text
stringlengths
28
935k
meta
stringlengths
137
139
red_pajama_subset
stringclasses
1 value
\section{Introduction} TODO: Motivation from (2 bit example, ...) A number of graph tasks can be seen as mapping nodes in a graph to vectors. Here is a list based on the restrictions on each of the vectors $v$ for a graph with $n$ nodes: \begin{table}[H] \centering \begin{tabular}{c|c|c} Task & Restrictions & Sample Algorithms \\ \hline Embedding & $v \in \mathbb{R}^k$ & Spectral embedding, DeepWalk \\ Soft multi-label clustering & $v \in [0,1]^k$ & ??? \\ Hard multi-label clustering & $v \in \{0,1\}^k$ & Spectral multi-label clustering \\ Soft clustering & $v \in [0,1]^k, \sum v = 1$ & Mixed-membership SBM, my HMM variant \\ Hard clustering & $v \in \{0,1\}^k, \sum v = 1$ & SBM, spectral clustering \end{tabular} \end{table} The more restrictive the vector, the more interpretable, but the mapping also loses more information about the graph. The development for multi-label clustering seems weak relative to the other tasks. As a baseline, I am aware of what I would call ``Spectral multi-label clustering'' for hard multi-label clustering: this algorithm sets the bits of the output based on the entrywise signs of the spectral embedding. There is some literature on this task under the name ``Non-exhaustive, overlapping clustering,'' but not much. \paragraph{Contrasting with NMF, standard single-label clustering, mixed membership models, etc.} Suppose we have a graph similar to \textsc{BlogCatalog} which logs friendships between a population of people. There are $k\approx 15$ possible interests (cooking, baseball, gaming, etc.) people can have, and people are friends if and only if they share at least 2 interests. Suppose the population includes people with all possible combinations of the interests. Then this is a rank $\sim 2^k$ friendship graph, so NMF methods, and any methods just based on matrix factorization, can only exactly factor this graph with rank $\sim 2^k$. However, a multi-label clustering model, like the one described in Section~\ref{sec:model}, can theoretically exactly factor such a graph with $\sim k$-rank matrices. This is due to the entrywise nonlinearity on the outside of the factorization, which is not present in standard NMF. \paragraph{Further contrast with single-label clustering} Now suppose the original friendship graph was between people in the USA, and we are adding a second population from China. Suppose there are no international friendships, but the friendship structure is exactly the same in China and the USA in terms of the generation of friendships from the same $k$ interests. With single-label clustering, if we needed $c$ clusters to describe the population in the USA, we would need an additional $c$ clusters to also model the Chinese population. But with a multi-label clustering model like the one in Section~\ref{sec:model}, we can still exactly model the population by adding just $2$ additional clusters/attributes, namely ``is American'' and ``is Chinese'' attributes. \section{Generative Model}\label{sec:model} Consider the set of symmetric, unweighted graphs on $n$ nodes, i.e. the set of symmetric $A \in \{0,1\}^{n \times n}$. Here is an edge-independent, generative model for such graphs which sets the probability of an edge existing between nodes $i$ and $j$ as follows: \[ p_{ij} = \sigma\left( v_i^T W v_j \right) \] where $\sigma$ is the logistic function, $W \in \mathbb{R}^{k \times k}$ is a symmetric matrix, and $v_i$ and $v_j$ are column vectors in $[0,1]^{k}$. $k$ is the number of clusters, $v_i$ and $v_j$ are the soft multi-label clusterings of nodes $i$ and $j$, and $W$ is a cluster affinity matrix. This could be trained with a log-loss on a graph to recover a soft multi-label clustering, the sequence of all $\{v_i\}_{i=1}^n$. \medskip\noindent\textbf{Summary of Main Contributions.} The key contributions of this work are as follows: \begin{itemize} \item \textbf{Multi-label Graph-based Clustering:} Clearly motivating and defining (and naming) the node multi-label clustering / attribute assignment task. \item Generative Model. Providing a graph generative model for the task. Possibly also providing model variants that apply to heterogeneous, directed, and/or weighted graphs. \item Theoretical results and analysis \item From Homophily to Heterophily: Model generalizes for both homophily and heterophily settings. \item Providing an algorithm to fit the model. The algorithm should be able to operate in a real-time, online setting. \item Results on real-world graphs \end{itemize} \section{Related Work} \label{sec:related-work} TODO \section{Problem Formulation} \section{Approach} \section{Results} \section{Conclusion} \end{document} \section{Introduction}\label{sec:intro} Graphs naturally arise in data from a variety of fields including sociology~\citep{mason2007graph}, biology~\citep{scott1988social}, and computer networking~\citep{bonato2004survey}. A key underlying task in machine learning for graph data is forming models of graphs which can predict edges between nodes, form useful representations of nodes, and reveal interpretable structure in the graph, such as detecting clusters of nodes. Many graph models fall under the framework of edge-independent graph generative models, which can output the probabilities of edges existing between any pair of nodes. The parameters of such models can be trained iteratively on the network, or some fraction of the network which is known, in the link prediction task, e.g., by minimizing a cross-entropy loss. To choose among these models, one must consider whether the model is capable of expressing structures of interest in the graph, as well as the interpretability of the model. \paragraph{Expressiveness} As real-world graphs are high-dimensional objects, graph models generally compress information about the graph. Such models are exemplified by the family of dot product models, which associate each node with a real-valued ``embedding'' vector; the predicted probability of the link between two nodes increases with the dot product of their embedding vectors. These models can alternatively be seen as factorizing the adjacency matrix of the graph in terms of a low-rank matrix. Recent work~\citep{seshadhri2020impossibility} has shown that dot product models are limited in their ability to model common structures in real-world graphs, such as triangles incident only on low-degree nodes. In response, \cite{chanpuriya2020node} showed that with the logistic PCA (LPCA) model, which has two embeddings per node (i.e. using the dot product of the ``left'' embedding of one node and the ``right'' embedding of another), not only can such structures be represented, but further, any graph can be exactly represented with embedding vectors whose lengths are linear in the maximum degree of the graph. \cite{peysakhovich2021attract} show that the limitations of the single-embedding model, which are overcome by having two embeddings, stem from only being able to represent adjacency matrices which are positive semi-definite, which prevents them from representing heterophilous structures in graphs; heterophilous structures are those wherein dissimilar nodes are linked. \paragraph{Heterophily: Motivating example} To demonstrate how heterophily can manifest in networks, as well as how models which assume homophily can fail to represent such networks, we provide a simple synthetic example. Suppose a recruiting website allows its members to contact each other; we construct a graph of these members, with an edge indicating that two members have been in contact. Members are either recruiters or non-recruiters, and each member comes from one of ten locations (e.g., a city). Members from the same location are likely to contact each other; this typifies homophily, wherein links occur between similar nodes. Furthermore, recruiters are unlikely to contact other recruiters, and non-recruiters are unlikely to contact other non-recruiters; this typifies heterophily. Figure~\ref{fig:synth_true} shows an instantiation of such an adjacency matrix with $1000$ nodes, which are randomly assigned to one of the ten locations and one of recruiter / non-recruiter. We recreate this network with our embedding model and the \textsc{BigClam} algorithm of \cite{yang2013overlapping}, which explicitly assumes homophily. We also compare with the best low-rank approximation to the adjacency matrix in terms of Frobenius error; this is the SVD of the matrix, discarding all but the top singular values. In Figure~\ref{fig:synth_true}, we show how \textsc{BigClam} captures only the ten communities based on location, i.e., only the homophilous structure, and fails to capture the heterophilous distinction between recruiters and non-recruiters. We also plot the error of the reconstructions as the embedding length increases. There are $10\cdot 2 = 20$ different kinds of nodes, meaning the expected adjacency matrix is rank-$20$, and our model maintains the lowest error up to this embedding length; by contrast, \textsc{BigClam} is unable to decrease error after capturing location information with length-$10$ embeddings. \begin{figure} \centering \includegraphics[width=0.6\textwidth]{plots/synth/syntheticgraph.png} \caption{The motivating synthetic graph. The expected adjacency matrix (left) and the sampled matrix (right); the latter is passed to the training algorithms. The network is approximately a union of ten bipartite graphs, each of which correspond to recruiters and non-recruiters at one of the ten locations.} \label{fig:synth_true} \end{figure} \begin{figure} \centering \includegraphics[width=0.75\textwidth]{plots/synth/syntheticgraph_recons.png} \includegraphics[width=0.24\textwidth]{plots/synth/synthgraph_errors.png} \caption{(Right) Reconstructions of the motivating synthetic graph of Figure~\ref{fig:synth_true} with SVD, \textsc{BigClam}, and our model, using 12 communities or singular vectors. Note the lack of the small diagonal structure in \textsc{BigClam}'s reconstruction; this corresponds to its inability to capture the heterophilous interaction between recruiters and non-recruiters. (Left) Frobenius error when reconstructing the motivating synthetic graph of Figure~\ref{fig:synth_true} with SVD, \textsc{BigClam}, and our model, as the embedding length is varied. The error is normalized by the sum of the true adjacency matrix (i.e., the number of edges).} \label{fig:synth_recons} \end{figure} \paragraph{Interpretability} Beyond being able to capture a given network accurately, it is often desirable for a graph model to form interpretable representations of nodes and to produce edge probabilities in an interpretable fashion. Dot product models can achieve this by restricting the node embeddings to be nonnegative. Nonnegative factorization has long been used to decompose data into parts~\citep{donoho2004does}. In the context of graphs, this entails decomposing the set of nodes of the network into clusters or communities. In particular, each entry of the nonnegative embedding vector of a node represents the intensity with which the node participates in a community. Note that this allows the edge probabilities output by dot product models to be interpretable in terms of coparticipation in communities. Depending on the model, these vectors may have restrictions such as a sum-to-one requirement, meaning the node is assigned a categorical distribution over communities. The least restrictive and most expressive case is that of soft assignments to overlapping communities, where the entries can vary totally independently. In models for this case, the output of the dot product is often mapped through a nonlinear link function to produce a probability, i.e. to ensure the value lies in $[0,1]$. This link function ideally also facilitates straightforward interpretation. We propose the first edge-independent graph generative model that is a) expressive enough to capture heterophily, b) interpretable in that it produces nonnegative embeddings, and c) optimizes effectively on real-world graphs with gradient descent on a cross-entropy loss. \paragraph{Summary of main contributions} The key contributions of this work are as follows: \begin{itemize} \item We introduce a graph generative model, based on nonnegative matrix factorization, which is able to represent both heterophily and overlapping communities. Our model outputs link probabilities which are interpretable in terms of the communities it detects. \item We provide a scheme for initialization of the nonnegative factors using the arbitrary real factors generated by logistic PCA. We show theoretically how a graph which is represented exactly by LPCA can also be represented exactly by our model. \item We show theoretically that, with a small number of communities, our model can exactly represent a natural class of graphs which exhibits both heterophily and overlapping communities. \item In experiments, we show that our algorithm is competitive on real-world graphs in terms of representing the network, doing link prediction, and producing communities which align with ground-truth. \end{itemize} \section{Graph Generative Model}\label{sec:model} Consider the set of undirected, unweighted graphs on $n$ nodes, i.e., the set of graphs with symmetric adjacency matrices in $\{0,1\}^{n \times n}$. We propose an edge-independent, generative model for such graphs. Given a diagonal matrix ${\bm{W}}\in\mathbb{R}^{k \times k}$ and a matrix ${\bm{V}} \in [0,1]^{n \times k}$, we set the probability of an edge existing between nodes $i$ and $j$ to be the $(i,j)$-th entry of matrix $\tilde{{\bm{A}}}$: \begin{align} \label{eqn:vwv} \tilde{{\bm{A}}} := \sigma( {\bm{V}}^\top {\bm{W}} {\bm{V}} ) , \end{align} where $\sigma$ is the logistic function. $k$ represents the number of clusters; intuitively, if ${\bm{v}}_i \in \mathbb{R}^k$ is the $i$-th row of matrix ${\bm{V}}$, then ${\bm{v}}_i$ is soft assignment of node $i$ to the $k$ communities. ${\bm{W}}$ can be viewed as a cluster affinity matrix. An equivalent alternative formulation is \begin{equation}~ \tilde{{\bm{A}}}_{i,j} = \sigma( {\bm{v}}_i {\bm{W}} {\bm{v}}_j^\top ). \end{equation} \paragraph{Interpretation} The edge probabilities output by this model have an intuitive interpretation, and to maximize interpretability, we focus on the case where ${\bm{W}}$ is diagonal. Recall that there is a one-to-one-to-one relationship between probability $p \in [0,1]$, odds $o=\tfrac{p}{1-p} \in [0,\infty)$, and logit $\ell = \log(o)\in (-\infty,+\infty)$. The logit of the link probability between nodes $i$ and $j$ is ${\bm{v}}_i^\top {\bm{W}} {\bm{v}}_j$, which is a summation of terms ${\bm{v}}_{ic} {\bm{v}}_{jc} {\bm{W}}_{cc}$ over all communities $c \in [k]$. If the nodes both fully participate in community $c$, that is, ${\bm{v}}_{ic} = {\bm{v}}_{jc} = 1$, then the edge logit is changed by ${\bm{W}}_{cc}$ starting from a baseline of $0$, or equivalently the odds of an edge is multiplied by $\exp({\bm{W}}_{cc})$ starting from a baseline odds of $1$; if either of the nodes participates only partially in community $c$, then the change in logit and odds is accordingly prorated. Homophily and heterophily also have a clear interpretaion in this model: homophilous communities are those with ${\bm{W}}_{cc} > 0$, where two nodes both participating in the community increases the odds of a link, whereas communities with ${\bm{W}}_{cc} < 0$ are heterophilous, and coparticipation decreases the odds of a link. \section{Related Work} \label{sec:related-work} \paragraph{Node clustering} There is extensive prior work on the node clustering problem~\citep{schaeffer2007graph,aggarwal2010survey,nascimento2011spectral}, perhaps the most well-known being the normalized cuts algorithm of \cite{shi2000normalized}, which produces a clustering based on the entrywise signs of an eigenvector of the graph Laplacian matrix. However, the clustering algorithms which are most relevant to our work are those based on non-negative matrix factorization (NMF)~\citep{lee1999learning,berry2007algorithms,wang2012nonnegative,gillis2020nonnegative}. One such algorithm is that of \cite{yu2005soft}, which approximately factors a graph's adjacency matrix $A \in \{0,1\}^{n \times n}$ into two positive matrices $H$ and $\Lambda$, where $H \in \mathbb{R}_+^{n \times k}$ is left-stochastic (i.e. each of its columns sums to $1$) and $\Lambda \in \mathbb{R}_+^{k \times k}$ is diagonal, such that $H \Lambda H^{\top} \approx A$. Here $H$ represents a soft clustering of the $n$ nodes into $k$ clusters, while the diagonal entries of $\Lambda$ represent the prevalence of edges within clusters. Note the similarity of the factorization to our model, save for the lack of a nonlinearity. Other NMF approaches include those of \cite{ding2008nonnegative}, \cite{yang2012clustering}, \cite{kuang2012symmetric}, and \cite{kuang2015symnmf} (\textsc{SymNMF}). \paragraph{Modeling heterophily} Much of the existing work on graph models has an underlying assumption of network homophily~\citep{newman2002assortative, johnson2010entropic, noldus2015assortativity}. There has been significant recent interest in the limitations of graph neural network (GNN) models~\citep{duvenaud2015convolutional,li2015gated,kipf2016semi,hamilton2017inductive} at addressing network heterophily~\citep{nt2019revisiting,zhu2020beyond}, as well as proposed solutions \citep{pei2020geom,zhu2020graph,yan2021two}, but relatively less work for more fundamental models such as those for clustering. Some existing NMF approaches to clustering do naturally model heterophilous structure in networks. The model of \cite{nourbakhsh2014matrix}, for example, is similar to that of \cite{yu2005soft}, but allows the cluster affinity matrix $\Lambda$ to be non-diagonal; this allows for inter-cluster edge affinity to exceed intra-cluster edge affinity, so heterophily can arise in this model, though it is not a focus of their work. Further, the model of \cite{miller2009nonparametric} is similar to ours and also allows for heterophily, though it restricts the cluster assignment matrix ${\bm{V}}$ to be binary; additionally, their training algorithm is not based on gradient descent as ours is, and it does not scale to large networks. More recently, \cite{peysakhovich2021attract} propose a decomposition of the form ${\bm{A}} \approx {\bm{D}} + {\bm{B}} {\bm{B}}^\top - {\bm{C}} {\bm{C}}^\top$, where ${\bm{D}} \in \mathbb{R}^{n \times n}$ is diagonal and ${\bm{B}},{\bm{C}} \in \mathbb{R}^{n \times k}$ are low-rank; the authors discuss how, interestingly, this model separates the homophilous and heterophilous structure into different factors, namely ${\bm{B}}$ and ${\bm{C}}$. However, this work does not pursue a clustering interpretation or investigate setting the factors ${\bm{B}}$ and ${\bm{C}}$ to be nonnegative. One stage of our training algorithm uses a similar decomposition, though it includes the nonnegativity constraint; this is detailed in Section~\ref{sec:training}. \paragraph{Overlapping clustering} Many models discussed above focus on the single-label clustering task. We are interested in the closely-related but distinct task of multi-label clustering, also known as overlapping community detection~\citep{xie2013overlapping, javed2018community}. The \textsc{BigClam} algorithm of \cite{yang2013overlapping} uses the following generative model for this task: the probability of a link between two nodes $i$ and $j$ is given by $1 - \exp(-\bm{f}_i \cdot \bm{f}_j)$, where $\bm{f}_i, \bm{f}_j \in \mathbb{R}_+^k$ represent the intensities with which the nodes participate in each of the $k$ communities. This model allows for intersections of communities to be especially dense with edges, which the authors generally observe in real-world networks; by contrast, they claim that prior state-of-the-art approaches, including ones based on clustering links~\citep{ahn2010link} and clique detection~\citep{palla2005uncovering}, as well as a mixed-membership variant~\citep{airoldi2008mixed} of the stochastic block model~\citep{holland1983stochastic}, implicitly assume that intersections are sparse. \textsc{BigClam} assumes strict homophily of the communities, whereas our model allows for both homophily and heterophily. Additionally, unlike in our model, there is no upper bound to the intensities of community participation (i.e. the entries of each $\bm{f}$), so it is unclear how to incorporate prior knowledge about community membership in the form of binary labels, as in a semi-supervised situation. The approach of \cite{zhang2012overlapping} is more similar to ours and more amenable to such prior information in that community assignments are bounded; specifically, the model is similar to those of \cite{yu2005soft} and \cite{nourbakhsh2014matrix}, but allows the cluster assignment matrix $H$ to be an arbitrary matrix of probabilities rather left-stochastic. However, unlike our model and \textsc{BigClam}, these models lack a nonlinear linking function; recent work outside clustering and community detection on graph generative models~\citep{rendsburg2020netgan,chanpuriya2020node} suggests that the addition of a nonlinear linking function, specifically softmax and logistic nonlinearities as in our model, can make matrix factorization-based graph models more expressive. Lastly, a recent approach is the \textsc{vGraph} model of \cite{sun2019vgraph}, which also lacks a final nonlinear linking function, but, interestingly, has an intermediate linking function: the matrix factors (i.e. the cluster assignment matrices) themselves are a product of learned embeddings for the nodes and communities, put through a softmax linking function. Their algorithm ultimately determines overlapping communities as in link clustering approaches, and they find that it generally achieves state-of-the-art results in matching ground-truth communities; as discussed in Section~\ref{sec:exp-ground}, we find that our algorithm's performance on this task compares favorably to \textsc{vGraph}. \section{Training Algorithm}\label{sec:training} Given an input graph ${\bm{A}} \in \{0,1\}^{n \times n}$, we find ${\bm{V}}$ and ${\bm{W}}$ such that the model produces $\tilde{{\bm{A}}}=\sigma({\bm{V}} {\bm{W}} {\bm{V}}^\top) \in (0,1)^{n \times n}$ as in Eq.~(\ref{eqn:vwv}) which approximately matches ${\bm{A}}$. In particular, we train the model to minimize the sum of binary cross-entropies of the link predictions over all pairs of nodes: \begin{equation}~\label{eqn:ew_loss} R = -\sum\left( {\bm{A}} \log(\tilde{{\bm{A}}}) \right) - \sum\left( (1-{\bm{A}}) \log(1-\tilde{{\bm{A}}}) \right), \end{equation} where $\sum{}$ denotes the scalar summation of all entries in the matrix. Rather than optimizing the model of Equation~\ref{eqn:vwv} directly, we optimize different parametrizations which we find are more effective. This optimization comprises three stages. Note that while we outline a non-stochastic version of the algorithm, each stage can generalize straightforwardly to a stochastic version, i.e., by sampling links and non-links for the loss function. \paragraph{First stage} We first fit the unconstrained logistic principal components analysis (LPCA) model to the input graph as in \cite{chanpuriya2020node}. This model reconstructs a graph $\tilde{{\bm{A}}} \in \{0,1\}^{n \times n}$ using logit factors ${\bm{X}},{\bm{Y}} \in \mathbb{R}^{n \times k}$ via the model \begin{equation}~\label{eqn:lpca_model} \tilde{{\bm{A}}} = \sigma({\bm{X}} {\bm{Y}}^\top). \end{equation} Factors ${\bm{X}}$ and ${\bm{Y}}$ are initialized randomly, then trained via gradient descent on the loss of Equation~\ref{eqn:ew_loss} so that $\tilde{{\bm{A}}} \approx {\bm{A}}$. Note that entries of the factors ${\bm{X}}$ and ${\bm{Y}}$ are not necessarily nonnegative; hence this model does not directly admit an interpretation as community detection. Unlike \cite{chanpuriya2020node}, which explicitly seeks to exactly fit the graph, i.e., to find ${\bm{X}},{\bm{Y}}$ such that $\tilde{{\bm{A}}} = {\bm{A}}$, and does not explore the graph structure which is recovered in the factors, we employ $L_2$ regularization of the factors to avoid overfitting. See Algorithm~\ref{alg:fit_unconstrained_lpca} for pseudocode of this stage. \paragraph{Second stage} The factors ${\bm{X}}$ and ${\bm{Y}}$ from the first stage are processed into nonnegative factors ${\bm{B}} \in \mathbb{R}_+^{n \times k_B}$ and ${\bm{C}} \in \mathbb{R}_+^{n \times k_C}$ such that $k_B + k_C = 3k$ and \begin{equation*} {\bm{B}} {\bm{B}}^\top - {\bm{C}} {\bm{C}}^\top \approx \tfrac{1}{2} \left( {\bm{X}}{\bm{Y}}^\top + {\bm{Y}}{\bm{X}}^\top \right). \end{equation*} Note that the left-hand side can only represent symmetric matrices. Let ${\bm{L}} = \tfrac{1}{2} \left( {\bm{X}}{\bm{Y}}^\top + {\bm{Y}}{\bm{X}}^\top \right)$. ${\bm{L}}$ is a symmetrization of ${\bm{X}}{\bm{Y}}^\top$; if $\sigma({\bm{X}}{\bm{Y}}^\top)$ closely approximates the symmetric matrix ${\bm{A}}$ as desired, so too should the symmetrized logits. Pseudocode for this stage is given in Algorithm~\ref{alg:init_constrained}. The concept of this stage is to first separate the logit matrix ${\bm{L}}$ into a sum and difference of rank-$1$ components via eigendecomposition. Each of these components can be written as $+{\bm{v}} {\bm{v}}^\top$ or $-{\bm{v}} {\bm{v}}^\top$ with ${\bm{v}} \in \mathbb{R}^n$, where the sign depends on the sign of the eigenvalue. Each component is then separated into a sum or difference of three outer products of nonnegative vectors, via the claim below. \begin{claim} Let $\phi : \mathbb{R} \rightarrow \mathbb{R}$ denote the ReLU activation function, i.e., $\phi(z) = \max\{z,0\}$. For any vector ${\bm{v}}$, \begin{align*} {\bm{v}} {\bm{v}}^\top = 2 \phi({\bm{v}}) \phi({\bm{v}})^\top + 2 \phi(-{\bm{v}}) \phi(-{\bm{v}})^\top - |{\bm{v}}| |{\bm{v}}|^\top \end{align*} \end{claim} \begin{proof} Take any ${\bm{v}} \in \mathbb{R}^k$. Then \begin{align*} {\bm{v}} {\bm{v}}^\top = & ~ ( \phi({\bm{v}}) - \phi(-{\bm{v}}) ) \cdot ( \phi({\bm{v}})^\top - \phi(-{\bm{v}})^\top ) \\ = & ~ \phi({\bm{v}}) \phi({\bm{v}})^\top + \phi(-{\bm{v}}) \phi(-{\bm{v}})^\top - \phi({\bm{v}}) \phi(-{\bm{v}})^\top - \phi(-{\bm{v}}) \phi({\bm{v}})^\top \\ = & ~ 2 \phi({\bm{v}}) \phi({\bm{v}})^\top + 2 \phi(-{\bm{v}}) \phi(-{\bm{v}})^\top - ( \phi({\bm{v}}) + \phi(-{\bm{v}}) ) \cdot ( \phi({\bm{v}}) + \phi(-{\bm{v}}) )^\top \\ = & ~ 2 \phi({\bm{v}}) \phi({\bm{v}})^\top + 2 \phi(-{\bm{v}}) \phi(-{\bm{v}})^\top - |{\bm{v}}| |{\bm{v}}|^\top, \end{align*} where the first step follows from ${\bm{v}}= \phi({\bm{v}})- \phi(-{\bm{v}})$, and the last step follows from $|{\bm{v}}| = \phi({\bm{v}}) + \phi(-{\bm{v}})$. \end{proof} Algorithm~\ref{alg:init_constrained} constitutes a constructive proof of the following theorem. \begin{theorem}[Nonnegative Factorization of Rank-$k$ Matrices]\label{thm:nneg_rank} Given a symmetric rank-$k$ matrix ${\bm{L}} \in \mathbb{R}^{n \times n}$, there exist nonnegative matrices ${\bm{B}} \in \mathbb{R}_+^{n \times k_B}$ and ${\bm{C}} \in \mathbb{R}_+^{n \times k_C}$ such that $k_B + k_C = 3k$ and ${\bm{B}} {\bm{B}}^\top - {\bm{C}} {\bm{C}}^\top = {\bm{L}}$. \end{theorem} \paragraph{Third stage} The factors ${\bm{B}}$ and ${\bm{C}}$ from the previous stage serve as initialization for the final stage of optimization. Of the $3k$ communities generated by the previous stage, we keep the top $k$ which are most impactful on the edge logits, as ranked by the $L_2$ norms of the columns of ${\bm{B}}$ and ${\bm{C}}$. Now ${\bm{B}} \in \mathbb{R}_+^{n \times k_B}$ and ${\bm{C}} \in \mathbb{R}_+^{n \times k_C}$ such that $k_B + k_C = k$. These remaining $k$ communities are then directly optimized by minimizing the cross-entropy loss of Equation~\ref{eqn:ew_loss} on the following graph model: \begin{equation}~\label{eqn:atr_rep_model} \tilde{{\bm{A}}} = \sigma\left( {\bm{B}} {\bm{B}}^\top - {\bm{C}} {\bm{C}}^\top \right). \end{equation} This stage proceeds exactly as the first stage, i.e. as in Algorithm~\ref{alg:fit_unconstrained_lpca}, except with Equation~\ref{eqn:atr_rep_model} as the generative model rather than Equation~\ref{eqn:lpca_model}. Additionally, the optimized parameters ${\bm{B}}$ and ${\bm{C}}$ are constrained to be nonnegative. The model in Equation~\ref{eqn:atr_rep_model} is exactly equivalent to that of Equation~\ref{eqn:vwv}, where ${\bm{W}}$ is constrained to be diagonal (i.e. $\diag({\bm{w}})$), and parameters can be transformed to that form with a small manipulation. \begin{claim}\label{thm:bc_to_vwv} Given nonnegative matrices ${\bm{B}} \in \mathbb{R}_+^{n \times k_B}$ and ${\bm{C}} \in \mathbb{R}_+^{n \times k_C}$, letting $k=k_B+k_C$, there exist a matrix ${\bm{V}} \in [0,1]^{n \times k}$ and a diagonal matrix ${\bm{W}}\in\mathbb{R}^{k \times k}$ such that ${\bm{V}} {\bm{W}} {\bm{V}}^\top = {\bm{B}} {\bm{B}}^\top - {\bm{C}} {\bm{C}}^\top$. \end{claim} \begin{proof} Let ${\bm{m}}_B$ and ${\bm{m}}_C$ be the vectors containing the maximums of each column of ${\bm{B}}$ and ${\bm{C}}$, respectively. The equality and the constraints on ${\bm{V}}$ and ${\bm{W}}$ are satisfied by setting \begin{align*} {\bm{V}} &= \begin{pmatrix} {\bm{B}} \times \diag\left({\bm{m}}_B^{-1}\right); & {\bm{C}} \times \diag\left({\bm{m}}_C^{-1}\right) \end{pmatrix} \\ % {\bm{W}} &= \diag\left( \begin{pmatrix} +{\bm{m}}_B^{2}; & -{\bm{m}}_C^{2} \end{pmatrix} \right) . \end{align*} \end{proof} \begin{algorithm \caption{Fitting the Unconstrained LPCA Model} \label{alg:fit_unconstrained_lpca} \textbf{input} adjacency matrix ${\bm{A}} \in \{0,1\}^{n \times n}$, rank $k < n$, regularization weight $\lambda\geq 0$, number of iters. $I$ \\ \textbf{output} factors ${\bm{X}},{\bm{Y}} \in \mathbb{R}^{n \times k}$ such that $\sigma({\bm{X}}{\bm{Y}}^\top) \approx {\bm{A}}$ \begin{algorithmic}[1] \State Initialize elements of ${\bm{X}},{\bm{Y}} \in \mathbb{R}^{n \times k}$ randomly \For{$i \gets 1$ to $I$} \State $\tilde{{\bm{A}}} \gets \sigma({\bm{X}}{\bm{Y}}^\top)$ \Comment{\textcolor{gray}{reconstructed adjacency matrix}} \State $R \gets -\sum\left( {\bm{A}} \log(\tilde{{\bm{A}}}) \right) - \sum\left( (1-{\bm{A}}) \log(1-\tilde{{\bm{A}}}) \right) $ \Comment{\textcolor{gray}{cross-entropy loss}} \State $R \gets R + \lambda \left(\Vert {\bm{X}} \Vert_F^2 + \Vert {\bm{Y}} \Vert_F^2\right) $ \Comment{\textcolor{gray}{regularization loss}} \State Calculate $\partial_{{\bm{X}},{\bm{Y}}} R$ via differentiation through Steps 3 to 5 \State Update ${\bm{X}},{\bm{Y}}$ to minimize $R$ using $\partial_{{\bm{X}},{\bm{Y}}} R$ \EndFor \State \textbf{return} ${\bm{X}},{\bm{Y}}$ \end{algorithmic} \end{algorithm} \begin{algorithm \caption{Initializing the Constrained Model from LPCA Logits} \label{alg:init_constrained} \textbf{input} logit factors ${\bm{X}},{\bm{Y}} \in \mathbb{R}^{n \times k}$ \\ \textbf{output} ${\bm{B}},{\bm{C}} \in [0,\infty)^{n \times 3k}$ such that ${\bm{B}} {\bm{B}}^\top - {\bm{C}} {\bm{C}}^\top \approx \tfrac{1}{2} \left( {\bm{X}}{\bm{Y}}^\top + {\bm{Y}}{\bm{X}}^\top \right)$ \begin{algorithmic}[1] \State Set ${\bm{Q}}\in\mathbb{R}^{n \times k}$ and $\bm{\lambda} \in \mathbb{R}^{k}$ by truncated eigendecomposition \newline such that ${\bm{Q}} \times \diag(\bm{\lambda}) \times {\bm{Q}}^\top \approx \tfrac{1}{2} ( {\bm{X}}{\bm{Y}}^\top + {\bm{Y}}{\bm{X}}^\top )$ % \State ${\bm{B}}^* \gets {\bm{Q}}^+ \times \diag(\sqrt{+\bm{\lambda^+}})$, where $\bm{\lambda^+}$, ${\bm{Q}}^+$ are the positive eigenvalues/vectors \State ${\bm{C}}^* \gets {\bm{Q}}^- \times \diag(\sqrt{-\bm{\lambda^-}})$, where $\bm{\lambda^-}$, ${\bm{Q}}^-$ are the negative eigenvalues/vectors % \State ${\bm{B}} \gets \begin{pmatrix} \sqrt{2} \phi({\bm{B}}^*); & \sqrt{2} \phi(- {\bm{B}}^* ); & | {\bm{C}}^* | \end{pmatrix}$ \Comment{\textcolor{gray}{$\phi$ and $|\cdot|$ are entrywise ReLU and absolute value}} \State ${\bm{C}} \gets \begin{pmatrix} \sqrt{2} \phi({\bm{C}}^*); & \sqrt{2} \phi(-{\bm{C}}^*); & |{\bm{B}}^*| \end{pmatrix}$ \State \textbf{return} ${\bm{B}},{\bm{C}}$ \end{algorithmic} \end{algorithm} \paragraph{Implementation details} Our implementation uses PyTorch~\citep{NEURIPS2019_9015} for automatic differentiation and minimizes the loss using the SciPy~\citep{scipy} implementation of the L-BFGS~\citep{liu1989limited,zhu1997algorithm} algorithm with default hyperparameters and up to a maximum of 200 iterations for both stages of optimization. We set the magnitude of the regularization to $10$ times the mean entry value of the factor matrices. We include code in the form of a Jupyter notebook~\citep{PER-GRA:2007} demo in the supplemental material. \section{Theoretical Results} \label{sec:theory} \textsc{SymNMF} and \textsc{BigClam}, among other models for undirected graph, assume network homophily, which precludes low-rank representation of networks with heterophily. We first show that our model is highly expressive in that it can capture arbitrary homophilous and heterophilous structure: using a result from \cite{chanpuriya2020node}, we show that our model can exactly reconstruct a graph using a number of communities that is linear in the maximum degree of the graph. \begin{lemma}[Exact LPCA Embeddings for Bounded-Degree Graphs, \cite{chanpuriya2020node}]\label{thm:sparse} Let ${\bm{A}} \in \{0,1\}^{n \times n}$ be the adjacency matrix of a graph $G$ with maximum degree $c$. Then there exist matrices ${\bm{X}},{\bm{Y}} \in \mathbb{R}^{n \times (2c+1)}$ such that $({\bm{X}} {\bm{Y}}^\top)_{ij} > 0$ if ${\bm{A}}_{ij} = 1$ and $({\bm{X}} {\bm{Y}}^\top)_{ij} < 0$ if ${\bm{A}}_{ij} = 0$. \end{lemma} \begin{theorem}[Interpretable Exact Reconstruction for Bounded-Degree Graphs] Let ${\bm{A}} \in \{0,1\}^{n \times n}$ be the adjacency matrix of a graph $G$ with maximum degree $c$. Let $k=12c+6$. For any $\epsilon>0$, there exist $mV \in [0,1]^{n\times k}$ and diagonal ${\bm{W}} \in \mathbb{R}^{k \times k}$ such that $\norm{\sigma ({\bm{V}} {\bm{W}} {\bm{V}}^\top) - {\bm{A}}}_\text{F} < \epsilon$. \end{theorem} \begin{proof} Lemma~\ref{thm:sparse} guarantees the existence of matrices ${\bm{X}},{\bm{Y}} \in \mathbb{R}^{n \times (2c+1)}$ such that $({\bm{X}} {\bm{Y}}^\top)_{ij} > 0$ if ${\bm{A}}_{ij} = 1$ and $({\bm{X}} {\bm{Y}}^\top)_{ij} < 0$ if ${\bm{A}}_{ij} = 0$. Let ${\bm{L}} = \tfrac{1}{2}({\bm{X}} {\bm{Y}}^\top + {\bm{Y}} {\bm{X}}^\top)$, the symmetrization of ${\bm{X}} {\bm{Y}}^\top$. Since ${\bm{A}}$ is symmetric, it still holds that ${\bm{L}}_{ij} > 0$ if ${\bm{A}}_{ij} = 1$ and ${\bm{L}}_{ij} < 0$ if ${\bm{A}}_{ij} = 0$; further, as the sum of two rank-$(2c+1)$ matrices, the rank of ${\bm{L}}$ is at most $2\cdot (2c+1)$. Finally, by Claim~\ref{thm:nneg_rank} and Theorem~\ref{thm:bc_to_vwv}, with $k=3\cdot 2\cdot (2c+1) = 12c+6$, there exist matrices ${\bm{V}} \in [0,1]^{n\times k}$ and diagonal ${\bm{W}} \in \mathbb{R}^{k \times k}$ such that ${\bm{V}} {\bm{W}} {\bm{V}}^\top = {\bm{L}}$, meaning still $({\bm{V}} {\bm{W}} {\bm{V}}^\top)_{ij} > 0$ if ${\bm{A}}_{ij} = 1$ and $({\bm{V}} {\bm{W}} {\bm{V}}^\top)_{ij} < 0$ if ${\bm{A}}_{ij} = 0$. Since $\lim_{z\to -\infty} \sigma(z) = 0$ and $\lim_{z\to +\infty} \sigma(z) = 1$, it follows that \[ \lim_{s\to \infty} \sigma \left({\bm{V}} (s{\bm{W}}) {\bm{V}}^\top \right) = \lim_{s\to \infty} \sigma \left(s {\bm{V}} {\bm{W}} {\bm{V}}^\top \right) = {\bm{A}}, \] that is, ${\bm{W}}$ can be scaled larger to match ${\bm{A}}$ arbitrarily closely. \end{proof} The above bound on the number of communities $k$ required for exact representation can be very loose. We additionally show that our model can exactly represent a natural family of graphs which exhibits both homophily and heterophily with small $k$. The family of graphs is defined below; roughly speaking, nodes in such graphs share an edge iff they coparticipate in some number of homophilous communities and don't coparticipate in a number of heterophilous communities. For example, the motivating graph described in Section~\ref{sec:intro} would be an instance of such a graph if there exists an edge between two nodes iff the two members are from the same location and have different roles (i.e., one is a recruiter and the other is a non-recruiter). \begin{theorem} Suppose there is an undirected, unweighted graph on $n$ nodes with adjacency matrix ${\bm{A}} \in \{0,1\}^{n \times n}$ whose edges are determined by an overlapping clustering and a ``thresholding'' integer $t \in \mathbb{Z}$ in the following way: for each vertex $i$, there are two binary vectors ${\bm{b}}_i \in \{0,1\}^{k_b}$ and ${\bm{c}}_i \in \{0,1\}^{k_c}$, and there is an edge between vertices $i$ and $j$ iff ${\bm{b}}_i \cdot {\bm{b}}_j - {\bm{c}}_i \cdot {\bm{c}}_j \geq t$. Then, for any $\epsilon > 0$, there exist ${\bm{V}} \in [0,1]^{n\times (k+1)}$ and diagonal ${\bm{W}} \in \mathbb{R}^{(k+1) \times (k+1)}$ such that $\norm{\sigma ({\bm{V}} {\bm{W}} {\bm{V}}^\top) - {\bm{A}}}_\text{F} < \epsilon$. \end{theorem} \begin{proof} Let the rows of ${\bm{B}} \in \{0,1\}^{n \times k_b}$ and ${\bm{C}} \in \{0,1\}^{n \times k_c}$ contain the vectors ${\bm{b}}$ and ${\bm{c}}$ of all nodes. By Claim~\ref{thm:bc_to_vwv}, we can find ${\bm{V}}^* \in [0,1]^{n\times k}$ and diagonal ${\bm{W}}^* \in \mathbb{R}^{k \times k}$ such that ${\bm{V}}^* {\bm{W}}^* {\bm{V}}^{*\top} = {\bm{B}} {\bm{B}}^\top - {\bm{C}} {\bm{C}}^\top$. Now let \begin{align*} {\bm{V}} = \begin{pmatrix} {\bm{V}}^* & \bm{1} \end{pmatrix} \qquad % {\bm{W}} = \begin{pmatrix} {\bm{W}}^* & 0 \\ 0 & \tfrac{1}{2}-t \end{pmatrix} . \end{align*} Then $({\bm{V}} {\bm{W}} {\bm{V}}^{\top})_{ij} = {\bm{b}}_i \cdot {\bm{b}}_j - {\bm{c}}_i \cdot {\bm{c}}_j + \tfrac{1}{2} - t$. Hence $({\bm{V}} {\bm{W}} {\bm{V}}^{\top})_{ij} > 0$ iff ${\bm{b}}_i \cdot {\bm{b}}_j - {\bm{c}}_i \cdot {\bm{c}}_j > t - \tfrac{1}{2}$, which is true iff ${\bm{A}}_{ij} = 1$ by the assumption on the graph. Similarly, $({\bm{V}} {\bm{W}} {\bm{V}}^{\top})_{ij} < 0$ iff ${\bm{A}}_{ij} = 0$. It follows that \[ \lim_{s\to \infty} \sigma \left({\bm{V}} (s{\bm{W}}) {\bm{V}}^\top \right) = \lim_{s\to \infty} \sigma \left(s {\bm{V}} {\bm{W}} {\bm{V}}^\top \right) = {\bm{A}}. \] \end{proof} \section{Experiments} \label{sec:exp} \subsection{Expressiveness} We investigate the expressiveness of our generative model, that is, the fidelity with which it can reproduce an input network. In Section~\ref{sec:intro}, we used a simple synthetic network to show that our model is able to represent heterophilous structures in addition to homophilous structure. We now evaluate the expressiveness of our model on a benchmark of real-world networks, summarized in Table~\ref{tab:datasets}. As with the synthetic graph, we fix the number of communities or singular vectors, fit the model, then evaluate several types of reconstruction error. In Figure~\ref{fig:real_recons}, we compare the results of our model with those of SVD, \textsc{BigClam}~\citep{yang2013overlapping}, and \textsc{SymNMF}~\citep{kuang2015symnmf}. The \textsc{BigClam} model is discussed in detail in Section~\ref{sec:related-work}. \textsc{SymNMF} simply factors the adjacency matrix as ${\bm{A}} \approx {\bm{H}} {\bm{H}}^\top$, where ${\bm{H}} \in \mathbb{R}_{+}^{n \times k}$; note that, like SVD, \textsc{SymNMF} does not necessarily output a matrix whose entries are probabilities (i.e., bounded in $[0,1]$), and hence it is not a graph generative model like ours and \textsc{BigClam}. For each method, we fix the number of communities or singular vectors at the number of ground-truth communities of the network. For a fair comparison with SVD, we do not regularize the training of the other methods. Our method consistently has the lowest reconstruction error, both in terms of Frobenius error and entrywise cross-entropy (Equation~\ref{eqn:ew_loss}). \begin{table \small \centering \caption{\label{tab:datasets} Datasets used in our experiments. As in \cite{sun2019vgraph}, for {\sc YouTube} and {\sc Amazon}, we take only nodes which participate in at least one of the largest $5$ ground-truth communities.} \begin{tabular}{llrrr} \toprule \textbf{Name} & \textbf{Reference} & \textbf{Nodes} & \textbf{Edges} & \textbf{Labels} \\ \midrule {\sc Blog} & \cite{tang2009relational} & 10,312 & 333,983 & 39 \\ {\sc YouTube} & \cite{yang2015defining} & 5,346 & 24,121 & 5 \\ {\sc POS} & \cite{mahoney} & 4,777 & 92,406 & 40 \\ {\sc PPI} & \cite{breitkreutz2007biogrid} & 3,852 & 76,546 & 50 \\ {\sc Amazon} & \cite{yang2015defining} & 794 & 2,109 & 5 \\ \bottomrule \end{tabular} \end{table} \begin{figure}[h] \centering \includegraphics[height=1.55in]{plots/real/real_recon_frob.png} \hspace{5pt} \includegraphics[height=1.55in]{plots/real/real_recon_ce.png} \caption{Error when reconstructing real-world graphs with \textsc{SymNMF}, SVD, \textsc{BigClam}, and our model. Frobenius error is normalized as in Figure~\ref{fig:synth_recons}; cross-entropy is normalized by the number of entries of the matrix ($n^2$).} \label{fig:real_recons} \end{figure} \subsection{Similarity to Ground-Truth Clusters}\label{sec:exp-ground} \vspace{-2pt} As a way of assessing the interpretability of the clusters generated by our method, we evaluate the similarity of the clusters to ground-truth communities, and we compare with results from other overlapping clustering algorithms. For all methods, we set the number of communities to be detected as the number of ground-truth communities. We report F1-Score as computed in \cite{yang2013overlapping}. See Figure~\ref{fig:real_gt}. The performance of our method is competitive with \textsc{SymNMF}, \textsc{BigClam}, and vGraph~\citep{sun2019vgraph}. \begin{figure}[h] \centering \includegraphics[height=1.75in]{plots/real/real_gt.png} \caption{Similarity of recovered communities to ground-truth communities of real-world datasets. We were unable to run the authors' implementation of \textsc{vGraph} on \textsc{Blog} with 16 GB of memory.} \label{fig:real_gt} \end{figure} \vspace{-5pt} \subsection{Link Prediction}\label{sec:linkpred} \vspace{-2pt} We assess the predictive power of our generative model via the link prediction task on real-world networks. As discussed in Section~\ref{sec:model}, the link probabilities output by our model are interpretable in terms of a clustering of nodes that it generates; we compare results with our method to those of other models which permit similar interpretation, namely \textsc{BigCLAM} and \textsc{SymNMF}. We randomly select 10\% of node pairs to hold out (i.e. 10\% of entries of the adjacency matrix), fit the models on the remaining 90\%, then use the trained models to predict whether there are links between node pairs in the held out 10\%. As a baseline for comparison, we also show results for randomly predicting link or no link with equal probability. See Figure~\ref{fig:real_linkpred} for the results. The performance of our method is competitive with or exceeds that of the other methods in terms of F1 Score. \begin{figure}[h] \centering \includegraphics[height=1.75in]{plots/real/real_linkpred.png} \caption{Accuracy of link prediction on real-world datasets.} \label{fig:real_linkpred} \end{figure} \vspace{-7pt} \section{Conclusion} \vspace{-2pt} We introduce an interpretable, edge-independent graph generative model that is highly expressive at representing both heterophily and overlapping communities. Our experimental results show its effectiveness on many important tasks. Further, our theoretical results demonstrate the expressiveness of our model in its ability to exactly reconstruct a graph using a number of clusters that is linear in the maximum degree, along with its ability to capture both heterophily and homophily in the data. In general, a deeper understanding of the expressiveness of both nonnegative and arbitrary low-rank logit models for graphs, as well as convergence properties of training algorithms, is an interesting direction for future research. \bibliographystyle{iclr2021_conference}
{'timestamp': '2021-11-05T01:21:57', 'yymm': '2111', 'arxiv_id': '2111.03030', 'language': 'en', 'url': 'https://arxiv.org/abs/2111.03030'}
arxiv
\section{Introduction} Energy systems optimization problems frequently exhibit multiple, competing objectives, such as economic vs environmental considerations \cite{PISTIKOPOULOS2021107252}. For instance, minimizing energy consumption, incurred costs, and greenhouse gas emissions are differing goals that can result in significantly different optimal operating patterns in energy-intensive processes \cite{kelley2018demand}. Likewise, peak performance and long-term degradation frequently represent conflicting objectives when designing new energy systems, such as lithium ion batteries \cite{liu2017optimizing}. In these cases, conventional mathematical optimization cannot locate a single solution that is optimal in terms of all given objectives. Rather, \textit{multi-objective} optimization must be employed, wherein trade-offs between the competing objectives are explored. Specifically, multi-objective optimization seeks to find a set of solutions, called Pareto optimal points, that are optimal in terms of the trade-offs between objectives. A desired solution can then be selected from the optimal set based on other considerations. A second, distinct challenge common in optimization of energy systems is the complexity of involved mathematical models. Energy systems are often described by multi-scale, distributed, and/or nonlinear models that can be computationally expensive to evaluate. Furthermore, multiple expensive function evaluations may be required to approximate derivative information. These models may also involve categorical input variables, e.g.,\ selecting from available equipment, influencing the objective functions but for which we cannot compute derivatives or establish a ranking between different categories. Deterministic (global) optimization of the resulting models is invariably impractical using current technologies, motivating instead the use of data-driven, or \textit{derivative-free}, optimization approaches. These approaches treat a complex energy systems model as an input-output ``black box'' model during optimization, or a ``grey box'' model if some model equations are retained \cite{BOUKOUVALA2016701, beykal2018optimal}. The predominant approaches for black-box optimization are (i) \textit{evolution-based}, where selection heuristics are used to choose promising inputs for successive generations, or (ii) \textit{surrogate-model-based}, where an internal surrogate model is constructed to approximate the input-output behavior \citep{bhosekar2018surrogateReview}. Given the above, several recent research efforts have focused on multi-objective, black-box optimization, with particular emphasis on applications in energy systems. Successful applications include optimization of wind-farm layouts \cite{rodrigues2016multi, yin2014multi}, building energy management \cite{delgarm2016multi, mayer2020environmental, yu2015application}, microgrid planning \cite{vergara2015towards, zhou2016multi}, process design \cite{sanaye2010thermal, hajabdollahi2017multi}, etc. Evolution-based strategies such as genetic algorithms, particle swarm, etc., are a popular choice for such problems, as Pareto points can simply be approximated using the best points found in previous generations \cite{coello2007evolutionary}. Nevertheless, these methods often require many function evaluations, making them ill-suited for energy systems models that are expensive to evaluate. Moreover, energy-systems problems are typically subject to important constraints (e.g., safety, regulatory limits), which must be satisfied by optimal/feasible solutions \cite{beykal2018optimal}. Dealing with constrained input spaces is non-trivial for evolution-based strategies, and information regarding infeasible points is typically unused. Rather, infeasible points can be resampled/repaired heuristically \cite{harada2007constraint}, or constraint violations can be treated using a penalty term or additional objective \cite{runarsson2003constrained}. Therefore, we focus on Bayesian optimization (BO) strategies, which can exhibit improved sampling efficiency by constructing internal surrogate models. Acquisition functions based on the learned surrogate models are then used in optimization, where promising points to sample are identified. The use of deterministic optimization tools here can allow energy-system constraints to be handled seamlessly, incorporating knowledge regarding the feasibility of proposed points. Many existing methods, such as ParEGO \cite{knowles2006parego} and TSEMO \cite{bradford2018efficient}, employ Gaussian Processes (GPs) as surrogate models. GPs are popular choices for black-box optimization because they naturally quantify uncertainty outside of sampled areas, allowing sampling strategies to balance between exploring regions of high uncertainty and exploiting the regions near the best observed values. The conflicting nature of these goals is known as the exploitation/exploration trade-off. Many GP-based approaches handle categorical variables with one-hot encoding, which introduces a continuous variable bounded between zero and one for each category. This dramatically enlarges the dimensionality for problems with many categorical variables. Recent efforts \citep{manson2021mvmoo} propose using tailor-made kernels for GPs to approach multi-objective problems with categorical variables. Our recent work \cite{thebelt2021entmoot} introduced \texttt{ENTMOOT}, which instead uses tree-based models as the internal surrogates for Bayesian optimization. Tree-based models have several notable advantages: they are well-suited for nonlinear and discontinuous functions, and they naturally support discrete/categorical features. However, unlike GPs, they do not provide uncertainty estimates, and gradients are not readily available for optimization; these traits have limited the use of tree models in BO \cite{Shahriari2016BO}. \texttt{ENTMOOT} overcomes these limitations by (i) employing a novel distance-based metric as a reliable uncertainty estimate, and (ii) using a mixed-integer formulation for optimization over the tree models. In this work, we extend the \texttt{ENTMOOT} framework to constrained, multi-objective black-box optimization, and demonstrate its applicability to real-world energy systems optimization. In particular, we introduce a weighted Chebyshev method \cite{knowles2006parego} with tree ensemble surrogate models to efficiently identify Pareto optimal points. Furthermore, we show that similarity-based metrics provide robust uncertainty estimates for categorical/discrete inputs. The proposed framework is first extensively tested using several well-known synthetic benchmarks, and is later demonstrated on the practically motivated case studies of wind-farm layout optimization and lithium-ion battery design. These case studies show that \texttt{ENTMOOT} significantly outperforms the popular state-of-the-art \texttt{NSGA-II} tool, largely due to its sample efficiency, effective handling of categorical features and ability to incorporate mechanistic constraints. The paper is structured as follows: we first provide background and review related works on BO, tree models, and multi-objective optimization in Section \ref{sec:background}. Section \ref{sec:method} then describes the proposed framework, including acquisition function, optimization formulation, and exploration heuristics, in Sections \ref{sec:acq_func}, \ref{sec:tree_enc}, and \ref{sec:explore}, respectively. Finally, we give computational results in Section \ref{sec:results}, including first synthetic benchmarks, then two real-world case studies. The latter comprise a popular windfarm layout optimization benchmark, as well as a novel battery design optimization study based on the recent software package PyBaMM. Both problems are challenging due to having high-dimensional feature spaces, explicit input constraints, and categorical input variables. \section{Background} \label{sec:background} \subsection{Bayesian Optimization} Bayesian optimization (BO) is one of the most popular approaches for derivative-free optimization of black-box functions. There are numerous successful applications, ranging from hyperparameter tuning of machine learning algorithms \citep{snoek2015SBOAnn} to design of engineering systems \citep{forrester2008BayesOpt, mockus1989BayesOpt} and drug development \citep{negoescu2011BayesOpt}. BO takes a black-box function $f:\mathbb{R}^n \to \mathbb{R}^{n_f}$ and determines its minimizer $\bm{x}^*$ according to: \begin{subequations} \label{eq:intro_bo} \begin{flalign} \bm{x}^* \in &\underset{\bm{x} \in \mathbb{R}^n} {\text{argmin}} \; f(\bm{x}). \label{eq:intro_bo_obj} \\ \; \; \; \text{s.t.} \; \; & g(\bm{x}) = 0, \label{eq:intro_bo_constr_eq} \\ & h(\bm{x}) \leq 0. \label{eq:intro_bo_constr_ieq} \end{flalign} \end{subequations} Here, $g(\bm{x})$ and $h(\bm{x})$ are additional constraints on inputs $\bm{x}$, i.e.\ equality and inequality constraints, that may be added based on domain knowledge. The parameter $n_f$ gives the number of objectives $f(\bm{x})$ and is $n_f = 1$ for single-objective problems. In general, no other information of $f(\bm{x})$, e.g.\ derivatives, is available. BO learns a probabilistic surrogate model to predict the behavior of function $f(\bm{x})$ to reveal promising regions of the search space. An acquisition function $Acq(\bm{x})$ is derived from such surrogate models and also takes into account less-explored regions, where we expect high prediction errors, capturing the well-known \textit{exploitation}/\textit{exploration} trade-off. \review{“Many acquisition functions, e.g.\ probability of improvement, expected improvement and upper confidence bound \citep{Shahriari2016BO}, combine the surrogate model mean and predictive variance into an easy-to-evaluate mathematical expression. Here, the acquisition function seeks to balance the mean, which gives an indication for well-performing configurations, and the variance, which exposes new areas of the search space.} BO solves problem Equ.~\eqref{eq:intro_bo} by sequentially updating the surrogate model and optimizing $Acq(\bm{x})$ to derive promising black-box inputs $\bm{x}_\text{next}$ according to: \begin{subequations} \label{eq:intro_bo2} \begin{flalign} \bm{x}_\text{next} \in &\underset{\bm{x} \in \mathbb{R}^n} {\text{argmin}} \; Acq(\bm{x}). \label{eq:mod_bo_obj_acq} \\ \; \; \; \text{s.t.} \; \; & g(\bm{x}) = 0, \label{eq:intro_bo_constr_acq_eq} \\ & h(\bm{x}) \leq 0. \label{eq:intro_bo_constr_acq_ieq} \end{flalign} \end{subequations} Sophisticated BO algorithms are particularly useful when evaluating $f(\bm{x})$ is expensive, since BO tends to be more sample efficient than other heuristics or grid search. The most popular choice for surrogate models in BO is the GP \citep{rasmussen2006GP}, as it naturally handles mean and variance predictions to determine confidence intervals. Other approaches rely on Bayesian neural networks \citep{snoek2015SBOAnn}, gradient-boosted trees \citep{thebelt2021entmoot} or random forests \citep{hutter2011SequentialModel} as surrogate models. For detailed reviews on BO we refer the reader to \citep{brochu2009BayesOpt, frazier2016BayesOpt, frazier2018tutorial, Shahriari2016BO}. \par \subsection{Tree Ensembles} A popular class of data-driven models that is also being used in BO is tree ensembles, e.g.\ gradient-boosted regression trees (GBRTS) \citep{friedman2002stochastic, Friedman2001GreedyMachine} and random forests \citep{breiman2001random}. These models can learn discontinuous and nonlinear response surfaces and naturally support categorical features, avoiding one-hot encoding or other reformulations. Tree ensembles split the search space into separate regions by defining decision thresholds at every node of a decision tree and assigning branches to it, e.g. two branches for binary trees. These splitting conditions are evaluated to progress in the decision tree and reveal its active leaf. Decision trees are highly effective as an ensemble, where the sum of active leaf weights makes up the prediction. \review{Therefore, tree ensembles are nonlinear data-driven models that produce a piece-wise constant prediction surface.} For GBRTs every decision tree is trained to fix predictive errors of previous trees, leading to a strong predictive performance of the combined ensemble, i.e.\ multiple weak learners \textit{boost} each other to form a strong ensemble learner. \review{Boosting methods tend to have an advantage for data with high-dimensional predictors as empirically shown in \citet{buhlmann2003boosting}.} \\ Incorporating tree-based models as surrogate models into BO is difficult \citep{Shahriari2016BO}, with the main challenges being: (i) finding reliable prediction uncertainty metrics that can be used for exploration in BO, and (ii) effectively optimizing the resulting acquisition function, i.e., solving Equ.~\eqref{eq:intro_bo2}, to propose promising new inputs. To overcome the former challenge, \textit{Jackknife} and \textit{infinitesimal Jackknife} \citep{JMLRv15wager14a} aim to provide confidence intervals of random forests based on statistical metrics. In a different approach, \citet{hutter2011SequentialModel} introduced \texttt{SMAC} as the first BO algorithm that uses tree ensembles, i.e. random forests, as surrogate models and estimating variance empirically based on individual decision tree predictions. \texttt{SMAC} has been shown to work well compared to other algorithms on various benchmark problems. However, \citet{Shahriari2016BO} show that the \texttt{SMAC} uncertainty metric has undesirable properties in certain settings, e.g.\ narrow confidence intervals in low data regions and uncertainty peaks when there is large disagreement between individual trees. \citet{tim_head_2018_1207017} implement quantile regression \citep{Meinshausen06quantileregression, 10.1257/jep.15.4.143} to define upper and lower confidence bounds of tree model predictions in the software tool \textit{Scikit-Opimize} for both GBRTs and random forests. Our recent work \citep{thebelt2021entmoot} first introduced \texttt{ENTMOOT}, which combines discrete tree models with a distance-based uncertainty metric that is designed to mimic the behavior of GPs. We showed using empirical studies that this distance metric effectively reveals areas of high and low model uncertainty. \par The other aforementioned challenge of optimizing acquisition functions comprised of tree ensembles is widely ignored, and stochastic strategies, e.g.\ genetic algorithms or random search, are used to solved Equ.~\eqref{eq:intro_bo2}. To this end, we proposed \citep{thebelt2021entmoot} a global optimization strategy for various distance metrics, e.g.\ Manhattan and squared Euclidean distance, based on a tree-model encoding proposed by \citet{Misic2017OptimizationEnsembles} to handle limitations related to stochastic optimization. The advantages of global optimization strategies were shown to be especially significant in high-dimensional settings, where sampling-based optimization approaches require exponentially many evaluations. Moreover, such global optimization strategies guarantee feasibility of constraints on input variables and avoid previously mentioned challenges related to missing gradients when it comes to discrete tree models. This paper extends the \texttt{ENTMOOT} framework \citep{thebelt2021entmoot} for multi-objective problems and presents challenging and relevant benchmarks that further highlight its merits. \subsection{Multi-Objective Optimization} \begin{figure} \centering \includegraphics[width=0.5\paperwidth]{ex_pf.pdf} \caption{\textbf{(left)}~shows true Pareto frontier (red dashed line) and its approximation (black line) based on non-dominated points (black dots), \textbf{(right)}~shows updated approximated Pareto frontier based on new non-dominated points (blue dots).} \label{fig:ex_pf} \end{figure} Multi-objective optimization (MOO) problems seek to minimize multiple conflicting objectives $f_i:\mathbb{R}^n \to \mathbb{R}, \forall i \in \left[n_f\right]$. Two fundamentally different approaches \citep{hwang2012multiple} in MOO that deal with this problem are scalarization and the Pareto method, which quantify multi-objective trade-offs \textit{a priori} and \textit{a posteriori}, respectively. The weighted sum approach \citep{zadeh1963optimality} defines the acquisition function $Acq = \sum\nolimits_{i} w_i f_i(\bm{x})$, representing a scalarization method that combines all objectives into a single objective that is then minimized. This strategy is straightforward to implement and has been applied in other constrained black-box optimization methods \citep{beykal2018optimal}. However, the weighted sum method requires prior knowledge to determine weights $w_i$ for different objectives and offers very limited insights into the trade-offs among various competing objectives. \par The Pareto method \citep{pareto1919manuale} seeks to overcome these limitations by exploring the entire Pareto frontier comprised by a set of Pareto-optimal points. By definition, Pareto-optimal points cannot be improved for one objective function without impairing another one. Computing the entire Pareto frontier is expensive and may be infeasible due to limited evaluation budgets. A common way to approximate Pareto frontiers is to instead use ``non-dominated'' function observations. To give an example, target observation $\bm{Y}_1$ is dominated by $\bm{Y}_2$ if $Y_{1,j} \geq Y_{2,j}, \forall j \in \{1,2, \dots, n_f\}$ and $Y_{1,j} > Y_{2,j}$ for at least one $j \in \{1,2, \dots, n_f\}$. Fig.~\ref{fig:ex_pf} shows an example of a two-dimensional Pareto frontier, i.e.\ when both objectives are being minimized, and its approximated Pareto frontier for a given set of data points and when more data points are added. \begin{figure} \centering \includegraphics[width=0.75\paperwidth]{ex_ws_cs.pdf} \caption{Depicts multi-objective function plot $f_2(f_1(\bm{x}))$ with Pareto frontier (red line), isocontours of $w = (0.5, 0.5)$ scalarization (black lines) and best attainable trade-off based on method used (green dot). \textbf{(left)}~convex Pareto frontier using weighted sum approach \textbf{(middle-left)}~concave Pareto frontier using weighted sum approach \textbf{(middle-right)}~convex Pareto frontier using Chebyshev method \textbf{(right)}~concave Pareto frontier using Chebyshev method.} \label{fig:ex_ws_cs} \end{figure} The previously mentioned weighted sum approach can generate certain Pareto frontiers by minimizing the objective functions with varying weights $w_i$. However, even in the best case, weighted sums can only reconstruct convex Pareto frontiers \citep{messac2000ability}. Fig.~\ref{fig:ex_ws_cs} visualizes the Pareto method using the weighted sum objective for convex and concave Pareto frontiers and shows the best attainable points. \par An alternative approach implementing the Pareto method is the weighted Chebyshev method \citep{knowles2006parego}, which defines the objective function as $Acq = \text{max}_i \; w_i f_i $. The weights $w_i$ are drawn from a random distribution and defined such that $\sum \nolimits_i w_i = 1$. \review{The choice of distribution can influence what weight combinations the method is focusing on, e.g.\ using a normal distribution would focus on more equally distributed weights around 0.5. Solving the bilevel optimization problem, i.e.\ $ \text{min} \; Acq = \text{min} \; \text{max}_i \; w_i f_i $, allows reconstruction of Pareto-optimal points on both convex and concave Pareto frontiers. This is visualized in Fig.~\ref{fig:ex_ws_cs} where we compare the weighted sum and weighted Chebyshev method.} The algorithm proposed here utilizes the weighted Chebyshev method in combination with tree ensembles to reveal Pareto-optimal trade-offs of constrained multi-objective optimization problems. \review{The $\epsilon$-constraint method is an alternative way of considering different objectives and has been applied to energy-related problems \citep{javadi2020multi}. This method minimizes one objective while constraining other objectives to a certain range to generate the Pareto frontier. It is highly effective when there is existing knowledge about some objectives that can be used to determine relevant $\epsilon$ values to constrain these objectives. However, insufficient $\epsilon$ values may produce non-dominated points far away from the true Pareto frontier.} \par \review{Other approaches that combine prior knowledge of the problem at hand with different data-driven model architectures to determine multi-objective trade-offs are given in \citep{olofsson2018bayesian,beykal2018optimal}.} Another popular class of methods tackling these problems is genetic algorithms (GA) \citep{kumar2010genetic}. One of the most popular algorithms of this category is \texttt{NSGA-II} \citep{deb2002fast}, which handles constrained multi-objective problems and has been successfully deployed in many energy applications \cite{hajabdollahi2017multi, mayer2020environmental, sanaye2010thermal, vergara2015towards, yin2014multi, zhou2016multi, haddadian2017multi, hu2016nsga}. While there is no feasibility guarantee for input constraints, \texttt{NSGA-II} generates solutions that seek to minimize constraint violation. As a state-of-the-art tool with a readily available Python implementation \citep{pymoo} that can handle constrained multi-objective optimization problems, we use it as the main method for comparison benchmarks. \section{Method} \label{sec:method} \begin{table}[] \centering \begin{tabularx}{\textwidth}{ c|X } \hline $f_i(\cdot)$ & black-box function of objective $i \in \left[n_f\right]$ \\ $n$ & number of input dimensions \\ $n_f$ & number of objectives \\ $\bm{x}$ & variable input vector of size $n$ \\ $\bm{x}^*$ & optimal input of black-box function $f$ \\ $\bm{x}_\text{next}$ & next black-box input proposal \\ $Acq(\cdot)$ & acquisition function optimized to determine $\bm{x}_\text{next}$ \\ $g(\cdot)$ & input equality constraints \\ $h(\cdot)$ & input inequality constraints \\ $w_i$ & weight for objective $i$ \\ $\hat{\mu}_i(\cdot)$ & prediction of tree ensemble for objective $i$ \\ $\alpha(\cdot)$ & uncertainty contribution for exploration \\ $\kappa$ & hyperparameter that weights exploration term in acquisition function \\ $\bm{X}$ & input data points $\bm{X} = (\bm{X}_1, \bm{X}_2, \dots, \bm{X}_n)$ \\ $\bm{Y}$ & target data points $\bm{Y} = (\bm{Y}_1, \bm{Y}_2, \dots, \bm{Y}_n)$ \\ $\mathcal{N}$ & set of continuous variables \\ $\mathcal{C}$ & set of categorical variables \\ $\mathcal{D}$ & \review{available data set} \\ $S_i(\cdot,\cdot)$ & returns similarity of two data points for categorical feature $i$ \\ $p^2(i,j)$ & measure of probability for categorical feature $i$ to the take the value $j$ \\ $\mathcal{P}_a$ & approximated Pareto frontier \\ $\mathcal{P}_\text{true}$ & true Pareto frontier \\ \hline \end{tabularx} \caption{General table of notations.} \label{tab:general_not} \end{table} In the following sections we give more details on the proposed method. Section~\ref{sec:acq_func} outlines the acquisition function used. Sections~\ref{sec:tree_enc} and \ref{sec:explore} explain the encoding for both tree ensembles and exploration contributions. Table~\ref{tab:general_not} summarizes notations used in the following sections. \subsection{Acquisition Function} \label{sec:acq_func} We combine the previously mentioned Chebyshev method with the lower confidence bound acquisition function \citep{Cox97sdo:a}, i.e.\ one of the most popular BO acquisition functions, defined as: \begin{equation} Acq(\bm{x}) = \hat{\mu}(\bm{x}) - \kappa \; \alpha(\bm{x}), \end{equation} where $\hat{\mu}$ denotes the mean prediction of the surrogate model used. $\alpha$ determines exploration based on an uncertainty metric with $\kappa$ functioning as a hyperparameter to balance the \textit{exploitation} / \textit{exploration} trade-off. The combined acquisition function replaces the exploitation part with the Chebyshev approach and uses separate tree ensembles to approximate individual objectives $f_i$ with $\hat{\mu}_i$: \begin{equation} \label{eq:multi_objective} \bm{x}_{\text{next}} \in \underset{\bm{x}, \bm{z}, \bm{\nu}, \hat{\mu}, \alpha} {\text{arg min}} \; \underset{i \in \left[n_f\right]}{\text{max}} \; \; w_i \frac{\hat{\mu}_i (\bm{x}) - \text{min}(\bm{Y}_i)} {\text{max}(\bm{Y}_i) - \text{min}(\bm{Y}_i)} - \frac{\kappa}{n} \alpha (\bm{x}). \end{equation} The next black-box evaluation point $\bm{x}_\text{next}$ is the result of the bilevel problem stated in Equ.~\eqref{eq:multi_objective}. The first term of Equ.~\eqref{eq:multi_objective} comprises the normalized mean function of tree model predictions $\hat{\mu}_i$, $i \in \left[n_f\right]$, trained on individual target columns multiplied with randomly generated parameters $w_i \in \left[0, 1\right]$. Note that the normalization of $\hat{\mu}_i (\bm{x})$ is only an approximation based on minimum and maximum target observations, i.e. $\text{min}(\bm{Y}_i)$ and $\text{max}(\bm{Y}_i)$, in data set $\mathcal{D}$. This allows for the optimization to focus on different parts of the Pareto front depending on which tree model has the largest weight. \review{We emphasize that early iterations are likely going to have poorly normalized objectives, i.e.\ when the approximated objective bounds are very different to the actual objective bounds. The proposed method allows for users to explicitly specify $\text{min}(\bm{Y}_i)$ and $\text{max}(\bm{Y}_i)$ , to avoid poor normalizations of objective values if objective bounds are known a priori.} The second term of Equ.~\eqref{eq:multi_objective} is proposed by \citet{thebelt2021entmoot} and helps exploration by incentivizing solutions away from previously explored data points. We reformulate optimization objective in Equ.~\eqref{eq:multi_objective} to remove its bilevel nature according to: \begin{subequations} \label{eq:multi_objective_reform} \begin{flalign} \bm{x}_{\text{next}} \in & \underset{\bm{x}, \bm{z}, \bm{\nu}, \hat{\mu}, \alpha} {\text{arg min}} \; \hat{\mu} - \frac{\kappa}{n} \alpha (\bm{x}) \\ & \text{s.t.} \; \hat{\mu} \geq w_i \frac{\hat{\mu}_i (\bm{x}) - \text{min}(\bm{Y}_i)} {\text{max}(\bm{Y}_i) - \text{min}(\bm{Y}_i)}, \; \forall i \in \left[n_f\right] \end{flalign} \end{subequations} Formulations in Equ.~\eqref{eq:multi_objective} and Equ.~\eqref{eq:multi_objective_reform} are equivalent since $\hat{\mu}$ must be greater or equal to all individual tree model contributions. Therefore, at the optimal point, it will be equivalent to the largest tree model prediction, making other tree model contributions redundant. \subsection{Tree Ensemble Encoding} \label{sec:tree_enc} \begin{table}[] \centering \begin{tabularx}{\textwidth}{ c|X } \hline $z_{t,l}$ & variable leaf $l$ in tree $t$ \review{acting as a binary variable} \\ $\nu_{i,j}$ & binary variable for active split of feature $i$ \\ $v_{i,j}$ & numerical value split node $j$ of feature $i$ \\ $v_i^L$, $v_i^U$ & lower and upper bound of continuous feature $i$ \\ $F_{t,l}$ & weight of leaf $l$ in tree $t$ \\ $\mathcal{T}$ & set of trees \\ $\mathcal{L}_t$ & set of leaves in tree $t$ \\ $\mathbf{splits}(t)$ & set of splits of tree $t$ \\ $\mathbf{left}(s)$ & leaf indices left of split $s$ \\ $\mathbf{right}(s)$ & leaf indices right of split $s$ \\ $\text{V}(s)$ & feature participating in split $s$ \\ \hline \end{tabularx} \caption{Tree ensemble encoding table of notation.} \label{tab:tree_model} \end{table} \begin{figure*} \label{fig:dec_tree} \begin{center} \includegraphics[width=0.77\paperwidth]{gbt_tree} \end{center} \caption{Visualization of a decision tree evaluation.} \end{figure*} The proposed method uses the \citet{Misic2017OptimizationEnsembles} mixed-integer linear programming formulation to encode the tree model \cite{Mistry2018Mixed-IntegerEmbedded}. Tree ensembles are a popular choice for problems with different variable types, i.e.\ continuous and categorical variables. Continuous variables are defined based on a lower and upper bound, and individual decision trees use splitting conditions to partition the input space. For categorical variables we distinguish between nominal and ordinal variables. For different categories of ordinal variables we can establish an order, but cannot quantify the relative distance between different categories. On the other hand, nominal variables neither define an order nor a distance between different categories. Training a tree ensemble determines split conditions in individual decision trees for different variable types. Table~\ref{tab:tree_model} defines the notation in this section. For continuous variables trees define numerical thresholds $v_{i,j}$ as split conditions that determine whether the decision tree evaluation progresses to the left or right branch of the node. The index $i$ indicates the feature involved in the split and $j \in \{1,2,\dots,K_i\}$ denotes an ordering for all continuous split conditions in the ensemble according to $v_{i,1} < v_{i,2} < ... < v_{i,K_i}$. To assign the correct numerical value $v_{i,j}$ to a split $s \in \mathbf{splits}(t)$ in tree $t$ we define $\mathbb{C}(s)=j$ which maps split $s$ onto the correct $j\in \{1,2,\dots,K_{\text{V}(s)}\}$. $\text{V}(s)$ gives the index of the feature participating in split $s$. On the other hand, categorical variables define split conditions as subsets of all possible categories for a feature $i$. LightGBM implements this procedure by grouping for maximum homogeneity as proposed by \citet{fisher1958grouping}. \review{With slight abuse of notation, we define $\mathbb{C}(s) \subseteq \{1,2,\dots,K_{\text{V}(s)}\}$ for categorical features.} The set $\{1,2,\dots,K_{\text{V}(s)}\}$ has all available categories if $\text{V}(s)$ is a categorical feature. Defining the tree ensemble in this way simplifies the encoding as an optimization model (see Table~\ref{tab:tree_model}). \par We start by defining $\mathcal{N}$ and $\mathcal{C}$ as sets for continuous and categorical variables, respectively. For continuous variables the model defines binary variables $\nu_{i,j}$ corresponding to split condition: $\nu_{i,j} = \mathbb{I} \{ x_i \leq v_{i,j} \}, \forall i \in \mathcal{N}, j \in \{ 1,...,K_i\}$. For categorical variables the model defines binary variables $\nu_{i,j}$ corresponding to split condition: $\nu_{i,j} = \mathbb{I} \{ x_i=j \}, \forall i \in \mathcal{C}, j \in \{ 1,...,K_i\}$. The following constraints encode the tree model for single objectives according to \cite{Misic2017OptimizationEnsembles}: \begin{subequations} \label{eq:tree_encoding} \begin{flalign} &\hat{\mu} =\sum\limits_{t\in{\mathcal{T}}} \sum\limits_{l\in{\mathcal{L}_{t}}} F_{t,l} z_{t,l}, & & \label{eq:const_a}\\ &\;\;\;\sum\limits_{l\in{\mathcal{L}_{t}}}\;\;\;\; z_{t,l} = 1, & &\forall t\in \mathcal{T}, \label{eq:const_b}\\ &\sum\limits_{\;\;l\in\mathbf{left}(s)}\; z_{t,l} \leq \sum\limits_{j \in \mathbf{C}(s)} \nu_{\text{V}(s),j}, & &\forall t \in \mathcal{T}, \forall s \in \mathbf{splits}(t), \label{eq:const_c}\\ &\sum\limits_{\;\;l\in\mathbf{right}(s)} z_{t,l} \leq 1 - \sum\limits_{j \in \mathbf{C}(s)} \nu_{\text{V}(s),j}, & &\forall t \in \mathcal{T}, \forall s \in \mathbf{splits}(t), \label{eq:const_d} \\ &\;\;\;\sum\limits_{j=1}^{K_i}\;\;\; \nu_{i,j} = 1, & &\forall i \in \mathcal{C}, \label{eq:const_e} \\ &\nu_{i,j} \leq \nu_{i,j+1}, & &\forall i \in \mathcal{N}, \forall j \in \left [ K_i - 1 \right ], \label{eq:const_f} \\ &\nu_{i,j} \in \{ 0,1 \}, & &\forall i \in \left [ n \right ], \forall j \in \left [ K_i \right ], \label{eq:const_g} \\ &z_{t,l} \geq 0, & &\forall t\in{\mathcal{T}}, \forall l\in{\mathcal{L}_{t}}. \label{eq:const_h} \end{flalign} \end{subequations} \review{For every tree ensemble $\hat{\mu}_i$ of Equ.~\eqref{eq:multi_objective_reform}, we define the constraints Equ.~\eqref{eq:const_a} as the sum of all active leaf weights $F_{t,l}$, which are obtained from training of the tree ensemble.} The leaves are indexed by $t\in{\mathcal{T}}$ and $l\in{\mathcal{L}_{t}}$, with $\mathcal{T}$ and $\mathcal{L}_t$ denoting the set of trees and the set of leaves in tree $t$, respectively. Binary variables $z_{t,l} \in \left[ 0,1 \right]$ function as switches indicating which leaves are active. \review{For this model definition \citet{Misic2017OptimizationEnsembles} shows that variables $z_{t,l}$ can be relaxed to positive continuous variables according to Equ.~\eqref{eq:const_h} without losing their binary behavior, as they are fully-defined by binary variables $\nu_{\text{V}(s),j}$, i.e.\ Equ.~\eqref{eq:const_c} and Equ.~\eqref{eq:const_d}. Relaxing binary variables can allow third party solvers to use more effective solution methods.} Equ.~\eqref{eq:const_b} ensures that only one leaf per tree contributes to the tree ensemble prediction. Equ.~\eqref{eq:const_c}, \eqref{eq:const_d} and \eqref{eq:const_f} force all splits $s \in \mathbf{splits}(t)$, leading to an active leaf, to occur in the correct order. Here $\mathbf{left}(s)$ and $\mathbf{right}(s)$ denote subsets of leaf indices $l \in \mathcal{L}_t$ which are left and right of split $s$ in tree $t$. Binary variables $\nu_{\text{V}(s),j}$ determine which splits are active. $\mathbf{C}(s)$ behaves differently depending on the variable type, i.e.\ continuous or categorical, as previously explained. To ensure that only one of the available categories for feature $i$ is active, Equ.~\eqref{eq:const_e} constraints are added for all categorical variables $i \in \mathcal{C}$. Fig.~\ref{fig:dec_tree} visualizes the evaluation of a single decision tree and shows which leaf variables are active. For more details on the tree ensemble encoding and theoretical properties of the formulation we refer the reader to \citep{Misic2017OptimizationEnsembles}. \\ \review{ Some key hyperparameters of tree ensembles are the number of trees, the maximum depth of a single decision tree and the minimum number of data points used to define a leaf. While tuning these hyperparameters may improve tree ensemble performance, we assume a pre-defined set of fixed hyperparameter values to allow for a fair comparison with other methods. Standard techniques, e.g.\ cross-validation or early stopping, could be used to further improve \texttt{ENTMOOT}'s performance and help with exploring unknown areas where model uncertainty is high. } \par \subsection{Search Space Exploration} \label{sec:explore} Next we present details about the Equ.~\eqref{eq:multi_objective_reform} exploration term denoted by $\alpha$. \review{Given that tree ensembles have a piece-wise constant prediction surface with no built-in metric to evaluate uncertainty, we introduce a distance-based exploration measure that incentivizes solutions away from already visited data points.} Different strategies to quantify uncertainty for continuous and categorical variables are deployed and combined to define $\alpha$ according to: \begin{subequations} \label{eq:alphas} \begin{flalign} & \alpha \leq \alpha_{\mathcal{N}}^d + \alpha_{\mathcal{C}}^d,\; \; \forall d \in \mathcal{D} \\ & \alpha_{\mathcal{N}}^d \in \left[ 0, |\mathcal{N}| \right] \\ & \alpha_{\mathcal{C}}^d \in \left[ 0, |\mathcal{C}| \right] \end{flalign} \end{subequations} with $\alpha_{\mathcal{N}}^d$ and $\alpha_{\mathcal{C}}^d$ denoting exploration contributions of continuous and categorical variables, respectively. For continuous variables we define $\alpha_{\mathcal{N}}^d$ by introducing distance constraints according to: \begin{equation} \label{eq:dist_meas} \alpha_\mathcal{N}^d \leq \left\lVert \frac{\bm{x}_\mathcal{N} - \bm{v}^{L}} {\bm{v}^{U} - \bm{v}^{L}} - \frac{\bm{X}_d - \bm{v}^{L}} {\bm{v}^{U} - \bm{v}^{L}} \right\rVert_2^2, \; \; \forall d \in \mathcal{D} \end{equation} Continuous variable bounds $\bm{v}^{L}$ and $\bm{v}^{U}$ normalize the vector of continuous variables $\bm{x}_\mathcal{N}$. Equ.~\eqref{eq:dist_meas} defines $\alpha_\mathcal{N}$ as the squared Euclidean distance to the closest normalized data point $\bm{X}_d$ and bounds it to $\alpha \in \left[0,1\right]$. Due to the negative contribution of $\alpha$ in Equ.~\eqref{eq:multi_objective_reform}, the Equ.~\eqref{eq:dist_meas} quadratic constraints make the overall problem non-convex. These types of non-convex quadratic problems can be solved by commercial branch-and-bound solvers, e.g.\ Gurobi~-~v9. The proposed measure is similar to \citet{thebelt2021entmoot} and can be reformulated to utilize the standard Euclidean or Manhattan distances. To correlate continuous variables $\bm{x}$ with discrete tree model splits, we introduce linking constraints according to Equ.~\eqref{eq:linking_const} which assign separate intervals $v_{i,j}$ defined by the tree model splits back to the original continuous search space $\bm{x} \in \mathbb{R}^n$. Parameters $v_i^L$ and $v_i^U$ denote upper and lower bounds of feature $i$, respectively. \begin{subequations} \label{eq:linking_const} \begin{flalign} &x_{i} \geq v^L_{i} + \sum\limits_{j=1}^{K_{i}} \left (v_{i,j} - v_{i,j-1} \right ) \left ( 1 - \nu_{i,j} \right ), & &\forall i \in \mathcal{N},\\ &x_{i} \leq v^U_{i} + \sum\limits_{j=1}^{K_{i}} \left (v_{i,j} - v_{i,j+1} \right ) \nu_{i,j}, & &\forall i \in \mathcal{N},\\ &x_{i} \in \left [ v_{i}^{L},v_{i}^{U} \right ], & &\forall i \in \mathcal{N}. \end{flalign} \end{subequations} Quantifying exploration contributions as distances is more difficult when it comes to categorical variables. Here we use similarity measures proposed by \citet{boriah2008Categ} that compute the proximity of categorical feature values between two points of the data set. \review{These measures define $S_i \left(\bm{X}_{d_1,i}, \bm{X}_{d_2,i} \right)$ as the similarity between feature $i$ of data points $\bm{X}_{d_1}$ and $\bm{X}_{d_2}$ with regard to categorical feature $i \in \mathcal{C}$.} The easiest way to define $S_i$ is the \textit{Overlap} measure: \begin{equation} \label{eq:overlap} \review{S_i\left(\bm{X}_{d_1,i}, \bm{X}_{d_2,i}\right)}= \begin{cases} 1 \; \; \bm{X}_{d_1,i} = \bm{X}_{d_2,i}\\ 0 \; \; \text{otherwise} \end{cases} \end{equation} Using this measure we observe a range $S_i \in \left[ 0, 1 \right]$ since it only measures the overlap between categorical features, i.e.\ having the same category gives similarity of one while having different categorical values give similarity of values. While this measure is easy to implement and effective, it does not take into consideration the number of times different categorical data points already appear in the data set. Here, \citet{boriah2008Categ} propose probability based metrics to consider different types of similarities. The property $p^2(i,j)$ is a probability estimate of category $j$ of feature $i$ appearing in data set $\mathcal{D}$ and is defined as: \begin{equation} p^2\left(i, j\right) = \frac{\text{count}_i \left( j\right) \left( \text{count}_i \left( j\right)-1 \right) }{\mid \mathcal{D} \mid \left( \mid \mathcal{D} \mid-1\right)} \end{equation} Large values of $p^2(i,j)$ indicate a high probability that categorical feature $i$ will have the value $j$. \citet{boriah2008Categ} use $p^2(i,j)$ to define the \textit{Goodall4} similarity according to \begin{equation} \label{eq:goodall4} \review{S_i\left(\bm{X}_{d_1,i}, \bm{X}_{d_2,i}\right)}= \begin{cases} p^2\left(i, \bm{X}_{d_1, i}\right) &\text{if} \; \bm{X}_{d_1, i} = \bm{X}_{d_2, i}\\ 0 &\text{otherwise} \end{cases} \end{equation} For categorical variables we link the distance metric to the exploration term by adding the following constraints to our optimization problem: \begin{equation} \label{eq:cat_dist} \alpha_\mathcal{C}^d \leq \sum\limits_{i \in \mathcal{C}} \sum\limits_{j = 1}^{K_i} \left[ 1 - \review{S_i\left(\bm{X}_{d,i},j\right)} \right] \nu_{i,j}, \; \; \forall d \in \mathcal{D} \end{equation} Equ.~\eqref{eq:goodall4} computes larger similarities for features that occur more often in the data set, causing $\alpha_\mathcal{C}^d$ in Equ.~\eqref{eq:cat_dist} to take smaller values, which incentivizes solutions that appear less frequently in data set $\mathcal{D}$. \review{We can read active categorical variable values by checking which of the $\nu_{i,j}$ binary variables is not zero:} \begin{equation} \label{eq:cat_map} \review{x_i = \underset{j \in \left [ K_i \right ]}{\text{argmax}} \; \{\nu_{i,j}\}, \forall i \in \mathcal{C}.} \end{equation} \review{We note that Equ.~\eqref{eq:cat_map} is not part of the optimization problem and should demonstrate how active labels are linked to $\bm{x}_\text{next}$.} In summary, the resulting optimization model that determines the next promising input $\bm{x}_\text{next}$ uses Equ.~\eqref{eq:multi_objective_reform}, Equ.~\eqref{eq:tree_encoding} for every tree model, Equ.~\eqref{eq:dist_meas}, Equ.~\eqref{eq:linking_const} and Equ.~\eqref{eq:cat_dist}, and is classified as a mixed-integer non-convex quadratic problem. \subsection{Combined Model} \review{ The combined model consists of the Section~\ref{sec:tree_enc} tree ensemble encodings and the Section~\ref{sec:explore} exploration measure. The proposed method uses the modified Chebyshev method introduced in Section~\ref{sec:acq_func}. Optimization of the tree model encoding is an NP-hard problem \citep{Misic2017OptimizationEnsembles}, and, together with the exploration measure, can be classified as a nonconvex mixed-integer quadratic program. The nonconvex part originates from the definition of $\alpha_\mathcal{N}^d$ as a quadratic in Equ.~\eqref{eq:dist_meas}, which is then maximized in the objective function, i.e.\ its negative value is minimized. While these formulations do not scale well with growing problem sizes, \citet{thebelt2021entmoot} found that most problems converge within minutes due to the usage of effective heuristics in third party solvers. \citet{Misic2017OptimizationEnsembles}, \citet{thebelt2021entmoot} and \citet{Mistry2018Mixed-IntegerEmbedded} also propose custom heuristics specifically tailored for optimization problems including tree ensembles to enhance bound improvement when optimizing such models. \\ The tree encoding defined in Equ.~\eqref{eq:tree_encoding} adds constraints for splits in every decision tree and scales with the size of the tree ensemble. While it is independent of the number of data points and the dimensionality, one would expect larger tree ensembles for large data sets and high-dimensional spaces, and therefore more constraints in the optimization model. The uncertainty metric defined in Section~\ref{sec:explore} directly scales with the size of the data set, dimensionality as well as number of categories if categorical variables are involved. Equ.~\eqref{eq:alphas} and Equ.~\eqref{eq:dist_meas} are added for every additional data point, and the vectors in Equ.~\eqref{eq:dist_meas} grow with increasing dimensionality, making the resulting problem more difficult to solve. Moreover, similarity matrix $S$ for categorical variables grows with increasing number of data points and Equ.~\eqref{eq:cat_dist} is added for every data point. \citet{thebelt2021entmoot} solve a similar problem for single objective problems and propose using data clustering to combine multiple data points into single cluster centers to reduce the size of the problem. While the proposed method is inherently difficult to solve, we motivate its usefulness by empirically evaluating it on practically motivated case studies. The superior performance with respect to sampling efficiency of the proposed method motivates its usage over cheaper algorithms, e.g.\texttt{NSGA-II}, especially when black-box functions are expensive to evaluate. } \section{Numerical Studies} \label{sec:results} This section empirically evaluates the framework proposed in this paper. Code recapitulating the \texttt{ENTMOOT} results can be found here: \url{https://github.com/cog-imperial/moo_trees}. We select synthetic benchmarks with known Pareto fronts that enable comprehensive comparison with respect to performance metrics. Moreover, we present two practically motivated case studies, i.e.,\ wind turbine placement (WTP) and battery material selection (BMS), that emphasize the advantages of the proposed method and highlight its relevance to energy systems. \review{For all studies we assume expensive black-box evaluations comprise the majority of the total computational complexity of each run. Therefore, we evaluate solver performance based on how many black-box evaluations are needed to explore the Pareto frontier, i.e. different metrics are used to measure the progress.} For all experiments we provide medians for all performance metrics, as well as first and third quartiles that bound the confidence intervals, computed using 25 runs with ordered random seeds in $\{101,102,...125\}$. The same set of initial points are provided for all competing methods to facilitate comparison. \review{By using the same set of initial data points and testing multiple random seeds, we mitigate the effects of specific initial settings favoring one method over the other.} \review{For the case studies with unknown Pareto frontiers we compute the bounded hypervolume of the objective space over number of black-box evaluations. The number of black-box evaluations contributes to the overall computational complexity, and we therefore compare methods based on how many black-box evaluations are needed to improve the bounded hypervolume of the objective space.} \\ We compare the proposed methods to \texttt{NSGA-II} using its \textit{pymoo} \citep{pymoo} implementation. Additionally, we investigate random search for unconstrained problems using a feasible sampling strategy, as described in Section~\ref{sec:wind_opt_bench}. The \texttt{NSGA-II} method is used with default hyperparameter values in \textit{pymoo}, except for initial population size, which is set consistently with the other considered methods. Since \texttt{NSGA-II} does not directly support categorical variables, we apply one-hot encoding by introducing continuous auxiliary variables for all categories of a categorical variable bounded within $\left[0.0,1.0\right]$. The auxiliary variable with the highest numerical value determines the category picked. \texttt{ENTMOOT} uses 400 trees with a maximum tree depth of three and a minimum of two data points per leaf. The tree ensemble is trained using LightGBM \citep{Ke2017LightGBM:Tree}, and the default value of $\kappa = 1.96$ is picked for all numerical studies. \review{To allow for a fair comparison with other methods, we used the same set of hyperparameters for \texttt{ENTMOOT} throughout all runs.} \review{\texttt{ENTMOOT} uses Gurobi~-~v9 to solve the mixed-integer quadratic program (MIQP) with default parameter settings to find minima of the tree ensemble surrogate model. We found that for most instances Gurobi~-~v9 finds a global optimal solution in a fairly short time given the default relative optimality gap of \num{1e-4} and feasibility tolerance of \num{1e-6}. However, sometimes Gurobi~-~v9 struggles to fully close the optimality gap, so we enforce a time limit of 100 s, given that a feasible solution is found, due to computational limitations when running batch jobs. If a feasible solution is not found, the optimization procedure is continued until one is found. We note that this procedure only affects the method presented here, and not other tools that we compare against.} All experiments are run on a Linux machine equipped with an Intel Core i7-7700K 4.20 GHz and 16 GB of memory. \subsection{Performance Metrics} We use multiple different measures to compare the performance of different algorithms. For benchmarks where the true Pareto frontier is known, we rely on the Euclidean generational distance (GD) \citep{van1999multiobjective}, the inverted generational distance (IGD) \citep{sierra2004new}, the maximum Pareto frontier error (MPFE) \citep{van1999multiobjective} and the volume ratio (VR) \citep{olofsson2018bayesian}. The true Pareto frontier is denoted as $\mathcal{P}_\text{true}$ and $\mathcal{P}_a$ is the approximated Pareto frontier derived by different algorithms. For synthetic benchmarks in Section~\ref{sec:synthetic_benchmarks}, $\mathcal{P}_\text{true}$ is determined by running \texttt{NSGA-II} for a few thousand iterations. For energy systems related benchmarks there is no true Pareto frontier available, and we compare the hypervolume bounded by the approximate Pareto frontiers derived from different algorithms. We compute GD according to: \begin{equation} \text{GD}\left( \mathcal{P}_a \right) = \frac{1}{|\mathcal{P}_a|} \sum\limits_{\bm{r} \in \mathcal{P}_a} \underset{\bm{r}^{\left( t \right)} \in \mathcal{P}_\text{true}}{\text{min}} \; \left\lVert \bm{r} - \bm{r}^{\left( t \right)} \right\rVert_2, \end{equation} which describes the average distance of points in in the approximated Pareto frontier $\mathcal{P}_a$ to the true Pareto frontier $\mathcal{P}_\text{true}$. The results of this measure may be misleading if the approximate number consists of only a few good Pareto points. To overcome this problem we also report IGD which computes the average distance of points on the true Pareto frontier to the approximate Pareto frontier according to: \begin{equation} \text{IGD}\left( \mathcal{P}_a \right) = \frac{1}{|\mathcal{P}_\text{true}|} \sum\limits_{\bm{r}^{\left( t \right)} \in \mathcal{P}_{\text{true}}} \underset{\bm{r} \in \mathcal{P}_a}{\text{min}} \; \left\lVert \bm{r}^{\left( t \right)} - \bm{r} \right\rVert_2. \end{equation} The MPFE measure is defined as: \begin{equation} \text{MPFE}\left( \mathcal{P}_a \right) = \underset{\bm{r}^{\left( t \right)} \in \mathcal{P}_\text{true}}{\text{max}} \; \underset{\bm{r} \in \mathcal{P}_a}{\text{min}} \; \left\lVert \bm{r} - \bm{r}^{\left( t \right)} \right\rVert_2, \end{equation} and computes the maximum error of the approximate Pareto frontier to the true Pareto frontier. The MPFE measure can be sensitive to outliers, since a single bad point on Pareto frontier is sufficient to negatively influence the measure. VR is a measure that takes the entirety of the approximated Pareto frontier into consideration: \begin{equation} \label{eq:vr} \text{VR} \left( \mathcal{P}_a \right) = -\log{ \left( 1 - \frac{\text{Vol} \left( \mathcal{P}_a \right)} {\text{Vol} \left( \mathcal{P}_\text{true} \right)} \right)} \end{equation} with $\text{Vol}(\cdot)$ describing the hypervolume of the Pareto frontier. The VR measure computes the ratio of hypervolume bounded by the approximate Pareto frontier vs. the hypervolume bounded by the true Pareto frontier. \review{We note that the VR measure is undefined if $\mathcal{P}_a$ exactly matches $\mathcal{P}_\text{true}$. However, since $\mathcal{P}_\text{true}$ itself is an approximation of the true Pareto frontier as stated above, this case is highly unlikely. The Equ.~\eqref{eq:vr} logarithm helps distinguish solutions with $\text{Vol} \left( \mathcal{P}_a \right)\ / \text{Vol} \left( \mathcal{P}_{\text{true}} \right) \simeq 1$, e.g.\ improvements of $\text{Vol} \left( \mathcal{P}_a \right)\ / \text{Vol} \left( \mathcal{P}_{\text{true}} \right)$ from 99 \% to 99.9 \% are valued higher than increasing the ratio from 19 \% to 19.9 \%.} \subsection{Synthetic Benchmarks} \label{sec:synthetic_benchmarks} We test the proposed method on various synthetic benchmarks to show its competitive performance compared to other state-of-the-art methods. The synthetic benchmarks provided in this section have different types of Pareto frontiers to show the algorithm's capability of reproducing them and each have two objective functions. The \textit{Fonzeca \& Fleming} problem \citep{fonseca1995overview} is a popular choice for benchmarking multi-objective optimization frameworks and is defined as: \begin{equation} \label{eq:fonzeca} \begin{cases} f_1(\bm{x}) = 1 - \text{exp} \left( - \sum\limits_{i = 1}^{D} \left( x_i - \frac{1}{\sqrt {D}} \right)^2 \right), \\ f_2(\bm{x}) = 1 - \text{exp} \left( - \sum\limits_{i = 1}^{D} \left( x_i + \frac{1}{\sqrt {D}} \right)^2 \right). \end{cases} \end{equation} \review{Fig.~\ref{fig:syn_bench}} shows the concave Pareto frontier of the function. The function inputs $x_i \in \left[-4,4\right]$ for $i \in \{1,2,\dots,D\}$ bound the function outputs according to $f_1(\bm{x}), f_2(\bm{x}) \in \left[0,1\right]$. For our tests we choose $D=2$. \par The second synthetic benchmark function is \textit{Schaffer} \citep{schaffer1985some} given by: \begin{equation} \label{eq:schaffer} \begin{cases} f_1(\bm{x}) = x^2, \\ f_2(\bm{x}) = (x-2)^2. \end{cases} \end{equation} \textit{Schaffer} has a convex Pareto frontier as depicted in \review{Fig.~\ref{fig:syn_bench}}. Inputs of \textit{Schaffer} are defined as $x \in \left[-3,3\right]$ bounding the objectives according to $f_1(x) \in \left[0,9\right]$ and $f_2(x) \in \left[0,25\right]$. \par \textit{Kursawe} \citep{kursawe1990variant} is the third benchmark function which we use for comparison. The \textit{Kursawe} function is interesting due to its discontinuous Pareto frontier and is defined as: \begin{equation} \label{eq:kursawe} \begin{cases} f_1(\bm{x}) = \sum\limits_{i = 1}^{D-1} \left[ - 10 \text{exp} \left( -0.2 \sqrt {x_i^2 + x_{i+1}^2} \right)\right], \\ f_2(\bm{x}) = \sum\limits_{i = 1}^{D} \left[ |x_i|^{0.8} + 5 \sin{\left( x_i^3 \right)} \right] \end{cases} \end{equation} \textit{Kursawe} has inputs defined as $x_i \in \left[-5,5\right]$ for $i \in \{1,2,\dots,D\}$ with $D=3$. Approximate output bounds for \textit{Kursawe} are given as $f_1(\bm{x}) \in \left[-20,-4\right]$ and $f_2(\bm{x}) \in \left[-12,25\right]$. \par We also include the $\text{S}^+$ and $\text{S}^-$ benchmark from \citet{olofsson2018bayesian} to test the proposed algorithm on a problem that has both convex and concave sections on the Pareto frontier. The functions are defined as follows: \begin{equation} \label{eq:sin} \begin{cases} f_1(\bm{x}) = x_1, \\ f_2(\bm{x}) = 10 - x_1 + x_2 \pm \sin\left( x_1 \right) \end{cases} \end{equation} where $\text{S}^+$ and $\text{S}^-$ are differentiated by the sign of the sinusoidal function in $f_2$. The two-dimensional inputs for both functions are given as $x_1 \in \left[0,10\right]$ and $x_2 \in \left[0,10\right]$. The approximate bounds of both objectives are $f_1(\bm{x}) \in \left[0,10\right]$ and $f_2(\bm{x}) \in \left[-1,12\right]$. \par Based on preliminary studies we found that the performance of different algorithms is highly dependent on the quality of the initial population. \review{Therefore, we provide the same randomly sampled ten initial points to all methods for the synthetic benchmarks.} \begin{figure*} \begin{center} \includegraphics[width=0.77\paperwidth]{moo_benchmark} \end{center} \caption{\label{fig:syn_bench} Pareto frontiers of synthetic benchmark functions.} \end{figure*} \review{Table~\ref{tab:syn_res}} presents the results of all synthetic benchmark tests. \review{The average of all random seeds for the proposed tree-based surrogate model outperforms \texttt{NSGA II} and random-search on all of the benchmark problems after 80 iterations for GD, IGD and VR metrics. For the MPFE metric the proposed method wins for every synthetic function except the Kursawe function.} The results highlight the sampling-efficiency of surrogate-based methods. \pgfplotstableread[col sep=comma]{ itr,entmoot_gd,entmoot_inv_gd,entmoot_mpfe,entmoot_vr,ga_gd,ga_inv_gd,ga_mpfe,ga_vr 10,37.65 $\pm$ (7.7),4.15 $\pm$ (0.5),0.95 $\pm$ (0.1),0.03 $\pm$ (0.1),37.65 $\pm$ (7.7),4.15 $\pm$ (0.5),0.95 $\pm$ (0.1),0.03 $\pm$ (0.1) 20,\textbf{16.90} $\pm$ (7.1),\textbf{2.93} $\pm$ (0.6),\textbf{0.67} $\pm$ (0.1),\textbf{0.42} $\pm$ (0.2),24.00 $\pm$ (7.8),3.59 $\pm$ (0.6),0.89 $\pm$ (0.1),0.10 $\pm$ (0.2) 40,\:\:\textbf{4.09} $\pm$ (1.4),\textbf{1.51} $\pm$ (0.4),\textbf{0.45} $\pm$ (0.1),\textbf{1.47} $\pm$ (0.3),10.93 $\pm$ (7.7),2.83 $\pm$ (0.6),0.77 $\pm$ (0.2),0.51 $\pm$ (0.3) 60,\:\:\textbf{2.20} $\pm$ (0.4),\textbf{1.10} $\pm$ (0.4),\textbf{0.38} $\pm$ (0.2),\textbf{2.10} $\pm$ (0.4),\:\:5.89 $\pm$ (6.4),2.01 $\pm$ (0.6),0.55 $\pm$ (0.1),0.78 $\pm$ (0.4) 80,\:\:\textbf{1.48} $\pm$ (0.4),\textbf{0.87} $\pm$ (0.4),\textbf{0.30} $\pm$ (0.2),\textbf{2.54} $\pm$ (0.5),\:\:4.33 $\pm$ (4.8),1.55 $\pm$ (0.5),0.41 $\pm$ (0.1),1.29 $\pm$ (0.4) 10,25.66 $\pm$ (20.7),1.80 $\pm$ (0.5),1.56 $\pm$ (0.3),2.75 $\pm$ (0.7),25.66 $\pm$ (20.7),1.80 $\pm$ (0.5),1.56 $\pm$ (0.3),2.75 $\pm$ (0.7) 20,\:\:\textbf{5.86} $\pm$ \:\:(3.3),\textbf{1.00} $\pm$ (0.1),\textbf{0.90} $\pm$ (0.2),\textbf{4.61} $\pm$ (0.4),\:\:7.54 $\pm$ \:\:(9.7),1.37 $\pm$ (0.4),1.11 $\pm$ (0.2),3.69 $\pm$ (0.6) 40,\:\:\textbf{1.24} $\pm$ \:\:(0.9),\textbf{0.65} $\pm$ (0.1),\textbf{0.65} $\pm$ (0.2),\textbf{5.63} $\pm$ (0.5),\:\:1.58 $\pm$ \:\:(2.4),0.85 $\pm$ (0.3),0.81 $\pm$ (0.2),4.65 $\pm$ (0.6) 60,\:\:\textbf{0.69} $\pm$ \:\:(0.3),\textbf{0.53} $\pm$ (0.1),\textbf{0.58} $\pm$ (0.2),\textbf{6.16} $\pm$ (0.6),\:\:0.92 $\pm$ \:\:(1.2),0.67 $\pm$ (0.2),0.64 $\pm$ (0.2),5.46 $\pm$ (0.5) 80,\:\:\textbf{0.52} $\pm$ \:\:(0.2),\textbf{0.45} $\pm$ (0.1),\textbf{0.51} $\pm$ (0.2),\textbf{6.53} $\pm$ (0.7),\:\:0.59 $\pm$ \:\:(0.2),0.54 $\pm$ (0.1),0.56 $\pm$ (0.1),5.85 $\pm$ (0.4) 10,177.12 $\pm$ (32.6),21.15 $\pm$ (3.0),3.23 $\pm$ (0.3),0.55 $\pm$ (0.2),177.12 $\pm$ (32.6),21.15 $\pm$ (3.0),3.23 $\pm$ (0.3),0.55 $\pm$ (0.2) 20,136.79 $\pm$ (25.1),20.08 $\pm$ (2.9),3.03 $\pm$ (0.3),\textbf{0.83} $\pm$ (0.2),\textbf{136.20} $\pm$ (23.2),\textbf{18.98} $\pm$ (2.6),\textbf{2.88} $\pm$ (0.3),0.73 $\pm$ (0.2) 40,\:\: \textbf{61.70} $\pm$ (22.1),\textbf{13.84} $\pm$ (1.9),\textbf{2.47} $\pm$ (0.3),\textbf{1.41} $\pm$ (0.2),\:\:94.14 $\pm$ (18.4),17.30 $\pm$ (2.6),2.58 $\pm$ (0.3),0.99 $\pm$ (0.2) 60,\:\: \textbf{32.17} $\pm$ (11.6),\textbf{12.37} $\pm$ (2.1),2.43 $\pm$ (0.3),\textbf{1.65} $\pm$ (0.2),\:\:78.84 $\pm$ (20.0),14.74 $\pm$ (2.8),\textbf{2.39} $\pm$ (0.3),1.23 $\pm$ (0.3) 80,\:\: \textbf{23.62} $\pm$ \: (8.2),\textbf{10.71} $\pm$ (2.6),2.33 $\pm$ (0.4),\textbf{1.77} $\pm$ (0.3),\:\:57.72 $\pm$ (21.0),13.14 $\pm$ (2.4),\textbf{2.22} $\pm$ (0.3),1.41 $\pm$ (0.3) 10,27.41 $\pm$ (5.0),3.49 $\pm$ (0.4),1.77 $\pm$ (0.3),1.41 $\pm$ (0.2),27.41 $\pm$ (5.0),3.49 $\pm$ (0.4),1.77 $\pm$ (0.3),1.41 $\pm$ (0.2) 20,\textbf{17.18} $\pm$ (2.8),\textbf{2.77} $\pm$ (0.2),1.41 $\pm$ (0.1),1.90 $\pm$ (0.2),19.14 $\pm$ (3.6),2.85 $\pm$ (0.4),\textbf{1.40} $\pm$ (0.3),\textbf{1.92} $\pm$ (0.2) 40,\textbf{10.12} $\pm$ (1.0),\textbf{2.10} $\pm$ (0.2),\textbf{1.08} $\pm$ (0.2),2.26 $\pm$ (0.3),13.73 $\pm$ (2.7),2.24 $\pm$ (0.3),1.21 $\pm$ (0.2),\textbf{2.29} $\pm$ (0.2) 60,\:\:\textbf{7.27} $\pm$ (0.9),\textbf{1.76} $\pm$ (0.1),\textbf{0.96} $\pm$ (0.1),\textbf{2.60} $\pm$ (0.4),10.69 $\pm$ (2.6),2.08 $\pm$ (0.2),1.06 $\pm$ (0.2),2.47 $\pm$ (0.2) 80,\:\:\textbf{5.24} $\pm$ (0.5),\textbf{1.57} $\pm$ (0.1),\textbf{0.88} $\pm$ (0.1),\textbf{2.78} $\pm$ (0.4),\:\:8.37 $\pm$ (2.5),1.92 $\pm$ (0.1),1.01 $\pm$ (0.1),2.73 $\pm$ (0.2) 10,27.93 $\pm$ (3.8),3.26 $\pm$ (0.2),1.65 $\pm$ (0.2),1.35 $\pm$ (0.2),27.93 $\pm$ (3.8),3.26 $\pm$ (0.2),1.65 $\pm$ (0.2),1.35 $\pm$ (0.2) 20,\textbf{18.12} $\pm$ (1.9),\textbf{2.61} $\pm$ (0.2),1.31 $\pm$ (0.1),\textbf{1.92} $\pm$ (0.1),19.56 $\pm$ (2.6),2.68 $\pm$ (0.2),\textbf{1.30} $\pm$ (0.2),1.81 $\pm$ (0.1) 40,\textbf{10.35} $\pm$ (1.2),\textbf{2.02} $\pm$ (0.1),\textbf{1.10} $\pm$ (0.1),\textbf{2.55} $\pm$ (0.1),13.73 $\pm$ (2.3),2.29 $\pm$ (0.2),1.14 $\pm$ (0.1),2.15 $\pm$ (0.1) 60,\:\:\textbf{7.40} $\pm$ (0.7),\textbf{1.68} $\pm$ (0.1),\textbf{0.97} $\pm$ (0.1),\textbf{2.93} $\pm$ (0.1),10.39 $\pm$ (2.5),2.08 $\pm$ (0.1),1.05 $\pm$ (0.1),2.35 $\pm$ (0.1) 80,\:\:\textbf{5.38} $\pm$ (0.5),\textbf{1.51} $\pm$ (0.1),\textbf{0.89} $\pm$ (0.1),\textbf{3.21} $\pm$ (0.1),\:\:8.17 $\pm$ (2.3),1.95 $\pm$ (0.1),1.00 $\pm$ (0.1),2.49 $\pm$ (0.1) }\synRes \begin{table}[] \pgfplotstableset{col sep=comma} \pgfplotstableset{create on use/Problem/.style={ create col/set list={ ,Fonzeca \&, Fleming \citep{fonseca1995overview},,, ,Schaffer \citep{schaffer1985some},,,, ,Kursawe \citep{kursawe1990variant},,,, ,S+ \citep{olofsson2018bayesian},,,, ,S- \citep{olofsson2018bayesian},,,, }, }, columns/Problem/.style={string type, column type={|c}}, } \pgfplotstabletypeset[ precision=2, fixed zerofill, column type={r}, string type, every head row/.style={% before row={\hline & & \multicolumn{2}{c|}{GD ($\times 100$)} & \multicolumn{2}{c|}{inv. GD ($\times 100$)} & \multicolumn{2}{c|}{MPFE} & \multicolumn{2}{c|}{VR}\\ }, after row=\hline }, font=\scriptsize, every last row/.style={after row=\hline}, columns={Problem, itr, entmoot_gd, ga_gd, entmoot_inv_gd, ga_inv_gd, entmoot_mpfe, ga_mpfe, entmoot_vr, ga_vr}, columns/itr/.style={column name=Itr, column type={c}}, columns/entmoot_gd/.style={column name=\texttt{ENTMOOT}, column type={|c}}, columns/ga_gd/.style={column name=\texttt{NSGA2} / rnd, column type={c}}, columns/entmoot_inv_gd/.style={column name=\texttt{ENTMOOT}, column type={|c}}, columns/ga_inv_gd/.style={column name=\texttt{NSGA2} / rnd, column type={c}}, columns/entmoot_mpfe/.style={column name=\texttt{ENTMOOT}, column type={|c}}, columns/ga_mpfe/.style={column name=\texttt{NSGA2} / rnd, column type={c}}, columns/entmoot_vr/.style={column name=\texttt{ENTMOOT}, column type={|c}}, columns/ga_vr/.style={column name=\texttt{NSGA2} / rnd, column type={c|}}, every row no 5/.style={before row=\hline}, every row no 10/.style={before row=\hline}, every row no 15/.style={before row=\hline}, every row no 20/.style={before row=\hline}, ]{\synRes} \caption{ \label{tab:syn_res} Results of synthetic benchmark problems comparing \texttt{ENTMOOT} against the best result of \texttt{NSGA-II} and random-search based on different performance metrics. Each entry shows the Median of all runs with different random seeds and the standard deviation in brackets after a certain amount of black-box evaluations with winning median highlighted in bold.} \end{table} \subsection{Optimization of Windfarm Layout} \label{sec:wind} \begin{table}[] \centering \begin{tabularx}{\textwidth}{ c|X } \hline $u_j$ & experienced velocity of turbine $j$ \\ $u_0$ & ambient wind speed \\ $u_{k,j}$ & interference caused on turbine $j$ by turbine $k$ \\ $C_{T,k}$ & thrust coefficient of $k$-th turbine at given windspeed \\ $A_j$ & rotor area of $j$-th turbine \\ $A_{k,j}$ & rotor area of $j$-th turbine lying in the wake of turbine $k$ \\ $h_\text{hub}$ & turbine hub height \\ $z_0$ & surface roughness height \\ $\text{dist}_{k,j}$ & distance between turbines $k$ and $j$ \\ $\xi$ & degree of wake expansion \\ $R_k$ & radius of wind turbine $k$ \\ $c_{k,j}$ & distance from turbine $j$ to center of wake from turbine $k$ when it reaches turbine $j$ \\ $f_w$ & annual frequency at which certain wind speeds occur \\ $P_j(\cdot)$ & power generated by turbine $j$ \\ $P_j^\text{ideal}(\cdot)$ & power generated by turbine $j$ without wake effects\\ $x_\text{turb},k$ & x-coordinates of turbine $k$ \\ $y_\text{turb},k$ & y-coordinates of turbine $k$ \\ $b_k$ & binary variable indicating if turbine $k$ is active \\ $b_{k,j}^\text{dist}$ & auxiliary binary variable indicating if distance constrained for turbines $k$ and $j$ is active \\ $\text{dist}_{k,j}$ & continuous variable for distance between turbines $k$ and $j$, change with definition above \\ $\alpha_\text{samp}$ & continuous variable that gives maximum distance to closest sampling point \\ $k_i^{d,+}$ & auxiliary variable takes positive contribution of Manhattan distance between $x_i$ and data point $d$ \\ $k_i^{d,-}$ & auxiliary variable takes negative contribution of Manhattan distance between $x_i$ and data point $d$ \\ $N_\text{turb}$ & number of active turbines \\ \hline \end{tabularx} \caption{Wind turbine benchmark table of notation.} \label{tab:wind_turbine_notation} \end{table} \subsubsection{General Model Description} In this section, we consider the optimal layout of an offshore windfarm based on the model by \citet{rodrigues2016multi}. In general, formulations for optimization of windfarm layouts can be nonlinear, multi-modal, non-differentiable, non-convex, and discontinuous, making them difficult to solve using model-based optimization techniques. Therefore, the resulting problems are often solved using multi-objective black-box optimization schemes. We note that, while the model presented here is based on several simplifications, the proposed optimization strategy is general and can be applied to more complicated windfarm models, including those that cannot be expressed analytically. The placement of wind turbines is complicated by wake effects, or the effect of one turbine on the power generation of another. Wake losses are approximated using the model by \citet{katic1986simple}, which provides a simple model for approximating wind velocity in the wake of some turbine(s). Table~\ref{tab:wind_turbine_notation} provides the notation for this case study. Following this model, the velocity experienced by the $j$-th turbine is expressed: \begin{equation} u_j = u_0(1-\sqrt{\sum_{k \neq j} u_{k,j}^2}) \end{equation} where $u_0$ is the ambient wind speed (without wake effects) and $u_{k,j}$ is the interference caused on turbine $j$ by turbine $k$. The pairwise interference terms are calculated as: \begin{align} u_{k,j} &= \frac{1-\sqrt{1-C_{T,k}}}{(1+\xi \text{dist}_{k,j}/R_j)^2} \frac{A_{k,j}}{A_j} \\ \xi &= 0.5 \mathrm{log}^{-1}\left( \frac{h_\mathrm{hub}}{z_0} \right) \end{align} where $C_{T,k}$ is the thrust coefficient of the $k$-th turbine at a given windspeed, $A_j$ is the rotor area of the $j$-th turbine, and $A_{k,j}$ is the rotor area of the $j$-th turbine that lies in the wake of turbine $k$. The variable $\text{dist}_{k,j}$ denotes distance between turbines $k$ and $j$, and $\xi$ represents the degree of wake expansion, computed using turbine hub height $h_\mathrm{hub} = 107$ m, and surface roughness height $z_0$, assumed to be $5\times10^{-4}$ m. It is further assumed that the wake of each turbine expands linearly, i.e., $R_{k,j} = R_k + \xi \text{dist}_{k,j}$, where $R_k$ is the radius of the turbine rotor. Therefore, the rotor area of turbine $j$ in the wake of turbine $k$, $A_{k,j}$, can be computed as: \begin{multline} A_{k,j} = \frac{1}{2} \left( R_{k,j}^2 \left( 2 \mathrm{arccos}\left( \frac{R_{k,j}^2 + c_{k,j}^2 - R_j^2}{2 R_{k,j} c_{k,j}} \right) - \mathrm{sin} \left( 2 \mathrm{arccos}\left( \frac{R_{k,j}^2 + c_{k,j}^2 - R_j^2}{2 R_{k,j} c_{k,j}} \right) \right) \right) \right) + \\ \frac{1}{2} \left( R_{j}^2 \left( 2 \mathrm{arccos}\left( \frac{R_{j}^2 + c_{j,k}^2 - R_{k,j}^2}{2 R_{j} c_{j,k}} \right) - \mathrm{sin} \left( 2 \mathrm{arccos}\left( \frac{R_{j}^2 + c_{k,j}^2 - R_{k,j}^2}{2 R_{j} c_{j,k}} \right) \right) \right) \right) \end{multline} where $c_{k,j}$ is the distance from turbine $j$ to the center of the wake from turbine $k$ when it reaches turbine $j$. Note that if the wake front entirely covers turbine $j$, then instead $A_{k,j}$ is set to $\pi R_j^2$, and if the wake front does not impact turbine $j$, then $A_{k,j} = 0$. Wind turbines are assumed to be identical ``Vestas 8 MW'' units, whose power and thrust curves are linearly interpolated and given in \citet{rodrigues2016multi}. Each turbine has a rotor radius of 82 m. We further use the discretized North Sea wind distribution data from \citet{rodrigues2016multi}. \review{This application places the base of up to 16 wind turbines within a square 15.21~$\text{km}^2$ area based on optimal tradeoffs of two conflicting objectives to explore the Pareto frontier.} We represent the coordinates of each turbine using two continuous variables; therefore, the degrees of freedom for the \textit{windfarm} problem $\bm{x}$ comprise 32 positive continuous variables, i.e.\ Equ.~\eqref{eq:req_constr_f} and Equ.~\eqref{eq:req_constr_g}, denoting the location of each of the 16 wind turbines. Furthermore, 16 binary variables, i.e.\ Equ.~\eqref{eq:const_e}, are introduced to indicate which wind turbines are active. Optimization of the windfarm layout involves two objective functions: \begin{equation} \begin{cases} f_1(\bm{x}) = \frac{\sum_w \sum_{j=1}^{16} P_j(u_w) f_w}{\sum_w 16 P_j^\mathrm{ideal}(u_w) f_w}, \\ f_2(\bm{x}) = \frac{\sum_w \sum_{j=1}^{16} P_j(u_w) f_w}{N_\text{turb} P_j^\mathrm{ideal}}. \end{cases} \end{equation} where $P_j(u_w)$ is the power generated by turbine $j$ generated at wind velocity $u_w$ (wind data is discretized in to winds with velocity $u_w$ and frequency $f_w$). $P_j^\mathrm{ideal}(u_w)$ is the power generated by turbine $j$ at wind velocity $u_w$ without any wake effects, and $N_\text{turb}$ is the number of turbines placed in the farm. The objectives $f_1$ and $f_2$ correspond to the energy production and efficiency, respectively. The two objectives represent conflicting design goals, as production is increased by placing more turbines in the wind farm. However, wake effects also increase with the number of turbines, decreasing the windfarm efficiency. \subsubsection{Optimization Benchmark} \label{sec:wind_opt_bench} \begin{figure*} \begin{center} \includegraphics[width=0.55\paperwidth] {ex_wind_turbine} \end{center} \caption{\label{fig:ex_wind} \review{Example for feasible layout using three wind turbines visualizing optimization variables from Equ.~\eqref{eq:req_constr}. Variabels $b$ indicate if a wind turbine is active and $[x,y]$ give its coordinates. Circles around wind turbines indicate the Equ.~\eqref{eq:req_constr_b} minimum distance constraints of 975 m between individual wind turbines.}} \end{figure*} For the \textit{windfarm} benchmark we distinguish between required and supporting constraints, i.e.\ Equ.~\eqref{eq:req_constr} and Equ.~\eqref{eq:help_constr}, respectively. Required constraints are given by the problem description and must be satisfied by feasible solutions. Equ.~\eqref{eq:req_constr_b} define auxiliary variables $\text{dist}_{i,j}$ as the distance between two wind turbine locations and Equ.~\eqref{eq:req_constr_c} defines the minimum of distance $\text{dist}_{k,j}$ as 975 m when both turbines $k$ and $j$ are active which is given when Equ.~\eqref{eq:req_constr_d} is zero. \review{Fig.~\ref{fig:ex_wind}} depicts a feasible layout for three wind turbines. Moreover, supporting constraints in Equ.~\eqref{eq:help_constr} are added to break symmetry and remove equivalent solutions. Equ.~\eqref{eq:help_constr_a} assures that wind turbines are activated in an increasing order, e.g.\ for the case that two wind turbines are active this allows only for binary variables $b_1$ and $b_2$ to be active. The inequality constraints Equ.~\eqref{eq:help_constr_b} and Equ.~\eqref{eq:help_constr_c} enforce a default location of $(0,0)$ for inactive wind turbines since their location has no influence on the black-box objective. We found that \texttt{NSGA-II} struggles to consistently provide feasible solutions for the required constraints in Equ.~\eqref{eq:req_constr}, so we exclude supporting constraints from Equ.~\eqref{eq:help_constr} because they further restrict the search space. Since \texttt{ENTMOOT} and the initial sampling set both provide guaranteed $\epsilon$-feasible solutions, additional supporting constraints from Equ.~\eqref{eq:help_constr} can be added to further limit the search space and prevent the algorithm from finding redundant solutions. \\ \textbf{Required Constraints} \begin{subequations} \label{eq:req_constr} \begin{flalign} & \sum\limits_{k = 1}^{|\bm{b}|} b_k \geq 1, & & \label{eq:req_constr_a}\\ & \text{dist}_{k,j}^2 \leq \left( x_{\text{turb},k} - x_{\text{turb},j} \right)^2 + \left( y_{\text{turb},k} - y_{\text{turb},j} \right)^2, & & \forall k \in \left[ 1, ..., 16 \right], \; \forall j \in \left[ k + 1, ..., 16 \right] \label{eq:req_constr_b}\\ & b_{k,j}^{\text{dist}} \rightarrow \text{dist}_{i,j} \geq 975, & & \forall k \in \left[ 1, ..., 16 \right], \; \forall j \in \left[ i + 1, ..., 16 \right], \label{eq:req_constr_c} \\ & b_{k,j}^{\text{dist}} = b_k \cdot b_j, & & \forall k \in \left[ 1, ..., 16 \right], \; \forall j \in \left[ k + 1, ..., 16 \right], \label{eq:req_constr_d} \\ & \bm{b} \in \left\{ 0, 1 \right\}^{16}, & & \label{eq:req_constr_e} \\ & \bm{x}_{\text{turb}} \in \left[ 0.0, 3900.0 \right]^{16}, & & \label{eq:req_constr_f} \\ & \bm{y}_{\text{turb}} \in \left[ 0.0, 3900.0 \right]^{16} & & \label{eq:req_constr_g} \\ & \text{dist}_{k,j} \in \mathbb{R}^\text{+}, & & \forall k \in \left[ 1, ..., 16 \right], \; \forall j \in \left[ k + 1, ..., 16 \right] \label{eq:req_constr_h}\\ & b_{k,j}^{\text{dist}} \in \left\{ 0, 1 \right\}, & & \forall k \in \left[ 1, ..., 16 \right], \; \forall j \in \left[ k + 1, ..., 16 \right]. \label{eq:req_constr_i} \end{flalign} \end{subequations} \textbf{Helper Constraints} \begin{subequations} \label{eq:help_constr} \begin{flalign} & b_k \geq b_{k+1}, & & \forall k \in \left[ 1, ..., 15 \right], \label{eq:help_constr_a} \\ & \neg b_i \rightarrow x_{\text{turb},k} \leq 0, & & \forall k \in \left[ 1, ..., 16 \right], \label{eq:help_constr_b} \\ & \neg b_i \rightarrow y_{\text{turb},k} \leq 0, & & \forall k \in \left[ 1, ..., 16 \right]. \label{eq:help_constr_c} \end{flalign} \end{subequations} We use an advanced initialisation strategy to ensure that only feasible initial populations are provided for both \texttt{ENTMOOT} and \texttt{NSGA-II}. Moreover, the solutions are created for fixed numbers of wind turbines. The goal is to provide 16 initial solutions with $1, 2, ..., 16$ wind turbines to expose both tested algorithms to initial points that contain all possible numbers of wind turbines. The algorithm to compute the initial set of data points $\mathcal{D}_\text{init}$ is given as Algorithm~\ref{algo:init}. The first data point has one turbine placed at the middle of the field with random noise $\epsilon_\text{noise}$ added to the its position to get varying results for different random seeds. Equ.~\eqref{eq:init} takes into consideration all data points that are currently in $\mathcal{D}_\text{init}$ and maximizes the Manhattan distance to the closest sample that is available. We encode the Manhattan distance according to \citet{giloni2002L1}. Equ.~\eqref{eq:man_c} enforces $k_i^{d,+}$ and $k_i^{d,-}$ to take positive and negative values of the difference between $x_i$ and the closest data point, respectively. Equ.~\eqref{eq:const_d} is implemented using special ordered sets \citep{tomlin1988SOS} to assure that at least one of the variables $k_i^{d,+}$ and $k_i^{d,-}$ is zero. The fixed number $N_\text{turb}$ of turbines per iteration is enforced through the summation constraint Equ.~\eqref{eq:man_f}. \\ \begin{algorithm}[H] \begin{algorithmic}[1] \Require{$seed \in \mathbb{Z}^+$} \Ensure{$\mathcal{D}_\text{init}$} \State{$\mathcal{D}_\text{init} \gets \{\}$} \State{$N_\text{turb} \gets 1$} \State{$\epsilon_\text{noise} \gets$ random$\left(0, 1950.0, seed\right)$} \State{$x_{\text{turb},0} \gets 1950.0 + \epsilon_\text{noise}$} \State{$y_{\text{turb},0} \gets 1950.0 + \epsilon_\text{noise}$} \State{$\bm{x}_{\text{init}} \gets$ Solve Equ.~\eqref{eq:init} s.t.\ Equ.~\eqref{eq:req_constr} and Equ.~\eqref{eq:help_constr} with $x_{\text{turb},0}$, $y_{\text{turb},0}$ and $N_\text{turb}$} \State{$\mathcal{D}_\text{init} \gets \mathcal{D}_\text{init} \bigcup \bm{x}_{\text{init}}$} \For{$l \gets 2$ to $16$} \State{$N_\text{turb} \gets l$} \State{$\bm{x}_{\text{init}} \gets$ Solve Equ.~\eqref{eq:init} s.t.\ Equ.~\eqref{eq:req_constr} and Equ.~\eqref{eq:help_constr} with $\mathcal{D}_\text{init}$ and $N_\text{turb}$} \State{$\mathcal{D}_\text{init} \gets \mathcal{D}_\text{init} \bigcup \bm{x}_{\text{init}}$} \EndFor \end{algorithmic} \caption{Wind turbine initialisation algorithm.} \label{algo:init} \end{algorithm} \begin{subequations} \label{eq:init} \begin{flalign} & & \bm{x}_{\text{init}} \in \underset{\bm{x}} {\text{arg min}} & \; - \alpha_\text{samp} & \\ & & \text{s.t.} \; \; & \alpha_\text{samp} \leq \sum\limits_{i \in \left [ n \right ]} k_i^{d,+} + k_i^{d,-}, & & \forall d\in \mathcal{D}_\text{init}, \label{eq:man_b}\\ & & & x_i^{d,\text{norm}} - \frac{x_i - v^L_i}{v^U_i - v^L_i} = k_i^{d,+} - k_i^{d,-}, & & \forall d\in \mathcal{D}_\text{init}, \forall i \in \left [ n \right ],\label{eq:man_c}\\ & & & k_i^{d,+} \cdot k_i^{d,-} = 0, & & \forall d\in \mathcal{D}_\text{init}, \forall i \in \left [ n \right ], \label{eq:man_d}\\ & & & k_i^{d,+}, k_i^{d,-} \geq 0, & & \forall d\in \mathcal{D}_\text{init}, \forall i \in \left [ n \right ], \label{eq:man_e}\\ & & & \sum\limits_{i = 1}^{|\bm{b}|} b_i = N_\text{turb}. & & \label{eq:man_f} \end{flalign} \end{subequations} \begin{figure*} \begin{center} \includegraphics[width=0.78\paperwidth]{windfarm} \end{center} \caption{Compares windpark layout optimization results of \texttt{NSGA-II} (green), \texttt{ENTMOOT} (purple) and feasible sampling strategy (yellow). \textbf{(left)}~Hypervolume bounded by Pareto frontier approximation after a certain number of function evaluations. \textbf{(right)}~Best Pareto frontier approximation found for different algorithms based on hypervolume. Objectives are dimensionless due normalization based on physical limits.} \label{fig:res_windfarm} \end{figure*} \begin{figure*} \begin{center} \includegraphics[width=0.80\paperwidth] {Windfarm_layout} \end{center} \caption{\review{\label{fig:res_wind_layout} Example windpark layouts for highest average energy objective solutions not including initial samples, i.e. \textbf{(left)} \texttt{ENTMOOT} and \textbf{(right)} \texttt{NSGA-II}. Circles around wind turbines indicate the Equ.~\eqref{eq:req_constr_b} minimum distance constraints of 975 m between individual wind turbines. \texttt{ENTMOOT} is able to place all 16 turbines while \texttt{NSGA-II} is only able to place 15 due to constraint violation.}} \end{figure*} Fig.~\ref{fig:res_windfarm} shows the bounded hypervolume for different algorithms for a total of 500 black-box evaluations. For better comparison we include test runs for the initial sampling strategy where 500 total samples are generated. \texttt{NSGA-II} finds significantly better results early on when compared to a similar study presented in \citep{rodrigues2016multi}, which is likely due to variety of initial feasible points provided, since GAs generate new black-box input proposals based on the previously observed population. However, even the feasible sampling strategy quickly outperforms \texttt{NSGA-II}, emphasizing the importance of providing feasible black-box input proposals. This is even more evident for solutions with large average energy production and low energy efficiency since these refer to windfarm layouts with a high number of wind turbines where more energy is produced with low energy efficiency due to wake effects. From an optimization perspective such solutions are more difficult due to Equ.~\eqref{eq:req_constr_b} minimum distance constraints enforced between all turbines that become increasingly restrictive for a growing number of wind turbines. \review{Fig.~\ref{fig:res_wind_layout} depicts layout proposals given by \texttt{ENTMOOT} and \texttt{NSGA-II} for highest average energy production, i.e.\ solutions with high number of turbines, when excluding the set of initial samples. While \texttt{NSGA-II} fails to place all 16 turbines due to constraint violation, \texttt{ENTMOOT} manages to find a feasible solution for all turbines available highlighting its capability to explore the entire Pareto frontier of non-dominated objective trade-offs. \review{Moreover, \texttt{ENTMOOT} profits from its capability to explicitly handle input constraints. The presented 32-dimensional case study has a smaller effective dimensionality since only positions of active turbines influence the black-box outcome, e.g. if only one turbine is active, the problem becomes three dimensional. Since \texttt{ENTMOOT} can capture this hierarchical structure, it never revisits equivalent solutions and better uses the sampling budget.} Fig.~\ref{fig:res_windfarm} depicts the best Pareto frontier approximations found by each algorithm and shows \texttt{ENTMOOT}'s outstanding performance compared to \texttt{NSGA-II} for high average energy production solutions due to guaranteed feasible input proposals even for highly-constrained problems.} \texttt{ENTMOOT} also outperforms the feasible sampling strategy, highlighting the significance of using tree ensembles as surrogate models to learn multi-objective systems. Note that \citet{rodrigues2016multi} only tested on a discrete grid with varying resolution because continuous coordinates were deemed too difficult. With 500 iterations, \texttt{ENTMOOT} for the continuous case outperforms all methods presented in \citep{rodrigues2016multi} for the highest discretization resolution even after up to $10^6$ iterations. While one can argue that the windfarm layout benchmark presented here is cheap to evaluate, real-world layout planning will require many expensive dynamic fluid simulations, and sampling-efficient algorithms can help with quickly finding good solutions \subsection{Battery Material Optimization} \begin{table}[] \centering \begin{tabularx}{\textwidth}{ c|X } \hline $p$ & parameter set picked for default values \\ $\epsilon_\text{poros}^+$ & porosity of positive battery side \\ $\epsilon_\text{active}^+$ & active material volume fraction of positive battery side \\ $R_\text{particle}^+$ & particle radius of positive battery side \\ \review{$C$} & \review{current that discharges the battery in one hour} \\ $\lambda^+$ & electrode thickness scaling factor of positive battery side \\ $\epsilon_\text{poros}^-$ & porosity of negative battery side \\ $\epsilon_\text{active}^-$ & active material volume fraction of negative battery side \\ $R_\text{particle}^-$ & particle radius of negative battery side \\ $\lambda^-$ & electrode thickness scaling factor of negative battery side \\ \review{$I$} & \review{discharge current} \\ \review{$V$} & \review{discharge voltage} \\ \review{$t$} & \review{discharge time} \\ \hline \end{tabularx} \caption{Battery benchmark table of notation.} \label{tab:battery_notation} \end{table} \subsection{General Model Description} Battery technology is a popular field of research and there are many examples in literature that successfully model key performance metrics, e.g.\ capacity degradation \citep{severson2019data}, by using data-driven approaches. In this section we consider Lithium-ion battery optimization: namely how to simultaneously achieve high energy and power density. For this exercise the open-source software PyBaMM \citep{Sulzer2021} is used, which comprises a number of mathematical models for simulating the important physical processes that occur within batteries. PyBaMM makes extensive use of the CasADi framework \citep{Andersson2019} to solve the system of DAEs and the NumPy \citep{Harris2020} python package for array manipulation. Within the PyBaMM framework, the Single Particle Model with electrolyte effects (SPMe) \citep{Marquis2019} is chosen as it offers a good compromise between computational cost and accuracy (including electrolyte losses and particle diffusion). While recent works \citep{Tranter2020a} and \citep{Timms2021} have studied battery-state heterogeneity, we select a one-dimensional, isothermal formulation here for simplicity, noting that the proposed framework is agnostic to the form of the black-box model. The full suite of battery models available in PyBaMM is described in \citet{Marquis2020}. A typical Lithium-ion battery comprises layers of electrodes containing active material that host the ions at different open-circuit potentials. These electrodes are separated by non-conductive, electrolyte filled polymers, with layers alternating between anode (negative) and cathode (positive). The electrodes are usually coated onto both sides of metallic foils that form the current collectors, which are typically copper and aluminium. The battery charges and discharges when an external current is passed between the cell terminals, and ions flow internally within the electrolyte between the electrodes, completing redox reactions at the active-material surfaces. Each electrode is formed of a solid matrix mixture of active material, to support the intercalation of lithium ions, and carbon binder which structurally supports the active material and conducts electrons towards the reaction sites. The matrix is porous, allowing electrolyte to penetrate the material and conduct ions in the liquid phase to participate in the reactions. The active material in the anode is typically graphite and has an open-circuit potential close to zero, compared with lithium, and the active material in the cathode is commonly a transition metal or combination thereof, for example Nickel, Manganese and Cobalt or (NMC). The composition/chemistry of both electrodes, but especially the cathode, can vary quite significantly for different applications. Some materials, e.g., lithium-iron-phosphate (LFP), are more stable and longer lasting, but have a lower open-circuit voltage, and therefore, the resulting battery has lower power density. Aside from chemistry, the dimensions of the layers and microstructural design of the materials also greatly affects whether a cell performs better as a high-energy or high-power cell. The losses within the cells are characterised by overpotentials that manifest by reducing the cell voltage, and these are typically dependent on the operating current. As batteries are usually operated within determined voltage windows for safety and longevity, the recoverable capacity (and cell voltage) decreases when cycling at higher rates. Two important transport related phenomena within the cell in particular are: ion migration within the electrolyte, and diffusion within the active material. The interlayer transport is largely determined by the volume fractions of the electrode constituents, which also in turn affect the tortuosity of the transport pathways. The porosity of the solid electrode matrix refers to the volume fraction of the space that is filled with electrolyte. A decreased porosity here results in a corresponding increase in active material volume (and therefore specific capacity); however, the transport is then on average more difficult, and the cell will not be able to operate at high power. Similarly, if the electrodes are made thicker then the overall active material volume fraction will increase compared to inactive components such as current collectors and separators, but transport losses will increase as ions have further to travel to reach all parts of the cell. Finally, another key microstructural parameter is the average size of active particles. Smaller particles will have better solid diffusion losses and a greater active surface area per volume, but may necessitate a greater binder volume fraction in order to keep them structurally stable and provide enough electron pathways to the increased number of active sites. Given all the above considerations, this case study seeks to select a set of hyper-parameters using published parameter sets from the battery literature \citep{Ai2019, Chen2020a, Ecker2015, Ecker2015a, Marquis2019, Yang2017} and then explore various geometrical parameters in order to find an optimal high energy and high power combination. Table~\ref{tab:battery_notation} lists the notation for this case study. \review{The mean power and discharged energy of the battery cell form the objective functions, i.e. $f_1$ and $f_2$, respectively, and are defined as:} \begin{equation} \begin{cases} \review{f_1(\bm{x}) = \overline{IV},} \\ \review{f_2(\bm{x}) = \int_{0}^{t} IV \,dt}, \end{cases} \end{equation} \review{where $I$ is the current, $V$ is the voltage and $t$ is discharge time. As simulations are performed on a 1-D domain an arbitrary cross-sectional area is assigned to the battery and determines the cell volume along with the layer thickness which is varied between cases. Cell volume is used to normalize the objective functions making them comparable for different runs.} \subsubsection{Optimization Benchmark} \begin{figure*} \begin{center} \includegraphics[width=0.78\paperwidth]{battery} \end{center} \caption{Compares battery optimization results of \texttt{NSGA-II} (green), \texttt{ENTMOOT} (purple) and feasible sampling strategy (yellow). \textbf{(left)}~Hypervolume bounded by Pareto frontier approximation after a certain number of function evaluations. \textbf{(right)}~Best Pareto frontier approximation found for different algorithms based on hypervolume.} \label{fig:res_battery} \end{figure*} \review{Reasonable bounds for all optimization variables are given in Equ.~\eqref{eq:bat_h}~-~Equ.~\eqref{eq:bat_q}, with variable $p$ indicating the parameter set selected. We model the variable $p$ as a categorical variable, as it is difficult to quantify a distance between different parameter sets $\{\text{Ai2019},\ \text{Chen2020},\ \text{Ecker2015},\ \text{Marquis2019},\ \text{Yang2017}\}$. } Variables $\epsilon_{\text{poros}}$, $\epsilon_{\text{active}}$ and $R_{\text{particle}}$ denote porosity, active material volume fraction and particle radius and are optimized for both positive and negative side of the battery, i.e.\ indicated by $+$ and $-$. The negative and positive side electrode thickness is scaled by optimization variable $\lambda$ allowing a continuous range between half and double the size of the default electrode. Since porosity translates to the volume fraction of the electrolyte, Equ.~\eqref{eq:bat_a} and Equ.~\eqref{eq:bat_b} limit the sum of porosity and active material volume fraction $\epsilon_\text{active}$ to $0.95$ leaving a volume fraction of $5 \%$ for binder material. Different battery specifications are designed for certain C-rate ranges, i.e.\ $1 \text{C}$ translates to the current that discharges the battery in 1 hour, and is denoted by variable $C$. Too high values of $C$ certain battery designs cause PyBaMM simulations to fail. To reduce the number of failed simulations we introduce custom upper bounds for $C$ in Equ.~\eqref{eq:bat_c}~-~Equ.\eqref{eq:bat_g} based on preliminary studies for all parameter sets in $p \in \{\text{Ai2019},\ \text{Chen2020},\ \text{Ecker2015},\ \text{Marquis2019},\ \text{Yang2017}\} $ without modifying other optimization variables. Both objectives, i.e. \ power and discharged energy, are normalized based on best minimum and maximum values observed throughout all computational runs. \review{In summary, this case study has one categorical variable describing the underlying parameter set that is being used, i.e.\ Equ.~\eqref{eq:bat_h}, and nine continuous variables denoting various design parameters of the battery cell that can be optimized, i.e.\ Equ.~\eqref{eq:bat_i}~-~Equ.~\eqref{eq:bat_q}. Equ.~\eqref{eq:bat_a}~-~Equ.~\eqref{eq:bat_g} comprise seven additional constraints for input variables.} \textbf{Required Constraints} \begin{subequations} \label{eq:req_constr_battery} \begin{flalign} & \epsilon_{\text{poros}}^{-} + \epsilon_{\text{active}}^{-} \leq 0.95 & & \label{eq:bat_a} \\ & \epsilon_{\text{poros}}^{+} + \epsilon_{\text{active}}^{+} \leq 0.95 & & \label{eq:bat_b}\\ & (p = \text{Ai2019}) \rightarrow C \leq 3.2 & & \label{eq:bat_c} \\ & (p = \text{Chen2020}) \rightarrow C \leq 2.2 & & \label{eq:bat_d} \\ & (p = \text{Ecker2015}) \rightarrow C \leq 8.2 & & \label{eq:bat_e} \\ & (p = \text{Marquis2019}) \rightarrow C \leq 5.2 & & \label{eq:bat_f} \\ & (p = \text{Yang2017}) \rightarrow C \leq 8.2 & & \label{eq:bat_g} \\ & p \in \{\text{Ai2019},\ \text{Chen2020},\ \text{Ecker2015},\ \text{Marquis2019},\ \text{Yang2017}\} & & \label{eq:bat_h}\\ & C \in \left[0.5, 8.2\right] & & \label{eq:bat_i} \\ & \epsilon_{\text{poros}}^{-} \in \left[0.2,0.7 \right] & & \label{eq:bat_j} \\ & \epsilon_{\text{active}}^{-} \in \left[0.2,0.7 \right] & & \label{eq:bat_k} \\ & R_{\text{particle}}^{-} \in \left[\num{1e-6}, \num{20e-6} [m]\right] & & \label{eq:bat_l} \\ & \epsilon_{\text{poros}}^{+} \in \left[0.2,0.7 \right] & & \label{eq:bat_m} \\ & \epsilon_{\text{active}}^{+} \in \left[0.2,0.7 \right] & & \label{eq:bat_n} \\ & R_{\text{particle}}^{+} \in \left[\num{1e-6}, \num{20e-6} [m]\right] & & \label{eq:bat_o} \\ & \lambda^- \in \left[0.5,2.0\right] & & \label{eq:bat_p} \\ & \lambda^+ \in \left[0.5,2.0\right] & & \label{eq:bat_q} \end{flalign} \end{subequations} \review{A procedure similar to Algorithm~\ref{algo:init} provides ten feasible initial points to all competing methods. We fix the categorical variable $p \in \{\text{Ai2019},\ \text{Chen2020},\ \text{Ecker2015},\ \text{Marquis2019},\ \text{Yang2017}\} $ for individual points to obtain two points for each possible parameter set $p$. For the general case, the method extends Equ.~\eqref{eq:init} with similarity measures, e.g.\ Equ.~\eqref{eq:overlap} and Equ.~\eqref{eq:goodall4}, to increase diversity in initial samples with respect to categorical features.} \\ Fig.~\ref{fig:res_battery} shows hypervolume improvement and best Pareto frontier approximations for the battery design benchmark. All methods are capable improving the hypervolume of the objective space. Compared to the Section~\ref{sec:wind} benchmark the constraints given in Equ.~\eqref{eq:req_constr_battery} are less restrictive making feasible solutions more attainable and allowing \texttt{NSGA-II} to surpass the feasible sampling strategy. \texttt{ENTMOOT} manages to outperform other strategies for all different random seeds considered. The Fig.~\ref{fig:res_battery} best Pareto frontier approximations derived by competing methods show that \texttt{NSGA-II} spends a large amount of evaluation budget to improve already explored points while \texttt{ENTMOOT} is actively exploring the entire objective space. \texttt{ENTMOOT} especially dominates when it comes to high power solutions which are dominated by high C-rates. Since, \texttt{ENTMOOT} guarantees feasibility of proposed solutions, C-rates are kept below the bounds specified in Equ.~\eqref{eq:bat_c}~-~Equ.\eqref{eq:bat_g} allowing for a higher frequency of successful simulations. The feasible sampling strategy manages to only find two non-dominated points for the Pareto frontier approximation. \section{Conclusion} Energy systems with multiple opposing objects are challenging to optimize due to complex system behavior, highly restrictive input constraints and large feature spaces with heterogenous variable types. The resulting problems are often handled using multi-objective Bayesian optimization, owing to relatively high sampling efficiency and ability to directly include input constraints. Tree-based models represent promising candidates for this class of optimization problems, as they are well-suited for nonlinear/discontinuous functions and naturally support discrete/categorical features. Nevertheless, uncertainty quantification and optimization over tree models are non-trivial, limiting their deployment in black-box optimization. Given the above, this work introduces a multi-objective black-box optimization framework based on the tree-based \texttt{ENTMOOT} tool. The proposed all-in-one strategy addresses all of the above challenges, while also providing better sampling efficiency compared to the popular state-of-the-art tool \texttt{NGSA-II}. \review{In a comprehensive numerical study, we demonstrate the advantages of the proposed framework on both synthetic problems and energy-related benchmarks, including windfarm layout optimization and lithium-ion battery design with two objective functions.} In both energy-related benchmarks, \texttt{ENTMOOT} identifies better Pareto frontiers, and in significantly fewer iterations, compared to \texttt{NGSA-II} and a random search strategy. Due to its versatility and sampling efficiency we envision \texttt{ENTMOOT} to be strongly relevant to real-world and industrial settings where experimental black-box evaluations are expensive. \review{While the numerical studies only consider bi-objective problems, the proposed method also applies to case studies with more than two objective functions. Future research will focus on other applications with more objective functions that can benefit from the proposed method.} \clearpage \section{Acknowledgments} This work was supported by BASF SE, Ludwigshafen am Rhein, EPSRC Research Fellowships to RM (EP/P016871/1) and CT (EP/T001577/1), and an Imperial College Research Fellowship to CT. TT acknowledges funding from the EPSRC Faraday Institution Multiscale Modelling Project (EP/S003053/1, FIRG003) \printbibliography \end{document}
{'timestamp': '2021-11-08T02:04:23', 'yymm': '2111', 'arxiv_id': '2111.03140', 'language': 'en', 'url': 'https://arxiv.org/abs/2111.03140'}
arxiv
\section{Summary} For generating a recg-style section of references, e.g.,~\cite{lin2012asplos}, instead of this~\cite{lin2012asplos-raw}. Also suppress all misc fields except year and pages. To get the code, do \begin{lstlisting} git clone https://code.google.com/p/recg-latex-kit/ \end{lstlisting} Usage: copy *.bst and *.bib to your latex project folder. Please contribute to the code. \section{Why needed?} RECG style expects this reference~\cite{lin2012asplos} out of the following raw bib entry downloaded from the ACM: \begin{lstlisting} @inproceedings{lin2012asplos-raw, author = {Lin, Felix Xiaozhu and Wang, Zhen and LiKamWa, Robert and Zhong, Lin}, title = {Reflex: using low-power processors in smartphones without knowing them}, booktitle = {Proceedings of the eighteenth international conference on Architectural support for programming languages and operating systems}, year = {2012}, isbn = {978-1-4503-0759-8}, location = {London, England, UK}, pages = {13--24}, numpages = {12}, url = {http://doi.acm.org/10.1145/2150976.2150979}, doi = {10.1145/2150976.2150979}, acmid = {2150979}, publisher = {ACM}, address = {New York, NY, USA}, keywords = {distributed shared memory, energy-efficiency, heterogeneous systems, mobile systems}, } \end{lstlisting} \section{Usage} \begin{enumerate} \item In your-bib.bib, replace the raw booktitle with the acronym, e.g. change \begin{lstlisting} booktitle={Proceedings of the eighteenth international conference on Architectural support for programming languages and operating systems} \end{lstlisting} to \begin{lstlisting} booktitle=ASPLOS, booktitle-full={Proceedings of the eighteenth international conference on Architectural support for programming languages and operating systems} \end{lstlisting} Note that we preserve the full name in the \texttt{booktitle-full} filed in case the full name is needed in the future, and bibtex will ignore the field when generating the reference. For all available acronyms, see abr-long.bib. \item In your paper, to generate the full reference, do: \begin{lstlisting} \bibliographystyle{abbrv-recg} \section{Motivations} \label{sec:bkgnd} \subsection{Mobile GPUs} This paper focuses on mobile GPUs which share memory with CPU. \paragraph{GPU stack and execution workflow} As shown in Figure~\ref{fig:workflow}, a modern GPU stack consists of ML frameworks (e.g. Tensorflow), a userspace runtime for GPU APIs (e.g. OpenCL), and a GPU driver in the kernel. When an app executes ML workloads, it invokes GPU APIs, e.g. OpenCL. Accordingly, the runtime prepares GPU jobs and input data: it emits GPU commands, shaders, and data to the shared memory which is mapped to the app's address space. The driver sets up the GPU's pagetables, configures GPU hardware, and submits the GPU job. The GPU loads the job shader code and data from the shared memory, executes the code, and writes back compute results and job status to the memory. After the job, the GPU raises an interrupt to the CPU. For throughput, the GPU stack often supports multiple outstanding jobs. \paragraph{CPU/GPU interactions} through three channels: \begin{myitemize} \item Registers, for configuring GPU and controlling jobs. \item Shared memory, to which CPU deposits commands, shaders, and data and retrieves compute results. Modern GPUs have dedicated pagetables, allowing them to access shared memory using GPU virtual addresses. \item GPU interrupts, which signal GPU job status. \end{myitemize} The GPU driver manages these interaction; thus it can interpose and log these interactions. \begin{comment} \paragraph{GPU record and replay} The GPU stack was architected for graphics in the first place; it included the support for compute as an afterthought. Thus, many of its key features are designed for graphics, including JIT job generation, dynamic memory management, and fine-grained sharing. These features are the major sources of complexity; they become overkills to modern ML workloads which are more predictable than graphics. A prior work~\cite{tinyStack} unwinds the stack's complexity for ML workloads. it records CPU/GPU interactions of ML workloads and interatively replays them without support of the original stack; The key rationle is ML characteristic such as running pre-defined jobs iteratively. \end{comment} \begin{comment} \paragraph{Assumptions} We have two following assumptions (which we will verify in Section XXX). 1) GPU state is controlled by the driver 2) implicit state update is done by only register write, not read, such as job submission, and the interrupt. We have empirically analyzed the XXX number of GPU drivers (e.g. mali, v3d, adreno, etc), and found no clues that the read accesses update GPU states. \jin{the GPU state is driven by a sequence of register reads/writes} From stack's point of view, GPU states are not that diverse (e.g. idle, job is running, cache is dirty, flushed, etc.) and controlled by a set of register accesses. The state change is driven by a sequence of register accesses. If no commands are send to the GPU, there will be no state changes. Some register access clearly is clearly irrelevant to the GPU state change. What is ``state''. Register reads do not change state, reads have no side effect, etc. \begin{myitemize} \item Power on/off \item MMU (page table) setup \item mem synced/cache flush or not \end{myitemize} \end{comment} \input{fig-gputrend} \subsection{Prior Approaches} Our goal is to run GPU compute inside the TrustZone TEE, for which prior approaches are inadequate. \paragraph{Porting GPU stack to TEE} One approach is to pull the GPU stack to the TEE (``lift and shift'')~\cite{HIX,secDeep}. The biggest problem is the clumsy GPU stack: the stack spans large codebases (e.g. tens of MB binary code), much of which are proprietary. The stack depends on POSIX APIs which are unavailable inside TrustZone TEE. For these reasons, it will be a daunting task to port proprietary runtime binaries and a POSIX emulation layer, let alone the GPU driver. \textit{Partitioning} the GPU stack and porting part of it, as suggested by recent works~\cite{telekine,graviton}, also see significant drawbacks: they still require high engineering efforts and sometimes even hardware modification. The ported GPU code is likely to introduce vulnerabilities to the TEE ~\cite{CVE-2014-1376,CVE-2019-5068,CVE-2019-20577}, bloating the TCB and weakens security. \paragraph{Outsourcing} Another approach is for TEE to invoke an external GPU stack. One choice is to invoke the GPU stack in the normal-world OS of the same device. Because the OS is untrusted, the TEE must prevents it from learning ML data/parameters and tampering with the result. Recent techniques include homomorphic encryption~\cite{slalom,cryptoNet}, ML workload transformation~\cite{occlumency,ternary}, and result validation~\cite{deepAttest}. They lack GPU acceleration or support limited GPU operators, often incurring significant efficiency loss. \begin{comment} \xzlNote{may omit below} The TEE may invoke a GPU service in the cloud, which, however, gives up known benefits of on-device ML. The ML apps is vulnerable to poor network connectivity. Since ML data and parameters must be sent to the cloud, the TEE must entrust data privacy with the cloud, which requires non-trivial system support. For instance, preventing data leak in cloud GPU using SGX enclaves is still an active research topic~\cite{haven,ryoan}. \end{comment} \input{fig-using} \subsection{GPU replay{} in TrustZone} Unlike prior approaches, GPU replay{} provides a new way to execute GPU-accelerated compute~\cite{tinyStack}. (1) In the record phase, app developers run their ML workload \textit{once} on a trusted GPU stack; at the driver level, a recorder logs all the CPU/GPU interactions -- register accesses, GPU memory dumps which enclose GPU commands and shaders, and interrupt events. These interactions constitute a \textit{recording} for the ML workload. (2) In the replay phase, a target app in the TEE supplies new input to the recording. The TEE does not need a GPU stack but only a simple replayer (30 KB) for interpreting and executing the logged interactions. Figure~\ref{fig:using} exemplifies how GPU replay{} works for NN inference. To record, developers run the ML inference once and produce a sequence of recordings, one for each NN layer; each NN layer invokes multiple GPU jobs, e.g. convolution or pooling. To replay, a target ML app executes the recordings in the layer order. The granularity of recordings is a developers' choice as the tradeoff between composability and efficiency. Alternatively, developers may create one monolithic recording for all the NN layers (not shown in the figure). \paragraph{Why is GPU replay{} practical?} (1) An ML workload such as NN often runs pre-defined GPU jobs. High-level GPU APIs can be translated to GPU primitives ahead of time; at run time, the workload does not need the stack's dynamic features, e.g. JIT and fine-grained sharing. (2) An NN often has a static GPU job graph with no conditional branches among jobs. A single record run can exercise all the GPU jobs and record them. (3) Nondeterministic GPU events can be systematically prevented or tolerated, allowing the replayer to faithfully reproduce the recorded jobs. For instance, the recorder can serialize GPU job submission and avoid nondeterministic interrupts. \subsection{The Problem of Recording Environment} To apply GPU replay{} to TrustZone, a missing component is the recording environment where the GPU stack is exercised and recordings are produced. Obviously, the environment should be trustworthy to the TEE. What is more important, the environment must have access to the GPU hardware that matches the GPU for replay. Recording with the exact GPU model is crucial. In our experience, one shall not even record with a different GPU model from the \textit{same} GPU family, because replay can be broken by subtle hardware differences: (1) register values which reflect the GPU's hardware configuration, e.g. shader core count, based on which the JIT compiler generate and optimize GPU shaders; (2) encodings of GPU pagetables; (3) encodings of shared memory, with which GPU communicates its execution status with CPU. \noindent \textit{Can recording be done on developers' machines? } While developers' machines can be trustworthy~\cite{devSecOps}, it would be a heavy burden for the developers to foresee all possible client GPUs and possess the exact GPU models for recording. As shown in Figure~\ref{fig:gputrend}, mobile GPUs are highly diverse~\cite{gpuRank}: today's SoCs see around 80 mobile GPU models in four major families (Apple, PVR, Mali, and Adreno); no GPU models are dominating the market; new GPU models are rolled out frequently. \noindent \textit{Can recording be done on a ``mobile device farm'' in the cloud?} While such a device farm relieves developers' burden, managing a large, diverse collection of mobile devices in the cloud is tedious if not impractical. Not designed to be hosted, mobile devices do not conform to the size, power, heat dissipation requirements of data centers. The device farm is not elastic: a device can serve one client at a time; planning the capacity and device types is difficult. As new mobile devices emerge every few months, the total cost of ownership is high. \begin{comment} \textit{1) A variety of GPU model.} Given today's diverse stock GPU models, developers should have physical GPUs that target devices equip (almost) and all of the software stack, which is extremely burdensome for each developer. Alternatively, they may use GPU stubs instead; Although possible, they are not entirely supported from GPU vendors; implementing all the stub off-the-shelf GPU model requires deep understanding of GPU model and operations. \textit{2) Lazy deployment.} The GPU stack and user application have been frequently updated by nature; for instance, the NN model provider constantly updates its model for better accuracy; the GPU vendors recurrently revise the driver to fix known vulnerabilities or newly discovered hardware quirks; the framework developer constantly releases the patches for better performance. The offline recording cannot work in step with emerging GPU applications. Alternatively, online recording on target device is possible. However, it recording on potentially vulnerable NW cannot guarantee recording integrity; a recording on SW necessitates GPU stack porting which is contract to our goal. A recent work has suggested record and replay{} GPU compute~\cite{tinyStack}, which assume developers host target-compatible GPUs and records the compute ahead of time (offline). However, it has several limitations as follows. \begin{myenumerate} \item A variety of client platforms and GPU hardware: Developers should have physical GPUs that target devices equip (almost) and all of the software stacks. Given today's heterogeneous mobile/IoT devices with the diversity of GPU hardware, it is extremely costly for each developer. Alternatively, the developer may use GPU stubs instead. Yet, GPU hardware models (even of the same family) will behave different ways (subtle). Although possible, they are not entirely supported from GPU vendors; implementing all the stub off-the-shelf GPU models requires deep understanding of GPU model and operations. \item Lazy deployment. The offline recording cannot work in step with emerging GPU applications and hence does not make a quick response towards user's needs; the users may suffer from a limited set of compute as recorded by the developers ahead of time. The users must be allowed to easily get a GPU compute not limited by developers prior efforts. \item \Note{This is an alternative. Save it later} \jin{may only valid when we care TEE deployment} Developers may record on local device like running a VM which require high maintenance effort while losing ease of deployment. Recording on the target device (which has the ``right`` GPU) defeats the purpose of development ease and makes the recording integrity questionable (i.e. the target device must ensure its GPU stack for recording integral). \item Frequent update. The GPU stack and user application have been frequently updated by nature. For instance, the NN model provider constantly updates its model for better accuracy; the GPU vendors recurrently revise the driver to fix known vulnerabilities or newly discovered hardware quirks; the framework developer consistently releases the patches for better performance. \end{myenumerate} CoDry{} solves the dilemma: it exploits the GPU hardware on the clients hence relieving the cloud from hosting and maintaining a variety of mobile/embedded GPUs. it enables the online recording that is immediately applicable when demanded by the client, which the offline (ahead of time) recording lacked. \end{comment} \section{Conclusions} CoDry{} provides a cloud service for GPU recording in a secure way; it performs GPU dryrun interacting with the client GPUs over long wireless communication. Retrofitting known I/O optimization techniques, CoDry{} significantly reduces the time and energy consumed by client to get a GPU recording. \begin{comment} \section{Concluding Remarks} \paragraph{Recording on target devices} When an app is installed to the target, CoDry{} records its GPU executions for future replay. Doing so reduces developers efforts in some use cases, e.g. replaying within TEE, since the developers do not have to know the target GPUs. It does not ease deployment because the target still needs a full stack. It raises a challenge of ensuring trustworthiness of the GPU stack for recording, which can be addressed by isolating the stack in a virtual machine and measuring its code for integrity. \paragraph{Applicability to discrete GPUs} The idea of CoDry{} is likely to apply. Our GPU hardware assumptions (\S\ref{sec:abs_model}) see counterparts on discrete GPUs albeit in different forms, e.g. registers and memory mapped via PCIe. The new challenges include more complex CPU/GPU interactions, higher GPU dynamism, and recording cost due to larger memory dumps. \paragraph{Summary} CoDry{} pre-records GPU executions for replay on new input data without a GPU stack. CoDry{} identifies key GPU/CPU interactions and memory states, works around proprietary GPU internals, and prevents replay divergence. The resultant replayer is tiny, portable, and quick to launch. \end{comment} \section{Evaluation} \label{sec:eval} \input{fig-recording-delay} The evaluation answers the following questions. \begin{myitemize} \item Is CoDry{} secure against attacks?~(\S~\ref{sec:eval-security}) \item What are the delays of CoDry{}?~(\S~\ref{sec:eval-perf}) \item Are CoDry{}'s optimizations significant? (\S~\ref{sec:eval-choice}) \item What is the energy implication of CoDry{}? (\S\ref{sec:eval:energy}) \end{myitemize} \subsection{Security Analysis} \label{sec:eval-security} \paragraph{Threat model} We trust the cloud service, assuming its GPU stack is being attested~\cite{trustedCloudComputing,psData}. We trust the client's TEE and hardware but not its OS. We consider two types of adversaries: (1) a local, privileged adversary who controls the client OS; (2) a network-level adversary who can eavesdrop the cloud/client communications during recording. \begin{comment} We assume the cloud is trustworty; the cloud guarantees the integrity of VM image in which GPU stack is well-managed and protected as part of software supplychain~\cite{nist-supplychain}. In the client side, a shim is protected by the TEE; it, however, faces a powerful local privileged or remote adversaries who has a full control of the entire system including OS kernel and local GPU stack. The adversaries may mess up or compromise recording by exploiting local GPU stack in the normal world; While a remote dryrun, they can generate unexpected register access by running another GPU application simultaneously or exploiting GPU driver's interface (i.e. IOCTL). The adversaries may also corrupt or drop the packets transferred from/to shim in the TEE. We do not defend against side channel attacks towards TrustZone TEE (e.g. power and timing); adversaries may learn NN model structure by observing GPU power usage or analyzing ML execution time. We consider packet drop and availability attacks as out of scope. \end{comment} \paragraph{Integrity} CoDry{}'s \textit{recording integrity} is collaboratively ensured by (1) the trusted cloud service, (2) the client's TrustZone hardware, and (3) the encrypted cloud/client communication. In particular, GPUShim{} locks the GPU MMIO region during recording, preventing any local adversary from tampering with GPU registers or shared memory. CoDry{}'s \textit{replay integrity} is ensured by the TrustZone hardware. Since the replayer only accepts recordings signed by the cloud, it exposes no additional attack surface to adversaries. \paragraph{Confidentiality} CoDry{}'s \textit{recording} never leaks program data from TEE, e.g. ML model parameters or inputs, since recording does not require such data. It however may leak some information about the ML workload, as the workload \textit{code} such as GPU shaders moves through the network. Although the network traffic is encrypted, it may nevertheless leak workload information, e.g. NN types, via side channels. Such side channels can be mitigated by orthogonal solutions~\cite{telekine,opaque}. Since \textit{replay} is within the client TEE and requires no client/cloud communication, its data confidentiality is given by TrustZone. We notice TrustZone may leak data to local adversaries via hardware side channels, which can be mitigated by existing solutions~\cite{TruSpy,ARMageddon}. \paragraph{Availability} Like any cloud-based service, \textit{recording} availability of CoDry{} depends on network conditions and the cloud availability, which are vulnerable to DDoS attacks. Its \textit{replay} availability is at the same level of the TrustZone TEE, given the GPU power is managed by the TEE not the OS~\cite{seCloak}. \begin{comment} \noindent \textbf{Attacks thwarted} by CoDry{} are as follows. \begin{myenumerate} \item \textit{Adversarial GPU access.} By design, the client shim isolate GPU access by locking GPU MMIO region from normal world while recording. Thereby, a local adversary who is even aware of physical address of GPU MMIO region cannot exploit GPU registers. \item \textit{GPU memory corruption} is simply defeated as the shim assigns the dedicated secure memory to the GPU after isolation mentioned above. \item \textit{Breaking packets integrity.} While a network-level attacker may sniff or corrupt packets for recording interactions, it will be prevented by secure channel in which all the packets are encrypted; the interaction integrity can be checked by authentication code accordingly. \item \textit{Disclosing NN parameters.} Even both local and remote attackers may want to sniff private NN parameters, the client is free from potential disclosure of its private data by CoDry{}' design of recording without the actual input and NN parameters. \end{myenumerate} Besides, when replaying, CoDry{} can keep the security at the same level as the prior work~\cite{tinyStack}. We do not defend against side channel (e.g. power, cache, and timing) and availability attacks. \end{comment} \begin{comment} \paragraph{Security benefits} The interaction between the cloud and the client is confidential. Before offering a GPU stack, the cloud VM establishes a secure channel with the client TEE through attestation; all the interactions are encrypted after two parties exchange a shared symmetric key (e.g. by using Diffie-Hellman). Both parties can easily detect if the data transferred to/from each other is compromised. Moreover, the cloud hypervisor assign a VM to only one client; no remote attacks that may compromise the running GPU stack in the VM. CoDry{}'s design defeats the attacks exploiting the stack's internal even unknown bugs (e.g. zero-day attacks) that threaten GPU computation and/or kernel integrity. While the recording may involve such vulnerabilities, it can be detected by our verification method in Section XXX ahead of time before replaying (e.g. access only permitted memory). CoDry{} cleans the GPU state and cache on handoff; the subsequent apps or replaying cannot sniff the data of the prior computation. As the GPU is locked (in Section XXX) during recording/replaying, a malicious normal world app cannot access the GPU or halt the current computation. \end{comment} \subsection{Performance} \label{sec:eval-perf} \paragraph{Methodology} As shown in Table~\ref{tab:model_desc}, we test CoDry{} on inference with 6 popular NNs running atop ARM Compute Library~\cite{acl}. We measure CoDry{}'s recording delay under two network conditions as controlled by NetEm~\cite{netEm}: i) WiFi-like (20 ms RTT, 80 Mbps) and ii) cellular-like (50 ms RTT, 40 Mbps)~\cite{ExLL}. The hardware platform is described in \sect{env-setup}. We study the following versions: \begin{myitemize} \item \texttt{Naive}{} incurs a round trip per register access and synchronizes entire GPU memory before/after a GPU job. \item \texttt{OursM}{} includes selective memory synchronization~(\S\ref{sec:mem-sync}). \item \texttt{OursMD}{}, in addition to \texttt{OursM}{}, includes register access deferral~(\S\ref{sec:reg-defer}); it generates per-commit round trips. \item \texttt{OursMDS}{} additionally includes speculation~(\S\ref{sec:speculation}). It represents CoDry{} with all our techniques, \end{myitemize} \paragraph{Recording delays} Figure~\ref{fig:recording-delay} shows the end-to-end recording delays. \texttt{Naive}{} incurs long recording delays even on WiFi ranging from 52 seconds (MNIST, a small NN) to 423 seconds (VGG16, a large NN). Such delays become much higher on the cellular network, range from 116 seconds to 795 seconds. As discussed in \sect{overview:delay}, such high delays not only slow down ML workload launch but also hurts interactivity because the TEE must lock the GPU during recording. Compared to \texttt{Naive}{}, \texttt{OursMDS}{} reduces the delays by up to 95\% to 18 seconds (WiFi) and 30 seconds (cellular) on average. We deem these delays as acceptable, as they are comparable to mobile app installation delays reported to be 10 -- 50 seconds~\cite{appTime}. \paragraph{Replay delays} CoDry{}'s replay incurs minor overhead in workload execution as shown in Table~\ref{tab:replay}. Compares native executions, CoDry{}'s replay delays range from 68\% lower to 3\% higher (25\% lower on average). CoDry{} performance advantage comes from its removal of the complex GPU stack. We notice that these results are consistent with the prior work~\cite{tinyStack}. \subsection{Validation of key designs} \label{sec:eval-choice} \paragraph{Efficacy of deferral} As shown in Figure~\ref{fig:recording-delay} (\texttt{OursM}{} vs. \texttt{OursMD}{}), register access deferral reduces the overall delays by 65\% (WiFi) and 69\% (cellular). Table~\ref{tab:model_desc} further shows that the deferral reduces the number of round trips by 73\% on average. With deferral, each commit encapsulates 3.8 register accesses on average. \input{tab-model-desc} \paragraph{Efficacy of speculation} We run all six benchmarks with retaining register access history in between, allowing CoDry{} to reuse history across benchmarks. Figure~\ref{fig:recording-delay} (\texttt{OursMDS}{} vs. \texttt{OursMD}{}) shows that speculation reduces the recording delays by 60\% to 74\%. Table~\ref{tab:model_desc} further shows \texttt{OursMDS}{} achieves 86~\% reduced number of round trips on average. Such benefit mainly come from coalescing round trips of asynchronous commits. We further investigate the speculation success rates and find 95\% of commits (99\% register accesses) satisfy the speculation criteria~(\S\ref{sec:speculation}). These commits are generated by GPU driver routines that roughly fall into four categories. (1) \textit{Init}: probe hardware configuration when the driver is loaded. (2) \textit{Interrupt}: read and clear interrupt status. (3) \textit{Power state}: periodic manipulation of GPU power states. (4) \textit{Polling}: busy wait for GPU to finish TLB or cache operations. Figure~\ref{fig:speculation} shows a breakdown of commits by category. All register values in these commits are highly predictable. The commits that fail the criteria are due to reads of nondeterministic register values. For example, on each job submission, the Mali driver reads and writes a register \texttt{LATEST\_FLUSH\_ID} which reflects the GPU cache state and can be nondeterministic. \input{tab-replay} \paragraph{Misprediction cost} For the above reasons, we have not observed misprediction in our 1,000 runs of each workload. To validate that CoDry{} can handle misprediction, we artificially inject into record runs wrong register values. In all the cases of injection, CoDry{} always detects mismatches between the speculative and the injected register value, initiating rollback of the software and the hardware states properly. In the worst case (misprediction at the end of a record run), we measure the delays of rollback is 1 and 3 seconds for MNIST and VGG16, respectively. The delays are primarily dominated by driver reload and GPU job recompilation, which overshadow the replay delays on the client GPU hardware. \paragraph{Selective memory synchronization} Figure~\ref{fig:recording-delay} (\texttt{OursM}{} vs. \texttt{Naive}{}) shows that the technique reduces the recording delays by 1 -- 57\% on average. The reduction is more pronounced on large NNs such as AlexNet and VGG16 (34 -- 57\%). Table~\ref{tab:model_desc} shows the network traffic for memory synchronization is reduced by 72 -- 99\%. \paragraph{Polling offloading} (\S{\ref{sec:off-polling}) The numbers of polling instances range from 117 (MNIST) to 492 (VGG16), that generate from 130 to 550 round trips. Offloading polling reduces the total round trips by 13 -- 58, making the cost of polling instance one RTT; This is because without offloading, a polling loop often takes a few RTTs (the RTT is long as compared to GPU operations being polled such as cache flush); with offloading and speculation, the RTTs often become hidden. \input{fig-speculation} \subsection{Energy consumption} \label{sec:eval:energy} We measure the whole client energy using a digital multimeter which instruments the power barrel of the client device (Hikey960). The client device has no display. It uses the on-board WL1835 WiFi module for communication; it does not run any other foreground applications. Each workload runs 500 iterations and we report the average energy. Figure~\ref{fig:energy} shows the results. \textit{Record.} The energy consumed by recording is moderate, ranging from 1.8 -- 8.2 J, which is comparable to one by installing a mobile app, e.g. 16 J for Snapchat (80MB) on the same device. Note that it is one-time consumption per workload. Compared to \texttt{Naive}{}, CoDry{} reduces the system energy consumption by 84 -- 99\%. \textit{Replay.} As a reference, we measure replay energy per benchmark. It ranges from 0.01 -- 1.3 J, consistent with the replay delays in Table~\ref{tab:replay}. The replaying energy is comparable with the native execution on the original GPU stack of the client device (not shown in the figure). \section{\@startsection {section}{1}{\z@}% \newcommand*\circled[1]{\tikz[baseline=(char.base)]{ \node[shape=circle,fill=black,draw,text=white,inner sep=1pt] (char) {#1};}} \newcommand{\Paragraph}[1]{\vskip 3pt\noindent\textbf{#1 }} \newcommand\paratitle[1]{\textit{\textbf{#1}} \hspace{1mm}} \renewcommand{\paragraph}[1]{\vskip 3pt\noindent\textbf{#1 }} \newenvironment{smitemize}% {\begin{list}{$\bullet$}% {\setlength{\parsep}{0pt}% \setlength{\topsep}{0pt}% \setlength{\itemsep}{2pt}}}% {\end{list}} \newcommand\Note[1]{\sethlcolor{yellow} \hl{#1}} \newcommand\Noted[1]{} \newcommand\xzlNote[1]{\sethlcolor{yellow} \hl{xzl: #1}} \definecolor{darkblue}{rgb}{0.0, 0.0, 0.55} \definecolor{mygreen}{HTML}{ADFF2F} \definecolor{mylightgray}{gray}{0.8} \newcommand\jin[2][]{ \fcolorbox{blue}{white}{\bf\em\color{blue}jin} {\small\em\color{blue}{\fontfamily{qhv}\selectfont \underline{#1} #2}} } \newcommand\myfootnote[1]{\textcolor{red}{\footnote{#1}}} \renewcommand\labelenumi{(\theenumi)} \newenvironment{myitemize}% {\begin{itemize} [leftmargin=0cm, itemindent=.3cm, labelwidth=\itemindent, labelsep=0pt, parsep=0.0pt, topsep=0.5pt, itemsep=0.5pt, align=left] }% {\end{itemize}} \newenvironment{myenumerate}% {\begin{enumerate} [leftmargin=.cm,itemindent=.5cm,labelwidth=\itemindent, labelsep=0pt, parsep=1pt, topsep=1pt, itemsep=3pt, align=left] }% {\end{enumerate}} \newcommand\sect[1]{Section~\ref{sec:#1}} \newcommand{\scenario}[1]{\texttt{#1}} \newcommand{\system}[1]{\textsf{#1}} \newcommand{\code}[1]{\texttt{#1}} \newcommand{\queue}[1]{\textit{#1}} \input{terms} \makeatletter \def\@copyrightspace{\relax} \makeatother \section{Implementations} \label{sec:env-setup} \paragraph{Platforms} We implement the CoDry{} prototype on the following platforms. The cloud service runs on Odroid C4, an Arm board with 4 Cortex-A55 cores. The client runs on Hikey960 which has 4 Cortex-A73 and A53 cores, and a Mali G71 MP8 GPU. Our choice of Arm processors for the cloud is for engineering ease rather than a hard requirement; the cloud service can run on x86 machines with binary translation~\cite{charm}. The cloud service runs Debian 9.4 (Linux v4.14) with a GPU stack composed of a ML framework (ACL v20.05 \cite{acl}), a runtime (\code{libmali.so}), and a driver (Mali Bifrost r24~\cite{bifrost-driver}). Under the cloud service, KVM-QEMU (v4.2.1) runs as the VM hypervisor. The client runs Debian 9.13 (Linux v4.19) and OPTEE (v3.12) as its TEE. \paragraph{DriverShim{}} We build our code instrumentation tool as a Clang plugin. For static analysis and code manipulation, the plugin traverses the driver's abstract syntax tree (AST). With the Clang/LLVM toolchain~\cite{clang}, our tool compiles the GPU driver and links it against DriverShim{}. By limiting the scope to the hot driver functions in the Mali GPU driver~(\S\ref{sec:reg-defer}), our instrumentation tool processes 19 functions in total. The instrumentation itself incurs negligible overhead. We implement DriverShim{} as a kernel module ($\sim$1K SLoC) to be invoked by the instrumented driver code; the module performs dependency tracking, commit management, and speculation, as described in \sect{reg} and \ref{sec:mem-sync}. DriverShim{} communicates with the client via TCP-based messages in our custom formats. To avoid potential timeout due to network communications, we add a fixed delay (e.g. 3 seconds) to all the timeout values in the driver. We prepare and install GPU devicetrees in the cloud VM, so the GPU stack can run transparently even a physical GPU is not present~\cite{charm}. To support multiple GPU types, we implement a mechanism for the cloud service to load per-GPU devicetree when a VM boots. As a result, a single VM image can incorporate multiple GPU drivers, which are dynamically loaded depending on the specific client GPU model. \paragraph{GPUShim{}} We build GPUShim{} as a TEE module. Following the TrustZone convention, GPUShim{} communicates with the cloud using the GlobalPlatform APIs implemented by OPTEE~\cite{globalplatform-tee-guide}. The communication is authenticated and encrypted by SSL 3.0 with the TEE, before it forwarded through the normal-world OS. By design, the client's trusted firmware dynamically switches the GPU between the normal world and the TEE with a configurable TrustZone address space controller (TZASC)~\cite{seCloak}. Yet, our client platform (Hikey960) has a proprietary TZASC which lacks public documentation~\cite{vtz}. We workaround this issue by statically reserving memory regions for GPU and mapping the memory regions and GPU registers to the TEE. We modify the secure monitor to route the GPU's interrupts to the TEE. GPUShim{} forwards the interrupts to DriverShim{} for handling. We avoid interrupt injection to the VM hypervisor and keep it unmodified. To bootstrap the GPU, the client TEE may need to access SoC resources not managed by the GPU driver, e.g. power/clock for GPU. While the TEE may invoke related kernel functions in the normal-world OS via RPC~\cite{charm}, we protect these resources inside the TEE as did in prior work for stronger security~\cite{seCloak}. \begin{comment} \subsection{Setup client GPU TEE} \xzlNote{It can be... may ... state what is done. shim, code instrumentation, etc.?} \paragraph{Secure dryrun and replay} To secure dryrun and subsequent replay, a client TEE must ensure the followings. \noindent (1) \textit{Seucre channel}, which guarantees confidential packet exchange between the cloud and the client. It can be achieved by well-known protocol such as SSL. After successful authentication, a suitable cryptographic protection is applied over all the interactions. \noindent (2) \textit{GPU isolation}, enabled via TrustZone Address Space Controller (TZASC)~\cite{sanctuary}. Specifically, the TZASC enables the GPU to access dedicated GPU secure memory; it can also prevent GPU register access from untrusted applications~\cite{seCloak}; all the GPU interrupts can be securely directed to the TEE by updating secure monitor~\cite{seCloak}. \end{comment} \begin{comment} \subsection{Cloud VM management} \paragraph{VM preparation and assignment} By default, the cloud maintains VM images that pre-installed GPU stacks of some popular GPU models (e.g. Mali, Adreno, etc). To initiate a VM, the cloud requires GPU device tree entry from the client as the real GPU hardware is not present~\cite{charm}. When the client ships its GPU entry, the cloud reacts as follows. (1) The cloud picks and boots up the VM parsing the given entry; doing so allows the VM instance to have the identical GPU device view of the client. (2) The VM then probes the GPU hardware and stack. (3) The cloud assigns the VM to the client; the VM then begins dryrun of given workload. \paragraph{GPU driver instrumentation} CoDry{} requires a minimal instrumentation of GPU driver as what TinyStack~\cite{tinyStack} does for recording; it includes GPU interface knowledge such as register for kick the GPU, events that GPU interrupt handler starts, etc. Besides, CoDry{} needs static analysis of the GPU driver (e.g. to find all polling loops and commit points). However, the effort is not that much; in our experience with Mali Bifrost, only 19 functions contain most of the register accesses. \end{comment} \begin{comment} \paragraph{Cloud} As a prototype, we build CoDry{} for ARM-based platform. We use a small ARM workstation (i.e. Odroid C4) as a cloud server in which VMs are supported based on KVM-QEMU. In the cloud, we implement a \textit{cloud-proxy} which assigns the VM on clients' request; to make the VM believe it has a GPU hardware, we parse the same device tree as the one client platform applied. We reuse most record and replay functionalities of TinyStack~\cite{tinyStack}; We add TCP-based socket to the stock GPU drivers on each VM which enables remote communication for GPU register access to the client. Currently, our cloud supports XX number of VMs, each of which supports GPUs of Mali Bifrost and Broadcom families). \paragraph{Clients devices} As illustrated in Table~\ref{tab:env}, we choose a set of ARM dev boards as clients, each of which supports Bifrost G31 and G71 and Broadcom v3d GPUs. Note that we isolate client shim in the secure world on HiKey960 only; although technically not impossible, others (Odroid series) lack a support of programmable TrustZone by vendors. \st{We build a replayer atop OP-TEE (vX.XX).} We implement a \textit{client-proxy} in the normal world which redirects packets to the replayer while communicating with the one in the cloud. This is due to the lack of network stack in OP-TEE. \end{comment} \section{Hiding Register Access Delays} \label{sec:reg} To overcome the long network delays in CPU/GPU interactions, we retrofit known I/O optimizations to exploit new opportunities. \begin{comment} \Note{--old writing--} We analyze a sequence of register accesses for the GPU computation and observe the following characteristics: i) a read operation is dominant in the total register accesses but side-effect free (can be prefetched and speculated); ii) a repeated sequence of register accesses for unit of function to communicate with the GPU (can be batched); Based on the characteristics, the CoDry{} can greatly reduce the cost of interaction for dry-run by prefetching register map and speculatively continuing the driver's control flow and batching the repeated sequence of register accesses. \Note{--old writing end--} \end{comment} \input{fig-hiding} \subsection{Register Access Deferral} \label{sec:reg-defer} \paragraph{Problem} By design, a GPU driver weaves GPU register accesses into its instruction stream; it executes register accesses and CPU instructions synchronously in program order. For example in Figure~\ref{fig:hiding}(a), the driver cannot issue the second register access until the first access and the CPU instructions preceding the second register access complete. The synchronous register access leads to numerous network round trips. This is exacerbated by the fact that GPU register accesses are dominated by reads (more than 95\% in our measurement), which cannot be simply buffered as writes. \paragraph{Basic idea} We coalesce the round trips by making register accesses asynchronous: as shown in Figure~\ref{fig:hiding}(b), DriverShim{} defers register accesses as the driver executes, until the driver cannot continue execution without the value from any deferred register read. DriverShim{} then \textit{synchronously} commits all deferred register accesses in a batch to the client GPU. After the commit, DriverShim{} stalls the driver execution until the client GPU returns the register access results. To implement the mechanism, DriverShim{} injects the deferral hooks into the driver via automatic instrumentation. The driver \textit{source code} remains unmodified. \paragraph{Key mechanisms for correctness} First, DriverShim{} keeps the deferral transparent to the client and its GPU. For correctness, the GPU must execute the same sequence of register accesses as if there was no deferral. The register accesses must be in their \textit{exact} program order, because (1) GPU is stateful and (2) these accesses may have hidden dependencies. For instance, read from an interrupt register may clear the GPU's interrupt status, which is a prerequisite for a subsequent write to a job register. For this reason, DriverShim{} queues register accesses in their program order. It instantiates one queue \textit{per kernel thread}, which is important to the memory model to be discussed later. \begin{comment} ---- since we already do speculation The need for GPU transparency is why CoDry{} eschews register prefetch, i.e. batch read of registers that the driver \textit{may} actually read in the future; a prefetch incurs surplus register reads that will not be present in the actual driver execution; in case these register reads have side effect (e.g. read from an interrupt status register to clear pending interrupts), the correctness of driver execution is broken. \end{comment} Second, DriverShim{} tracks data dependencies. This is because (1) the driver code may consume values from uncommitted register reads; (2) the value of a later register write may depend on the earlier register reads. Listing~\ref{list:regio} (a) shows examples: variable \texttt{qrk\_mmu} depends on the read from register \texttt{MMU\_CONFIG}; the write to \texttt{MMU\_CONFIG} on line 7 depends on the register read on line 3. To this end, for each queued register read, DriverShim{} creates a symbol for the read value and propagates the symbol in subsequent driver execution. Specifically, a symbol can be encoded in a later register write to be queued, e.g. \texttt{reg\_write(MMU\_CONFIG, $\mathcal{S}$|0x10)}, where $\mathcal{S}$ is a symbol. After a commit returns concrete register values, DriverShim{} \textit{resolves} the symbols and replaces symbolic expressions in the driver state that encode these symbols. Third, DriverShim{} respects control dependencies. The driver control flow may reach a predicate that depends on an uncommitted register read, as shown in Listing~\ref{list:regio} (b), line 3. DriverShim{} resolves such control dependency immediately: it commits all the queued register accesses including the one pertaining to the predicate. \input{list-regio} \paragraph{When to commit?} DriverShim{} commits register accesses when the driver triggers the following events. \begin{myitemize} \item \textit{Resolution of control dependency}. This happens when the driver execution is about to take a conditional branch that depends on an uncommitted register read. \item \textit{Invocations of kernel APIs}, notably scheduling and locking. There are three rationales. (1) By doing so, DriverShim{} safely limits the scope of code instrumentation and dependency tracking to the GPU driver itself; it hence avoids doing so for the whole kernel. (2) DriverShim{} ensures all register reads are completed before kernel APIs that may externalize the register values, e.g. printk() of register values. (3) Committing register accesses prior to any lock operations (lock/unlock) ensures memory consistency, which will be discussed below. \item \textit{Driver's explicit delay}, e.g. calling the kernel's delay family of functions~\cite{linux-delays}. The drivers often use delays as barriers, assuming register accesses preceding delay() in program order will take effect after delay(). For example, the driver writes a GPU register to initiate cache flush and then calls delay(), after which the driver expects that the cache flush is completed and coherent GPU data already resides in the shared memory. To respect such design assumptions, DriverShim{} commits register accesses before explicit delays. \end{myitemize} \paragraph{Memory consistency for concurrent threads} The GPU driver is multi-threaded by design. Since DriverShim{} defers register accesses with per-thread queues, if a driver thread assigns a symbolic value to a variable $X$, the actual update to $X$ will not happen until the thread commits the corresponding register read. What if another thread attempts to read $X$ before the commit? Will it read the stale value of $X$? DriverShim{} provides a known memory model of \textit{release consistency}~\cite{comet} to ensure no other concurrent threads can read $X$. The memory model is guaranteed by two designs. (1) Given that the Linux kernel and drivers have been thoroughly scrutinized for data race~\cite{kscan}, a thread always updates shared variables (e.g. $X$) with necessary locks, which prevent concurrent accesses to the variables. (2) DriverShim{} always commits register accesses before the driver invokes unlock APIs, i.e. a thread commits register accesses before releasing any locks. As such, the thread must have updated the shared variables with concrete values before any other threads are allowed to access the variables. \paragraph{Optimizations} To further lower overhead, we narrow down the scope of register access deferral. We exploit an observation: GPU register accesses show high locality in the driver code: tens of ``hot'' driver functions issue more than 90\% register accesses. These hot functions are analogous to compute kernels in HPC applications. To do so, we obtain the list of hot functions via profiling offline. We run the GPU stack, trace register accesses, and bin them by driver functions. At record time, DriverShim{} only defers register accesses within these functions. When the driver's control flow leaves one hot function but not entering another, DriverShim{} commits queued register accesses. Note that (1) the choices of hot functions are for optimization and do not affect driver correctness, as register accesses outside of hot functions are executed synchronously; (2) profiling is done \textit{once} per GPU driver, hence incurring low effort. \begin{comment} \paragraph{Gadgets} Gadgets are our scopes for register IO deferral. Gadgets exploit an observation: register IO often shows high locality. First, most register accesses are done by a small fraction of driver code (a small fraction of kernel functions). For example, ... . Second, these kernel functions are repeatedly invoked in different contexts. \begin{itemize} \item Dense reg access. Little kernel side-effect, hardware operations, locks ... within a gadget. Motivate: compilation and offloading. \item \end{itemize} Intuitively, a gadget is a code piece with high density of register accesses. Definition: within a function; not spanning function scope (inlined code okay; not including calls to other kernel functions). no delays (we do not ``defer'' delay because the driver often implicitly assume some pending hardware operations are done after delay) A gadget may contain conditionals. Can be extracted via (dynamic) program analysis. Dominating: covering most of the register accesses. (90\%). Support: efficacy. A gadget is analogous to a compute kernel in HPC applications. Our key construct to make the problem tractable. \textbf{Why gadgets?} \begin{itemize} \item Narrow down analysis scope; simplify execution (no full kernel taint tracking, etc). \item Simple memory model (no worries about race conditions; no locking); Limited (?) side effect on the kernel state? \item Well-defined, simple semantics; easy to reason about: register accesses take effect at the gadget boundary. \end{itemize} Gadgets: static instrumentation. Narrow down the scope. \begin{itemize} \item Dense reg access. Little kernel side-effect, hardware operations, locks ... within a gadget. Motivate: compilation and offloading. \item \end{itemize} Intuitively, a gadget is a code piece with high density of register accesses. Definition: within a function; not spanning function scope (inlined code okay; not including calls to other kernel functions). no delays (we do not ``defer'' delay because the driver often implicitly assume some pending hardware operations are done after delay) A gadget may contain conditionals. Can be extracted via (dynamic) program analysis. Dominating: covering most of the register accesses. (90\%). Support: efficacy. A gadget is Our key construct to make the problem tractable. \textbf{Why gadgets?} \begin{itemize} \item Narrow down analysis scope; simplify execution (no full kernel taint tracking, etc). \item Simple memory model (no worries about race conditions; no locking); Limited (?) side effect on the kernel state? \item Well-defined, simple semantics; easy to reason about: register accesses take effect at the gadget boundary. \end{itemize} Gadgets: static instrumentation. Narrow down the scope. \end{comment} \subsection{Speculation} \label{sec:speculation} \paragraph{Basic idea} Even with deferred register accesses, each commit is still synchronous taking one RTT (Figure~\ref{fig:hiding}(b)). DriverShim{} further makes \textit{some} commits asynchronous to hide their RTTs. The idea is shown in Figure~\ref{fig:hiding}(c): rather than waiting for a commit $\mathcal{C}$ to complete, DriverShim{} predicts the values of all register reads enclosed in $\mathcal{C}$ and continues driver execution with the predicated values; later, when $\mathcal{C}$ completes with the actual read values, DriverShim{} validates the predicated values: it continues the driver execution if the all predictions were correct; otherwise, it initiates a recovery process, as will be discussed below. Misprediction incurs performance penalty but does not violate correctness. \paragraph{Why are register values predictable?} The efficacy of speculation hinges on predictability of register values. Our observation is that the driver issues \textit{recurring segments} of register accesses, to which the GPU responds with identical values most of time. Such segments recur within a workload (e.g. MNIST inference) and across workloads (e.g. MNIST and AlexNet inferences). Why recurring segments? We identify the following common causes. (1) Routine GPU maintenance. For instance, before and after each GPU job, the driver flushes GPU's TLB/cache. The sequences of register accesses and register values (e.g. the final status of flush operations) repeat themselves. (2) Repeated GPU state transitions. For instance, each time an idle GPU wakes up, the driver exercises the GPU's power state machine, for which the driver issues a fixed sequence of register writes (to initiate state changes) and reads (to confirm state changes). (3) Repeated hardware discovery. For instance, during its initialization, the driver probes GPU hardware capabilities by reading tens of registers. The register values remain the same as the hardware does not change. \paragraph{When to speculate?} Not all register accesses belong to recurring segments. To minimize misprediction, DriverShim{} acts \textit{conservatively}, only making prediction when the history of commits shows high confidence. When DriverShim{} is about to make a commit $\mathcal{C}$, it looks up the commit history at the same driver source location. It considers the most recent $k$ historical commits that enclose the same register access sequence as $\mathcal{C}$: if all the $k$ historical commits have returned identical sequences of register read values, DriverShim{} uses the values for prediction; otherwise, DriverShim{} avoids speculation for $\mathcal{C}$, executing it synchronously instead. $k$ is a configurable parameter controlling the DriverShim{}'s confidence that permits prediction. We set $k=3$ in our experiment. \begin{comment} CoDry{} only speculates for $\mathcal{C}$ when the It applies the following rules. (1) It only consider historical commits that execute the same register access segment as $\mathcal{C}$. (2) All the considered historical commits must have returned identical sequences of register read values; otherwise CoDry{} avoids speculation for $\mathcal{C}$, executing it synchronously instead. For example, CoDry{} disables speculation for the first and the second run of recordings; the subsequent runs only speculate on I/O commits for which the previous two runs show the same values. When CoDry{} meets mis-speculation at commit $C3$, it cleans up $C3$ and disables speculation permanently. \end{comment} \paragraph{How does driver execute with predicted values?} Based on predicted register values, the GPU driver may mutate its state and take code branches; DriverShim{} may make a new commit without waiting for outstanding commits to complete. To ensure correctness, DriverShim{} stalls the driver execution until all outstanding commits are completed and the predictions are validated, when the driver is about to externalize \textit{any} kernel state, e.g. calling printk() on a variable. This condition is simple, not differentiating if the externalized state depends on predicted register values. As a result, checking the condition is trivial: DriverShim{} just intercepts a dozen of kernel APIs that may externalize kernel state. DriverShim{} eschews from fine-grained tracking of data and control dependencies throughout the whole kernel. \textit{Optimization:} Only checking the above condition has a drawback: in the event of misprediction, both the driver and the GPU have to roll back to valid states, because both may have executed based on mispredicted register values. Listing~\ref{list:regio} (b) shows an example: if the read of \code{JOB\_IRQ\_STATUS} (line 9) is found to be mispredicted after the second commit (line 10), the driver already contains incorrect state (in \code{dev}) and the GPU has executed incorrect register accesses (e.g. write to \code{JOB\_IRQ\_CLEAR}). To this end, DriverShim{} can relieve the client GPU from rollback in case of misprediction. It does so by prevent spilling speculative state to the client. Specifically, DriverShim{} \textit{additionally} stalls the driver before committing register accesses that themselves are speculative, i.e. having dependencies on predicted values. For example, in Listing~\ref{list:regio} (b), the second commit must be stalled if the first is yet to complete, because the second commit consists of register accesses (\code{JOB\_IRQ\_CLEAR} and \code{TILER/SHADER\_PRESENT}) that casually depend on the outcome of the first commit. To track speculative register accesses, DriverShim{} \textit{taints} the predicted register values and follow their data/control dependencies in the driver execution. In the above example, when the driver takes a conditional branch based on a speculative value (line 3), DriverShim{} taints all updated variable and statements on that branch to be speculative, e.g. \code{dev->tiler}. For completeness, the taint tracking applies to any kernel code invoked by the driver. \begin{comment} \xzlNote{Optional} We choose to implement only the simple condition for stalling without fine tracking. Our rationales: we favor simplicity; the cost of restart a GPU workload is low to modest: our workloads (layers/iterations of ML training/inference) are much shorter (no more than several seconds, unlike servers in many prior work); we will optimize for fast recovery on GPU with replay; our success rate of prediction is high. \end{comment} \begin{comment} \Note{the complex version} This may need nontrivial tracking. consider the following case. A=read(regA) // speculated A==1 if (A) var=1 if (var) write(regB, 1) // must stall? The recorder must know that var==1 depends on the speculated value A==1. Therefore, it cannot execute write(regB) until read(regA) completes Only in the following two conditions, the driver will pause its execution waiting for an outstanding commit to finish. First, when the driver is about to externalize speculated values, e.g. calling printk() on these values. \Note{how about a speculated branch calling externalization functions?} Second, when the speculated values are about to impact the client GPU state The situations include: (1) value dependencies on the speculation: the driver is about to commit a register write, for which the value depends on a speculated value. (2) control dependencies: the driver is on a conditional branch and the conditional depends on a speculated value, and is about to access the GPU (including register IO commit and sending memory update). The driver waits until the dependency IO commit to complete. We prevent speculated values from being exposed to the client GPU. For instance, sending a register write to GPU, where the value to write is based on a speculated value. This is because GPU is a stateful device. If the speculation turned out to be incorrect, the client GPU must be restore to the state before the register write. Unlike the cloud, a client device lacks efficient way to do this, e.g. it cannot checkpoint the GPU state for fast rollback. It can only reset the GPU and re-execute the workload, which can be a lengthy process. \end{comment} \paragraph{How to recover from misprediction?} When DriverShim{} finds an actual register value different from what was predicated, the GPU stack and/or the GPU should restore to valid states. We exploit the GPU replay technique~\cite{tinyStack} for both parties to restart and fast-forward \textit{independently}. To initiate recovery, DriverShim{} sends the client the location of the mispredicted register access in the interaction log. Then both parties restart and replay the log up to the location. In this process, GPUShim{} feeds the recorded stimuli (e.g. register writes) to the physical GPU; DriverShim{} feeds the recorded GPU response (e.g. register reads and interrupts) to the GPU stack. Because both parities need no network communication, the recovery takes only a few seconds, as will be evaluated in Section~\ref{sec:eval-choice}. \begin{comment} \Note{-------- Obsoleted -------- thoughts about dependency } \begin{itemize} \item \textbf{Case 1: No dependency (or simple dependency)} Might interleave with kernel execution. Kernel execution is as simple as memory load/store. Addresses known ahead of time. \begin{itemize} \item A sequence of register writes (batch, async by nature, trivial) \item A sequence of register reads ?? (prefetch? push to the client?) \item A sequence of mixed reads/writes (push to the client? how about the memory consistency model?) \end{itemize} Example: job submission. \textbf{Solution}: log reg access; deferred commit; writes: take variable snapshots; reads: value as symbols; reach the end of gadgets: ``commit'' -- pushed to the client, resolving all symbols. \textbf{taint tracking/sym execution in a limited scope:} a gadget. \textbf{Downside}: limited opportunities? \item \textbf{Case 3: GPU/GPU dependency} back-to-back register accesses; May have conditionals, e.g. Upcoming GPU interactions (may have side effect) depend on prior GPU reads; little kernel execution in between. \begin{itemize} \item Example: polling, GPU cache/TLB flush. Power check (a FSM) \item Solution: push the whole sequence (including conditionals) to the client. \end{itemize} \item \textbf{Case 2: Kernel/GPU dependency (after warm-up, optimization)} Kernel control flow dependency on register access results. Kernel/CPU execution interleaved. Extensive kernel code invoked, with heavy side effects on kernel state. More than simply read/write from/to register. Cannot be easily pushed down to the client for execution. \begin{itemize} \item Example: interrupt handler; init by reading from configuration registers \item \textbf{Solution}: speculative (and multi-variant, symbolic) execution on the cloud. Solely based on a ``fake'' GPU results in the cloud. \textbf{Even interrupt can be speculated?} Bail out at the first divergence event. \textbf{Downside}: high rate of speculation failures. nondeterminism. \end{itemize} \end{itemize} ``Push'', when possible, seems favorable than speculation. But it can require complex code analysis; also the gadget lengths are limited. \textbf{gadgets}: no special instructions, no lock acquire/release, no scheduling API (atomic); no externally visible effect, e.g. tracing API, time API. limited exchange/interactions with the kernel environment. \end{comment} \subsection{Offloading polling loops} \label{sec:off-polling} A GPU driver often invokes polling loops, e.g. to busy wait for register value changes as shown in Listing~\ref{list:polling}. Polling loops contribute a large fraction of register accesses; they are a major source of control dependencies. \input{list-polling} \paragraph{Problem} Naive execution of a polling loop incurs multiple round trips, rendering the aforementioned techniques ineffective. (1) Deferring register access does not benefit much, because each loop iteration generates control dependency and requests a synchronous commit. (2) Speculation on a polling loop is difficult: by design above, DriverShim{} must predict the iteration count before the terminating condition is met, which often depends on GPU timing (e.g. a GPU job's delay) and is nondeterministic in general. \paragraph{Observations} Fortunately, most of polling loops are simple, meeting the following conditions. \begin{myitemize} \item Register accesses in the loop are \textit{idempotent}: the GPU state is not be affected by re-execution of the loop body. \item The iteration count has only local impact: the count is a local variable and does not escape the function enclosing the loop. The count is evaluated with some simple predicates, e.g. \texttt{(count<MAX)}. \item The addresses of kernel variables referenced in a loop are determined prior to the loop, i.e. the loop itself does not compute these addresses dynamically. \item The loop body does not invoke kernel APIs that have external impact, e.g. locking and printk(). \end{myitemize} Simple polling loops allow optimizations as will be discussed below. DriverShim{} uses static analysis to find all of them in the GPU driver. Complex polling loops that misfit the definition above are rare; DriverShim{} just executes them without optimizations. \paragraph{Solution} DriverShim{} executes simple polling loops as follows. (1) \textit{Offloading.} DriverShim{} commits a loop in a shot to the client GPU, incurring only one RTT. To do so, DriverShim{} offloads a copy of the loop code as well as all variables to be referenced in the loop. GPUShim{} runs the loop and returns updated variables. Offloading respects release memory consistency as described in Section~\ref{sec:reg-defer}, because accesses to shared variables inside the loop must be protected with locks and the loop itself does not unlock. (2) \textit{Speculation.} DriverShim{} further masks the RTT in offloading a loop. Rather than predicting the exact iteration count (e.g. the final value of \code{max} in Listing~\ref{list:polling}), DriverShim{} extracts and predicts the \textit{predicate} on the iteration count, e.g. \code{(max?=0)}, which is more predictable. When the client returns the actual iteration count, DriverShim{} evaluates the predicate in order to validate the prediction. \section{Introduction} \label{sec:intro} \paragraph{GPU in TrustZone} Trusted execution environments (TEE) has been a popular facility for secure GPU computation~\cite{graviton,HIX}. By isolating GPU from the untrusted OS of the same machine, it ensures the GPU computation's confidentiality and integrity. This paper focuses on GPU computation in TrustZone, the TEE on ARM-based personal devices. For these devices, in-TEE GPU compute is especially useful, as they often run GPU-accelerated ML on sensitive data, e.g. user's health activities, speech audio samples, and video frames. \paragraph{GPU stack mismatches TrustZone} Towards isolating the GPU \textit{hardware}, TrustZone is already capable~\cite{sanctuary,seCloak}, which is contrast to other TEEs such as SGX. The biggest obstacle is the GPU \textit{software} stack, which comprises ML frameworks, a userspace runtime, and a device driver. The stack is large, e.g. the runtime for Mali GPUs is an executable binary of 48 MB; it has deep dependency on a POSIX OS, e.g. to run JIT compilation; it is known to contain vulnerabilities~\cite{cudaLeak,CVE-2019-5068,CVE-2020-11179}. Such a feature-rich stack mismatches the TEE, which expects minimalist software for strong security~\cite{panoply,rubinov16icse,streamBox-TZ}. Recognizing the mismatch, prior works either transform the GPU stack~\cite{graviton} or the workloads~\cite{schrodinText,slalom,visor}. They suffer from drawbacks including high engineering efforts and loss of compatibility, as will be analyzed in Section~\ref{sec:bkgnd}. \begin{comment} The biggest obstacle is the GPU software stack, which spans the ML framework, a userspace runtime, and a device driver. As shown in Figure XXX, the feature-rich stack mismatches the TEE. The stack is large (e.g. the runtime for Arm Mali GPUs is 48 MBs), has deep dependency on a POSIX OS (e.g. it runs a JIT compiler), and is known to contain vulnerabilities. By contrast, the TEE expects minimalist (lean) software for strong security. Prior work has recognized this mismatch~\cite{slalom}. In response, they either transform the GPU stack \Note{cite} or transform the ML workloads. While effectiveness has been shown, their drawbacks include high engineering effort, the need for special hardware, and loss of compatibility with GPU ecosystems. Section XXX will present more details. \end{comment} \begin{comment} is a cornerstone that mediates interactions between the user apps and GPU hardware. To install the stack in TEE, it faces the following difficulties. (1) TCB inflating (Security). The stack is known to be vulnerable as reported constantly~\cite{cudaLeak,sugar}; its huge size bloats TCB size in TEE. (2) Engineering efforts. A huge porting efforts is unavoidable due to its myriads of dependencies. The stack's proprietary runtime (blackbox) is an obstacle, which lead to loss of compatibility with stock GPU stacks. (3) Additional treatment. Albeit the above are possible, additional software treatment may be required (e.g. given GPU the permission to access secure memory). The use of mobile GPUs in client devices (e.g. smartphones) rapidly grows; it generally accelerates on-device computation including machine learning workloads (training/inference) in mobile/edge environments. To launch GPU, a GPU stack should be installed in the client environment; as a cornerstone, the stack mediates interactions between the user apps and GPU hardware. The GPU stack, however, is overinflated for repeating a sequence of jobs (e.g. ML workloads); Such a huge stack leads to the following issues on client devices. (1) threatening system's security. The stack is known to be vulnerable as reported constantly~\cite{cudaLeak,sugar}; its wide interfaces are easily exploitable by adversaries no matter privileged or not. During an GPU app and stack are running, the adversaries may leak user's private information (e.g. input image for ML workload) and/or lead to system crash~\cite{CVE-2019-20577}. (2) poor TEE-compatibility (deployment). Building GPU-executable TEE for client devices is challenging; although not impossible, it requires a huge porting efforts and/or hardware modifications on off-the-shelf devices~\cite{graviton,HIX}. \end{comment} \input{fig-overview1} \paragraph{Goal \& overall approach} \textit{Can the TrustZone TEE run GPU-accelerated compute without an overhaul of the GPU stack?} To this end, a recent approach called GPU replay{} shows high promise~\cite{tinyStack}. It executes a GPU-accelerated workload $\mathcal{W}$, e.g. neural network (NN) inference, in two phases. (1) In the record phase, developers run $\mathcal{W}$ on a full GPU stack and log CPU/GPU interactions as a series of register accesses and memory dumps. (2) In the replay phase, a target program replays the pre-recorded CPU/GPU interactions on new input data without needing a GPU stack. GPU replay{} well suites TEE. The record phase can be done in a safe environment which faces low threats. After record is done \textit{once}, replay can happen within the TEE \textit{repeatedly}. The replayer can be as simple as a few KSLoC, has little external dependency, and contains no vulnerabilities seen in a GPU stack~\cite{CVE-2019-14615,CVE-2019-5068,CVE-2020-11179}. Note that it is crucial to record and replay at CPU/GPU boundary; recording at higher levels, e.g. ML framework APIs, would bloat the TEE with implementation of these APIs. \begin{comment} \noindent (1) \textit{Security and privacy} The GPU stack in the cloud is less susceptible to attacks as compared to the one on clients. A client device can enhance security as no longer exposed to wide and exploitable GPU stack's interfaces; a module to communicate with the cloud is small and independent, and hence easily portable to the TEE. \noindent (2) \textit{Ease of deployment}. The replayer can be lean and require little external dependency, which suits the TEE well. A client device is free from an installation of the entire stack, which is managed in a central place (cloud); the cloud always keeps the latest version of GPU stack and ML libraries. As interacting with the lowest interface, high-level optimizations already get involved in. \end{comment} Yet, a key, unsolved problem is the \textit{recording environment}, where the full GPU stack is exercised and CPU/GPU interactions are logged. The recording environment must simultaneously (1) enjoy strong security and (2) access the \textit{exact} GPU hardware that will be used for replay. These requirements preclude recording on the OS of the same mobile device, as TEE does not trust the OS. They also preclude recording on a developer's machine, because it can be difficult for developers to predict and possess all GPU hardware models that their workloads \textit{may} execute on. Section~\ref{sec:bkgnd} will present details on today's diverse mobile GPUs. \begin{comment} \begin{myenumerate} \item \textit{On development machine ahead of time.} \hspace{1pt} For recording, developers would need the actual GPU hardware, which is too many to manage; the rationale is the GPU sack requires GPU model-specific configuration, revision, quirks, etc. \item \textit{On device when demanded.} \hspace{1pt} Alternatively, the user may choose to record GPU compute in the normal or secure world. However, as normal world is potentially vulnerable, the adversary may corrupt the recording; the latter requires porting entire GPU stack into the TEE, which is contract to our design goal. \end{myenumerate} \end{comment} \paragraph{Key idea} We present a novel approach called collaborative dryrun (CoDry{}), in which the TEE leverages the cloud for GPU recording. As shown in Figure~\ref{fig:overview}, a cloud service hosts the GPU software stack without hosting any GPU hardware. To record, the TEE on a mobile device (referred to as the ``client'') requests the cloud to run a workload, e.g. NN inference. The cloud exercises its GPU stack without executing the actual GPU computation; it tunnels all the resultant CPU/GPU interactions between the GPU stack and the physical GPU isolated in the client TEE. The cloud logs all the interactions as a \textit{recording} for the workload. In future execution of the workload on new inputs, the TEE replays the recording on its physical GPU without invoking the cloud service. CoDry{} addresses the needs for a secure, manageable recording environment. First, unlike mobile devices which face high threats from numerous apps, the cloud service runs on rigorously managed infrastructures and only exposes a small attack surface -- authenticated, encrypted communication with the client TEE. Importantly, the cloud service never learns the TEE's sensitive data, e.g. ML input and model parameters. Second, the cloud service accesses the exact, diverse GPU hardware (Figure~\ref{fig:gputrend}) without the hassle of hosting them. It is responsible for hosting drivers for the GPU hardware, a task which we will show as practical. \begin{comment} --- useful ??? ---- Our cloud service differs from popular cloud offloading \Note{cite}: while cloud offloading aims to get the correct compute results, we only need to extract the correct CPU/GPU interactions for replay; the actual number crunching is not even necessary. We will exploit this opportunity for optimizations. As shown in Figure~\ref{fig:overview}, the cloud maintains a number of VM instances, each of which maintains a GPU stack corresponding to the GPU model requested by the client (e.g. Mali Bifrost, Qualcomm Adreno, etc); while not hosting the actual GPU hardware (i.e. physical GPU), the VM communicates with the GPU on the client side. At the first run (which we refer to as ``dry-run'') of computation, TZ captures all the interactions between the cloud and client. In subsequent execution of the same workload, (albeit on different input), TZ simply replays the recording without intervention of the cloud again. In doing so, the client TZ can record GPU compute without an entire GPU stack. \end{comment} \begin{comment} In this paper, we advocate a new approach, cloud-hosted GPU stack. That is, as shown in Figure~\ref{fig:overview}, the cloud hosts a variety of GPU stacks for client devices. The cloud maintains a number of VM instances, each of which supports a GPU stack corresponding to the GPU model demanded by the client (e.g. Mali Bifrost, Qualcomm Adreno, etc); while not hosting the actual GPU hardware (i.e. physical GPU), the VM communicates with the GPU on the client side, that is protected by TZ. The whole GPU execution is done securely and remotely; a client device first passes an encrypted GPU apps to TZ, which locks the GPU and deliver the app to the cloud after authentication; the cloud then docks the app to a corresponding VM that hosts the GPU stack the client equip; the client device, thereby, can complete GPU computation without the local GPU stack. Meanwhile, to release a expensive communication cost between the normal and secure world, and the client and cloud, the TZ captures the interactions between the cloud and client. In subsequent execution of the same workload (albeit on different input), the TZ simply replays the recording without intervention of the cloud. \end{comment} \begin{comment} In this paper, we advocate a new approach, cloud-hosted GPU stack. That is, as shown in Figure~\ref{fig:overview}, the cloud maintains a number of VM instances, each of which supports a GPU stack for a variety of GPU models (e.g. Mali Bifrost) while not hosting the actual GPU hardware (i.e. physical GPU). When developers build and run the GPU workload on their target devices (e.g. an NN inference), they first submit the GPU app to the cloud; the cloud docks the app to a VM that hosts the GPU stack for target GPU the device equipped with. The VM then runs the app with its resident GPU stack while communicating with the target's GPU. The target device, thereby, can complete GPU computation without the local GPU stack. Meanwhile, to release communication overhead of remote running, the device records interactions; in subsequent execution of the same workload (albeit on different input), the target device simply replays the recording without intervention of the cloud. \end{comment} \paragraph{Challenges and Designs} The main challenge arises from spanning CPU/GPU interactions over the connection between the cloud and the client. A GPU workload generates frequent register accesses (more than 95\% are read), accesses to shared memory, and interrupts. If the GPU stack and the GPU hardware were co-located on the same machine, each interaction event takes no more than microseconds; since we distribute them over wireless connection, each event will take milliseconds or seconds. Forwarding the interactions naively results in formidable delays, rendering CoDry{} unusable. To overcome the long delays, we exploit two insights. (1) The sequence of GPU register accesses consists of many \textit{recurring segments}, corresponding to driver routines repeatedly invoked in GPU workloads, e.g. for job submission and GPU cache flush. By learning these segments, the cloud service can predict most register accesses and their outcomes. (2) Unlike IO-as-a-service~\cite{io-as-a-service} which must produce correct results, the cloud only has to extract \textit{replayable interactions} for later actual executions. With the insights, CoDry{} automatically instruments the GPU driver code in the cloud to implement the following mechanisms. \noindent (1) \textit{Register access deferral.} While each register access was designed to be executed on the physical GPU synchronously, the cloud service queues and commits multiple accesses to the client GPU in a batch, coalescing their network round trips. Since register accesses are interleaved with the driver execution in program order, the cloud service represents the values of uncommitted register reads as symbols and allows symbolic execution of the driver. After the register reads are completed by the client GPU, the cloud replaces symbolic variables with concrete register values. \noindent (2) \textit{Register access speculation. } To further mask the network delay of a commit, the cloud service predicts the outcomes of register reads in the commit. Without waiting for the commit to finish, the cloud allows the driver to continue execution based on the predicted read values. The cloud validates the speculation after the client returns the actual register values. In case of misprediction, both the cloud and the client leverage the GPU replay technique to rapidly rollback to their most recent valid states. \noindent (3) \textit{Metastate-only synchronization. } Despite physically distributed memories, the driver in the cloud and the client GPU must maintain a synchronized memory view. We reduce the synchronization \textit{frequencies} by tapping in GPU hardware events; we reduce the synchronization \textit{traffic} by only synchronizing GPU's metastate -- GPU shaders, command lists, and job descriptions -- while omitting workload data, which constitutes the majority of GPU memory. As a result, we preserve correct CPU/GPU interactions while forgoing the compute result correctness, a unique opportunity of dryrun. \paragraph{Results} We build CoDry{} atop Arm platforms and Mali Bifrost, a popular family of mobile GPUs, and evaluate it on a series of ML workloads. Compared to naive approach, CoDry{} lowers the recording delays by two order of magnitude, from several hundred seconds to 10 -- 40 seconds; it reduces the client energy consumption by up to 99\%. Its replay incurs 25\% lower delays as compared to insecure, native execution of the workloads. \begin{comment} \textbf{Major challenge: span the CPU/GPU interface over wireless WAN} The interface: registers, shared memory, interrupts. Is it feasible to span the CPU/GPU interface (where latencies expected to be microseconds) over the Internet connection between client/cloud (where latencies can be as long as hundreds of milliseconds)? Frequent interactions (The frequent interactions block the driver's control flow and hence slow down the GPU computation). Numerous register accesses, e.g. several thousands per NN inference. If execute honestly over wireless, recording a NN takes hundreds of seconds. Severely slows down app startup; waste energy (??) Sync GPU memory: how to sync, what to sync? Native sync over wireless (cellular) is slow and costly. How about GPU memory address space? As we will show, native treatment of the interface (e.g. verbatim forwarding of register accesses, frequent of memory synchronization) results in (1) formidable slowdown (e.g. XXX seconds to record MNIST, a simple NN), rendering the service barely usable; (2) GPU stack timeout (many timing assumptions broken) (3) increased cloud cost because VMs run for long. \textbf{Insight 1}: recording contrasts to concrete GPU execution; for recording, the cloud GPU stack only needs an illusion as if it operates on a GPU so its interactions can be dumped and transmitted to the client. Memory synchronization: only for metadata not for data (because we are not set to get the correct results). \textbf{Insight 2}: Learn and exploit common interactions patterns. batched, summarized, learnt from past execution, or speculated (in the spirit of speculative execution). Backed by full execution. Key mechanisms: speculation, pattern reusing (caching), ... All these can be done with light knowledge on the GPU interfaces. As a result: can either avoid or hide long network delays and makes distributed recording fast and practical. \textbf{Implementation challenges (less important):} \begin{itemize} \item Maintain illusions to the cloud (how to run \& maintain the cloud VM so it "believes" it's dealing with a physical GPU) The cloud expects low latency access of register and memory. How to cope with timeout? \item How to run/manage the cloud VMs (practicality issues) \item Low developer efforts? Transformation of existing GPU driver code with low effort. \item Many instances? Deal with device tree (known?), drive probing, DMA, and timeout (as our register and memory access may incur long delays) \end{itemize} \end{comment} \begin{comment} \begin{myitemize} \item \textbf{Diverse embedded GPU hardware}. Different revisions, generations, etc. High cost for the cloud to run each hardware model. And how many instances each? A management nightmare. Our key insight: recording contrasts to concrete GPU execution; for recording, the cloud GPU stack only needs an illusion as if it operates on a GPU so its interactions can be dumped and transmitted to the client. Solution: The cloud does host any physical GPUs. As the cloud runs the GPU stack, the cloud OS forwards the interactions back to the client (where the physical GPU exists) for execution. \textbf{A novel way to use the cloud as a ``safe recording environment''} for GPU stack. \item \textbf{The modifications to a commodity OS}. \end{myitemize} \end{comment} \paragraph{Contributions} We present a holistic solution for GPU acceleration within the TrustZone TEE. We address the key missing piece -- a safe, practical recording environment. We make the following contributions. \begin{myitemize} \item A novel architecture called CoDry{}, where the cloud and the client TEE collaboratively exercise the GPU stack for recording CPU/GPU interactions. \item A suite of key I/O optimizations that exploit GPU-specific insights in order to overcome the long network delays between the cloud and the client. \item A concrete implementation for practicality: lightweight instrumentation of the GPU driver; crafting the device tree for VMs to probe GPU without hosting the GPU; a TEE module managing GPU for record and replay. \end{myitemize} \section{Memory Synchronization} \label{sec:mem-sync} \paragraph{Problem} While the driver (cloud) and the GPU (client) run on their own local memoriess, we need to synchronize the view of shared memory between them as in Figure~\ref{fig:mmsync}. Memory synchronization has been a central issue in distributed execution\cite{clonecloud,comet,rio, charm}. A proven approach is relaxed memory consistency: one node pushes its local memory updates to other nodes only when the latter nodes are about to see the updates. Accordingly, prior systems choose synchronization points based on program behaviors, e.g. synchronizing thread-local memory at the function call boundary~\cite{clonecloud} or synchronizing shared memory of a data-race free program at the lock/unlock operations~\cite{comet}. Unlike these prior systems, the memory sharing protocol between CPU and GPU is never explicitly defined. For example, they never use locks. From our observations, we make an educated guess that CPU and GPU write to disjoint memory regions and order their memory accesses by \textit{some} register accesses and \textit{some} driver-injected delays. However, it would be error-prone to build CoDry{} based on such brittle, vague assumptions. \paragraph{Approach} Our idea is to constrain the GPU driver behaviors so that we can make \textit{conservative} assumptions for memory synchronization. To do so, we configure the driver's job queue length to be 1, which effectively serializes the driver's job preparation and the GPU's job execution. Such a constraint has been applied in prior work and shows minor overhead, because individual GPU compute jobs are sizable~\cite{tinyStack}. With the constraint, the driver prepares GPU jobs (and accesses the shared memory) only when the GPU is idle; the GPU is executing jobs (and accesses the memory) only when the driver is idle. As a result, we maintain an invariant: \textit{The driver and the client GPU will never access the shared memory simultaneously}. \input{fig-mmsync} \paragraph{When to synchronize?} The cloud and client synchronize when the GPU is about to become busy or idle: \begin{myitemize} \item \textit{Cloud $\Rightarrow$ client.} \vspace{1pt} Right before the register write that starts a new GPU job, DriverShim{} dumps kernel memory that the driver allocates for the GPU and sends it to the client. The memory dump is consistent: at this moment, the GPU driver has emitted and flushed all the memory state needed for the new job, and has updated the GPU pagetables for mapping the memory state. \item \textit{Client $\Rightarrow$ cloud.} \vspace{1pt} Right after the client GPU raises an interrupt signaling job completion, GPUShim{} forwards the interrupt and uploads its memory dump to the cloud. The memory dump is also consistent: at this moment the GPU must have written back the job status and flushed job data from cache to local memory. Specifically, the GPU cache flush action is either prescribed in the command stream~\cite{bifrost-cache-flush} or requested at the beginning of the interrupt handler~\cite{vc4-cache-flush}. \end{myitemize} To further safeguard the aforementioned invariant, we implement continuous validation. After DriverShim{} sends its memory dump to the client, it unmaps the dumped memory regions from CPU and disables DMA to/from the memory. As such, any spurious access to the memory region will be trapped to DriverShim{} as a page fault and reported as an error. In the same fashion, GPUShim{} unmaps the shared memory from the \textit{GPU}'s pagetable when the GPU becomes idle; any spurious access from GPU will be trapped and reported. \paragraph{What to synchronize?} As shown in Figure~\ref{fig:mmsync}, we minimize the amount of memory transfer with the following insight: \textit{for recording, it is sufficient to synchronize only the GPU metastate in memory}, including GPU commands, shader code, and job descriptors. Synchronizing program data, including input/output and intermediate GPU buffers, is unnecessary. This is effective as program data constitutes most of GPU memory footprint. How to locate metastate in the shared memory, given that the memory layout is often proprietary? We implement a combination of techniques. (1) Some GPU page tables have permission bits which suggest the usage of memory pages. For instance, the Mali GPUs map metastate as \textit{executable} because the state contains GPU shader code~\cite{bifrost-mem-hint}. (2) For GPU hardware lacking permission bits, CoDry{} infers the usage of memory regions from IOCTL() flags used by ML workloads to map these regions. For instance, a region mapped as readonly cannot hold GPU commands, because the GPU runtime needs the write permission to emit GPU commands. (3) If the above knowledge is unavailable, the DriverShim{} simply replaces an ML workload's inputs and parameters as zeros. Doing so will result in abundant zeros in the GPU's program data, making memory dumps highly compressible. Atop selective memory synchronization, we apply standard compression techniques. Both shims use range encoding to compress memory dumps; each shim calculates and transfers the deltas of memory dumps between consecutive synchronization points. \begin{comment} \begin{itemize} \item \textit{Sync from cloud to client} To identify metadata, we exploit driver's semantic as hints. For instance, when GPU memory is allocated, the user space runtime propagates some information (?) or flags (e.g. Mali) that indicates what this memory region will be used for (e.g. store data or store GPU binaries). Note that not much efforts is needed to instrument such information (e.g. a couple of functions of the driver). \item \textit{Sync from client to cloud} After job/command is done, the client calculates the deltas of metadata compared to the one it received before the execution; like what cloud did, the client only returns back the deltas with which the cloud updates GPU page table. Note that GPU handles page fault relying on the GPU driver; it does not allocate or update page table internally. \end{itemize} The cloud pushes only deltas of metadata, the update from previous sync point. For the changes on non-metadata region, the cloud just sends GPU address ranges without the actual data such that the client maps the region to its physical memory and updates the page table. \paragraph{Locating binaries and input/output} Advocating the GPURip's approach, we identify the necessary memory contents and locations such as GPU binaries, input and output location. Delta encoding; only transmitting the difference; range encoding; \paragraph{Other (known) optimization on compressing memory snapshots} \end{comment} \section{CoDry{}} \label{sec:overview} \input{fig-workflow} We advocate for a new recording environment: dryrun the GPU stack in the cloud while using the physical GPUs on the clients. \subsection{The Approach} Figure~\ref{fig:workflow} illustrates our approach. (1) Developers write an ML workload as usual, e.g. MNIST inference atop Tensorflow. They are oblivious to the TEE, the GPU model, and the cloud service. (2) Before executing the workload for the first time, the client TEE requests the cloud service to dryrun the workload. As the cloud runs the GPU stack, it forwards the access to GPU hardware to the client TEE and receives the GPU's response from the latter. In the mean time, the cloud records all the CPU/GPU interactions. (3) For actual executions of the ML workload, the client TEE replays the recorded CPU/GPU interactions on new input data; it no longer involves the cloud. Our approach fundamentally differs from remote I/O or I/O-as-a-service~\cite{io-as-a-service}. Our goal is neither to execute GPU compute in the cloud~\cite{kahawai,clonecloud} (in fact, the cloud has no physical GPUs) nor run the GPU stack \textit{precisely} in the cloud, e.g. for software testing~\cite{charm}. It is to extract the software's stimuli to GPU and the GPU's response. This allows CoDry{} to skip much communications and optimize the cloud execution. \paragraph{Why using the cloud for recording?} The cloud has the following benefits. \begin{myenumerate} \item \textit{Rich resources.} The cloud can run a GPU stack that is too big to fit in the TEE; it can also host multiple variants of GPU stack, catering to different APIs and frameworks used by ML workloads. \item \textit{Secure.} The cloud isolates the GPU stack in a safer environment. In contrast to client mobile devices which often run a myriad of apps and face threats such as clickbait and malware, the cloud infrastructure has more rigorous security measures~\cite{trustedCloudComputing,psData}. As the dryrun service uses dedicated VMs that only serve authenticated TEEs, the attack surface of the GPU stack is minimized. \item \textit{No sensitive data exposed.} A client TEE's invocation of dryrun service never gives away its ML model weights or inputs, because recording by design does not need them. For this reason, the dryrun service does not have to be hosted in a cloud TEE, e.g. SGX. Section~\ref{sec:eval-security} will present a detailed security analysis. \end{myenumerate} \begin{comment} With rich resources, the cloud is capable of running a GPU stack that is too big to fit in the TEE. The cloud can also host multiple GPU stack variants, catering to different APIs and frameworks that may be used by ML workloads. For instance, it can have separate VM images for OpenCL atop Ubuntu and Vulkan atop Android to record workloads that use either OpenCL or Vulkan. The cloud VM isolates the GPU stack in a safer environment. In contrast to client devices such as smartphones often running a myriad of third party apps and facing various threats (clickbait, malware, etc), the cloud infrastructure has more rigorous security measures; as the dryrun service uses dedicated VMs that only servce authenticated TEEs, the attack surface of the GPU stack is greatly reduced. TEE's invocation of dryrun service never gives away the ML model weights or actual inputs, because the dryrun service does not require them. For this reason, a cloud TEE, e.g. SGX, is often not required to host the dryrun service. Section~\ref{sec:eval-security} will present a detailed security analysis. \end{comment} \paragraph{Can the cloud emulate GPUs?} One may wonder if the cloud operates with software-based GPU emulators~\cite{nomali}, thereby avoid communicating with client GPUs. Building such emulators is difficult, as it would require precise emulation of GPU interfaces and behaviors. However, modern GPUs are diverse~\cite{gpuRank}; they often have undisclosed behaviors and interfaces; their hardware quirks are not uncommon. \paragraph{Will the cloud see GPU driver explosion?} The cloud VMs for dryrun need to install drivers for all GPU models on clients. Fortunately, maintaining the drivers will not add much burden, as the total number of needed GPU drivers is small. A single GPU driver often supports many GPU models of the same family~\cite{midgard-driver,bifrost-driver}; these GPUs share much driver code while differing in register definitions, hardware revisions, and erratum. For instance, Mali Bifrost and Qualcomm Adreno 6xx drivers each support 6 and 7 GPUs~\cite{mali-gpuinfo,adreno-gpulist}. As \sect{env-setup} will show, by crafting the kernel device tree, we can incorporate multiple GPU drivers in one Linux kernel image to be used by the cloud VMs. \subsection{The CoDry{} architecture} Figure~\ref{fig:workflow} shows the architecture. The cloud service manages multiple VM images, each installed with a variant of GPU stack. The VM is lean, containing a kernel and the minimal software required by the GPU stack. Once launched, a VM is dedicated to serving only one client TEE. All the communication between the cloud VM and the TEE is authenticated and encrypted. CoDry{}'s recorder comprises two shims for the cloud (DriverShim{}) and for the client TEE (GPUShim{}). DriverShim{} at the bottom of the GPU stack interposes access to the GPU hardware. It is implemented by automatic instrumenting of the GPU driver, injecting code to register accessors and interrupts handlers. GPUShim{}, instantiated as a TEE module, isolates the GPU during recording and prevents normal-world access. After a record run, DriverShim{} processes logged interactions as a recording; it signs and sends the recording back to the client. To replay, the client TEE loads a recording, verifies its authenticity, and executes the enclosed interactions. During replay, the TEE isolates the GPU; before and after the replay, it resets the GPU and cleans up all the hardware state. \subsection{Challenge: long network delays} \label{sec:overview:delay} A GPU stack is designed under the assumption that CPU and GPU co-locate on an on-chip interconnect with sub-microsecond delays. CoDry{} breaks the assumption by spanning the interconnect over the Internet with tens of ms or even seconds of delays. As a result, the GPU driver is blocked frequently. The GPU driver frequently issues register accesses; each register access stalls the driver for one round trip time (RTT). Taking MNIST inference as an example, the GPU driver roughly issues 2800 register accesses, taking 117 seconds on cellular network. Long RTTs also make memory synchronization slow. CoDry{} needs to synchronize the memory views of the driver (cloud) and the GPU (client). When they run on the same machine, the driver and the GPU exchange extensive information via shared memory: commands, shader code, and input/output data. When the driver and the GPU are distributed, maintaining such a shared memory illusion may see prohibitive slowdown. As we will show in Section~\ref{sec:mem-sync}, classic distributed shared memory (DSM) misses key opportunity in dryrun. The long recording delay, often hundreds of seconds shown in \sect{eval}, render CoDry{} unusable. (1) An ML workload has to wait long before its first execution in TEE. (2) During a record run, the TEE must exclusively owns the GPU, blocking the normal-world GPU apps for long and hurting the system interactivity. (3) The cloud cost is increased, because CoDry{} keeps the VMs alive for extended time. (4) The GPU stack often throws exceptions, because the long delays violate many timing assumptions implicitly made by the stack code. \section{Related Work} \label{sec:related} \paragraph{Remote I/O} is adopted for cross-device I/O sharing~\cite{rio,mobilePlus} and task offloading~\cite{kahawai,telekine}. Unlike CoDry{}, however, their remoting boundary is at higher-level -- device file~\cite{rio}, Android binder IPC~\cite{mobilePlus}, and runtime API~\cite{telekine}. Such clean-cut boundaries ease a course-grained I/O remoting, e.g. function-level RPC calls. To apply to TEE, however, the client TEE must keep a part of (e.g. device driver) or the entire I/O stack while bloating TCB. Similar to CoDry{}, prior works have explored the lowest software level; For efficient dynamic analysis, they forward I/O from VM to mobile system~\cite{charm} or low-level memory access from emulator to real device~\cite{avatar,surrogates}. However, their cross-device interfaces are wired, faster than what CoDry{} addresses, (i.e. wireless connection). CoDry{} has a different goal: hosting a dryrun service for GPU recording, mitigating communication cost. \begin{comment} \paragraph{Remote I/O access} Remote I/O is adopted for decoupling the software from I/O devices. To enable remote I/O control, there are three available types of interfaces: i) entire code sharing, that sends the code to execute to the client; ii) API remoting, which shares all the API calls by wrapping related function calls and arguments; iii) register I/O, directly communicates with remote I/O device in the register level. Unlike first two interfaces, the last one does not require GPU stack at all and hence is applied to TEE with a lean stub module (small TCB). However, it suffers from frequent interactions (e.g. MMIO access, mem sync) over slow wireless communication. Recently I/O-Device-as-a-Service~\cite{idaas} has been proposed, in which every I/O devices acts as in an independent service from the cloud; the device includes its software stack, libraries and daemons) on a microcontroller on the device while providing narrow and high-level API interface based on message queue. Many prior works enable remote I/O access (MMIO access) to support dynamic analysis with I/O devices. Charm~\cite{charm} ports entire mobile I/O device stack into remote VM; it redirect I/O operations from VM to mobile system. Avatar~\cite{avatar} and SURROGATES~\cite{surrogates}: run embedded firmware in the emulator and forward the low-level memory accesses (including I/O operation) to the real device. The communication channel is JTAG (avatar), which is slow, or customized FPGA (SURROGATES) to speed up. Rio~\cite{rio} adopt device file as boundary and M+ uses the Android binder IPC boundary~\cite{mobilePlus}. Kahawai~\cite{kahawai} collaboratively renders the mobile graphics workload. It Kahawai, the mobile client offloads high-fidelity rendering to the cloud and receives delta frames which contains difference between high- and low-detailed frames or P-frames of high-fidelity I-frames. The client then patches its low-fidelity frames with delta frames or merge P-frame with its I-frames. \end{comment} \paragraph{Device isolation with TEE} Recent works propose TEE-based solutions for GPU isolation by hiding GPU stack in the TEE~\cite{HIX,secDeep} or security-critical GPU interfaces in the GPU hardware~\cite{graviton}. They, however, require hardware modification and/or bloat TCB inside TEE. Favorable to the insight given by GPU replay{}~\cite{tinyStack}, CoDry{} offers a remote recording service for clients to reproduce GPU compute without the stack in TEE. Leveraging TrustZone components, prior works build a trusted path locally, e.g. for secure device control~\cite{seCloak} or remotely~\cite{trustUI}, e.g. to securely display confidential text~\cite{schrodinText} and image~\cite{rushMore}. Their techniques are well-suited to CoDry{} for i) discarding adversarial access to the GPU while recording and replaying; ii) building secure channel between cloud VM and client TEE; \input{fig-energy} \noindent \textbf{Speculative execution} is widely explored by prior works; based on caching and prefetching, they facilitate asynchronous file I/O~\cite{specHint,specNFS,sprint} or speed up VM replication~\cite{remus} and distributed systems~\cite{matei08osdi}. Unlike such works, CoDry{} does not prefetch I/O access ahead of time; instead, CoDry{} hide I/O latency by speculatively continue driver's workflow deferring read values while replacing them as symbolic expression; it then commit when facing value/control dependencies. \begin{comment} \paragraph{GPU scheduling} \begin{myenumerate} \item AvA: Accelerated Virtualization of Accelerators [ASPLOS 20] \item TimeGraph [ATC11] \item PTask [SOSP11] \item LTZVisor [ECRTS17] \end{myenumerate} \end{comment} \paragraph{Mobile cloud offloading} There has been previous works on cloud offloading~\cite{clonecloud,maui,comet}, which partitions mobile application into two parts: one for local device and the other for the cloud. Facilitating application-layer virtual machine or runtime, each part of the application cooperatively runs from both sides continuously. Unlike them, CoDry{} does not require runtime or vm support from the client; the offloading is also temporal for dryrun of GPU compute to capture the interactions. \begin{comment} MAUI [MobiSys 10] Duke, UMass, MSR Target: mobile application written for .NET CLR. (C\# i`n the paper) Partitioning: developers' annotation What/how states to sync energy saving through fine-grained code offloading while minimizing the changes required to applications. Type-safety nature of .NET runtime enables to traverse the in-memory data structure used by the program By wrapping the orig func, the remote func gets one more parameter (app state) and returns it (updated app state) if needed Thoughts: not mentioned about handling external I/O CloneCloud [Eurosys 11] Intel Labs Berkeley Target: mobile app running on Dalvik Partitioning: no need of annotation; using static analysis + profiling, it automatically decide what cloud be offloaded. What/how states to sync Execution stack frames, relevant data objects in the process heap, and register contents at the migration point Readily accessible as they are maintained by the VM mgnt software. Constraints Cannot support remote run with external I/O (e.g. sensor inputs), which must be processed locally (on mobile phone) COMET [OSDI 12] U. Michigan, AT\&T Labs Target: smartphone and tablets Focus not on what to offload but on how to offload -- minimize the number of communication events necessary Rely on Java Memory Model (non-overlapping memory locations) Tango [MobiSys 15] Idea: keep the replica app on the cloud and execute the both I/O events are captured and replayed to keep the same app state Overall thoughts: Apps, runtime (VM) exists on both side (cloud and client) Application VMs ease instrumentation and synchronization of application states No recent following work… \end{comment} \noindent \textbf{GPU record and replay} has been explored to dig out GPU command stream semantics~\cite{rosenzweig-m1,panfrost,grate}, enhance performance~\cite{nimble}, migrate runtime calls~\cite{patrace}, and reproduce computation~\cite{tinyStack}. While they care \textit{what} to record, CoDry{}'s focus is \textit{how} to record; CoDry{} addresses costly interaction overhead for remote GPU recording. \begin{comment} Quite related to CoDry{}, recording syscalls has been popular in reverse engineering GPU runtimes~\cite{rosenzweig-m1, grate, panfrost, patrace}. By changing LD\_PRELOAD of a GPU app, the developers intercept IOCTL commands between the runtime and the kernel, manipulate the commands, and observe the results. Compared to it, CoDry{} targets a different goal (minimizing GPU software), records a lower level (registers and memory), and entails different techniques (e.g. interval compression, input/output localization, etc.) \end{comment} \begin{comment} Targeting application instrumentation, system diagnosis, or reproducing bugs for debugging, record and replay approach is broadly studied: i) on mobile environment to reproduce GUI gestures~\cite{reran} including network activities and various sensor inputs~\cite{valera}, or improve real-time interaction between mobile app and the user~\cite{mobiplay}; ii) on desktop/server environment to reproduce behavior of web applications~\cite{mahimahi}, entire system~\cite{R2, RR} or virtual machine~\cite{reVirt}. Besides, some works adopts record and replay technique for the security analysis to detect vulnerabilities~\cite{sanity, replayConfusion, rtag} or network troubleshooting~\cite{ofrewind}. \end{comment} \begin{comment} \paragraph{Refactoring GPU stacks} Recent works isolate part or the whole GPU stack for security. Sugar subsumes an entire GPU stack to an app's address space~\cite{sugar}. Graviton pushes the function of isolation and resource management from OS to a GPU's command processor~\cite{graviton}. Telekine spans a GPU stack between local and cloud machines at the API boundary (e.g. redirecting API calls from client to server)~\cite{telekine}. HIX ports the entire GPU stack to a secure enclave for protection and also restricts the IO interconnect~\cite{HIX}. HETEE pools multiple GPUs in a rack-level box and instantiates dedicated hardware controller and fabric to isolate the use of these GPUs~\cite{hetee}; While efficacy has been shown, a key drawback is the high engineering effort (e.g. deep modifications of GPU software/hardware), limited to a special hardware component (e.g. software-defined PCIe fabric) and/or likely loss of compatibility with the stock GPU stacks. Contrasting to all the above \textit{spatial} refactoring of a GPU stack, CoDry{} can be viewed as a \textit{temporal} refactoring -- between the development time and the run time. \paragraph{Optimizing GPU computations} Much work has optimized mobile ML performance, e.g. by exploiting CPU/GPU heterogeneity~\cite{ulayer}. Notably, recent studies found CPU software inefficiency that leaves GPU hardware under-utilized, e.g. suboptimal CLFlush~\cite{KLO} or expensive data transformation~\cite{smaug}. While prior solutions directly fix the inefficiency in the GPU stack~\cite{KLO}, CoDry{} offers a new approach of blind fixes without requiring to pinpoint the causes: replaying the CPU outcome (e.g. shader code) and removing the GPU idle intervals. \end{comment} \begin{comment} To shield GPU stack and computation, multiple proposals have been made on re-engineering the stack. As shown in Figure~\ref{fig:design-cmp} (a), some systems instantiate a GPU stack for each app by isolating the whole stack~\cite{sugar, HETEE}; to further strengthen isolation, some isolate the app and its GPU sack in a TEE~\cite{HIX}. Meanwhile, other works partition the GPU stack and only isolates key layers~\cite{graviton, telekine, visor}. Yet, these approaches entail some limitations as follows. i) While squeezing attack surface by isolation, they do not eliminate GPU vulnerabilities, especially in higher layers (e.g. JIT and programming frameworks). For instance, even the authorized user unintentionally incurs buggy behavior of JIT compilation which threaten the TEE integrity and hence, the entire system. ii) The required engineering effort to deal with complex, proprietary code and interfaces is daunting. As the required changes to GPU stack are tremendous, the proof-of-concept GPU stack was often emulated or a trimmed-down version with open source user-space driver~\cite{HIX,graviton, telekine, visor}. Such versions are unlikely to benefit from new features and security patches being added to the full-fledged GPU stacks (e.g. CUDA, ARM Mali); without continuous maintenance as enjoyed by the full-fledged stacks, they likely become incompatible with newer GPU APIs or OS kernels. iii) If not impossible, porting GPU stack into TEE bloats TCB size and incurs additional overhead results from isolation. iv) Some designs~\cite{HIX, graviton, telekine, visor} require hardware modification which is inapplicable to a multitude of off-the-shelf client devices. \paragraph{Prior efforts on re-engineering stacks} To shield GPU stack and thus computation, multiple proposals are made on re-engineering the stack. \textbf{Isolating (porting) the whole stack} As shown in Figure~\ref{fig:design-cmp} (a), some systems instantiate a GPU stack for each app by isolating the whole stack~\cite{sugar,HETEE}; to further strengthen isolation, some isolate the app and its GPU stack in a TEE~\cite{HIX}. The rationale is to contain th damage if it happens. \textbf{Isolating vulnerable layers} Other work partitions the GPU stack and only isolates key layers. Sugar~\cite{sugar}: library OS approach. \jin{we should discuss about sugar again} Move as much as possible to app (web apps); leave lower layers in the OS kernel). \textbf{Hardening vulnerable layers} Graviton~\cite{graviton} and Telekine~\cite{telekine}: trust higher layers (user level); distrust lower layers and re-implement them in trusted ``GPU firmware'' (GPU's command processor). HIX~\cite{HIX}: focus is to cleanly switch (coarse-grained sharing) GPU between worlds (SGX). Doing so at the interconnect. Distrust the standard GPU stack; incarnate a new stack (?) in TEE (SGX). HETEE~\cite{HETEE} isolates and pushes the \Note{whole stack (??)} to PCIe controller (trusted firmware). \end{comment} \begin{comment} \paragraph{Secure GPU Computation} Challenging secure GPU computation, prior works propose GPU TEE by leveraging existing hardware-supported CPU TEE. HIX~\cite{HIX} assigns MMIO region to the memory space protected by SGX and allows its access only from application running in the enclave. Graviton~\cite{graviton} modifies the interface between device driver and GPU hardware to prevent unauthorized access from concurrently running contexts by adversaries. Telekine~\cite{telekine} adopts the Graviton's design to support GPU TEE and further fortifies its security by oblivious GPU computation. While these approaches can support secure GPU computation, they necessitate porting either user-space runtime or even a whole GPU stack which incurs a large TCB size. Note that porting even requires tremendous effort as the GPU software stack is diverse due to various vendor-provided APIs and userspace runtime. In addition, they target a cloud while requiring hardware modification that its infeasible to apply to existing numerous off-the-shelf devices. Unlike them, the CoDry{}'s tiny GPU stack facilitates porting with a minimal TCB size without hardware modification. Slalom~\cite{slalom} proposed secure heterogeneous computation by homomorphic encryption. It outsources computation intensive parts of DNN to GPU while data is encrypted. The computation is verified later from CPU-TEE. While it provides data confidentiality, it does not fit well for the end-devices as homomorphic encryption brings about significant performance degradation due to additional computations. Moreover, it is limited on linear operations which makes it difficult to support diverse computation. Finally, HETEE~\cite{HETEE} adds a special controller on top of the PCIe switch that acts as gatekeeper allowing only authorized applications to utilize accelerators. However, it requires architectural modification and is inapplicable to existing devices not equipped with such PCIe interface. HIX~\cite{HIX} assigns MMIO region to the memory space protected by SGX and allows its access only from application running in the enclave. While this approach can support secure GPU computation, they necessitate porting either user-space runtime or even a whole GPU stack which incurs a large TCB size. In addition, they target a cloud while requiring hardware modification that its infeasible to apply to existing numerous off-the-shelf devices. Graviton~\cite{graviton} modifies the interface between device driver and GPU hardware to prevent unauthorized access from concurrently running contexts by adversaries. HIX assigns MMIO region to the memory space protected by SGX and allows its access only from application running in the enclave. While these approaches can support secure GPU computation, they necessitate porting either user-space runtime or even a whole GPU stack which incurs a large TCB size. In addition, they target a cloud while requiring hardware modification that is infeasible to apply to existing numerous off-the-shelf devices. Telekine~\cite{telekine} adopts the Graviton's design to support GPU TEE and further fortifies its security by oblivious GPU computation. In Telekine, the client device generates and submits GPU jobs in an oblivious way which are processed by GPU TEE in the cloud. However, it requires user-space runtime modification on the client side which is challenging as its source code is closed in general. It also assumes that client devices are trusted which is orthogonal to our goal. Last but not least, HETEE~\cite{HETEE} adds a special controller on top of the PCIe switch that acts as gatekeeper allowing only authorized applications to utilize accelerators. However, it requires architectural modification and is inapplicable to existing devices not equipped with such PCIe interface. \end{comment} \begin{comment} \paragraph{Trusted execution environment} Thanks to its strong security guarantees, prior works utilize TEE to isolate entire application~\cite{trustshadow} or security-sensitive software components~\cite{rubinov16icse}, to support secure compute primitives~\cite{streambox-tz}, to protect machine learning inference~\cite{occlumency} and training~\cite{darkneTZ}. While the current TEE is limited on CPU computation, prior works proposed solutions that leverage TEE to protect GPU computation by isolating potentially vulnerable GPU software stack~\cite{slalom} and/or hardware modification~\cite{graviton, HIX, hetee}. \end{comment} \paragraph{Secure client ML} Much works has been proposed to protect model and user privacy~\cite{ppfl,darkneTZ} and/or to secure ML confidentiality~\cite{ternary,occlumency}. However, they all lack GPU-acceleration which is crucial for resource-hungry client devices. While recent work~\cite{slalom} suggests a verifiable GPU compute with TEE, the complexity of homomorphic encryption significantly burdens client devices. \begin{comment} \Note{moved here, merge} \textbf{Partitioning the workloads; isolating the sensitive part; running others on the GPU stack} \cite{slalom} Still, the sensitive part has to run atop a full GPU stack. Limited on what can be executed on the ``untrusted'' stack. \cite{schrodintext}: rasterizing texts in the untrusted stack. Pick texts in TEE (sensitive part). \cite{darknetz}: how about ~\cite{yerbabuena}? partition NN; isolate \& protect privacy-sensitive layers (using TZ); others run atop of untrusted the untrusted GPU stack. Telekine~\cite{telekine}: extend graviton for protection against timing channels. Idea is API remoting. Partitioning happens at the HIP API calls. Pre-allocate required GPU memory (\textbf{which reduces dynamism}). \jin{this cannot guarantee full-static allocation; compute job is dynamic (observed from Mali Bifrost)} \end{comment} \begin{comment} Some existing works proposed GPU isolated execution environment~\cite{graviton, HIX, telekine, HETEE, visor}, they necessitate porting partial or entire GPU software stack into TEE which incurs a large TCB. It is worth noting that the porting requires a tremendous effort as the GPU software stack is even diverse due to various vendor-provided APIs and userspace runtime. Moreover, some hardware modifications are prerequisite to deploy their solutions that makes it challenging to apply them to numerous existing mobile devices. Homomorhpic encryption can be applied for securing GPU, it degrades achievable performance benefit from GPU accelerator. Although recent work~\cite{slalom} proposed lightweight encryption scheme combined with CPU TEE, it is limited on linear operations and requires additional computation and power consumption which is even more critical to the mobile devices. Yet, these approaches entail some limitations: ii) different applications may use diverse GPU programming model (OpenCL, GLES, Vulkan, etc) seeking best-fitted one for each, which may require multiple GPU software stack in TEE involving additional TCB bloating; iii) the bugs in the device driver\jin{cite} that may threaten entire TEE integrity; iv) hardware modification is not applicable to a multitude off-the-shelf devices. We aims at i) eliminating GPU software stack from execution environment, ii) supporting diverse GPU programming abstractions, and iii) no-hardware modification. In doing so, the GPU execution become more secure and can be easily ported into TEE. \end{comment} \begin{comment} The GPU security threats are increasingly explored by code injection~\cite{pixelVault}, using non-zeroed memory after initialization~\cite{cudaLeak, lee14sp}, etc, that mostly result from its vulnerable software stack. On one hand, the critical device driver's vulnerabilities are steadily reported, exploitable for unauthorized memory access~\cite{CVE-2017-18643} or obtaining a full control of host physical memory~\cite{CVE-2014-0972}. On the other hand, the high-level APIs are not designed with security in mind~\cite{milkomeda}; even so, it is unclear how it can cooperate with vendor's proprietary (blackbox) user-space runtime~\cite{zhu17gpgpu}. What is worse, the closed runtime and complexity of software stack hinder a formal verification or monitoring the malicious GPU computation. \end{comment} \begin{comment} The use of GPU computation in mobile environment is emerging and becoming diverse in accordance with both the growing demand of on-device computation and enhanced computing power of mobile GPU. For instance, federated learning expedites a machine learning training by utilizing mobile data and resources and on-device inference is already widely deployed, each of which can be accelerated by on-device GPU computation\jin{cite}. While on-device GPU computation has additional performance benefit beyond one with only CPU, it is more challenging to achieve secure GPU computation since the recent hardware-enforced TEE equipped with mobile SoC supports only CPU computation. \end{comment} \begin{comment} \begin{myitemize} \item \textbf{Single-purpose devices} This is the case for cameras, robots (ROS), unmanned vehicles, smart speakers... IoT, edge, etc. One app is using GPU for an extended period of time (milliseconds or seconds). Sharing happens rarely. \item \textbf{Background compute} Long running. Scheduled to execute. ML training, when no active foreground apps. Rarely interleave with other apps. Multiple background apps? Can take turns to run; time-multiplexing at large granularities. \end{myitemize} \textbf{1. Prescribed GPU compute (?)} Why graphics workloads are likely improvised (?), modern GPUs on embedded devices are widely used to accelerate computation, notably ML inference and training (i.e. federated learning). CPU submits a series of compute jobs (also called \textit{compute kernels}) to GPU for execution (in a pipeline fashion), where latter jobs consume the results of earlier jobs. Unlike typical graphics workloads which has frequent and dynamic communication with GPU software stack, the use of GPU for general computation is more static and less interactive\jin{cite}. \begin{myitemize} \item the number of distinct compute jobs is low \item the (code? input size?) of jobs are determined at the development time \end{myitemize} For ML workloads: (1) each app runs a small set of networks, e.g. \Note{some evidence - check Mengwei's paper}; (2) each network consists of a small set of (well-known) compute kernels. (\texttt{Convolution}, \texttt{Activation}, \texttt{Pooling}, etc), while input data varies (and input size??), the number of distinct kernels is small and determined at the development time, Figure XXX shows evidence: AlexNet and MobileNet, two popular networks on client devices, have XXX and XXX distinct compute kernels, respectively. Even deeper networks, e.g. XXX, have XXX distinct kernels. Another evidence is that popular client ML frameworks, e.g. ARM ACL or Tencent ncnn, implement XXX distinct kernels. \textbf{2. Coarse-grained sharing/multiplexing}. Reasons: \begin{myitemize} \item \textbf{Single-purpose devices} This is the case for cameras, robots, unmanned vehicles, smart speakers... One app is using GPU for an extended period of time (milliseconds or seconds). Sharing happens rarely. \item \textbf{Background (long-running) compute} ML training, when no active foreground apps. Rarely interleave with other apps. Multiple background apps? Can take turns to run; time-multiplexing at large granularities. \end{myitemize} \end{comment}
{'timestamp': '2021-11-08T02:00:13', 'yymm': '2111', 'arxiv_id': '2111.03065', 'language': 'en', 'url': 'https://arxiv.org/abs/2111.03065'}
arxiv
\section{Introduction} Modern software development increasingly relies on the reuse of external libraries. The past decades have seen the emergence of online software repositories hosting thousands, sometimes millions, of software artifacts ready for reuse~\cite{decan19}. Package managers that automate library resolution from these repositories have greatly facilitated the practice~\cite{cox2019surviving}. Increasingly, modern software consists, in a majority of external libraries glued together by a minority of business specific code directly written by the developer~\cite{Holger}. The benefit of relying on externally developed software artifacts is twofold: development and maintenance time is decreased, and software used by thousands of other applications may receive more scrutiny. However, depending on third-party libraries opens up for a whole new category of hazards. Bugs~\cite{carvalho2014heartbleed}, breakages~\cite{leftpad}, and supply chain attacks~\cite{ohm20,taylor2020defending} can now occur in all the dependencies of an application and not solely in the code controlled by the application developer. For example, in March 2016, the removal of the \texttt{left-pad} package from the NPM registry broke the build of thousands of JavaScript projects ~\cite{leftpad,cox2019surviving}. More recently, thousands of SolarWinds customers have been compromised through a malicious update. This incident raised questions on how to reliably use software dependencies~\cite{MassacciJP21}. The breadth of supply chain attacks is a major challenge. Compromising one single library ~\cite{eventstream} affects every instance of any application depending on the library. This makes popular libraries target of choices for malicious actors. On the other hand, seminal work by Forrest~\cite{forrest97} and Cohen~\cite{cohen93} have proposed to distribute software variants instead of running identical instances across a network of machine, to mitigate the scale of attacks. We propose to diversify the libraries in the supply chain of applications to mitigate the scale of supply chain attacks. For many application domains, there exist several alternative libraries providing similar features. This opens the door to the generation of variants of an application by substituting libraries in its supply chain. Unfortunately, these libraries cannot be directly substituted. They typically do not provide the same API ~\cite{bartolomei2009study}: features might not be divided in the same way, signatures may be different, etc. Hence, replacing one by another, requires considerable effort. In this work, we introduce the concept of Library Substitution Framework. To support the substitution of libraries that provide similar features with different APIs, without modifying the application code, we propose to separate the API from the actual implementation. Keeping the API intact is necessary to prevent changes in the application. To bind the API to an actual implementation, we propose a three-tier adaptation architecture. First, a bridge provides the same API as the original and maps this API to an abstract Facade. The Facade captures the core features that are common to the pool of similar libraries. The third-tier for adaptation relates the Facade to an actual implementation. For a specific library, a wrapper implements this relation to the Facade's features. With this three-tier architecture we save the effort of developing one adapter per combination of possible library substitution. To assess the feasibility of this architecture, diversifying supply chains, we implement a concrete framework for Java JSON\xspace libraries. The framework, called \textsc{Argo}\xspace, supports substituting a JSON\xspace library present in the supply chain of an application, by another JSON\xspace library. We discuss the implementation process of \textsc{Argo}\xspace, its design choices, and experiment the reuse of the test suites of existing JSON\xspace libraries to validate it. We also assess the effect of library substitution on 368 clients of JSON\xspace libraries. We successfully generate \np{4069} variant applications that use a completely different implementation of a JSON\xspace library than the original and still pass the same tests as the original. For all these case studies, we have checked that the tests of the applications invoke a part of the JSON\xspace API. These novel results demonstrate the opportunity of harnessing the natural diversity of library implementations in a Library Substitution Framework to diversify the supply chain of applications. Our library substitution architecture is generic and can be reused to diversify other parts of the supply chain for which there exist diverse implementations. Our contributions are as follows \begin{itemize} \item an original architecture for a Library Substitution Framework to diversify the supply chain of an application, without changing the application's source code; \item \textsc{Argo}\xspace, a proof-of-concept implementation of this framework to provide build time diversification of JSON\xspace suppliers; \item novel empirical evidence that a Library Substitution Framework can generate application variants that have different dependencies as the original applications and still behave the same, modulo test suite. \end{itemize} \section{Risks of monoculture in the software supply chain} \label{sec:background} This section introduces the context of our work. We summarize the challenges of library reuse, with respect to software supply chain attacks. \subsection{Software Supply Chain Attacks} Package managers automatically fetch third-party libraries from a repository and integrate them into applications~\cite{decan19,cox2019surviving}. There exist package managers and an associated repository for most programming languages. For instance, Java has Maven and Maven Central, JavaScript has NPM and the NPM repository, Python has pip and PyPI. Massive dependence on external software artifacts raises new reliability and security concerns. New external actors become involved in the development of software projects: the developers of all external libraries used in the project. Furthermore, external libraries come with dependencies of their own, making the complete audit of libraries more difficult. Consequently, third-party software libraries represent an essential and complex part of the software supply chain of applications~\cite{ohm20,levy2003poisoning}. This opens the door to software supply chain attacks, that specifically target third-party packages \cite{ohm20}. Such attacks include package typo squatting \cite{taylor2020defending}, trusting the trust attacks \cite{thompson1984reflections}, and social engineering on open-source packages. An example of such an attack is demonstrated by the incident related to the \texttt{event-stream} package from the NPM registry. A malicious actor managed to gain the trust of the owner by contributing legitimate patches to the package~\cite{eventstream}. The owner then handed over the control of the repository to the malicious actor, who used it to inject code stealing cryptocurrency keys available on the machine of anyone running code depending on the \texttt{event-stream} package. \subsection{Diversity Reservoirs in Software Repositories} \label{sec:back-json-libs} Software repositories host millions of libraries. Among these numerous libraries, many of them provide similar features. For example, \textit{\url{mvnrepository.com}} lists more than $80$ different HTTP clients libraries for the JVM, more than $40$ different logging frameworks, and more than $20$ Base64 libraries. These different libraries that provide similar functionalities, are developed by different developers, with different motivations and without coordination. In the remaining of this paper, we call such a group of libraries implementing similar features, a \textit{reservoir}. The libraries in a reservoir do not provide the exact same features, but very similar ones, typically related to a standard. For example, network libraries implement well-specified protocols (HTTP, TCP, IP), cryptography libraries implement the same algorithms (TLS, RSA, SHA1), and data manipulation libraries implement various formats (JSON, XML, YAML). This natural diversity of library implementations for specific features has been harnessed in previous work. Koopman and DeVale studied the diversity of POSIX implementations and use it for reliability \cite{koopman1999comparing}. Shacham and colleagues exploit the diversity of collection libraries \cite{shacham2009chameleon} to optimize the applications depending on them. Sondhi~\cite{sondhi2021mining} reuses the test cases of similar libraries. Our work is the first to propose to harness diverse libraries to generate variant applications. \subsection{Library Monoculture} \label{sec:monoculture} While there exist a diversity of library implementations, the actual usages are skewed on a small subset of them. Applications massively depend on a handful of packages, while most other packages are rarely depended upon~\cite{decan19}. Library usages in a software repository follow a power law~\cite{louridas2008power}. Zerouali and Mens~\cite{zerouali2017analyzing} found that $97\%$ of the projects using Maven on GitHub declared a dependency towards \texttt{junit}. Meanwhile, the second most popular test library, \texttt{TestNG} is only used by $11.9\%$ of the projects of their dataset (most of them also using \texttt{junit}). This unequal distribution of usages within a library reservoir is far from an exception. For example, \textit{\url{mvnrepository.com}} lists \np{11628} usages within Maven Central of \texttt{Apache HttpClient}, the most popular HTTP client library and only \np{6604} for the second most popular one \texttt{OkHttp}. The large number of applications that rely on the same popular libraries is evidence that a new form of software monoculture~\cite{birman2009monoculture,goth2003addressing} emerges in software repositories. The concentration of usages magnifies the risks of software supply chain attacks that target the popular libraries shared across a large number of applications. Meanwhile, there exist alternative implementations that provide the same features as these popular libraries. In this work, we propose to harness this diversity of implementations in order to mitigate the risk of having one vulnerable library used by all applications. Today, the discrepancy among alternative APIs and the entanglement between application and library code prevent a smooth, automatic replacement of one library by another. Some previous work lay the ground for this. In the Java ecosystem, Java Specification Requests~\cite{jsr} are formal documents to standardize the APIs of the different libraries of a specific domain. However, the general case is that the multiple libraries which implement similar features are not inter-changeable, as they have different APIs. On the client side, there is a rich literature on API migration~\cite{alrubayeM019,balaban2005refactoring} that describes how to modify clients calls to APIs to adapt them to alternative libraries. However, none of these approaches allow a fully automated migration of existing clients from a library to an alternative. State-of-the-art techniques for API specification and migration do not support the automatic synthesis of diversified applications based on the alternative library implementations available in software repositories.In the next section, we discuss one key conceptual challenge that prevents this form of diversification in the supply chain. \subsection{Client-library Entanglement} \label{sec:entanglement} When the developers of an application identify the need for a specific feature, they will usually find several libraries that provide the desired feature. For example, the \textit{reservoir} for HTTP client libraries in Maven Central contains libraries such as \texttt{Apache HttpClient}, \texttt{OkHttp}, or \texttt{Jetty client} \footnote{\url{https://mvnrepository.com/open-source/http-clients}}. Yet, to use the desired feature, a developer needs to declare, in the configuration file of its package manager, a dependency towards one specific library. For example, a developer will not declare a dependency towards an abstract HTTP client, but towards the specific library \texttt{Apache HttpClient} version \texttt{4.5.13}. The package manager will then automatically fetch the library and bundle it with the rest of the application. Once the chosen library is fetched, the desired feature can be used through direct calls to the library's API. For example, in the case of \texttt{Apache HttpClient}, it may be instantiating an object from the class \texttt{CloseableHttpClient} and calling its method \texttt{execute} to execute an HTTP query. Application developers might need an abstract feature regardless of what library implements it. Yet, to use this feature, they need to choose \textit{a specific library} and make their code \textit{entangled} with its API. Meanwhile, alternative libraries might propose very different APIs, with different abstractions. Methods might take a different number of parameters, or parameters of different types. This makes migrations from a library to an alternative potentially time costly \cite{Alrubaye18}. Furthermore, migration requires good knowledge of the former library's API, the new library's API and the ability to modify the code of the client. This problem intensifies in the context of transitive dependencies, i.e., third-party libraries depended upon by a client's library. For example, \texttt{Apache HttpClient}, in its version \texttt{4.5.13}, depends on other libraries such as \texttt{commons-codec} and \texttt{commons-logging}. This means that a project that depends on \texttt{Apache HttpClient} also depends on these two libraries. In this case, the developer of such a project typically does not have the possibility of modifying the source code of \texttt{Apache HttpClient}, hence performing a migration from, \texttt{commons-codec} to an alternative library is unpractical. The entanglement between application code and APIs, the diversity of APIs in a reservoir and the complexity of dependency trees are key challenges that we need to address in order to automate library substitution. \section{Automatic diversification in the software supply chain} \label{sec:concept} In this work, we aim at letting developers benefit from the natural diversity of libraries in a given domain. Our goal is to build diverse application variants, with the same functionalities, but diverse supply chains. Given an application that depends on a specific library, we propose a systematic way to substitute this library, without modifying the source code of either the application nor the library. \subsection{Generating a Population of Variants} \label{sec:multivariant} A software supply chain attack that targets one single library has the potential to disrupt all the instances of an application that depends on the library. In this work, we propose to mitigate this risk through supply chain diversification. We aim at synthesizing a population of application variants which instances are different enough, so they cannot be attacked in the same way. This is achieved because these instances do not depend on the same libraries implementations, hence are not sensitive to the same supply chain attacks. For a given application that depends on a specific library, we propose to generate as many variants as there exist alternative libraries providing similar features. For example, from an application depending on \texttt{Apache HTTPClient}, we propose to generate a population of variants, one depending on \texttt{OkHTTP}, one depending on \texttt{Eclipse Jetty}, one depending on \texttt{Jode HTTP}, etc. This population would include one variant per alternative library that \texttt{Apache HTTPClient} can be substituted with, without breaking the functionalities of the original application. To produce these variants, we propose a generic architecture for library substitution. A Library Substitution Framework is specialized for a reservoir, and supports the generation of variants, each based on an alternative library of the reservoir. Overall, the goal of such a framework is to maximize the number of variants that can be created from a single client application, depending on a library of the reservoir. However, substituting a library by an alternative raises significant challenges because of client-library entanglement and API discrepancies. In the following sections, we propose a general architecture that addresses these challenges. \subsection{Library Adapters} \label{sec:adapters} The key challenge for automatic library substitution lies in the tight entanglement between an application and the APIs of its third-party libraries (top part of \autoref{fig:adapter}). To support substituting a library by another in the same reservoir, we propose to introduce one level of indirection between an API and its implementation. Keeping the original API allows us to support library substitution without modifying the code of the client application. The level of indirection between the API and an implementation is a piece of software that binds the API elements to elements of the implementation. We call this piece of software an \textit{adapter}. \autoref{fig:adapter} illustrates the concept. It represents a client that depends on a library A0. The client includes invocations to the API of A0. Hence, replacing A0 by A1 is not possible, as A1 exposes a different API. An \emph{adapter} from A0 to A1 exposes the same API as A0, and it implements wrappers for all API elements of A0 that adapt the calls towards A1. For example, an adapter from \texttt{Apache HttpClient} to \texttt{OkHTTP} would provide the API of \texttt{Apache HttpClient} (with types such as \texttt{CloseableHttpClient}) but calls to this API would be translated to calls to the API of \texttt{OkHTTP}. \begin{figure}[ht] \centering \includegraphics[width=0.9\columnwidth]{figures/Argo_Adapter.pdf} \caption{To support library substitution, we propose to define adapters between the API of a third-party library and other libraries from the same reservoir. Untangling 'behind' the API allows us to substitute similar libraries with no modification in the client application code.} \label{fig:adapter} \end{figure} \subsection{Library Substitution Framework Architecture} \label{sec:archi} \begin{figure*}[ht] \centering \includegraphics[width=0.9\textwidth]{figures/Wrapper_facade_v4.pdf} \caption{Generic architecture for a Library Substitution Framework that targets a set of applications and a library reservoir. Bridges abstract the API used by the clients from the concrete implementation; the facade defines a common API for all libraries; a wrapper maps the abstract API to the concrete functions of an existing library of the reservoir.} \label{fig:gen-wrapper-archi} \end{figure*} In this section, we refine the high-level concept of \emph{adapter} into a generic architecture to build a Library Substitution Framework. In particular, this architecture aims at limiting the development effort related to the high number of API elements to adapt. A naive approach would implement an adapter for each pair of libraries in a given reservoir, with each adapter implementing the full API of the library being adapted. For a reservoir containing $n$ libraries, the number of API element implementations that the framework needs to provide is computed with: \begin{equation} \sum_{i=0}^{n} \#Version_{API\_i} \times Size_{API\_i} \times (n - 1) \end{equation} Indeed, for each version ($\#Version_{API\_i}$) of each of the $n$ libraries in the reservoir, every API element ($Size_{API\_i}$) needs to be re-written with each of the $n-1$ other libraries of the reservoir. The amount of code to be developed, tested, and maintained makes this naive approach impractical for large library reservoirs. We leverage one key observation to limit the development effort for adapters: the distributions of usages among libraries in a reservoir\cite{harrandjson}, among versions\cite{soto2019emergence} and among the API members\cite{harrandCore}, are skewed towards a handful of popular elements. If the designers of a Library Substitution Framework accept to build a solution that is effective for a majority of client applications in a given domain, instead of all of them, then, the complexity of the framework can be significantly reduced. We discuss each point in the following paragraphs. \textit{Size of APIs:} The number of elements exposed by a library's API can be large. For example, among the $100$ most popular libraries of Maven Central, the median number of public types is $202$, the median number of methods $1,815$ and the median number of public fields $148$~\cite{harrandCore}. There might be some client applications that depend on these elements. Consequently, a Library Substitution Framework shall support all these API elements to provide diversity to all applications. However, the vast majority of clients rely on a small subset of the original APIs~\cite{harrandCore}. Consequently, framework designers can provide adapters that focus on the most popular subset of the original libraries' API. \textit{Number of versions:} A library is released through multiple versions, and all versions are available on the online repositories. For example, in Maven Central, there are between $5$ and $200$ different versions for $50\%$ of the libraries \cite{soto2019emergence}. Each new version potentially changes the API of the library. To support all clients of all versions of a library, the adapter needs to support the union of the APIs of all versions. However, only a handful of versions are used by a majority of clients~\cite{soto2019emergence}. This implies that a Library Substitution Framework can focus on the most popular version of each library. Furthermore, the subset of popular API elements of a library does not necessarily change for every version~\cite{breakingbad}. Hence, the most popular version of an API may also be compatible with clients of other versions. \textit{Number of Alternative Libraries:} Developing adapters for each library in a reservoir can be challenging, in particular for a large reservoir. For example, \textit{\url{mvnrepository.com}} lists more than $80$ different HTTP clients libraries for the JVM, or more than $40$ different logging frameworks. Designers can focus on supporting a minority of popular libraries. Consequently, their Library Substitution Framework will not be usable for the few client applications that use the least popular libraries in the reservoir. In addition to the curation of the API to adapt, we propose a generic architecture for a Library Substitution Framework. In particular, this architecture addresses the problem of the number of possible substitutions. The number of alternative libraries also increases quadratically the number of combinations of substitution possible. To limit this quadratic explosion, we rely on the inversion of control pattern~\cite{inversion}. We implement adapters between the APIs used by the client applications and a common, abstract API that captures the core set of features shared by all libraries in the reservoir. We then implement adapters between this common API towards each library of the reservoir. Hence, the actual library can be changed seamlessly. \autoref{fig:gen-wrapper-archi} describes the proposed three layers architecture. \textbf{Bridge:} A bridge aims at abstracting the API of a library used by a client, without modifying the code of the client. To do so, a bridge presents to its clients the same API (or a subset) as the library it substitutes. The actual implementation of the bridge actually transfers method calls to objects implementing common interfaces contained in the facade. A bridge ensures the syntactic correctness of the substitution. To summarize, a bridge is an adapter from the API of the library it substitutes towards the API described in the facade. \textbf{Facade:} A facade specifies a set of abstract operations that capture the core set of features that are provided by all libraries in the reservoir. It defines a common API that bridges use. It also defines a Factory that instantiates a concrete library that will provide these operations, providing the inversion of control mechanism~\cite{inversion}. \textbf{Wrapper:} A wrapper is an adapter from the API described in the facade towards an existing alternative library. It provides the concrete behavior for the operations specified in the facade. To be part of this architecture for substitution, the library must be extended with adapted classes that relate the operations of the facade with the concrete classes of the library. The more libraries naturally available in a reservoir, the more behavior diversity we can introduce for the client applications. With this architecture, a client application can benefit from the alternative libraries by replacing, in the configuration file of its package manager, the original dependency by its corresponding bridge and the desired wrapper. The pair Bridge / Wrapper constitutes the adapter from the bridged library to the wrapped one. The architecture of \autoref{fig:gen-wrapper-archi} combined with the API curating, greatly reduces, the number of API elements to be adapted, which can be revised from (1) to: \begin{equation} \sum_{i=0}^{m} Size_{Most\_Used\_Elements(API\_i)} + \sum_{i=0}^{n} Size_{Facade} \end{equation} with $m \ll n$ First, only the most popular version of an API is selected, second, only the most popular elements of the $m$ most popular APIs are adapted, and they are adapted only once thanks to the facade. Then, each API element of the facade is implemented once per library ($n$) in the reservoir. It is important to note that this approach scales linearly with the number of libraries $n$ in the reservoir, rather than quadratically. Furthermore, this architecture makes the addition of new libraries to the reservoir simpler to handle. Indeed, both the development of a new bridge and a new wrapper only require knowledge of the API of the new library and the facade. \subsection{Assessment Criteria for Library Substitution Frameworks} \label{sec:eval-goals} To evaluate the relevance of the concept of Library Substitution Framework proposed in this work, as well as the architecture described in this section, we formulate 4 criteria, associated to 4 metrics \textbf{Minimal number of API elements to adapt:} An important aspect of the architecture we propose in this work, lies in curating the APIs to adapt. The metric to observe, regarding that aspect, is the number of API elements that actually need to be adapted. \textbf{Preservation of the behavior of the bridged libraries:} Given a bridged library, the bridge should behave as the original library, with all implementations in a reservoir. In order to assess the behavior preservation, we rely on the existing test suite of the library. We measure this with respect to the number of tests of a library that pass on its corresponding bridge coupled with each wrapper in the reservoir. \textbf{Maximize the share of clients supported by the bridge APIs:} A bridged library does not adapt all API elements of the original library. Still, a Library Substitution Framework aims at supporting the diversification of a maximum number of applications. We measure the effectiveness of this trade-off with the share of clients that compiles when a library is substituted by its corresponding bridge. \textbf{Maximize the number of behavior preserving variants per client:} The main goal of a Library Substitution Framework is to diversify the supply chain of the applications that depend on library of a reservoir. Meanwhile, diversification must preserve the original behavior of the application. Here, we count the number of application variants that pass the original test suite, after substituting the original dependency by one of the implementations in the reservoir. \section{Experimental Protocol} \label{sec:methodology} The architecture, presented in the previous section, is generic and aims at being instantiated for specific library reservoirs. To evaluate the feasibility, and the effectiveness of Library Substitution Framework, we implement a case study for the reservoir of Java JSON\xspace libraries. JavaScript Object Notation, or JSON\xspace, is a ubiquitous file and data exchange format. Since its creation in 1999, it has gained considerable popularity for a wide spectrum of activities such as web APIs \cite{tan2016service}, scientific computing \cite{millman2014developing}, data management \cite{LiuHMCLSSSAA20}, or gaming \cite{tost2021}. It is also used as a serialization format for Java objects. Serialization is known to be vulnerability prone~\cite{Peles15,Viega0000,Fingann20}, and JSON libraries are no exception~\cite{friday13json}. For example, \texttt{jackson-databind}, the most popular Java JSON\xspace library is referenced in at least $68$ CVE~\cite{jacksonCVE}. This makes JSON libraries good targets for supply chain attacks on third-party packages. Therefore, the reservoir of JSON libraries \cite{harrandjson} is a relevant target to experiment the concept of Library Substitution Framework. \subsection{Research Questions} \label{sec:rqs} \newcommand{\textbf{RQ1. Can the architecture we propose for a Library Substitution Framework be implemented from a concrete reservoir of libraries?}}{\textbf{RQ1. Can the architecture we propose for a Library Substitution Framework be implemented from a concrete reservoir of libraries?}} \newcommand{\textbf{RQ2. Can the preservation of features of the libraries be tested by reusing their existing test suites?}}{\textbf{RQ2. Can the test suite of libraries, be curated and reused to test a Library Substitution Framework?}} \newcommand{\textbf{RQ3. What is the share of clients for which the framework preserves the static semantics of the original dependency?}}{\textbf{RQ3. What is the share of clients for which the framework preserves the static semantics of the original dependency?}} \newcommand{\textbf{RQ4. How many variants can we produce for each client, while preserving the original behavior?}}{\textbf{RQ4. How many variants can we produce for each client, while preserving the original behavior?}} \newcommand{\textbf{RQ5. To what extent does the diversification of \json provider also diversify the observable behavior of \json clients?}}{\textbf{RQ5. How can clients increase the diversity of their providers?}} In \autoref{sec:concept}, we introduced a general architecture for a Library Substitution Framework that supports the automatic build of variant application with diverse suppliers. We validate our approach for JSON\xspace through 5 RQs: 2 that focus on validating the architecture and 3 that validate the support to build variants. The first group of research question assesses the feasibility of implementing a Library Substitution Framework as described in \autoref{sec:archi}, and testing its features. To answer these questions, we focus on the \emph{libraries} of the reservoir. \textbf{\textbf{RQ1. Can the architecture we propose for a Library Substitution Framework be implemented from a concrete reservoir of libraries?}} In this first research question, we implement \textsc{Argo}\xspace, a Library Substitution Framework for JSON\xspace libraries. We follow the process of curating APIs and the general architecture described in \autoref{sec:archi}. We describe the design decisions such as the choices of bridged libraries, the choice of features to include in the facade, as well as the implementation of wrappers. We then discuss the impact of these choices on the number of API elements adapted in the framework. \textbf{\textbf{RQ2. Can the preservation of features of the libraries be tested by reusing their existing test suites?}} In this research question, we investigate to what extent we can reuse the test suites of the bridged libraries to validate a Library Substitution Framework. We carefully curate the test suites of the $4$ libraries bridged in \textsc{Argo}\xspace. We then run these test suites on each of the $80$ combinations of bridges and wrappers available in the framework. This reuse of tests across libraries of the same domain is in part similar to the work of Sondhi and colleagues \cite{sondhi2021mining}. \vspace{1em} In research questions 3, 4 and 5, we assess the impact of a Library Substitution Framework on \emph{clients} of libraries from the targeted reservoir. These questions focus on the impact of \textsc{Argo}\xspace on the clients of JSON\xspace libraries. \textbf{\textbf{RQ3. What is the share of clients for which the framework preserves the static semantics of the original dependency?}} In this research question, we assess which clients compile correctly when replacing the original library by the corresponding bridge. This means that all API members used by a client do have a substitution provided by \textsc{Argo}\xspace. We also investigate cases where this condition is not met. This allows us to study the consequences of the trade\-off, described in \autoref{sec:archi}, between the size of the APIs bridged and the number of supported clients. \textbf{\textbf{RQ4. How many variants can we produce for each client, while preserving the original behavior?}} This research question is at the core of our work. Here, we measure the number of JSON\xspace libraries we can automatically substitute while preserving the original behavior of the clients, as specified by their test suites. The larger number of libraries we can substitute, the more diversity of providers \textsc{Argo}\xspace can support in the supply chain of the clients. \textbf{\textbf{RQ5. To what extent does the diversification of \json provider also diversify the observable behavior of \json clients?}} When the test suite of a client fails, the substitution of the library it uses, it gives us indications on what makes clients tied to a specific JSON\xspace library. By analyzing these test failures, we draw general principles that make clients less coupled with a library and more prone to diversification. \subsection{Datasets} In this section we present the two datasets we build to study our two groups of research questions. First, we collect a reservoir of Java JSON\xspace library to build a concrete Library Substitution Framework, described in \autoref{sec:json-family}. Second, we gather a set of clients of the most popular libraries in this reservoir, described in \autoref{sec:clients}, to study the impact of our framework. \subsubsection{JSON Library Reservoir} \label{sec:json-family} \input{tables/reservoir} Our reservoir of Java JSON\xspace libraries includes $20$ libraries available on Maven Central, all providing (i) JSON\xspace parsing features, and (ii) serialization to JSON\xspace text. These libraries have been designed by different people with different motivations. We have previously analyzed the behavior of this reservoir in depth~\cite{harrandjson}. In our previous work, we make three points that are of interest for this work: (i) these libraries make a large variety of design decisions to represent JSON\xspace data; (ii) these libraries exhibit a large diversity of behaviors regarding what JSON\xspace inputs they consider as well-formed or ill-formed; (iii) there is more diversity of behaviors observed on JSON\xspace inputs that do not conform to the standard grammar~\cite{rfc8259}. \autoref{tab:libs-api} describes our reservoir of JSON\xspace libraries. Column \textsc{\#Commits} indicates the number of commits in the source repository of the library, when available. Column \textsc{\#Stars} gives the number of stars each library has, when hosted on GitHub. As described in \autoref{sec:archi}, supporting all versions of all libraries, is a large effort. Hence, we focus on the most popular version of each library. Column \textsc{Version} shows the version selected to build \textsc{Argo}\xspace. Finally, we select the API of $4$ of the most popular libraries, \texttt{jackson-databind}\@\xspace, \texttt{gson}\@\xspace, \texttt{org.json}\@\xspace, \texttt{json-simple}\@\xspace for which we develop bridges. We also collect their respective test suites to assess the preservation of their features by \textsc{Argo}\xspace. \textbf{\textsc{Placebo}\xspace JSON\xspace library: } We want to verify that, when we substitute a library by another, the new library, provided by the framework, is actually covered by the test suite. To do so, we add another wrapper to the $20$ existing libraries. \textsc{Placebo}\xspace is a special wrapper. It contains classes that implement the complete interfaces of the facade, and all of its methods directly throw an exception when invoked. Hence, when a JSON\xspace library is substituted with \textsc{Placebo}\xspace, two things can happen: (i) the execution of the test suite triggers an exception from \textsc{Placebo}\xspace and fails; (ii) or the test suite passes without triggering any exception. If no exception is triggered, we conclude that the test suite does not cover the usage of the JSON\xspace library. Hence, the test suite cannot be used to assess if the library substitution was successful. If an exception is triggered, the JSON\xspace library usage is covered by the test suite. \subsubsection{Client of JSON Libraries} \label{sec:clients} In this section, we describe the methodology that we follow to construct the dataset of open-source Maven Java projects that use JSON libraries. We choose open-source projects in order to have a large diversity of library usages, and to study the impact of library substitution. We want open-source projects that have a reproducible build, use a JSON\xspace library, and have reproducible tests that do cover the JSON\xspace library in question. The construction of this benchmark is composed of $4$ main steps. (i) First, we identify the \np{147991} Java projects on GitHub that have at least five stars. We use the stars as an indicator of interest. (ii) Second, we select \ChartSmall[q]{54703}{147991} Maven projects. We choose Maven projects to be able to build and execute the tests of the projects automatically. (iii) Third, we parse each Maven build configuration file to identify the projects that use any version of a JSON library. During this step, we identify \ChartSmall[q]{12012}{54703} projects. (iv) As the fourth step, we execute three times the test suite of all the projects, as a sanity check to filter out projects that we cannot build and the projects with flaky tests. We keep the projects that have at least one test and have all the tests passing: \ChartSmall[q]{1927}{12012} projects passed this verification. This gives us \np{1927} client projects that declare a dependency towards a JSON\xspace library and that can build. We run an additional check to verify that the test suite of the client covers the usage of the JSON\xspace library. Indeed, a test suite that does not cover the JSON\xspace library, would pass regardless of whether our substitution is satisfactory or not. We substitute the JSON\xspace library of these clients by the corresponding bridge and the \textsc{Placebo}\xspace implementation. If the test suite of the client passes, it means that the client does not actually need \texttt{gson}\@\xspace to run. In that case, we remove the client from the dataset. Our final dataset consists of $368$ client projects distributed as shown in \autoref{tab:cli}. Column \textsc{\#Client} indicates the number of clients for each library, \textsc{\#Test} shows the combined number of tests provided by their test suite, and \textsc{\#JSON Test} gives the number of these tests that cover the usage of a JSON\xspace library. This number is obtained by checking the number of test failures with the \textsc{Placebo}\xspace wrapper. \begin{table}[ht] \centering \begin{tabular}{@{}lrrr@{}} \hline \textsc{Library} & \textsc{\#Client} & \textsc{\#Test} & \textsc{\#JSON Test} \\ \hline jackson-databind & 128 & 636,664 & 127,054\\ gson & 122 & 201,576 & 6,891\\ json & 84 & 84,030 & 10,835\\ json-simple & 34 & 37,804 & 1,065\\ \hline Total & 368 & 960,074 & 145,845\\ \hline \end{tabular} \vspace{0.5em} \caption{JSON\xspace library clients studied} \label{tab:cli} \end{table} \subsection{Experimental Protocol} \subsubsection{Library Substitution Framework design and test (RQs 1 \& 2)} \label{sec:methodo-rq1} The goal of our two first research questions is to assess the feasibility of implementing and testing the architecture described in \autoref{sec:archi}. \autoref{fig:lib-exp} gives an overview of our process to answer these questions \begin{figure}[ht] \centering \includegraphics[width=\columnwidth]{figures/Methodo_RQs_1_2.pdf} \caption{Design (RQ1) and test (RQ2) of \textsc{Argo}\xspace, our concrete Library Substitution Framework for the JSON\xspace library reservoir. In RQ1 we design and implement the facade, $4$ bridges, and $20$ wrappers. In RQ2, we curate and reuse the test suites of the $4$ bridged libraries, to run them on all combinations of bridges and wrappers.} \label{fig:lib-exp} \end{figure} \textbf{RQ1 protocol:} To answer the first question, we implement \textsc{Argo}\xspace, a Library Substitution Framework for the JSON\xspace library reservoir described in \autoref{sec:json-family}. In order to bring down the development effort, we follow the process of API curation described in \autoref{sec:archi}. We focus on the most used version of each library of the reservoir. We develop a bridge for $4$ of the most popular libraries: \texttt{jackson-databind}\@\xspace, \texttt{gson}\@\xspace, \texttt{org.json}\@\xspace and \texttt{json-simple}\@\xspace. In these bridges, we only adapt the most used API elements that correspond to the features shared by all libraries of the reservoir. We assess the popularity of API elements by static analysis of the clients' dataset described in \autoref{sec:clients}. To perform this static analysis, we reuse the tool develop for a previous study~\cite{harrandCore}. We define a common API that describes the common features, which we package as the facade of our framework. These features are JSON\xspace text parsing, JSON\xspace type representation as Java Object, and data serialization as JSON\xspace text. Finally, we write a wrapper for each of the $20$ libraries of the reservoir. We then evaluate this API curating process by discussing the number of API elements adapted compared to the total number of API elements in the reservoir. \textbf{RQ2 protocol:} Once \textsc{Argo}\xspace is implemented, we run the test suite of the $4$\@\xspace bridged libraries against their corresponding bridge in order to assess what functionalities of the $20$\@\xspace libraries are preserved. This assessment is based on a two-step protocol: (1) First, we curate the original test suite to select a subset of the original test suite that is relevant to test \textsc{Argo}\xspace; (2) we run this curated test suite on the corresponding bridge and each of the $20$\@\xspace wrappers supported by \textsc{Argo}\xspace. \begin{figure}[ht] \centering \includegraphics[width=\columnwidth]{figures/Test_Selection_4.pdf} \caption{Protocol to select tests relevant to Library Substitution Framework validation from the test suite of the bridged libraries. Tests need to cover adapted API elements, while not enforcing a non-standard behavior.} \label{fig:test-selection} \end{figure} First, we follow the test selection process described in \autoref{fig:test-selection}. Given one original JSON\xspace library, we extract its test suite and add a dependency to the corresponding bridge and implementation. For example, we take the test suite of \texttt{org.json}\@\xspace , and add a dependency towards \texttt{json-over-argo} and \texttt{argo-json}. Hence, when a test case refers to a class from the original library, the corresponding class from the bridge is loaded instead. (1) First, we compile the test suite. Some test cases do not compile because the bridge does not implement the feature targeted by the test. We remove those tests. Then, we run the test suite on the bridge with the \textsc{Placebo}\xspace wrapper (2). We comment-out tests that pass despite the wrapper being empty and label them as \textsc{PLACEBO}. At the end of this test suite execution, we obtain a subset of the original test suite, composed exclusively of the test cases and assertions that assess the behavior of the bridge. We execute the test cases that are not labelled \textsc{PLACEBO}, with the bridge and the wrapper that corresponds to the original library (3). We select all the tests that pass on this implementation. If some test cases fail, we manually analyze them to determine whether to modify them or to remove them (4). We remove tests that specify a behavior stricter than what is described in RFC 8259~\cite{rfc8259}. The tests we modify are adapted in two ways. One is to relax assertions that assess strict equality of JSON\xspace strings to make them tolerant to equivalent JSON\xspace strings: make JSON\xspace text equality check tolerant to white spaces or JSON\xspace object tolerant to key reordering. The second is the relaxation of the number comparisons to make them tolerant to different types (removing unchecked casts, making floating-point comparison modulo epsilon, etc.). As a sanity check, we re-run the whole selected test suite to make sure that every test fails on \textsc{Placebo}\xspace and succeeds on the reference wrapper. The second main step of the protocol for RQ2 consists in running the selected test cases with every other library, to determine how much of the original behavior is preserved by the variants present in \textsc{Argo}\xspace. We then analyze the reasons for eventual failures. \subsubsection{Client Experiments (RQs 3, 4 \& 5)} \label{sec:methodo-rq234} \begin{figure}[ht] \centering \includegraphics[width=\columnwidth]{figures/Client_experiments.pdf} \caption{The flow of experiments on JSON\xspace libraries' clients.\\ For each client, we substitute the original library by its corresponding bridge. We, then, compile the client to detect potential missing API elements from the bridge (RQ3). If compilation succeeds, we generate 20 variants per client, one per library in the reservoir. We run the clients' original test suites on each variant. We then analyze test successes (RQ4) and failures (RQ5).} \label{fig:client-exp} \end{figure} Our second set of RQs assesses whether we can generate application variants through library substitution. To answer them, we substitute the JSON\xspace library, used by the clients of the dataset described \autoref{sec:clients}, by alternatives provided by \textsc{Argo}\xspace. \autoref{fig:client-exp} describes the flow of our experiment. For each client, we substitute the JSON\xspace library and replace it by the corresponding bridge. Since all of our clients are Maven project, to perform substitutions, we edit the \textit{pom.xml} files of clients. This allows us to alter the classpath of the client both during compilation and test execution. \textbf{RQ3 protocol:} We analyze the result of compiling each client, where the original JSON\xspace library has been substituted by the corresponding bridge. Our dataset only contains client projects for which we can reproduce the build. Consequently, a build failure with the bridge indicates that there are static differences between the part of the API of the original library used by the client and its \textsc{Argo}\xspace counterpart. By contrast, when no compilation error occurs, it means that all API members statically called by the clients are exposed by the bridge. \textbf{RQ4 protocol:} In RQ4, we measure the number of behaviorally equivalent variants we can generate through library substitution. We focus on clients for which the substitution of the library, by its corresponding bridge, leads to successful compilation. For each client, we generate $20$ variants, one per library in the reservoir described in \autoref{sec:json-family}. A variant is composed of the original client, a bridge, a wrapper and one alternative library. We run the test suite of these clients on each of the $20$ variants. We assess if variants are behaviorally equivalent, by checking whether the client's test suite passes, without test failures, on them. Our dataset only contains clients for which the test suite covers the usage of the original JSON\xspace library, as a substitution with the \textsc{Placebo}\xspace wrapper makes their test suite fail. Hence, we know that the substituted library is covered by at least one test in the client's test suite. We then count for each client the number of behaviorally equivalent variants. This number of variants is the number of alternatives that our Library Substitution Framework provides for a given client. \textbf{RQ5 protocol:} In RQ5, we manually investigate clients for which we obtain test failures after library substitution. We re\-run failing tests with a debugger to investigate the root cause of their failure. From these analyses, we draw principles that enable developers to decouple clients from their libraries. We discuss these principles and give examples of tests that do not respect them. \section{Results} \label{sec:results} \subsection{\textbf{RQ1. Can the architecture we propose for a Library Substitution Framework be implemented from a concrete reservoir of libraries?}} \label{sec:argo-design} In this research question, we assess the feasibility of implementing a Library Substitution Framework that follows the architecture described in \autoref{sec:archi}. To evaluate the development cost of such an endeavor, we implement a concrete framework, \textsc{Argo}\xspace, for the reservoir of JSON\xspace libraries described in \autoref{sec:json-family}. We focus on the features that are shared by all the $20$ libraries of the reservoir: parsing JSON\xspace text into Java objects and serializing these objects back to JSON\xspace text. In the remaining of this section, we discuss in detail our design decisions. We also discuss the effect of our proposed architecture on the development effort through the lens of API elements adapted. \input{tables/library_rq1} \autoref{tab:libs-rq1} summarizes the design decisions taken concerning API curating, in our implementation of \textsc{Argo}\xspace. Column \textsc{\#Version} indicates the number of versions listed by \textit{\url{mvnrepository.com}} for each of the $20$ libraries of the reservoir. We decide to focus on only the most popular version of each of these libraries. We estimate the popularity of library version based on the clients we mine from GitHub in \autoref{sec:clients}. Column \textsc{\#API\_Elements} gives the number of public elements (constructors, methods and fields), in the most popular version of each library. Each of these elements may be called by any clients of the library. Column \textsc{\#API\_Bridge} shows the number of API elements adapted in the bridges. These elements' code is rewritten using calls to elements of \textsc{Argo}\xspace's facade. These numbers are provided for the subset of the most popular libraries for which we have chosen to implement a bridge. Column \textsc{\#API\_Wrapper} indicates the number of API elements of the original libraries used in \textsc{Argo}\xspace's wrappers. In the remaining of this section, we discuss these numbers with more details by going through each layer of the architecture: bridges, facade and wrappers. \textbf{Bridges:} We select $4$\@\xspace out of the $5$ most popular libraries in the reservoir: \texttt{jackson-databind}\@\xspace, \texttt{gson}\@\xspace, \texttt{org.json}\@\xspace, and \texttt{json-simple}\@\xspace. Bridges are implemented by replacing calls to parsing and serialization to their abstract counterparts described in the facade, and by replacing JSON\xspace data structure classes by classes containing a type from the facade and redirecting method calls to their equivalent described by the facade on the contained type. We implement a bridge from the most popular version of those $4$\@\xspace libraries towards our facade. The column \textsc{\#API\_Bridge} of \autoref{tab:libs-rq1} shows the number of API elements adapted for each bridge. They range from $60$ for \texttt{gson}\@\xspace to $123$ for \texttt{org.json}\@\xspace. This represents a small proportion of their respective API size (ranging from $102$ elements up to \np{5807}). The sources of our bridges are available online.\footnote{\url{https://github.com/nharrand/argo}} \textbf{Facade:} We identify a common set of features for all of our $4$\@\xspace bridged libraries. We rely both on knowledge of the JSON\xspace subject, and on the manual analysis of the libraries in the reservoir to identify three key, core features, which we specify in the facade: parsing JSON\xspace text into Java structures, serializing these structures to JSON\xspace text, and representing JSON\xspace types with Java structures. We observe that $15$ out of $20$ libraries propose a type for JSON\xspace object and $14$ for JSON\xspace arrays~\cite{harrandjson}. The other libraries represent these data as types of the Java standard library, implementing either a Map or a List (or in one case a primitive array). Therefore, we include these types in the facade. We also add a type to represent the JSON\xspace value Null As the other JSON\xspace types (String, Number, and Boolean) are more often represented by types from the Java standard library, we do not impose any choice in our facade. In total, the facade includes $3$ interfaces (JSON\xspace object, JSON\xspace array and JSON\xspace factory), regrouping $15$ methods to be implemented by each of the $20$ wrappers. \textbf{Wrapper:} Writing a wrapper consists in implementing the interfaces provided by the facade with the API of an existing library of the reservoir. The column \textsc{\#API\_Wrapper} of \autoref{tab:libs-rq1} shows the number of API elements of the targeted library used in our wrapper. They range from $2$ for \texttt{progbase} and \texttt{json-util} up to $48$ for \texttt{mjson}. We first implement the interface, described in the facade, responsible for JSON\xspace text parsing and the creation of concrete JSON\xspace object from the library being wrapped. This operation is either implemented through the constructors of the class representing JSON\xspace object and JSON\xspace array, in a factory class or in a class representing the parser. Second, we adapt serialization operation to serialization methods of the facade. Finally, we add an implementation for the interface of the facade representing JSON\xspace object and JSON\xspace array based on the existing class of the library, either by extending the class in question or by creating a container type. When no such class exists, we create a container type for the class of the Java standard library used by the library. This is the case for $5$ libraries: \texttt{flexjson}, \texttt{genson}, \texttt{json-util}, \texttt{progbase} and \texttt{sojo}, which explains the relatively low number of API elements used. In the most extreme case, \texttt{progbase}, only two API elements are used: \texttt{JSONObjectReader.readJSON}, the parser and \texttt{JSONObjectWriter.writeJSON}, the serializer. We also intercept \texttt{null} values used to represent the JSON\xspace Null value and replace them by the type of the facade. We do write this wrapper for all $20$ libraries in our dataset. The sources of our wrappers are available online.\footnote{\url{https://github.com/nharrand/argo}} With the JSON\xspace reservoir presented in \autoref{tab:libs-rq1} a naive approach for the development of adapters would require the development of an adapter from each API element of each version of the $20$ libraries towards the $19$ other libraries. Assuming that the number of API elements for each library does not drastically vary among versions, then, the naive approach would require $27$ millions of elements to be adapted following the calculus (1) presented in \autoref{sec:archi}. Even if we focused on one version per library, this would still mean adapting $13,958$ API elements to each of the $19$ other libraries, or a total of $265,202$ adapters. Instead, using the revised calculus (2), we adapt a total of $336$ elements in our $4$ bridges, and $20 \times 15$ ($300$) in our wrappers. This represents a total of $636$ adapters. This reduction from $265,202$ to $636$ adapters results from a careful selection of a subset of libraries and APIs to build the bridges of \textsc{Argo}\xspace, as well as from the architecture based on inversion of control and an abstract facade. The experiments in the following sections show that the drastic reduction of API elements still allows diversifying the supply chain of a large number of clients. \begin{mdframed}[style=mpdframe]\textbf{Answer to RQ1.} With \textsc{Argo}\xspace, a concrete Library Substitution Framework for the reservoir of JSON\xspace libraries, we demonstrate that such an implementation is feasible. After API curating, we design bridges that adapt the most used API elements representing the common features of the reservoir. This process reduces the number of API element adaptations from $265,202$ to $636$. \end{mdframed} \subsection{\textbf{RQ2. Can the preservation of features of the libraries be tested by reusing their existing test suites?}} We investigate how \textsc{Argo}\xspace's $20$ libraries preserve an equivalent behavior, modulo test, for the $4$ bridges we developed. We first discuss the outcome of curating the original test suites of the $4$ bridged libraries. Second, we run the curated test suites with the bridges and each library of the reservoir, and discuss the outcome. \subsubsection{Test Selection} \input{tables/test_selection} \autoref{tab:test-selection} gives the details of the test selection for each original test suite. The second column gives the number of tests present in that original test suite. The third column gives the number of tests that were removed because they call API elements not supported by the bridge. The fourth column indicates the number of tests that we discard because they pass on the \textsc{Placebo}\xspace wrapper and therefore would pass with any library. The last column indicates the number of tests that we have selected to run with each library in the reservoir. For example, the \texttt{gson}\@\xspace test suite originally contained \np{1051} tests, from which we removed none for compilation reasons, $918$ were labelled as \textsc{PLACEBO} and $133$ were selected. In total, we assembled $4$ curated test suites combining $390$ tests. We can see two different trends. \texttt{gson}\@\xspace and \texttt{jackson-databind}\@\xspace are large libraries that expose many features, beyond just JSON\xspace serialization, parsing and JSON\xspace data structure. Some of these features are unmodified in our bridges as they are not shared by the other libraries, and therefore unaffected by \textsc{Argo}\xspace. By unmodified, we mean that we keep the source code from the original library. This explains the large number of \textsc{PLACEBO} tests that we discard. Note that, by definition, those tests would pass with any wrapper of \textsc{Argo}\xspace. On the other hand, \texttt{org.json}\@\xspace proposes a large API that we do not fully support in our bridge as few clients rely on it, hence the large number of tests that do not compile because of features that we do not support. Those tests do call API elements that we dismissed in our bridges. \input{listings/error_handling} We modify $17$ tests, across the $4$ test suites, by deactivating assertions that specify the error behavior of the original library. Error handling behavior is very diverse among our libraries and, hence, difficult to reproduce with every other library. \autoref{lst:error-handling} is an excerpt of a test that checks the behavior of \texttt{json-simple}\@\xspace's parser when encountering an ill-formed JSON\xspace input. When \texttt{json-simple}\@\xspace's parser encounters an error, gives its position to its client. The client can then decide what to do with the partially parsed JSON\xspace text. Some libraries, such as \texttt{org.json}\@\xspace, fail without giving the position of the error. Other libraries, consider the error to be positioned somewhere else. Hence, it is possible to preserve the fact that an exception is thrown for an ill-formed input, but not necessarily the error message or partially parsed data. Therefore, we keep the assertion that specifies that an exception is thrown (Line 7), but we deactivate the assertion that specifies the content of the exception (Line 11). \subsubsection{Behavior Preservation} \autoref{tab:cross-test-results} presents the outcomes for the curated test suites on each pair of bridge and wrapper in \textsc{Argo}\xspace. Each column corresponds to one of the $4$\@\xspace bridges, and each line corresponds to one of the $20$\@\xspace wrappers. Each cell gives the number of tests of the original test suite that pass with the bridged library, indicating behavior preservation. Cells in green show wrappers that passed all tests, cells colored in yellow represent wrappers that failed less than $10\%$ of the test suite, and in red are the wrappers that failed more than $10\%$ of the test suite. For example, the first line shows that all the curated tests for \texttt{gson}\@\xspace pass with the \texttt{gson}\@\xspace bridge and the \texttt{cookjson} wrapper; $6$ out of the $141$ curated \texttt{jackson-databind}\@\xspace tests fail with the \texttt{jackson-databind}\@\xspace bridge and the \texttt{cookjson} wrapper; all the \texttt{json} tests and the \texttt{json-simple}\@\xspace tests pass with their respective bridges and the \texttt{cookjson} wrapper. \input{tables/cross_tests_results} Overall, out of the $80$ test suite runs ($4 \times 20$), $56$ pass without any failures. This means that, $56$ bridge/wrapper couples preserve the initial library's behavior. This shows that for the most part, the libraries of our reservoir share similar features with similar behaviors, which makes them prone to substitution. $19$ test suite fail less than $10\%$ of their tests, including $7$ that fail a single test. $5$ test suites fail more than $10\%$ of their tests. Two wrappers (\textit{mjson} and \textit{jjson}) fail tests for all $4$ test suites. While $4$ wrappers (\textit{fastjson}, \textit{genson}, \textit{json-lib}, and \textit{jsonij}) pass all tests of all test suites. These results show that overall, most features of the original four bridged libraries are supported by \textsc{Argo}\xspace. Our analysis of the test failures reveals that libraries can fail for several reasons. Firs, a standard may leave room for diversity among libraries implementing it~\cite{harrandjson}. In the case of JSON\xspace, the RFC~\cite{rfc8259} leaves JSON\xspace parsers free to decide whether to accept ill-formed JSON\xspace inputs. Therefore, tests specifying the acceptance or rejection\footnote{\url{https://github.com/google/gson/blob/f649e051411e092f0123878e16c5132500a2d01e/gson/src/test/java/com/google/gson/internal/bind/JsonTreeWriterTest.java\#L131}} of ill-formed inputs may fail when running on other libraries implementing different choices. Second, libraries may implement different, and not fully aligned, standards. For example, \texttt{jsonutil} implements ECMA5 and rejects keys that start with a digit\footnote{\url{https://github.com/billdavidson/JSONUtil/blob/f833a1bd7e63df30aae70984539378fdb0ee4263/JSONUtil/src/main/java/org/kopitubruk/util/json/JSONParser.java\#L119}}. Finally, some aspects of a standard may be commonly ignored by libraries (in our case, $6$ libraries do not support Unicode characters). \begin{mdframed}[style=mpdframe]\textbf{Answer to RQ2.} For $56$ out of the $80$ \textsc{Argo}\xspace pairs of bridges and wrappers, all test cases in the curated test suite of the original bridged library pass. Moreover, less than 10\% of the tests fail for $19$ pairs. This is strong evidence that \textsc{Argo}\xspace preserves behavior through library implementation substitution and that the developers of future Library Substitution Frameworks can reuse existing test suites for validation. \end{mdframed} \subsection{\textbf{RQ3. What is the share of clients for which the framework preserves the static semantics of the original dependency?}} In RQ1, we have discussed the API curating process. In \texttt{jackson-databind}\@\xspace's bridge we have adapted $79$ out of \numprint{5807} original API elements, for \texttt{gson}\@\xspace $60$ out of $468$, for \texttt{org.json}\@\xspace $123$ out of $301$ and for \texttt{json-simple}\@\xspace $74$ out of $102$. In this research question, we investigate the impact of this API curation on clients of those APIs. In particular, we assess what share of the clients of the $4$ bridged libraries only use API elements supported in \textsc{Argo}\xspace. To assess this share, we observe the outcome of compiling the source code of clients of the datasets described in \autoref{sec:clients}, when their JSON\xspace library is substituted by the corresponding bridge. \begin{figure}[ht] \centering \input{chart/fig6} \caption{Share of client projects with no compilation errors after transformation} \label{fig:compilation} \end{figure} \autoref{fig:compilation} shows the compilation outcome of $368$ clients transformed with one of the $4$\@\xspace bridges in \textsc{Argo}\xspace. The horizontal axis indicates the bridge, and the vertical axis the share of clients using the bridge that compile without error. For example, $115$ of the $128$ ($89.84\%$) clients that originally use \texttt{jackson-databind}\@\xspace compile with \textsc{Argo}\xspace's bridge for \texttt{jackson-databind}\@\xspace (\texttt{jackson-databind-over-argo}). In total, $89.40\%$ of clients ($329$ out of $368$) successfully compile with an \textsc{Argo}\xspace bridge instead of their original JSON\xspace dependency. This is strong evidence that the trade-off that we made between the complexity of the bridges and the preservation of a subset of the original APIs is appropriate to successfully serve a large portion of the JSON libraries clients. In the following, we discuss the root cause for the compilation errors. In particular, we highlight that not all of them are due to missing API members in the bridges. Instead, they occur because of the intrinsic complexity of dependency resolution mechanisms. By design, \textsc{Argo}\xspace bridges do not cover the most exotic parts of the bridged libraries' API. Hence, the compilation fails when we build a client that uses an API element that is not supported in the bridge. This is the case, for example, for Jooby\footnote{\url{https://github.com/jooby-project/jooby}}, a modular web framework that depends on \texttt{org.json}\@\xspace. Jooby depends on the class \texttt{org.json.JSONTokener}, which is not included in our bridge. Hence, when replacing \texttt{org.json}\@\xspace, by \texttt{json-over-argo}, compilation fails. Among the $16$ \texttt{org.json}\@\xspace clients for which \textsc{Argo}\xspace transformations lead to compilation errors, $10$ are due to clients relying on \texttt{org.json.JSONTokener}. We provide a bridge for the most used version of each bridged library. Consequently, clients relying on a different version of the library may face some incompatibility when the API is substituted by the bridge. This only causes issues when the part of the API used by the client has changed in the version supported by \textsc{Argo}\xspace. For example, the project java2typescript\footnote{\url{https://github.com/raphaeljolivet/java2typescript/blob/5e3921b674bfb03ba9ac042238a8db0b9b17ca3a/java2typescript-jackson/pom.xml}} depends on \texttt{jackson-databind}\@\xspace version $2.6.4$. It uses the constructor for the class \texttt{TypeBindings}, available in version $2.6.4$. We support \texttt{jackson-databind}\@\xspace version $2.12.0$ in which this constructor has become private, providing a factory method instead to create an object of this type. Hence, when replacing \texttt{jackson-databind}\@\xspace by its bridge \texttt{jackson-databind-over-argo} in java2typescript, the compilation fails. Compilation errors occur because of dependency conflicts introduced by specific implementation choices of \textsc{Argo}\xspace. For example, \texttt{netbeans-mmd-plugin} depends on \texttt{commons-codec:1.14}. But \textit{cookjson}, one of the libraries in our JSON reservoir, depends on version \texttt{1.10} of \texttt{commons-codec}. This creates a conflict in the compilation classpath of the project when \texttt{org.json}\@\xspace is substituted by its \textsc{Argo}\xspace bridge and the \textit{cookjson} implementation. This conflict triggers a compilation error, since the API of \texttt{commons-codec} has changed between version \texttt{1.14} and \texttt{1.10}. In particular, the method \texttt{DigestUtils.digest}\footnote{\url{https://github.com/apache/commons-codec/blob/af7b94750e2178b8437d9812b28e36ac87a455f2/src/main/java/org/apache/commons/codec/digest/DigestUtils.java\#L71}}'s signature has changed and since version \texttt{1.11} takes a \texttt{byte[]} parameter instead of an \texttt{InputStream}. This leads the compilation of \texttt{netbeans-mmd-plugin}, that relies on the newest version of the API, to fail. As stated in \autoref{sec:argo-design}, the goal of our architecture is not to target all clients of all versions of the libraries in our reservoir. We have focused on a limited part of the API of one version of $4$ libraries. We observe that we still provide adaptation for API elements that are enough to support $89.40\%$ of the clients of these $4$ libraries. \begin{mdframed}[style=mpdframe]\textbf{Answer to RQ3.} The $4$\@\xspace JSON\xspace bridges implemented in \textsc{Argo}\xspace provide an API large enough to successfully compile $89.40\%$ of the clients in our dataset. The high rate of successful compilation is evidence that it is relevant to select a subset of a library's API to build a Library Substitution Framework based on bridges and wrappers. \end{mdframed} \subsection{\textbf{RQ4. How many variants can we produce for each client, while preserving the original behavior?}} In the section, we evaluate the amount of behavior preserving variants per client, that we can generate through the use of a Library Substitution Framework. To assess which variant exhibit a behavior equivalent to the original application, we rely on the test suite of the application. We use the $329$ clients of the dataset described in \autoref{sec:clients} for which the substitution of the JSON\xspace library by its corresponding bridge led to no errors. For each of these clients, we build $20$ variants corresponding to each of the $20$ libraries of the reservoir and run the client's test suite. We then analyze the test results and count the number of variant that are behaviorally equivalent modulo test. We ran the test suite of each client three times to limit the impact of flaky tests, the clients have \np{960074} test cases, which take a total of \np{18.2} hours to execute. In total, we execute \np{2880222} tests cases. \begin{figure}[ht] \centering \includegraphics[width=\columnwidth]{figures/Alternatives_per_clients.pdf} \caption{Distribution of the number of successful substitution per client.\\ We regroup the $329$ clients of our dataset based on the number of JSON\xspace library substitutions (out of $20$) that passed their test suite.} \label{fig:number-alternative} \end{figure} \autoref{fig:number-alternative} illustrates the key results for RQ3. This plot shows the cumulative number of clients for which we successfully substituted a certain number of alternative JSON\xspace libraries. The horizontal axis gives the number of alternative libraries and the vertical axis gives the number of clients. The colors indicate which bridge is used. The right-most bar of the plot indicates that \textsc{Argo}\xspace is able to substitute the original JSON\xspace library by any of the $20$ alternatives for $88$ clients (including the wrapper corresponding to the original library). This is a novel evidence that it is possible to automatically increase the diversity of suppliers in the supply chain of client applications, without changing the code of these clients. Among the $88$ clients, $39$ build with the \texttt{gson}\@\xspace bridge and $39$ build with the \texttt{jackson-databind}\@\xspace bridge, $7$ with the \texttt{org.json}\@\xspace bridge and $3$ for the \texttt{json-simple}\@\xspace one. This shows that library substitution are possible from any of the $4$ bridged libraries towards any of the $20$ libraries of the reservoir. The other bars in the plot indicate that the majority of the other $241$ clients can be provided with a large proportion of alternative JSON\xspace libraries available in our pool: $195$ out of $329$ ($59.27\%$) clients can build with $14$ or more alternatives. On the left of the plot, we observe that $57$ clients cannot successfully run their whole test suite on any alternative library ($12$ for \texttt{gson}\@\xspace, $27$ for \texttt{jackson-databind}\@\xspace, $13$ for JSON\xspace and $5$ for \texttt{json-simple}\@\xspace), and that $51$ clients are compatible with between $1$ and $5$ JSON\xspace libraries. In total, we successfully synthesize \np{4069} behaviorally correct variants, modulo test suite, for the the $329$ original clients. We can build variants, with $15$ or more alternative JSON\xspace libraries, for $195$\@\xspace clients. In the following, we discuss two clients for which a high number of libraries can be substituted to their original JSON\xspace library. The Automotion framework\footnote{\url{https://github.com/ITArray/automotion-java}} originally depends on \texttt{json-simple}\@\xspace. Its test suite includes $5,693$ test cases that trigger invocations on the \texttt{json-simple}\@\xspace API. Automotion directly calls $15$ different methods from $3$ classes of the library (\texttt{JSONObject}, \texttt{JSONArray} and \texttt{JSONValue}. These calls are made from $13$ distinct methods in \texttt{automation\-java}'s code. JSON\xspace manipulation is important for this framework (evidenced by the large number of test cases), yet it is very regular: it uses functions related to JSON\xspace parsing, JSON\xspace object manipulation (read and write) and serialization. During the execution of its test suite, Automotion invokes \texttt{json-simple}\@\xspace's API $39,481$ times. All $20$ libraries provided by \textsc{Argo}\xspace can be substituted to \texttt{json-simple}\@\xspace and provide the proper behavior for these thousands of invocations, without breaking the test suite of Automotion. \input{listings/detect-class} CrashCoin\footnote{\url{https://github.com/StanIsAdmin/CrashCoin}}, a cryptocurrency implemented in Java, originally depends on \texttt{org.json}\@\xspace. CrashCoin's test suite includes $15$ test cases that cover parts of CrashCoin which invoke the API of \texttt{org.json}\@\xspace. For all the libraries in our reservoir, except \texttt{corn} and \texttt{mjson}, we successfully build CrashCoin with \textsc{Argo}\xspace and all test cases pass, which generates 18 variants of the project with 18 different providers for JSON\xspace processing. CrashCoin's test suite fail when substituting \texttt{org.json}\@\xspace by \texttt{corn}. \texttt{TestBlockChain\#testBlockChainBlockAdding} fails with \texttt{corn} because this JSON\xspace library does not handle correctly natural numbers that do not fit in an \texttt{Integer} (number in the interval $2^{31} - 1$ to $-2^{31}$). When running the test, the JSON\xspace library needs to determine the type of $1,512,901,875,251$. The library \texttt{corn} relies on the method \texttt{detectClass}, shown in \autoref{lst:corn-detect-class}, to determine the Java type to represent a JSON\xspace literal. This method tries to parse the literal as \texttt{Integer}, if this fails, it tries to parse the literal as a \texttt{Float}, then as a \texttt{Double}, and so on. But parsing the String $1,512,901,875,251$ with \texttt{Float\#valueOf} does not raise an exception for values that do not fit on 32 bits. Instead, the method returns the rounded value $1.51290184E12$, losing the last $5$ digits of precision and failing the test. Overall, the $2$ libraries that pass the least clients' test suite, \texttt{mjson} ($120$ out of $329$) and \texttt{jjson} ($135$ out of $329$) are also the two libraries that fail the most tests in our cross testing experiments as shown in \autoref{tab:cross-test-results}. This confirms the intuition given in RQ1, that these two libraries exhibit a behavior that is more different from the $4$ bridged libraries than the other libraries, hence their use as substitution libraries is less likely to succeed. \begin{mdframed}[style=mpdframe]\textbf{Answer to RQ4.} \textsc{Argo}\xspace successfully diversifies the JSON\xspace supply chain of $272$ of the $329$ ($83\%$) client applications. $195$\@\xspace of them are compatible with $15$ or more libraries. In total, from $329$ clients, we synthesize \np{4069} variant applications using diverse JSON\xspace suppliers. This is an empirical assessment of the supply chain diversity that can be achieved by the Library Substitution Framework proposed in this work. \end{mdframed} \subsection{\textbf{RQ5. To what extent does the diversification of \json provider also diversify the observable behavior of \json clients?}} In this research question, we analyze the root cause of test failures when testing the clients with \textsc{Argo}\xspace. A key observation is that some test failures occur because of a tight coupling between the client and the JSON\xspace library. Some coupling is accidental and can be avoided to eventually make the client more prone to supply chain diversification. In this section, we discuss and illustrate three principles that enable more diversification. While the examples are collected from our experiments on JSON\xspace library substitution, we draw from them generic principles that are not specific to JSON\xspace libraries. \input{listings/cast} \textbf{Minimize reliance on implicit library behavior:} Some undocumented behaviors of a library, that are more linked to its implementation than to the contract of its API, are used by some clients. \autoref{lst:cast} shows such an example of dependence over an observed behavior rather than a contractual one. \texttt{CorpusMetadata} is class from Indra\footnote{\url{https://github.com/Lambda-3/Indra}}, which depends on \texttt{json-simple}\@\xspace. The constructor of this class takes a \texttt{Map} as an argument. In practice, this \texttt{Map} is read from a JSON\xspace object parsed with \texttt{json-simple}\@\xspace. This constructor assumes that specific types correspond to each key. In particular, the entry retrieved for the key \textsc{APPLY\_STEMMER} is assumed to be typed as a \texttt{long}. While this does not cause any issue with numbers read by \texttt{json-simple}\@\xspace, other JSON\xspace libraries may encode them with a different Java type. For example, \texttt{fastjson} encodes some value with \texttt{Integer}. Hence, when \textsc{Argo}\xspace substitutes \texttt{json-simple}\@\xspace with \texttt{fastjson}, the cast operations fail and a \texttt{ClassCastException} is thrown. This illustrates a case of a client that relies on an undocumented behavior of a library (returning a \texttt{Long} for natural numbers) rather than the one guaranteed by the API (returning an \texttt{Object}). Limiting coupling to return types that are not guaranteed by the signature of an API element is a sound design principle that facilitates dependency substitution and diversification. \input{listings/string-equality} \textbf{Test cases should not over specify the behavior of the client:} \autoref{lst:string-equality} shows an example of a test that over specifies the behavior of the program under test. It is extracted from the test suite of \texttt{jts}\footnote{\url{https://github.com/locationtech/jts}}. It checks that the class \texttt{Geometry} is correctly serialized in JSON\xspace. However, instead of checking that the information is indeed contained in a well-formed JSON\xspace string, the test checks that the serialized string is exactly equal to an expected value, character per character. This is over specification of the expected behavior, since the JSON\xspace standard specifies that the order of key-value pairs is not meaningful. In this case, $16$ out of $20$ \textsc{Argo}\xspace libraries make this test fail while they still produce an equivalent JSON\xspace string, which is not strictly equal. The other $4$ libraries pass the test. Over-specifying tests hinders library substitution, by erroneously indicating to the developer of the client that a library is incompatible. \input{listings/test-invalid} \textbf{Limit dependency on behavior stricter than the standard:} \autoref{lst:test-invalid} shows an excerpt of a test for CouchbaseMock\footnote{\url{https://github.com/couchbase/CouchbaseMock}}. It checks that specific values cannot be inserted in a JSON\xspace object. RFC 8259~\cite{rfc8259}, that standardizes the JSON format, stipulates that JSON libraries should not generate such values when they produce JSON text, but that they are free to accept them or not when reading JSON text. This test from CouchbaseMock verifies that such values are rejected. This means that CouchbaseMock is stricter than the JSON\xspace standard. CouchbaseMock depends on \texttt{json-simple}\@\xspace, which rejects these ill-formed values. Yet, other libraries often accept these values~\cite{harrandjson}, without violating RFC 8259~\cite{rfc8259}. Hence, when \texttt{json-simple}\@\xspace is substituted by another JSON\xspace library, the test may fail. In our dataset, $11$ of the $20$ libraries make this test fail, while the other $9$ make it pass. We showed in our previous work~\cite{harrandjson} that there exists a large diversity of behavior among JSON\xspace libraries when parsing ill-formed. This diversity emerges because the behavior of JSON\xspace libraries is not standardized for ill-formed values. It is a sound design principle for client applications to limit their assumptions about nonstandard API behavior, which can favor automatic dependency diversification. \begin{mdframed}[style=mpdframe]\textbf{Answer to RQ5.} A manual analysis of corner cases, reveals three design principles can favor dependency diversification: (i) Clients should not depend on implicit behavior of the library; (ii) test cases should not over-specify the behavior of the client they test; (iii) clients should limit their assumptions about non-standard behavior. \end{mdframed} \section{Threats to validity} \label{sec:threats} \textbf{Internal Validity.} We evaluate the concept of Library Substitution Framework with a concrete implementation for the Java JSON\xspace reservoir. We rely on application test suites as an oracle for successful substitution. However, test suites are imperfect. To limit the impact of this threat to validity, we rely on a two stages process. \textsc{Argo}\xspace is tested with carefully curated test suites of the $4$ bridged libraries. We systematically remove libraries which test suite passes with the \textsc{Placebo}\xspace wrapper. This ensures that the tests cover the JSON\xspace library and that its behavior is actually depended on. \textbf{External Validity.} We evaluate the concept of Library Substitution Framework in the single context of JSON\xspace libraries. This opens a discussion on how does this concept apply to other domains. We foresee three key arguments in favor of such an approach for other domains. Reservoirs of similar libraries exist in several domains, as evidenced by browsing software repositories for libraries of a specific domain\footnote{\url{https://mvnrepository.com/open-source}}. Previous work has demonstrated the possibility of performing wrapper based migration for Swing and SWT libraries~\cite{bartolomei2010swing}, XML~\cite{bartolomei2009study} or user interfaces~\cite{Bartolomei2012}. The overall architecture that we propose in this work is inspired by the one of the framework Simple Logging Facade for Java~\cite{slf4j}. Even if the architecture of \texttt{slf4j} does not aim at the same goals, it shows that such an architecture is possible in the domain of logging libraries. \section{Related Work} \label{sec:related-work} Our work about diversification in the software supply chain relates to three research areas: automatic synthesis of software diversity, library management and software supply chain hardening. \subsection{Automated Diversity} Automatic diversification was pioneered by the seminal work of Cohen~\cite{cohen93} and Forrest \cite{forrest97}. They proposed to generate program variants that deliver the same functionality as the original, while exhibiting differences in the way they handle unspecified behavior. Following these initial work, subsequent studies analyzed different kinds of transformations in the stack \cite{lee2021savior}, on binary code \cite{wartell2012binary,AbrathCMBS20}, at the binary interface level \cite{Kc03}, in the compiler \cite{homescu2015large} or in the source code \cite{baudry14b,harrand2019journey}. All these transformations operate on a small scope, typically at the instruction-level. This is both a necessity to limit the risks of breaking the original functionality, and a key limitation to achieve behavior diversity outside the specified requirements. Meanwhile, only few techniques propose to exploit the existence of alternative libraries to create diversity. Persaud and al.~\cite{persaud2016frankenssl} present FrankenSSL. This approach recombines fragments of forks of OpenSSL to create library variants that all provide the same features. But these fork have a very similar API as they descend from a unique project. Our proposal for a Library Substitution Framework generalizes the idea of exploiting the natural diversity of library implementations, at build time. The natural emergence of functionally diverse implementations of the same features has been harnessed in several ways in the past, to reduce common failure \cite{SalakoS14}. For example, collection libraries exist in many different implementations, which can be selected according to application specific performance requirements, either statically ~\cite{basios2018darwinian}or dynamically~\cite{shacham2009chameleon,basios2018darwinian}. We have previously harnessed the natural diversity of Java decompilers to improve the overall precision of decompilation~\cite{HarrandDecompiler}. Gashi and colleagues have tamed the diversity of SQL servers for security purposes \cite{gashi2007}, while Xu and Kim leveraged the execution platform diversity to protect against attacks on PDF applications \cite{xu2017}. The concept of Library Substitution Framework is founded on the natural emergence of diverse implementations of various kinds of libraries. Our concrete implementation, \textsc{Argo}\xspace, harnesses JSON\xspace libraries that differ in performance~\cite{Maeda} as well as in behavior~\cite{harrandjson}. This type of diversity in the supply chain of applications is beneficial to protect against a single point of failure. \subsection{Library Migration} Techniques to help developers in the migration process usually suggest mappings between specific API elements providing similar features Chen et al.~\cite{chen2015} describe an unsupervised learning approach to create a database of similar APIs. Alrubye and colleagues~\cite{alrubaye19,Alrubaye18} present a tool named MigrationMiner that finds migration rules, in past migrations of other projects. These rules help developers to replace calls to the previous API by their equivalent in the new API. Fazzini and colleagues~\cite{Fazzini2020} propose APIMigrator, to automate the migration of applications when the Android API evolves, based on how other projects have already migrated. These tools assist developers in their migration process, and do not automate the migration of applications. They could assist the developers of a Library Substitution Framework in the development of bridges. In his thesis, Bartolomei~\cite{Bartolomei2012} proposes design principles for wrapper-based migration. Sharma and colleagues~\cite{sharma2019} wrote a tool that synthesizes adapters to replace functions that provide similar features, one by another, inside a given project. Previous projects \texttt{slf4j}~\cite{slf4j} or \texttt{micrometer}~\cite{micrometer} implement such a family of adapters for reservoirs of logging and metric libraries. They aim at merging respectively logs and metric gathered by the different libraries present in the dependency tree of an application. In this work, we propose a generic architecture for library substitution, which rely on a similar architecture for a different purpose. Our goal here is to build variants of applications, depending on different library suppliers. \subsection{Supply Chain Hardening} Recent work has highlighted the need for software supply-chain hardening, with a focus on software dependencies~\cite{PeisertSOMBLMMP21} One approach consists a systematically building dependencies from source code and ensuring a strictly deterministic build~\cite{lamb2021reproducible}. Deterministic builds are important as discrepancies between sources and packages can hide malicious code from the eyes of reviewers of open-source software~\cite{Vu2021}. But making builds fully deterministic is currently challenging because of timestamping or random naming \cite{ren2018automated}. Nikitin and colleagues propose a decentralized software-update framework to distribute software packages for which the build is reproducible~\cite{nikitin2017chainiac}. Other works aim at defending against malicious libraries also exists. Pashchenko and colleagues~\cite{pashchenko2020vuln4real} propose a methodology to evaluate which dependencies of a software project are vulnerable. Vasilakis and colleagues~\cite{vasilakis2021supply} propose a technique that learns the normal behavior of a dependency and automatically synthesizes a new library that exhibits an equivalent client-observable behavior, with no vulnerability. Catuogno and colleagues propose a technique to prevent malicious users from forcing applications to install vulnerable dependencies \cite{CatuognoGP20}. Cox~\cite{cox2019surviving} suggests that developers of client applications should decouple their code from the concrete implementation of libraries, adding an abstraction layer between the application and the API. This recommended abstraction layer regroups all calls to the external API in a localized wrapper, making future migrations simpler. We propose to mutualize this solution to all clients of a library reservoir. Our notions of bridge and facade for a library reservoir detach the APIs of these libraries from their actual implementation, allowing for library substitution. \section{Conclusion} \label{sec:conclusion} In the context of ever-increasing reliance on external software libraries, supply chain attacks represent a major threat. To mitigate their scale, we propose to generate and deploy software variants with a diverse supply chain. In this work, we present the concept of Library Substitution Framework based on a three-tier adaptation architecture. It allows developers to substitute a library by an alternative one, without modifications of the client software, enabling diversified variants based on each different library alternative. To assess the validity of the architecture we propose, we implement a concrete framework for Java JSON libraries. Our framework, \textsc{Argo}\xspace, supports $20$ different JSON\xspace libraries. We test this framework by reusing the test suites of bridged libraries. We evaluate the ability of our framework to diversify the supply chain of applications on a dataset of open-source project depending on JSON\xspace libraries. On $195$\@\xspace of the $368$\@\xspace java applications tested, we are able to provide at least $15$ alternatives. These results open the way for usages of the variants produced by our approach such as Moving Target Defense, or N-Variant systems.
{'timestamp': '2021-11-08T02:04:45', 'yymm': '2111', 'arxiv_id': '2111.03154', 'language': 'en', 'url': 'https://arxiv.org/abs/2111.03154'}
arxiv
\section{Introduction} Object detection is a fundamental task of computer vision. Its goal is to locate the bounding boxes of objects in an image as well as to classify them. Due to the complexity and diversity of the real world, this problem remains challenging despite the considerable attention it attracts. Most previous works focus on developing better detection frameworks~\cite{ren2015faster,yang2019reppoints,chen2020reppoints,carion2020end,liu2016ssd,redmon2016you, law2018cornernet} or stronger network architectures~\cite{lin2017feature, cai2018cascade, hu2018relation, tan2020efficientdet, ghiasi2019fpn, hu2018relation}. In addition, there are some that study data augmentation strategies~\cite{fang2019instaboost, cubuk2020randaugment, chen2021scale}, label assignment~\cite{zhu2020autoassign, li2021pseudo}, or training losses~\cite{lin2017focal, rezatofighi2019generalized}. In general, the existing works follow a standard training paradigm where the network takes training images that are augmented by a \textit{single} data augmentation strategy and the human-annotated bounding boxes are \textit{simply} used as the training targets. We refer to this approach as \textit{SiTraining}. Few works explore alternative training methods, which have been based on distillation \cite{chen2017learning,wang2019distilling,zhu2019deformable} or dynamic adjustment of label assignment criteria and regression loss \cite{zhang2020dynamic}. In this work, we expand the power of an augmentation strategy and the utility of human-annotated boxes through a new training paradigm for object detection. We observe that suitable magnitudes of an augmentation can vary from image to image, where a strong augmentation of certain images will enrich the training data, but may degrade the data when applied to other images, such as by altering the object appearance to become less compatible with the object class. Based on this, we present a mixed augmentation strategy that utilizes both strong and normal augmentations in a manner that takes advantage of strong augmentations only on images where they are expected to be helpful. We additionally note that human annotation of bounding boxes is often noisy or incomplete, which can be harmful to training. To alleviate this issue, we introduce the use of mixed training targets, composed of both human-annotated ground-truths and pseudo boxes that are intended to compensate for annotation errors. \input{figures/paradigm} The pseudo boxes are determined by bootstrapping on the detector. Because of the robustness of neural networks to label noise, the online detector can produce pseudo boxes that capture object locations missed or inaccurately localized by human labelers. We therefore utilize these pseudo boxes in conjunction with the human-annotated boxes to improve detection. Furthermore, the online detector can predict whether a strong augmentation of an image would help training. This is accomplished by using the online detector to compute the foreground score of a training target. A high score indicates that the target can be easily trained on, while those with a low score are discarded from training. \input{figures/label_noise_examples} Our training paradigm, called \textit{MixTraining}, integrates the mixed augmentation and mixed training targets as illustrated in Figure~\ref{fig:paradigm}. In the bottom two branches, normally augmented and strongly augmented images are passed to the detector for training. In the top branch, an exponential moving average (EMA) model of the online detector is used to generate pseudo boxes and to predict the foreground scores of the training targets. Only for training targets with a high score will their strong augmentations be included for training. As the detector progresses through training, the mixed augmentation and mixed training targets become increasingly better via bootstrapping. \textit{MixTraining} is a general training framework for object detection that can enhance existing object detectors without introducing extra computation or model parameters at inference time. Our experiments show that \textit{MixTraining} can appreciably improve the performance of leading object detectors such as Faster R-CNN~\cite{ren2015faster} with a ResNet-50~\cite{he2016deep} backbone (from 41.7 mAP to 44.0 mAP) and Cascade R-CNN~\cite{cai2018cascade} with the Swin-Transformer~\cite{liu2021swin} backbone (from 50.9 mAP to 52.8 mAP). \section{Related works} \paragraph{Framework and Network Design in Object Detection} Designing more effective frameworks has been a research focus in object detection. Most object detectors can be separated into two framework categories: single-stage object detectors~\cite{liu2016ssd, redmon2016you, lin2017focal, tian2019fcos} and two-stage object detectors~\cite{ren2015faster,chen2020reppoints,law2018cornernet}. Although we mainly conduct experiments of our method on two-stage detectors to verify the effectiveness this work, as a general training paradigm, \textit{MixTraining} is suitable for both single-stage and two-stage detectors. There are also many works exploring stronger network architectures. For example, feature pyramid network~\cite{ghiasi2019fpn} utilizes a pyramid network to tackle the challenge of scale diversity, and Cascade R-CNN~\cite{cai2018cascade} introduces a multi-stage head for improving localization accuracy. These methods can significantly elevate detection performance, and our work is compatible with these methods. \paragraph{Data Augmentation in Object Detection} Recently, the importance of data augmentation has become evident in the research community. Existing works can be classified into two categories. Methods in the first category focus on developing new transformation components. For example, Mixup~\cite{zhang2017mixup} proposes to use mixed images and labels as training samples. CutOut~\cite{devries2017improved} masks a part of a region in the original inputs. CopyPaste~\cite{ghiasi2020simple} and InstaBoost~\cite{fang2019instaboost} further consider data augmentation at the instance level, but both of them require instance mask annotations. Another type of method studies how to combine existing transformations more effectively. Representative works include AutoAug~\cite{zoph2020learning} and RandAug~\cite{cubuk2020randaugment}. Different from those methods that focus on how to improve a single augmentation strategy, our method considers two augmentations of different magnitudes. Current augmentation methods are, in fact, compatible with our mixed augmentation strategy, which can be applied with arbitrary forms of augmentation. \paragraph{Label Assignment in Object Detection} Existing works on label assignment mainly focus on improving assignment accuracy. GuidedAnchoring~\cite{wang2019region} dynamically changes the anchor shape and leverages semantic features to fit the objects better. ATSS~\cite{zhang2020bridging} presents an adaptive label assignment mechanism by dynamically adjusting the IoU threshold. AutoAssign~\cite{zhu2020autoassign} assigns positive or negative weights for each sample based on the training loss. Different from those methods, \textit{MixTraining} does not change the mechanism of label assignment itself, but changes the availability of each training target based on its predicted foreground score and the magnitude of the data augmentation. \paragraph{Alternative Training Methods for Object Detection} Only a few works explore alternative training methods for object detection, and they have primarily been based on distillation. For example, in \cite{wang2019distilling,zhu2019deformable}, feature distillation is presented to obtain fine-grained features or reduce invalid contextual information. Another work~\cite{zheng2021localization} focuses on the localization ambiguity issue, which is also explored in this work but we arrive at a different conclusion. In \cite{chen2017learning}, the distillation of features and detection results are considered at the same time. However, they rely on a well-trained teacher detector and mainly focus on distilling knowledge from a stronger teacher model to a weaker student detector. Compared with these distillation-based methods, \textit{MixTraining} also consists of two branches but mainly focuses on annotation noise and measuring the training difficulty of training targets. Dynamic R-CNN~\cite{zhang2020dynamic} examines the existing training paradigm from the training dynamics perspective. During training, it dynamically adjusts the label assignment criteria and the parameters of the regression loss for fuller training of the network. In comparison, \textit{MixTraining} enhances training by gradually introducing new well-trained samples into the set of strongly augmented images. \input{figures/example_annotation_noisy} \section{MixTraining} In this section, we introduce our new training scheme, \textit{MixTraining}, which integrates the two major components: mixed training targets and mixed data augmentation. The whole training paradigm is illustrated in Figure~\ref{fig:paradigm}. In the following, we will introduce each component in detail. \paragraph{Mixed Training Targets} Conventional \textit{SiTraining} uses only human-annotated ground-truths to train the detector. However, human annotation is imperfect and often includes annotation noise such as inaccurate localization or missing labels which can harm training. Examples are shown in Figure~\ref{fig:label_noise_examples}. Because of the robustness of deep neural networks to label noise~\cite{rolnick2017deep}, they can predict pseudo boxes, also known as pseudo labels, that are relatively free of localization noise and resilient to missing labels. This property has been exploited in semi-supervised object detection~\cite{sohn2020simple}, weakly-supervised object detection~\cite{dong2018few}, and sparsely annotated object detection~\cite{wang2020co}. However, its value in supervised object detection has rarely been explored. In this work, we introduce the use of mixed training targets that include both human-annotated ground-truth boxes and pseudo boxes to alleviate the issue of noisy annotation. To generate high-quality pseudo boxes, we follow the common practices~\cite{sohn2020simple,xie2020self,xu2021end} of applying an exponential moving average (EMA) model on the input images without any data augmentation except for scale jitter. Since the predicted boxes of an object detector are often noisy and redundant, non-maximum suppression (NMS) is employed to eliminate redundancy, where only pseudo boxes with a foreground score greater than 0.9 are retained. We next examine how to properly combine the pseudo boxes predicted by the object detector with human-annotated ground truth. For this, we design three strategies to deal with the missing label and noisy box localization issues: \begin{itemize} \item \textit{Missing labels}. In this strategy, we retain pseudo boxes whose IoU (intersection-over-union) with the ground truth is less than 0.5. They can be considered as missing annotations and are added to the training targets. An example is shown in Figure~\ref{fig:example_annotation_noisy} (c). \item \textit{Box localization noise}. Due to occlusion, small object size, and human subjectivity, the annotation quality for box localization is often inconsistent. We alleviate this issue by replacing the ground-truth boxes by pseudo boxes whose IoU with ground-truth boxes is greater than 0.5. An example is shown in Figure~\ref{fig:example_annotation_noisy} (d). \item \textit{Hybrid Approach}. The above two strategies are compatible with each other, and can be used at the same time, we named this strategy as hybrid approach, which has the advantages of the above two strategies. An example is shown in Figure~\ref{fig:example_annotation_noisy} (e). \end{itemize} We test the three strategies on the COCO dataset~\cite{lin2014microsoft} in Sec.~\ref{sec:ablation_study}. The results show that this treatment of missing labels notably improves detection performance, and there is no significant affects that applying the strategy for box localization noise alone. However, the hybrid strategy, which takes the advantages of other two strategies, show better performance than each of the above two strategies. By thus, we adopt the hybrid strategy in producing mixed training targets. \input{figures/wrong_label_assignment} \paragraph{Mixed Data Augmentation} Appropriate data augmentation is essential in training an object detector. In \textit{SiTraining}, a single data augmentation strategy is typically utilized, and the augmentation hyper-parameters need to be carefully tuned to achieve good detection performance. However, setting suitable hyper-parameters is a challenge. Weak data augmentation is prone to over-fitting and the model capacity may not be fully utilized. On the other hand, strong data augmentation may be detrimental, as it can lead to difficulty in training for some images and training targets. In \textit{MixTraining}, we expand single data augmentation to a mixed strategy: during training, we randomly sample and apply an augmentation from among strong and normal augmentations for each image. Training over various levels of augmentation can be advantageous because of the greater diversity of data. However, strong augmentations can potentially hurt training if the resulting appearance becomes incongruous with object class. We address this issue by using a training loss in which strongly augmented images are taken only for targets that can be easily trained on. A direct approach to implement this idea is to simply remove non-easy targets from all the training samples. However, a consequence of this is that many foreground proposals would be incorrectly assigned as background in the label assignment, as shown in Figure~\ref{fig:wrong_label_assignment}. Therefore, we instead assign a weight $w$ for each training target $g$: \begin{equation} w(g) = \begin{cases} 1, & \text{$g$ is an easy target or a normal augmentation} \\ 0, & \text{otherwise}. \end{cases} \end{equation} For all images that are normally augmented, $w(g)$ is set to 1 for all of their training targets. For the image that are strongly augmented, $w(g)$ is set to 1 only if $g$ is an easy training target. Then, we use this weight $w$ as a loss weight for each proposal in the training stage: \begin{equation} L_{det} = \sum_{i=0}^{N} w(g_i) L_{det}(p_i, g_i) \end{equation} where $p_i$ is the i-th proposal, and $g_i$ is the training target assigned to $p_i$. To determine whether $g$ is an easy target, we employ a simple approach where the foreground score of $g$ is predicted by the EMA model, and $g$ is considered an easy target if its score is greater than a threshold (0.9 by default). Since this method uses the same model and input images as pseudo box generation, the extra computational overhead can be largely reduced by treating the targets $\{g_i\}$ as proposals in the pseudo box generation process. \section{Experiments} \subsection{Experimental Settings and Implementation Details} \paragraph{Dataset and Evaluation Protocol} We validate our method on the COCO2017 dataset~\cite{lin2014microsoft}, which contains 80 object categories, 118k images for training (train2017), 5k images (minival) for validation and 20k images for testing (test-dev). The mean average precision (mAP) is adopted as the default metric for measuring performance. In our experiments, we mainly conduct experiments on the validation set for both system-level comparison and ablation study. \input{tables/data_aug} \paragraph{Implementation Details} In our experiments, two different data augmentation strategies are adopted: normal augmentation and strong augmentation. We summarize the details in Table~\ref{tab::data_aug}. Compared with normal augmentation, the strong augmentation includes greater spatial/geometric transformation. For updating the EMA model that predicts pseudo boxes, the momentum coefficient is set to 0.999. To examine the effectiveness of \textit{MixTraining}, we conduct experiments on various object detectors and backbone architectures. In practice, we find that \textit{MixTraining} can benefit from a longer training schedule, while the performance of other models may degrade due to over-fitting (we discussed in Sec.~\ref{sec:compared_to_sitraining}). For a fair comparison, we use multiple training schedules for each model and report its best performance in our experiments. For models using ResNet-50 backbone, we adopt the SGD (stochastic gradient descent) as the default optimizer, and for models using Swin-Small as the backbone, we adopt the AdamW~\cite{kingma2014adam} as the optimizer. Besides, all the backbone weights are pre-trained on ImageNet-1K dataset~\cite{deng2009imagenet}. All the models run on 32$\times$Nvidia V100. For other training settings and hyper-parameters for each detector, we following the default settings if not otherwise specified. \input{tables/system_level} \input{tables/different_iters} \subsection{Comparison to \textit{SiTraining}} \label{sec:compared_to_sitraining} \paragraph{\textit{MixTraining} Benefits from Longer Training} We found that \textit{MixTraining} can benefit from a longer training schedule due to the use of the mixed data augmentation. As shown in Figure~\ref{fig:overfitting_sitraining} and Table~\ref{tab::different_iters}, by extending the training iterations from 360k to 720k, \textit{MixTraining} can improve Faster R-CNN with ResNet-50 backbone from 42.4 mAP to 44.0 mAP. On the contrary, extending the training schedule of \textit{SiTraining} with normal data augmentation results in performance degradation because of over-fitting. Although using strong augmentation in \textit{SiTraining} can alleviate the over-fitting issue, its best performance is worse than that for normal data augmentation because of difficulty in training. To fairly compare different models, in all the following experiments, we report the best performance of different models by training the models under various training schedules. \input{figures/overfitting_sitraining} \paragraph{Comparison on Different Detectors} We also compare \textit{MixTraining} to \textit{SiTraining} using different detectors. The results are shown in Table~\ref{tab::system_full_coco}. When using Faster R-CNN to evaluate the two methods, \textit{MixTraining} outperforms \textit{SiTraining} by 2.3 points with the ResNet-50 backbone and by 1.6 points with the Swin-S backbone, which demonstrates that our method is compatible with different backbone architectures. We further conduct experiments on Cascade R-CNN to validate our method on a stronger detector, and consistent improvements are achieved, with \textit{MixTraining} outperforming \textit{SiTraining} by 1.9 points with the Swin-S backbone. \input{tables/ablation_component} \subsection{Ablation Study} \label{sec:ablation_study} In this section, we validate our design choices on Faster R-CNN with a ResNet-50 backbone. \paragraph{Effects of Different Components} We first study the effects of different components of \textit{MixTraining}. The results are shown in Table~\ref{tab::ablation_comp}. Compared to the model trained by \textit{SiTraining} with normally augmented images (41.7 mAP), adopting mixed data augmentation improves mAP by 0.8 points. Further integrating the mixed training targets improves the model by 1.5 points. \paragraph{Strategies for Mixing Targets} \input{tables/ablation_pseudo_boxes} We present three different strategies for combining the pseudo boxes and human-annotated ground-truth boxes, and the results of each are shown in Table~\ref{tab::ablation_pseudo_boxes}. Compared with the baseline model that uses only human-annotated ground-truth boxes during training, the strategy designed for dealing with the missing label issue brings notable improvements. In comparison, using the strategy that only deals with box localization noise only show a certain advantage. Furthermore, applying both strategies together (i.e. hybrid approach) leads to results that surpass either of the strategies alone. \input{figures/stat_mixed_training_targets} In addition, we examine how the number of predicted pseudo boxes and the number of pseudo boxes retained as missing labels changes in the training process. Figure~\ref{fig:stat_mixed_training_targets} shows the results. As training progresses, both of these quantities increase, indicating that the quality of pseudo boxes improves during training. In Figure~\ref{fig:pseudo_boxes}, some qualitative results of the generated pseudo boxes are displayed. \paragraph{Mixed Data Augmentation} \input{tables/ablation_mixed_aug_comp} The mixed data augmentation consists of two parts: the mixed data augmentation strategy, and the weighted training loss that includes strong augmentations only on easy training targets. We study the impact of these two parts, and the results are shown in Table~\ref{tab::ablation_mixed_aug_comp}. Compared with the baseline model learned through \textit{SiTraining} with normal data augmentation, simply applying the mixed data augmentation strategy improves the performance by 0.4 points, and further adopting the weighted loss to alleviate the training difficulty issue for strongly augmented images further improves the performance by 0.4 points. Figure~\ref{fig:ratio_easy_target} (left) illustrates how the proportion of easy training targets changes during training. In the early stage, only a small number of training targets are identified as easy targets, so strongly augmented images have little impact on training. As the training progresses, as increasing number of training targets are well fitted and identified as easy targets. At the end of training, more than $50\%$ of the training targets are identified as easy samples and used for strong augmentation. Figure~\ref{fig:ratio_easy_target} (middle) and (right) illustrate the proportion of objects of different sizes in easy targets and non-easy targets when the model completed the training. In easy target, the large objects is much more than small objects, while the conclusion is opposite in non-easy target. \input{figures/ratio_easy_target} \input{figures/pseudo_boxes} \input{tables/ablation_data_aug} Since our mixed data augmentation contains both normal augmentation and strong augmentation, we also compared to applying just one type of augmentation, and the results are shown in Table~\ref{tab::ablation_data_aug}. We found that simply adopting strong augmentation in \textit{SiTraining} does not improve performance. On the contrary, it hurts the training process, resulting in worse performance than using normal augmentation. Our mixed data augmentation strategy can alleviate the training difficulty of strong augmentation and improve the performance by 0.8 points. \section{Conclusion} In this work, we introduce a new training paradigm, MixTraining, for object detection that can improve the performance of existing detectors for free. Our method consists an enhanced data augmentation that combines different strengths of augmentation and excludes the strong augmentations of certain training targets to reduce training difficulty. In addition, a pseudo box mechanism is introduced to address label noise in human annotation. The experiments conducted on the COCO2017 benchmark verify the effectiveness of MixTraining across various detectors and backbones. \bibliographystyle{apalike}
{'timestamp': '2021-11-05T01:22:34', 'yymm': '2111', 'arxiv_id': '2111.03056', 'language': 'en', 'url': 'https://arxiv.org/abs/2111.03056'}
arxiv
\section{Introduction} Proteins \cite{creighton,lesk,bahar_jernigan_dill,berg} are powerful molecular machines. Small globular proteins fold into their native state structures rapidly and reproducibly and these folded forms determine their function. The folding of a globular protein is driven by hydrophobicity, the aversion of the protein backbone and some side chains to water. This causes a protein to expel the water from within its folded core thereby maximizing the self-interaction of the backbone. Furthermore, in order to enable diverse functions, one requires many distinct folded forms. This is elegantly enabled in proteins through their modular structures. The building blocks of protein structures predicted by Pauling and his collaborators \cite{pauling_helix,pauling_sheet} and confirmed resoundingly in experiments over the decades allow for literally thousands of ways in which $\alpha$-helices and almost planar $\beta$-sheets can be assembled to yield putative native state structures of globular proteins. Form determines function and these proteins interact with each other along with other cell constituents in an orchestrated manner to enable life. Our analysis begins with elementary mathematics. Symmetry dictates a tube as a minimalist model for our protein chain. The space-filling conformation of a discrete tube, whose axis is made up of $C^{\alpha}$ backbone atoms, is a helix with a specific pitch to radius ratio and a specific rotation angle. These two quantities along with the bond length uniquely determine all attributes of the space-filling helix including the tube radius. Remarkably, the geometries of both anti-parallel and parallel strand arrangements are predicted mathematically by considering space-filling arrangements of assemblies of zig-zag strand conformations (which are special two dimensional forms of a helix) of a tube of the same radius. The helix and the sheet, the modular building blocks of protein structures, are thus predicted by considerations of mathematics and physics. A zero parameter first principles prediction of the structures of these building blocks constitutes a re-derivation of Pauling’s classic results without invoking quantum chemistry, the planarity of the peptide bond, or the nature of the hydrogen bond. But how are these structures realized here on earth? This is where chemistry enters the picture. We present two significant results in our paper. The first is the near perfect accord between theory and experiment. The second is the beautiful fit of the rules of quantum chemistry to the requirements of mathematics and physics. We then go on to study the complementary roles of the fields of chemistry and biology in evolution, natural selection (the proteins are the molecular targets of natural selection), and protein structure and function. Our work here celebrates the marvelous accord between seemingly distinct and highly complementary approaches to protein science from the fields of mathematics, physics, chemistry, and biology. More importantly, we hope that our work will provide a new framework and a fresh unified perspective for understanding proteins. We alert the reader that our work is primarily concerned with the geometries of the building blocks and {\it not} their assembly into the tertiary protein structure. \section{Results and Discussion} \subsection{Mathematics and physics} A protein is a chain molecule which provides a natural context for its parts, an essential attribute of a machine. Thus we can distinguish between one $C^{\alpha}$ atom and another depending, not just on the identity of their side chain but, more generally, on their sequential location, say from the $N$-terminal end. From a geometrical point of view, it is not possible to model a protein with just a single sphere (Figure 1a). One instead would need an object that is spatially extended to capture the chain topology. A sphere is a region of space carved around a point, the sphere center. A simple mathematical generalization of a sphere, resulting in an extended object, is to replace the point by a line and carve out space within a distance $\Delta$ from the line. One then obtains a tube of radius (or thickness) $\Delta$ (Figure 1b). Helices are ubiquitous in bio-molecular structures. However, in every day life, we do not see helices often except in the context of tubes. An example is a garden hose, which is often wound into a helix. We will show below that a protein can indeed be usefully viewed as a flexible tube. It is natural to wonder whether, instead of a tube, one might equivalently consider a chain of spheres with a railway train topology. There are at least two reasons why this is not a satisfactory alternative. First, from a symmetry perspective, a sphere looks the same when viewed from any direction. It is isotropic. However a chain is necessarily anisotropic. This is because there is a special tangent direction at any given location along a chain. An anisotropic chain comprised of isotropic spheres results in a symmetry clash. A second reason for the inappropriateness of a chain of spheres model is that it becomes an infinitesimally thin line in the continuum limit, whereas a tube is characterized by a {\it non-zero thickness}. Indeed, one might imagine the tube shown in Figure 1b to be a chain of coins rather than a chain of spheres in the continuum limit. We use a bare-bones description of a protein and treat the axis of the protein-tube as a chain of equally spaced $C^{\alpha}$ atoms. The latter assumption is a good one because the measured bond length (over more than 4000 experimentally determined high resolution native state structures) is found to be ($3.81 \pm 0.02$)\r{A} \cite{local_sequence_structure}. The thickness of the tube can be thought of as being able to accommodate the other backbone atoms, which we do not explicitly consider in our coarse-grained approach. We will proceed by making a constructive hypothesis and assessing the consequences of this hypothesis. Our hypothesis follows from the recognition that the dominant folding mechanism of a protein is the hydrophobicity of its backbone along with the drive to maximize its self-interaction \cite{creighton,lesk,bahar_jernigan_dill,berg}, thereby attaining a space-filling folded state \cite{nature_tube}. Fortunately, for proteins, there is a wealth of experimental data accumulated over the decades, which serve to validate our hypothesis. The rest of this section is a hopefully more accessible summary of the results of recent mathematical calculations \cite{Rose_PRE}. Remarkably, the theoretical analysis has no further assumptions, no chemistry input, and no adjustable parameters, and allows us to determine the space-filling conformations of a tube with a discrete axis with fixed bond length. We predict three secondary structures: a tightly wound space-filling helix; zig-zag strands packed into almost planar sheets, in two distinct manners corresponding to parallel and anti-parallel sheets; and hexagonal packing of straight backbone conformations, akin to a compact assembly of pencils. We do not discuss the third secondary structure in the rest of this paper because the presence of side-chains, sticking out from the backbone, results in steric clashes thereby ruling out this structure \cite{ramachandran,rose_GNR,rose_side_chains}. The steric clashes are deftly averted in both the helix and in the planar sheet conformations. These two secondary structures are in fact observed in proteins and, quite remarkably, have the same quantitative geometry as the $\alpha$-helix and two kinds of $\beta$-sheets, all elegantly predicted by Pauling and co-workers some seven decades ago \cite{pauling_helix,pauling_sheet}. What follows from assembling these modular building blocks is a library of putative native state folds, each corresponding to a distinct topological assembly through tight turns. Figure 2 shows four sketches of a helix. The axis of a continuum helix (a helix, whose axis is continuous) (Figure 2a) necessarily spans all three dimensions and has just one character. The situation becomes more interesting, when the axis is discrete (as in a protein). There are now three distinct geometries that a helix can adopt: a generic helix rotation angle (Figure 2b) results in the $C^{\alpha}$ atoms spanning all three dimensions, as in Figure 2a; a helix rotation angle, $\varepsilon_0$, equal to $\pi$ (Figure 2c) leads to the helix axis becoming a two-dimensional zig-zag strand; and, finally, a rotation angle equal to $2\pi$ (Figure 2d) yields a one-dimensional straight line helical axis, which we will not consider further in our analysis as mentioned earlier. Let us consider a continuum tube (the axis of the tube is continuous) of radius $\Delta$ and ask what its space-filling conformation is. We know, from our experience with a garden hose, that if we bend it too tightly (with a local radius of curvature smaller than the tube radius), we get a kink in the tube. So a tightly wound tube would have a local radius of curvature exactly equal to $\Delta$. The self-interaction of the tube is maximized by placing successive turns of the helix on top of each other and alongside each other, while ensuring that there are no self-intersections (Figures 3a and 3c). When viewed from the top, there is no empty space in the middle of the helix (Figures 3b and 3d). The tight packing fills the space within the helix and thereby maximizes the self-interaction. Mathematics teaches us that the geometry of such a space-filling helix is characterized by a universal pitch to radius ratio, $P/R$, of $2.512 \dots$ \cite{nature_tube}. This is a very helpful result but it only tells us about a dimensionless characteristic of the space-filling helix. So how we do make a more tangible (in this case, with actual lengths) connection with real proteins? The intrinsic discrete nature of the protein backbone yields the two motifs, the helix and the strand. Furthermore, there is now the bond length of 3.81\r{A}, which will set our length scale. We take our space-filling continuum tube wound tightly with the magic dimensionless ratio $P/R=2.512\dots$ and discretize the axis with equally spaced $C^{\alpha}$ atoms. We then find mathematically \cite{Rose_PRE} that the largest rotation angle, $\varepsilon_0$, which ensures that the helix with the discrete axis remains space-filling, is approximately $99.8^{\circ}$ (Figure 4). (The procedure is very similar to that employed by Pauling and his colleagues \cite{pauling_helix,pauling_sheet}, who found the rotation angle allowing for the coherent placement of hydrogen bonds.) The bond length, the value of $P/R$, and the rotation angle completely specify ${\it all}$ characteristics of the space-filling helix. Notably, the tube radius is predicted to be $\Delta \sim 2.63$\r{A}. Armed with these results, we now proceed to an analysis of the second building block of protein structures, strands assembled into sheets. We consider a zig-zag strand, a discretized helical conformation of a tube of radius $\Delta$ (now known through the helix analysis to be $\sim 2.63$\r{A}) with $\varepsilon_0=\pi$. A straight tube axis can be drawn through a strand in two ways -- either through the blue points (we will denote this as a blue tube) or the red points (a red tube) (Figure 2c and Figure 5). A single strand is not space-filling by itself. In order to maximize self-interactions, we need to pack strands together while ensuring that the side chains do not clash sterically. There are two distinct ways of doing this packing: the first is a blue tube alongside a blue tube (or equivalently red next to red); and the second is a blue tube next to a red tube (or equivalently red next to blue). These two packings yield distinct geometries (Figure 5). A three dimensional packing of strands is forbidden because of side-chain clashes, but the two types of assembly into planar sheets are both sterically allowed. One can construct mathematical arguments that other plausible packings, such as two or three helices twisted together or a helix alongside a strand do not fill space as efficiently as the unique space filling helix and the two kinds of sheets assembled from zig-zag strands. Interestingly, a pair of helices of opposite chiralities pack better than those with the same chirality. However, this is not a factor in protein native state structures because, as is well known experimentally, there is chiral symmetry breaking in protein $\alpha$-helices due to the left-handed nature of the constituent amino acids. This is the essence of the theoretical analysis \cite{Rose_PRE} that enables a slew of zero-parameter predictions with the only inputs being the constructive hypothesis entailing the maximization of the self-interaction of the protein backbone along with setting the characteristic length scale through the bond length of $3.81$\r{A}. \subsection{Chemistry provides a good fit to the dictates of mathematics} Table 1 presents a comparison of our theoretical predictions with experimental data. For our analysis, we used 4416 structures (with complete information pertaining to all backbone atoms) from Richardsons’ Top 8000 set of high-resolution, quality-filtered protein chains (resolution $<$ 2\r{A}, 70\% PDB homology level) \cite{richardson_proteins2000_top8000}. The protein PDB codes are listed in the Supplementary Information of \v{S}krbi\'{c} et al. \cite{local_sequence_structure}. Hydrogen bonds were identified using DSSP \cite{DSSP} to extract 3595 helices, 8473 antiparallel pairs, and 4639 parallel pairs. Helices were defined to be $12$-residue segments with intra-helical hydrogen bonds ($N_iH \bullet\bullet\bullet O_{i-4}$ and $O_i\bullet\bullet\bullet HN_{i+4}$) at each residue. Antiparallel strand pairs were identified by three inter-pair hydrogen bonds at $(i,j)$, $(i+2,j-2)$, and $(i-2,j+2)$, $i \in $ strand 1, $j \in $ strand 2. To avoid possible end effects, only $(i,j)$ residue pairs were used. Parallel strand pairs were identified by four inter-pair hydrogen bonds between $(i,j-1)$, $(i,j+1)$, $(i+2,j+1)$, and $(i-2,j-1)$, $i \in $ strand 1, $j \in $ strand 2, and only the $i-th$ residue was considered. Table 1 shows the excellent accord between the mathematical predictions and experiments. Let us begin with the $\alpha$-helix. Our central predictions \cite{Rose_PRE} are the rotation angle of around $99.8^{\circ}$, the tube radius $\Delta$ of around $2.63$\r{A}, and the pitch to radius ratio of $2.512\dots$ It is straightforward using these predictions to deduce a host of other quantities pertaining to the space-filling helix including the bond angle $\theta \sim 91.8^{\circ}$ and the dihedral angle $\mu \sim 52.4^{\circ}$ (Figures 6c and 6d and Table 1). It is interesting to note that the experimental helix is slightly squished compared to the theoretical prediction. The experimental mean value of the dihedral angle, $\mu$, is about 5\% smaller than that predicted by theory, while the mean experimental distance between the $(i,i+3)$ $C^{\alpha}$ atoms is about 3\% less than that predicted by theory. (All these quantities nevertheless are equal to the predicted values within error estimates.) This helix squishing can be rationalized in two ways. Qualitatively, the atomic nature of the protein chain allows for space-filling to be accentuated by squeezing the helix more tightly. Quantitatively, this can arise because of the partial covalent bond character of a hydrogen bonded donor-acceptor pair allowing for a mutual distance a bit smaller than the sum of the van der Waals radii. The two triangles $(i-1,i,i+3)$ and $(i,i+3,i+4)$ are predicted to be congruent (Figure 6b). The sides $(i-1,i)$ and $(i+3,i+4)$ are both equal to the bond length. The side $(i,i+3)$ is common to both triangles. And the angles $(i-1,i,i+3)$ and $(i,i+3,i+4)$ are both equal to $90^{\circ}$. Theory predicts that the two triangles do not lie in a plane but rather that the planes of the triangles make an angle of approximately $215.5^{\circ}$ with each other in excellent accord with the experimental data of $(213.1 \pm 5.9)^{\circ}$. We now turn to the pairing of two strands. Unlike in a helix, the pairing of strands is necessarily non-local. As noted earlier, the chain topology of a protein naturally provides a context for the location of a $C^{\alpha}$ atom. There is a distinction between whether two paired strands are parallel to each other (meaning proceeding in the same direction) or are antiparallel to each other. As pointed out by Pauling, there are two distinct hydrogen bonding patterns for parallel and antiparallel sheets. The two distinct pairing patterns emerge from the simple tube picture as well without invoking any chemistry. The distances required by the tube constraints of being placed parallel and alongside each other (but with the correct choice of the tube axes) are very well satisfied experimentally (see Table 1). \subsection{Biology and chemistry} Our discussion so far has been limited to the backbone atoms, common to all proteins, and to the secondary structures that are the modular building blocks of protein folds \cite{levitt_chothia_1976,chothia_1992,teresa,taylor_nature_2002}. So what of the amino acids and their side-chains? Amino acid sequences play a major role in facilitating amazing functionalities \cite{creighton,lesk,bahar_jernigan_dill,berg}. To illustrate a concrete example, let us consider the enzymatic function of enhancing reaction rates. The rate enhancement often arises by a lowering of the free energy of the transition state of the reaction through specific binding of the enzyme to the substrate or the reactant(s). The native state fold of the enzyme (selected from the predetermined library) has an active site, where just a few amino acids are responsible for the catalytic activity. The binding to the substrate is of course highly specific. Proteases, which are responsible for the degradation of proteins through the hydrolysis of peptide bonds, undergo convergent evolution (e.g. the digestive enzyme chymotrypsin and subtilisin, an enzyme made by soil bacteria) using distinct native state folds from the pre-sculpted library but having the same catalytic triad due to sequence design. The catalytic triad in both cases comprise three amino acids, serine, histidine, and aspartate, bound to each other by hydrogen bonds, resulting in the proton being moved away from the serine along with the creation of a reactive alkoxide ion. Divergent evolution also occurs in proteins whose native state structure and the catalytic triad are the same, yet the nature of the binding site is not. A notable example is the family of proteins including chymotrypsin (which hydrolyses the peptide bonds on the carboxyl side of aromatic or large hydrophobic amino acids such as Trp, Tyr, Phe, Met, and Leu), trypsin (a digestive protein made in the pancreas which cleaves after positively charged amino acids lysine and arginine), elastase (made both in the pancreas and by white blood cells, which specifically targets elastin, a building block of blood vessel walls), thrombin (which cleaves proteins only at arginine-glycine linkages and helps curb bleeding by creating a blood clot), plasmin (an enzyme which cleaves proteins after lysine and arginine and dissolves blood clots), cocoonase (which also cleaves after lysine and arginine in the silk strands of the cocoon facilitating the emergence of the silk moth), and acrosin (which creates a hole in the protective sheath around the egg to allow sperm-egg contact). Key functional sites of proteins exhibit a high degree of conservation \cite{Ref_84_from_PRE_2004,konate_elife_2018} and coevolutionary analysis has been helpful in identifying protein-protein interactions \cite{Ref_85A_from_PRE_2004,Ref_85B_from_PRE_2004,Ref_86_from_PRE_2004,baker_pnas_2017}. In accord with our findings, experiments have shown that not only can the topology of the native state be preserved on significantly changing the amino acid sequence \cite{Ref_62A_from_PRE_2004,Ref_62B_from_PRE_2004,Ref_62C_from_PRE_2004,Ref_62D_from_PRE_2004,Ref_62E_from_PRE_2004,Ref_62F_from_PRE_2004,Ref_62G_from_PRE_2004,Ref_62H_from_PRE_2004,Ref_65A_from_PRE_2004,Ref_61A_from_PRE_2004,Ref_60_from_PRE_2004,Ref_61B_from_PRE_2004,Ref_65B_from_PRE_2004,Ref_45A_from_PRE_2004,Ref_45B_from_PRE_2004,Ref_62I_from_PRE_2004,Ref_46A_from_PRE_2004,Ref_46B_from_PRE_2004,Ref_65C_from_PRE_2004,Ref_62J_from_PRE_2004}, but also the rate of protein folding does not change appreciably. Indeed, there is evidence from experiments \cite{Ref_45A_from_PRE_2004,Ref_45B_from_PRE_2004,Ref_46A_from_PRE_2004,Ref_46B_from_PRE_2004,Ref_44_from_PRE_2004,Ref_47_from_PRE_2004} that the structures of the transition states do not change much for proteins with similar native state structures. Experiments have shown that many protein sequences can have the same native state conformation \cite{Ref_64A_from_PRE_2004,Ref_64B_from_PRE_2004,Ref_64C_from_PRE_2004,Ref_64D_from_PRE_2004}. Interestingly, the same fold (e.g. the TIM (Triose phosphate IsoMerase) barrel) can facilitate multiple distinct functionalities \cite{Ref_66_from_PRE_2004,Ref_87_from_PRE_2004,franklin_elife_2018}. Also, the protein structure prediction method of threading \cite{Ref_67_from_PRE_2004} relies on the notion that a given protein does not fashion its own native state fold but rather selects from a predetermined library of folds. Evolution, along with natural selection, allows nature to use variations on the same theme to perform myriad tasks in the living cell. Note that molecular evolution would not be able to work in this manner if protein structures changed continuously and were themselves subject to evolution. If protein structures were themselves to evolve and were also directly implicated in function, as we know they are, the structures of two interacting partners would have to co-evolve harmoniously so as not to disrupt function. Such an unlikely scenario would thwart evolution, as we know it. Our derivation of the building block geometries of protein structures from first principles provides proof that the menu of folds is in fact immutable. The mutation of a single amino acid at a time results in a random walk that forms a connected network in sequence space. However there is no similar continuous variation in structure space \cite{Ref_36_from_PRE_2004,Ref_79_from_PRE_2004}. \section{Conclusion} Here we have shown that, while mathematics alone is able to quantitatively predict the building blocks of protein structures, the results of chemistry and biology are remarkably consilient with the constraints placed by mathematics and physics. There have been many hints over the years that this might be true. More than eight decades ago, Bernal \cite{bernal} highlighted the common characteristics of all proteins. Some seventy years ago, Pauling \cite{pauling_helix,pauling_sheet}, the master of quantum chemistry, founded the field of molecular biology by predicting the geometries of the building blocks of protein structures using just the backbone atoms. Several years later, Ramachandran and his colleagues \cite{ramachandran} showed that the same building blocks were selected for by following quantum chemistry rules (without the need to invoke hydrogen bonds) while carefully avoiding steric clashes. As the number of protein sequences with known structure is growing enormously, the number of distinct protein folds is not. All this suggests that, even as Darwin's evolution is a major player in determining protein behavior, there is great simplicity in the protein problem, because Plato's ideas of the preeminence of geometry and symmetry are still very relevant when it comes to the library of putative native state folds. Sequences and even functionalities evolve in order to fit within the constraints of these geometric structures, which are determined by mathematics and physics and are Platonic and not subject to Darwinian evolution. One cannot but marvel at the interplay of sequence, structure, and function of proteins and celebrate the consilience of mathematics and the sciences in shaping the field of protein science. Understanding the fit between sequence and structure in a precise mathematical manner remains an outstanding challenge. We are delighted to dedicate this perspective to a dear friend Nitant Kenkre - an erudite scholar and a marvelous gentleman. We have all read his papers and one of us (JRB) has experienced the great pleasure of joyously interacting with Nitant. His knowledge of philosophy and mathematics and his humanity are inspiring. \section{Materials and Methods} The PDB codes of the proteins used for our analysis are presented as Supplementary Information in \v{S}krbi\'{c} et al. \cite{local_sequence_structure}.\\ \section*{Acknowledgements} We are indebted to George Rose for collaboration and inspiration. We are very grateful to Pete von Hippel for his warm hospitality and to him and Brian Matthews for stimulating conversations.\\ {\it Funding:} This project received funding from the European Union’s Horizon 2020 research and innovation program under the Marie Sk\l odowska-Curie Grant Agreement No 894784. The contents reflect only the authors’ view and not the views of the European Commission. Support from the University of Oregon (through a Knight Chair to JRB), International Centre of Physics at Institute of Physics, VAST under grant number ICP.2021.05 (TXH), University of Padova through ``Excellence Project 2018'' of the Cariparo foundation (AM), MIUR PRIN-COFIN2017 Soft Adaptive Networks grant 2017Z55KCW and COST action CA17139 (AG) is gratefully acknowledged. The computer calculations were performed on the Talapas cluster at the University of Oregon.\\ {\it Conflict of interest:} The authors declare that they have no conflict of interest.\\ {\it Author contributions:} JRB, AM, and T\v{S} conceived the ideas for the paper. T\v{S} carried out the calculations under the guidance of JRB. JRB wrote the paper. All authors participated in understanding the results and reviewing the manuscript.\\
{'timestamp': '2021-11-05T01:21:54', 'yymm': '2111', 'arxiv_id': '2111.03025', 'language': 'en', 'url': 'https://arxiv.org/abs/2111.03025'}
arxiv
\section{Introduction} Encryption is fundamentally important for information security over networks. For a vast range of situations, the amount of user's data far exceeds the amount of secrecy that is available to keep the users' data in complete secrecy. For such a situation, an often called one-way function is required to provide computation based security on top of any given amount of information-theoretic security. The conventional one-way functions are discrete, which in general require a secret key that is 100\% reliable. In this paper, we are interested in applications where a reliable secret key is either not available or insufficient but a limited amount of secrecy is available in some noisy form. One such application is when two separated nodes (Alice and Bob) in a network do not share a secret key but they have their respective estimates of a common physical feature vector (such as reciprocal channel state information). How to use the estimated feature vectors at Alice and Bob to protect a large amount of information transmitted between them is a physical layer encryption problem discussed in \cite{Hua2020a}-\cite{Hua2020b}. Another application is biometric template security for Internet applications \cite{Jain2008}-\cite{Patel2015} where network users just want to rely on their own biometric feature vectors for secure online transactions. The estimated (or measured) feature vectors are noisy. To exploit them for encryption, there are two basic approaches. The first is such that Alice and Bob attempt to generate a secret key from their noisy estimates. If successfully, this key can be then used to encrypt and decrypt a large amount of information based on a discrete encryption method. But due to noise in the estimated feature vectors, there is no guarantee that the key produced by Alice 100\% agrees with the key produced by Bob \cite{Lai2011}, \cite{Wallace2010} and \cite{Ye2010}. Any mismatched keys would generally fail a discrete encryption method. Note that an encrypted sequence is typically based on a pseudorandom sequence governed by a seed, i.e., a secret key, and a totally different pseudorandom sequence would be generated with any bit change in the seed. The second approach is what we call here continuous encryption. For physical layer encryption \cite{Hua2020a}-\cite{Hua2020b}, for example, a message to be sent by Alice can be encrypted by a continuous encryption function (CEF) based on Alice's estimate of a secret feature vector, and the message can be then recovered by Bob using the same CEF but based on Bob's estimate of the secret feature vector. The noises in the estimated feature vectors degrade Bob's recovery of the message but only in a soft or controllable way. This second approach is similar in a spirit to many of the methods for biometric template security \cite{Jain2008}-\cite{Patel2015}. The contributions of this paper focus on a development of continuous encryption functions (CEFs). We define a CEF as any function $\mathbf{y}=f(\mathbf{x})$ that maps an $N\times 1$ \emph{continuous} real-valued vector $\mathbf{x}$ onto another $M\times 1$ real-valued vector $\mathbf{y}$. But not all CEFs have the same quality for applications. We will only consider a CEF $\mathbf{y}=f(\mathbf{x})$ that allows $N$ and $M$ to be any positive integers and can be decomposed into $\mathbf{y}_i=f_i(\mathbf{x})$ with $\mathbf{y}_i$ being the $i$th subvector of $\mathbf{y}$. The index $i$ here may also represent the time when the CEF is used. If $\mathbf{y}$ is a continuous vector, we call $\mathbf{y}=f(\mathbf{x})$ a CEF of type A. If $\mathbf{y}$ is discrete, we call $\mathbf{y}=f(\mathbf{x})$ a CEF of type B. A quantization of the output of a type-A CEF converts it to a type-B CEF. We propose to measure the (primary) quality of a CEF $\mathbf{y}=f(\mathbf{x})$ by the following criteria: \begin{enumerate} \item (Hardness to invert) Can $\mathbf{x}$ be computed from $\mathbf{y}$ with a complexity order that is a polynomial function of the dimensions of $\mathbf{x}$ and $\mathbf{y}$? If yes, the function is said to be easy, or not hard, to invert. If no, the next question is important: \item (Hardness to substitute) Can $\mathbf{y}_i$ for some values of $i$ be written as $\mathbf{y}_i=f_{1,i}(\mathbf{s})$ where $f_{1,i}(\mathbf{s})$ is not a hard-to-invert function of $\mathbf{s}$ and $\mathbf{s}=f_2(\mathbf{x})$ is an $i$-independent function of $\mathbf{x}$ (and has a dimension no larger than a polynomial function of $N$)? If yes, the function $f(\mathbf{x})$ is said to be easy, or not hard, to substitute. We call $\mathbf{s}=f_2(\mathbf{x})$ a substitute input. \item (Noise sensitivity) If the CEF is hard to invert and hard to substitute, then it is important to know how sensitive statistically $\mathbf{y}$ is to a small perturbation/noise in $\mathbf{x}$. \end{enumerate} The family of CEFs includes all prior hard-to-invert or one-way continuous functions proposed in the literature. The hard to invert property is widely desired in applications. The hard to substitute property is also important for a similar reason. If an attacker is able to determine a substitute input from prior exposed $\mathbf{y}_i$, then all future $\mathbf{y}_i$ can be predicted by the attacker. It is clear that ``easy to invert'' implies ``easy to substitute'', but the reverse is not true in general. We say that a CEF is easy to attack if it is easy to invert \emph{or} easy to substitute, or equivalently a CEF is hard to attack if it is hard to invert \emph{and} hard to substitute. The noise sensitivity of a CEF is also important in applications. To have a small noise sensitivity, a CEF $\mathbf{y}=f(\mathbf{x})$ must be locally continuous with probability one subject to some continuous randomness of $\mathbf{x}$. More precisely, for a type-A CEF, we can measure its sensitivity by the square-rooted ratio of $\texttt{SNR}_\mathbf{x}$ over $\texttt{SNR}_\mathbf{y}$ where $\texttt{SNR}_\mathbf{x}$ and $\texttt{SNR}_\mathbf{y}$ are some signal-to-noise ratios (SNRs) of $\mathbf{x}$ and $\mathbf{y}$ respectively, e.g., see \eqref{eq:eta_k_x} later. For a type-B CEF, the sensitivity can be measured by the bit error rate (BER) in $\mathbf{y}$ caused by random perturbations in $\mathbf{x}$, which will be discussed in detail in section \ref{sec:comparison}. A best CEF must be hard to invert and hard to substitute and have the least noise sensitivity. It is important to note that for a given CEF, one can try to be successful to prove that the CEF is not hard to attack. But it seems impossible to \emph{prove} that a CEF is hard to attack. Such an open problem also applies to discrete one-way functions \cite{Levin2003}, \cite{KatzLindell2015}, \cite{wiki} even though their use in practice has been indispensable. We will say that a CEF is empirically hard to attack if we can provide strong empirical evidence. \subsection{Prior Works and Current Contributions} It appears that the prior CEFs all exploit (or can all exploit) any available secret key $S$ (as the seed) to produce pseudo-random numbers or operations needed in the functions. The best known method to invert such a CEF in general seems to have a complexity order equal to $C_{N,M}2^{N_S}$, where $N_S$ is the number of binary bits in the secret key, and $C_{N,M}$ is the (best known) complexity to invert the CEF if the secret key is exposed. Unless mentioned otherwise, we will refer to $C_{N,M}$ as the complexity of attack. The understanding of $C_{N,M}$ is important for situations where $N_S$ is not sufficiently large or simply zero. The random projection (RP) method in \cite{Teoh2007} and the dynamic random projection (DRP) method in \cite{Yang2010} are type-A CEFs before a quantization is applied at the last step of the functions. The Index-of-Maximum (IoM) hashing in \cite{Jin2018} is inherently a type-B CEF. The higher-order polynomials (HOP) in \cite{Grigoriev2012} are a type-A CEF. We will show that for the RP method, the DRP method and the IoM algorithm 1, $C_{N,M}=P_{N,M}$ with $P_{N,M}$ denoting a polynomial function of both $N$ and $M$. We will also show that for the IoM algorithm 2, $C_{N,M}=L_{N,M}2^N$ with $L_{N,M}$ being a linear function of $N$ and $M$ respectively. The HOP method is shown to be easy to substitute. Another major contribution of this paper is a new family of nonlinear CEFs called SVD-CEF. This family of CEFs is of type A and based on the use of components of singular value decomposition (SVD) of a randomly modulated matrix of $\mathbf{x}$. Based on the empirical evidences shown in this paper, the complexity order to attack a SVD-CEF is $C_{N,M}=P_{N,M}2^{\zeta N}$ where $\zeta>1$ is typically substantially larger than one and increases as $N$ increases. Furthermore, we will show that a quantized SVD-CEF also outperforms the IoM algorithm 2 in terms of noise sensitivity. Table \ref{Table_Comparison} provides a comparison of several CEFs discussed in this work, where ``No'' in the H.I. column is for ``not hard to invert'', ``Yes'' in the H.I. column is for ``empirically hard to invert'', ``Yes'' in the H.S. column is for ``empirically hard to substitute'', ``No'' in the H.S. column is for ``not hard to substitute'', and the column of ``Attack'' is the complexity of attack. The entry marked as ``-'' is no longer important due to a ``No'' in another column. \begin{table} \centering \caption{Comparison of CEFs.}\label{Table_Comparison} \begin{tabular}{|c|c|c|c|c|c|c|} \hline & Ref &Type & H.I. & H.S.& Attack \\ \hline RP & \cite{Teoh2007}&A & No & -& - \\ DRP & \cite{Yang2010}&A & No & -& - \\ URP & Here &A & No & -& - \\ HOP & \cite{Grigoriev2012} &A & - & No& - \\ IoM-1 & \cite{Jin2018} &B & No & -& - \\ IoM-2 & \cite{Jin2018}&B & Yes & Yes& $L_{N,M}2^N$ \\ SVD-CEF & Here&A & Yes & Yes& $P_{N,M}2^{\zeta N}$ \\ \hline \end{tabular} \end{table} \vspace {-2mm} \subsection{The Rest of the Paper} In section \ref{sec:linearCEF}, we review a linear family of CEFs, including RP and DRP. We will also discuss the usefulness of unitary random projection (URP), a useful transformation from the $N$-dimensional real space $\mathcal{R}^N$ to the $N$-dimensional sphere of unit radius $\mathcal{S}^N(1)$. In section \ref{sec:NonlinearPrior}, we review a family of nonlinear CEFs, including HOP and IoM. In section \ref{sec:New}, we present a new family of nonlinear CEFs called SVD-CEF, which is a new development from our prior works in \cite{Hua2020a}-\cite{Hua2020b}. In section \ref{sec:hard_to_invert}, we provide empirical details to explain why the SVD-CEF is hard to attack. In section \ref{sec:statistics}, we provide a statistical analyse of the SVD-CEF. In section \ref{sec:comparison}, we show a detailed comparison of the noise sensitivities of a quantized SVD-CEF and the IoM algorithm 2. The conclusion is given in section \ref{sec:conclusion}. \section{Linear Family of CEFs}\label{sec:linearCEF} A family of linear CEFs can be expressed as follows: \begin{equation}\label{} \mathbf{y}=\mathbf{R}_S\mathbf{x} \end{equation} where $\mathbf{R}_S$ is a $M\times N$ pseudo-random matrix dependent on a secret key $S$. Let the $i$th $M_i\times 1$ subvector of $\mathbf{y}$ be $\mathbf{y}_i$, and the $i$th $M_i\times N$ block matrix of $\mathbf{R}_S$ be $\mathbf{R}_{S,i}$. Then it follows that \begin{equation}\label{} \mathbf{y}_i=\mathbf{R}_{S,i}\mathbf{x} \end{equation} where $i=1,\cdots,I$ and $\sum_{i=1}^I M_i=M$. \subsection{Random Projection}\label{sec:RP} The linear family of CEFs includes the random projection (RP) method shown in \cite{Teoh2007} and applied in \cite{Pillai2011}. If $S$ is known, so is $\mathbf{R}_{S,i}$ for all $i$. If $\mathbf{y}_i$ for some $i$ is known/exposed and $\mathbf{R}_{S,i}$ is of the full column rank $N$, then $\mathbf{x}$ is given by $\mathbf{R}_{S,i}^+\mathbf{y}_i=(\mathbf{R}_{S,i}^T\mathbf{R}_{S,i})^{-1}\mathbf{R}_{S,i}^T \mathbf{y}_1$ where $^+$ denotes pseudo-inverse. If $\mathbf{R}_{S,i}$ is not of full column rank, then $\mathbf{x}$ can be computed from a set of outputs like (for example) $\mathbf{y}_1,\cdots,\mathbf{y}_L$ where $L$ is such that the vertical stack of $\mathbf{R}_{S,1},\cdots,\mathbf{R}_{S,L}$, denoted by $\mathbf{R}_{S,1:L}$, is of the full column rank $N$. If $S$ is unknown, then a method to compute $\mathbf{x}$ includes a discrete search for the $N_S$ bits of $S$ as follows \begin{equation}\label{} \min_S\min_{\mathbf{x}}\|\mathbf{y}_{1:L}-\mathbf{R}_{S,1:L}\mathbf{x}\|= \min_S\|\mathbf{y}_{1:L}-\mathbf{R}_{S,1:L}\mathbf{R}_{S,1:L}^+\mathbf{y}_{1:L}\| \end{equation} where $\mathbf{y}_{1:L}$ is the vertical stack of $\mathbf{y}_1,\cdots,\mathbf{y}_L$. The total complexity of the above attack algorithm with unknown key $S$ is $P_{N,M} 2^{N_S}$ with $P_{N,M}$ being a linear function of $\sum_{i=1}^LM_i$ and a cubic function of $N$. So, RP is not hard to attack (subject to a small $N_S$). \subsection{Dynamic Random Projection}\label{sec:DRP} The dynamic random projection (DRP) method proposed in \cite{Yang2010} and also discussed in \cite{Patel2015} can be described by \begin{equation}\label{eq:yiRsixx} \mathbf{y}_i=\mathbf{R}_{S,i,\mathbf{x}}\mathbf{x} \end{equation} where $\mathbf{R}_{S,i,\mathbf{x}}$ is the $i$th realization of a random matrix that depends on both $S$ and $\mathbf{x}$. Since $\mathbf{R}_{S,i,\mathbf{x}}$ is discrete, $\mathbf{y}_i$ in \eqref{eq:yiRsixx} is a \emph{locally} linear function of $\mathbf{x}$. (There is a nonzero probability that a small perturbation $\mathbf{w}$ in $\mathbf{x}'=\mathbf{x}+\mathbf{w}$ leads to $\mathbf{R}_{S,i,\mathbf{x}'}$ being substantially different from $\mathbf{R}_{S,i,\mathbf{x}}$. This is not a desirable outcome for biometric templates although the probability may be small.) Two methods were proposed in \cite{Yang2010} to construct $\mathbf{R}_{S,i,\mathbf{x}}$, which were called ``Functions I and II'' respectively. For simplicity of notation, we will now suppress $i$ and $S$ in \eqref{eq:yiRsixx} and write it as \begin{equation}\label{eq:yiRsixx2} \mathbf{y}=\mathbf{R}_{\mathbf{x}}\mathbf{x} \end{equation} \subsubsection{Assuming ``Function I'' in \cite{Yang2010}} In this case, the $i$th element of $\mathbf{y}$, denoted by $v_i$, corresponds to the $i$th slot shown in \cite{Yang2010} and can be written as \begin{equation}\label{} v_i=\mathbf{r}_{x,i}^T\mathbf{x} \end{equation} where $\mathbf{r}_{x,i}^T$ is the $i$th row of $\mathbf{R}_\mathbf{x}$. But $\mathbf{r}_{x,i}^T$ is one of $L$ key-dependent pseudo-random vectors $\mathbf{r}_{i,1}^T,\cdots,\mathbf{r}_{i,L}^T$ that are independent of $\mathbf{x}$ and known if $S$ is known. So we can also write \begin{equation}\label{} v_i=\mathbf{r}_i^T\mathbf{\bar x} \end{equation} where $\mathbf{r}_i^T=[\mathbf{r}_{i,1}^T,\cdots,\mathbf{r}_{i,L}^T]^T$, and $\mathbf{\bar x}\in \mathcal{R}^{LN}$ is a sparse vector consisting of zeros and $\mathbf{x}$. Before $\mathbf{x}$ is known, the position of $\mathbf{x}$ in $\mathbf{\bar x}$ is initially unknown. If an attacker has stolen $K$ realizations of $v_i$ (denoted by $v_{i,1},\cdots,v_{i,K}$), then it follows that \begin{equation}\label{} \mathbf{v}_i =\mathbf{R}_i\mathbf{\bar x} \end{equation} where $\mathbf{v}_i = [v_{i,1},\cdots,v_{i,K}]^T$, and $\mathbf{R}_i$ is the vertical stack of $K$ key-dependent random realizations of $\mathbf{r}_i^T$. With $K\geq LN$, $\mathbf{R}_i$ is of the full column rank $LN$ with probability one, and in this case the above equation (when given the key $S$) is linearly invertible with a complexity order equal to $\mathcal{O}((LN)^3)$. An even simpler method of attack is as follows. Since $v_{i,k}=\mathbf{r}_{i,k,l}^T\mathbf{x}$ where $l\in\{1,\cdots,L\}$ and $\mathbf{r}_{i,k,l}$ for all $i$, $k$ and $l$ are known, then we can compute \begin{align}\label{} l^*&=arg\min_{l\in\{1,\cdots,L\}}\min_{\mathbf{x}}\|\mathbf{v}_i-\mathbf{R}_{i,l}\mathbf{x}\|^2\notag\\ &= arg\min_{l\in\{1,\cdots,L\}}\|\mathbf{v}_i-\mathbf{R}_{i,l}\mathbf{R}_{i,l}^+\mathbf{v}_i\|^2 \end{align} where $\mathbf{R}_{i,l}$ is the vertical stack of $\mathbf{r}_{i,k,l}^T$ for $k=1,\cdots,K$. Provided $K\geq N$, $\mathbf{R}_{i,l}$ has the full column rank with probability one. In this case, the correct solution of $\mathbf{x}$ is given by $\mathbf{R}_{i,l^*}^+\mathbf{v}_i$. This method has a complexity order equal to $\mathcal{O}(LN^3)$. \subsubsection{Assuming ``Function II'' in \cite{Yang2010}} To attack ``Function II'' with known $S$, it is equivalent to consider the following signal model: \begin{equation}\label{} v_k = \sum_{n=1}^N r_{k,l_k,n} x_n \end{equation} where $v_k$ is available for $k=1,\cdots,K$, $r_{k,l,n}$ for $1\leq k \leq K$, $1\leq l \leq L$ and $1\leq n \leq N$ are random but known\footnote{``random but known'' means ``known'' strictly speaking despite a pseudo-randomness.} numbers (when given $S$), $x_n$ for all $n$ are unknown, and $l_k$ is a $k$-dependent random/unknown choice from $[1,\cdots,L]$. We can write \begin{equation}\label{} \mathbf{v}=\mathbf{R}\mathbf{x} \end{equation} where $\mathbf{v}$ is a stack of all $v_k$, $\mathbf{x}$ is a stack of all $x_n$, and $\mathbf{R}$ is a stack of all $r_{k,l_k,n}$ (i.e., $(\mathbf{R})_{k,n}=r_{k,l_k,n}$). In this case, $\mathbf{R}$ is a random and unknown choice from $L^K$ possible known matrices. An exhaustive search would require the $\mathcal{O}(L^K)$ complexity with $K\geq N+1$. Now we consider a different approach of attack. Since $r_{k,l,n}$ for all $k,l,n$ are known, we can compute \begin{equation}\label{} c_{n,n'}=\frac{1}{KL}\sum_{k=1}^K\sum_{l=1}^L\sum_{l'=1}^L r_{k,l,n}r_{k,l',n'} \end{equation} If $r_{k,l,n}$ are pseudo i.i.d. random (but known) numbers of zero mean and variance one, then for large $K$ (e.g., $K\gg L^2$) we have $c_{n,n'}\approx \delta_{n,n'}$. Also define \begin{equation}\label{} y_n = \frac{1}{K}\sum_{k=1}^K \sum_{l=1}^L v_k r_{k,l,n} = \sum_{n'=1}^N \hat c_{n,n'} x_{n'} \end{equation} where $n=1,\cdots,N$ and \begin{equation}\label{} \hat c_{n,n'} = \frac{1}{K}\sum_{k=1}^K \sum_{l=1}^L r_{k,l,n}r_{k,l_k,n'} . \end{equation} If $r_{k,l,n}$ are i.i.d. of zero mean and unit variance, then for large $K$ we have $\hat c_{n,n'}\approx c_{n,n'}\approx \delta_{n,n'}$ and hence \begin{equation}\label{} y_n \approx x_n. \end{equation} More generally, if we have $\hat c_{n,n'}\approx c_{n,n'}$ with a large $K$, then \begin{equation}\label{} \mathbf{y}\approx \mathbf{C}\mathbf{x} \end{equation} where $(\mathbf{y})_n=y_n$, and $(\mathbf{C})_{n,n'}=c_{n,n'}$. Hence, \begin{equation}\label{} \mathbf{x}\approx \mathbf{C}^{-1}\mathbf{y}. \end{equation} With an initial estimate $\mathbf{\hat x}$ of $\mathbf{x}$, we can then do the following to refine the estimate: \begin{enumerate} \item For each of $k=1,\cdots,K$, compute $l_k^*=arg \min_{l\in [1,\cdots,L]} |v_k-\sum_{n=1}^N r_{k,l,n} \hat x_n|$. \item Recall $\mathbf{v} = \mathbf{R}\mathbf{x}$. But now use $(\mathbf{R})_{k,n}=r_{k,l_k^*,n}$ for all $k$ and $n$, and replace $\mathbf{\hat x}$ by \begin{equation}\label{} \mathbf{\hat x}=(\mathbf{R}^T\mathbf{R})^{-1}\mathbf{R}^T\mathbf{v} \end{equation} \item Go to step 1 until convergence. \end{enumerate} Note that all entries in $\mathbf{R}$ are discrete. Once the correct $\mathbf{R}$ is found, the exact $\mathbf{x}$ is obtained. The above algorithm converges to either the exact $\mathbf{x}$ or a wrong $\mathbf{x}$. But with a sufficiently large $K$ with respect to a given pair of $N$ and $L$, our simulation shows that above attack algorithm yields the exact $\mathbf{x}$ with high probabilities. For example, for $N=8$, $L=8$ and $K=23L$, the successful rate is $99\%$. And for $N=16$, $L=48$ and $K=70L$, the successful rate is $98\%$. In the experiment, for each set of $N$, $L$ and $K$, 100 independent realizations of all elements in $\mathbf{x}$ and $\mathbf{R}$ were chosen from i.i.d. Gaussian distribution with zero mean and unit variance. The successful rate was based on the 100 realizations. In \cite{Yang2010}, an element-wise quantized version of $\mathbf{v}$ was further suggested to improve the hardness to invert. In this case, the vector potentially exposable to an attacker can be written as \begin{equation}\label{} \mathbf{\hat v}=\mathbf{R}\mathbf{x}+\mathbf{w} \end{equation} where $\mathbf{w}$ can be modelled as a white noise vector uncorrelated with $\mathbf{R}\mathbf{x}$. The above attack algorithm with $\mathbf{v}$ replaced by $\mathbf{\hat v}$ also applies although a larger $K$ is needed to achieve the same rate of successful attack. In all of the above cases, the computational complexity for a successful attack is a polynomial function $N$, $L$ and/or $K$ when the secret key $S$ is given. \subsection{Unitary Random Projection (URP)}\label{sec:URP} None of the RP and DRP methods is homomorphic. To have a homomorphic CEF whose input and output have the same distance measure, we can use \begin{equation}\label{} \mathbf{y}_k=\mathbf{R}_k\mathbf{x} \end{equation} where $\mathbf{R}_k\in \mathcal{R}^{N\times N}$ for each realization index $k$ is a pseudo-random unitary matrix governed by a secret key $S$. Clearly, if $\mathbf{y}_k'=\mathbf{R}_k\mathbf{x}'$, then $\|\mathbf{y}_k'-\mathbf{y}_k\|=\|\mathbf{x}_k'-\mathbf{x}_k\|$. Clearly, the sensitivity of URP equals one everywhere. If $\mathbf{R}_k$ is just a permutation matrix, then the distribution of the elements of $\mathbf{x}$ is the same as that of $\mathbf{y}_k$ for each $k$. To hide the distribution of the entries of $\mathbf{x}$ from $\mathbf{y}_k$ for any $k$, we can let $\mathbf{R}_k=\mathbf{P}_{k,2}\mathbf{Q}\mathbf{P}_{k,1}$ where $\mathbf{Q}$ is a fixed unitary matrix (such as the discrete Fourier transform matrix), and $\mathbf{P}_{k,1}$ and $\mathbf{P}_{k,2}$ are pseudo-random permutation matrices governed by the seed $S$. This projection makes the distribution of the elements of $\mathbf{y}_k$ differ from that of $\mathbf{x}$. For large $N$, the distribution of the elements of $\mathbf{y}_k$ approaches the Gaussian distribution for each typical $\mathbf{x}$. Conditioned on a fixed key $S$, if the entries in $\mathbf{x}$ are i.i.d. Gaussian with zero mean and variance $\sigma_x^2$, then the entries in each $\mathbf{y}_i$ are also i.i.d. Gaussian with zero mean and the variance $\sigma_x^2$. To further scramble the distribution of $\mathbf{y}_k$, we can add one or more layers of pseudo-random permutation and unitary transform, e.g., $\mathbf{R}_k=\mathbf{P}_{k,3}\mathbf{Q}\mathbf{P}_{k,2}\mathbf{Q}\mathbf{P}_{k,1}$. For unitary $\mathbf{R}_k$, we also have $\|\mathbf{y}_k\|=\|\mathbf{x}\|$, which means that $\|\mathbf{x}\|$ is not protected from $\mathbf{y}_k$. If $\|\mathbf{x}\|$ needs to be protected, we can apply the transformation shown next. \subsubsection{Transformation from $\mathcal{R}^N$ to $\mathcal{S}^N(1)$}\label{sec:transformation} We now introduce a transformation from the $N$-dimensional vector space $\mathcal{R}^N$ to the $N$-dimensional sphere of unit radius $\mathcal{S}^N(1)$. Let $\mathbf{x}\in \mathcal{R}^N$. Define \begin{equation}\label{} \mathbf{v}=\left [\begin{array}{c} \frac{1}{\|\mathbf{x}\|\sqrt{1+\|\mathbf{x}\|^2}}\mathbf{x} \\ \frac{\|\mathbf{x}\|}{\sqrt{1+\|\mathbf{x}\|^2}} \end{array} \right ] \end{equation} which clearly satisfies $\mathbf{v}\in\mathcal{S}^N(1)$. Then, we let \begin{equation}\label{} \mathbf{y}_k=\mathbf{R}_k\mathbf{v} \end{equation} where $\mathbf{R}_k$ is now a $(n+1)\times (n+1)$ unitary random matrix governed by a secret key $S$. Let $\mathbf{y}_k'=\mathbf{R}_k\mathbf{v}'$. It follows that $\|\mathbf{y}_k'-\mathbf{y}_k\|=\|\mathbf{v}'-\mathbf{v}\|$. But since $\mathbf{v}$ is now a nonlinear function of $\mathbf{x}$, the relationship between $\|\mathbf{v}'-\mathbf{v}\|$ and $\|\mathbf{x}'-\mathbf{x}\|$ is more complicated, which we discuss below. Let us consider $\mathbf{x}'=\mathbf{x}+\mathbf{w}$. One can verify that \begin{align}\label{} \|\mathbf{v}'-\mathbf{v}\|&=\left \|\left [ \begin{array}{c} \frac{\mathbf{x}+ \mathbf{w}}{\|\mathbf{x}+\mathbf{w}\|\sqrt{1+\|\mathbf{x}+\mathbf{w}\|^2}} \\ \frac{\|\mathbf{x}+\mathbf{w}\|}{\sqrt{1+\|\mathbf{x}+\mathbf{w}\|^2}} \end{array} \right ] - \left [ \begin{array}{c} \frac{\mathbf{x}}{\|\mathbf{x}\|\sqrt{1+\|\mathbf{x}\|^2}} \\ \frac{\|\mathbf{x}\|}{\sqrt{1+\|\mathbf{x}\|^2}} \end{array} \right ] \right \|\notag\\ &= \left \| \left [\begin{array}{c} \frac{\mathbf{a}}{b} \\ \frac{c}{d} \end{array} \right ]\right \| \end{align} where \begin{align}\label{} \mathbf{a}&=(\mathbf{x}+\mathbf{w})\cdot\|\mathbf{x}\|\cdot\sqrt{1+\|\mathbf{x}\|^2}\notag\\ &- \mathbf{x}\cdot\|\mathbf{x}+\mathbf{w}\|\cdot \sqrt{1+\|\mathbf{x}+\mathbf{w}\|^2} \end{align} \begin{equation}\label{} b=\|\mathbf{x}\|\cdot\sqrt{1+\|\mathbf{x}\|^2}\cdot\|\mathbf{x}+\mathbf{w}\|\cdot \sqrt{1+\|\mathbf{x}+\mathbf{w}\|^2} \end{equation} \begin{equation}\label{} c=\|\mathbf{x}+\mathbf{w}\|\cdot\sqrt{1+\|\mathbf{x}\|^2}-\|\mathbf{x}\|\cdot \sqrt{1+\|\mathbf{x}+\mathbf{w}\|^2} \end{equation} \begin{equation}\label{} d=\sqrt{1+\|\mathbf{x}\|^2}\|\cdot\sqrt{1+\|\mathbf{x}+\mathbf{w}\|^2}. \end{equation} To derive a simpler relationship between $\|\mathbf{v}'-\mathbf{v}\|$ and $\|\mathbf{x}'-\mathbf{x}\|=\|\mathbf{w}\|$, we will assume $\|\mathbf{w}\|\ll r\doteq \|\mathbf{x}\|$ and apply the first order approximations. Also we can write \begin{equation}\label{} \mathbf{w} = \eta_x\mathbf{w}_x+\eta_\perp\mathbf{w}_\perp \end{equation} where $\mathbf{w}_x$ is a unit-norm vector in the direction of $\mathbf{x} $, and $\mathbf{w}_\perp$ is a unit-norm vector orthogonal to $\mathbf{x}$. Then, \begin{equation}\label{} \|\mathbf{w}\|^2 = \eta_x^2 +\eta_\perp^2 \end{equation} \begin{equation}\label{} \mathbf{x}^T\mathbf{w} = \eta_x\|\mathbf{x}\|=\eta_x r. \end{equation} It follows that \begin{align}\label{} \|\mathbf{x}+\mathbf{w}\|&\approx \|\mathbf{x}\|\notag\\ &+\frac{1}{2\|\mathbf{x}\|}(\|\mathbf{w}\|^2 +2\mathbf{x}^T\mathbf{w})\notag\\ &=r+\frac{1}{2r}(\eta_x^2 +\eta_\perp^2+2r\eta_x)\notag\\ &\approx r+\frac{1}{2r}(\eta_\perp^2+2r\eta_x) \end{align} \begin{align}\label{} \sqrt{1+\|\mathbf{x}+\mathbf{w}\|^2}&\approx \sqrt{1+\|\mathbf{x}\|^2}\notag\\ &+\frac{1}{2\sqrt{1+\|\mathbf{x}\|^2}}(\|\mathbf{w}\|^2 +2\mathbf{x}^T\mathbf{w})\notag\\ &\approx\sqrt{1+r^2} +\frac{1}{2\sqrt{1+r^2}}(\eta_\perp^2+2r\eta_x). \end{align} Then, one can verify that \begin{equation}\label{} \mathbf{a} \approx \mathbf{w}r\sqrt{1+r^2}-\mathbf{x}\frac{1}{2}\left (\frac{r}{\sqrt{1+r^2}}+\frac{\sqrt{1+r^2}}{r}\right ) (\eta_\perp^2+2r\eta_x) \end{equation} and \begin{align}\label{} \|\mathbf{a}\|^2 &= r^2(1+r^2)(\eta_x^2+\eta_\perp^2)\notag\\ &+\frac{1}{4}r^2\left (\frac{r}{\sqrt{1+r^2}} +\frac{\sqrt{1+r^2}}{r}\right )^2(\eta_\perp^2+2r\eta_x)^2\notag\\ &-\eta_x r^2\sqrt{1+r^2}\left (\frac{r}{\sqrt{1+r^2}}+\frac{\sqrt{1+r^2}}{r}\right ) (\eta_\perp^2+2r\eta_x)\notag\\ &\approx r^2(1+r^2)(\eta_x^2+\eta_\perp^2)\notag\\ &+r^4\left (\frac{r}{\sqrt{1+r^2}}+\frac{\sqrt{1+r^2}}{r}\right )^2 \eta_x^2\notag\\ &-2r^3\sqrt{1+r^2}\left (\frac{r}{\sqrt{1+r^2}}+\frac{\sqrt{1+r^2}}{r}\right ) \eta_x^2\notag\\ &= r^2(1+r^2) \eta_\perp^2 +\frac{r^6}{1+r^2}\eta_x^2 \end{align} where the approximations hold because of $\eta_x\ll r$ and $\eta_\perp\ll r$. Similarly, we have \begin{equation}\label{} b^2\approx r^4(1+r^2)^2 \end{equation} \begin{equation}\label{} c^2\approx \left (\frac{1}{2r\sqrt{1+r^2}}(\eta_\perp^2+2r\eta_x)\right )^2\approx \frac{1}{(1+r^2)}\eta_x^2 \end{equation} \begin{equation}\label{} d^2 \approx (1+r^2)^2. \end{equation} Hence \begin{equation}\label{} \|\mathbf{v}'-\mathbf{v}\|^2 =\frac{\|\mathbf{a}\|^2}{b^2}+\frac{c^2}{d^2} \approx\frac{1}{r^2(1+r^2)} \eta_\perp^2 +\frac{r^2+1}{(1+r^2)^3}\eta_x^2. \end{equation} It is somewhat expected that the larger is $r$, the less are the sensitivities of $\|\mathbf{v}'-\mathbf{v}\|^2$ to $\eta_\perp$ and $\eta_x$. But the sensitivities of $\|\mathbf{v}'-\mathbf{v}\|^2$ to $\eta_\perp$ and $\eta_x$ are different in general, which also vary differently as $r$ varies. If $r\ll 1$, then \begin{equation}\label{} \|\mathbf{v}'-\mathbf{v}\|^2 \approx \frac{1}{r^2} \eta_\perp^2 +\eta_x^2 \end{equation} which shows a higher sensitivity of $\|\mathbf{v}'-\mathbf{v}\|^2$ to $\eta_\perp$ than to $\eta_x$. If $r\gg 1$, then \begin{equation}\label{eq:vvw} \|\mathbf{v}'-\mathbf{v}\|^2 \approx\frac{1}{r^4} \eta_\perp^2 +\frac{1}{r^4}\eta_x^2=\frac{1}{r^4}\|\mathbf{w}\|^2 \end{equation} which shows equal sensitivities of $\|\mathbf{v}'-\mathbf{v}\|^2$ to $\eta_\perp$ and $\eta_x$ respectively. The above results show how $\|\mathbf{v}'-\mathbf{v}\|^2$ changes with $\mathbf{w}=\eta_\perp \mathbf{w}_\perp +\eta_x \mathbf{w}_x$ subject to $\|\mathbf{w}\|\ll \|\mathbf{x}\|=r$ or equivalently $\sqrt{\eta_\perp^2+\eta_x^2}\ll r$. For larger $\|\mathbf{w}\|$, the relationship between $\|\mathbf{v}'-\mathbf{v}\|^2$ and $\|\mathbf{w}\|$ is not as simple. But one can verify that if $\|\mathbf{w}\|\gg r \gg 1$, then $\|\mathbf{v}'-\mathbf{v}\|\approx 1/r$. \section{Nonlinear Family of CEFs}\label{sec:NonlinearPrior} If the secret key $S$ available is not large enough, then we must consider CEFs that cannot be proven to be easy to attack even if $S$ is known. Such a CEF has to be nonlinear. \subsection{Higher-Order Polynomials} A family of higher-order polynomials (HOP) was suggested in \cite{Grigoriev2012} as a hard-to-invert continuous function. But we show next that HOP is not hard to substitute. Let $\mathbf{y}=[y_1,\cdots,y_M]^T$ and $\mathbf{x}=[x_1,\cdots,x_N]^T$ where $y_m$ is a HOP of $x_1,\cdots,x_N$ with pseudo-random coefficients. Namely, $y_m=f_m(x_1,\cdots,x_N)=\sum_{j=0}^J c_{m,j} x_1^{p_{1,j}}\cdots x_N^{p_{N,j}}$ where the coefficients $c_{m,j}$ are pseudo-random numbers governed by $S$. When $S$ is known, all the polynomials are known and yet $\mathbf{x}$ is still generally hard to obtain from $\mathbf{y}$ for any $M$ due to the nonlinearity. But we can write $y_m=g_m(\mathbf{v}(x_1,\cdots,x_N))$, where $g_m$ is a scalar linear function conditioned on $S$, and $\mathbf{v}(x_1,\cdots,x_N)$ is a $J\times 1$ vector nonlinear function unconditioned on $S$. This means that the HOP is not a hard-to-substitute function. \subsection{Index-of-Max Hashing} More recently a method called index-of-max (IoM) hashing was proposed in \cite{Jin2018} and applied in \cite{Kirchgasser2020}. There are algorithms 1 and 2 based on IoM, which will be referred to as IoM-1 and IoM-2. In IoM-1, the feature vector $\mathbf{x}\in \mathcal{R}^N$ is multiplied (from the left) by a sequence of $L\times N$ pseudo-random matrices $\mathbf{R}_1,\cdots,\mathbf{R}_{K_1}$ to produce $\mathbf{v}_1,\cdots,\mathbf{v}_{K_1}$ respectively. The index of the largest element in each $\mathbf{v}_k$ is used as an output $y_k$. With $\mathbf{y}=[y_1,\cdots,y_{K_1}]^T$, we see that $\mathbf{y}$ is a nonlinear (``piece-wise'' constant and ``piece-wise'' continuous) continuous function of $\mathbf{x}$. In IoM-2, $\mathbf{R}_1,\cdots,\mathbf{R}_{K_1}$ used in IoM-1 are replaced by $N\times N$ pseudo-random permutation matrices $\mathbf{P}_1,\cdots,\mathbf{P}_{K_1}$ to produce $\mathbf{v}_1,\cdots,\mathbf{v}_{K_1}$, and then a sequence of vectors $\mathbf{w}_1,\cdots,\mathbf{w}_{K_2}$ are produced in such a way that each $\mathbf{w}_k$ is the element-wise products of an exclusive set of $p$ vectors from $\mathbf{v}_1,\cdots,\mathbf{v}_{K_1}$. The index of the largest element in each $\mathbf{w}_k$ is used as an output $y_k$. With $\mathbf{y}=[y_1,\cdots,y_{K_2}]^T$, we see that $\mathbf{y}$ is another nonlinear continuous function of $\mathbf{x}$. Next we show that IoM-1 is not hard to invert if the secret key $S$ or equivalently the random matrices $\mathbf{R}_1,\cdots,\mathbf{R}_{K_1}$ are known. We also show that IoM-2 is not hard to invert up to the sign of each element in $\mathbf{x}$ if the secret key $S$ or equivalently the random permutations $\mathbf{R}_1,\cdots,\mathbf{R}_{K_1}$ are known. \subsubsection{Attack of IoM-1} Assume that each $\mathbf{R}_k$ has $L$ rows and the secret key $S$ is known. Then knowing $y_k$ for $k=1,\cdots,K_1$ means knowing $\mathbf{r}_{k,a,l}$ and $\mathbf{r}_{k,b,l}$ satisfying \begin{equation}\label{} \mathbf{r}_{k,a,l}^T\mathbf{x}>\mathbf{r}_{k,b,l}^T\mathbf{x} \end{equation} with $l=1,\cdots,L-1$ and $k=1,\cdots,K_1$. Here $\mathbf{r}_{k,a,l}^T$ and $\mathbf{r}_{k,b,l}^T$ for all $l$ are rows of $\mathbf{R}_k$. The above is equivalent to $ \mathbf{d}_{k,l}^T\mathbf{x}>0 $ with $\mathbf{d}_{k,l}=\mathbf{r}_{k,a,l}-\mathbf{r}_{k,b,l}$, or more simply \begin{equation}\label{eq:dkx} \mathbf{d}_k^T\mathbf{x}>0 \end{equation} where $\mathbf{d}_k$ is known for $k=1,\cdots,K$ with $K=K_1(L-1)$. Note that any scalar change to $\mathbf{x}$ does not affect the output $\mathbf{y}$. Also note that even though IoM-1 defines a nonlinear function from $\mathbf{x}$ to $\mathbf{y}$, the conditions in \eqref{eq:dkx} useful for attack are linear with respect to $\mathbf{x}$. To attack IoM-1, we can simply compute $\mathbf{\hat x}$ satisfying $\mathbf{d}_k^T\mathbf{\hat x}>0$ for all $k$. One such algorithm of attack is as follows: \begin{enumerate} \item Initialization/averaging: Let $\mathbf{\hat x}=\mathbf{\bar d}\doteq\frac{1}{K}\sum_{k=1}^K\mathbf{d}_k$. \item Refinement: Until $\mathbf{d}_k^T\mathbf{\hat x}>0$ for all $k$, choose $k^*=arg\min_k \mathbf{d}_k^T\mathbf{\hat x}$, and compute \begin{equation}\label{} \mathbf{\hat x}\leftarrow\mathbf{\hat x} -\eta (\mathbf{d}_{k^*}^T\mathbf{\hat x})\mathbf{d}_{k^*} \end{equation} where $\eta$ is a step size. \end{enumerate} Our simulation (using $\eta = \frac{1}{\|\mathbf{d}_{k^*}\|^2}$) shows that using the initialization alone can yield a good estimate of $\mathbf{x}$ as $K$ increases. More specifically, the normalized projection $\frac{\mathbf{\bar d}^T\mathbf{x}}{\|\mathbf{\bar d}\|\cdot\|\mathbf{x}\|}$ converges to one as $K$ increases. Our simulation also shows that the second step in the above algorithm improves the convergence slightly. Examples of the attack results are shown in Tables \ref{Table1} and \ref{Table2} where $L=N$. We see that IoM-1 (with its key $S$ exposed) can be inverted with a complexity order no larger than a linear function of $N$ and $K_1$ respectively. \begin{table} \centering \caption{Normalized projection of $\mathbf{x}$ onto its estimate using only averaging for attack of IoM-1}\label{Table1} \begin{tabular}{|c|c|c|c|c|} \hline & $K_1=8$ & 16 & 32 & 64 \\ \hline $N=8$ & 0.8546 & 0.9171 & 0.9562 & 0.9772 \\ 16 & 0.8022 & 0.8842 & 0.9365 &0.9666 \\ 32 & 0.7328 & 0.8351 & 0.906 & 0.9494 \\ \hline \end{tabular} \end{table} \begin{table} \centering \caption{Normalized projection of $\mathbf{x}$ onto its estimate after convergence of refinement for attack of IoM-1}\label{Table2} \begin{tabular}{|c|c|c|c|c|} \hline & $K_1=8$ & 16 & 32 & 64 \\ \hline $N=8$ & 0.8807 & 0.9467 & 0.9804 & 0.9937 \\ 16 & 0.8174 & 0.908 & 0.9612 &0.9861 \\ 32 & 0.739 & 0.8497 & 0.9268 & 0.9699 \\ \hline \end{tabular} \end{table} \subsubsection{Attack of IoM-2} To attack IoM-2, we need to know the sign of each element of $\mathbf{x}$, which is assumed below. Given the output of IoM-2 and all the permutation matrices $\mathbf{P}_1,\cdots,\mathbf{P}_{K_1}$, we know which of the elements in each $\mathbf{w}_k$ is the largest and which of these elements are negative. If the largest element in $\mathbf{w}_k$ is positive, we will ignore all the negative elements in $\mathbf{w}_k$. If the largest element in $\mathbf{w}_k$ is negative, we know which of the elements in $\mathbf{w}_k$ has the smallest absolute value. Let $|\mathbf{w}_k|$ be the vector consisting of the corresponding absolute values of the elements in $\mathbf{w}_k$. Also let $\log|\mathbf{w}_k|$ be the vector of element-wise logarithm of $|\mathbf{w}_k|$. It follows that \begin{equation}\label{} \log|\mathbf{w}_k|=\mathbf{T}_k\log|\mathbf{x}| \end{equation} where $\mathbf{T}_k$ is the sum of the permutation matrices used for $\mathbf{w}_k$. The knowledge of an output $y_k$ of IoM-2 implies the knowledge of $\mathbf{t}_{k,a,l}^T$ and $\mathbf{t}_{k,b,l}^T$ (i.e., row vectors of $\mathbf{T}_k$) such that either \begin{equation}\label{} \mathbf{t}_{k,a,l}^T\log|\mathbf{x}|>\mathbf{t}_{k,b,l}\log|\mathbf{x}| \end{equation} with $l=1,\cdots,L_k-1$ if $\mathbf{w}_k$ has $L_k\geq 2$ positive elements, or \begin{equation}\label{} \mathbf{t}_{k,a,l}^T\log|\mathbf{x}|<\mathbf{t}_{k,b,l}\log|\mathbf{x}| \end{equation} with $l=1,\cdots,N-1$ if $\mathbf{w}_k$ has no positive element. If $\mathbf{w}_k$ has only one positive element, the corresponding $y_k$ is ignored as it yields no useful constraint on $\log|\mathbf{x}|$. We assume that no element in $\mathbf{x}$ is zero. Equivalently, the knowledge of $y_k$ implies $ \mathbf{c}_{k,l}^T\log|\mathbf{x}|>0 $ where $\mathbf{c}_{k,l}=\mathbf{t}_{k,a,l}-\mathbf{t}_{k,b,l}$ for $l=1,\cdots,L_k-1$ if $\mathbf{w}_k$ has $L_k\geq 2$ positive elements, or $\mathbf{c}_{k,l}=-\mathbf{t}_{k,a,l}+\mathbf{t}_{k,b,l}$ for $l=1,\cdots,N-1$ if $\mathbf{w}_k$ has no positive element. A simpler form of the constraints on $\log|\mathbf{x}|$ is \begin{equation}\label{eq:ckx} \mathbf{c}_k^T\log|\mathbf{x}|>0 \end{equation} where $\mathbf{c}_k$ is known for $k=1,\cdots,K$ with $K=\sum_{k=1}^{K_2}(\bar L_k-1)$. Here $\bar L_k = L_k$ if $\mathbf{w}_k$ has a positive element, and $\bar L_k = N$ if $\mathbf{w}_k$ has no positive element. The algorithm to find $\log|\mathbf{x}|$ satisfying \eqref{eq:ckx} for all $k$ is similar to that for \eqref{eq:dkx}, which consists of ``initialization/averaging'' and ``refinement''. Knowing $\log|\mathbf{x}|$, we also know $|\mathbf{x}|$. Examples of the attack results are shown in Tables \ref{Table3} and \ref{Table4} where $p=N$ and all entries of $\mathbf{x}$ are assumed to be positive. The above analysis shows that IoM-2 effectively extracts out a binary (sign) secret from each element of $\mathbf{x}$ and utilizes that secret to construct its output. Other than that secret, IoM-2 is not a hard-to-invert function. In other words, IoM-2 can be inverted with a complexity order no larger than $L_{N,K_2}2^N$ where $L_{N,K_2}$ is a linear function of $N$ and $K_2$, respectively, and $2^N$ is to due to an exhaustive search of the sign of each element in $\mathbf{x}$. Note that if an additional key $S_x$ of $N$ bits is first extracted with 100\% reliability from the signs of the elements in $\mathbf{x}$, then a linear CEF could be used while maintaining an attack complexity order equal to $\mathcal{O}(N^3 2^N)$. \begin{table} \centering \caption{Normalized projection of $\mathbf{|x|}$ onto its estimate using only averaging for attack of IoM-2}\label{Table3} \begin{tabular}{|c|c|c|c|c|} \hline & $K_2=8$ & 16 & 32 & 64 \\ \hline $N=8$ & 0.9244 & 0.954 & 0.9698 & 0.9783 \\ 16 & 0.9068 & 0.9418 & 0.9603 &0.9694 \\ 32 & 0.8844 & 0.9206 & 0.9379 & 0.9466 \\ \hline \end{tabular} \end{table} \begin{table} \centering \caption{Normalized projection of $\mathbf{|x|}$ onto its estimate after convergence of refinement for attack of IoM-2}\label{Table4} \begin{tabular}{|c|c|c|c|c|} \hline & $K_2=8$ & 16 & 32 & 64 \\ \hline $N=8$ & 0.9432 & 0.9711 & 0.9802 & 0.9816 \\ 16 & 0.9182 & 0.9525 & 0.9649 &0.9653 \\ 32 & 0.8887 & 0.9258 & 0.9403 & 0.9432 \\ \hline \end{tabular} \end{table} \section{A New Family of Nonlinear CEFs}\label{sec:New} The previous discussions show that RP, DRP and IoM-1 are not hard to invert, and IoM-2 can be inverted with a complexity order no larger than $L_{N,K_2}2^N$. We show next a new family of nonlinear CEFs, for which the best known method to attack suffers a complexity order no less than $\mathcal{O}(2^{\zeta N})$ with $\zeta$ substantially larger than one. The new family of nonlinear CEFs is broadly defined as follows. Step 1: let $\mathbf{M}_{k,x}$ be a matrix (for index $k$) consisting of elements that result from a random modulation of the input vector $\mathbf{x}\in\mathcal{R}^N$. Step 2: Each element of the output vector $\mathbf{y}\in\mathcal{R}^M$ is constructed from a component of the singular value decomposition (SVD) of $\mathbf{M}_{k,x}$ for some $k$. Each of the two steps can have many possibilities. We will next focus on one specific CEF in this family (as this CEF seems the best among many choices we have considered). For each pair of $k$ and $l$, let $\mathbf{Q}_{k,l}$ be a (secret key dependent) random $N\times N$ unitary (real) matrix. Define \begin{equation}\label{eq:Mkx} \mathbf{M}_{k,x}=[\mathbf{Q}_{k,1}\mathbf{x},\cdots,\mathbf{Q}_{k,N}\mathbf{x}] \end{equation} where each column of $\mathbf{M}_{k,x}$ is a random rotation of $\mathbf{x}$. Let $\mathbf{u}_{k,x,1}$ be the principal left singular vector of $\mathbf{M}_{k,x}$, i.e., \begin{equation}\label{eq:typeA} \mathbf{u}_{k,x,1}=arg\max_{\mathbf{u},\|\mathbf{u}\|=1} \mathbf{u}^T\mathbf{M}_{k,x}\mathbf{M}_{k,x}^T\mathbf{u} \end{equation} Then for each $k$, choose $N_y<N$ elements in $\mathbf{u}_{k,x,1}$ to be $N_y$ elements in $\mathbf{y}$. For convenience, we will refer to the above function (from $\mathbf{x}$ to $\mathbf{y}$) as SVD-CEF. Note that there are efficient ways to perform the forward computation needed for \eqref{eq:typeA} given $\mathbf{M}_{k,x}\mathbf{M}_{k,x}^T$. One of them is the power method \cite{Golub}, which has the complexity equal to $\mathcal{O}(N^2)$. But the construction of $\mathbf{M}_{k,x}\mathbf{M}_{k,x}^T$ requires $\mathcal{O}(N^3)$ complexity. We can see that for each random realization of $\mathbf{Q}_{k,l}$ for all $k$ and $l$ and a random realization $\mathbf{x}_0$ of $\mathbf{x}$, with probability one there is a neighborhood around $\mathbf{x}_0$ within which $\mathbf{y}$ is a continuous function of $\mathbf{x}$. It is also clear that for any fixed $\mathbf{x}$ the elements in $\mathbf{y}$ appear random to anyone who does not have access to the secret key used to produce the pseudo-random $\mathbf{Q}_{k,l}$. In the next two sections, we will provide detailed analyses of the SVD-CEF. \section{Attack of the SVD-CEF}\label{sec:hard_to_invert} We now consider how to compute $\mathbf{x}\in \mathcal{R}^N$ from a given $\mathbf{y}\in \mathcal{R}^M$ with $M\geq N$ for the SVD-CEF based on \eqref{eq:Mkx} and \eqref{eq:typeA} assuming that $\mathbf{Q}_{k,l}$ for all $k$ and $l$ are also given. One method (a universal method) is via exhaustive search in the space of $\mathbf{x}$ until a desired $\mathbf{x}$ is found (which produces the known $\mathbf{y}$ via the forward function). This method has a complexity order (with respect to $N$) no less than $\mathcal{O}(2^{N_BN})$ with $N_B$ being the number of bits needed to represent each element in $\mathbf{x}$. The value of $N_B$ depends on noise level in $\mathbf{x}$. It is not uncommon in practice that $N_B$ ranges from 3 to 8 or even larger. The only other good method to invert the SVD-CEF seems the Newton's method, which is considered next. To prepare for the application of the Newton's method, we need to formulate a set of equations which must be satisfied by all unknown variables. \subsection{Preparation} We now assume that for each of $k=1,\cdots,K$, $N_y$ elements of $\mathbf{u}_{k,x,1}$ are used to construct $\mathbf{y}\in \mathcal{R}^M$ with $M=KN_y$. To find $\mathbf{x}$ from known $\mathbf{y}$ and known $\mathbf{Q}_{k,l}$ for all $k$ and $l$, we can solve the following eigenvalue-decomposition (EVD) equations: \begin{equation}\label{eq:MMyk} \mathbf{M}_{k,x}\mathbf{M}_{k,x}^T\mathbf{u}_{k,x,1}=\sigma_{k,x,1}^2\mathbf{u}_{k,x,1} \end{equation} with $k=1,\cdots,K$. Here $\sigma_{k,x,1}^2$ is the principal eigenvalue of $\mathbf{M}_{k,x}\mathbf{M}_{k,x}^T$. But this is not a conventional EVD problem because the vector $\mathbf{x}$ inside $\mathbf{M}_{k,x}$ is unknown along with $\sigma_{k,x,1}^2$ and $N-N_y$ elements in $\mathbf{u}_{k,x,1}$ for each $k$. We will refer to \eqref{eq:MMyk} as the EVD equilibrium conditions for $\mathbf{x}$. If the unknown $\mathbf{x}$ is multiplied by $\alpha$, so should be the corresponding unknowns $\sigma_{k,x,1}$ for all $k$ but $\mathbf{u}_{k,x,1}$ for any $k$ is not affected. So, we will only need to consider the solution satisfying $\|\mathbf{x}\|^2=1$. Note that if the norm of the original feature vector contains secret, we can first use the transformation shown in section \ref{sec:transformation}. The number of unknowns in the system of nonlinear equations \eqref{eq:MMyk} is $N_{unk,EVD,1}=N+(N-N_y)K+K$, which consists of all $N$ elements of $\mathbf{x}$, $N-N_y$ elements of $\mathbf{u}_{k,x,1}$ for each $k$ and $\sigma_{k,x,1}^2$ for all $k$. The number of the nonlinear equations is $N_{equ,EVD,1}=NK+K+1$, which consists of \eqref{eq:MMyk} for all $k$, $\|\mathbf{u}_{k,x,1}\|=1$ for all $k$ and $\|\mathbf{x}\|^2=1$. Then, the necessary condition for a finite set of solutions is $N_{equ,EVD,1}\geq N_{unk,EVD,1}$, or equivalently $N_yK\geq N-1$. If $N_y<N$, there are $N-N_y$ unknowns in $\mathbf{u}_{k,x,1}$ for each $k$ and hence the left side of \eqref{eq:MMyk} is a third-order function of unknowns. To reduce the nonlinearity, we can expand the space of unknowns as follows. Since $\mathbf{M}_{k,x}\mathbf{M}_{k,x}^T=\sum_{l=1}^N\mathbf{Q}_{k,l}\mathbf{X}\mathbf{Q}_{k,l}^T$ with $\mathbf{X}=\mathbf{x}\mathbf{x}^T$, we can treat $\mathbf{X}$ as a $N\times N$ symmetric unknown matrix (without the rank-1 constraint), and rewrite \eqref{eq:MMyk} as \begin{equation}\label{eq:QXKyk} (\sum_{l=1}^N\mathbf{Q}_{k,l}\mathbf{X}\mathbf{Q}_{k,l}^T)\mathbf{u}_{k,x,1} = \sigma_{k,x,1}^2\mathbf{u}_{k,x,1} \end{equation} with $Tr(\mathbf{X})=1$, $\|\mathbf{u}_{k,x,1}\|=1$ and $k=1,\cdots,K$. In this case, both sides of \eqref{eq:QXKyk} are of the 2nd order of all unknowns. But the number of unknowns is now $N_{unk,EVD,2}=\frac{1}{2}N(N+1)+(N-N_y)K+K>N_{unk,EVD,1}$ while the number of equations is not changed, i.e., $N_{equ,EVD,2}=N_{equ,EVD,1}=NK+K+1$. In this case, the necessary condition for a finite set of solution for $\mathbf{X}$ is $N_{equ,EVD,2}\geq N_{unk,EVD,2}$, or equivalently $N_yK\geq \frac{1}{2}N(N+1)-1$. Note that $\mathbf{X}$ seems the only useful substitute for $\mathbf{x}$. But this substitute still seems hard to compute from $\mathbf{y}$ as shown later. Alternatively, we know that $\mathbf{x}$ satisfies the following SVD equations: \begin{equation}\label{eq:MUV} \mathbf{M}_{k,x}\mathbf{V}_{k,x}=\mathbf{U}_{k,x}\boldsymbol{\Sigma}_{k,x} \end{equation} with $\mathbf{U}_{k,x}^T\mathbf{U}_{k,x}=\mathbf{I}_N$ and $\mathbf{V}_{k,x}^T\mathbf{V}_{k,x}=\mathbf{I}_N$. Here $\mathbf{U}_{k,x}$ is the matrix of all left singular vectors, $\mathbf{V}_{k,x}$ is the matrix of all right singular vectors, and $\boldsymbol{\Sigma}_{k,x}$ is the diagonal matrix of all singular values. The above equations are referred to as the SVD equilibrium conditions on $\mathbf{x}$. With $N_y$ elements of the first column of $\mathbf{U}_{k,x}$ for each $k$ to be known, the unknowns are the vector $\mathbf{x}$, $N^2-N_y$ elements in $\mathbf{U}_{k,x}$ for each $k$, all $N^2$ elements in $\mathbf{V}_{k,x}$ for each $k$, and all diagonal elements in $\boldsymbol{\Sigma}_{k,x}$ for each $k$. Then, the number of unknowns is now $N_{unk,SVD}=N+(N^2-N_y)K+N^2K+NK$, and the number of equations is $N_{equ,SVD}=N^2K+N(N+1)K+1$. In this case, $N_{equ,SVD}\geq N_{unk,SVD}$ iff $N_yK\geq N-1$. This is the same condition as that for EVD equilibrium. But the SVD equilibrium equations in \eqref{eq:MUV} are all of the second order. Note that for the EVD equilibrium, there is no coupling between different eigen-components. But for the SVD equilibrium, there are couplings among all singular-components. Hence the latter involves a much larger number of unknowns than the former. Specifically, $N_{unk,SVD}>N_{unk,EVD,2}>N_{unk,EVD,1}$. Every set of equations that $\mathbf{x}$ must fully satisfy (given $\mathbf{y}$) is a set of nonlinear equations, regardless of how the parameterization is chosen. This seems the fundamental reason why the SVD-CEF is hard to invert. SVD is a three-factor decomposition of a real-valued matrix, for which there are efficient ways for forward computations but no easy way for backward computation. If a two-factor decomposition of a real-valued matrix (such as QR decomposition) is used, the hard-to-invert property does not seem achievable. In Appendix \ref{sec:attack}, the details of an attack algorithm based on Newton's method are given. \subsection{Performance of Attack Algorithm}\label{sec:performance_of_attack} Since the conditions useful for attack of the SVD-CEF are always nonlinear, any attack algorithm with a random initialization $\mathbf{x}'$ can converge to the true vector $\mathbf{x}$ (or its equivalent which produces the same $\mathbf{y}$) only if $\mathbf{x}'$ is close enough to $\mathbf{x}$. To translate the local convergence into a computational complexity needed to successfully obtain $\mathbf{x}$ from $\mathbf{y}$, we now consider the following. Let $\mathbf{x}$ be an $N$-dimensional unit-norm vector of interest. Any unit-norm initialization of $\mathbf{x}$ can be written as \begin{equation}\label{eq:xxw} \mathbf{x}'=\pm \sqrt{1-r^2}\mathbf{x} + r\mathbf{w} \end{equation} where $0<r\leq 1$ and $\mathbf{w}$ is a unit-norm vector orthogonal to $\mathbf{x}$. For any $\mathbf{x}$, $r\mathbf{w}$ is a vector (or ``point'') on the sphere of dimension $N-2$ and radius $r$, denoted by $\mathcal{S}^{N-2}(r)$. The total area of $\mathcal{S}^{N-2}(r)$ is known to be $|\mathcal{S}^{N-2}(r)|= \frac{2\pi^{\frac{N-1}{2}}}{\Gamma(\frac{N-1}{2})}r^{N-2}$. Then the probability for a uniformly random $\mathbf{x}'$ from $\mathcal{S}^{N-1}(1)$ to fall onto $\mathcal{S}^{N-2}(r_0)$ orthogonal to $\sqrt{1-r_0^2}\mathbf{x}$ with $r\leq r_0\leq r+dr$ is $2\frac{|\mathcal{S}^{N-2}(r)|}{|\mathcal{S}^{N-1}(1)|}dr$ where the factor 2 accounts for $\pm$ in \eqref{eq:xxw}. Therefore, the probability of convergence from $\mathbf{x}'$ to $\mathbf{x}$ is \begin{align}\label{} P_{conv}&=\mathcal{E}_x\left \{ \int_0^1 2 P_{x,r}\frac{|\mathcal{S}^{N-2}(r)|}{|\mathcal{S}^{N-1}(1)|}dr\right \}\notag\\ &=\frac{2\Gamma \left (\frac{N}{2}\right )}{\sqrt{\pi}\Gamma \left (\frac{N-1}{2}\right )}\int_0^1P_r r^{N-2}dr \end{align} where $\mathcal{E}_x$ is the expectation over $\mathbf{x}$, $P_{x,r}$ is the probability of convergence from $\mathbf{x}'$ to $\mathbf{x}$ when $\mathbf{x}'$ is chosen randomly from $\mathcal{S}^{N-2}(r)$ orthogonal to a given $\sqrt{1-r^2}\mathbf{x}$, and $\mathcal{E}_x\{P_{x,r}\}=P_r$. We see that $P_r$ is the probability that the algorithm converges from $\mathbf{x}'$ to $\mathbf{x}$ (including its equivalent) subject to a fixed $r$, uniformly random unit-norm $\mathbf{x}$, and uniformly random unit-norm $\mathbf{w}$ satisfying $\mathbf{w}^T\mathbf{x}=0$. And $P_r$ can be estimated via simulation. If $P_r=0$ for $r\geq r_{max}$ (with $r_{max}<1$), then \begin{align}\label{} P_{conv}&=\frac{2\Gamma \left (\frac{N}{2}\right )}{\sqrt{\pi}\Gamma \left (\frac{N-1}{2}\right )}\int_0^{r_{max}}P_r r^{N-2}dr\notag\\ &<\frac{2\Gamma \left (\frac{N}{2}\right )}{(N-1)\sqrt{\pi}\Gamma \left (\frac{N-1}{2}\right )}r_{max}^{N-1}\notag\\ &<r_{max}^{N-1} \end{align} which converges to zero exponentially as $N$ increases. In other words, for such an algorithm to find $\mathbf{x}$ or its equivalent from random initializations has a complexity order equal to $\mathcal{O}(\frac{1}{P_{conv}})>\mathcal{O}((\frac{1}{r_{max}})^{N-1})$ which increases exponentially as $N$ increases. In our simulation, we have found that $r_{max}$ decreases rapidly as $N$ increases. Let $P_{r,N}$ be $P_r$ as function of $N$. Also let $P_{r,N}^*$ be the probability of convergence to $\mathbf{\hat x}$ which via the SVD-CEF not only yields the correct $y_k$ for $k=1,\cdots,K$ but also the correct $y_k$ for $k>K$ (up to maximum absolute element-wise error no larger than 0.02). Here $K$ is the number of output elements used to compute the input vector $\mathbf{x}$. In the simulation, we chose $N_y=1$ and $N_{equ,EVD,2}=N_{unk,EVD,2}+1$, which is equivalent to $K=\frac{1}{2}N(N+1)$. Shown in Table \ref{Table_Pr} are the percentage values of $P_{r,N}$ versus $r$ and $N$, which are based on 100 random choices of $\mathbf{x}$. For each choice of $\mathbf{x}$ and each value of $r$, we used one random initialization of $\mathbf{x}'$. (For $N=8$ and the values of $r$ in this table, it took two days on a PC with CPU 3.4 GHz Dual Core to complete the 100 runs.) \begin{table} \centering \caption{$P_{r,N}$ and $P_{r,N}^*$ in $\%$ versus $r$ and $N$}\label{Table_Pr} \begin{tabular}{ |c|c|c|c|c|c|c|c|c| } \hline $r$ & $0.001$ & $0.01$ & $0.1$ & $0.3$ & $0.5$ & $0.7$& $0.9$ & $1$\\ \hline $P_{r,4}$ & $46$ & $24$ & $6$ & $0$ & $1$ & $1$ & $1$& $0$ \\ \hline $P_{r,4}^*$ & $45$ & $17$ & $4$ & $0$ & $1$ & $0$ & $1$& $0$\\ \hline $P_{r,8}$ & $29$ & $7$ & $1$ & $0$ & $0$ & $0$ & $0$ & $0$\\ \hline $P_{r,8}^*$ & $25$ & $5$ & $0$ & $0$ & $0$ & $0$ & $0$ & $0$\\ \hline \end{tabular} \end{table} \section{Statistics of the SVD-CEF}\label{sec:statistics} In this section, we show a statistical study of the SVD-CEF, which shows how sensitive the SVD-CEF is in terms of its input perturbation versus its output perturbation. We will also show a weak correlation between its input and output, and a weak correlation between its outputs. These weak correlations are certainly desirable for a CEF. The statistics of the output $\mathbf{y}$ of the SVD-CEF is directly governed by the statistics of the principal eigenvector $\mathbf{u}_k\doteq\mathbf{u}_{k,x,1}$ of the matrix $\mathbf{M}_{k,x}\mathbf{M}_{k,x}^T$. So, we can next focus on the statistics of $\mathbf{u}_k$ versus $\mathbf{x}$. \subsection{Input-Output Distance Relationships} Unlike the random unitary projections, here the relationship between $\|\Delta \mathbf{x}\|$ and $\Delta \mathbf{u}_k$ is much more complicated. \subsubsection{Local Sensitivities}\label{sec:local} For local sensitivities, we consider the relationship between the differentials $\partial \mathbf{u}_{k,x,1}$ versus $\partial \mathbf{x}$. Since $\mathbf{u}_{k,x,1}$ is the principal eigenvector of $\mathbf{M}_{k,x}\mathbf{M}_{k,x}^T=\sum_{l=1}^N\mathbf{Q}_{k,l}\mathbf{x}\mathbf{x}^T\mathbf{Q}_{k,l}^T$, it is known \cite{Greenbaum2019} that \begin{equation}\label{} \partial\mathbf{u}_{k,x,1}=\sum_{j=2}^N\frac{1}{\lambda_1-\lambda_j}\mathbf{u}_{k,x,j} \mathbf{u}_{k,x,j}^T\partial(\mathbf{M}_{k,x}\mathbf{M}_{k,x}^T)\mathbf{u}_{k,x,1}. \end{equation} where $\lambda_j$ is the $j$th eigenvalue of $\mathbf{M}_{k,x}$ corresponding to the $j$th eigenvector $\mathbf{u}_{k,x,j}$. Here $\partial(\mathbf{M}_{k,x}\mathbf{M}_{k,x}^T)=\sum_l\mathbf{Q}_{k,l}\partial\mathbf{x}\mathbf{x}^T\mathbf{Q}_{k,l}^T +\sum_l\mathbf{Q}_{k,l}\mathbf{x}\partial\mathbf{x}^T\mathbf{Q}_{k,l}^T$. It follows that \begin{equation}\label{eq:yTx} \partial\mathbf{u}_{k,x,1}=\mathbf{T}\partial\mathbf{x} \end{equation} where $\mathbf{T}=\mathbf{A}+\mathbf{B}$ with \begin{equation}\label{} \mathbf{A} = \sum_{j=2}^N\frac{1}{\lambda_1-\lambda_j}\mathbf{u}_{k,x,j}\mathbf{u}_{k,x,j}^T \sum_{l=1}^N\mathbf{Q}_{k,l} \mathbf{x}^T \mathbf{Q}_{k,l}^T\mathbf{u}_{k,x,1} \end{equation} \begin{equation}\label{} \mathbf{B} = \sum_{j=2}^N \frac{1}{\lambda_1-\lambda_j}\mathbf{u}_{k,x,j}\mathbf{u}_{k,x,j}^T\sum_{l=1}^N \mathbf{Q}_{k,l}\mathbf{x}\mathbf{u}_{k,x,1}^T\mathbf{Q}_{k,l}. \end{equation} We can also write \begin{align}\label{} \mathbf{T} &= \left (\sum_{j=2}^N\frac{1}{\lambda_1-\lambda_j}\mathbf{u}_{k,x,j}\mathbf{u}_{k,x,j}^T\right ) \notag\\ &\cdot\left (\sum_{l=1}^N\mathbf{Q}_{k,l}\left [(\mathbf{x}^T \mathbf{Q}_{k,l}^T\mathbf{u}_{k,x,1})\mathbf{I}_N+\mathbf{x}\mathbf{u}_{k,x,1}^T\mathbf{Q}_{k,l} \right]\right ) \end{align} where the first matrix component has the rank $N-1$ and hence so does $\mathbf{T}$. Let $\partial\mathbf{x}=\mathbf{w}$ which consists of i.i.d. elements with zero mean and variance $\sigma_w^2\ll 1$. It then follows that \begin{equation}\label{} \mathcal{E}_w\{\|\partial \mathbf{u}_{k,x,1}\|^2\}=Tr\{\mathbf{T}\sigma_w^2\mathbf{T}^T\} =\sigma_w^2\sum_{j=1}^{N-1}\sigma_j^2 \end{equation} where $\sigma_j$ for $j=1,\cdots,N-1$ are the nonzero singular values of $\mathbf{T}$. Since $\mathcal{E}_w\{\|\partial\mathbf{x}\|^2\}=N\sigma_w^2$, we have \begin{equation}\label{eq:eta_k_x} \eta_{k,x}\doteq\sqrt{\frac{\mathcal{E}_w\{\|\partial \mathbf{u}_{k,x,1}\|^2\}}{\mathcal{E}_w\{\|\partial\mathbf{x}\|^2\}}}= \sqrt{\frac{1}{N}\sum_{j=1}^{N-1}\sigma_j^2} \end{equation} which measures a local sensitivity of $\mathbf{u}_k$ to a perturbation in $\mathbf{x}$. Since both $\mathbf{x}$ and $\mathbf{u}_k$ have the unit norm, we can view $1/\mathcal{E}_w\{\|\partial\mathbf{x}\|^2\}$ as SNR of $\mathbf{x}$ and $1/\mathcal{E}_w\{\|\partial \mathbf{u}_{k,x,1}\|^2\}$ as SNR of $\mathbf{u}_{k,x,1}$. For each given $\mathbf{x}$, there is a small percentage of realizations of $\{\mathbf{Q}_{k,l},l=1,\cdots,N\}$ that make $\eta_{k,x}$ relatively large. To reduce $\eta_{k,x}$, we can simply prune away such bad realizations. Shown in Fig. \ref{fig:etakx} are the means and means-plus-deviations of $\eta_{k,x}$ (over choices of $k$ and $\mathbf{x}$) versus $N$, with and without pruning respectively. Here ``std'' stands for standard deviation. We see that $5\%$ pruning (or equivalently $95\%$ inclusion shown in the figure) results in a substantial reduction of $\eta_{k,x}$. We used $1000\times1000$ realizations of $\mathbf{x}$ and $\{\mathbf{Q}_{k,l},l=1,\cdots,N\}$. \begin{figure}[h] \centering \centering \includegraphics[width=80mm]{FIG_4/V1_stat_test_2a.jpg} \caption{The mean and mean-plus-deviation of $\eta_{k,x}$ versus $N$.} \label{fig:etakx} \end{figure} Shown in Table \ref{T:eta} are some statistics of $\eta_{k,x}$ subject to $\eta_{k,x}<2.5$. And $P_{good}$ is the probability of $\eta_{k,x}<2.5$. \begin{table} \centering \caption{Statistics of $\eta_{k,x}$ subject to $\eta_{k,x}<2.5$ and $P_{good}$}\label{T:eta} \begin{tabular}{|c|c|c|c|} \hline $N$ & 16 & 32 & 64 \\ \hline Mean & 1.325 & 1.489 & 1.645 \\ \hline Std & 0.414 & 0.397 & 0.371 \\ \hline $P_{good}$ & 0.88 & 0.84 & 0.78 \\ \hline \end{tabular} \end{table} \subsubsection{Global relationships} Any unit-norm vector $\mathbf{x}'$ can be written as $\mathbf{x}'=\pm \sqrt{1-\alpha}\mathbf{x}+\sqrt{\alpha}\mathbf{w}$ where $0\leq \alpha \leq 1$, and $\mathbf{w}$ is of the unit norm and satisfies $\mathbf{w}^T\mathbf{x}=0$. Then $\|\Delta \mathbf{x}\|=\|\mathbf{x}'-\mathbf{x}\|=\sqrt{2-2\sqrt{1-\alpha}} $. It follows that $\|\Delta \mathbf{x}\| \leq \sqrt{2}$ and $\|\Delta\mathbf{u}_k\|\leq \sqrt{2}$. For given $\alpha$ in $\mathbf{x}'=\pm \sqrt{1-\alpha}\mathbf{x}+\sqrt{\alpha}\mathbf{w}$, $\|\Delta \mathbf{x}\|$ is given while $\|\Delta\mathbf{u}_k\|$ still depends on $\mathbf{w}$. Shown in Fig. \ref{T:du_over_dx} are the means and means-plus-deviations of $\frac{\|\Delta\mathbf{u}_k\|}{\|\Delta \mathbf{x}\|}$ versus $\|\Delta \mathbf{x}\|$ subject to $\eta_{k,x}<2.5$. This figure is based on $1000\times1000$ realizations of $\mathbf{x}$ and $\{\mathbf{Q}_{k,l},l=1,\cdots,N\}$ under the constraint $\eta_{k,x}<2.5$. \begin{figure}[h] \centering \includegraphics[width=80mm]{FIG_4/V2_stat_test_3a.jpg} \caption{The means (lower three curves) and means-plus-deviations (upper three curves) of $\frac{\|\Delta\mathbf{u}_k\|}{\|\Delta \mathbf{x}\|}$ subject to $\eta_{k,x}<2.5$.}\label{T:du_over_dx} \end{figure} \subsection{Correlation between Input and Output} \subsubsection{When there is a secret key} Recall $\mathbf{M}_{k,x}=[\mathbf{Q}_{k,1}\mathbf{x},\cdots,\mathbf{Q}_{k,N}\mathbf{x}]$. With a secret key, we can assume that $\mathbf{Q}_{k,l}$ for all $k$ and $l$ are uniformly random unitary matrices (from adversary's perspective). Then $\mathbf{u}_k$ for all $k$ and any $\mathbf{x}$ are uniformly random on $\mathcal{S}^{N-1}(1)$. It follows that $\mathcal{E}_Q\{\mathbf{u}_k\mathbf{u}_m^T\}=0$ for $k\neq m$, and $\mathcal{E}_Q\{\mathbf{u}_k\mathbf{x}^T\}=0$. Furthermore, it can be shown that $\mathcal{E}_Q\{\mathbf{u}_k\mathbf{u}_k^T\}=\frac{1}{N}\mathbf{I}_N$, i.e., the entries of $\mathbf{u}_k$ are uncorrelated with each other. Here $\mathcal{E}_Q$ denotes the expectation over the distributions of $\mathbf{Q}_{k,l}$. \subsubsection{When there is no secret key} In this case, $\mathbf{Q}_{k,l}$ for all $k$ and $l$ must be treated as known. But we consider typical (random but known) realizations of $\mathbf{Q}_{k,l}$ for all $k$ and $l$. To understand the correlation between $\mathbf{x}\in \mathcal{S}^{N-1}(1)$ and $\mathbf{u}_k\in \mathcal{S}^{N-1}(1)$ subject to a fixed (but typical) set of $\mathbf{Q}_{k,l}$, we consider the following measure: \begin{equation}\label{} \rho_k=N\max_{i,j}|[\mathcal{E}_x\{\mathbf{x}\mathbf{u}_k^T\}]_{i,j}| \end{equation} where $\mathcal{E}_x$ denotes the expectation over the distribution of $\mathbf{x}$. If $\mathbf{u}_k=\mathbf{x}$, then $\rho_k=1$. So, if the correlation between $\mathbf{x}$ and $\mathbf{u}_k$ is small, so should be $\rho_k$. For comparison, we define $\rho_k^*$ as $\rho_k$ with $\mathbf{u}_k$ replaced by a random unit-norm vector (independent of $\mathbf{x}$). For a different $k$, there is a different realization of $\mathbf{Q}_{k,1},\cdots,\mathbf{Q}_{k,N}$. Hence, $\rho_k$ changes with $k$. Shown in Fig. \ref{fig:correlation} are the mean and mean$\pm$deviation of $\rho_k$ and $\rho_k^*$ versus $N$ subject to $\eta_{k,x}<2.5$. We used $10000\times100$ realizations of $\mathbf{x}$ and $\{\mathbf{Q}_{k,1},\cdots,\mathbf{Q}_{k,N}\}$. We see that $\rho_k$ and $\rho_k^*$ have virtually the same mean and deviation. (Without the constraint $\eta_{k,x}<2.5$, $\rho_k$ and $\rho_k^*$ match even better with each other.) \begin{figure}[h] \centering \includegraphics[width=80mm]{FIG_4/V2_stat_test_1a.jpg} \caption{The means and means$\pm$deviations of $\rho_k$ (using SVD-CEF output) and $\rho_k^*$ (using random output) versus $N$ subject to $\eta_{k,x}<2.5$.} \label{fig:correlation} \end{figure} \subsection{Difference between Input and Output Distributions}\label{sec:entropy} We show next that $\mathbf{u}_k$ for all $k$ have a near-zero linear correlation among themselves, and each $\mathbf{u}_k$ is nearly uniformly distributed on $\mathcal{S}^{N-1}(1)$ when $\mathbf{x}$ is uniformly distributed on $\mathcal{S}^{N-1}(1)$. When $\mathbf{Q}_{k,1}$ for all $k$ and $l$ are independent random unitary matrices, we know that $\mathbf{u}_k$ and $\mathbf{u}_m$ for $k\neq m$ are independent of each other and $\mathcal{E}_Q(\mathbf{u}_k\mathbf{u}_m^T)=0$. Then for any typical realization of such $\mathbf{Q}_{k,1}$ for all $k$ and $l$, and for any $\mathbf{x}$, we should have $\frac{1}{K}\sum_{k=1}^K\mathbf{u}_k\mathbf{u}_{k+m}^T\approx 0$ for large $K$ and any $m\geq 1$, which means a near-zero linear correlation among $\mathbf{u}_k$ for all $k$. To show that the distribution of $\mathbf{u}_k$ for each $k$ is also nearly uniform on $\mathcal{S}^{N-1}(1)$, we need to show that for any $k$ and any unit-norm vector $\mathbf{v}$, the probability density function (PDF) $p_{k,v}(x)$ of $\mathbf{v}^T\mathbf{u}_k$ subject to a fixed set of $\mathbf{Q}_{k,l}$ for all $l$ and random $\mathbf{x}$ on $\mathcal{S}^{N-1}(1)$ is nearly the same as the PDF $p(x)$ of any element in $\mathbf{x}$. The expression of $p(x)$ is derived in \eqref{eq:px} in Appendix \ref{sec:PDF}. The distance between $p(x)$ and $p_{k,v}(x)$ can be measured by \begin{equation}\label{} D_{k,v}=\int p(x)\ln\frac{p(x)}{p_{k,v}(x)}dx\geq 0. \end{equation} Clearly, $D_{k,v}$ changes as $k$ and $\mathbf{v}$ change. Shown in Fig. \ref{fig:Dkv} are the mean and mean $\pm$ deviation of $D_{k,v}$ versus $N$ subject to $\eta_{k,x}<2.5$. We used $50\times1000\times 500$ realizations of $\mathbf{v}$, $\mathbf{x}$ and $\{\mathbf{Q}_{k,1},\cdots,\mathbf{Q}_{k,N}\}$. We see that $D_{k,v}$ becomes very small as $N$ increases. This means that for a large $N$, $\mathbf{u}_k$ is (at least approximately) uniformly distributed on $\mathcal{S}^{N-1}(1)$ when $\mathbf{x}$ is uniformly distributed on $\mathcal{S}^{N-1}(1)$. (Without the constraint $\eta_{k,x}<2.5$, $D_{k,v}$ versus $N$ has a similar pattern but is somewhat smaller.) \begin{figure}[h] \centering \includegraphics[width=80mm]{FIG_4/V2_stat_test_4b.jpg} \caption{The mean and mean$\pm$deviation of $D_{k,v}$ versus $N$ subject to $\eta_{k,x}<2.5$.} \label{fig:Dkv} \end{figure} \section{Comparison between SVD-CEF and IoM-2}\label{sec:comparison} As discussed earlier, the best known method to attack IoM-2 has the complexity $L_{N,M} 2^N$ with $L_{N,M}$ being a linear function of $M$ and $N$ respectively while the best known method to attack SVD-CEF has the complexity $P_{N,M} 2^{\zeta N}$ with $\zeta>1$ increasing with $N$ and $P_{N,M}$ being a polynomial function of $M$ and $N$. We see that SVD-CEF is much harder to attack than IoM-2 while none of the two could be shown to be easy to attack (assuming that all elements in $\mathbf{x}$ have independently random signs from the perspective of the attacker). The complexity of forward computation of IoM-2 is less than that of SVD-CEF. The former is $\mathcal{O}(N^2)$ per (integer) sample of the output while the latter is $\mathcal{O}(N^3)$ per (real-valued) sample of the output. To compare the noise sensitivities between SVD-CEF and IoM-2, we need to quantize the output of SVD-CEF as shown below since the output of IoM-2 is always discrete. \subsection{Quantization of SVD-CEF} Let the $k$th (real-valued) sample of the output of SVD-CEF at Alice due to the input vector $\mathbf{x}$ be $y_k$, and the $k$th sample of the output of SVD-CEF at Bob due to the input vector $\mathbf{x}'=\mathbf{x}+\mathbf{w}$ be $y_k'$. In the simulation, we will assume that the perturbation vector $\mathbf{w}$ is white Gaussian, i.e., $\mathcal{N}(0,\sigma^2\mathbf{I})$. As shown before, the PDF of $y_k$ can be approximated by \eqref{eq:px} in Appendix \ref{sec:PDF}, i.e., $f_{y_k}(y) = C_N (1-y^2)^{\frac{N-3}{2}}$ with $C_N=\frac{\Gamma(\frac{N}{2})}{\sqrt{\pi}\Gamma(\frac{N-1}{2})}$ and $-1<y<1$. To quantize $y_k$ into $n_y=\log_2N_y$ bits, Alice first over quantizes $y_k$ into $m_y=\log_2M_y$ bits with $M_y=N_yL_y$. Each of the $M_y$ quantization intervals within $(-1,1)$ is chosen to have the same probability $\frac{1}{M_y}$. For example, the left-side boundary value $t_i$ of the $i$th interval can be computed (offline) from $\int_{-1}^{t_i} f_{y_k}(y)dy = \frac{i}{M_y}$ with $i=0,1,\cdots,M_y-1$. A closed form of $\int(1-y^2)^{\frac{N-3}{2}}dy=\int \cos^{N-2}\theta d\theta $ with $y=\sin\theta$ is available for efficient bisection search of $t_i$. Specifically, $\int \cos^n \theta d\theta = \frac{\cos^{n-1}\theta \sin\theta}{n}+\frac{n-1}{n}\int \cos^{n-2}\theta d\theta$. The additional $l_y=\log_2L_y$ bits are used to assist the quantization of $y_k'$ at Bob. Specifically, if $y_k$ is quantized by Alice into an integer $0\leq i_k\leq M_y-1$, which has the standard binary form $b_1\cdots b_{n_y}b_{n_y+1}\cdots b_{m_y}$, then Alice keeps the first $n_y$ bits $b_1\cdots b_{n_y}$, corresponding to an integer $0\leq m_k\leq N_y-1$, and informs Bob of the last $l_y$ bits $b_{n_y+1}\cdots b_{m_y}$, corresponding to an integer $0\leq j_k\leq L_y-1$. Then the quantization of $y_k'$ by Bob is $m_k' = arg\min_{m=0,\cdots,N_y-1} |y_k' - j_k -mL_y|$. If $m_k$ differs from $m_k'$, it is very likely that $m_k'=m_k\pm 1$. So, Gray binary code should be used to represent the integers $m_k$ and $m_k'$ at Alice and Bob respectively. We will choose $N_y=N$ in simulation. So, each of $m_k$ and $m_k'$, corresponding to each pair of $y_k$ and $y_k'$ respectively, is represented by $\log_2 N$ bits. The above quantization scheme is related to those for secret key generation in \cite{Wallace2010} and \cite{Ye2010}. Here, we have a virtually unlimited amount of $y_k$ and $y_k'$ for $k\geq 1$, and a limited bit error rate after quantization is not a problem in practice such as for biometric based authentication (where ``Alice'' should be replaced by ``registration phase'' and ``Bob'' by ``validation phase''). \subsection{Comparison of Bit Error Rates} We can now compare the bit error rates (BERs) between the quantized SVD-CEF and the IoM-2. To generate the $k$th output (integer) sample of IoM-2, we consider that Alice applies $N$ random permutations to the $N\times 1$ feature vector $\mathbf{x}$ to produce $\mathbf{v}_{k,1},\cdots,\mathbf{v}_{k,N}$ respectively, and then computes the element-wise product of these vectors to produce $\mathbf{w}_k$. The index of the largest entry in $\mathbf{w}_k$ is now denoted by $0\leq m_k\leq N-1$. Bob conducts the same operations on $\mathbf{x}'=\mathbf{x}+\mathbf{w}$ to produces $0\leq m_k' \leq N-1$. We also apply Gray binary code here for IoM-2, which however has little effect on the performance. In Fig \ref{fig:Comparison}, we illustrate the BER performance of the quantized SVD-CEF and the IoM-2. We see that SVD-CEF consistently outperforms IoM-2. For IoM-2 and each pair of $N$ and $\sigma$, we used 1500 independent realizations of $\mathbf{x}$ according to $\mathcal{N}(0,\mathbf{I})$, and for each $\mathbf{x}$ we used an independent set of permutations and five independent realizations of $\mathbf{w}$. For SVD-CEF and each pair of $N$ and $\sigma$, we used 750 independent realizations of $\mathbf{x}$ according to $\mathcal{N}(0,\mathbf{I})$, and for each $\mathbf{x}$ we used an independent set of unitary matrices (required in $\mathbf{M}_{k,x}$ but subject to $\eta_{k,x}\leq 2.5$) and five independent realizations of $\mathbf{w}$. \begin{figure}[h] \centering \includegraphics[width=80mm]{FIG_4/CEF_VS_IoM_2c.jpg} \caption{Bit error rates of SVD-CEF and IoM-2.} \label{fig:Comparison} \end{figure} Finally, it is useful to note that SVD-CEF is of type A, which is more flexible than type B. If we reduce the number $N_y$ of quantized bits per output sample, the BER of SVD-CEF can be further reduced. For IoM-2, however, if we constrain the search among the first $L<N$ elements in $\mathbf{w}_k$, it only reduces the number of bits per output sample but does not improve the BER. \section{Conclusion}\label{sec:conclusion} In this paper, we have presented a development of continuous encryption functions (CEFs) that transcend the boundaries of wireless network science and biometric data science. The development of CEFs is critically important for physical layer encryption of wireless communications and biometric template security for online Internet applications. We defined the family of CEFs to include all prior continuous ``one-way'' functions, but also expanded the scope of fundamental measures for a CEF. We showed that the dynamic random projection method and the index-of-max hashing algorithm 1 (IoM-1) are not hard to invert, the index-of-max hashing algorithm 2 (IoM-2) is not as hard to invert as it was thought to be, and the higher-order polynomials are easy to substitute. We also introduced a new family of nonlinear CEFs called SVD-CEF, which is empirically shown to be hard to attack. A statistical analysis of the SVD-CEF was provided, which reveals useful properties. The SVD-CEF is also shown to be less sensitive to noise than the IoM-2.
{'timestamp': '2021-11-08T02:04:59', 'yymm': '2111', 'arxiv_id': '2111.03163', 'language': 'en', 'url': 'https://arxiv.org/abs/2111.03163'}
arxiv
\section{Additional Proofs} \begin{proofof}{lem:pctl:monotonicity} We simultaneously prove the whole statement by induction on the structure of the formulae $\phi$ and $\psi$. The cases $\phi=l$ and $\phi=\sf true$ result in trivial equalities. For the case $\phi=\lnot\phi'$ we need to prove \[ \sem{n}{\delta}{+1}{\lnot\phi'} \subseteq \sem{n}{\delta'}{+1}{\lnot\phi'} \qquad \sem{n}{\delta'}{-1}{\lnot\phi'} \subseteq \sem{n}{\delta}{-1}{\lnot\phi'} \qquad \sem{n}{\delta}{-1}{\lnot\phi'} \subseteq \sem{n}{\delta}{+1}{\lnot\phi'} \] which is equivalent to \[ \mathcal{Q}\setminus\sem{n}{\delta}{-1}{\phi'} \subseteq \mathcal{Q}\setminus\sem{n}{\delta'}{-1}{\phi'} \qquad \mathcal{Q}\setminus\sem{n}{\delta'}{+1}{\phi'} \subseteq \mathcal{Q}\setminus\sem{n}{\delta}{+1}{\phi'} \qquad \mathcal{Q}\setminus\sem{n}{\delta}{+1}{\phi'} \subseteq \mathcal{Q}\setminus\sem{n}{\delta}{-1}{\phi'} \] which, in turn, is equivalent to \[ \sem{n}{\delta'}{-1}{\phi'} \subseteq \sem{n}{\delta}{-1}{\phi'} \qquad \sem{n}{\delta}{+1}{\phi'} \subseteq \sem{n}{\delta'}{+1}{\phi'} \qquad \sem{n}{\delta}{-1}{\phi'} \subseteq \sem{n}{\delta}{+1}{\phi'} \] which is the induction hypothesis. \noindent For the case $\phi=\phi_1 \land \phi_2$ we need to prove \[ \sem{n}{\delta}{+1}{\phi_1\land\phi_2} \subseteq \sem{n}{\delta'}{+1}{\phi_1\land\phi_2} \qquad \sem{n}{\delta'}{-1}{\phi_1\land\phi_2} \subseteq \sem{n}{\delta}{-1}{\phi_1\land\phi_2} \qquad \sem{n}{\delta}{-1}{\phi_1\land\phi_2} \subseteq \sem{n}{\delta}{+1}{\phi_1\land\phi_2} \] which is equivalent to \[ \begin{array}{l} \sem{n}{\delta}{+1}{\phi_1} \cap \sem{n}{\delta}{+1}{\phi_2} \subseteq \sem{n}{\delta'}{+1}{\phi_1} \cap \sem{n}{\delta'}{+1}{\phi_2} \\ \sem{n}{\delta'}{-1}{\phi_1} \cap \sem{n}{\delta'}{-1}{\phi_2} \subseteq \sem{n}{\delta}{-1}{\phi_1} \cap \sem{n}{\delta}{-1}{\phi_2} \\ \sem{n}{\delta}{-1}{\phi_1} \cap \sem{n}{\delta}{-1}{\phi_2} \subseteq \sem{n}{\delta}{+1}{\phi_1} \cap \sem{n}{\delta}{+1}{\phi_2} \end{array} \] which immediately follows from the induction hypothesis on $\phi_1$ and $\phi_2$. For the case $\phi=\logPr{\rhd \pi}{\psi}$ we need to prove \[ \begin{array}{l} \sem{n}{\delta}{+1}{\logPr{\rhd \pi}{\psi}} \subseteq \sem{n}{\delta'}{+1}{\logPr{\rhd \pi}{\psi}} \\ \sem{n}{\delta'}{-1}{\logPr{\rhd \pi}{\psi}} \subseteq \sem{n}{\delta}{-1}{\logPr{\rhd \pi}{\psi}} \\ \sem{n}{\delta}{-1}{\logPr{\rhd \pi}{\psi}} \subseteq \sem{n}{\delta}{+1}{\logPr{\rhd \pi}{\psi}} \end{array} \] The first inclusion follows from \begin{align*} \sem{n}{\delta}{+1}{\logPr{\rhd \pi}{\psi}} & = \setcomp{q\in\mathcal{Q}}{ \Pr(\trStart{q} \cap \sem{k}{\delta}{+1}{\psi}) + \delta \rhd \pi } \\ & \subseteq \setcomp{q\in\mathcal{Q}}{ \Pr(\trStart{q} \cap \sem{k}{\delta'}{+1}{\psi}) + \delta' \rhd \pi } \\ & = \sem{n}{\delta'}{+1}{\logPr{\rhd \pi}{\psi}} \end{align*} where we exploited $\delta\leq\delta'$, the induction hypothesis $\sem{k}{\delta}{+1}{\psi} \subseteq \sem{k}{\delta'}{+1}{\psi}$, the monotonicity of $\Pr(-)$, and the fact that $\geq\circ\,\rhd \subseteq \rhd$. The second inclusion follows from an analogous argument: \begin{align*} \sem{n}{\delta'}{-1}{\logPr{\rhd \pi}{\psi}} & = \setcomp{q\in\mathcal{Q}}{ \Pr(\trStart{q} \cap \sem{k}{\delta'}{-1}{\psi}) - \delta' \rhd \pi } \\ & \subseteq \setcomp{q\in\mathcal{Q}}{ \Pr(\trStart{q} \cap \sem{k}{\delta}{-1}{\psi}) - \delta \rhd \pi } \\ & = \sem{n}{\delta}{-1}{\logPr{\rhd \pi}{\psi}} \end{align*} where we exploited $-\delta'\leq-\delta$, the induction hypothesis $\sem{k}{\delta'}{-1}{\psi} \subseteq \sem{k}{\delta}{-1}{\psi}$, the monotonicity of $\Pr(-)$, and the fact that $\geq\circ\,\rhd \subseteq \rhd$. For $\psi = {\sf X} \phi$, we can observe that $\sem{n}{\delta}{r}{{\sf X} \phi} = f(\sem{n}{\delta}{r}{\phi})$ where $f$ is a monotonic function mapping sets of states to sets of traces, which does not depend on $\delta,r$ (but only on $n$). Hence, the thesis follows from the set inclusions about the semantics of $\phi$ in the induction hypothesis. Similarly, for $\psi = \phi_1 {\sf U} \phi_2$, we can observe that $\sem{n}{\delta}{r}{\phi_1 {\sf U} \phi_2} = g(\sem{n}{\delta}{r}{\phi_1}, \sem{n}{\delta}{r}{\phi_2})$ where $g$ is a monotonic function mapping pairs of sets of states to sets of traces, which does not depend on $\delta,r$ (but only on $n$). Hence, the thesis follows from the set inclusions about the semantics of $\phi_1$ and $\phi_2$ in the induction hypothesis. \qed \end{proofof} \begin{proofof}{lem:sim:monotonicity} The statement follows by induction on $n-n'$ from the following properties: \begin{align} \label{eq:sim:monotonicity:1} & \delta \leq \delta' \;\land\; p \crysim{n}{\delta} q \implies p \crysim{n}{\delta'} q \\ \label{eq:sim:monotonicity:2} & p \crysim{n+1}{\delta} q \implies p \crysim{n}{\delta} q \end{align} To prove \eqref{eq:sim:monotonicity:1} we proceed by induction on $n$. % In the base case $n = 0$ the thesis trivially follows by the first case of~\Cref{def:param-bisim}. For the inductive case, we assume \eqref{eq:sim:monotonicity:1} holds for $n$, and prove it for $n+1$. % Therefore, we assume $p \crysim{n+1}{\delta} q$ and prove $p \crysim{n+1}{\delta'} q$. \Cref{def:param-bisim:a} of the thesis directly follows from the hypothesis. % For \Cref{def:param-bisim:b} of the thesis we have \[ \tsPr{p}{Q} \leq \tsPr{q}{\cryset{n}{\delta}{Q}} + \delta \leq \tsPr{q}{\cryset{n}{\delta'}{Q}} + \delta' \] where the first inequality follows from the hypothesis $p \crysim{n+1}{\delta} q$, while the second one follows from the induction hypothesis (which implies $\cryset{n}{\delta}{Q} \subseteq \cryset{n}{\delta'}{Q}$) and $\delta\leq\delta'$. % \Cref{def:param-bisim:c} is analogous. We now prove \eqref{eq:sim:monotonicity:2}, proceeding by induction on $n$. % In the base case $n=0$, the thesis trivially follows by the first case of~\Cref{def:param-bisim}. % For the inductive case, we assume the statement holds for $n$, and we prove it for $n+1$. % Therefore, we assume $p \crysim{n+2}{\delta} q$ and prove $p \crysim{n+1}{\delta} q$. \Cref{def:param-bisim:a} of the thesis directly follows from the hypothesis. % For \Cref{def:param-bisim:b} of the thesis we have \[ \tsPr{p}{Q} \leq \tsPr{q}{\cryset{n+1}{\delta}{Q}} + \delta \leq \tsPr{q}{\cryset{n}{\delta}{Q}} + \delta \] where the first inequality follows from the hypothesis $p \crysim{n+2}{\delta} q$, while the second one follows from the induction hypothesis (which implies $\cryset{n+1}{\delta}{Q} \subseteq \cryset{n}{\delta}{Q}$). % \Cref{def:param-bisim:c} is analogous. \qed \end{proofof} \begin{lemma}\label{lem:leq-eps-implies-leq} Let $a,b \in \mathbb{R}$. If $\forall \epsilon > 0: a \leq b + \epsilon$ then $a \leq b$. \end{lemma} \begin{proof} If $a>b$, taking $\epsilon=(a-b)/2$ contradicts the hypothesis. \qed \end{proof} \begin{proofof}{lem:traces} By \cref{lem:sim:monotonicity} we have that $\stateP \CSim{m}{d} \stateQ$. If $T$ is finite the thesis follows from \cref{lem:finite-traces}. If $T$ is infinite, it must be countable: this follows by the fact that Markov chains states are countable and the length of the traces in $T$ is finite. So, let $\tilde{t}_0 \tilde{t}_1 \hdots$ be an enumeration of $T$. By definition of infinite sum, we have that: \[ \prob{T}{} = \lim_{k \to \infty} {\sum_{i = 0}^k \prob{\tilde{t}_i}{}} \] By definition of limit of a sequence, we have that for all $\epsilon > 0$ there exists $v \in \mathbb{N}$ such that for all $k > v$: \[ \abs{\prob{T}{} - \sum_{i = 0}^k \prob{\tilde{t}_i}{}} < \epsilon \] Since $\prob{\tilde{t}_i}{} \geq 0$ for all $i$, we can drop the absolute value and we get: \begin{equation}\label{lem:traces:eq1} \prob{T}{} - \sum_{i = 0}^k \prob{\tilde{t}_i}{} < \epsilon \end{equation} By \cref{lem:leq-eps-implies-leq} it suffice to show $\prob{T}{} \leq \prob{\TR{m}{d,\stateQ}{T}}{} + dm + \epsilon$ for all $\epsilon > 0$, or equivalently: \[\prob{T}{} - \epsilon \leq \prob{\TR{m}{d,\stateQ}{T}}{} + dm \] So, let $\epsilon > 0$ and let $k$ be such that \cref{lem:traces:eq1} holds. Then we have that: \[ \prob{T}{} - \epsilon < \sum_{i = 0}^k \prob{\tilde{t}_i}{} \] Let $T' = \setcomp{\tilde{t}_i}{i \leq k}$. Since $\sum_{i = 0}^k \prob{\tilde{t}_i}{} = \prob{T'}{}$ and $T'$ is finite, by \cref{lem:finite-traces} we have that: \[ \sum_{i = 0}^k \prob{\tilde{t}_i}{} \leq \prob{\TR{m}{d,\stateQ}{T'}}{} + dm \] Since $\TR{m}{d,\stateQ}{T'} \subseteq \TR{m}{d,\stateQ}{T}$ we have that: \[ \prob{\TR{m}{d,\stateQ}{T'}}{} + dm \leq \prob{\TR{m}{d,\stateQ}{T}}{} + dm \] Summing up, we have that $\prob{T}{} - \epsilon \leq \prob{\TR{m}{d,\stateQ}{T}}{} + dm$ for all $\epsilon > 0$. By \cref{lem:leq-eps-implies-leq} it follows $\prob{T}{} \leq \prob{\TR{m}{d,\stateQ}{T}}{} + dm$ as required. \qed \end{proofof} \section{Related work and conclusions} The closest work to ours is that of D’Innocenzo, Abate and Katoen~\cite{DInnocenzo12hscc}, which addresses the model checking problem on relaxed PCTL. Their relaxed PCTL differs from ours in a few aspects. First, its syntax allows for an individual bound for each until operator ${\sf U}^{\leq k}$, while we assume all such bounds are equal. This difference does not seem to affect our results, which could be extended to cover the general case. Second, their main result shows that bisimilar states up-to a given error $\epsilon$ satisfy the same formulae $\psi$, provided that $\psi$ ranges over the so-called $\epsilon$-robust formulae. Instead, our soundness result applies to \emph{all} PCTL formulae, and ensures that when moving from a state satisfying $\phi$ to a bisimilar one, $\phi$ is still satisfied, but at the cost of slightly increasing the error. Third, their relaxed semantics differs from ours. In ours, we relax all the probability bounds by the same amount $\delta$. Instead, the relaxation in~\cite{DInnocenzo12hscc} affects the bounds by a different amount which depends on the error $\epsilon$, the until bound $k$, and the underlying DTMC. Desharnais, Lavioletta and Tracol~\cite{Desharnais08qest} use the standard, coinductive probabilistic bisimilarity, which is up-to an error $\delta$. Our bisimilarity notion introduces a further parameter, the number of steps $n$, and restricts the attention to the first $n$ steps, only. Another minor difference is that~\cite{Desharnais08qest} considers a labelled Markov process, i.e.\@\xspace the probabilistic variant of a labelled transition system, while we instead focus on DTMCs having labels on states. Further, \cite{Desharnais08qest} establishes the soundness and completeness of their bisimilarity for a Larsen-Skou logic~\cite{Larsen91iandc} instead of PCTL. Bian and Abate~\cite{Bian17fossacs} study bisimulation and trace equivalence up-to an error $\epsilon$, and show that $\epsilon$-bisimilar states are also $\epsilon’$-trace equivalent, for a suitable $\epsilon’$ which depends on $\epsilon$. Further, they show that $\epsilon$-trace equivalent states satisfy the same formulae in a bounded LTL, up-to a certain error. In our work, we focus instead on the branching logic PCTL. A related research line is that on \emph{bisimulation metrics}, which, like our up-to bisimilarity, take approximations into account~\cite{Desharnais99concur,Castiglioni16qapl}. Similarly to our bisimilarity, bisimulation metrics allow to establish two states equivalent up-to a certain error (but usually do not take into account the bound on the number of steps). Interestingly, Castiglioni, Gebler and Tini~\cite{Castiglioni16qapl} introduce a notion of distance between Larsen-Skou formulae, and prove that the bisimulation distance between two processes corresponds to the distance between their mimicking formulae. To the best of our knowledge, we are not aware of any works relating bisimulation metrics to PCTL. \section{Introduction} The behavior of many real-world systems can be formally modelled as probabilistic processes, e.g.\@\xspace as discrete-time Markov chains. Consequently, specifying and verifying properties on these systems requires probabilistic versions of temporal logics, such as PCTL~\cite{HanssonJonsson94}. PCTL allows to express probability bounds using the formula $\logPr{\geq \pi}{\psi}$, which is satisfied by those states starting from which the path formula $\psi$ holds with probability $\geq \pi$. A well-known issue is that real-world systems can have tiny deviations from their mathematical models, while logical properties, such as those written in PCTL, impose sharp constraints on the behavior. To address this issue, one can use a \emph{relaxed} semantics for PCTL, as in~\cite{DInnocenzo12hscc}. There, the semantics of formulae is parameterised over the error $\delta\geq 0$ one is willing to tolerate. Compared with the standard PCTL semantics of $\logPr{\geq \pi}{\psi}$ where the bound $\geq\pi$ is \emph{exact}, in relaxed PCTL this bound is weakened to $\geq\pi-\delta$. So, the relaxed semantics generalises the standard PCTL semantics of~\cite{HanssonJonsson94}, which can be obtained by choosing $\delta=0$. Instead, choosing an error $\delta > 0$ effectively provides a way to measure ``how much'' a state satisfies a given formula: some states might require only a very small error, while others a much larger one. When dealing with temporal logics such as PCTL, one often wants to study some notion of state equivalence which preserves the semantics of formulae: that is, when two states are equivalent, they satisfy the same formulae. For instance, probabilistic bisimilarities like those in~\cite{Desharnais10iandc,Desharnais02iandc,Larsen91iandc} preserve the semantics of formulae for PCTL and other temporal logics. However, when dealing with a \emph{relaxed} semantics of PCTL, one might also want to relax the notion of probabilistic bisimilarity, to account for the error $\delta$. Relaxing the bisimilarity relation puts one in front of a choice about which properties of the strict probabilistic bisimilarity one wants to keep. In particular, we note that the transitivity property, which is enjoyed by strict probabilistic bisimulation, is instead \emph{not} desirable for the relaxed notion. Indeed, we could have three states $q,q'$ and $q''$ where the behavior of $q$ and $q'$ is similar enough (within the error $\delta$), the behavior of $q'$ and $q''$ is also similar enough (within $\delta$), but the behavioral difference between $q$ and $q''$ is larger than the allowed error $\delta$. At best, we can have a kind of ``triangular inequality'', where $q$ and $q''$ can still be related but only with a larger error $2\cdot\delta$. Bisimilarity is usually defined by coinduction, essentially requiring that the relation is preserved along an arbitrarily long sequence of moves. Still, in some settings, bisimilarity could be too restrictive. For instance, consider a PCTL formula $\phi$ where all the until operators are \emph{bounded}, as in $\phi_1 {\sf U}^{\leq k} \phi_2$. Assume that we desire a relation on states that preserves $\phi$. While we could use bisimilarity for such a purpose, we do not really need to consider the behavior after a certain amount of steps, which only depends on $\phi$. Instead of using bisimilarity, here we might instead resort to a behavioral relation that only observes the first $n$ steps, where $n$ is a parameter of the relation. Unlike bisimilarity, such a relation is naturally defined by \emph{induction} on $n$. We call this looser variant of bisimilarity an \emph{up-to-$n,\delta$} bisimilarity. Further, when studying the security of systems modelling cryptographic protocols, we would like to consider as morally equivalent two states when their behavior is similar (up to some error $\delta$) in the short run, and significantly diverges only in the long run. For instance, a state $q$ could represent an ideal system where no attacks can be performed by construction, while another state $q'$ could represent a real system where an adversary can try to disrupt the cryptographic protocol. In such a scenario, if the protocol is secure, we would like to have $q$ and $q'$ equivalent, since the behavior of the real system is close to the one of the ideal system. However, this would not be possible using a (coinductive) bisimilarity notion, since in the real system an adversary can repeatedly try to guess the secret cryptographic keys, and break security in the very long run, with very high probability. For this reason, standard cryptographic security definitions require that the behavior of the ideal and real system are within a small error, but only for a \emph{bounded} number of steps, after which their behavior could diverge. To account for these scenarios, in this paper we use a bounded, approximate notion of bisimilarity, inspired by~\cite{Desharnais08qest}. We showcase up-to-$n,\delta$ bisimilarity on a running example (\Cref{ex:pctl:padlock,ex:sim:padlock,ex:results:padlock}), comparing an ideal combination padlock against a real one which can be opened by an adversary guessing its combination. We show the two systems bisimilar, and discuss how they satisfy a basic security property expressed in PCTL, with suitable errors. Our main contribution is a soundness theorem establishing that, when a state $q$ satisfies a PCTL formula $\phi$ (up to a given error), any bisimilar state $q' \crysim{}{} q$ must also satisfy $\phi$, at the cost of a slight increase of the error. More precisely, if formula $\phi$ only involves until operators bounded by $\leqn$, state $q$ satisfies $\phi$ up to some error, and bisimilarity holds for enough steps and error $\delta$, then $q'$ satisfies $\phi$ with an \emph{additional} asymptotic error $O(n\cdot\delta)$. This asymptotic behavior is compatible with the usual assumptions of computational security in cryptography. There, models of security protocols include a security parameter $\eta$, which affects the length of the cryptographic keys and the running time of the protocol: more precisely, a protocol is assumed to run for $n(\eta)$ steps, which is polynomially bounded w.r.t.\@\xspace $\eta$. As already mentioned above, cryptographic notions of security do not observe the behavior of the systems after this bound $n(\eta)$, since in the long run an adversary can surely guess the secret keys by brute force. Coherently, a protocol is considered to be secure if (roughly) its actual behavior is \emph{approximately} equivalent to the ideal one for $n(\eta)$ steps and up to an error $\delta(\eta)$, which has to be a negligible function, asymptotically approaching zero faster than any rational function. Under these bounds on $n$ and $\delta$, the asymptotic error $O(n\cdot\delta)$ in our soundness theorem is negligible in $\eta$. Consequently, if two states $q$ and $q'$ represent the ideal and actual behavior, respectively, and they are bisimilar up to a negligible error, they will satisfy the same PCTL formulae with a negligible error. We provide a detailed overview of the proof of our soundness theorem, explaining the techniques that we used. Then, we also present the actual formal proof. Due to space limitations, we relegated to the appendix some parts of it. Remarkably, our proof exploits an apparently unrelated result from graph theory, namely the min-cut/max-flow theorem. \section{Appendix} \input{app.tex} \end{document} \section{PCTL} Assume a set $\mathcal{L}$ of labels, ranged over by $l$, and let $\delta,\pi$ range over non-negative reals. A \emph{discrete-time Markov chain} (DTMC) is a standard model of probabilistic systems. Throughout this paper, we consider a DTMC having a countable, possibly infinite, set of states $q$, each carrying a subset of labels $\lab(q) \subseteq \mathcal{L}$. \begin{definition}[Discrete-Time Markov Chain] \label{def:pctl:dtmc} A (labelled) DTMC is a triple $(\mathcal{Q}, \Pr, \lab)$ where: \begin{itemize} \item $\mathcal{Q}$ is a countable set of states; \item $\Pr : \mathcal{Q}^2 \to [0,1]$ is a function, named transition probability function; \item $\lab : \mathcal{Q} \to \mathcal{P}(\mathcal{L})$ is a labelling function \end{itemize} Given $q \in \mathcal{Q}$ and $Q \subseteq \mathcal{Q}$, we write $\tsPr{q}{Q}$ for $\sum_{q'\in\mathcal{Q}} \tsPr{q}{q'}$ and we require that $\tsPr{q}{\mathcal{Q}}=1$ for all $q\in\mathcal{Q}$. \end{definition} A \emph{trace} is an infinite sequence of states $t = q_0q_1\cdots$, where we write $t(i)$ for $q_i$, i.e.\@\xspace the $i$-th element of $t$. A \emph{trace fragment} is a finite, non-empty sequence of states $\tilde{t} = q_0 \cdots q_{n-1}$, where $\card{\tilde{t}}= n\geq 1$ is its length. Given a trace fragment $\tilde{t}$ and a state $q$, we write $\finTraceTq^\omega$ for the trace $\finTraceTq\stateQq\cdots$. It is well-known that, given an initial state $q_0$, the DTMC induces a $\sigma$-algebra of measurable sets of traces $T$ starting from $q_0$, i.e.\@\xspace~the $\sigma$-algebra generated by cylinders. More in detail, given a trace fragment $\tilde{t} = q_0 \cdots q_{n-1}$, its cylinder $\cyl{\tilde{t}} = \setcomp{t}{\text{$\tilde{t}$ is a prefix of $t$}}$ is given probability \( \Pr(\cyl{\tilde{t}}) = \prod_{i=0}^{n-2} \tsPr{q_i}{q_{i+1}} \). As usual, if $n=1$ the product is empty and evaluates to $1$. Closing the family of cylinders under countable unions and complement we obtain the family of measurable sets. The probability measure on cylinders then uniquely extends to all the measurable sets. Given a set of trace fragments $\tilde{T}$, all starting from the same state $q_0$ and having the same length, we let \( \Pr(\tilde{T}) = \Pr(\bigcup_{\tilde{t}\in\tilde{T}} \cyl{\tilde{t}}) = \sum_{\tilde{t}\in\tilde{T}} \Pr(\cyl{\tilde{t}}) \). Note that using same-length trace fragments ensures that their cylinders are disjoint, hence the second equality holds. Below, we define PCTL formulae. Our syntax is mostly standard, except for the \emph{until} operator. There, for the sake of simplicity, we do not bound the number of steps in the syntax $\phi_1\ {\sf U}\ \phi_2$, but we do so in the semantics. Concretely, this amounts to imposing the same bound to \emph{all} the occurrences of ${\sf U}$ in the formula. Such bound is then provided as a parameter to the semantics. \begin{definition}[PCTL syntax] The syntax of PCTL is given by the following grammar, defining \emph{state formulae} $\phi$ and \emph{path formulae} $\psi$: \begin{align*} \phi & ::= l \mid {\sf true} \mid \lnot \phi \mid \phi \land \phi \mid \logPr{\rhd \pi}{\psi} \qquad \mbox{ where } \rhd \in \setenum{>,\geq} \\ \psi & ::= {\sf X}\ \phi \mid \phi\ {\sf U}\ \phi \end{align*} % As syntactic sugar, we write $\logPr{< \pi}{\psi}$ for $\lnot\logPr{\geq \pi}{\psi}$, and $\logPr{\leq \pi}{\psi}$ for $\lnot\logPr{> \pi}{\psi}$. \end{definition} Given a PCTL formula $\phi$, we define its maximum ${\sf X}$-nesting $\nestMax{{\sf X}}{\phi}$ and its maximum ${\sf U}$-nesting $\nestMax{{\sf U}}{\phi}$ inductively as follows: \begin{definition}[Maximum nesting] For $\circ \in \setenum{{\sf X},{\sf U}}$, we define: \[ \begin{array}{c} \nestMax{\circ}{l} = 0 \qquad \nestMax{\circ}{\sf true} = 0 \qquad \nestMax{\circ}{\lnot\phi} = \nestMax{\circ}{\phi} \\[8pt] \nestMax{\circ}{\phi_1 \land \phi_2} = \max(\nestMax{\circ}{\phi_1},\nestMax{\circ}{\phi_2}) \qquad \nestMax{\circ}{\logPr{\rhd \pi}{\psi}} = \nestMax{\circ}{\psi} \\[8pt] \nestMax{\circ}{{\sf X} \phi} = \nestMax{\circ}{\phi} + \begin{cases} 1 & \text{if $\circ = {\sf X}$} \\ 0 & \text{otherwise} \end{cases} \\[16pt] \nestMax{\circ}{\phi_1 {\sf U} \phi_2} = \max(\nestMax{\circ}{\phi_1},\nestMax{\circ}{\phi_2}) + \begin{cases} 1 & \text{if $\circ = {\sf U}$} \\ 0 & \text{otherwise} \end{cases} \end{array} \] \end{definition} We now define a semantics for PCTL where the probability bounds $\rhd \pi$ in $\logPr{\rhd \pi}{\psi}$ can be relaxed or strengthened by an error $\delta$. Our semantics is parameterized over the \emph{until} bound $n$, the error $\delta\in\mathbb{R}^{\geq 0}$, and a direction $r\in\setenum{+1,-1}$. Given the parameters, the semantics associates each PCTL state formula with the set of states satisfying it. Intuitively, when $r = +1$ we relax the semantics of the formula, so that increasing $\delta$ causes more states to satisfy it. More precisely, the probability bounds $\rhd\pi$ in positive occurrences of $\logPr{\rhd \pi}{\psi}$ are decreased by $\delta$, while those in negative occurrences are increased by $\delta$. Dually, when $r = -1$ we strengthen the semantics, modifying $\rhd\pi$ in the opposite direction. \begin{definition}[PCTL semantics] The semantics of PCTL formulas is given below. Let $n \in \mathbb{N}$, $\delta\in\mathbb{R}^{\geq 0}$ and $r \in \setenum{+1,-1}$. \[ \begin{array}{ll} \sem{n}{\delta}{r}{l} &= \setcomp{q\in\mathcal{Q}}{l\in\lab(q)} \\ \sem{n}{\delta}{r}{\sf true} &= \mathcal{Q} \\ \sem{n}{\delta}{r}{\lnot\phi} &= \mathcal{Q} \setminus \sem{n}{\delta}{-r}{\phi} \\ \sem{n}{\delta}{r}{\phi_1 \land \phi_2} &= \sem{n}{\delta}{r}{\phi_1} \cap \sem{n}{\delta}{r}{\phi_2} \\ \sem{n}{\delta}{r}{\logPr{\rhd \pi}{\psi}} &= \setcomp{q\in\mathcal{Q}}{ \Pr(\trStart{q} \cap \sem{n}{\delta}{r}{\psi}) + r \cdot \delta \rhd \pi } \\ \sem{n}{\delta}{r}{{\sf X} \phi} &= \setcomp{t}{t(1) \in \sem{n}{\delta}{r}{\phi}} \\ \sem{n}{\delta}{r}{\phi_1 {\sf U} \phi_2} &= \setcomp{t}{ \exists i\in 0..n.\ t(i) \in \sem{n}{\delta}{r}{\phi_2} \land \forall j\in 0..i-1.\ t(j) \in \sem{n}{\delta}{r}{\phi_1}} \end{array} \] \end{definition} The semantics is mostly standard, except for $\logPr{\rhd \pi}{\psi}$ and $\phi_1 {\sf U} \phi_2$. The semantics of $\logPr{\rhd \pi}{\psi}$ adds $r\cdot\delta$ to the probability of satisfying $\psi$, which relaxes or strengthens (depending on $r$) the probability bound as needed. The semantics of $\phi_1 {\sf U} \phi_2$ uses the parameter $n$ to bound the number of steps within which $\phi_2$ must hold. Our semantics enjoys monotonicity. The semantics of state and path formulae is increasing w.r.t.\@\xspace~$\delta$ if $r = +1$, and decreasing otherwise. The semantics also increases when moving from $r=-1$ to $r=+1$. \begin{lemma}[Monotonicity] \label{lem:pctl:monotonicity} Whenever $\delta \leq \delta'$, we have: \begin{align*} & \sem{n}{\delta}{+1}{\phi} \subseteq \sem{n}{\delta'}{+1}{\phi} && \sem{n}{\delta'}{-1}{\phi} \subseteq \sem{n}{\delta}{-1}{\phi} && \sem{n}{\delta}{-1}{\phi} \subseteq \sem{n}{\delta}{+1}{\phi} \\ & \sem{n}{\delta}{+1}{\psi} \subseteq \sem{n}{\delta'}{+1}{\psi} && \sem{n}{\delta'}{-1}{\psi} \subseteq \sem{n}{\delta}{-1}{\psi} && \sem{n}{\delta}{-1}{\psi} \subseteq \sem{n}{\delta}{+1}{\psi} \end{align*} \end{lemma} Note that monotonicity does \emph{not} hold for the parameter $n$, i.e.\@\xspace even if $n\leqn'$, we can \emph{not} conclude $\sem{n}{\delta}{+1}{\phi} \subseteq \sem{n'}{\delta}{+1}{\phi}$. For a counterexample, let $\mathcal{Q} = \setenum{q_0, q_1}$, $\lab(q_0)=\emptyset$, $\lab(q_1)=\setenum{\sf a}$, $\tsPr{q_0}{q_1}=\tsPr{q_1}{q_1}=1$, and $\tsPr{q}{q'}=0$ elsewhere. Given $\phi=\logPr{\leq 0}{{\sf true}\ {\sf U}\ {\sf a}}$, we have $q_0 \in \sem{0}{0}{+1}{\phi}$ since in $n=0$ steps it is impossible to reach a state satisfying $\sf a$. However, we do \emph{not} have $q_0 \in \sem{1}{0}{+1}{\phi}$ since in $n'=1$ steps we always reach $q_1$, which satisfies $\sf a$. \begin{example}\label{ex:pctl:padlock} We compare an ideal combination padlock to a real one from the point of view of an adversary. The ideal padlock has a single state $q_{\sf ok}$, representing a closed padlock that can not be opened. Instead, the real padlock is under attack from the adversary who tries to open the padlock by repeatedly guessing its 5-digit PIN. At each step the adversary generates a (uniformly) random PIN, different from all the ones which have been attempted so far, and tries to open the padlock with it. The states of the real padlock are ${q_0,\ldots,q_{N-1}}$ (with $N=10^5$), where $q_i$ represents the situation where $i$ unsuccessful attempts have been made, and an additional state $q_{\sf err}$ that represents that the padlock was opened. Since after $i$ attempts the adversary needs to guess the correct PIN among the $N-i$ remaining combinations, the real padlock in state $q_i$ moves to $q_{\sf err}$ with probability $1/(N-i)$, and to $q_{i+1}$ with the complementary probability. Summing up, we simultaneously model both the ideal and real padlock as a single DTMC with the following transition probability function: \[ \begin{array}{l@{\qquad}l} \Pr(q_{\sf ok},q_{\sf ok})=1 \\ \Pr(q_{\sf err},q_{\sf err})=1 \\ \Pr(q_i,q_{\sf err}) = 1/(N-i) & 0\leq i<N \\ \Pr(q_i,q_{i+1}) = 1-1/(N-i) & 0\leq i<N \\ \Pr(q,q') = 0 & \text{otherwise} \end{array} \] We label the states with labels $\mathcal{L}=\setenum{\sf err}$ by letting $\lab(q_{\sf err})=\setenum{\sf err}$ and $\lab(q)=\emptyset$ for all $q\neqq_{\sf err}$. The PCTL formula $\phi = \logPr{\leq 0}{{\sf true}\ {\sf U}\ {\sf err}}$ models the expected behavior of an unbreakable padlock, requiring that the set of traces where the padlock is eventually opened has zero probability. Formally, $\phi$ is satisfied by state $q$ when \begin{align} \nonumber q \in \sem{n}{\delta}{+1}{\phi} & \iff q \in \sem{n}{\delta}{+1}{\lnot \logPr{> 0}{{\sf true}\ {\sf U}\ {\sf err}}} \\ \nonumber & \iff q \notin \sem{n}{\delta}{-1}{\logPr{> 0}{{\sf true}\ {\sf U}\ {\sf err}}} \\ \nonumber & \iff \lnot ( \Pr(\trStart{q} \cap \sem{n}{\delta}{-1}{{\sf true}\ {\sf U}\ {\sf err}}) - \delta > 0 ) \\ \label{eq:padlock-pr} & \iff \Pr(\trStart{q} \cap \sem{n}{\delta}{-1}{{\sf true}\ {\sf U}\ {\sf err}}) \leq \delta \end{align} When $q=q_{\sf ok}$ we have that $\trStart{q_{\sf ok}} \cap\sem{n}{\delta}{-1}{{\sf true}\ {\sf U}\ {\sf err}} = \emptyset$, hence the above probability is zero, which is surely $\leq \delta$. Consequently, $\phi$ is satisfied by the ideal padlock $q_{\sf ok}$, for all $n\geq 0$ and $\delta\geq 0$. By contrast, $\phi$ is not always satisfied by the real padlock $q=q_0$, since we have $q_0\in \sem{n}{\delta}{+1}{\phi}$ only for some values of $n$ and $\delta$. To show why, we start by considering some trivial cases. Choosing $\delta=1$ makes equation~\eqref{eq:padlock-pr} trivially true for all $n$. Further, if we choose $n=1$, then $\trStart{q_0} \cap\sem{n}{\delta}{-1}{{\sf true}\ {\sf U}\ {\sf err}} = \setenum{q_0q_{\sf err}^\omega}$ is a set of traces with probability $1/N$. Therefore, equation~\eqref{eq:padlock-pr} holds only when $\delta\geq 1/N$. More in general, when $n\geq 1$, we have \[ \trStart{q_0} \cap \sem{n}{\delta}{-1}{{\sf true}\ {\sf U}\ {\sf err}} = \setenum{q_0q_{\sf err}^\omega,\ q_0q_1q_{\sf err}^\omega,\ q_0q_1q_2q_{\sf err}^\omega,\ \ldots,\ q_0\ldotsq_{n-1}q_{\sf err}^\omega } \] The probability of the above set is the probability of guessing the PIN within $n$ steps. The complementary event, i.e.\@\xspace not guessing the PIN for $n$ times, has probability \[ \dfrac{N-1}{N} \cdot \dfrac{N-2}{N-1} \cdots \dfrac{N-n}{N-(n-1)} = \dfrac{N-n}{N} \] Consequently, \eqref{eq:padlock-pr} simplifies to $n/N \leq \delta$, suggesting the least value of $\delta$ (depending on $n$) for which $q_0$ satisfies $\phi$. For instance, when $n=10^3$, this amounts to claiming that the real padlock is secure, up to an error of $\delta = n/N = 10^{-2}$. \end{example} \section{Soundness: Proofs}\label{sec:proofs} \begin{proofof}{lem:matching} Without loss of generality, we prove the statement under the following additional assumptions: \begin{align} \label{eq:matching-aux2} & \forall b \in B: f_B(b) > 0 \\ \label{eq:matching-aux1} & \forall b \in B: \setcomp{a \in A}{b \in g(a)} \neq \emptyset \qquad \text{and} \\ \nonumber & \qquad \forall b_1,b_2 \in B: \setcomp{a \in A}{b_1 \in g(a)} = \setcomp{a \in A}{b_2 \in g(a)} \implies b_1 = b_2 \end{align} If $B$ does not satisfy \cref{eq:matching-aux2}, just remove from $B$ the elements $b$ such that $f_B(b) = 0$ adjust $g$ accordingly, and set $h(a,b) = 0$. \Cref{eq:matching-assumption} still holds since we removed only elements whose value is zero. If $B$ does not satisfy \cref{eq:matching-aux1}, it can be transformed to a set that does. To see why, let $\equiv \subseteq B \times B$ be defined as: \[b \equiv b' \text{ iff } \setcomp{a \in A}{b \in g(a)} = \setcomp{a \in A}{b' \in g(a)}\] Let $\hat{B}$ be the set of equivalence classes w.r.t. $\equiv$. For an equivalence class $[b]$, define $f_{\hat{B}}([b]) = \sum_{b' \in [b]}{f_B(b')}$ and $g'(a) = \setcomp{[b]}{b \in g(a)}$. It is easy to verify that \cref{eq:matching-aux1} is satisfied. Notice that $\sum_{[b] \in g'(a)} f_{B'}([b])$ converges because $\sum_{[b] \in g'(a)} f_{B'}([b]) = \sum_{[b] \in g'(a)} \sum_{b' \in [b]}f_{B}(b) = \sum_{b \in g(a)}f_{B}(b)$. We now show that $A,\hat{B}$ and $g'$ satisfy \cref{eq:matching-assumption}. We have that, for all $b \in B$, $f_B(b) \leq f_{\hat{B}}([b])$ and $b \in g(a) \implies [b] \in g'(a)$. Therefore, for all $A' \subseteq A$: \[ \sum_{a \in A'} f_A(a) \leq \sum_{b \in \bigcup_{a \in A'} g(a)} f_B(b) \leq \sum_{[b] \in \bigcup_{a \in A'} g'(a)} f_{B'}([b]) \] From a function $h'$ satisfying \cref{eq:matching-thesis:1,eq:matching-thesis:2} for $A, \hat{B}$ and $g'$ we can easily obtain a function $h$ for $A, B$ and $g$: e.g.\@\xspace, set $h(a,b) = h'(a,[b])\frac{f_B(b)}{f_{\hat{B}}([b])}$. Notice that $f_{\hat{B}}([b]) > 0$ by \cref{eq:matching-aux2}, and that if $B$ satisfies \cref{eq:matching-aux1} it then holds that $\card{B} < 2^{\card{A}}$, and so $B$ is finite. That said, we show that the thesis holds by reducing to the max-flow problem \cite{MinCut}. Assume w.l.o.g that $A$ and $B$ are disjoint. Let $N = (V,E)$ be a directed graph, where $V = A \cup B \cup \setenum{s,t}$ with $s,t \not\in A \cup B$ and: \[E = \setcomp{(s,b)}{b \in B} \cup \setcomp{(b,a)}{a \in A, b \in g(a)} \cup \setcomp{(a,t)}{a \in A}\] Define edge capacity $w: E \rightarrow \mathbb{R}_0^+ \cup \infty$ as follows: \[ w(s,b) = f_B(b) \qquad w(b,a) = \infty \qquad w(a,t) = f_A(a) \] Consider the cut $C = \setcomp{(a,t)}{a \in A}$ associated with partition $(V \setminus \setenum{t},\setenum{t})$. Such cut has capacity $\sum_{a \in A} f_A(a)$ and we argue it is minimum. Take a cut $C'$ of the network. First notice that if $C'$ contains edges of the form $(b,a)$ its capacity would be infinite. We can therefore consider only cuts whose elements are of the form $(s,b)$ or $(a,t)$, and thus for all $a \in A$ we have that $a$ and the elements of $g(a)$ are in the same partition. In other words $s$ partition is of the form $A' \cup \bigcup_{a \in A'} g(a) \cup \setenum{s}$, $t$ partition is of the form $A \setminus A' \cup \bigcup_{a \in (A \setminus A')} g(a) \cup \setenum{t}$, where $A' \subseteq A$. So capacity of $C'$ is $\sum_{a \in A'} f_A(a) + \sum_{b \in g(A \setminus A')} f_B(b)$. Now, capacity of $C$ is $\sum_{a \in A'} f_A(a) + \sum_{a \in (A \setminus A')} f_A(a)$. Since $\sum_{a \in (A \setminus A')} f_A(a) \leq \sum_{b \in g(A \setminus A')} f_B(b)$ by assumption \cref{eq:matching-assumption}, we have that capacity of $C$ is minimal. By the min-cut max-flow theorem \cite{MinCut}, we have that the max flow of the network has capacity $\sum_{a \in A} f_A(a)$. Let $flow: E \rightarrow \mathbb{R}_0^+$ be the a flow associated to such cut. Consequently, we have that $flow(a,t) = f_A(a)$ for all $a \in A$. Define: \[ h(a,b) = \begin{cases} \frac{flow(b,a)}{f_B(b)} & \text{ if } b \in g(a)\\ 0 & \text{ otherwise} \end{cases} \] We have to show that $h$ satisfies \cref{eq:matching-thesis:1,eq:matching-thesis:2}. Let $A' \subseteq A$. We have that: \begin{align*} \sum_{a \in A'} \sum_{b \in g(a)} h(a,b) f_B(b) & = \sum_{a \in A'} \sum_{b \in g(a)} \frac{flow(b,a)}{f_B(b)} f_B(b) \\ & = \sum_{a \in A'} \sum_{b \in g(a)} flow(b,a) \end{align*} By the conservation of flow constraint, we have that: \[\sum_{a \in A'} \sum_{b \in g(a)} flow(b,a) = \sum_{a \in A'} flow(a,t) = \sum_{a \in A'} f_A(a)\] So summing up we have that: \[\sum_{a \in A'} \sum_{b \in g(a)} h(a,b) f_B(b) = \sum_{a \in A'} f_A(a)\] For the remaining part, let $b \in B$. We have that: \begin{align*} \sum_{a \in A} h(a,b) & = \sum_{a \in \setcomp{a'}{b \in g(a')}} h(a,b) \; = \; \sum_{a \in \setcomp{a'}{b \in g(a')}} \frac{flow(b,a)}{f_B(b)} \\ & = \frac{1}{f_B(b)} {\sum_{a \in \setcomp{a'}{b \in g(a')}} flow(b,a)} \;\leq\; \frac{f_B(b)}{f_B(b)} \;=\; 1 \tag*{\qed} \end{align*} \end{proofof} \begin{proofof}{lem:finite-traces} By induction on $n$. The base case ($n = 1$) is trivial as $T = \{\stateP\}$ and $\TR{n}{d,\stateQ}{T} = \{\stateQ\}$, or $T = \emptyset$ and $\TR{n}{d,\stateQ}{T} = \emptyset$. Therefore $\prob{T}{} = \prob{\TR{n}{d,\stateQ}{T}}{} = \card{T}$. For the induction case, first notice that: \[ \prob{T}{}\;\;= \;\; \sum_{\tilde{t} \in T} \prob{\stateP}{\tilde{t}(1)}\prob{\tilde{t}(1\hdots n - 1)}{} \] Now, referring to \cref{lem:matching}, let $A = \setcomp{\tilde{t}(1)}{\tilde{t} \in T}$, $B = \setcomp{\stateQi}{p' \CSim{n}{d} \stateQi \text{ for some } p' \in A} \cup \{D\}$, where $D$ is a special element not occurring in $A \cup B$. Let $f_A(p') = \prob{\stateP}{p'}$, $f_B(\stateQi) = \prob{\stateQ}{\stateQi}$ and $f_B(D) = d$. Finally, let $g(p') = \R{n-1}{d}{p'} \cup\{D\}$. Now, let $A' \subseteq A$. We have that: \[ \sum_{a \in A'} f_A(a) = \prob{\stateP}{A'} \leq \prob{\stateP}{\R{n-1}{d}{A'}} + d = \sum_{b \in \bigcup_{a \in A'} g(a)} f_B(b) \] Notice that, by \cref{def:param-bisim}, we have that $A,B,f_A,f_B,g$ satisfy \cref{eq:matching-assumption} of \cref{lem:matching}. Indeed, let $A' \subseteq A$. We have that: \[\sum_{a \in A'} f_A(a) = \prob{\stateP}{A'} \leq \prob{\stateQ}{\cryset{n - 1}{d}{A'}} + d = \sum_{b \in \bigcup_{a \in A'} g(a)} f_B(b)\] We can then conclude that there is $h$ such that, for all $A' \subseteq A$: \[ \prob{\stateP}{A'} = \sum_{p' \in A'} \Big( h(p',D) d \;\;+ \sum_{\stateQi \in \R{n-1}{d}{p'}} h(p',\stateQi)\prob{\stateQ}{\stateQi}\Big) \] Let $T_{P} = \setcomp{\tilde{t}(1...n - 1)}{\tilde{t} \in T \land \tilde{t}(1) \in P}$ where $P \subseteq A$. We simply write $T_{p'}$ if $P = \{p'\}$. So, we have that: \[ \begin{array}{rl} \prob{T}{} & \;\;=\;\;\sum_{\tilde{t} \in T} \prob{\stateP}{\tilde{t}(1)}\prob{\tilde{t}(1\hdots n - 1)}{}\\ & \;\;= \;\; \sum_{p' \in A} \prob{\stateP}{p'}\prob{T_{p'}}{}\\ & \;\;= \;\; \sum_{p' \in A} \prob{T_{p'}}{}\Big(h(p',D) d \;\;+ \sum_{\stateQi \in \R{n-1}{d}{p'}} h(p',\stateQi)\prob{\stateQ}{\stateQi}\Big)\\ & \;\;\leq \;\; d + \sum_{p' \in A} \prob{T_{p'}}{}\sum_{\stateQi \in \R{n-1}{d}{p'}} h(p',\stateQi)\prob{\stateQ}{\stateQi}\\ & \;\;= \;\; d + \sum_{p' \in A} \sum_{\stateQi \in \R{n-1}{d}{p'}} h(p',\stateQi)\prob{\stateQ}{\stateQi}\prob{T_{p'}}{}\\ & \;\;\leq \;\; d + \sum_{p' \in A} \sum_{\stateQi \in \R{n-1}{d}{p'}} h(p',\stateQi)\prob{\stateQ}{\stateQi}\Big(\prob{\TR{n-1}{d,\stateQi}{T_{p'}}}{}+d(n - 1)\Big)\\ & \;\;= \;\; d + S_1 + S_2 \end{array} \] % where: \[ s1 = \sum_{p' \in A} \sum_{\stateQi \in \R{n-1}{d}{p'}} h(p',\stateQi)\prob{\stateQ}{\stateQi}d(n - 1) \] \[ s2 = \sum_{p' \in A} \sum_{\stateQi \in \R{n-1}{d}{p'}} h(p',\stateQi)\prob{\stateQ}{\stateQi}\prob{\TR{n-1}{d,\stateQi}{T_{p'}}}{} \] Now: \[ \begin{array}{rl} s1 & \;\;=\;\; d(n - 1)\sum_{p' \in A} \sum_{\stateQi \in \R{n-1}{d}{p'}} h(p',\stateQi)\prob{\stateQ}{\stateQi}\\ & \;\;\leq\;\; d(n - 1)\prob{\stateP}{A}\\ & \;\;\leq\;\; d(n - 1) \end{array} \] Therefore $d + s1 \leq dn$. It remains to show that $s2 \leq \prob{\TR{n}{d,\stateQ}{T}}{}$. First notice that $s2$ can be rewritten as follows by a simple reordering of terms: \[ s2 = \sum_{\stateQi \in \R{n - 1}{d}{A}} \sum_{p' \in A \cap \R{n - 1}{d}{\stateQi}} h(p',\stateQi)\prob{\stateQ}{\stateQi}\prob{\TR{n-1}{d,\stateQi}{T_{p'}}}{} \] So: \[ \begin{array}{rl} s2 &\;\;=\;\; \sum_{\stateQi \in \R{n - 1}{d}{A}} \sum_{p' \in A \cap \R{n - 1}{d}{\stateQi}} h(p',\stateQi)\prob{\stateQ}{\stateQi}\prob{\TR{n-1}{d,\stateQi}{T_{p'}}}{}\\ &\;\;\leq\;\;\sum_{\stateQi \in \R{n - 1}{d}{A}} \sum_{p' \in A \cap \R{n - 1}{d}{\stateQi}} h(p',\stateQi)\prob{\stateQ}{\stateQi} \prob{\TR{n-1}{d,\stateQi}{T_{A \cap \R{n - 1}{d}{\stateQi}}}}{}\\ &\;\;\leq\;\;\sum_{\stateQi \in \R{n - 1}{d}{A}} \prob{\stateQ}{\stateQi}\prob{\TR{n-1}{d,\stateQi}{T_{A \cap \R{n - 1}{d}{\stateQi}}}}{} \sum_{p' \in A \cap \R{n - 1}{d}{\stateQi}} h(p',\stateQi)\\ &\;\;\leq\;\;\sum_{\stateQi \in \R{n - 1}{d}{A}} \prob{\stateQ}{\stateQi}\prob{\TR{n-1}{d,\stateQi}{T_{A \cap \R{n - 1}{d}{\stateQi}}}}{}\\ &\;\;=\;\;\prob{\TR{n}{d,\stateQ}{T}}{} \end{array} \] % The last equality follows by partitioning $\TR{n}{d,\stateQ}{T}$ according to the second state of each trace $\stateQi$. The set of all such second states is the set of those bisimilar to (some state of) $A$, namely $\R{n - 1}{d}{A}$. % Given any such $\stateQi$, the probability of its partition is $\prob{\stateQ}{\stateQi}\prob{U_{\stateQi}}{}$ where $U_{\stateQi}$ is the set of the \emph{tails} of $\TR{n}{d,\stateQ}{T}$ starting from $\stateQi$. % Since this set is defined taking pointwise bisimilar traces, we can equivalently express $U_{\stateQi}$ by first taking the tails of $T$ (i.e., $T_A$), and then considering the bisimilar traces: in other words, we have $U_{\stateQi} = \TR{n-1}{d,\stateQi}{T_{A}}$. Note that the states in $A$ which are not bisimilar to $\stateQi$ do not contribute to $\TR{n-1}{d,\stateQi}{T_{A}}$ in an way, so we can also write the wanted $U_{\stateQi} = \TR{n-1}{d,\stateQi}{T_{A \cap \R{n - 1}{d}{\stateQi}}}$. % \qed \end{proofof} \begin{lemma}\label{lem:logic-finite-traces-next} Let $T = \setcomp{t}{t(0) = \stateP \land t \sat{d}{n}{r} \logNext \sFormula}$ for some $\stateP,\sFormula$, and let $m \geq 2$. Then: \[\prob{T}{} = \prob{\setcomp{\tilde{t}}{\card{t} = m \land \tilde{t}(0) = \stateP \land \tilde{t} \sat{d}{n}{r} \logNext \sFormula}}{}\] \end{lemma} \begin{proof} Trivial. \qed \end{proof} \begin{lemma}\label{lem:logic-finite-traces} Let $T = \setcomp{t}{t(0) = \stateP \land t \sat{d}{n}{r} \sFormula[1] \logUntil \sFormula[2]}$ for some $\stateP,\sFormula[1], \sFormula[2]$, and let $m \geq n + 1$. Then: \[\prob{T}{} = \prob{\setcomp{\tilde{t}}{\card{\tilde{t}} = m \land \tilde{t}(0) = \stateP \land \tilde{t} \sat{d}{n}{r} \sFormula[1] \logUntil \sFormula[2]}}{}\] \end{lemma} \begin{proof} (Sketch) Let $\tilde{T} = \setcomp{\tilde{t}}{\card{\tilde{t}} = m \land \tilde{t}(0) = \stateP \land \tilde{t} \sat{d}{n}{r} \sFormula[1] \logUntil \sFormula[2]}$. The thesis follows from the fact that $T = \bigcup_{\tilde{t} \in \tilde{T}}{cyl(\tilde{t})}$. \qed \end{proof} In the following proof we find it more convenient to use the notation $q \sat{\delta}{n}{r} \phi$ instead of $q \in \sem{n}{\delta}{r}{\phi}$. \zunnote{Si potrebbe aggiustare la notazione k,m,n e $\delta$, rinominando le lettere opportunamente.} \begin{lemma}\label{lem:bisimi-implies-prop-preserv} Let $k$ and $n$ be, respectively, the maximum nesting level of $\logUntil$ and of $\logNext$ in $\sFormula$, and let $\stateP \CSim{mk + n + 1}{d_1} \stateQ$. Then: \begin{enumerate} \item \label{lem:bisimi-implies-prop-preserv:item1} If $\stateP \sat{d_2}{m}{+1} \sFormula$ then $\stateQ \sat{d_2 + d_1(mk + n + 1)}{m}{+1} \sFormula$. \item \label{lem:bisimi-implies-prop-preserv:item2} If $\stateP \not\sat{d_2}{m}{-1} \sFormula$ then $\stateQ \not\sat{d_2 + d_1(mk + n + 1)}{m}{-1} \sFormula$. \end{enumerate} \end{lemma} \begin{proof} By induction on $\sFormula$. The cases $\logTrue$ and $\atomA$ are trivial. \begin{itemize} \item $\mathtt{\neg} \sFormulai$. We only show \cref{lem:bisimi-implies-prop-preserv:item1} as the other item is similar. So, suppose $\stateP \sat{d_2}{m}{+1} \mathtt{\neg} \sFormulai$. Then $\stateP \not\sat{d_2}{m}{-1} \sFormula$. By the induction hypothesis we have that $\stateQ \not\sat{d_2 + d_1(mk + n + 1)}{m}{-1} \sFormula$, and hence $\stateQ \sat{d_2 + d_1(mk + n + 1)}{m}{+1} \mathtt{\neg} \sFormulai$ as required. \item $\sFormula[1] \mathtt{\land} \sFormula[2]$. We only show \cref{lem:bisimi-implies-prop-preserv:item1} as the other item is similar. So, suppose $\stateP \sat{d_2}{m}{+1} \sFormula[1] \mathtt{\land} \sFormula[2]$. Then $\stateP \sat{d_2}{m}{+1} \sFormula[1]$ and $\stateP \sat{d_2}{m}{+1} \sFormula[2]$. By the induction hypothesis $\stateQ \sat{d_2 + d_1(mk + n + 1)}{m}{+1} \sFormula[1]$ and $\stateQ \sat{d_2 + d_1(mk + n + 1)}{m}{+1} \sFormula[2]$. Therefore $\stateQ \sat{d_2 + d_1(mk + n + 1)}{m}{+1} \sFormula[1] \mathtt{\land} \sFormula[2]$ as required. \item $\lPr{\geq d}{\pFormula}$. For \cref{lem:bisimi-implies-prop-preserv:item1}, suppose $\stateP \sat{d_2}{m}{+1} \lPr{\geq d}{\pFormula}$. Let: \[T = \setcomp{\tilde{t}}{\card{\tilde{t}} = mk + n + 1 \land \tilde{t}(0) = \stateP \land \tilde{t} \sat{d_2}{m}{+1} \pFormula}{}\] We start by proving: \begin{equation}\label{lem:bisimi-implies-prop-preserv:eq1} \forall \tilde{u} \in \TR{mk + n + 1}{d_1,\stateQ}{T}: \tilde{u} \sat{d_2 + d_1(mk + n + 1)}{m}{+1} \pFormula \end{equation} So, let $\tilde{u} \in \TR{(m + 1)k + n + 1}{d_1,\stateQ}{T}$. Then, there is $\tilde{t} \in T$ such that, for all $0 \leq i < mk + n + 1$: \[\tilde{t}(i) \CSim{mk + n + 1-i}{d_1} \tilde{u}(i)\] We proceed by cases on $\pFormula$. \begin{itemize} \item $\sFormula[1] \logUntil \sFormula[2]$. First notice that $mk + n + 1 \geq m + 1$, and hence by \cref{lem:logic-finite-traces} we have that: \[\prob{T}{} = \prob{\setcomp{t}{t(0) = \stateP \land t \sat{d_2}{m}{+1} \sFormula[1] \logUntil \sFormula[2]}}{}\] We then have $\prob{T}{} + d_2 \geq d$. Since $\tilde{t} \sat{d_2}{m}{+1} \sFormula[1] \logUntil \sFormula[2]$, we have that: \[\exists i \leq m: \tilde{t}(i) \sat{d_2}{m}{+1} \sFormula[2] \land \forall j < i: \tilde{t}(j) \sat{d_2}{m}{+1} \sFormula[1]\] Let $n'$ be the maximum nesting level of $\logNext$ in $\sFormula[2]$. We know that: \[\tilde{t}(i) \CSim{mk + n + 1-i}{d_1} \tilde{u}(i) \land mk + n + 1 - i > m(k - 1) + n' + 1\] Then, by \cref{lem:sim:monotonicity} (monotonicity of $\CSim{}{}$), we have that: \[\tilde{t}(i) \CSim{m(k - 1) + n' + 1}{d_1} \tilde{u}(i)\] Then, by the induction hypothesis, we have that: \[\tilde{u}(i) \sat{d_2 + d_1(m(k - 1) + n' + 1)}{m}{+1} \sFormula[2]\] By \cref{lem:pctl:monotonicity} (monotonicity of $\sat{}{}{}$) it follows that: \[ \tilde{u}(i) \sat{d_2 + d_1(mk + n + 1)}{m}{+1} \sFormula[2]\] With a similar argument we can conclude that, for all $j < i$: \[\tilde{u}(j) \sat{d_2 + d_1(mk + n + 1)}{m}{+1} \sFormula[1]\] Hence \cref{lem:bisimi-implies-prop-preserv:eq1} holds. \item $\logNext \sFormula[1]$. First notice that $mk + n + 1 \geq 2$, and hence by \cref{lem:logic-finite-traces-next} we have that: \[\prob{T}{} = \prob{\setcomp{t}{t(0) = \stateP \land t \sat{d_2}{m}{+1} \logNext \sFormula[1]}}{}\] We then have $\prob{T}{} + d_2 \geq d$. Since $\tilde{t} \sat{d_2}{m}{+1} \logNext \sFormula[1]$, we have that \( \tilde{t}(1) \sat{d_2}{m}{+1} \sFormula[1] \). We know that: \( \tilde{u}(1) \CSim{mk + n}{d_1} \tilde{t}(1) \). By the induction hypothesis, \( \tilde{u}(1) \sat{d_2 + d_1(mk + n)}{m}{+1} \sFormula[1] \). By \cref{lem:pctl:monotonicity} (monotonicity of $\sat{}{}{}$) it follows that: \( \tilde{u}(i) \sat{d_2 + d_1(mk + n + 1)}{m}{+1} \sFormula[1] \). Hence, \eqref{lem:bisimi-implies-prop-preserv:eq1} holds. \end{itemize} \medskip Back to the main statement, we have that, by \cref{lem:traces}: \[\prob{\TR{mk + n + 1}{d_1,\stateQ}{T}}{} + d_2 + d_1 (mk + n + 1) \geq \prob{T}{} + d_2\] So, summing up: \[ \begin{array}{c} \prob{\setcomp{t}{t(0) = \stateQ \land t\sat{d_2 + d_1(mk + n + 1)}{m}{1} \pFormula}}{} + d_2 + d_1 (mk + n + 1) = \\ \prob{\setcomp{\tilde{t}}{\card{\tilde{t}} = mk + n + 1 \land \tilde{t}(0) = \stateQ \land \tilde{t}\sat{d_2 + d_1(mk + n + 1)}{m}{1} \pFormula}}{} + d_2 + d_1 (mk + n + 1) \geq \\ \prob{\TR{mk + n + 1}{d_1,\stateQ}{T}}{} + d_2 + d_1 (mk + n + 1) \geq \\ \prob{T}{} + d_2 \geq d \end{array} \] Therefore $\stateQ \sat{d_2 + d_1(mk + n)}{m}{+1} \lPr{\geq d}{\pFormula}$.\\[10pt] For \cref{lem:bisimi-implies-prop-preserv:item2}, suppose $\stateP \not\sat{d_2}{m}{-1} \lPr{\geq d}{\pFormula}$. Then: \[ \prob{\setcomp{t}{t(0) = \stateP \land t \sat{d_2}{m}{-1} \pFormula}{}}{} - d_2 < d \] From the above, by a case analysis on $\pFormula$, and exploiting \cref{lem:logic-finite-traces,lem:logic-finite-traces-next}, we can conclude $\prob{T}{} - d_2 < d$ where: \[ T = \setcomp{\tilde{t}}{\card{\tilde{t}} = mk + n + 1 \land t(0) = \stateP \land t \sat{d_2}{m}{-1} \pFormula} \] Let: \[\bar T = \setcomp{\tilde{t}}{\card{\tilde{t}} = mk + n + 1 \land t(0) = \stateP \land \tilde{t} \not\sat{d_2}{m}{-1} \pFormula}{}\] We have that $1 - \prob{\bar T}{} = \prob{T}{}$. We start proving that: \[\forall \tilde{u} \in \TR{mk + n + 1}{d_1,\stateQ}{\bar T}: \tilde{u} \not\sat{d_2 + d_1(mk + n + 1)}{m}{-1} \pFormula\] So, let $\tilde{u} \in \TR{mk + n + 1}{d_1,\stateQ}{\bar T}$. Then, there is $\tilde{t} \in \bar{T}$ such that, for all $0 \leq i < mk + n + 1$: \[\tilde{t}(i) \CSim{mk + n-i}{d_1} \tilde{u}(i)\] We proceed by cases on $\pFormula$. \begin{itemize} \item $\sFormula[1] \logUntil \sFormula[2]$. Since $\tilde{t} \not\sat{d_2}{m}{-1} \sFormula[1] \logUntil \sFormula[2]$, we have that: \[\forall i \leq m: \tilde{t}(i) \not\sat{d_1}{m}{-1} \sFormula[2] \lor \exists j < i: \tilde{t}(j) \not\sat{d_2}{m}{-1} \sFormula[1]\] So, take $i \leq m$. Let $n'$ be the maximum nesting level of $\logNext$ in $\sFormula[2]$. If $\tilde{t}(i) \not\sat{d_1}{m}{-1} \sFormula[2]$, since \[\tilde{t}(i) \CSim{mk + n + 1 - i}{d_1} \tilde{u}(i) \land mk + n + 1 - i > m(k - 1) + n' + 1\] by \cref{lem:sim:monotonicity} (monotonicity of $\CSim{}{}$) we have that: \[\tilde{t}(i) \CSim{m(k - 1) + n' + 1}{d_1} \tilde{u}(i)\] By the induction hypothesis we have that: \[\tilde{u}(i) \not\sat{d_2 + d_1(m(k - 1) + n' + 1)}{m}{-1} \sFormula[2]\] By \cref{lem:pctl:monotonicity} (monotonicity of $\sat{}{}{}$) it follows: \[\tilde{u}(i) \not\sat{d_2 + d_1(mk + n + 1)}{m}{-1} \sFormula[2]\] If $\tilde{t}(j) \not\sat{d_1}{m}{-1} \sFormula[1]$ for some $j < i$, with a similar argument we can conclude that: \[\tilde{u}(j) \not\sat{d_2 + d_1(m(k - 1) + n + 1)}{m}{-1} \sFormula[1]\] \item $\logNext \sFormula[1]$. Since $\tilde{t} \not\sat{d_2}{m}{-1} \logNext \sFormula[1]$, we have that: \( \tilde{t}(1) \not\sat{d_2}{m}{-1} \sFormula[1] \). Since $\tilde{t}(1) \CSim{mk + n}{d_1} \tilde{u}(1)$, by the induction hypothesis \( \tilde{u}(i) \not\sat{d_2 + d_1(mk + n)}{m}{-1} \sFormula[1] \). By \cref{lem:pctl:monotonicity} it follows that: \( \tilde{u}(i) \not\sat{d_2 + d_1(mk + n + 1)}{m}{-1} \sFormula[1] \). \end{itemize} \medskip Back to the main statement, by \cref{lem:traces} we have that: \[\prob{\bar T}{} \leq \prob{\TR{mk + n + 1}{d_1,\stateQ}{\bar T}}{} + d_1(mk + n + 1)\] Summing up, we have that: \[ \begin{array}{c} \prob{\setcomp{t}{t(0) = \stateQ \land t\sat{d_2 + d_1(mk + n + 1)}{m}{-1} \pFormula}}{} - d_2 - d_1 (mk + n + 1) = \\ \prob{\setcomp{\tilde{t}}{\card{\tilde{t}} = \card{\tilde{t}} = mk + n + 1 \land \tilde{t}(0) = \stateQ \land \tilde{t}\sat{d_2 + d_1(mk + n + 1)}{m}{-1} \pFormula}}{} - d_2 - d_1 (mk + n + 1) = \\ 1 - \prob{\setcomp{\tilde{t}}{\card{\tilde{t}} = mk + n + 1 \land \tilde{t}(0) = \stateQ \land \tilde{t}\not\sat{d_2 + d_1(mk + n + 1)}{m}{-1} \pFormula}}{} - d_2 - d_1 (mk + n + 1) \leq \\ 1 - \prob{\TR{mk + n}{d_1,\stateQ}{\bar T}}{} - d_2 - d_1 (mk + n + 1) \leq \\ 1 - \prob{\bar T}{} - d_2 = \\ \prob{T}{} - d_2 < d \end{array} \] Therefore $\stateQ \not\sat{d_2 + d_1(mk + n)}{m}{-1} \lPr{\geq d}{\pFormula}$. \qed \end{itemize} \end{proof} \begin{proofof}{th:soundness} Immediate consequence of~\Cref{lem:bisimi-implies-prop-preserv}. \qed \end{proofof} \section{Soundness: Overview} \label{sec:result} Our soundness theorem shows that, if we consider any state $q$ satisfying $\phi$ (with steps $n$ and error $\delta'$), and any state $q'$ which is bisimilar to $q$ (with enough steps and error $\delta$), then $q'$ must satisfy $\phi$, with the same number $n$ of steps, at the cost of suitably increasing the error. For a fixed $\phi$, the ``large enough'' number of steps and the increase in the error depend linearly on $n$. \begin{theorem}[Soundness] \label{th:soundness} Given a formula $\phi$, let $k_X = \nestMax{{\sf X}}{\phi}$ be the maximum ${\sf X}$-nesting of $\phi$, and let $k_U = \nestMax{{\sf U}}{\phi}$ be the maximum ${\sf U}$-nesting of $\phi$. % Then, for all $n,\delta,\delta'$ we have: \[ \begin{array}{c} \cryset{\bar{n}}{\delta}{ \sem{n}{\delta'}{+1}{\phi}} \subseteq \sem{n}{\bar{n}\cdot\delta+\delta'}{+1}{\phi} % \tag*{ where $\bar{n} = n\cdotk_U + k_X + 1$} \end{array} \] \end{theorem} \begin{example} \label{ex:results:padlock} We now apply~\Cref{th:soundness} to our padlock system in the running example. % To do so, we take the same formula $\phi = \logPr{\leq 0}{{\sf true}\ {\sf U}\ {\sf err}}$ of~\Cref{ex:pctl:padlock} and choose $n=10^3$ and $\delta'=0$. % Since $\phi$ has only one until operator and no next operators, the value $\bar{n}$ in the statement of the theorem is $\bar{n} = 10^3\cdot 1+0+1 = 1001$. % Therefore, from~\Cref{th:soundness} we obtain, for all $\delta$: \[ \begin{array}{ll} & \cryset{1001}{\delta}{ \sem{1000}{0}{+1}{\phi}} \subseteq \sem{1000}{1001\cdot \delta}{+1}{\phi} \end{array} \] In~\Cref{ex:pctl:padlock} we discussed how the ideal padlock $q_{\sf ok}$ satisfies the formula $\phi$ for any number of steps and any error value. % In particular, choosing 1000 steps and zero error, we get $q_{\sf ok}\in \sem{1000}{0}{+1}{\phi}$. Moreover, in~\Cref{ex:sim:padlock} we observed that states $q_{\sf ok}$ and $q_0$ are bisimilar with $\bar{n}=1001$ and $\delta=1/(N-0-\bar{n}+2) = 1/99001$, i.e.~$q_{\sf ok} \crysim{\bar{n}}{\delta} q_0$. In such case, the theorem ensures that $q_0\in\sem{1000}{1001/99001}{+1}{\phi}$, hence the real padlock can be considered unbreakable if we limit our attention to the first $n=1000$ steps, up to an error of $1001/99001 \approx 0.010111$. % Finally, we note that such error is remarkably close to the least value that would still make $q_0$ satisfy $\phi$, which we computed in~\Cref{ex:pctl:padlock} as $n/N = 10^3/10^5 = 0.01$. \end{example} In the rest of this section, we describe the general structure of the proof in a top-down fashion, leaving the detailed proof for~\Cref{sec:proofs}. We prove the soundness theorem by induction on the state formula $\phi$, hence we also need to deal with path formulae $\psi$. Note that the statement of the theorem considers the image of the semantics of the state formula $\phi$ w.r.t.~bisimilarity (i.e., $\cryset{\bar{n}}{\delta}{\sem{n}{\delta'}{+1}{\phi}}$). Analogously, to deal with path formulae we also need an analogous notion on sets of traces. To this purpose, we consider the set of traces in the definition of the semantics: $T = \trStart{p} \cap \sem{n}{\delta}{r}{\psi}$. Then, given a state $q$ bisimilar to $p$, we define the set of \emph{pointwise bisimilar traces} starting from $q$, which we denote with $\TR{n}{\delta,\stateQ}{T}$. Technically, since $\psi$ can only observe a finite portion of a trace, it is enough to define $\TR{n}{\delta,\stateQ}{\tilde{T}}$ on sets of \emph{trace fragments} $\tilde{T}$. \begin{definition} Write $\fram{q_0}{n}$ for the set of all trace fragments of length $n$ starting from $q_0$. % Assuming $\stateP \CSim{n}{\delta} \stateQ$, we define $\TR{n}{\delta,\stateQ}{}: \mathcal{P}(\fram{\stateP}{n}) \rightarrow \mathcal{P}(\fram{\stateQ}{n})$ as follows: \[ \TR{n}{\delta,\stateQ}{\tilde{T}} = \setcomp{\tilde{u} \in \fram{\stateQ}{n}}{ \exists \tilde{t} \in \tilde{T}.\, \forall 0 \leq i < n.\ \tilde{t}(i) \CSim{n-i}{\delta} \tilde{u}(i) } \] \end{definition} The key inequality we exploit in the proof (\Cref{lem:traces}) compares the probability of a set of trace fragments $\tilde{T}$ starting from $\stateP$ to the one of the related set of trace fragments $\TR{m}{\delta,\stateQ}{\tilde{T}}$ starting from a $\stateQ$ bisimilar to $\stateP$. We remark that the component $\bar{n} \delta$ in the error that appears in~\Cref{th:soundness} results from the component $m \delta$ appearing in the following lemma. \begin{lemma}\label{lem:traces} If $\stateP \CSim{n}{\delta} \stateQ$ and $\tilde{T}$ is a set of trace fragments of length $m$, with $m \leq n$, starting from $\stateP$, then: \[ \prob{\tilde{T}}{} \leq \prob{\TR{m}{\delta,\stateQ}{\tilde{T}}}{} + m \delta \] \end{lemma} \Cref{lem:traces} allows $\tilde{T}$ to be an infinite set (because the set of states $\mathcal{Q}$ can be infinite). We reduce this case to that where $\tilde{T}$ is finite. We first recall a basic calculus property: any inequality $a \leq b$ can be proved by establishing instead $a \leq b + \epsilon$ for all $\epsilon > 0$. Then, since the probability distribution of trace fragments of length $m$ is discrete, for any $\epsilon>0$ we can always take a finite subset of the infinite set $\tilde{T}$ whose probability differs from that of $\tilde{T}$ less than $\epsilon$. It is therefore enough to consider the case where $\tilde{T}$ is finite, as done in the following lemma. \begin{lemma}\label{lem:finite-traces} If $\stateP \CSim{n}{\delta} \stateQ$ and $\tilde{T}$ is a finite set of trace fragments of length $n > 0$ starting from $\stateP$, then: \[ \prob{\tilde{T}}{} \leq \prob{\TR{n}{\delta,\stateQ}{\tilde{T}}}{} + n \delta \] \end{lemma} We prove \Cref{lem:finite-traces} by induction on $n$. In the inductive step, we partition the traces according to their first move, i.e., on their next state after $\stateP$ (for the trace fragments in $T$) or $\stateQ$ (for the bisimilar counterparts). A main challenge here is caused by the probabilities of such moves being weakly connected. Indeed, when $\stateP$ moves to $p'$, we might have several states $\stateQi$, bisimilar to $p'$, such that $\stateQ$ moves to $\stateQi$. Worse, when $\stateP$ moves to another state $p''$, we might find that some of the states $\stateQi$ we met before are also bisimilar to $p''$. Such overlaps make it hard to connect the probability of $\stateP$ moves to that of $\stateQ$ moves. To overcome these issues, we exploit the technical lemma below. Let set $A$ represent the $\stateP$ moves, and set $B$ represent the $\stateQ$ moves. Then, associate to each set element $a\in A,b\in B$ a value ($f_A(a), f_B(b)$ in the lemma) representing the move probability. The lemma ensures that each $f_A(a)$ can be expressed as a weighted sum of $f_B(b)$ for the elements $b$ bisimilar to $a$. Here, the weights $h(a,b)$ make it possible to relate a $\stateP$ move to a ``weighted set'' of $\stateQ$ moves. Further, the lemma ensures that no $b\in B$ has been cumulatively used for more than a unit weight ($\sum_{a \in A} h(a,b) \leq 1$). \begin{lemma}\label{lem:matching} Let $A$ be a finite set and $B$ be a countable set, equipped with functions $f_A: A \rightarrow \mathbb{R}_0^+$ and $f_B: B \rightarrow \mathbb{R}_0^+$. Let $g:A \rightarrow 2^B$ be such that $\sum_{b \in g(a)} f_B(b)$ converges for all $a \in A$. If, for all $A' \subseteq A:$ \begin{equation}\label{eq:matching-assumption} \sum_{a \in A'} f_A(a) \leq \sum_{b \in \bigcup_{a \in A'} g(a)} f_B(b) \end{equation} then there exists $h:A \times B \rightarrow \intervalCC 0 1$ such that: \begin{align}\label{eq:matching-thesis:1} &\forall b \in B: \sum_{a \in A} h(a,b) \leq 1 \\ \label{eq:matching-thesis:2} &\forall A' \subseteq A: \sum_{a \in A'} f_A(a) = \sum_{a \in A'} \sum_{b \in g(a)} h(a,b) f_B(b) \end{align} \end{lemma} \bartnote{Rivedere la reference nella proof, prima ce ne era una sola di label.} \begin{figure}[h] \hspace{-5mm}% \includegraphics[scale=0.7]{graph_flow.pdf} \caption{Graphical representation of \Cref{lem:matching} (left) and its proof (right).} \label{fig:matching} \end{figure} We visualize \Cref{lem:matching} in \Cref{fig:matching} through an example. The leftmost graph shows a finite set $A=\setenum{a_1,a_2,a_3}$ where each $a_i$ is equipped with its associated value $f_A(a_i)$ and, similarly, a finite set $B=\setenum{b_1,\ldots,b_4}$ where each $b_i$ has its own value $f_B(b_i)$. The function $g$ is rendered as the edges of the graph, connecting each $a_i$ with all $b_j \in g(a_i)$. The graph satisfies the hypotheses, as one can easily verify. For instance, when $A' = \setenum{a_1,a_2}$ inequality \eqref{eq:matching-assumption} simplifies to $0.3+0.5 \leq 0.5+0.6$. The thesis ensures the existence of a weight function $h(-,-)$ whose values are shown in the graph on the left over each edge. These values indeed satisfy \eqref{eq:matching-thesis:1}: for instance, if we pick $b=b_2$ the inequality reduces to $0.5+0.1\bar 6 \leq 1$. Further, \eqref{eq:matching-thesis:2} is also satisfied: for instance, taking $A'=\setenum{a_2}$ the equation reduces to $0.5 = 0.4\cdot 0.5+0.5\cdot 0.6$, while taking $A'=\setenum{a_3}$ the equation reduces to $0.2 = 0.1\bar 6\cdot 0.6+1.0\cdot 0.05+1.0\cdot 0.05$. The rightmost graph in \Cref{fig:matching} instead sketches how our proof devises the wanted weight function $h$, by constructing a network flow problem, and exploiting the well-known min-cut/max-flow theorem. We start by adding a source node to the right (white bullet in the figure), connected to nodes in $B$, and a sink node to the left, connected to nodes in $A$. We write the capacity over each edge: we use $f_B(b_i)$ for the edges connected to the source, $f_A(a_i)$ for the edges connected to the sink, and $+\infty$ for the other edges in the middle. Then, we argue that the leftmost cut $C$ shown in the figure is a min-cut. Intuitively, if we take another cut $C'$ not including some edge in $C$, then $C'$ has to include other edges making $C'$ not any better than $C$. Indeed, $C'$ can surely not include any edge in the middle, since they have $+\infty$ capacity. Therefore, if $C'$ does not include an edge from some $a_i$ to the sink, it has to include all the edges from the source to each $b_j \in g(a_i)$. In this case, hypothesis \eqref{eq:matching-assumption} ensures that doing so does not lead to a better cut. Hence, $C$ is indeed a min-cut. From the max-flow corresponding to the min-cut, we derive the values for $h(-,-)$. Thesis \eqref{eq:matching-thesis:1} follows from the flow conservation law on each $b_i$, and the fact that the incoming flow of each $b_j$ from the source is bounded by the capacity of the related edge. Finally, thesis \eqref{eq:matching-thesis:2} follows from the flow conservation law on each $a_i$, and the fact that the outgoing flow of each $a_i$ to the sink is exactly the capacity of the related edge, since the edge is on a min-cut. \section{Up-to-$n,\delta$ Bisimilarity} We now define a relation on states $q \crysim{n}{\delta} q'$ that intuitively holds whenever $q$ and $q'$ exhibit similar behavior for a bounded number of steps. The parameter $n$ controls the number of steps, while $\delta$ controls the error allowed in each step. Note that since we only observe the first $n$ steps, our notion is \emph{inductive}, unlike unbounded bisimilarity which is co-inductive, similarly to~\cite{Castiglioni16qapl}. \begin{definition}[Up-to-$n,\delta$ Bisimilarity] \label{def:param-bisim} We define the relation $q \crysim{n}{\delta} q'$ as follows by recursion on $n$: \begin{enumerate} \item $q \crysim{0}{\delta} q'$ always holds \item $q \crysim{n+1}{\delta} q'$ holds if and only if, for all $Q \subseteq \mathcal{Q}$: \begin{enumerate} \item\label{def:param-bisim:a} $\lab(q) = \lab(q')$ \item\label{def:param-bisim:b} $\tsPr{q}{Q} \leq \tsPr{q'}{\cryset{n}{\delta}{Q}} + \delta$ \item\label{def:param-bisim:c} $\tsPr{q'}{Q} \leq \tsPr{q}{\cryset{n}{\delta}{Q}} + \delta$ \end{enumerate} \end{enumerate} where $\cryset{n}{\delta}{Q} = \setcomp{q'}{\exists q\inQ.\ q \crysim{n}{\delta} q'}$ is the image of the set $Q$ according to the bisimilarity relation. \end{definition} We now establish two basic properties of the bisimilarity. Our notion is reflexive and symmetric, and enjoys a triangular property. Further it is monotonic on both $n$ and $\delta$. \begin{lemma The relation $\crysim{}{}$ satisfies: \[ q \crysim{n}{\delta} q \qquad\quad q \crysim{n}{\delta} q' \implies q' \crysim{n}{\delta} q \qquad\quad q \crysim{n}{\delta} q' \land q' \crysim{n}{\delta'} q'' \implies q \crysim{n}{\delta+\delta'} q'' \] \end{lemma} \begin{proof} Straightforward induction on $n$. \qed \end{proof} \begin{lemma}[Monotonicity] \label{lem:sim:monotonicity} \[ n \geq n' \;\land\; \delta \leq \delta' \;\land\; p \crysim{n}{\delta} q \implies p \crysim{n'}{\delta'} q \] \end{lemma} \begin{example} \label{ex:sim:padlock} We use up-to-$n,\delta$ bisimilarity to compare the behavior of the ideal padlock $q_{\sf ok}$ and the real one, in any of its states, when observed for $n$ steps. % When $n=0$ bisimilarity trivially holds, so below we only consider $n>0$. We start from the simplest case: bisimilarity does not hold between $q_{\sf ok}$ and $q_{\sf err}$. % Indeed, $q_{\sf ok}$ and $q_{\sf err}$ have distinct labels ($\lab(q_{\sf ok})=\emptyset\neq\setenum{{\sf err}}=\lab(q_{\sf err})$), hence we do not have $q_{\sf ok} \crysim{n}{\delta} q_{\sf err}$, no matter what $n>0$ and $\delta$ are. We now compare $q_{\sf ok}$ with any $q_i$. % When $n=1$, both states have an empty label set, i.e.~$\lab(q_{\sf ok})=\lab(q_i)=\emptyset$, hence they are bisimilar for any error $\delta$. % We therefore can write $q_{\sf ok} \crysim{1}{\delta} q_i$ for any $\delta\geq 0$. When $n=2$, we need a larger error $\delta$ to make $q_{\sf ok}$ and $q_i$ bisimilar. % Indeed, if we perform a move from $q_i$, the padlock can be broken with probability $1/(N-i)$, in which case we reach $q_{\sf err}$, thus violating bisimilarity. % Accounting for such probability, we only obtain $q_{\sf ok} \crysim{2}{\delta} q_i$ for any $\delta\geq 1/(N-i)$. When $n=3$, we need an even larger error $\delta$ to make $q_{\sf ok}$ and $q_i$ bisimilar. % Indeed, while the first PIN guessing attempt has probability $1/(N-i)$, in the second move the guessing probability increases to $1/(N-i-1)$. % Choosing $\delta$ equal to the largest probability is enough to account for both moves, hence we obtain $q_{\sf ok} \crysim{3}{\delta} q_i$ for any $\delta\geq 1/(N-i-1)$. % Technically, note that the denominator $N-i-1$ might be zero, since when $i=n-1$ the first move always guesses the PIN, and the second guess never actually happens. % In such case, we instead take $\delta=1$. More in general, for an arbitrary $n\geq 2$, we obtain through a similar argument that $q_{\sf ok} \crysim{n}{\delta} q_i$ for any $\delta\geq 1/(N-i-n+2)$. % Intuitively, $\delta=1/(N-i-n+2)$ is the probability of guessing the PIN in the last attempt (the $n$-th), which is the attempt having the highest success probability. % Again, when the denominator $N-i-n+2$ becomes zero (or negative), we instead take $\delta=1$. \end{example}
{'timestamp': '2021-11-08T02:02:56', 'yymm': '2111', 'arxiv_id': '2111.03117', 'language': 'en', 'url': 'https://arxiv.org/abs/2111.03117'}
arxiv
\section{Unsupervised Learning of Compositional Energy Concepts Appendix} In this supplement, we provide additional empirical visualizations of our approach in \sect{sect:emperical}. Next, we provide details on experimental setup in \sect{sect:training}. The underlying code of the paper can be found at the paper website. \begin{figure}[h] \centering \begin{minipage}{0.37 \textwidth} \centering \includegraphics[width=\linewidth]{fig/tetris_decomp.pdf} \caption{\textbf{Tetris Recombination.} Illustration of recombination of energy functions inferred by COMET\xspace on the Tetris dataset.} \label{fig:tetris_decomp} \end{minipage}\hfill \begin{minipage}{0.57\textwidth} \centering \includegraphics[width=\linewidth]{fig/lighting_object_decomp.pdf} \caption{\textbf{Light Object Decomposition.} Illustration of decomposing CLEVR Lighting scenes into separate energy functions. COMET\xspace is able to decompose a scene into lighting and constituent objects.} \label{fig:lighting_object} \end{minipage}\hfill \vspace{-10pt} \end{figure} \input{tbl/beta_vae_compare.tex} \subsection{Additional Empirical Results} \label{sect:emperical} \myparagraph{Qualitative Result.} We provide additional empirical visualizations of the results presented in the main paper section 5.2. We illustrate the permuted energy functions in Tetris in \fig{fig:tetris_decomp}, and find that we are able to successfully permute different Tetris blocks across different images. We further show that our model is able to decompose an image into both objects and lighting factors in the CLEVR Lighting dataset in \fig{fig:lighting_object}. \myparagraph{Quantitative Evaluation.} We provide an additional comparison of COMET to the $\beta$-VAE utilizing a separate codebase across 3 separate seeds in \tbl{table:disentangle_quant_betavae2}. We find that across different implementations COMET\xspace improves performance over the $\beta$-VAE. \subsection{Model and Experimental Details} \label{sect:training} \myparagraph{Dataset Details.} For the CLEVR dataset, we utilize the dataset generation code from \citep{Johnson2017CLEVR} to render images of scenes with 4 objects. For the CLEVR lighting dataset, we also utilize the code from \citep{Johnson2017CLEVR} to render the dataset but increase the lighting jitter to 10.0 for all settings. Finally, for the CLEVR toy dataset, we utilize the default CLEVR dataset generation code but replace the blend files of ``sphere'', ``cylinder'', and ``cube'' with that of ``bowling pin'', ``boot'', ``toy'' and ``truck''. \myparagraph{Architecture Details.} In COMET\xspace we utilize a residual network to parameterize an underlying energy function. We illustrate the underlying architecture of the energy function in \fig{fig:energy_function}. The energy function takes as input an image at $64 \times 64$ resolution and processes the image through a series of residual blocks combined with average pooling to obtain a final output energy. To condition the energy function on an input latent $z$, we linearly map $z$ to a separate per channel gain and bias in each residual block of the energy network, and use the resultant gain and bias vectors to modulate input features \citep{Perez2018Film}. We remove normalization layers from our residual network. To infer global factors from an input image, we utilize a convolutional encoder in \fig{fig:conv_encode}. The convolutional encoder maps an input image through a series of residual convolutional layers to obtain a set of distinct latent vectors. These resultant latent vectors are utilized to condition each separate energy function and correspond to individual global factors. To infer local object factors in a scene, we utilize a convolutional encoder in combination with a recurrent network with spatial attention. We concatenate a positional embedding to the underlying input image of scene \citep{liu2018intriguing}. We then utilize a series of 3 residual layers to downsample input images at $64 \times 64$ resolution to a lower resolution $8 \times 8$ feature grid. We utilize a LSTM with an attention mechanism \citep{Bahdanau2015Neural} to iteratively gather information from this feature grid to obtain a set of object latents representing the scene. We illustrate the overall architecture in \fig{fig:recurrent_encode}. \myparagraph{Training Details.} Models for each dataset are trained for 12 hours on a single 32GB Volta machine. Models are trained utilizing the Adam optimizer \citep{Kingma2015Adam} with a learning rate of 3e-4. We utilize 10 steps of optimization to approximate the minimal energy state of an energy function, with each gradient descent step utilizing a scalar multiplier of 1000. When training each model, the gradients are clipped to a magnitude of 1. Images are fit at $64 \times 64$ resolution, with a training batch size of 32. We utilize a latent dimension of 16 per component when extracting local factors of variation and a latent dimension of 64 when extracting global factors of variation. For global factor recombination, to obtain high-resolution results on real datasets, we utilize LPIPS loss as a replacement to MSE loss. \begin{figure}[H] \begin{minipage}{0.3\linewidth} \centering \begin{tabular}{c} \toprule \toprule 3x3 Conv2d, 64 \\ \midrule ResBlock Down 64 \\ \midrule ResBlock Down 64 \\ \midrule ResBlock Down 64 \\ \midrule Global Mean Pooling \\ \midrule Dense $\rightarrow$ 1 \\ \bottomrule \end{tabular} \captionof{table}{Architecture of energy function.} \label{fig:energy_function} \end{minipage}% \hfill \begin{minipage}{0.3\linewidth} \centering \begin{tabular}{c} \toprule \toprule 3x3 Conv2d, 64 \\ \midrule ResBlock Down 64 \\ \midrule ResBlock Down 64 \\ \midrule ResBlock Down 64 \\ \midrule Global Mean Pooling \\ \midrule Dense $\rightarrow$ 64 \\ \midrule Dense $\rightarrow$ Latents \\ \bottomrule \end{tabular} \captionof{table}{The model architecture used for the convolutional encoder.} \label{fig:conv_encode} \end{minipage}\hfill \begin{minipage}{0.3\linewidth} \centering \begin{tabular}{c} \toprule \toprule 3x3 Conv2d, 64 \\ \midrule ResBlock Down 64 \\ \midrule ResBlock Down 64 \\ \midrule ResBlock Down 64 \\ \midrule LSTM \\ \midrule Dense $\rightarrow$ 64 \\ \midrule Dense $\rightarrow$ Latents \\ \bottomrule \end{tabular} \captionof{table}{The model architecture used for the recurrent encoder used in Section 5.2 of the main paper. We utilize a LSTM which operates on the spatial output of the residual network through attention \citep{Bahdanau2015Neural}.} \label{fig:recurrent_encode} \end{minipage} \end{figure} \section*{Broader Impact} Our work is a step towards the broad goal of building a system with physical understanding of the scenes around it. A system with a broad physical understanding of its surrounding environment has many potential impacts in industrial domains such as enabling household robots that can help the elderly age in place by helping with household chores and monitoring medical treatment. On the other hand, errors in our scene understanding system, such as classifying an unstable multi-object structure as a single object, could be costly if the model were actually deployed. We do not foresee our model, as a preliminary research effort, to have any significant societal impact toward any particular group. \section*{Checklist} \begin{enumerate} \item For all authors... \begin{enumerate} \item Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? \answerYes{} \item Did you describe the limitations of your work? \answerYes{See \sect{sect:conclusion}} \item Did you discuss any potential negative societal impacts of your work? \answerYes{See \sect{sect:conclusion}} \item Have you read the ethics review guidelines and ensured that your paper conforms to them? \answerYes{} \end{enumerate} \item If you are including theoretical results... \begin{enumerate} \item Did you state the full set of assumptions of all theoretical results? \answerYes{See \sect{sect:complexity}} \item Did you include complete proofs of all theoretical results? \answerYes{See \sect{sect:complexity}} \end{enumerate} \item If you ran experiments... \begin{enumerate} \item Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? \answerYes{We provide them in the supplement. Code will be provided upon paper acceptance.} \item Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? \answerYes{We provide them in the supplement.} \item Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? \answerYes{} \item Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? \answerYes{We provide them in the supplement.} \end{enumerate} \item If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... \begin{enumerate} \item If your work uses existing assets, did you cite the creators? \answerYes{} \item Did you mention the license of the assets? \answerYes{} \item Did you include any new assets either in the supplemental material or as a URL? \answerYes{} \item Did you discuss whether and how consent was obtained from people whose data you're using/curating? \answerYes{} \item Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? \answerYes{} \end{enumerate} \item If you used crowdsourcing or conducted research with human subjects... \begin{enumerate} \item Did you include the full text of instructions given to participants and screenshots, if applicable? \answerNA{} \item Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? \answerNA{} \item Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? \answerNA{} \end{enumerate} \end{enumerate} \section{Conclusion} \label{sect:conclusion} We have demonstrated an approach towards unsupervised learning of energy functions from images. We show how these functions encode both global and local factors of variations, and how they allow for further composition across separate modalities and datasets. A limitation of our current approach is that while it can compose factors across datasets that are substantially similar, compositions across datasets such as Falcor3D and CelebA-HQ are less interpretable. We posit that this is due to a lack of diversity in the underlying training data set. An interesting direction for future work would be to to train COMET\xspace on complex, higher diversity real world datasets, and observe subsequent recombinations of energy functions. We note that, as a consequence of using deep nets, our system is susceptible to dataset bias. Care must be put in ensuring a balanced and fair dataset if COMET\xspace is deployed in practice, as it should not serve to, even inadvertently, worsen societal prejudice. \section{Evaluation} \label{sect:eval} We quantitatively and qualitatively show that COMET\xspace can recover the global factors of variation in an image in \sect{sect:global}, as well as the local factors in an image in \sect{sect:object}. Furthermore, we show that the components captured by COMET\xspace can generalize well, across separate modalities in \sect{sect:generalize}. \subsection{Global Factor Disentanglement} \label{sect:global} \input{figText/nvidia_decomp} \input{figText/nvidia_recomb} We assess the ability of COMET\xspace to decompose global factors of variation in scenes consisting of lighting and camera illumination from Falcor3D (NVIDIA high-resolution disentanglement dataset) \citep{nie2020nvidia}, scene factors of variation in CLEVR \citep{Johnson2017CLEVR}, and face attributes in real images from CelebA-HQ \citep{Karras2017Progressive}. For all experiments, we utilize the same convolutional encoder to extract sets of latents from each dataset, and utilize a latent dimension of $64$ for each separately inferred latent. We provide additional training algorithm and model architecture details in the appendix. \myparagraph{Decomposition and Reconstructions.} In \fig{fig:global_decomp}, on Falcor3D and CelebA-HQ, we illustrate the underlying image gradients of each decomposed energy function. Such gradients correspond to aspects of the input image each energy function pays attention. Through qualitative examination, we posit that the individual inferred energy functions for Falcor3D correspond to camera position, lighting direction, floor position and lighting intensity (shown from left to right in \fig{fig:global_decomp}). Such a correspondence can be seen for example by the fact that the camera position energy function exhibits sharp gradients with respect to edges in an image, while the lighting direction energy function exhibits sharp gradients with respect to the underlying shadows in an image. In a similar manner, we hypothesize that the individual inferred energy functions for CelebA-HQ correspond to hair color, background lighting, facial expression and skin color. In \fig{fig:celebahq_clevr_decomp}, we show energy function decompositions of CLEVR, where we illustrate generations when composing an increasing number of inferred energy functions. By adding individual energy functions, we find that the generation transitions from consisting only of objects, to consisting of objects \& floor to consisting of objects, floor, \& lighting. \myparagraph{Recombination.} To further verify that each individual energy function captures the expected decomposition of factors described earlier, we recombine individual energy functions representing each component in the Falcor3D and CelebA-HQ datasets in \fig{fig:nvidia_celebahq_recomb}. In the left side of \fig{fig:nvidia_celebahq_recomb}, we vary an energy function representing a single factor, while keeping the remaining factors fixed. By varying energy functions in such a manner, we are able to capture camera position, lighting direction and lighting intensity variation (with camera position variation captured by varying energy functions for both floor position and camera position). In the right side of \fig{fig:nvidia_celebahq_recomb}, we can recombine discovered energy functions representing facial expression, hair color, and background lighting of one image with that of another. We find that by recombining individual energy functions representing each individual factor, we are able to reliably swap factors across images. \input{tbl/disentangle_tbl_2} \myparagraph{Quantitative Comparison.} Finally, we evaluate the learned representations on disentanglement. In Falcor3D~\citep{nie2020nvidia}, each image corresponds to a combination of $7$ factors of variation; lighting intensity, lighting $x$, $y$ \& $z$ direction, and camera $x$, $y$ \& $z$ position. We consider three commonly used metrics for evaluation, the BetaVAE metric~\citep{Higgins2017Beta}, the Mutual Information Gap (MIG)~\citep{Chen2018Isolating}, and the Mean Correlation Coefficient (MCC)~\citep{hyvarinen2016unsupervised}. See Appendix C of~\citep{klindt2021towards} for extended descriptions of metrics. Standardized metrics in disentanglement assume flattened model latents, i.e. relate the $7$ factors of variation to the $D$-dimensional encoding of the corresponding image. However, as discussed, our method extracts sets of latents from images. We thus extract $D$ principal components from the set of latents, which we then compare with $\beta$-VAE. In \tbl{table:disentangle_quant}, we find that our approach performs better than that of $\beta$-VAE across hyperparameter settings, as well as additional baselines of MONet and InfoGAN. \subsection{Object Level Decomposition} \input{figText/clevr_object_decomp} \input{figText/tetris_object_permute} \label{sect:object} Next, we assess the ability of COMET\xspace to decompose object-level factors of variation in an image. We evaluate the ability of COMET\xspace to isolate individual tetris blocks in the Tetris dataset from \citep{greff2019multi}, and individual object segmentations in the CLEVR dataset \citep{Johnson2017CLEVR}. To bias energy functions to local object-level variations, we utilize small latent dimension ($16$), and add positional embeddings to images. To extract repeated object-level structure in an image, we utilize a recurrent network as our encoder, similar to prior unsupervised object discovery work \citep{burgess2019monet}. We provide additional training algorithm and model architecture details for each experimental setup in the appendix. \myparagraph{Decomposition and Reconstructions.} We illustrate object-level decomposition of individual energy functions on CLEVR and Tetris in \fig{fig:clevr_tetris_object_decomp}. In both settings, we find that individual energy functions correspond to the underlying objects in the scene. On CLEVR, while in \fig{fig:celebahq_clevr_decomp} we obtain global factor decompositions, by biasing our energy function to object level decompositions we obtain individual cube decompositions in \fig{fig:clevr_tetris_object_decomp}. \myparagraph{Combinatorical Recombination.} We next consider recombining inferred object components. In \fig{fig:clevr_generalize} (left), we combine energy functions for individual CLEVR objects across two separate scenes. We find that by combining 8 energy functions corresponding to 4 objects from separate images, we are able to successfully generate an image containing all 8 objects, and with some consistency with respect to occlusion. In contrast, objects composed together through MONET do not respect occlusion, as they are represented as disjoint segmentation masks. \input{figText/clevr_component_generalize} \input{figText/data_recomb_multimodal_inference} \myparagraph{Quantitative Comparisons.} For quantitative comparison with MONET, we create approximate segmentation masks per energy function in CLEVR by thresholding the gradients (illustrated in \fig{fig:clevr_tetris_object_decomp}) of the energy function. We find that our approach obtains an ARI \citep{greff2019multi} of $0.916$ and a mean segmentation covering of 0.713. In contrast, we find MONET obtains an ARI of $0.873$ and a mean segmentation covering of 0.701. \myparagraph{Decompositions of Global and Object Level Factors.} COMET\xspace is distinct from previous approaches for unsupervised decomposition in that it is able to decompose both global and local factors of variation. We find that we are further able to \textit{control} the capture of either a particular global or local factor. In particular, we find that by conditioning a particular energy function with a positional embedding added to the image \citep{liu2018intriguing} and a small latent dimension we may effectively bias a energy function to capture an object factor of the scene. In contrast, a larger latent size biases an energy function to capture a global factor of the scene. In \tbl{tbl:ablation}, we investigate the extent of these two effects in enabling the capture of local factors in CLEVR as measured by ARI. We find that the addition of utilizing both small latent dimension and positional embedding enable more effective decomposition of underlying object factors. \input{tbl/ablation} By selectively enabling ourselves to specify both the underlying global and local factors of a scene, we may obtain an unsupervised decomposition of a scene with both local and global factors of variation. To test this, we render a novel dataset, \emph{CLEVR Lighting}, by increasing the lighting variation in CLEVR (illustrated in \fig{fig:clevr_generalize} (right)), and train COMET\xspace to infer $5$ separate energy functions. We encourage the first energy function to capture a global factor of variation by removing the positional embedding from the first inferred energy function. In such a setting, we find COMET\xspace successfully infers lighting as the first energy function, and individual objects for the subsequent components, which we illustrate in the appendix. We present recombinations of these inferred components in \fig{fig:clevr_generalize} (right). A limitation of our approach is that that lighting and object factors of variations are not completely disentangled. For example, in the the top row, the permuted reconstruction of the image has incorrect lighting in the center. \subsection{Compositional Factor Generalization} \label{sect:generalize} Finally, we assess the ability of components inferred from COMET\xspace to generalize. We study two separate settings of generalization. We first evaluate the ability of components to generalize to multi-modal inputs by training COMET\xspace to decompose images drawn from both CelebA-HQ and Danbooru datasets \citep{anime}, as well as KITTI \citep{Geiger2012Are} and Virtual KITTI \citep{cabon2020vkitti2} datasets. We next assess the ability of components from COMET\xspace to compose with a separate instance of COMET\xspace. We train separate COMET\xspace models on CLEVR, CLEVR Lighting and an additional novel dataset, \emph{CLEVR Toy}, which is rendered by replacing sphere/cylinder/cube objects with pin/boot/toy/truck objects. \myparagraph{Cross Dataset Recombination.} COMET\xspace may compose inferred components from one dataset with components discovered by a separate COMET\xspace trained on a separate dataset. We validate this in \fig{fig:data_recomb} (left), where we recombine components specifying objects in CLEVR and CLEVR Toy. In \fig{fig:data_recomb} (right), we further recombine components specifying objects in CLEVR with components specifying objects \& lighting in CLEVR Lighting. \myparagraph{Cross Modality Decomposition and Recombination.} We assess COMET\xspace decompositions on multi-modal datasets of Danbooru/CelebA-HQ and KITTI/Virtual KITTI in \fig{fig:multimodal_row}. We find consistent decomposition of components between separate modes. Furthermore, we find that these components may be recombined between the separate modalities in \fig{fig:multimodal_recombination}. \input{figText/multimodal} \input{figText/multimodal_recombinations} \vspace{-5pt} \section{Introduction} Human intelligence is characterized by its ability to learn new concepts, such as the manipulation of a new tool from only a few demonstrations \citep{Allen29302}. Essential to this capability is the composition and re-utilization of previously learned concepts to accomplish the task at hand \citep{lake2017building}. This is especially apparent in natural language, which is often described as a tool for making `infinite use of finite means' \citep{chomsky1965}. Previously acquired words can be infinitely nested using a set of grammatical rules to communicate an arbitrary thought, opinion, or state one is in. In this work, we are interested in constructing a system that can discover, in an unsupervised manner, a broad set of these compositional components, as well as subsequently combine them across distinct modalities and datasets. For obtaining such decompositions, two separate lines of work exist. The first focuses on obtaining global, holistic, compositional factors by situating data points, such as human faces, in an underlying (fixed) factored vector space \citep{vedantam2017generative,higgins2017scan}. Individual factors, such as emotion or hair color, are represented as independent dimensions of the vector space, with recombination between factors corresponding to the recombination of the underlying dimensions. Due to the fixed dimensionality of the vector space, multiple instances of a single factor, such as lighting, may not be combined, nor can individual factored vector spaces from separate datasets be combined, i.e. the facial expression in an image from one dataset, and the background lighting in an image from another. To address this weakness, a separate line of work decomposes a scene into a set of underlying `object' factors. Each object factor represents a separate set of pixels in an image, as defined by a disjoint segmentation mask \citep{van2018case,greff2019multi}. Such a representation allows for the composition of individual factors by compositing the segmentation masks. However, by explicitly constraining the decomposition to be in terms of disjoint segmentation masks, relationships between individual factors of variation become more difficult to represent and capture global factors describing a scene. \input{figText/teaser} In this work, we propose instead to decompose a scene into a set of factors represented as \textit{energy functions}. An individual energy function represents a factor by assigning low energy to scenes with said factor and high energy to scenes where said factor is absent. A scene is then generated by optimizing the sum of energies for all factors. Multiple factors can be composed together, by summing the energies for each individual factor. Simultaneously, these individual factors are defined across the entire scene, allowing energy functions to represent global factors (lighting, camera viewpoint) and local factors (object existence). Our work is inspired by recent work \citep{du2020compositional} which shows that energy based models may be utilized to represent flexible compositions of both global and local factors. However, while \citep{du2020compositional} required supervision, as labels were used to represent concepts, we aim to decompose and discover concepts in an unsupervised manner. In our approach, we discover energy functions from separate data points by enforcing compositions of these energy functions to recompose data. Our work is further inspired by the ability of humans to effortlessly and reliably combine concepts gathered from disparate experiences. As a separate benefit of our approach, we show that we may take components inferred by one instance of our model trained on one dataset, and compose it with other components inferred by other instances of our model trained on separate datasets. We provide analysis showing why our approach, COMET\xspace\footnote{short for COMposable Energy neTwork}, is favorable compared to existing unsupervised approaches for decomposing scenes. We contribute the following: First, we show COMET\xspace provides a unified framework enabling us to decompose images into both global factors of variation as well as local factors of variation. Second, we show that COMET\xspace enables us to scale to more realistic datasets than previous work. Finally, we show that components obtained by COMET\xspace generalize well, and are amenable to compositions across different modes of data, and with components discovered by other instances of COMET\xspace. \section{Composable Energy Networks} \vspace{-5pt} \input{figText/method} Let $\mathcal{D} = \{X\}$ be a set of images ${\bm{x}} \in \mathbb{R}^D$. Our goal is to obtain a set $Z$ of components $\{{\bm{z}}_0, {\bm{z}}_1, \ldots, {\bm{z}}_k\}$ for each image ${\bm{x}}$ representing the underlying factors of variation in the image, where each component ${\bm{z}} \in \mathbb{R}^M$. We first discuss how we represent $Z$ as a set of energy functions in \sect{sect:comp}. We then discuss how COMET\xspace learns to decompose data in an unsupervised manner into a set of components in \sect{sect:unsup_decomp}. \vspace{-5pt} \subsection{Composing Factors of Variation as Energy Functions} \label{sect:comp} In prior work for decomposing images into a set of components $Z$, approaches such as $\beta$-VAE \citep{Higgins2017Beta} utilize a parameterized, non-adaptive, feedforward decoder to map the set of components to an image. Due to this, the method is unable to compose multiple instances of the same component or a larger number of components then seen during training. On the other hand, approaches such as MONET \citep{burgess2019monet} utilize a decoder with shared weights to process each individual component. Unfortunately, the components are decoded independently, preventing relationships between individual components from being captured. To flexibly and generically compose a set of components $Z$, we require an approach that (1) utilizes a decoder that is shared across each component, such that variable-sized sets of components may be encoded, while also (2) decodes components jointly such that the relationships between individual components are covered. To construct an approach with the aforementioned desiderata, we propose to represent each component ${\bm{z}}$ as an energy function. We illustrate our approach and its differences from prior work in \fig{fig:method}. \myparagraph{Representing Components as Energy Functions.} Given a single component ${\bm{z}}$, we encode the factor using an energy function $E_\theta({\bm{x}}, {\bm{z}}): \mathbb{R}^D \times \mathbb{R}^M \rightarrow \mathbb{R}$, which is learned to assign low energy to all images ${\bm{x}}$ which contain the component and high energy to all other images. To obtain an image ${\bm{x}}'$ with a component ${\bm{z}}$, we solve for the expression ${\bm{x}}' = \argmin_{{\bm{x}}}E_{\theta}({\bm{x}}; {\bm{z}}_i)$. Note that in contrast to prior work composing energy functions \citep{du2020compositional}, our energy functions have no probabilistic interpretation. \myparagraph{Composing Energy Functions.} Given multiple components, we represent a set of components $\{{\bm{z}}_i\}$ by performing a summation $\sum_i E_\theta({\bm{x}}, {\bm{z}}_i)$ over each component's energy function. To obtain an image ${\bm{x}}'$ for the set of components $Z$, we solve for the expression ${\bm{x}}' = \argmin \limits_{{\bm{x}}} \sum_i E_{\theta}({\bm{x}}; {\bm{z}}_i)$. While both COMET\xspace and MONET rely on summation as a tool for composing components, MONET sums components in the image domain, while COMET\xspace sums the cost functions representing each component together. By summing cost functions, each component may combine with other components in a non-linear manner, enabling us to model more complex relationships between individual components. As a result, our generation ${\bm{x}}'$ is the byproduct of jointly minimizing each individual energy function $E_\theta({\bm{x}}, {\bm{z}}_i)$, and thus our generation contains each component. In addition, each individual component $z_i$ is parameterized by the same energy function $E_\theta$, enabling us to model a different number of components. \subsection{Unsupervised Decomposition of Composable Energy Functions} \label{sect:unsup_decomp} We next discuss how COMET\xspace discovers a set of composable energy functions from an input image ${\bm{x}}_i$. In \sect{sect:comp}, we discuss that a set of components $Z = \{{\bm{z}}_i\}$ may be encoded as a set of composable energy functions using the expression $\argmin_{{\bm{x}}} \sum_i E_{\theta}({\bm{x}}; {\bm{z}}_i)$. To discover the set of components $Z$ in an unsupervised manner, we train by recomposing the input image ${\bm{x}}_i$ \begin{equation} \mathcal{L}_{\text{MSE}}(\theta) = \| \argmin \limits_{{\bm{x}}} ( \sum_k E_{\theta}({\bm{x}}; \text{Enc}_\theta({\bm{x}}_i)[k]) ) - {\bm{x}}_i \|^2. \end{equation} We utilize a learned neural network encoder $\text{Enc}_\theta({\bm{x}}_i)$ to infer a set of components ${\bm{z}}_k$. In practice, evaluating the expression $ \argmin_{{\bm{x}}} \sum_k E_{\theta}({\bm{x}}; \text{Enc}_\theta({\bm{x}}_i)[k])$, is computationally intractable. We thus approximate the $\argmin$ operation with respect to ${\bm{x}}$ via $N$ steps of gradient optimization, with an approximate optimum ${\bm{x}}_i^N$ obtained as \begin{equation} {\bm{x}}_i^N = {\bm{x}}_i^{N-1} - \lambda \nabla_{{\bm{x}}} \sum_k E_{\theta} ({\bm{x}}_i^{N-1}; \text{Enc}_\theta({\bm{x}}_i)[k]). \label{eqn:opt_mult} \end{equation} \input{figText/pseudocode} In the above expression, we initialize optimization of ${\bm{x}}_i^0$ with uniform noise with $\lambda$ representing the step size for each gradient step. Sample ${\bm{x}}_i^n$ denotes the result after $n$ steps of gradient descent. We train our energy function $E_\theta$ using the modified objective $\mathcal{L}_{\text{MSE}} = \sum_{n=1}^{N} \| {\bm{x}}_i^n - {\bm{x}}_i \|^2$, where we minimizing MSE w.r.t ${\bm{x}}_i^n$. To train parameters of $E_\theta$ we use automatic differentiation to compute gradients with respect to each optimization step depicted in \eqn{eqn:opt_mult}, where for training stability, we truncate gradient backpropogation to the previous time step. We provide pseudocode for training our model in Algorithm \ref{alg:comet}. While the approach is simple, we find that it performs favorably in both global disentanglement as well as object-level disentanglement, and requires no additional objectives or priors to shape underlying latents. We utilize the same energy architecture $E_\theta$ throughout all experiments, and present details in the appendix. \myparagraph{Controlling Local and Global Decompositions.} In many scenes, both global and local factor decompositions are valid. To control the decomposition obtained by COMET\xspace, we bias the system towards inferring local factor decompositions by utilizing i) low latent dimensionality and ii) positional embeddings \citep{liu2018intriguing}, both of which have been used in previous object discovery works \citep{burgess2019monet}. This bias serves to encourage and enable models to focus on local patches of an image. We provide analysis of the effect of each inductive bias on the decomposition in \sect{sect:object}. \section{Complexity Analysis of Energy Function Compositions} \label{sect:complexity} In this section, we provide complexity-theoretic motivation for composing functions together using energy functions. Let $Z$ denote a set of components, with individual components ${\bm{z}}_1, \dots, {\bm{z}}_K \in \mathbb{R}^M$. Let $\mathcal{F}$ be the space of functions $f \colon Z \rightarrow \mathbb{R}^D$ for mapping sets of components to an output vector ${\bm{x}}$. We consider two subspaces for $\mathcal{F}$. \myparagraph{Composition of Energy Functions.} Let $\mathcal{F}_{\text{energy}} \subseteq \mathcal{F}$ be the subspace of functions of the form $\argmin_{\bm{x}} \sum_{1 \leq k \leq K} E({\bm{x}}, {\bm{z}}_k)$, where each $E({\bm{x}}, {\bm{z}}_m)$ is a function from $\mathbb{R}^{D} \times \mathbb{R}^M \rightarrow \mathbb{R}$. This subspace corresponds to the set of compositions realized by COMET\xspace. \myparagraph{Composition of Segmentation Masks.} We next consider the subspace of functions $\mathcal{F}_{\text{mask}} \subseteq \mathcal{F}$ consisting of functions $f$ of the form $\sum_{1 \leq k \leq K} m_k({\bm{z}}_k) f_k({\bm{z}}_k)$ where $f({\bm{z}}): \mathbb{R}^M \rightarrow \mathbb{R}^D$ and $m_k({\bm{z}}_k): \mathbb{R}^M \rightarrow \{0, 1\}^D$. Here, $m_k({\bm{z}}_k)$ represents a segmentation mask in $\mathbb{R}^D$. This composition is used in object decomposition methods, such as \citep{burgess2019monet,greff2019multi}. We first show that compositions of energy functions are more expressive than compositions of segmentation masks. \begin{theorem} The subspace $\mathcal{F}_{\text{energy}}$ is a strict superset of the subspace $\mathcal{F}_{\text{mask}}$. \end{theorem}% \vspace{-15pt} \begin{proof} Any function of the form $\sum_{{\bm{z}} \in \bm{Z}} m_k({\bm{z}}) f({\bm{z}})$ is equivalent to $\argmin_{\bm{x}} \sum_{{\bm{z}} \in \bm{Z}} E'({\bm{x}}, {\bm{z}})$, where $E'({\bm{x}}, {\bm{z}}) = m_k({\bm{z}}) ({\bm{x}} - f({\bm{z}}))^2$, so $\mathcal{F}_{\text{mask}} \subseteq \mathcal{F}_{\text{energy}}$. In the other direction, note that according to the definition of $\mathcal{F}_{\text{mask}}$, the presence of a particular component ${\bm{z}}_i$ assigns a fixed value to the output for the nonzero entries of $m_k({\bm{z}}_k) f({\bm{z}}_k)$, irrespective of the value of the other components. In contrast, the optimal value of ${\bm{x}}$ in $\mathcal{F}_{\text{energy}}$ depends on the value of all components. A constructive example of this is the set of energy functions over one-dimensional ${\bm{x}}$ where $E(x, {\bm{z}}_1) = (x-2)^2$, $E(x, {\bm{z}}_2) = (x-3)^2$, $E(x, {\bm{z}}_3) = (x-4)^2$. Thus, we have that $\argmin_x E(x, {\bm{z}}_1) + E(x, {\bm{z}}_2) \ne \argmin_x E(x, {\bm{z}}_1) + E(x, {\bm{z}}_3)$. Therefore, there are functions in $\mathcal{F}_{\text{energy}}$ that are not in $\mathcal{F}_{\text{mask}}$. \end{proof} % \vspace{-10pt} Next, we show that even in the setting in which we represent a single component ${\bm{z}}$, learning a function to approximate $E({\bm{x}}, {\bm{z}})$ is more computationally efficient than learning a function $f({\bm{z}})$ that approximates $\argmin_{\bm{x}} E({\bm{x}}, {\bm{z}})$. Intuitively, an energy function $E({\bm{x}}, {\bm{z}})$ can be seen as a verifier of a set of constraints, with the value of $E({\bm{x}}, {\bm{z}})$ being low when all constraints are satisfied. Approximating the function $\argmin_{\bm{x}} E({\bm{x}}, {\bm{z}})$ corresponds to generating a solution given a set of constraints, which is well-known in complexity theory to be much harder than verifying the constraints. Thus, to enable formal analysis of $E({\bm{x}}, {\bm{z}})$, we reduce the 3-SAT \citep{impagliazzo_paturi_1999} problem to an energy function $E({\bm{x}}, {\bm{z}})$. Given a 3-SAT formula $\phi$ with $D$ variables and $K$ clauses, we encode $\phi$ using an energy function $E({\bm{x}}, {\bm{z}}) := \sum_{1 \leq k \leq K} e_k({\bm{x}}, {\bm{z}}[k])$, where, ${\bm{x}}$ encodes an assignment to all the variables, ${\bm{z}}[k]$ represents the dimensions of ${\bm{z}}$ encoding the $k^{\text{th}}$ clause, and each $e_k$ is a function which has energy $0$ if the assignment ${\bm{x}}$ satisfies the $k^{\text{th}}$ clause, and has energy $1$ otherwise. To encode a clause using ${\bm{z}}[k]$, we utilize an ordinal representation (e.g. ${\bm{z}} = [1, 2, 3]$ to represent the clause $(x_1 \land x_2 \land x_3)$), and round non-integer coordinates of ${\bm{x}}$ and ${\bm{z}}$ to the nearest integer. We assume the Exponential Time Hypothesis (ETH)\citep{impagliazzo_paturi_1999}, which states that checking the satisfiability of a $3$-SAT formula takes time exponential in the sum of the number of variables and the number of clauses. \begin{theorem} There exists an energy function $E({\bm{x}}, {\bm{z}}_1)$ which can be evaluated at any input in time polynomial in the number of dimensions of ${\bm{x}}$ but for which the computational complexity of evaluating $f({\bm{z}}) := \argmin_{{\bm{x}}} E({\bm{x}}, {\bm{z}}_1)$ is (worst-case) exponential in the number of dimensions of ${\bm{x}}$. \end{theorem} \vspace{-15pt} \begin{proof} If we utilize the 3-SAT energy function $E({\bm{x}}, {\bm{z}})$ defined above. ETH implies that solving the 3-SAT problem, corresponding to computing $f({\bm{z}}) = \argmin_{{\bm{x}}} E({\bm{x}}, {\bm{z}}_1)$, is exponential in dimension of ${\bm{x}}$. In contrast, evaluating each entry of our defined $E({\bm{x}}, {\bm{z}}_1)$ is polynomial in dimension of ${\bm{x}}$. \end{proof} \vspace{-10pt} Our remark shows that it is computationally advantageous to learn an energy function $E({\bm{x}}, {\bm{z}})$ as opposed to a decoder $f({\bm{z}})$. To realize the exponential number of computations needed to compute $f({\bm{z}})$, significantly more capacity is necessary to represent $f({\bm{z}})$ in comparision to $E({\bm{x}}, {\bm{z}})$. We further show that as we compose multiple 3-SAT energy functions together, learning a decoder $f({\bm{z}}_1, \ldots, {\bm{z}}_k) := \argmin_{\bm{x}} \sum_k E({\bm{x}}, {\bm{z}}_k)$ that represents the optimization process scales exponentially with the number of energy components. \begin{theorem} There exists a composition of energy functions $\sum_k E({\bm{x}}, {\bm{z}}_k)$ which can be evaluated in time polynomial in the number of components $k$, but for which the computational complexity for evaluating $f({\bm{z}}_1, \ldots, {\bm{z}}_k) := \argmin_{\bm{x}} \sum_k E({\bm{x}}, {\bm{z}}_k)$ is (worst-case) exponential in the components of components $k$. \end{theorem} \vspace{-15pt} \begin{proof} Given $k$ separate 3-SAT energy functions $E({\bm{x}}, {\bm{z}}_k)$, minimizing the composed energy function, $f({\bm{z}}_1, \ldots, {\bm{z}}_k)=\argmin_{\bm{x}} \sum_k E({\bm{x}}, {\bm{z}}_k)$ corresponds to solving all 3-SAT encoded clauses across $k$ energy functions. ETH implies the computational complexity of evaluating $f({\bm{z}}_1, \ldots, {\bm{z}}_k)$ is exponential in $k$ while the evaluation of $k$ energy functions is polynomial in $k$. \end{proof} \vspace{-10pt} Here as well, to represent the exponential number of computations, significantly more capacity is necessary to realize the computation $f({\bm{z}}_1, \ldots, {\bm{z}}_k)$, which scales with the number of components $k$, in comparison to $\sum_k E({\bm{x}}, {\bm{z}}_k)$. Thus, remark 2 and 3 show that it can be efficient, from a learning perspective, to decode individual datapoints with energy functions. \section{Related Work} Our work is related to research in the areas of global factor disentanglement~\citep{Higgins2017Beta,burgess2018understanding,rolinek2019variational,Chen2018Isolating,locatello2020weakly,klindt2021towards} and independent component analysis (ICA)~\citep{comon1994independent,bell1995information,hyvarinen2016unsupervised,hyvarinen2017nonlinear,hyvarinen2018nonlinear,khemakhem2020variational,khemakhem2020ice,roeder2020linear,zimmermann2021contrastive}. Work in said areas focus on discovering an underlying global latent space which describes the input space. In contrast, we decompose data into a set of compositional vector spaces. This enables our approach to compose multiple instances of one factor together, as well as compose factors across distinct datasets. Our work is also related to a large body of existing work on unsupervised object discovery \citep{greff2017neural,burgess2019monet,greff2019multi,Eslami2016Attend, crawford2019spatially, du2021unsupervised, van2018relational,kosiorek2018sequential,eslami2018neural, veerapaneni2019entity,stanic2019r,Engelcke2020GENESIS,locatello2020objectcentric}. Such methods seek to decompose the scene into its underlying compositional objects by independently segmenting out each individual object in the scene. In contrast, our approach represents individual objects without the need of an explicit segmentation mask, enabling our approach to represent global relations between objects. Our work draws on recent work in energy based models (EBMs) \citep{kim2016deep, song2018learning, du2019implicit, xie2016theory, nijkamp2019anatomy, grathwohl2019your, du2021improved, gao2020flow}. Our underlying energy optimization procedure to generate samples is reminiscent of Langevin sampling, which is used to sample from EBMs \citep{xie2016theory, du2019implicit, nijkamp2019anatomy}. Most similar to our work is that of \citep{du2020compositional}, which proposes composing EBMs for compositional visual generation. Different from \citep{du2020compositional}, we study how we may discover factors in an unsupervised manner from data. \section{Appendix} \end{document}
{'timestamp': '2021-11-05T01:22:20', 'yymm': '2111', 'arxiv_id': '2111.03042', 'language': 'en', 'url': 'https://arxiv.org/abs/2111.03042'}
arxiv
\section*{APPENDIX} \section*{ACKNOWLEDGMENT} We are grateful for Ing. Róbert Szász Sr.'s support in editing the video material accompanying this paper. \bibliographystyle{IEEEtran} \section{Introduction} \label{sec:introduction} Unmanned aerial vehicles are able to greatly extend the workspace of a robotic arm~\cite{2021-BodTogSie}, which opens up new possibilities in aerial object manipulation and transportation~\cite{2021g-OllTogSuaLeeFra}. However, the major shortcoming of rigid robot arms is their limited capability to interact with humans. The lack of compliance and smooth motions forces these robots to operate in well-structured and fenced-off environments. In regards to the floating base, common quadcopters and hexacopters with fixed propellers are underactuated due to the orientation of their thrusters in the same direction, which makes the modeling and control more complex when using them as the flying base for such aerial manipulators. We propose the combination of a soft robotic arm mounted on a fully actuated Omnidirectional Micro Aerial Vehicle (OMAV)~\cite{allenspach_OMAV} (see \Cref{fig:coulped_system}) to tackle these challenges and to counteract the deficiencies of current aerial manipulators. \begin{figure}[t] \centering \includegraphics[width = .9\columnwidth]{dwg/7_drone_tasks_with_picture.pdf} \caption{Visualisation of the coupled flying platform consisting of the OMAV and the soft robotic arm used for the controlled simulations. The coordinate frame $\mathcal{B}$ is body-fixed with its origin at OMAV's center of mass and axis aligned with OMAV main inertia axis. The coordinate frame $\mathcal{E}$ is fixed to the tip of the end-effector. When the end-effector is in its fully straight configuration, the frame $\mathcal{E}$ is rotated by 180-degrees around the y-axis with respect to the frame $\mathcal{B}$. The bottom row of images shows some of the possible application areas of such a system: construction, goods delivery, human assistance, maintenance, and warehouse automation.\label{fig:coulped_system}} \vspace{-10pt} \end{figure} Robotics researchers have tried in recent years to improve physical human-robot interactions for rigid robots by introducing compliance to their structure, either directly in the joints~\cite{hwisu_compliance_joint}, in the links~\cite{dissertation_compliant_links}, or in the control software~\cite{schumacher2019_compliant_control}. Analogously, compliant joints were proposed for robots mimicking animals~\cite{hutter_starleth_compliance_actuator}. Controlling these advanced rigid-bodied robots in an optimal and robust fashion opens up new challenges and patterns~\cite{hutter_starleth_compliance_control}. The aforementioned issues and considerations on the lack of inherent compliance gave rise to the emergence of soft robotics. Soft robotics concentrates on building robots that mimic nature as close as possible. As opposed to ``\emph{classical}'' robotics, soft robotics shifts paradigms in the areas of material selection, actuator design, fabrication, and construction. A direct counterpart to the conventional rigid robot arms is a controllable soft continuum arm~\cite{katzschmann2015softarm2D}. A follow up work~\cite{katzschmann2020softarm2Dcontrol} extended the notions to model-based feedback control both in parameter-space and Cartesian operational-space, enhancing the capabilities of such soft arms. The soft continuum arms were recently elevated from 2D to 3D using either a model-based feedback control approach based on an Augmented Rigid Body Model (ARBM)~\cite{katzschmann2019softarm3Dcontrol}, or a reduced-order finite element method model based on proper orthogonal decomposition and a state observer~\cite{katzschmann2019softarm3DFEM}. Similar to classical rigid-bodied systems, the workspace of the soft robotic arm can be extended by mounting it to a flying robot. Instead of choosing a traditional drone, we liberate the soft arm from its fixed base by mounting it to an OMAV for increased dexterity and maneuverability as seen in \Cref{fig:coulped_system}. An OMAV, as opposed to commercially available quadcopters and hexacopters with fixed propeller orientation toward the same direction, is a fully actuated flying system and is capable of exerting forces and torques in any arbitrary direction~\cite{2021f-HamUsaSabStaTogFra}. This feature not only allows the soft continuum arm to move from a confined workspace to the free space -- theoretically reaching any point with any arbitrary orientation in 3D-space -- but also makes the control more robust and agile. The OMAV contributes to the agility and flexibility of such a flying platform and the exchange of the rigid robot arm with a soft arm adds the desired compliance and inherent safety that cannot be achieved otherwise. This platform opens a still unexplored solution in the current scenario of aerial manipulation. In this paper, we derive a mathematical model from the PCC and ARBM approach and unify it with a floating base robot. Moreover, we propose a hierarchical task-prioritizing controller architecture that enables the user to intuitively define high-level tasks in the operational space. The proposed architecture is able to regulate the system to a fixed point, track a trajectory with a given orientation, and exploit the nullspace of the high-priority tasks to execute additional non-interfering background motions. Consequently, this work contributes with: \begin{itemize} \item A mathematical parametrisation and model of the unified flying platform consisting of the OMAV and the soft robotic arm; \item A hierarchical task-prioritising controller capable of tracking trajectories while exploiting the nullspace of the higher priority tasks; \item A validation of the hierarchical controller in various simulations, such as nullspace motion, disturbance recovery and trajectory tracking. \end{itemize} \section{Background} We give an overview of the relevant modeling approaches for soft continuum manipulators with focus on the PCC and ARBM hypotheses and the state-of-the-art control methods. We then introduce the aerial robotic research field to motivate our choice in using an OMAV. \subsection{Soft continuum modeling} \label{sec:softroboticarm} \begin{figure} \centering \includegraphics[width = .7\columnwidth]{dwg/PCC.pdf} \caption{Illustration of the aerial manipulator and the Piecewise Constant Curvature (PCC) arm. The PCC arm is composed of four constant curvature (CC) segments. Frame $\{S_0\}$ denotes the base of the soft robot, while frame $\{S_i\}$ is attached to the end of the current segment and thus the start of the next segment. $T_{i-1}^i$ is the homogeneous transformation mapping from $\{S_{i - 1}\}$ to $\{S_i\}$. The drone's frame is denoted by $\mathcal{B}$ and the end-effector's frame is $\{S_4\}=\{\mathcal{E}\}$. Note that the actual system used in the simulation has six CC segments instead of the four presented here. \label{fig:PCC_ex}} \end{figure} Since soft actuators show high flexibility and compliance, they virtually possess infinite degrees of freedom (DOF), which is challenging from the modeling perspective. Researchers have proposed various techniques for dimensional reduction to render the challenge feasible, for example the \textit{Ritz-Galerkin} models for continuum manipulators~\cite{sadati2018control} and the \textit{Cosserat} approach for soft robots~\cite{renda2017discrete}. In this paper we use the PCC and ARBM hypotheses. The PCC model approximates the segments of a soft robotic arm with constant bending curvature and treats it as one piece. An example is presented in \Cref{fig:PCC_ex} for a four-way segmented soft arm. While PCC is merely a kinematic approximation, previous works \cite{katzschmann2015softarm2D, katzschmann2019softarm3Dcontrol, katzschmann2020softarm2Dcontrol} have confirmed the validity and efficacy of this approach in closed-loop controlled real-world scenarios. The advantage of the PCC and ARBM approach is that modeling approaches and control architectures from the rigid body literature can be directly applied to continuum arms with little effort. For the sake of brevity, we do not include here the fundamentals of PCC and ARBM, but we refer the interested reader to~\cite{katzschmann2020softarm2Dcontrol,katzschmann2019softarm3Dcontrol} for a more detailed derivation of this modeling technique. \subsection{Omnidirectional micro aerial vehicle (OMAV)} \label{sec:omav} OMAV aims to eliminate the underactuated system-characteristics thus empowering these flying vehicles with full motion range, six DOF and decoupled controllability between the translational and rotational dynamics. To obtain such property, different designs have been presented in~\cite{dandrea_omav} and~\cite{ryll_omav}. In this paper we consider a general tilt-rotor OMAV construction optimized for flight efficiency and large payload capacity, which was introduced and modeled in~\cite{siegwart_OMAV}. To be able to exploit the abilities of such an agile machine, previous works developed suitable controllers focusing on maneuverability while maintaining flight efficiency at the same time. Decoupling the translation and rotational dynamics while still ensuring robust control made it possible to deploy and use the OMAV for more practical tasks, like contact-based inspections~\cite{siegwart_OMAV_force_control,2019e-TogTelGasSabBicMalLanSanRevCorFra}. The variable propeller tilting together with the aforementioned controller resulted in an increase in the system's capabilities and maneuverability compared to the fixed-propeller quadrotor or hexarotor. For example, hovering in an arbitrary pose is possible with an OMAV but cannot be achieved with propellers having a fixed tilt angle and facing the same direction (as seen in the classical commercial-grade quad- and hexacopters). Naturally, the modeling and controlling of an OMAV is significantly more challenging than that of a quad- or hexarotor due to the increased capabilities and complexity. \begin{figure}[t] \centering \subfigure[]{\label{fig:pcc_transform}\includegraphics[width=.35\linewidth]{dwg/pcc_transform.pdf}} \subfigure[]{\label{fig:augmentation}\includegraphics[width=.55\linewidth]{dwg/rigid_link_model.pdf}} \caption{PCC augmentation and modeling of the segments. (a) Parametrisation and transition between two consecutive curvatures. (b) The extended rigid-body augmentation using 7 joints. Compared to previous works, the two additional joints - $\xi_{m1}$ and $\xi_{m2}$ - account for location of the center of mass off the centerline and thus add an additional degree of matching accuracy. Illustrations are adapted and extended from \cite{yasu2021sopra}.} \end{figure} \subsection{Unified flying platform with a manipulator} \label{sec:flyingplatform} To the best of our knowledge, there is currently not any work that discusses the control of a flying manipulator consisting of an flying platform and a \emph{soft} robotic arm manipulator. Most research in this field headed towards the direction of controlling a \emph{n}-joint \emph{rigid} body manipulator arm mounted on a \emph{quadcopter}, although most recent works started to explore rigid-body arms mounted on omnidirectional vehicles as well. Even though we use a soft-robot arm on the flying platform, our hierarchical control architecture is inspired by rigid-arms, such as~\cite{kannan_control_uav_operational_space}, where a 2-joint rigid link arm manipulator was mounted on a drone. The proposed hierarchical control structure consisted of the outermost closed-loop inverse kinematics algorithm layer and a position and attitude control loop inner layer. The results showed that the controller was stable and efficient with satisfactory performance. \cite{caccavale_control_uav_robot_arm} demonstrated a similar control structure for a 5 DOF arm, further analysing and proving the stability mathematically. A more closely related work is \cite{fishman2021softdrone}, a quadrotor equipped with a soft tendon-driven grasping mechanism attached to it. The control is conducted with an optimisation-based approach consisting of two submodules, separately optimizing for the quadrotor trajectory and the soft gripper movement. Our aim is to combine and extend the previous approaches: we build upon the novel tiltrotor OMAV architecture and combine it with the soft continuum arm, we find a PCC/ARBM-supported unified parametrization and we design an analytic model-based hierarchical feedback controller. \section{Model} In this section, we propose a framework for modeling the dynamics of soft robots, linking it to an equivalent rigid robot constrained through a set of nonlinear integrable constraints. The key property of the model is to define a perfect matching under the hypothesis of piecewise constant curvature, enabling the application of control strategies typically used in rigid robots onto soft robots. \subsection{Kinematics} \label{sec:kinematics} In the Piecewise Constant Curvature (PCC) model, the infinite dimensionality of the soft robot's configuration is resolved by considering the robot's shape as composed of a fixed number of segments with constant curvature (CC), merged such that the resulting curve is everywhere differentiable. Consider a PCC soft robot composed by $n$ CC segments, and consider a set of reference systems $\{S_0\},\dots,\{S_n\}$ attached at the ends of each segment. Fig.~\ref{fig:PCC_ex} presents an example of a soft robot composed by four CC segments. \begin{figure} \centering \includegraphics[width = .6\columnwidth]{dwg/PCC} \caption{Example of a Piecewise Constant Curvature robot, composed by four constant curvature elements. $\{S_0\}$ is the robot's base frame. A reference frame $\{S_i\}$ is connected at the end of each segment. $T_{i-1}^i$ is the homogeneous transformation mapping $\{S_{i - 1}\}$ into $\{S_i\}$.} \end{figure} Using the constant curvature hypothesis, ${S_{i-1}}$ and ${S_{i}}$ fully define the configuration of the $i\--th$ segment. Thus, the robot's kinematics can be defined by $n$ homogeneous transformations $T_{0}^1,\dots,T_{n-1}^n$, which map each reference system to the subsequent one. In the interest of conciseness, we will consider the planar case. Please refer to \cite{webster2010design} for more details about the PCC kinematics in 3D case. \begin{figure} \centering \includegraphics[width = .85\columnwidth]{dwg/segment_c.png} \caption{Kinematic representation of the i\--th planar constant curvature segment. Two local frames are placed at the two ends of the segment, $\{S_{i-1}\}$ and $\{S_{i}\}$ respectively. The length of the segment is $L_i$, and $q_i$ is the degree of curvature. \label{fig:CC_seg}} \end{figure} Fig.~\ref{fig:CC_seg} shows the kinematics of a single CC segment. Under the hypothesis of non-extensibility, one variable is sufficient to describe the segment's configuration. We use the relative rotation between the two reference systems, called the degree of curvature, as the configuration variable. Let us call this variable $q_i$ for the $i\--th$ segment. Then, the $i\--th$ homogeneous transformation can be derived using geometrical considerations as \begin{equation} \label{eq:T} T_{i-1}^i(q_i) = \begin{bmatrix} \cos(q_i) &-\sin(q_i) &L_i\frac{\sin(q_i)}{q_i} \\ \sin(q_i) &\cos(q_i) &L_i\frac{1 - \cos(q_i)}{q_i} \\ 0 &0 &1 \\ \end{bmatrix} \; , \end{equation} where $L_i$ is the length of a segment. \subsection{Dynamically-Consistent Augmented Formulation} \label{sec:augmented} An equivalent formulation of Eq.~\eqref{eq:T} in terms of elemental Denavit-Hartenberg (DH) transformations is introduced in \cite{hannan2003kinematics}. The framework we propose in this section leverages the intuition that such equivalence implicitly defines a connection between a soft robot and a rigid robot described by the equivalent DH-parametrization. Fig.~\ref{fig:augmented_robots} shows an example of robotic structures (an RPR robot) matching a single CC segment. More complex rigid structures matching a generic PCC soft robot can be built by connecting such basic elements. We will refer to the state space of the equivalent rigid robot as the \textit{augmented state representation} of the PCC soft robot. We call $\xi \in \mathbb{R}^{n\,m}$ the augmented configuration, where $m$ is the number of joints per CC segment and $n$ is the number of segments. The two configurations are connected through the continuously differentiable map \begin{equation} m: \mathbb{R}^{n} \rightarrow \mathbb{R}^{n\,m} \, . \end{equation} The map $\xi = m(q)$ assures that the end points of each CC segment coincide with the corresponding reference points of the rigid robot. Note that from a kinematic point of view, any augment representation satisfying this condition is equivalent. However, as soon as we consider the dynamics of the two robots, another constraint has to be taken into account: the inertial properties of the augmented and the soft robot must be equivalent. We thus ensure that the inertial properties are equivalent by matching the centers of mass of each CC segment by an equivalent point mass in the rigid robot structure. Considering a point mass placed in the middle of the main chord as a suitable approximation of the mass distribution of the CC segment, a dynamically consistent DH parametrization is described in Tab.~\ref{tab:DH2}. The segment map is \begin{equation}\label{eq:m_ex} m_i(q_i) = \begin{bmatrix} \frac{q_i}{2}\\ L_i \frac{\sin(\frac{q_i}{2})}{q_i} \\ L_i \frac{\sin(\frac{q_i}{2})}{q_i} \\ \frac{q_i}{2} \end{bmatrix} \; . \end{equation} We show a graphical representation of this robot in Fig.~\ref{fig:augmented_robots_m}. A generic PCC continuous soft robot can always be matched to a dynamically consistent rigid robot, built as a sequence of these RPPR elements. We present in Fig.~\ref{fig:PCC_eq} an equivalent rigid formulation for the PCC soft robot of Fig.~\ref{fig:PCC_ex}. The robot's configurations are connected by the map \begin{equation}\label{eq:m} m(q) = \begin{bmatrix} m_1(q_1)\mathrm{^T} \quad \ldots \quad m_n(q_n)\mathrm{^T} \end{bmatrix}^{\mathrm{T}} \; . \end{equation} \begin{table}[ht] \centering \caption{Description of the rigid robot equivalent to a single CC segment. The parameters $\theta$, $d$, $a$, $\alpha$ refer to the classic DH parametrization, while $\mu$ refers to the mass. \label{tab:DH2}} \begin{tabular}{cccccc} \hline Link &$\theta$ &d &a &$\alpha$ &$\mu$ \\ \hline $1$ &$\dfrac{q_i}{2}$ &0 &0 &$\dfrac{\pi}{2}$ &0 \\ $2$ &$0$ &$L_i \, \dfrac{\sin(\frac{q_i}{2})}{q_i}$ &0 &0 &$\mu_i$ \\ $3$ &$0$ &$L_i \, \dfrac{\sin(\frac{q_i}{2})}{q_i}$ &0 &$-\dfrac{\pi}{2}$ &0 \\ $4$ &$\dfrac{q_i}{2}$ &0 &0 &$0$ &0 \\[5pt] \hline \end{tabular} \end{table} \begin{figure} \centering \subfigure[RPR]{\includegraphics[width = .47\columnwidth]{dwg/segment_dh_1}\label{fig:augmented_robots}} \subfigure[RPPR]{\includegraphics[height = .45\columnwidth]{dwg/segment_dh}\label{fig:augmented_robots_m}} \caption{Two examples of augmented robots kinematically consistent with a planar CC segment. Several of these basic elements can be connected to obtain a kinematically consistent representation of a PCC soft robot. % Of the two examples only (b) takes into account the positioning of the mass of the segment, which is here placed in the middle of the chord, i.e. mass concentrated at the two ends of the segment. \label{fig:augmented_robots_dyn}} \end{figure} \begin{figure} \centering \includegraphics[width = .59\columnwidth]{dwg/PCC_eq} \caption{Example of augmented state representation of a four segment PCC soft robot. Each segment has mass $\mu_i$ and it is actuated through a torque $\tau_i$. \label{fig:PCC_eq}} \end{figure} \subsection{Dynamics} Consider the dynamics of the augmented rigid robot \begin{equation}\label{eq:xidyn} B_{\xi}(\xi)\ddot{\xi} + C_{\xi}(\xi,\dot{\xi})\dot{\xi} + G_{\xi}(\xi) = \tau_{\xi} + J_{\xi}^T(\xi) f_{\mathrm{ext}} \, , \end{equation} where $\xi$, $\dot{\xi}$, $\ddot{\xi}$ is the robot configuration with its derivatives, $B_{\xi}$ is the robot's inertia matrix, $C_{\xi}\dot{\xi}$ collects Coriolis and centrifugal terms, $G_{\xi}$ takes into account the effect of gravity on the robot. The robot is subject to a set of control inputs $\tau_{\xi}$, and a set of external wrenches $f_{\mathrm{ext}}$, mapped through the Jacobian $J_{\xi}$. To express Eq.~\eqref{eq:xidyn} on the sub\--manifold implicitly identified by $\xi = m(q)$, we evaluate the augmented configuration derivatives $\xi$, $\dot{\xi}$, w.r.t. $q$, $\dot{q}$, $\ddot{q}$ \begin{equation} \label{eq:xi} \begin{cases} \xi &= m(q) \\ \dot{\xi} &= J_{\mathrm{m}}(q) \dot{q} \\ \ddot{\xi} &= \dot{J}_{\mathrm{m}}(q,\dot{q}) \dot{q} + J_{\mathrm{m}}(q) \ddot{q} \; . \end{cases} \end{equation} where $J_{\mathrm{m}}(q): \mathbb{R}^{n} \rightarrow \mathbb{R}^{n \, m \times n}$ is the Jacobian of $m(\cdot)$, defined in the usual way as $J_{\mathrm{m}} = \frac{\partial m}{\partial q}$. For example, when $m_i(q)$ is defined as in \eqref{eq:m}, the Jacobian is \begin{equation}\label{eq:Jm} J_{\mathrm{m},i}(q_i) = \begin{bmatrix} \frac{1}{2} \quad L_{c,i}(q_i) \quad L_{c,i}(q_i) \quad \frac{1}{2} \end{bmatrix}^{\mathrm{T}} \end{equation} where $L_{c,i}(q_i) = L_i \, \frac{q_i \, \cos(\frac{q_i}{2}) - 2 \, \sin(\frac{q_i}{2})}{2 \, q_i^2}$. By substituting \eqref{eq:xi} into \eqref{eq:xidyn}, it follows \begin{equation} \begin{split} B_{\xi}&(m(q)) (\dot{J}_{\mathrm{m}}(q,\dot{q}) \dot{q} + J_{\mathrm{m}}(q) \ddot{q}) \\ &+ C_{\xi}(m(q),J_{\mathrm{m}}(q) \dot{q})J_{\mathrm{m}}(q) \dot{q} + G_{\xi}(m(q)) \\ &= \tau_{\xi} + J_{\xi}^T(m(q)) f_{\mathrm{ext}} \, . \end{split} \end{equation} This generalized balance of forces can be projected into the constraints through pre\-multiplication with $J_{\mathrm{m}}^{T}(q)$. This yields the compact dynamics \begin{equation}\label{eq:soft_robot_dynamics} \begin{split} B(q)\ddot{q} + C(q,\dot{q})\dot{q} + G_{\mathrm{G}}(q) = \tau + J^T(q) f_{\mathrm{ext}} \, , \end{split} \end{equation} where \begin{equation}\label{eq:js_m_def} \begin{cases} B(q) &= J_{\mathrm{m}}^T(q) \, B_{\xi}(m(q)) \, J_{\mathrm{m}}(q) \\ C(q,\dot{q}) &= J_{\mathrm{m}}^T(q) \, B_{\xi}(m(q)) \, \dot{J}_{\mathrm{m}}(q,\dot{q}) \\ & + J_{\mathrm{m}}^T(q) \, C_{\xi}(m(q),J_{\mathrm{m}}(q) \dot{q}) \, J_{\mathrm{m}}(q) \\ G_{\mathrm{G}}(q) &= J_{\mathrm{m}}^T(q) \, G_{\xi}(m(q))\\ \tau &= J_{\mathrm{m}}^T(q) \, \tau_{\xi} \\ J(q) &= J_{\xi}(m(q)) \, J_{\mathrm{m}}(q) \end{cases} \end{equation} Note that the terms in \eqref{eq:xidyn} can be efficiently formulated in an iterative form, as discussed in \cite{featherstone2014rigid}. The soft robotic model \eqref{eq:soft_robot_dynamics} inherits this property through \eqref{eq:js_m_def}. We complete \eqref{eq:soft_robot_dynamics} by introducing linear elastic and dissipative terms. The resulting model describing the evolution of the soft robot's degree of curvature $q$ in time is \begin{equation}\label{eq:soft_robot_dynamics_tot} B\ddot{q} + (C + D)\dot{q} + G_{\mathrm{G}} + K\,q = \tau + J^T f_{\mathrm{ext}} \, , \end{equation} where $D$ is the damping and $K$ is the stiffness. Note that the dependencies of $q,\dot{q},\ddot{q}$ were omitted for the sake of space. \section{Augmented Model Formulation} We resolve the infinite dimensionality of a soft robot through the Piecewise Constant Curvature (PCC) model by considering the robot's shape as composed of a fixed number of segments with constant curvature (CC), merged such that the resulting curve is everywhere differentiable, see Fig.~\ref{fig:PCC_ex}. \begin{figure} \centering \subfigure[]{\includegraphics[height = .59\columnwidth,trim = {5 0 45 0},clip]{dwg/PCC}\label{fig:PCC_ex}} \hspace{0.005\columnwidth} \subfigure[]{\includegraphics[height = .59\columnwidth,trim = {5 0 45 0},clip]{dwg/PCC_eq}\label{fig:PCC_ex_eq}} \caption{Example of a PCC model for a soft robot, composed by four constant curvature elements. Panel (a) shows the robot kinematics. $\{S_0\}$ is the robot's base frame. A reference frame $\{S_i\}$ is attached at the end of each segment. $T_{i-1}^i$ is the homogeneous transformation mapping $\{S_{i - 1}\}$ into $\{S_i\}$. Panel (b) presents the augmented state representation of the soft robot through rigid elements. Each segment has mass $\mu_i$ and it is actuated through a torque $\tau_i$.} \end{figure} We describe the relative rotation of the $i\--$th segment between the two adjacent reference systems through the configuration variable $q_i$. We propose to describe the PCC soft robot (as e.g. Fig. \ref{fig:PCC_ex}), through an equivalent rigid robot with an augmented state space (as e.g. Fig. \ref{fig:PCC_ex_eq}). The rigid robot is such that the end points of each CC segment coincide with the correspondent reference point of the rigid robot. We also ensure that the inertial properties are equivalent by matching the centers of mass of each CC segment by an equivalent point mass in the rigid robot structure. In this way we assure an exact equivalence of the rigid robot behavior and the soft robot, within the PCC hypothesis. The dynamics of the augmented rigid robot is \begin{equation}\label{eq:xidyn} B_{\xi}(\xi)\ddot{\xi} + C_{\xi}(\xi,\dot{\xi})\dot{\xi} + G_{\xi}(\xi) = J_{\xi}^T(\xi) f_{\mathrm{ext}} \, , \end{equation} where $\xi$, $\dot{\xi}$, $\ddot{\xi} \in \mathbb{R}^{n m}$ is the robot configuration with its derivatives, $B_{\xi}\in \mathbb{R}^{n m \times n m}$ is the robot's inertia matrix, $C_{\xi}\dot{\xi}\in \mathbb{R}^{n m}$ collects Coriolis and centrifugal terms, $G_{\xi}\in \mathbb{R}^{n m}$ takes into account the effect of gravity on the robot. The robot is subject to a set of external wrenches $f_{\mathrm{ext}}$, mapped through the Jacobian $J_{\xi}$. We evaluate the soft robot dynamics by imposing a set of nonlinear constraints $\xi = m(q)$, assuring the above described matching between end points and the point masses. The following set of equations results \begin{equation} \begin{split} B_{\xi}(m(q)) (\dot{J}_{\mathrm{m}} \dot{q} + J_{\mathrm{m}} \ddot{q}) + C_{\xi}(m(q),J_{\mathrm{m}} \dot{q})J_{\mathrm{m}} \dot{q} + G_{\xi}(m(q)) \\ = J_{\xi}^T(m(q)) f_{\mathrm{ext}} \, , \end{split} \end{equation} where $J_{\mathrm{m}}(q): \mathbb{R}^{n} \rightarrow \mathbb{R}^{n \, m \times n}$ is the Jacobian of $m(\cdot)$. This generalized balance of forces can be projected into the constraints $\xi = m(q)$ by pre\--multiplication with $J_{\mathrm{m}}^{T}(q)$. This yields the compact dynamics \begin{equation}\label{eq:soft_robot_dynamics} \begin{split} B(q)\ddot{q} + C(q,\dot{q})\dot{q} + G_{\mathrm{G}}(q) = J^T(q) f_{\mathrm{ext}} \, , \end{split} \end{equation} where \begin{equation}\label{eq:js_m_def} \begin{cases} B(q) &= J_{\mathrm{m}}^T(q) \, B_{\xi}(m(q)) \, J_{\mathrm{m}}(q) \\ C(q,\dot{q}) &= J_{\mathrm{m}}^T(q) \, B_{\xi}(m(q)) \, \dot{J}_{\mathrm{m}}(q,\dot{q}) \\ & + J_{\mathrm{m}}^T(q) \, C_{\xi}(m(q),J_{\mathrm{m}}(q) \dot{q}) \, J_{\mathrm{m}}(q) \\ G_{\mathrm{G}}(q) &= J_{\mathrm{m}}^T(q) \, G_{\xi}(m(q))\\ J(q) &= J_{\xi}(m(q)) \, J_{\mathrm{m}}(q) \end{cases} \end{equation} We complete \eqref{eq:soft_robot_dynamics} by introducing elastic and dissipative terms and consider the soft robot actuated through a pair of internal torques for each segment. Thus, the complete model is \begin{equation}\label{eq:soft_robot_dynamics_tot} B(q)\ddot{q} + (C(q,\dot{q}) + D)\dot{q} + G_{\mathrm{G}}(q) + K\,q = \tau + J\mathrm{^T}(q) f_{\mathrm{ext}} \, , \end{equation} where $D \succ 0$ is the damping and $K \succ 0$ is the stiffness. \section{Model} The model shall leverage all six DOF of the OMAV. Therefore, we propose a unified extended floating-base parametrisation for the coupled system. This choice is analogous to the frequently used rigid-body counterpart, as described for example in \cite{nakanishi2007floatingbase}. The soft continuum arm is modeled using the PCC and ARBM hypotheses. These hypotheses are based on the assumptions of non-extensible curvature segments and constant curvature along each one of these segments. The PCC approximation offers a suitable one-to-one mapping between the kinematic properties of non-extensible and constant curvature segments and a real-world soft continuum arm segment. The ARBM approach the real-world arm dynamics by describing an \emph{augmented} rigid-robot space with rigid links connecting translational and rotational joints~\cite{katzschmann2018softarm2Dcontrol}. Each segment has its own set of parameters $\theta$ for the bending angle and $\phi$ for the off-plane rotation in the PCC space (see \Cref{fig:pcc_transform}). To match the kinematic and dynamic profile of the soft continuum arm, a suitable rigid-body augmentation is required. A trade-off between computational costs resulting from model complexity and modeling accuracy puts limitations on the potential configuration of the chosen rigid-body robot acting dynamically equivalent to the soft arm. In this paper, we propose a 7-joint rigid robot configuration, which builds upon and extends the 5-joint parametrisation presented in \cite{yasu2021sopra}. Without $\xi_{m1}$ and $\xi_{m2}$, the mass would have to lie on the virtual line connecting the start and end point of a PCC segment. Adding these two extra joints helps to extend the system's capability by more accurately representing the shift of the center of mass of the soft arm during bending (see \Cref{fig:augmentation}). \begin{figure}[t] \centering \includegraphics[width = .65\columnwidth]{dwg/augmentation_full.pdf} \caption{Three PCC segments overlaid with their augmentations. \label{fig:augmentation_full}} \end{figure} In previous work~\cite{katzschmann2020softarm2Dcontrol,katzschmann2019softarm3Dcontrol}, one PCC element was mapped to one actuated segment of the soft continuum arm. However, we decided to take a more recent approach~\cite{yasu2021sopra} and increase the fidelity of simulation by modeling the actuated segments $N_{seg}=2$ each with $N_{PCC}=3$ PCC elements, summing up to a total of $N_{seg}*N_{PCC}*N_{aug}=2*3*7 = 42$ joints. The augmentation of one actuated segment is shown in \Cref{fig:augmentation_full}. This step increases the accuracy of the model at the cost of higher computational demands. Note that the variables $N_{seg}$, $N_{PCC}$, and $N_{aug}$ determine the dimensions of the \emph{augmented} space. The augmented soft continuum arm is extended with a floating base, \emph{i.e.}, the OMAV. The OMAV is modeled as a mass point with given mass and inertia properties. To represent rotations without a singularity, we use the quaternion elements $\xi_{quat_i}, i \in \{w,x,y,z\}$. The state of the system results in the following parametrisation vector: \begin{equation}\label{eq:parametrisation} \bm{\xi}= \begin{bmatrix} \bm{\xi}_{base}\\ \xi_{x_1}\\ \xi_{y_1}\\ ... \\ \xi_{m2_6} \end{bmatrix}= \begin{bmatrix} \bm{\xi}_{quat_{OMAV}}\\ \bm{\xi}_{pos_{OMAV}}\\ \xi_{x_1}\\ \xi_{y_1}\\ ... \\ \xi_{m2_6} \end{bmatrix} \bm{\dot{\xi}}= \begin{bmatrix} \prescript{}{\mathcal{B}}{\bm{\omega}_{IB}} \\ \prescript{}{\mathcal{B}}{\bm{v}} \\ \dot{\xi}_{x_1}\\ \dot{\xi}_{y_1}\\ ... \\ \dot{\xi}_{m2_6} \end{bmatrix} \bm{\ddot{\xi}}= \begin{bmatrix} \prescript{}{\mathcal{B}}{\bm{\dot{\omega}}_{IB}} \\ \prescript{}{\mathcal{B}}{\bm{a}} \\ \ddot{\xi}_{x_1} \\ \ddot{\xi}_{y_1} \\ ... \\ \ddot{\xi}_{m2_6} \end{bmatrix} \; , \end{equation} where $\bm{\xi}_{pos_{OMAV}} \in \mathbb{R}^{3}$ represents the Cartesian coordinates of the OMAV's centre of mass, while $\bm{v} \in \mathbb{R}^{3}$ and $\bm{a} \in \mathbb{R}^{3}$ are the first and second derivative of this quantity with respect to time. The vector $[\xi_{x_i}, \xi_{y_i}, \xi_{z_i}, \xi_{{l1}_i}, \xi_{{l2}_i}, \xi_{{m1}_i}, \xi_{{m2}_i}]^T \in \mathbb{R}^7, i \in {1...6}$ denotes the augmentation of the constant curvature segments, as depicted in \Cref{fig:augmentation}. The calligraphic prescripts -- $\mathcal{B}$ refers to the body-fixed coordinate system attached to the center of mass of the OMAV and axis aligned with main axis of inertia, and $\mathcal{I}$ is the inertial coordinate frame -- denotes the coordinate system, in which the quantity is described. The double subscript in $\bm{\omega}_{IB} \in \mathbb{R}^{3}$ denotes the angular velocity of the $\mathcal{B}$ coordinate frame with respect to the inertial frame $\mathcal{I}$ and $\bm{\dot{\omega}}_{IB} \in \mathbb{R}^{3}$ represents the angular acceleration. Note in \eqref{eq:parametrisation} that the parametrisation vector $\bm{\xi} \in \mathbb{R}^{N_{seg}*N_{PCC}*7+7}=\mathbb{R}^{49}$, and the first and second derivative terms are from the vector space $\bm{\dot{\xi}},\bm{\ddot{\xi}} \in \mathbb{R}^{48}$. This is due to the choice of a singularity-free rotation representation using quaternions with 4 elements. Transforming the hybrid platform to the augmented rigid-robot space enables a fast and straightforward derivation of the Jacobian matrix for an arbitrary fixed-point $Q$ in the body coordinate system: \begin{equation}\label{eq:jacobian} \begin{split} & \prescript{}{\mathcal{I}}{\bm{r}}_{IQ}=\prescript{}{\mathcal{I}}{\bm{r}}_{IB}+\bm{C}_{IB}\prescript{}{\mathcal{B}}{\bm{r}}_{BQ} \\ & \prescript{}{\mathcal{I}}{\bm{v}}_{Q}=\prescript{}{\mathcal{I}}{\bm{v}}_{B}+\dot{\bm{C}}_{IB}\prescript{}{\mathcal{B}}{\bm{r}}_{BQ}+\bm{C}_{IB}\prescript{}{\mathcal{B}}{\dot{\bm{r}}}_{BQ} \\ & \prescript{}{\mathcal{I}}{\bm{v}}_{Q}=\bm{C}_{IB}\prescript{}{\mathcal{B}}{\bm{v}}_{B}-\bm{C}_{IB}\begin{bsmallmatrix}\prescript{}{\mathcal{B}}{\bm{r}}_{BQ} \end{bsmallmatrix}_{\times}\prescript{}{\mathcal{B}}{\bm{\omega}}_{IB}+\bm{C}_{IB}\prescript{}{\mathcal{B}}{\bm{J}}_{Q}\dot{\xi}_j \end{split} \raisetag{2\normalbaselineskip} \end{equation} where ${\bm{r}}_{IB} \in \mathbb{R}^{3}$ denotes a vector from the origin $I$ of the inertial frame to the origin of the floating-base body-fixed frame $B$, $\prescript{}{\mathcal{B}}{\bm{J}}_{Q} \in \mathbb{R}^p$ is the local Jacobian written in the body-fixed coordinate frame, and $\bm{\dot{\xi}}_j \in \mathbb{R}^p$ is the time derivative of the robot parametrisation vector without the floating-base ($p$ denotes the number of joints). For the sake of brevity, the dependency of the terms on $\bm{\xi}$ was omitted. From the last equation, the Jacobian is $\prescript{}{\mathcal{I}}{\bm{J}}_Q(\xi)= \begin{bsmallmatrix} \bm{C}_{IB}(\xi) & -\bm{C}_{IB}(\xi)\begin{bsmallmatrix}\prescript{}{\mathcal{B}}{\bm{r}}_{BQ}(\xi) \end{bsmallmatrix}_{\times} & \bm{C}_{IB}(\bm{\xi})\prescript{}{\mathcal{B}}{\bm{J}}_{Q} \end{bsmallmatrix}$, where $\bm{C}_{IB} \in \mathbb{R}^{3 \times 3}$ is the rotation matrix of the body-frame with respect to the inertial frame and $\begin{bsmallmatrix}\bm{u}\end{bsmallmatrix}_{\times}$ denotes the cross-product skew symmetric matrix created from the vector $\bm{u}$. With the Jacobian, the inertia matrix $\bm{B}_{\xi}(\bm{\xi}) \in \mathbb{R}^{(N_{seg}*N_{PCC}*7 + 6) \times (N_{seg}*N_{PCC}*7 + 6)}=\mathbb{R}^{48 \times 48}$, Coriolis and centrifugal vector $\bm{c}_{\xi}(\bm{\dot{\xi}}, \bm{\xi}) \in \mathbb{R}^{N_{seg}*N_{PCC}*7 + 6}=\mathbb{R}^{48}$, and the gravitational field vector $\bm{g}_{\xi}(\bm{\xi}) \in \mathbb{R}^{N_{seg}*N_{PCC}*7 + 6}=\mathbb{R}^{48}$ can be derived in the augmented formulation using the equations (3.43), (3.44) and (3.45) from~\cite{robot_dynamics_lecture_notes_eth}. \begin{Remark} Instead of parameterizing the constant curvature segments with the off-plane rotation $\phi$ and bending angles $\theta$ as shown in \Cref{fig:pcc_transform}, an alternative parameterization composed of $\theta_x, \theta_y$ taken from \cite{yasu2021sopra} is applied: \begin{equation}\label{eq:theta_theta_parametrisation} \begin{split} \theta_x := \theta \cos{\phi} \\ \theta_y := \theta \sin{\phi} \end{split} \end{equation} which avoids a singularity when the soft continuum arm is in its straight configuration. This parametrization is used later for the state vector $\bm{q}$. \end{Remark} The bridging between the augmented rigid-body space and the PCC space is described with the set of equations (11) from~\cite{katzschmann2019softarm3Dcontrol}: \begin{equation} \label{eq:xi} \begin{cases} \bm{\xi} &= m(\bm{q}) \\ \bm{\dot{\xi}} &= \bm{J}_{\mathrm{m}}(\bm{q}) \bm{\dot{q}} \\ \bm{\ddot{\xi}} &= \bm{\dot{J}}_{\mathrm{m}}(\bm{q},\bm{\dot{q}}) \bm{\dot{q}} + \bm{J}_{\mathrm{m}}(\bm{q}) \bm{\ddot{q}} \end{cases} \end{equation} where $\bm{q} \in \mathbb{R}^{19}$ is the coupled system's parametrisation in the PCC space consisting of the $\theta_x, \theta_y$ parameters for the $N_{seg}*N_{PCC}=2*3=6$ PCC segments, the 4 quaternion elements, and the 3 Cartesian coordinates of the floating base. $m(\cdot): \mathbb{R}^{19} \rightarrow \mathbb{R}^{49}$ maps the PCC parametrisation to the augmented space and $\bm{J}_{\mathrm{m}}(\bm{q}) \in \mathbb{R}^{48 \times 18}$ is the Jacobian of $m(\cdot)$, \emph{i.e.}, $\frac{\partial m}{\partial \bm{q}}$. Its upper-left $6 \times 6$ sub-matrix affecting the OMAV parametrisation from one space to the other is the identity matrix, since the mapping is one-to-one. Using the mapping above, the PCC and ARBM assumptions \cite{katzschmann2019softarm3Dcontrol} define the system-matrices as follows: \begin{equation}\label{eq:system_matrices} \begin{cases} \bm{B}(\bm{q}) &= \bm{J}_{\mathrm{m}}^T(\bm{q}) \, \bm{B}_{\xi}(m(\bm{q})) \, \bm{J}_{\mathrm{m}}(\bm{q}) \\ \bm{c}(\bm{q},\bm{\dot{q}}) &= \bm{J}_{\mathrm{m}}^T(\bm{q}) \, \bm{c}_{\xi}(m(\bm{q}), \bm{J}_{\mathrm{m}}(\bm{q})\bm{\dot{q}}) \\ \bm{g}(\bm{q}) &= \bm{J}_{\mathrm{m}}^T(\bm{q}) \, \bm{g}_{\xi}(m(\bm{q}))\\ \bm{J}(\bm{q}) &= \bm{J}_{\xi}(m(\bm{q})) \, \bm{J}_{\mathrm{m}}(\bm{q}) \end{cases} \end{equation} where $\bm{B}_{\xi}, \bm{c}_{\xi}, \bm{g}_{\bm{\xi}}$ and $\bm{J}_{\xi}$ are augmented space quantities and have dimensions as described above. Finally, the dynamics of the coupled system are given as (for the full derivation please refer to \cite{katzschmann2018softarm2Dcontrol}): \begin{equation}\label{eq:soft_robot_dynamics} \begin{split} \bm{B}(\bm{q})\bm{\ddot{q}} + \bm{c}(\bm{q}, \bm{\dot{q}}) + \bm{g}(\bm{q}) + \bm{K} \bm{\Tilde{q}} + \bm{D} \bm{\dot{q}} = \\ \bm{\Tilde{A}}_{\alpha} \bm{\Omega} + \bm{S}_{\mathrm{sel}} \bm{A} \bm{p} + \bm{J}^T(\bm{q}) \bm{f}_{\mathrm{ext}} \end{split} \end{equation} which is analogous to the standard rigid-body formulation. With $n=18$, $\bm{B}(\bm{q}) \in \mathbb{R}^{n \times n}$ is the inertia matrix, $\bm{c}(\bm{q}, \bm{\dot{q}}) \in \mathbb{R}^{n}$ is the vector containing the Coriolis and centrifugal terms, $\bm{g}(\bm{q})$ is the gravitational force equivalent. The stiffness of the soft continuum arm is considered in the stiffness matrix $\bm{K} \in \mathbb{R}^{n \times n}$ and the damping effects are expressed by the damping matrix $\bm{D} \in \mathbb{R}^{n \times n}$. For the exact derivation and calculation of the stiffness and damping, please refer to \cite{yasu2021sopra} section \emph{III. C}. Both matrices have an upper-left $6 \times 6$ block of zeros to account for the lack of stiffness or damping in the equations of motion of the OMAV. Note that the stiffness matrix is multiplied with a modified state vector $\bm{\Tilde{q}} \in \mathbb{R}^{18}$. Since the first 6 elements of the vector are affected by the zero block of the stiffness matrix, the values in the modified state vector are irrelevant and thus set to zero, \emph{i.e.}, $[\mathrm{0}_{1 \times 6}, \theta_{x_1}, \theta_{y_1}, \theta_{x_2}, \theta_{y_2} \dotsc]^T$. This multiplication is necessary because the dimensions of the matrix multiplication would be inconsistent otherwise. $\bm{J}^T(\bm{q})$ is responsible for mapping external forces $\bm{f}_{\mathrm{ext}}$ from the operational space to the joint space. The OMAV rotor force generation and the soft robotic arm pressure actuation is on the right hand side of \eqref{eq:soft_robot_dynamics}. The expanded expression for the modified allocation matrix is $\bm{\Tilde{A}}_{\alpha} := \bm{J}_{\mathrm{m}}^T \, \bm{J}_{\mathrm{S}}^T \, \bm{A}_{\alpha} \in \mathbb{R}^{n \times w}$, where $w$ is the number of rotors. The squared rotor speeds $\bm{\Omega} \in \mathbb{R}^w$ multiplied with the instantaneous allocation matrix $\bm{A}_{\alpha}$ results in the body forces and torques, as described by (7) in \cite{allenspach_OMAV}. The wrench is mapped to the augmented rigid-body space with the OMAV center of mass Jacobian $\bm{J}_{\mathrm{S}} \in \mathbb{R}^{6 \times (N_{seg}*N_{PCC}*7 + 6)}$. The last step is the transition from the augmented space to the PCC space, which is carried out using the space mapping Jacobian $\bm{J}_{\mathrm{m}}$. The actuation inclusion of the soft continuum arm in the mathematical description follows analogously. $\bm{A} \in \mathbb{R}^{(n - 6) \times 6}$ is the conversion matrix between the chamber pressures and generalized forces, which acts on the pressure input $\bm{p} \in \mathbb{R}^6$ and is derived in \cite{yasu2021sopra}. Since the pressurisation of the soft arm chamber disregards the OMAV's equation of motions, a selection matrix $\bm{S}_{\mathrm{sel}} \in \mathbb{R}^{n \times (n - 6)}$ is required to transform the input vector to the correct dimensions. To keep the mathematical consistency of the derivation, $\bm{S}_{\mathrm{sel}}$ is composed of two blocks: the upper $6 \times (18 - 6)$ region affecting the OMAV's DOFs are zero, while the lower $(18 - 6) \times (18 - 6)$ is the identity matrix. \section{Control Design} \label{sec:control} In the following, we present our proposed controller design for curvature-based dynamic control and Cartesian impedance control with surface following. The uncertainty introduced by the PCC and the hypothesis on the mass distribution must be properly managed by algorithms designed to be robust to model uncertainties. We thus avoid the use of complete feedback cancellations of the robot's dynamics, as well as other kinds of control actions that presented issues with robustness in classical robots, such as pre\--multiplications of feedback actions by the inverse of the inertia matrix \cite{nakanishi2008operational,sciavicco2012modelling}. \subsection{Curvature Dynamic Control} We propose the following controller for implementing trajectory following in the soft robot's state space \begin{equation}\label{eq:joint_space_control} \tau = K \bar{q} + D \dot{\bar{q}} + C(q,\dot{q})\dot{\bar{q}} + B(q)\ddot{\bar{q}} + G_{\mathrm{G}}(q) + I_{\mathrm{q}} \int (\bar{q} - q) \end{equation} where $q,\dot{q},\ddot{q}$ are the degree of curvature vector and its derivatives. $\bar{q},\dot{\bar{q}},\ddot{\bar{q}}$ are the desired evolution and its derivatives expressed in the degree of curvature space. $B$ is the robot's inertia, $C$ is the Coriolis and centrifugal matrix, $K$ and $D$ are respectively the robot's stiffness and damping matrices. The constant $I_{\mathrm{q}}$ is the gain of the integral action. The resulting form of the closed loop system is \begin{multline} B(q)(\ddot{q} - \ddot{\bar{q}}) + C(q,\dot{q})(\dot{q} - \dot{\bar{q}}) - J^T(q) f_{\mathrm{ext}}\\ = K (\bar{q} - q) + I_{\mathrm{q}} \int (\bar{q} - q) + D (\dot{\bar{q}} - \dot{q}) \, . \end{multline} The feed-forward action $K \bar{q} + D \dot{\bar{q}}$ is combined with the physical impedance of the system, generating a natural proportional-derivative (PD) action $K (\bar{q} - q) + D (\dot{\bar{q}} - \dot{q})$. In this way the natural softness of the robot is preserved during possible interactions with an external environment. Please refer to \cite{della2017controlling} for more details on this. The integral action is included for compensating the mismatches between the real system and the approximated model considered here. Note that $I_{\mathrm{q}}$ is the only parameter that needs to be tuned in the proposed algorithm, since $K$ and $D$ are defined by the physics of the system. The stability of the closed loop can be proven through arguments similar to the ones in \cite{paden1988globally}. For the sake of space we will discuss these aspects in more detail in future extensions of this work. \subsection{Cartesian Impedance Control and Surface Following} \begin{figure} \centering \includegraphics[width = .49\columnwidth,trim=0mm 0mm 0mm 0mm,clip]{dwg/ref_sys} \caption{The goal of the proposed Cartesian impedance controller is to simulate the presence of a spring and a damper connected between the robot's end effector and a point in space $x_{\mathrm{d}}$. The frame $(n_{\parallel},n_{\perp})$ defines the tangent and parallel directions to the environment in the contact point. \label{fig:ref_sys}} \end{figure} A correct regulation of the impedance at the contact point is essential to implement robust and reliable interactions with the environment. Without loss of generality, we will consider in the following as point of contact the soft robot's end effector. We define a local frame $(n_{\parallel},n_{\perp})$ connected to the end effector, as depicted in Fig.~\ref{fig:ref_sys}. The unit vector $n_{\parallel}$ is chosen to be always tangent to the environment. The unit vector $n_{\perp}$ is such that $n_{\parallel}^{\mathrm{T}} \, n_{\perp} = 0$, and always points from the inside to the outside of the environment. For the purpose of approaching, contacting, and moving along the environment, we assume the knowledge of the following information: \begin{itemize} \item the coordinate $x_0$ of a point included within the environment \item the occurrence of a contact between the end effector and the environment, acquired by isInContact() \item parallel $n_{\parallel}$ and perpendicular $n_{\perp}$ unit vectors at the contact point, extracted by the methods {readParallelDirection()} and {readPerpendicularDirection()}, respectively \item the final target $x_t$ on the surface of the environment \end{itemize} Note that the occurrence of a contact and the contact direction can be obtained by a motion capture system or an array of force sensors mounted to the end effector. Leveraging these knowns and the robot's dynamic model, we propose to implement the desired compliant behavior through the following dynamic feedback loop \begin{equation}\label{eq:joint_space_control_2} \begin{split} \tau &= J^{\mathrm{T}}(q) (K_{\mathrm{c}} (x_{\mathrm{d}} - x) - D_{\mathrm{c}} J(q)\dot{q} ) \\ &+ C(q,\dot{q})\dot{q} + G_{\mathrm{G}}(q) + K \, q \\ &+ I_{\mathrm{c}} \, J^{\mathrm{T}}(q) \, n_{\parallel} \int n_{\parallel}^T (x_{\mathrm{d}} - x) \; , \end{split} \end{equation} where $q,\dot{q}$ are the degree of curvature vector and its derivative. $J(q)$ is the Jacobian mapping those derivatives into the end effector velocity $\dot{x}$. $x_{\mathrm{d}}$ is a reference position for the end effector, and $x$ is the current end effector position. The term $J^{\mathrm{T}}(q) (K_{\mathrm{c}} (x_{\mathrm{d}} - x) - D_{\mathrm{c}} J(q)\dot{q} )$ simulates the presence of a spring and a damper connected between the robot's end effector and $x_{\mathrm{d}}$. This imposes the desired Cartesian impedance. $K_{\mathrm{c}}$ and $D_{\mathrm{c}}$ are the desired Cartesian stiffness and damping matrices. We choose them to be diagonal in order to implement a full decoupling within the degrees of freedom. The elements $C(q,\dot{q})\dot{q} + G_{\mathrm{G}}(q) + K \, q$ cancel the centrifugal, Coriolis, gravitational and elastic force terms. This action is instrumental to obtain the desired decoupling at the end\--effector \cite{khatib1987unified}. Finally, we introduce the integral action $ I_{\mathrm{c}} J^{\mathrm{T}}(q) n_{\parallel} \int n_{\parallel}^T (x_{\mathrm{d}} - x) $. Note that we project the error $(x_{\mathrm{d}} - x)$ on the tangent direction $n_{\parallel}$. In this way we target the goal of compensating uncertainties introduced by the proposed approximations, obtaining zero error in steady state, while avoiding generating high contact forces. We specify the values of $x_{\mathrm{d}}$ and $n_{\parallel}$ on\--line through Algorithm~\ref{al:hl}. Algorithm~\ref{al:hl} consists of two phases: approaching and exploring. In the first phase (lines 1-5), a generic point inside the environment $x_0$ is selected as reference for the impedance controller. No integral action is considered here. When the soft robot makes contact with the environment, the second phase begins (lines 6-10). Here, the desired end effector position is chosen as the final target $x_t$. A constant displacement $\delta\in\mathbb{R}^+$ in the direction $-n_{\perp}$ is manually defined to ensure maintenance of contact with the environment. Algorithm~\ref{al:hl} terminates when the seminorm of the error weighted on $n_{\parallel} n_{\parallel}^T$ is under a manually defined threshold. In this way, only the error along the surface is considered. \begin{algorithm \begin{algorithmic}[1] \While{isInContact() == False} \Comment{Approaching} \State $n_{\parallel} \leftarrow [ 0 \;\; 0 ]^{\mathrm{T}} $ \State $n_{\perp} \leftarrow [ 0 \;\; 0 ]^{\mathrm{T}} $ \State $x_{\mathrm{d}} \leftarrow x_{0}$ \EndWhile \While{$ || x - x_{\mathrm{d}} ||_{n_{\parallel} n_{\parallel}^T} > \epsilon $} \Comment{Exploring} \State $n_{\parallel} \leftarrow \mathrm{readParallelDirection()} $ \State $n_{\perp} \leftarrow \mathrm{readPerpendicularDirection()} $ \State $x_{\mathrm{d}} \leftarrow x_{\mathrm{t}} - n_{\perp} \delta$ \EndWhile \end{algorithmic} \caption{High level control \label{al:hl}} \end{algorithm} \section{Control} \label{sec:control} This section introduces our proposed hierarchical control architecture designed for the coupled system. The controller is a prioritisation-based hierarchical controller and operates on the end-effector orientation, position, and OMAV orientation tasks. The OMAV position is not taken into account, since the only important position quantity is that of the end-effector. Nevertheless, OMAV orientation can help with avoiding singularities and inefficient configurations. The more important targets from the user's perspective are assigned the highest priority and the ordering in priority is as follows: \begin{enumerate} \item \textbf{End-effector orientation:} determined by the offset term $\Delta\bm{\phi}_{EE} \in \mathbb{R}^3$ that depends on the reference orientation $\bm{\phi}_{EE_{d}} \in \mathbb{R}^3$ and the controlled orientation $\bm{\phi}_{EE} \in \mathbb{R}^3$, both represented as angle-axis. \item \textbf{End-effector position:} $\Delta \bm{x}_{EE} \in \mathbb{R}^3$ is the difference of reference Cartesian position $\bm{x}_d \in \mathbb{R}^3$ and the current Cartesian position $\bm{x} \in \mathbb{R}^3$ of the end-effector. \item \textbf{OMAV orientation:} separately controlled thanks to the high number of DOFs and the hierarchical prioritisation approach. $\Delta\bm{\phi}_{O} \in \mathbb{R}^3$ depends on the reference OMAV rotation $\bm{\phi}_{O_{d}} \in \mathbb{R}^3$ and current orientation $\bm{\phi}_O \in \mathbb{R}^3$. Both rotations are represented in angle-axis. \end{enumerate} \begin{figure} \centering \includegraphics[width = 1.0\columnwidth]{dwg/hierarchical_controller_zoomed.pdf} \caption{Block diagram of the hierarchical controller. The nullspace projection matrices $N_2^{suc}$ and $N_3^{suc}$ prevent the lower priority tasks from interfering with higher priority tasks and ensure consistency not just in steady state, but also in the transient phase. \label{fig:blockdiagram}} \end{figure} The angular offset $\Delta\bm{\phi}$ is calculated using the definitions from \cite{robot_dynamics_lecture_notes_eth}. The current orientation $\mathcal{S} \in {\mathcal{E}, \mathcal{B}}$ (end-effector and OMAV frame) is rotated back to an arbitrary inertial frame $\mathcal{I}$, then rotated to the goal frame $\mathcal{G}$ using the rotation equation and the orthonormality of rotation matrices: \begin{equation} \label{eq:rotation} \bm{C}_{\mathcal{G}\mathcal{S}}(\Delta\bm{\phi}) = \bm{C}_{\mathcal{G}\mathcal{I}}(\bm{\phi}_d) \bm{C}_{\mathcal{S}\mathcal{I}}^T(\bm{\phi}) \; . \end{equation} Consequently, the rotation matrix is converted to an angle-axis representation to describe an offset vector in $\mathbb{R}^3$. The backbone of each task is an offset-driven feedback term presented on the left half of \Cref{fig:blockdiagram}: \begin{equation}\label{eq:joint_space_control_2} \begin{split} \bm{\tau}_1 &= \bm{J}_{EE_{rot}}^T (\bm{K}_{EE_{rot}} \Delta \bm{\phi}_{EE} - \bm{D}_{EE_{rot}} \bm{J}_{EE_{rot}} \bm{\dot{q}}) \\ \bm{\tau}_2 &= \bm{N}_2^{suc} \bm{J}_{EE_{pos}}^T (\bm{K}_{EE_{pos}} \Delta \bm{x}_{EE} - \bm{D}_{EE_{pos}} \bm{J}_{EE_{pos}} \bm{\dot{q}}) \\ \bm{\tau}_3 &= \bm{N}_3^{suc} \bm{J}_{O_{rot}}^T (\bm{K}_{O_{rot}} \Delta \bm{\phi}_{O} - \bm{D}_{O_{rot}} \bm{J}_{O_{rot}} \bm{\dot{q}}) \; , \end{split} \raisetag{2\normalbaselineskip} \end{equation} For the sake of brevity, the matrix dependencies on the full system parametrization vector $\bm{q}$ and its derivative $\bm{\dot{q}}$ were omitted. $\bm{K}_{EE_{rot}}, \bm{D}_{EE_{rot}}, \bm{K}_{EE_{pos}}, \bm{D}_{EE_{pos}}, \bm{K}_{O_{rot}}, \bm{D}_{O_{rot}} \in \mathbb{R}^{3 \times 3}$ are the stiffness and damping tuning matrices for the individual tasks. $\bm{J}_{EE_{rot}}, \bm{J}_{EE_{pos}}, \bm{J}_{O_{rot}} \in \mathbb{R}^{3 \times n}$ are the end-effector rotational, translational, and OMAV rotational Jacobians in the PCC space, respectively. To simultaneously ensure a task prioritisation and dynamic consistency, successive nullspace projection matrices $\bm{N}_2^{suc}, \bm{N}_3^{suc} \in \mathbb{R}^{n \times n}$ are applied to the tasks, as described in~\cite{dietrich2015nullspace_projection}. A nullspace projector for a task with the Jacobian $\bm{J}$ of a previous task (\emph{e.g.}, the end-effector orientation task $\bm{J}_{EE_{rot}}^T(\bm{K}_{EE_{rot}} \Delta \bm{\phi}_{EE} - \bm{D}_{EE_{rot}} \bm{J}_{EE_{rot}} \bm{\dot{q}})$ given by the controller) is obtained by: \begin{equation} \label{eq:nullspace} \bm{N}(\bm{q}) = \mathbb{\bm{I}}_{n \times n} - \bm{J}(\bm{q})^T \bm{J}(\bm{q})^{\#^T} \; , \end{equation} where $\bm{J}(\bm{q})^{\#}$ is the generalized inverse satisfying the criterion $\bm{J}(\bm{q}) \bm{J}(\bm{q})^{\#}=\mathbb{\bm{I}}_{n \times n}$. To fulfill the criteria that lower priority tasks not interfere with higher priority tasks during the transient phase or the steady state, a dynamically consistent inverse weighted by the inertia matrix is adapted and denoted as: \begin{equation} \label{eq:pseudoinverse} \bm{J}^{\#}:=\bm{J}^{B+} = \bm{B}^{-1} \bm{J}^T (\bm{J} \bm{B}^{-1} \bm{J}^T)^{-1} \; , \end{equation} based on \cite{dietrich2015nullspace_projection}. The torque $\bm{\tau}$ calculated by the controller is directly fed into the plant. To avoid a steady state tracking error, a gravitational decoupling was added to the control scheme. For a more detailed description of the output allocation pipeline for the OMAV and for the soft continuum arm, please refer to \cite{allenspach_OMAV} and \cite{yasu2021sopra}, respectively. \section{Simulative results} We implemented, tested, and evaluated the controller \eqref{eq:ik} in the absence of the design hypothesis of PCC. We considered a soft robot composed by four actuated segments of length $0.25$m. {\bf Each segment is simulated through} We tested the ability of Algorithm~\ref{al:hl} to efficaciously regulate the end effector position of the end effector through a static and a dynamic set of simulations. We compared the simulated results against the benchmark state of the art in continuum soft robot manipulators. More specifically, we used the kinematic inversion algorithm in \eqref{eq:ik} with the high gain PID controller \begin{equation} \tau = k_{\mathrm{P}} \, (\bar{q} - q) + k_{\mathrm{I}} \, \int (\bar{q} - q) + k_{\mathrm{D}} \, (\dot{\bar{q}} - \dot{q}) \end{equation} The weights $k_{\mathrm{P}}$, $k_{\mathrm{I}}$, $k_{\mathrm{D}}$ were manually tuned for each task, to obtain the best of performances. This lack of versatility represents a significant limitation of the PID controller as compared to our controller. Another limitation of the PID controller is the stiffening of the robot \cite{della2017controlling} \subsection{Set point regulation in operational space} \subsection{Trajectory Tracking in operational space} We consider as reference the following Lissajous curve \begin{equation} x_d(t) = \begin{bmatrix} 0.3 \, \sin(2\,t) + 0.4 \\ 0.3 \, \cos(t) - 0.4 \end{bmatrix} \, \mathrm{m} \, . \end{equation} $k_{\mathrm{P}} = 2 \, \mathrm{Nm}$, $k_{\mathrm{I}} = 1 \, \frac{\mathrm{Nm}}{\mathrm{s}}$, $k_{\mathrm{D}} = 10 \, \mathrm{Nms}$ \begin{figure} \centering \subfigure[]{\includegraphics[width = \columnwidth]{dwg/q_ev}} \subfigure[]{\includegraphics[width = \columnwidth]{dwg/torque_ev}} \caption{} \end{figure} \begin{figure} \centering \includegraphics[width = \columnwidth]{dwg/op_space_traj} \caption{} \end{figure} \subsection{Cartesian stiffness control} \section{Simulations} The simulation scenarios and tasks were designed to show some key capabilities of the coupled system, like continuous nullspace exploitation, disturbance rejection, or dynamic trajectory tracking. We believe that these simulations show the potential of a coupled soft robot arm and aerial drone system. In this section, we first describe the hardware and software setup together with the parameter values used for the simulations. Afterwards, simulation results are shown and discussed. \subsection{Simulation setup} The simulations were run on a laptop with a 4-core CPU (Intel i7-6820HQ (4 x 2.7GHz) 6. Generation) and 16GB RAM memory. The operating system used was an Ubuntu 18.04 Bionic. The code was written in \emph{C++ 17}, with \emph{cmake} version 3.20.0. The visualisation pipeline was built on \emph{ROS 1 - Melodic Morenia}~\cite{ros} and~\emph{Gazebo}, an open source 3D robotics simulator (here only used for visualisation). The \emph{Drake}~\cite{drake} library runs the physics engine in the background for the augmented rigid-body robot system descriptions and simulations. The virtual control frequency was set to 100Hz (this sets an achievable target for the real platform as well) and the internal state update frequency of the system was 100kHz. Note that due to the offline nature of the simulation, no real-time performance was targeted and the code is therefore not necessarily performance-optimised. \begin{table}[htp] \centering \footnotesize \begin{tabular}{lcc} \toprule & \multicolumn{2}{c}{Control task}\\ \cmidrule(lr){2-3} & static & dynamic \\ \midrule $\bm{K}_{EE_{rot}}$ & $(1.5,1.5,1.5)$ & $(1.5,1.5,1.5)$ \\ $\bm{D}_{EE_{rot}}$ & $(0.025,0.025,0.025)$ & $(0.025,0.025,0.025)$ \\ $\bm{K}_{EE_{pos}}$ & $(13.8,13.8,13.8)$ & $(3.8,3.8,3.8)$ \\ $\bm{D}_{EE_{pos}}$ & $(12.5,12.5,12.5)$ & $(2.5,2.5,2.5)$ \\ $\bm{K}_{O_{rot}}$ & $(5.0,5.0,5.0)$ & $(5.0,5.0,5.0)$ \\ $\bm{D}_{O_{rot}}$ & $(4.0,4.0,4.0)$ & $(4.0,4.0,4.0)$ \\ \bottomrule \end{tabular} \caption{Values of the gain and damping matrices} \label{table:matrices} \end{table} \begin{figure} \centering \subfigure[End-effector position deviation from reference]{\includegraphics[width = .85\columnwidth]{dwg/Sim_continuous_nullspace_Position_delta_without_title_with_screenshot_black.pdf}} \subfigure[End-effector orientation deviation from reference]{\includegraphics[width = .85\columnwidth]{dwg/Sim_continuous_nullspace_Orientation_delta_without_title_black.pdf}} \subfigure[OMAV orientation]{\includegraphics[width = .85\columnwidth]{dwg/Sim_continuous_nullspace_OMAV_orientation_black.pdf}} \caption{Exploitation of nullspace motion. The end-effector is regulated and held at the constant point $[0, 0, -0.25]^T$\si{\meter} and the constant orientation of $15^{\circ}$ rotation around the $y$-axis with respect to the arm's straight configuration. The OMAV is constantly rotated around its axes. Subplot (a) shows the end-effector position. Subplot (b) shows the end-effector orientation in quaternion notation. Subplot (c) shows the orientation of the OMAV in quaternion notation. \label{fig:sim}} \vspace{-0.5cm} \end{figure} \begin{figure}[t] \centering \includegraphics[width = .9\columnwidth]{dwg/Sim_disturbance_Fused.pdf} \caption{System evolution under force disturbances. The first disturbance of $[1,0,1]^T$\si{\newton} in frame $\mathcal{B}$ acts on the OMAV, occurs at $t=\SI{5}{\second}$, and lasts for \SI{1}{\second}. The second disturbance of $[1,1,1]^T$\si{\newton} in frame $\mathcal{E}$ acts directly on the end-effector, occurs at $t=\SI{15}{\second}$, and lasts for \SI{0.5}{\second}. The plots show the evolution of the position and orientation deviations of the end-effector. The top row of images above the plots shows the simulated system when experiencing these two disturbances.\label{fig:sim2}} \vspace{-0.5cm} \end{figure} \begin{figure*}[t] \centering \includegraphics[width = 1.65\columnwidth]{dwg/Sim_trajectory_control_fused_with_screenshots.pdf} \caption{System evolution with the reference point moving in a circle of radius \SI{0.25}{\meter} at the center point $[-0.25,0,-0.25]^T \si{\meter}$. Both the OMAV and the soft arm's end-effector are tracking an always "inward" facing orientation. \label{fig:sim3}} \vspace{-0.5cm} \end{figure*} We use for the simulation a two-segment \emph{SoPrA} soft continuum arm~\cite{yasu2021sopra} coupled to an OMAV with six dual propellers. The mass (including the batteries) of the OMAV is $\SI[prefixes-as-symbols]{3.67}{\kilo\gram}$ and the moments of inertia are $\mathrm{diag}(0.075,0.073,0.139) \si{\kilo\gram\metre\squared}$. The length of each SoPrA arm segment is $\SI[prefixes-as-symbols]{0.125}{\meter}$. The length of each connector piece between the segments is $\SI[prefixes-as-symbols]{0.02}{\meter}$ and is considered as an unactuated, rigid extension. The mass of the first segment is $\SI[prefixes-as-symbols]{0.190}{\kilo\gram}$, the second segment is $0.160kg$, and the connectors are $\SI[prefixes-as-symbols]{0.020}{\kilo\gram}$, each. The arm's diameter at the base is $\SI[prefixes-as-symbols]{0.042}{\meter}$, between the first and second segment is $\SI[prefixes-as-symbols]{0.035}{\meter}$, and at the tip is $\SI[prefixes-as-symbols]{0.028}{\meter}$. The remaining system properties were calculated as stated in~\cite{yasu2021sopra}. The control gain and damping matrices were fine-tuned empirically and the final values can be seen in \Cref{table:matrices}. The tuple of three numbers in the table is interpreted as $\mathrm{diag}(*)$. $\bm{K}_*$ matrices have the dimension $\si{\newton\per\meter}$ and $\bm{D}_*$ are of $\si{\newton\second\per\meter}$. $\bm{K}_{EE_{pos}}$ and $\bm{D}_{EE_{pos}}$ are slightly different for the static regulation and dynamic trajectory tracking cases: since the accuracy in the regulation tasks is crucial, higher gains are proposed to ensure a fast, aggressive, and accurate enough control, whereas for motion tracking the safety (more compliance) and stability are the primary concerns leading to lower gains. \subsection{Results} The first experiment on \Cref{fig:sim} demonstrates the exploitation of the motion's nullspace. The OMAV was commanded to change its orientation around a given rotation axis by a certain amount of degrees $axis_{degree}$ in a continuous manner in the repeating cycle $y_{-15^{\circ}} \to x_{15^{\circ}} \to y_{15^{\circ}} \to x_{-15^{\circ}} \to y_{-15^{\circ}}$. Meanwhile, the position and orientation of the end-effector remained stable and close to the reference. After the transient behaviour, the end-effector orientation and position remain stable with negligible error to the reference, even though the OMAV was changing its orientation during the whole ($24 \si{\second}$) simulation. In another experiment, the recovery capability after a disturbance was tested. The simulation shown in \Cref{fig:sim2} shows that the system is able to recover fast from disturbances acting either on the OMAV or on the soft arm. After the disturbance is applied, the system is able to react fast and returns to the reference position and orientation without any overshooting. These disturbances are not modeled, thus active disturbance rejection is not possible and not desired when collaborating with humans where a compliant behavior is preferred over a stiff one. The third simulation examined the dynamic trajectory tracking capabilities of the controller shown in \Cref{fig:sim3}. While the system is capable of following the circular trajectory with a given orientation over time, there was a small lag introduced in the position tracking. The mean L2 norm of the position error is around $0.043m$. This is due to the fact that the control is governed by the $\Delta$ offset terms introduced in \Cref{fig:blockdiagram}, which are arbitrary small at vanishing differences between the reference and control variable. It can be understood as follows: the controller needs a certain ``minimal'' difference between the reference and the controlled value to be ``active'' and effective enough. Note that we did not employ any model predictive control techniques. \section{Conclusion and future work} In this paper we propose a unified mathematical description of a coupled flying system consisting of an OMAV and a soft continuum arm. We show how extending the floating base approach taken from the classical rigid-body robotics literature leads to an analogous formulation in the PCC space with the ARBM. Furthermore, we derive a hierarchical task-prioritisation control architecture tailored to the coupled system. The approach has been tested and evaluated in various simulation scenarios. The system's architecture exhibits certain desirable characteristics, such as the exploration of nullspace-motion, disturbance recovery, and trajectory tracking with a given orientation of the end-effector and the OMAV. We hope that with this work we can lay the foundation for future research in the area of soft continuum manipulators mounted to flying vehicles. We believe that their potential for industrial applications is tremendous in the ever-growing demand on semi-automated warehouses, where humans and robots would actively and efficiently collaborate to retrieve and disperse the goods. Future work will focus on conducting experiments on the real-world system, potentially with an additional gripper attached at the end-effector, to test some basic transport capabilities. Another focus will be placed on micro oscillation effects observed during control simulations using high gains. These effects could be addressed using either curvature space or hybrid control, where the gains for the OMAV and SoPrA can be adjusted independently. \section{Experimental Results} In this section, we first describe the experimental setup, followed by the experimental validation of the proposed curvature controller and the Cartesian impedance controller. \subsection{Experimental setup} The experimental setup used here is a modified version of a soft planar robotic arm used for kinematic motions within confined environments \cite{marchese2014whole} and autonomous object manipulation \cite{katzschmann2015autonomous}. The version of the soft robot used here is composed of five bidirectional segments with inflatable cavities. Each segment of the soft arm is \SI{6.3}{\cm} long. The independent pneumatic actuation of the bidirectional arm segments is achieved through an array of 10 pneumatic cylinders. The connection element between each segment is supported vertically by two ball transfers that allow the arm to move with minimal friction on a level plane. A motion tracking system provides real-time measurements of marked points along the inextensible back of the soft arm. A rigid frame holds all the sub-systems together providing reliable hardware experiments without the need for camera recalibration. \begin{figure} \centering \subfigure[Curvature]{\includegraphics[width = .925\columnwidth]{dwg/sinusoidal_evolution_I0}} \subfigure[Torques]{\includegraphics[width = .925\columnwidth]{dwg/sinusoidal_evolution_I0_torques}} \caption{Evolutions resulting from the application of the dynamic controller \eqref{eq:joint_space_control} to the tracking of a trajectory \eqref{eq:js_tj}. The integral gain is $I_{\mathrm{q}} = 0 \frac{\mathrm{Nm}}{\mathrm{s}}$. Panel (a) shows the evolution of the degree of curvature $q$. Panel (b) presents the corresponding actuation torques. \label{fig:I0}} \end{figure} \begin{figure} \centering \subfigure[Curvature]{\includegraphics[width = .925\columnwidth]{dwg/sinusoidal_evolution_I08}} \subfigure[Torques]{\includegraphics[width = .925\columnwidth]{dwg/sinusoidal_evolution_I08_torques}} \caption{Evolutions resulting from the application of the dynamic controller \eqref{eq:joint_space_control} to the tracking of a trajectory \eqref{eq:js_tj}. The integral gain is $I_{\mathrm{q}} = 0.08 \frac{\mathrm{Nm}}{\mathrm{s}}$. Panel (a) shows the evolution of the degree of curvature $q$. Panel (b) presents the corresponding actuation torques. \label{fig:I08}} \end{figure} \begin{figure*} \centering \subfigure[0\si{\second}]{\includegraphics[trim={6cm 0cm 14cm 3cm},clip,width = .1375\textwidth]{dwg/osc_1}} \subfigure[0.5\si{\second}]{\includegraphics[trim={6cm 0cm 14cm 3cm},clip,width = .1375\textwidth]{dwg/osc_2}} \subfigure[1\si{\second}]{\includegraphics[trim={6cm 0cm 14cm 3cm},clip,width = .1375\textwidth]{dwg/osc_3}} \subfigure[1.5\si{\second}]{\includegraphics[trim={6cm 0cm 14cm 3cm},clip,width = .1375\textwidth]{dwg/osc_4}} \subfigure[2\si{\second}]{\includegraphics[trim={6cm 0cm 14cm 3cm},clip,width = .1375\textwidth]{dwg/osc_5}} \subfigure[2.5\si{\second}]{\includegraphics[trim={6cm 0cm 14cm 3cm},clip,width = .1375\textwidth]{dwg/osc_6}} \subfigure[3\si{\second}]{\includegraphics[trim={6cm 0cm 14cm 3cm},clip,width = .1375\textwidth]{dwg/osc_7}} \caption{The photo sequence shows the soft robot controlled along the reference trajectory~\eqref{eq:js_tj} by the proposed curvature controller~\eqref{eq:joint_space_control}. No integral action is used here, i.e. $I_{\mathrm{q}} = 0 \frac{\mathrm{Nm}}{\mathrm{s}}$. Note that the bottom segment is not actuated and constrained in its vertical position through a mechanical stop.\label{fig:photoseq_1}} \end{figure*} \subsection{Identification} The proposed model \eqref{eq:soft_robot_dynamics_tot} has several free parameters to be identified: masses $\mu_i$, lengths $L_i$, stiffnesses $k_i$, dampings $d_i$. In addition to the robot's dynamics, we also characterize the behavior of the actuators. The available inputs to our soft robot are the desired placements of the pistons within the cylinders. The placements are expressed in encoder tics, ranging from $-1000$ to $1000$ tics. We model the actuator's dynamics with a second order linear filter $\frac{\alpha_i}{(\gamma_i \, s + 1)^2}$. $\alpha_i$ and $\gamma_i$ are two additional variables to be included in the identification. The identification data were collected through three experiments. For each experiment, a step input is injected into all pneumatic cylinders. The amplitudes of the steps were $300$, $600$, and $900$ tics, respectively. The free parameters $L_i$ and $\mu_i$ were directly measured with \SI{0.063}{\m} and \SI{0.034}{\kilo\gram}, respectively. We hypothesized the same stiffness and damping for each segment in order to reduce the search space for the identification procedure. We identified the remaining parameters by iteratively fixing $\delta_i$ to a value picked from a predefined grid. The remaining seven parameters were identified as the ones minimizing the $2\--$norm of the error between estimated and measured evolutions. For this regression problem we used the pseudo\--inverse to achieve this goal. The best performing set of parameters between all identified sets was chosen. The identified stiffness $\hat{k}$ is \SI{0.56}{\newton\meter}. The damping $\hat{d}$ is \SI{0.1066}{\newton\meter\second}. The actuator parameters are $\hat{\alpha} = 10^{-3} [0.16, \; 0.24, \; 0.2, \; 0.25, \; 0.23 ]\si{\per\newton\per\meter}$ and $\hat{\gamma} = [ 0.1, \; 0.25, \; 0.1, \; 0.1, \; 0.1]\si{\second}$. \subsection{Curvature Control} To test the ability of the proposed curvature controller~\eqref{eq:joint_space_control}, we consider the problem of tracking the following trajectory in the degree of curvature space \begin{equation}\label{eq:js_tj} \bar{q}_i(t) = \frac{\pi}{20} - \frac{\pi}{24}\cos(\frac{2}{3} \, \pi \, t) \quad \forall i \in \{1,\dots,5\} \, . \end{equation} The input to the pistons is generated by filtering $\tau$ through \begin{equation} \label{eq:input_filter} \frac{1}{\hat{\alpha}_i}\frac{(\hat{\gamma}_i \, s + 1)^2}{(5\, T \, s + 1)^2} \, , \end{equation} where $T=\SI{0.015}{\second}$ is the sampling time of the control system. Fig.~\ref{fig:I0} presents the evolution of measured degrees of curvature and applied torques, with the integral action set to $I_{\mathrm{q}}=\SI{0}{\newton\meter\per\second}$. Even without any integral compensation of the model uncertainties, the algorithm is able to produce a stable oscillation close to the commanded one. The correspondent $L^2$\--norm of the error is \SI{0.1311}{\radian}. Fig.~\ref{fig:photoseq_1} presents the photo sequence of one of the resulting oscillations. Fig.~\ref{fig:I08} shows the evolution of the same quantities for $I_{\mathrm{q}} = \SI{0.08}{\newton\meter\per\second}$. This low gain feedback appears to scarcely modify the torque profile. However this small variation reduces sensibly the tracking error, resulting in a $L^2$\--norm equal to \SI{0.0965}{\radian}. The error can be further reduced by increasing the gain to \SI{0.3}{\newton\meter\per\second}, for which the $L^2$\--norm is \SI{0.0861}{\radian}. \subsection{Cartesian Impedance Control and Surface Following} \begin{figure*} \centering \subfigure[]{\includegraphics[trim={6cm 0cm 14cm 0.5cm},clip,width = .16\textwidth]{dwg/cart_1_2}} \subfigure[]{\includegraphics[trim={6cm 0cm 14cm 0.5cm},clip,width = .16\textwidth]{dwg/cart_2_2}} \subfigure[]{\includegraphics[trim={6cm 0cm 14cm 0.5cm},clip,width = .16\textwidth]{dwg/cart_3_2}} \subfigure[]{\includegraphics[trim={6cm 0cm 14cm 0.5cm},clip,width = .16\textwidth]{dwg/cart_4_2}} \subfigure[]{\includegraphics[trim={6cm 0cm 14cm 0.5cm},clip,width = .16\textwidth]{dwg/cart_5_2}} \subfigure[]{\includegraphics[trim={6cm 0cm 14cm 0.5cm},clip,width = .16\textwidth]{dwg/cart_6_2}} \caption{Photo sequence of the soft robot controlled through the proposed Cartesian impedance controller \eqref{eq:joint_space_control_2}. We report superimposed the two reference positions commanded by Algorithm~\ref{al:hl} (red crosses) and the trajectory of the end effector (blue dashed line). Panels (a-c) show the first phase of the algorithm: the robot's tip is attracted toward the environment by a virtual spring connected to a reference point inside the surface. Panels (d-f) illustrate the second phase of the algorithm: the robot traces along the surface toward the desired end position. Note that the bottom segment is not actuated and constrained in its vertical position through a mechanical stop. \label{fig:photoseq_2}} \vspace{-5pt} \end{figure*} \begin{figure} \centering \includegraphics[width = \columnwidth]{dwg/cartesian_torque} \caption{Actuation torques commanded by the proposed Cartesian impedance controller \eqref{eq:joint_space_control_2} while executing the Algorithm \ref{al:hl}. The contact detection happens at \SI{6.5}{\second}. \label{fig:cartesian_torque}} \end{figure} \begin{figure} \centering \includegraphics[width = \columnwidth]{dwg/certesian_ee.eps} \caption{End effector's evolution in Cartesian space resulting by the application of the proposed Cartesian impedance controller \eqref{eq:joint_space_control_2} and Algorithm \ref{al:hl}. The contact detection happens at \SI{6.5}{\second}. \label{fig:cartesian_ee}} \end{figure} We test the effectiveness of the proposed Cartesian impedance controller and surface following strategy. The robot's goal is to first reach the wall and then slide along it until the desired position is reached. Note that we are not interested in a precise regulation of the contact forces. Instead, the constraint imposed by the environment is purposefully exploited in combination with the decoupled compliance imposed by the control, to naturally generate the interaction forces and guide the end effector toward the desired position. The input to the pneumatic cylinders is produced by filtering $\tau$ in \eqref{eq:joint_space_control_2} through the filter described in \eqref{eq:input_filter}. The desired impedance at the end effector is \begin{equation} K_{\mathrm{c}} = \begin{bmatrix} 13 &0\\ 0 &13 \end{bmatrix}\si{\newton\meter\per\radian} \quad D_{\mathrm{c}} = \begin{bmatrix} 6 &0\\ 0 &6 \end{bmatrix}\si{\newton\meter\second\per\radian} \; . \end{equation} The integral gain is $I_c = 1.9 \si{\newton\meter\per\radian\per\second}$. As described in Algorithm~\ref{al:hl}, the experiment is divided in two phases. In the first one, the end effector of the soft robot is attracted toward a point within the environment ($x_0 = [0.283, 0.135]\si{\meter}$), which is manually defined. After contact is established, it triggers the execution of the second phase. The end-effector is now pulled towards a new target ($x_{\mathrm{d}} = [0.220, 0.160]$\si{\meter}) while staying in contact. The distance to the wall is maintained with $\delta = 0.05$\si{\meter}. The values of $n_{\perp}$ and $n_{\parallel}$ are considered known. For one example experiment, the commanded actuation torques are shown in Fig.~\ref{fig:cartesian_torque}. The evolution of the end effector in Cartesian space is shown in Fig.~\ref{fig:cartesian_ee}, while the correspondent photo sequence is shown in Fig.~\ref{fig:photoseq_2}. \section{Discussion} \section{Conclusion} In this paper we present two new algorithms that achieve dynamic control of soft robots and enable interactions between soft robots and their environment. Both algorithms leverage on the idea of connecting the soft robot to an equivalent augmented rigid robot, in such a way that the matching is exact in the common hypothesis of constant curvature, and under the introduced hypothesis on the mass distribution. Classic tools in robotic control are used to develop robust feedback control strategies able to compensate for any model mismatch. We implement the control algorithms on a planar multi-link soft robotic manipulator and demonstrate curvature control and surface following using our strategy. The control algorithm presented in this paper has been evaluated in the context of exploring a two-dimensional surface using a soft planar robot manipulator. However, the potential for this work is much broader. The control algorithm is general and has the potential to enable a wide range of dynamic tasks, ranging from exploring three dimensional spaces through contact, learning the geometry of the world, picking up delicate objects, moving heavy objects and enabling dynamic interactions with the world. \section*{Appendix A: Input Field} Continuous soft robots actuation systems are of the most disparate kinds, ranging from tendon driven \cite{renda20123d}, to dielectric elastomer \cite{carpi2007folded}. A complete treatise of the modeling of such systems is beyond the scope of the present paper. We refer the interested reader to \cite{rus2015design} for further details. We consider here to have an internal wrench independently applied at the two ends of a CC segment. In this case the mapping between the control input and the augmented system joint torques can be expressed as \begin{equation} \label{eq:input} \tau_{\xi} = A_{\xi}(\xi)\tau_{\mathrm{a}} \end{equation} with \begin{equation} \small A_{\xi}(\xi) = \begin{bmatrix} &\cdots &\vline &J_{\xi,i}^T(\xi) - J_{\xi,i-1}^T(\xi) \, T_{i}^{i-1}(\xi) &\vline &\cdots & \end{bmatrix} \; , \end{equation} where $J_{\xi,i}(\xi)$ is the Jacobian mapping $\dot{\xi}$ into the linear and angular velocities of $S_i$, and $T_{i}^{i-1}(\xi)$ is the inverse of the homogeneous transformation in \eqref{eq:T}. Combining \eqref{eq:js_m_def} and \eqref{eq:input} yields to \begin{equation} \label{eq:input} \tau = A(q)\tau_{\mathrm{a}} \end{equation} with \begin{equation} A(q) = J_{\mathrm{m}}^T(q) \; A_{\xi}(m(q)). \end{equation} Lets consider now a planar PCC soft robot, actuated with internal torques applied at the ends of each segment, as in Fig. \ref{fig:segment_elastic}. This case is of particular interest since it models a xxx actuation \cite{marchese}. \begin{figure} \centering \includegraphics[width = 0.7\columnwidth]{dwg/segment_elastic} \caption{A segment with constant curvature. An internal torque $\tau_i$ is applied at both ends. The radius of the segment section is $\Delta$. A spring and a damper are connected through the arc at distance $\delta$ from the segment axis. \label{fig:segment_elastic}} \end{figure} Interestingly in this case $A(q)$ is the identity matrix. This is coherent with the discussed property of the PCC model, to exactly describe the kinematic in the case of constant torque applied at the end of the segment. \section*{Appendix B: Impedance} The effect of elastic and viscous dissipative fields can be easily described by introducing the first one in $G_{\xi}$, and the second one in $C_{\xi}\dot{\xi}$, in \eqref{eq:xidyn}. However, it is more convenient to evaluate the impedance directly in the PCC soft robot space $q$, $\dot{q}$. We will consider here the planar case described in Fig. \ref{fig:segment_elastic}. We model the link elasticity through a continuous distribution of infinitesimal elastic terms, along the whole segment area. From simple geometrical considerations, the length of an infinitesimal spring at distance $\delta$ from the central axis of the segment is \begin{equation} L_{\delta,i}(q_i) = (\frac{L_i}{q_i} - \delta) \, q_i \, , \end{equation} where $L_i$ is the length of the central axis of the segment (constant for every $q_i$ by construction). We consider the spring to be linear, with an amount of stored energy equal to \begin{equation} \begin{split} E_{\delta,i}(q_i) &= \frac{1}{2} \kappa_i (L_{\delta,i}(0) - L_{\delta,i}(q_i))^2 \\ &= \frac{1}{2} \kappa_i \delta^2 q_i^2 \, . \end{split} \end{equation} Thus, the total amount of energy stored in the segment area is \begin{equation} E_{i}(q_i) = \int_{-\Delta}^{+\Delta} E_{\delta,i}(q_i) \mathrm{d} \delta = \frac{2}{3} \kappa_i \Delta^3 q_i^2. \end{equation} The elastic force acting on the i\--th segment can then be evaluated as \begin{equation} \frac{\partial E_{i}(q_i)}{\partial q_i} = \frac{4}{3} \kappa_i \Delta^3 q_i. \end{equation} Which is linear in the curvature angle $q_i$. A linear model of spring w.r.t. the local curvature is indeed coherent with the continuous Hooke model \cite{}. Similarly we introduce a damper in parallel to each infinitesimal spring. We consider a linear friction model, for which the generated force is equal to $\beta \, \dot{L}_{\delta,i}$. By exploiting kineto-static duality and integrating over the surface, we obtain the total dissipative force produced at the i\--th segment \begin{equation} \int_{-\Delta}^{\Delta} \beta_i \left(\frac{\partial L_{\delta,i}}{\partial q_i}\right)^2 \dot{q}_i \; \mathrm{d} \delta = \frac{4}{3} \beta_i \Delta^3 \dot{q}_i \; . \end{equation} So in the PCC hypotheses damping and elastic actions can be described by two linear terms, $D \, \dot{q}$ and $K \, q$ respectively, where $D$ and $K$ are two diagonal matrices, with $\frac{4}{3} \kappa_i \Delta^3$ and $\frac{4}{3} \beta_i \Delta^3$ as i\--th diagonal elements.
{'timestamp': '2021-11-08T02:02:36', 'yymm': '2111', 'arxiv_id': '2111.03111', 'language': 'en', 'url': 'https://arxiv.org/abs/2111.03111'}
arxiv
\section{Introduction} The Ising model is a mathematical model of a magnetic material, fundamental in the study of phase transitions in statistical physics. The Ising model is a probability distribution over cuts in a graph, and its partition function is the weighted sum over all cuts in the graph, connecting the physics of the model to combinatorial structures in computer science. In the field of approximate counting in computer science, the ferromagnetic Ising model plays a special role along with the monomer-dimer model as models for which approximating the partition function is tractable on all graphs and at all temperatures~\cite{jerrum1989approximating,JS93}. Conditioning on the magnetization of the model corresponds to fixing the balance of the random cut generated. In particular, at zero magnetization (an equal number of plus and minus spins), the Ising model is a probability distribution on bisections of the graph. In the study of spin models on sparse random graphs in physics, it has long been known that conditioning on zero magnetization can turn a ferromagnetic system into a glassy system~\cite{mezard1987mean} (i.e.\ fixing the magnetization can drastically change the model and induce slow dynamics). This suggests that lurking inside the tractable computational problems associated to the Ising model there may be hard problems accessible by fixing the magnetization. We make this idea concrete in a complexity-theoretic sense by reducing NP-hard balanced cut problems to approximating the partition function of the Ising model at fixed magnetization. Specifically we find computational thresholds for approximate counting and sampling in the ferromagnetic Ising model at fixed magnetization on bounded degree graphs. When the inverse temperature $\beta$ is small (smaller that the critical $\beta$ on the infinite $\Delta$-regular tree) there are efficient algorithms at all magnetizations. When $\beta$ is large (larger than the critical $\beta$) then there is a computational threshold: for magnetizations $\eta$ small in absolute value the computational problems are hard; for $\eta$ large in absolute value the problems are tractable. We first define the Ising model and the relevant properties of the model on the infinite regular tree, then state our main results. \subsection{The Ising model on graphs and trees} The Ising model on a finite graph $G$ at inverse temperature $\beta $ and activity $\lambda$ is the probability distribution $\mu_{G,\beta,\lambda}$ on $ \Sigma_G := \{ \pm 1\}^{V(G)}$ defined by \begin{align*} \mu_{G,\beta,\lambda}(\sigma) = \frac{ e^{ \frac{\beta}{2} \sum_{(u,v) \in E(G)} \sigma_u \sigma _v} \lambda^{ M(\sigma)} }{ Z_G(\beta,\lambda) } \end{align*} where $M( \sigma ) = \sum_{v \in V(G)} \sigma_v$ and \begin{align*} Z_G(\beta,\lambda) = \sum_{\sigma \in \Sigma_G} e^{\frac{\beta}{2} \sum_{(u,v) \in E(G)} \sigma_u \sigma _v} \lambda^{ M(\sigma)} \,. \end{align*} The probability distribution $\mu_{G,\beta, \lambda}$ is the Gibbs measure and $Z_G(\beta,\lambda)$ is the partition function. When $\beta \ge 0$ the model is ferromagnetic, and we will always assume this in what follows. In statistical physics the activity is often written as $\lambda = e^{h}$ where $h$ is the external field, and so we will call the unbiased case $\lambda =1$ the zero-field Ising model. The quantity $M(\sigma)$ is the \emph{magnetization} of the configuration $\sigma$. The normalized \emph{mean magnetization} of the Ising model is \[ \eta_{G}(\beta,\lambda) = \frac{ \langle M(\sigma)\rangle_{G,\beta,\lambda} }{|V(G)|} \,,\] where $\langle \cdot \rangle_{G,\beta,\lambda}$ denotes expectation with respect to the Ising model. We can also define the Ising model at fixed magnetization. For $ k \equiv |V(G)| \mod 2$, $|k| \le |V(G)|$, let $\Sigma_G(k) = \{ \sigma \in \Sigma_G : M(\sigma) =k \}$ be the subset of Ising configurations with magnetization $k$. Then the Ising model on $G$ at inverse temperature $\beta$ and fixed magnetization $k$ is the distribution $\nu_{G,\beta,k}$ on $\Sigma_G(k)$ defined by \begin{align*} \nu_{G,\beta,k} (\sigma) = \frac{ e^{\frac{\beta}{2} \sum_{(u,v) \in E(G)} \sigma_u \sigma _v} }{ Z_G^{\mathrm{fix}}(\beta ,k) } \end{align*} where \begin{align*} Z_G^{\mathrm{fix}}(\beta ,k) = \sum _{\sigma \in \Sigma_G(k) } e^{\frac{\beta}{2} \sum_{(u,v) \in E(G)} \sigma_u \sigma _v} \,. \end{align*} The distribution $\nu_{G,\beta,k}$ is simply the Ising model at inverse temperature $\beta$ (and arbitrary activity $\lambda >0$) conditioned on the event $ \sigma \in \Sigma_G(k)$. The fixed-magnetization partition function $Z_G^{\mathrm{fix}}(\beta ,k) $ is the coefficient of $\lambda^{k}$ when interpreting $ Z_G(\beta,\lambda)$ as a Laurent polynomial in $\lambda$. The Ising model can be defined on the infinite $\Delta$-regular tree $\mathbb{T}_{\Delta}$ via the DLR equations~\cite{Dob68,LR69} or as a weak limit of Ising models on finite-depth trees with given boundary conditions. Infinite regular trees are important in computer science as `optimal' expanders, and here we use a known relationship between the Ising model on random regular graphs and on the infinite tree. Depending on the parameters $\beta, \lambda$ there may be a unique infinite-volume Gibbs measure on $\mathbb{T}_{\Delta}$ or there may be multiple measures. The critical inverse temperature is $\beta_c(\Delta) = \log \frac{\Delta}{\Delta-2} $: for $\beta< \beta_c$ there is a unique Gibbs measure for all $\lambda$ and for $\beta>\beta_c$ there can be multiple measures if $\lambda$ is close enough to $1$~\cite{lyons1989ising}. We will be interested in one particular Gibbs measure on $\mathbb{T}_{\Delta}$, the `$+$' measure induced by the weak limit of finite-depth trees with the all $+$ boundary conditions. We denote this measure $\mu_{\Delta, \beta, \lambda}^+$. By the FKG inequality $\mu_{\Delta, \beta, \lambda}^+$ stochastically dominates all other Gibbs measures on $\mathbb{T}_\Delta$ with the same parameters. We let $\eta_{\Delta, \beta,\lambda}^+$ denote the expected value of the spin at the root of $\mathbb{T}_{\Delta}$ under $\mu_{\Delta, \beta, \lambda}^+$ (equivalently, the expected value of the spin at any fixed vertex since $\mu_{\Delta, \beta, \lambda}^+$ is translation invariant). Then the magnetization of the measure $\mu_{\Delta,\beta,\lambda}^+$ is \[ \eta_{\Delta, \beta,\lambda}^+ = \tanh\big(L^*+\artanh(\tanh L^*\tanh\tfrac{\beta}{2})\big), \] where $L^*$ is the largest solution to \[ L^* = \log\lambda + (\Delta-1)\artanh(\tanh L^*\tanh\tfrac{\beta}{2}). \] See Section~\ref{secExtremal} for more details and a derivation. The phase transition on $\mathbb{T}_{\Delta}$ manifests itself via the following `spontaneous magnetization' phenomenon~\cite{lyons1989ising}: \begin{enumerate} \item For $\beta < \beta_c(\Delta)$, $ \eta_{\Delta, \beta,1}^+ =0$. \item For $\beta > \beta_c(\Delta)$, $ \eta_{\Delta, \beta,1}^+ >0$. \end{enumerate} \subsection{Computational problems and computational thresholds} There are two main computational problems associated to a spin model like the Ising model. The approximate counting problem asks for an $\varepsilon$-relative approximation to the partition function $Z_G$; that is, a number $\hat Z$ so that $(1- \varepsilon) Z_G \le \hat Z \le (1+\varepsilon ) Z_G$. An FPTAS is an algorithm that provides such an approximation and runs in time polynomial in $|V(G)|$ and $1/\varepsilon$. An FPRAS is a randomized algorithm that provides such an approximation with probability at least $2/3$ and runs in time polynomial in $|V(G)|$ and $1/\varepsilon$. The approximate sampling problem is to output a sample $\sigma$ with distribution $\hat \mu$ so that $\| \mu_G - \hat \mu \|_{TV} <\varepsilon$. An efficient sampling scheme is a randomized algorithm that satisfies this guarantee and runs in time polynomial in $|V(G)|$ and $\log (1/\varepsilon)$\footnote{Sometimes the required dependence of the running time for an efficient approximate sampler is taken to be polynomial in $1/\varepsilon$ instead of $\log(1/\varepsilon)$; we use the stronger definition here.}. Jerrum and Sinclair gave an FPRAS for the ferromagnetic Ising model for all graphs, all inverse temperatures $\beta$, and all choices of the activity $\lambda$~\cite{JS93}\footnote{In fact the algorithm works in the case of non-uniform activities, as long as they are consistent: all at least $1$ or all at most $1$. The general case of approximating the partition function with non-uniform activities is \#BIS-hard~\cite{goldberg2007complexity}.}. Via self-reducibility of the random cluster representation of the Ising model, this gives an efficient sampling scheme as well~\cite{randall1999sampling}. On the other hand, for the anti-ferromagnetic Ising model (and the hard-core model of weighted independent sets), the approximate counting and sampling problems are \textup{NP}-hard in general, and for the class of bounded degree graphs precise computational thresholds are known. The results of Weitz~\cite{Wei06}, Sly~\cite{Sly10}, Sly--Sun~\cite{SS14}, Galanis--{\v S}tefankovi{\v c}--Vigoda~\cite{galanis2016inapproximability}, and Sinclair--Srivastava--Thurley~\cite{sinclair2014approximation} show that for these models (and for $\beta$ large enough in the case of the anti-ferromagnetic Ising model) there is a computational threshold at some critical activity $\lambda_c = \lambda_c(\Delta,\beta)$. In the case of the hard-core model, there is an FPTAS for $Z_G(\lambda)$ for $\lambda < \lambda_c$ and graphs $G$ of maximum degree $\Delta$ while for $\lambda>\lambda_c(\Delta)$ there is no FPRAS unless \textup{NP=RP}. For the ferromagnetic Ising model there are no such computational thresholds. But one can ask instead for approximation algorithms for coefficients of the partition function or approximate sampling algorithms for the Ising model at fixed magnetization. For $\beta \ge 0$ and $\eta \in [-1,1]$, let \csproblem{Fixed-Ising}$(G,\beta,\eta)$ be the problem of computing the partition function $Z^{\mathrm{fix}}_G(\beta, k)$ of the $n$-vertex graph $G$, where $k$ is the largest integer such that $k\equiv n \mod 2$ and $k\le \eta n$. In other words, $k = 2 \lfloor (\eta+1)n/2 \rfloor -n$. The associated sampling problem is to sample spin assignments from the measure $\nu_{G,\beta,k}$. The restriction on the parity of $k$ is simply to ensure that configurations of magnetization $k$ exist. Abusing notation slightly we will refer to both $\eta$ and $k$ as the magnetization, but it will be clear from context what is meant. This is the setting of the Kawasaki dynamics for the Ising model~\cite{kawasaki1966diffusion,kawasaki1972kinetics}: a \emph{conservative} dynamics with stationary distribution $\nu_{G, \beta, k}$ that at each step proposes a swap of nearest-neighbor spins. Understanding the convergence properties of the Kawasaki dynamics on subsets of $\mathbb Z^d$ is a deep mathematical problem~\cite{lu1993spectral,yau1996logarithmic,cancrini1999spectral,cancrini2000spectral}. In this paper we address the problem on general graphs from the perspective of computational complexity. \subsection{Our results} In what follows we always assume $\beta \ge0$ and $\Delta \ge 3$. When $\beta < \beta_c (\Delta)$ we give efficient approximate counting and sampling algorithms for all magnetizations. \begin{theorem}\label{thmAlgFixedSubcriticalBeta} Let $\Delta\ge 3$ and $\beta < \beta_c(\Delta)$. Then for all $\eta\in[-1,1]$ there is an FPRAS and efficient sampling scheme for \csproblem{Fixed-Ising}$(G,\beta,\eta)$ for graphs of maximum degree $\Delta$. \end{theorem} Theorem~\ref{thmAlgFixedSubcriticalBeta} can be deduced fairly easily from known results, essentially following the framework of~\cite{davies2021approximatelyICALP}. To sample from configurations with a given magnetization, we follow the standard approach of finding a suitable activity parameter for the Gibbs measure $\mu_{G,\beta,\lambda}$ so that the probability of hitting the desired magnetization is not too small (at least inverse polynomial), and then sampling from the Ising model, rejecting samples until we obtain one with the correct magnetization. Because efficient sampling algorithms for the Ising model exist for all $\beta, \lambda$ this approach works provided that a suitable activity parameter exists. By continuity, there is an activity that gives the correct mean magnetization, and because the partition function (as a function of $\lambda$) is uniformly zero-free in a sector in the complex plane~\cite{PR20}, the magnetization obeys a central limit theorem~\cite{MS19}, giving the required inverse polynomial lower bound. The main results of the paper are for the supercritical case, $\beta>\beta_c(\Delta)$. Here we prove that there is a computational threshold at an explicit $\eta_c = \eta_c(\Delta,\beta) \in (0,1)$ so that approximation is hard for $|\eta| < \eta_c$ but tractable for $|\eta| > \eta_c$. In fact, $\eta_c(\Delta,\beta) = \eta_{\Delta,\beta,1}^+$, the mean magnetization of the zero-field $+$ measure on $\mathbb{T}_\Delta$. \begin{theorem}\label{thmFixedSupercriticalBeta} Let $\Delta\ge 3$, $\beta>\beta_c(\Delta)$, and $\eta_c = \eta_{\Delta,\beta,1}^+$. \begin{enumerate}[label={\textup{(\alph*)}}] \item\label{algFixedSuper} For all $\eta$ with $|\eta|>\eta_c$ there is an FPRAS and efficient sampling scheme for \csproblem{Fixed-Ising}$(G,\beta,\eta)$ for graphs of maximum degree $\Delta$. \item\label{hardFixedSuper} Unless \textup{NP=RP}, for all $\eta$ with $|\eta| < \eta_c$ there is no FPRAS for \csproblem{Fixed-Ising}$(G,\beta,\eta)$ for graphs of maximum degree $\Delta$. \end{enumerate} \end{theorem} In~\ref{hardFixedSuper} our proof in fact shows that given $\Delta$, $\beta$ there is some $\zeta>0$ such that unless NP=RP, there is no polynomial-time algorithm for \csproblem{Fixed-Ising}$(G,\beta,\eta)$ which achieves a multiplicative approximation of $e^{n^{\zeta}}$ on $n$-vertex graphs $G$ of maximum degree $\Delta$. The infinite regular tree plays several roles in the proof of Theorem~\ref{thmFixedSupercriticalBeta}. For the hardness results, non-uniqueness for the zero-field Ising model on the tree at $\beta > \beta_c$ corresponds to `phase coexistence' of the model on the random $\Delta$-regular graph~\cite{dembo2010ising}. Phase coexistence allows us to use random graphs as gadgets, as Sly does in establishing a computational threshold for the hard-core model~\cite{Sly10} (and as is done in subsequent hardness proofs, e.g.~\cite{SS14,GSV15,cai2016hardness}). Our analysis of the hardness reduction requires new techniques to account for the fixed-magnetization constraint; we give an overview of the approach in the next section. For the algorithmic results, the $+$ measure on the infinite regular tree is the solution to a problem from extremal graph theory that is essential for the proof of Theorem~\ref{thmFixedSupercriticalBeta}. For the ferromagnetic Ising model with activity $\lambda>1$, what is the maximum mean magnetization over all graphs of maximum degree $\Delta$? We prove that the magnetization of the $+$ measure on the infinite $\Delta$-regular tree is an upper bound, and this value is approached by that of the random $\Delta$-regular graph in the $n \to \infty$ limit. The following result is the main combinatorial result of our paper. \begin{theorem}\label{thmExtremal} For all graphs $G$ of maximum degree $\Delta$, all $\lambda \ge1$, and all $\beta \ge0$, \[ \eta_{G}(\beta,\lambda)\le \eta_{\Delta,\beta,\lambda}^+ \, .\] \end{theorem} By integrating the mean magnetization from $\lambda=1$ to $\infty$, this theorem implies the $\Delta$-regular case of a result of Ruozzi which states that the `Bethe approximation' is a lower bound on the normalized partition function of the ferromagnetic Ising model~\cite{ruozzi2012bethe}. In combinatorics, results of this type belong to the field of extremal problems for bounded-degree graphs: maximizing or minimizing observables of statistical physics models over given classes of graphs, like the occupancy fraction of the hard-core or monomer-dimer models~\cite{DJPR17}. The area is surveyed by Zhao in~\cite{zhao2017extremal} and Csikv{\'a}ri describes several cases in which the optimal bound on a partition function is given by an analogous quantity on an infinite regular tree~\cite{csikvari2016extremal}. Bounds on observables such as the mean magnetization or occupancy fraction are stronger than bounds on the partition function, and to the best of our knowledge Theorem~\ref{thmExtremal} is the first case in which the infinite tree is proved to be extremal for an observable. Theorem~\ref{thmExtremal} implies the following extremal spontaneous magnetization result, which is what we use to guarantee the effectiveness of our algorithm. Define \[ \eta^*(\Delta,\beta) = \lim_{\lambda\to1^+}\sup_{G\in \mathcal{G}_{\Delta}}\eta_G(\beta,\lambda),\] where $\mathcal{G}_\Delta$ is the class of graphs of maximum degree $\Delta$. Then $\eta^*(\Delta,\beta) = \eta_{\Delta,\beta,1}^+$. The lower bound comes from taking a sequence of random $\Delta$-regular graphs, while the upper bound follows from Theorem~\ref{thmExtremal}. We describe in the next section the content of our algorithmic results for $\beta>\beta_c$: that $\eta_c(\Delta,\beta)=\eta^*(\Delta,\beta) = \eta_{\Delta,\beta,1}^+$. \subsection{Overview of the techniques} \subsubsection{Algorithms} For the algorithmic results of Theorem~\ref{thmFixedSupercriticalBeta}, we aim to apply the same type of algorithm as in Theorem~\ref{thmAlgFixedSubcriticalBeta}: find an activity $\lambda$ so the mean magnetization is close to the target magnetization, and prove that the probability of hitting the mean is not too small. Again by continuity, there is an activity with the correct mean magnetization, but the distribution may not be concentrated around its mean. For instance, taking $\lambda=1$ gives $0$ mean magnetization by symmetry, but if $\beta>\beta_c$, then hitting $0$ magnetization on the random regular graph is exponentially unlikely. So our question becomes: given an arbitrary graph of maximum degree $\Delta$ and a desired magnetization $\eta$, is the magnetization under $\mu_{G,\beta,\lambda}$ guaranteed to be concentrated around its mean when $\lambda$ is chosen so that the mean magnetization is (close to) $\eta$? The answer to this question is given by the Lee--Yang theorem~\cite{lee1952statistical} in combination with Theorem~\ref{thmExtremal}, which guarantees that to achieve a mean magnetization $\eta > \eta^*(\Delta,\beta)$ we can pick an activity $\lambda$ bounded away from $1$ independent of $n$. The Lee--Yang theorem then gives the zero-freeness result that provides us with the required central limit theorem. Our proof of Theorem~\ref{thmExtremal} is an extension of an approach used by Krinsky~\cite{krinsky1975bethe} to prove the result for infinite lattices like $\mathbb Z^d$ (or more generally graphs satisfying vertex and edge transitivity). The theorem (and the paper~\cite{krinsky1975bethe} that inspired it) may be of independent interest in combinatorics and algorithms. The proof of Theorem~\ref{thmExtremal} relies heavily on correlation inequalities, namely the GKS inequalities~\cite{griffiths1967correlations,kelly1968general}, and identities due to Thompson~\cite{thompson1971upper}. The techniques are distinct from previous approaches in this area of extremal graph theory such as the entropy method~\cite{kahn2001entropy}, occupancy method~\cite{DJPR17}, and inductive approaches~\cite{csikvari2017lower,sah2020reverse}. \subsubsection{Hardness} To prove a matching hardness result, we must overcome the barrier of the tractability of approximating the Ising partition function. This rules out the approach used in~\cite{davies2021approximatelyICALP} for proving hardness of approximating the number of independent sets of a given size, namely reducing approximating the partition function to approximating a fixed coefficient of the partition function. Instead, we use the fact that imposing the fixed-magnetization constraint fundamentally alters the behavior of the model. When highly connected components of a graph are connected with a relatively sparse set of edges, the fixed-magnetization, zero-field ferromagnetic Ising model exhibits a kind of global anti-ferromagnetic behavior due to the constraint on the magnetization: the spins on each highly connected component will align, but the number of components that pick each spin will be essentially determined by the constraint. This behavior is what allows us to prove hardness. We use a probabilistic analysis of the fixed-magnetization Ising model to show that a gadget construction based on that of~\cite{Sly10} can be used to reduce an NP-hard cut problem to approximating the fixed-magnetization Ising partition function. To illustrate our methods we sketch a simplified version of the proof for zero magnetization. Similar to previous approaches, our gadget $G$ is essentially a random $\Delta$-regular bipartite graph with some edges removed and trees attached to create `terminal vertices' of degree $\Delta-1$. Given an instance $H$ of \csproblem{Min-Bisection}, we replace each vertex of $H$ by a copy of the gadget $G$ and then join a number of terminal vertices of the appropriate copies of the gadget graph for each edge of $H$. When $\beta>\beta_c$, the Ising model on a single gadget $G$ exhibits \emph{phase coexistence}, with a bimodal distribution of either many more $+$ spins than $-$ spins or vice versa. The phase coexistence property of each gadget is so strong that when we take the collection of gadgets joined by the crossing edges and condition the Ising model on zero magnetization, the phase coexistence property on each gadget persists, and zero-magnetization is achieved (with high probability) by having an equal number of gadgets in each phase. Showing this involves proving a local central limit theorem and large deviation results for the magnetization of a collection of gadgets conditioned on an arbitrary spin assignment to the set of terminal vertices. This shows that the dominant contribution to the zero-magnetization partition function is given by configurations whose gadget phase assignments encode minimum bisections of $H$, and this in turn implies that a good approximation algorithm for the partition function can recover a minimum bisection. The proof of the local central limit theorem conditioned on the phases of the gadgets is a new technical ingredient in our proof. It involves bounding the moments of the magnetization on a single gadget, conditioned on a phase, and employing a Fourier analytic proof of a local central limit theorem. The full proof and the general case of $\eta \ne 0$ are only slightly more complex. Broadly, the same approach works except we reduce from a generalization of \csproblem{Min-Bisection}, $\gamma$-\csproblem{Min-Exact-Balanced-Cut} ($\gamma$-\csproblem{MEBC}), that requires the partition of a vertex set of size $N$ to have part sizes $\lfloor \gamma N \rfloor$ and $\lceil (1-\gamma)N \rceil$. It is convenient to add to the collection of gadget graphs some isolated vertices which smooth out certain parts of the analysis. In particular, it helps in proving the local central limit theorem. We choose $\gamma$ as a function of $\Delta$, $\beta$, and $\eta$, and we prove that when the Ising model on the collection of gadget graphs is conditioned to have magnetization $\eta$, with high probability the phases of the gadgets are split in fractions $\gamma$ and $1-\gamma$. Then a good approximation algorithm for the $\eta$-magnetization partition function can recover a minimum $\gamma$-balanced cut. \subsection{Related work} The algorithmic problem of sampling configurations of a fixed magnetization (or fixed size, in the case of independent sets) is the problem of sampling from the `canonical ensemble' in the language of statistical physics (in contrast to the `grand canonical ensemble' of the usual Ising or hard-core model). Work on this problem goes back to the very first Markov Chain Monte Carlo algorithm designed to sample from the canonical ensemble of hard spheres~\cite{metropolis1953equation}. Conservative dynamics such as these are still among the most used in current scientific applications (e.g.,~\cite{bernard2009event}). Grand canonical ensembles are generally more amenable to mathematical analysis due to their conditional independence properties, and much is known about both specific algorithms for sampling from these distributions (e.g. Glauber dynamics~\cite{mossel2013exact}, random-cluster dynamics~\cite{guo2018random}) and about the computational complexity of the approximate counting and sampling problems for these models. The computational complexity of approximately counting and sampling independent sets of a given size in bounded-degree graphs was recently addressed by Davies and Perkins who proved a computation threshold for these problems~\cite{davies2021approximatelyICALP}. As in Theorem~\ref{thmFixedSupercriticalBeta}, the threshold is given in terms of an extremal graph theory problem: that of minimizing the occupancy fraction over $G \in \mathcal{G}_{\Delta}$. Faster algorithms and an FPTAS up to the threshold for this problem were recently given in~\cite{jain2021approximate}. The use of random graphs as gadgets in hardness reductions was pioneered by Dyer, Frieze, and Jerrum~\cite{dyer2002counting} and used by Sly in identifying the computational threshold for the hard-core model~\cite{Sly10}, with further applications in~\cite{SS14,GSV15,cai2016hardness,GSVY16} among others. In particular, a detailed understanding of the moments of the partition function $Z_G$ for random regular graphs is now known, and, via the small subgraph conditioning method, concentration results for $Z_G$. We use this understanding extensively in Section~\ref{secHardness}. Finally, the Ising model at fixed magnetization has been studied extensively in both mathematics and physics, on $\mathbb Z^d$ and on random graphs~\cite{mezard1987mean}. Conditioning the ferromagnetic Ising model on zero magnetization has the effect of introducing `frustration': the impossibility of satisfying all edge constraints simultaneously. At zero temperature ($\beta =\infty$), the zero-magnetization Ising model is simply the uniform distribution on min-bisections of a graph; finding the size of the min bisection has long been known to be NP-hard~\cite{garey1974some}. The min-bisection problem is also studied on random graphs from the perspective of statistical physics~\cite{percus2008peculiar,zdeborova2010conjecture,diaz2004computation,dembo2017extremal}. Our work is an exploration of the worst-case computational complexity of the positive temperature regime of this problem. \subsection{Questions and future directions} Though we do not pursue it in this extended abstract, it is likely that the techniques of Jain, Perkins, Sah, and Sawhney~\cite{jain2021approximate} can be used to improve the algorithmic results of Theorems~\ref{thmAlgFixedSubcriticalBeta} and~\ref{thmFixedSupercriticalBeta} in two ways: \begin{enumerate} \item Obtain an FPTAS (efficient deterministic approximation algorithm) for \csproblem{Fixed-Ising}$(G,\beta,\eta)$ for the same range of parameters for which we obtain an FPRAS. \item Improve the running time of our approximate sampling algorithm to $\tilde O( n \log n)$. \end{enumerate} We have shown here a computational threshold for the fixed-magnetization Ising model. One can also ask what is achievable with a specific algorithm widely used in scientific applications, namely the Kawasaki dynamics. We conjecture that the Kawasaki dynamics mix rapidly on all graphs of maximum degree $\Delta$ for the same set of parameters for which we provide an FPRAS. In fact there are two versions of the Kawasaki dynamics: the \emph{local flip} dynamics in which at each step a swap of spins across an edge is proposed; and the \emph{global flip} dynamics in which at each step a swap of arbitrary spins in the graph is proposed. We conjecture that both versions mix in polynomial time for the parameters above; we further conjecture that the global flip dynamics mix in time $O(n \log n)$. \begin{conj} For $\beta< \beta_c(\Delta)$, the Kawasaki dynamics mix in time polynomial in $n$ for any fixed magnetization and any graph $G$ of maximum degree $\Delta$ on $n$ vertices. For $\beta > \beta_c(\Delta)$ and $|\eta | > \eta_c(\Delta,\beta)$ the Kawasaki dynamics mix in time polynomial in $n$ for any fixed magnetization $k \ge \eta n$ and any graph $G$ of maximum degree $\Delta$ on $n$ vertices. For the global flip dynamics, the mixing time in both cases in $O(n \log n)$. \end{conj} In the previous uses of random (bipartite) graphs as gadgets in hardness reductions for approximate counting problems, the gadgets themselves are not in general hard instances for the given problems. In particular, recent results~\cite{JenssenAlgorithmsJ,helmuth2020finite,chen2021sampling,jenssen2021approximatelySODA} show that for parameters sufficiently deep in the given non-uniqueness regimes, random regular graphs are tractable instances for approximate counting and sampling. We ask whether for random graphs there are efficient algorithms anywhere inside the NP-hardness regime. \begin{question} For $\Delta \ge 3$, $\beta>\beta_c(\Delta)$, is there some $|\eta| < \eta_c(\Delta,\beta)$ so that there exist efficient approximate counting and sampling algorithms for \csproblem{Fixed-Ising}$(G,\beta,\eta)$ for random $\Delta$-regular graphs? \end{question} \subsection{Organization} In Section~\ref{secPrelim} we provide some of the results we will use in our algorithms and hardness reductions. In Section~\ref{secHardness} we give the hardness reduction. In Section~\ref{secExtremal} we prove Theorem~\ref{thmExtremal}, solving the extremal problem that identifies the limit of our algorithmic approach. In Section~\ref{secAlgorithms} we prove the algorithmic results. \section{Preliminaries} \label{secPrelim} Recall that $\mathcal{G}_\Delta$ denotes the class of graphs of maximum degree $\Delta$. We use $\mu_{G,\beta,\lambda}$ to denote the Ising model on $G$ at inverse temperature $\beta $ and activity $\lambda$. We will often drop $\beta$ from the notation when it remains fixed and we will drop $\lambda$ from the notation in the case $\lambda=1$ (so $\mu_G = \mu_{G,\beta,1}$ when $\beta$ is understood from the context). We use the bracket notation $\langle \cdot \rangle_{G,\beta,\lambda}$ to denote expectations with respect to the Ising model, in part to distinguish these expectations from expectations over random graphs in Section~\ref{secHardness}. For a graph $G$, let $\Sigma_G = \{ \pm 1\}^{V(G)}$. Slightly abusing notation, for $U \subset V(G)$, let $\Sigma_U = \{ \pm 1\}^U$. We let $M(\sigma)$ denote the magnetization of a configuration $\sigma$ and $X(\sigma)$ denote the number of $+$ spins (so $M(\sigma) = 2 X(\sigma) - |V(G)|$). We let $\mathbf{X}$ denote the random variable $X(\sigma)$ when $\sigma$ is drawn from $\mu_{G,\beta,\lambda}$. We now collect a number of results that we will use in the proofs that follow. The first results are results on zero-free regions for the Ising model partition function, viewed as a (Laurent) polynomial in $\lambda$. \begin{theorem}[Lee--Yang~\cite{lee1952statistical}]\label{thmLeeYang} For $\beta \ge 0$, $\lambda \in \mathbb C$, and any graph $G$, $Z_G(\beta,\lambda) =0$ only if $|\lambda|=1$. \end{theorem} \begin{theorem}[Peters--Regts~\cite{PR20}]\label{thmzerofree} Let $\Delta\ge 3$ and $\beta\in(0, \beta_c(\Delta))$. Then there exists $\theta=\theta(\beta)\in(0,\pi)$ such that for any $\lambda\in\mathbb{C}$ with $|\arg(\lambda)| < \theta$ and any graph $G\in\mathcal{G}_\Delta$ we have $Z_G(\beta,\lambda)\ne 0$. \end{theorem} By the following general result of Michelen and Sahasrabudhe, these zero-freeness results imply central limit theorems for the magnetization of the ferromagnetic Ising model on graphs in $\mathcal{G}_\Delta$ when $\beta<\beta_c(\Delta)$ or when $\lambda >1$. We apply this result to a random variable counting the number of $+1$ spins in a sample from the Ising model; its generating function is a scaling of $Z_G(\beta,\lambda)$. \begin{theorem}[Michelen--Sahasrabudhe~\cite{MS19}]\label{thm:clt} For $n\ge 1$ let $\mathbf{X}_n$ be a random variable taking values in $\{0,\dotsc,n\}$ with mean $\mu_n$, standard deviation $\sigma_n$, and probability generating function $f_n$. If the roots $\zeta$ of $f_n$ satisfy $|\arg(\zeta)|\ge \delta_n$ and $\sigma_n\delta_n\to\infty$, then $(X_n-\mu_n)/\sigma_n$ converges in distribution to a standard normal random variable. \end{theorem} A central limit theorem for the magnetization in fact implies a local central limit theorem, following the approach of Dobrushin and Tirozzi~\cite{dobrushin1977central} (for spin models on $\mathbb Z^d$) and the results of~\cite{jain2021approximate} for the hard-core model. Let $\mathbf{X}$ denote the number of $+1$ spins in a sample from the Ising model. \begin{prop} \label{propLocalCLTalg} Fix $\lambda >1$ and $\beta \ge 0$. Then for any graph $G \in \mathcal{G}_{\Delta}$ on $n$ vertices and any non-negative integer $\ell$, \[ \mu_{G, \beta, \lambda} \left( \mathbf{X} = \ell \right) = \frac{1}{\sqrt{2\pi \var(\mathbf{X})} } \exp \left[ - \frac{(\ell- \langle \mathbf{X} \rangle_{G,\beta, \lambda} )^2 }{2\var(\mathbf{X}) } \right ] + o(n^{-1/2}) \,,\] where $\var(\mathbf{X}) = \langle \mathbf{X}^2 \rangle_{G,\beta,\lambda} - \langle \mathbf{X} \rangle_{G,\beta,\lambda}^2$, and where the implied constant in the error term depend only on $\Delta, \beta, \lambda$. The same holds for $\beta<\beta_c$, $\lambda \ge 1$, and any $G \in \mathcal{G}_{\Delta}$. Moreover, under the conditions above $\var(\mathbf{X}) = \Theta(n)$ where again the implied constants depend only on $\Delta, \beta, \lambda$. \end{prop} We prove Proposition~\ref{propLocalCLTalg} in Appendix~\ref{secAppendixCLT}; the proof of the local central limit theorem is analogous to that of~\cite[Theorem 1.5]{jain2021approximate} and the proof of the variance bound is analogous to that of~\cite[Lemma 9]{davies2021approximatelyICALP} and~\cite[Lemma 3.2]{jain2021approximate}. For the hardness results, we reduce an \textup{NP}-hard cut problem to the problem of approximating the Ising model at fixed magnetization. The $\gamma$-\csproblem{Min-Exact-Balanced-Cut} ($\gamma$-\csproblem{MEBC}) problem is the problem of finding the minimum of $|E(S, S^c)|$ over all $S\subset V(G)$, $|S| = \lfloor \alpha n \rfloor$, where $n= |V(G)|$. For stronger inapproximability in Theorem~\ref{thmFixedSupercriticalBeta}\ref{hardFixedSuper}, we apply an inapproximability result due to Bui and Jones~\cite{bui1992finding}, though this is not essential to our method: we can reduce from exactly solving $\gamma$-\csproblem{MEBC} instead. \begin{theorem}[Bui--Jones~\cite{bui1992finding}]\label{thmMEBC} Let $\gamma$ be a rational number in $(0,1)$ and let $\varepsilon>0$. Then $\gamma$-\csproblem{MEBC} is \textup{NP}-hard to approximate within an additive error $n^{2-\varepsilon}$ on $n$-vertex graphs. \end{theorem} A key ingredient in the algorithmic results are the efficient approximate counting and sampling algorithms for the ferromagnetic Ising model provided by Jerrum and Sincalir and Randall and Wilson. \begin{theorem}[Jerrum--Sinclair~\cite{JS93}, Randall-Wilson~\cite{randall1999sampling}] \label{thmIsingFPRAS} For all inverse temperatures $\beta$ and all activities $\lambda$, there is an FPRAS and efficient sampling scheme for the Ising model for all graphs $G$. \end{theorem} \section{Hardness} \label{secHardness} \subsection{The reduction and its properties}\label{secHardnessReduction} Given $\Delta \ge 3$, $\beta> \beta_c(\Delta)$ and $\eta \in [0, \eta_c)$, our goal is to reduce $\gamma$-\csproblem{Min-Exact-Balanced-Cut} to approximating a fixed-magnetization Ising partition function, for some rational number $\gamma\in((1+\eta/\eta_c)/2, 1)$. (By symmetry we need only consider $\eta \ge 0$). For the reduction we require a gadget $G=G(\Delta,n,\theta,\psi)$ where $\theta,\psi\in(0,1/8)$ are constants that can be determined later in terms of $\Delta,\beta$. The gadget is identical to the constructions in~\cite{Sly10,GSVY16}, which is a balanced bipartite graph on $n_G = (2+o(1))n$ vertices. The majority of the vertices have degree $\Delta$, and $m=O(n^{\theta})$ vertices on each side of $G$ are designated \emph{terminal vertices} of degree $\Delta-1$. We detail the construction of the gadget and state its properties after showing how it is used in the reduction. Let $H$ be a graph on $h = \lfloor n^{\theta/4}/(\Delta-1)\rfloor$ vertices, which is the input for $\gamma$-\csproblem{MEBC}. Given $G$ as above and an integer $s$, we construct a graph $H^G_s$ of maximum degree $\Delta$ on $ N:= h n_G + s$ vertices as follows: \begin{itemize} \item We include a copy $G^x$ of $G$ for each vertex $ x \in V(H)$. \item We include $s$ isolated vertices. \item For each edge $xy \in E(H)$, we include a matching of size $k=\lfloor n^{3\theta/4}\rfloor$ between the left terminals of $G^x$ and left terminals of $G^y$ and a matching of size $k$ between the right terminals of $G^x$ and right terminals of $G^y$. We do this in such a way that each terminal is used at most once (which is possible since $kh\le m$). \end{itemize} For reference, our parameter choices are listed here. The parameters $\Delta$, $\beta$ are fixed and we can compute $\eta_c$ from them (to arbitrary precision). The parameter $\eta$ is fixed and satisfies the conditions of the theorem. From these parameters we compute an arbitrary rational number $\gamma$ such that \[ \frac{1+\eta/\eta_c}{2} < \gamma < 1, \] which is possible because $\eta\in[0,\eta_c)$. Suitable choices of $\theta,\psi\in(0,1/8)$ can be made in terms of $\Delta,\beta$ (see Lemma~\ref{lemGadgetZ}). We are then given an instance $H$ of $\gamma$-\csproblem{Min-Exact-Balanced-Cut} on $h$ vertices with $h$ sufficiently large, and we choose an $n$ large enough that $h \le n^{\theta/4}/(\Delta-1)$. Let $h_+ = \lfloor \gamma h \rfloor$ and $h_- = \lceil (1-\gamma) h \rceil$ so that the $\gamma$-\csproblem{Min-Exact-Balanced-Cut} problem is to find the minimum of $|E(S,S^c)|$ over $S \subset V(H)$ with $|S| = h_+$. We insist that $h$ is large enough that $\min \{ h_+, h_-\} \ge 1$. Now let \begin{itemize} \item $m=(\Delta-1)^{\lfloor\theta\log_{\Delta-1}n\rfloor}= o(n^{1/8})$, \item $m'=(\Delta-1)^{\lfloor\theta\log_{\Delta-1}n\rfloor + \lfloor\psi\log_{\Delta-1}n\rfloor} = o(n^{1/4})$, \item $n_G = 2(n+ m' + m((\Delta-1)^{\lfloor\psi\log_{\Delta-1}n\rfloor}-1)/(\Delta-2)) = (2+o(1))n$ \item $k = \lfloor n^{3\theta/4}\rfloor$, \item $s$ be a non-negative integer such that \begin{equation}\label{eqScondition} \big | 2n(h_+ - h_-) \eta_c - \eta [h n_G + s] \big| \le \sqrt{nh} \,, \end{equation} and $s = \Theta(nh)$, \item $N = h n_G + s $, \item $M^* = h_+ - h_-$, \item $\delta>0$ be small enough as a function of $\gamma$ and $\eta_c$, \item $\ell = \lfloor N (\eta+1)/2 \rfloor$. \end{itemize} The parameters $m,m',n_G,k$ relate to the gadget construction that we detail below. There exists an $s$ satisfying~\eqref{eqScondition} with $s=\Theta(nh)$ which can be found in time polynomial in $h$ because our parameter choices mean that (as $h\to\infty$) \[ 2n(h_+-h_-)\eta_c = (2+o(1))\cdot (2\gamma-1)\eta_c \cdot nh, \] and \[ \eta [hn_G + s] = (2+o(1))\cdot \eta \cdot nh + O(s). \] Since $(2\gamma-1)\eta_c > \eta$, for some non-negative integer $s= \Theta(nh)$ the latter can be made within an additive term $O(1)$ of the former (and hence within $\sqrt{nh}$). Finally, $N$ is the number of vertices in the graph $H^G_s$ which we construct in the reduction, $M^*$ is the magnetization of the cuts considered for the $\gamma$-\csproblem{MEBC} problem on $H$, and $\ell$ is such that on $H^G_s$ \csproblem{Fixed-Ising}$(G,\beta,\eta)$ asks for configurations $\sigma$ with $X(\sigma) = \ell$ (and the desired fixed magnetization is thus $2 \ell -N$). Throughout this section there are many absolute constants (depending only on $\Delta, \beta, \eta$) used and defined. For ease of reading we will make ample use of $O(\cdot)$ and $\Omega(\cdot)$ notation as well as reusing constants $C, c$ etc. The main result of this section is the following. \begin{theorem}\label{thmHardness} Given $\varepsilon\in(0,1)$ there exists $\zeta > 0$ such that there is a randomized, polynomial-time algorithm to construct a graph $G$ as above so that with probability at least $2/3$ the following holds: given an $e^{N^\zeta}$-relative approximation to $Z^{\mathrm{fix}}_{H^G_s} (\beta, 2\ell -N) $ one can compute, in time polynomial in $h$, an additive $h^{2-\varepsilon}$ approximation to the $\gamma$-\csproblem{Min-Exact-Balanced-Cut} of $H$. \end{theorem} \noindent Theorem~\ref{thmHardness} together with Theorem~\ref{thmMEBC} immediately gives Theorem~\ref{thmFixedSupercriticalBeta}\ref{hardFixedSuper}. \subsection{The gadget} We use the same gadget construction as in~\cite{Sly10,GSVY16}. The construction is defined by the maximum degree $\Delta$, an integer $n$ and constants $\theta,\psi\in(0,1/8)$ which then determine the parameters $m,m',n_G,k$ listed above. To construct $G=G(\Delta,n,\theta,\psi)$, let $G'=G'(\Delta,n,\theta,\psi)$ be a random bipartite graph with $n+m'$ vertices on each side obtained by choosing $\Delta$ perfect matchings between the sides uniformly at random, and from the final matching removing $m'$ of the edges. With high probability the matchings will be pairwise disjoint sets of edges, so $G'$ is a simple graph. Let $U_0$ be the set of vertices of degree $\Delta$ in $G'$, and $W_0$ be the set of vertices of degree $\Delta-1$. To form $G$ from $G'$, on each side partition the $m'$ vertices of degree $\Delta-1$ into $m$ equal-sized sets, and attach the leaves of a copy of a $(\Delta-1)$-ary tree of depth $\lfloor\psi\log_{\Delta-1}n\rfloor$ to each set. Then each side of $G'$ has had $m$ trees each of which contains $O(n^\psi)$ vertices added. The roots of these trees are now the only vertices of degree $\Delta-1$ in $G$, and there are $m$ roots that were added to each side. These are the \emph{terminal} vertices which allow us to connect the gadgets together. Let $V_0$ be the vertex set of $G$, and $R_0$ be the terminal vertices. Constructed in this way, we want to show that various properties of $G'$ and $G$ hold with sufficiently high probability. Many of these properties were verified in~\cite{Sly10,GSVY16}, but we require additional control of statistics of the number of $+1$ spins. Throughout this entire section we fix the inverse temperature $\beta>\beta_c$ and take $\lambda=1$. Recall that $\mathbf{X}$ denotes the number of $+1$ spins in a sample from the Ising model. We will condition on various \emph{phases} of the Ising model on $G$ and on $H^G_s$. For $G$, given an Ising configuration $\sigma \in \Sigma_G$, we say the phase is $+$ if $\sum_{v \in U_0} \sigma_v >0$ and $-$ if $\sum_{v \in U_0} \sigma_v <0$. If the sum is $0$ then we take the phase to be the spin of some distinguished vertex $u_1 \in U_0$ fixed in advance (arbitrarily). Note that neither the spins of $W_0$ nor the spins of the trees added to $G'$ in the construction of $G$ appear in the definition of the phase. By symmetry, the probability under $\mu_G$ of each phase is exactly $1/2$. We denote the Ising model on $G$ conditioned on the $+$ phase and $-$ phase respectively by $\mu_{G,+}$ and $\mu_{G,-}$. We use $\langle \cdot \rangle _{G,+}$ and $\langle \cdot \rangle _{G,-}$ to denote the corresponding conditional expectation operators. For a spin assignment $\tau\in \Sigma_{R_0}$ to the terminals of $G$, we include an additional subscript $\tau$ to denote conditioning on the event $ \{ \sigma_{R_0}=\tau \}$ (that is, $\sigma$ restricted to $R_0$ is equal to $\tau$). Let $Z_{G,\alpha}$ be the contribution to the partition function $Z_{G}$ of the Ising model on the random gadget $G$ from spin assignments in which there are precisely $2\alpha n$ vertices in $U_0$ of spin $+$. Let $Z_{G,+}$ and $Z_{G,-}$ be the contributions from the $+$ and $-$ phase respectively to $Z_{G}$. We have \[ Z_{G,+} = \sum_{1/2 < \alpha \le 1} Z_{G,\alpha} + \frac{1}{2}Z_{G,1/2}, \] because all contributions with $\alpha>1/2$ belong to the $+$ phase, but for $\alpha=1/2$ we break the tie symmetrically so that half the contribution $Z_{G,1/2}$ goes to the $+$ phase. Usually, it suffices to use the upper bound on $Z_{G,\pm}$ obtained by taking the entire contribution from $\alpha=1/2$ to the phase at hand. We now state some results from~\cite{Sly10,GSV15,GSVY16} which are obtained by sophisticated versions of the first and second moment methods and an application of the small subgraph conditioning method~\cite{robinson1994almost,janson1995random}. We will state the results for the $+$ phase, the $-$ phase is completely analogous. Let $\alpha^+ = (1+\eta_c)/2$, $\alpha^- = (1-\eta_c)/2$, and \begin{equation}\label{eqTreeMarginals} q = \frac{(\alpha^+ e^\beta +1-\alpha^+ )^{\Delta-1} }{(\alpha^+ e^\beta +1-\alpha^+ )^{\Delta-1} + (\alpha^+ +(1-\alpha^+)e^\beta )^{\Delta-1} }, \end{equation} which means $q$ is the probability that the root of a $(\Delta-1)$-ary tree gets spin $+1$ in the zero-field `$+$ measure' on the infinite $(\Delta-1)$-ary tree (defined analogously to the $+$ measure on the infinite $\Delta$-regular tree). Note that $1/2 < q < \alpha^+$. We use $Q_S^{+}(\cdot)$ to denote the product measure on $\Sigma_S$ that assigns probability $q$ to $+1$ spins and probability $1-q$ to $-1$ spins, and vice versa for $Q_S^{-}(\cdot)$. The following lemma collects previous results on the gadget, most notably the near independence of the terminal spins conditioned on a phase. \begin{lemma}[{\cite[Proof of Theorem 2.1]{Sly10},~\cite[Proof of Lemma~B.3]{GSV15},~\cite[Lemma~22]{GSVY16}}] \label{lemGadgetZ} Let $G$ be the random graph described above with parameters $\theta,\psi\in(0,1/8)$. Then there exists $c>0$ so that for all $\alpha\in[1/2,1]$, \begin{align*} \frac{\mathbb{E} Z_{G,\alpha}}{\mathbb{E} Z_{G,+}} &\le \frac{C}{\sqrt{n}} e^{-cn(\alpha+\alpha^+)^2}, \end{align*} and for all $\alpha\in[0,1/2]$ \begin{align*} \frac{\mathbb{E} Z_{G,\alpha}}{\mathbb{E} Z_{G,-}} &\le \frac{C}{\sqrt{n}} e^{-cn(\alpha+\alpha^-)^2}. \end{align*} Moreover, there exist choices of constants $\theta,\psi\in(0,1/8)$ and $C'>0$ so that for large enough $n$, with probability at least $9/10$ over the choice of $G$, all of the following hold simultaneously: \begin{enumerate}[(i)] \item\label{itmTerminalProductMeasure} Conditioned on phase $+$, the terminal spins are approximately independent: \[ \max_{\tau\in \Sigma_{R_0}} \left| \frac{\mu_{G,+} ( \sigma_{R_0} = \tau)}{ Q^+_{R_0}(\tau)} - 1 \right| \le n^{-2\theta}. \] \item\label{itmBadTau} There exists $\mathcal B \subset \Sigma_{W_0}$ so that \begin{itemize} \item $\mu_{G,+}(\sigma_{W_0} \in \mathcal B) \le \exp (-n^{2 \theta}) $ \item For every $\tau_{W_0} \in \Sigma_{W_0}\setminus \mathcal B$, \[ \max_{\tau_{R_0} \in \Sigma_{R_0}} \left | \frac{ \mu_{G,+} (\sigma_{R_0} = \tau_{R_0} | \sigma_{W_0} =\tau_{W_0}) } { Q_{R_0}^+(\tau_{R_0}) } -1 \right| \le n^{-3 \theta} \] \end{itemize} \item\label{itmZlowerBound} \[ Z_{G,+} > \frac{1}{C'} \mathbb{E} Z_{G,+} \,. \] \end{enumerate} The same also hold with $+$ replaced by $-$. \end{lemma} In previous works~\cite{Sly10,GSVY16} a version of~\ref{itmZlowerBound} with $1/C'$ replaced by a function $o(1)$ as $n\to \infty$ is used (along with the fact that this weaker bound holds with high probability), but the stated version follows from the small subgraph conditioning method used therein~\cite{robinson1994almost,janson1995random}. In order to handle the fixed-magnetization constraint in our reduction, we show that certain additional properties hold with good probability. \begin{lemma}\label{lemGadgetProperties} For sufficiently large $n$, with probability at least $8/10$ over the choice of the gadget $G$ described above, the following hold simultaneously, for all choices of $\tau \in\Sigma_{R_0}$ (and for $+$ replaced by $-$ as well): \begin{enumerate}[(a)] \item\label{itmFirstMoment} \[ \langle \left | \mathbf{X} - 2n\alpha^+ \right| \rangle_{G,+, \tau} = O( \sqrt{n } ) \] \item\label{itmVariance} \[ \big\langle |\mathbf{X} - 2n \alpha^+|^2 \big\rangle_{G,+, \tau} = O(n) \] \item\label{itm3rdmoment} \[ \big\langle |\mathbf{X} - 2n \alpha^+|^3 \big\rangle_{G,+, \tau} = O(n^{3/2}) \] \item\label{itmMGF} For $\delta >0$ as specified above and $t_0 = \delta/(2 c_0 h)$ for some constant $c_0 >1/4$, \begin{align*} \big\langle e^{t_0 (\mathbf{X} - 2\alpha^+n)} \big\rangle_{G,+, \tau} \le e^{c_0 t_0^2 n} \intertext{and} \big\langle e^{t_0( 2\alpha^+n - \mathbf{X})} \big\rangle_{G,+, \tau} \le e^{c_0 t_0^2 n} \, . \end{align*} \end{enumerate} \end{lemma} We prove Lemma~\ref{lemGadgetProperties} in Section~\ref{lemGadgetProperties}. \subsection{Proof of Theorem~\ref{thmHardness}} Here we prove Theorem~\ref{thmHardness} given Lemmas~\ref{lemGadgetZ} and~\ref{lemGadgetProperties}. Let $G$ be a gadget which satisfies the conclusions of these lemmas, and let $H^G_s$ denote the graph constructed from $H$, $G$ and isolated vertices as above. Let $\hat H^G_s$ denote the same graph but without the edges between gadgets (so $\hat H^G_s$ consists of $h$ disjoint copies of $G$ and $s$ isolated vertices). We write $\mathcal{E}$ for the set of edges $E(H_s^G)\setminus E(\hat H_s^G)$ that lie between gadgets. Given $\sigma \in \Sigma_{ H^G_s}$, let $Y(\sigma) \in \Sigma_H$ be a vector denoting the phases of the gadgets $G^x$, $x \in V(H)$. We will call such a $Y$ a \emph{phase vector}. For a given $Y \in \Sigma_H$ let $\mu_{H^G_s, Y}$ be the Ising model on $H^G_s$ conditioned on $ \{ Y(\sigma) = Y \}$. Let $\langle \cdot \rangle_{H^G_s,Y}$ be the corresponding expectation operator. Define $\mu_{\hat H^G_s, Y}$ and $\langle \cdot \rangle_{\hat H^G_s,Y}$ analogously. For $x\in V(H)$ let $R^x$ be the set of terminals in the gadget $G^x$, and let $R$ be the union of the terminal vertices in all the copies of the gadget. For a spin assignment $\tau\in \Sigma_R$ to the terminals, we include an additional subscript $\tau$ to indicate conditioning on the event that $\{ \sigma_R=\tau \}$. We need two probabilistic results before proving Theorem~\ref{thmHardness}. The first is a large deviation bound for $\mathbf{X}$ conditioned on any phase vector $Y$ and any assignment of terminal spins $\tau$. The second is a local central limit theorem for $\mu_{\hat H^G_s, Y,\tau} (\mathbf{X}= \ell)$ when $M(Y) = M^* $, and for an arbitrary terminal spin assignment $\tau$. \begin{lemma}\label{lemLD} Assume the gadget $G$ satisfies the conclusions of Lemma~\ref{lemGadgetProperties}. Then for any phase vector $Y$, any $\tau \in \Sigma_W$, with \[ \nu = \frac{s}{2} + 2n \sum_{x \in V(H)} \alpha^{Y_x} \,, \] we have \[ \mu_{\hat H^G_s, Y,\tau} \Big ( \big | \mathbf{X} - \nu \big | \ge \delta n\Big) \le \exp \left (- \Omega(n/h) \right ) \,, \] where $\delta>0$ is a constant defined above. \end{lemma} \begin{proof} Note that to leading order $\nu$ is the mean $\langle \mathbf{X} \rangle_{\hat H^G_s,Y,\tau}$. We prove the bound on the upper tail; the proof for the lower tail is identical. Let $\mathbf{X}_s \sim \mathrm{Bin}(s,1/2)$ be the number of $+$ spins among the $s$ isolated vertices. Then $\langle e^{t_0 (\mathbf{X}_s-s/2)} \rangle \le e^{st_0^2/4} \le e^{sc_0 t_0^2}$ since $c_0 >1/4$. Using this along with Lemma~\ref{lemGadgetProperties} we can bound the moment generating function, \begin{align*} \langle e^{ t_0 (\mathbf{X} - \nu)} \rangle_{\hat H^G_s, Y,\tau} &\le e^{c_0t_0^2 nh} \,, \end{align*} for some constant $c>0$. Then we have \begin{align*} \mu_{\hat H^G_s, Y,\tau} ( \mathbf{X} \ge \nu + \delta n ) &\le e^{-t_0 \delta n} \langle e^{ t_0 (\mathbf{X} - \nu)} \rangle_{\hat H^G_s, Y,\tau} \\ &\le e^{-t_0 \delta n + ct_0^2 nh} = e^{- \frac{\delta n}{4h}} \end{align*} since $t_0= \delta/(2ch)$. \end{proof} The next lemma is a local central limit theorem for $\mathbf{X}$ with respect to $\mu_{\hat H^G_s, Y, \tau}$. \begin{lemma}\label{lemCLT} Assume the gadget $G$ satisfies the conclusions of Lemma~\ref{lemGadgetProperties}. Then for any phase vector $Y \in \Sigma_H$ with $M(Y) = M^*$, any $\tau \in \Sigma_W$, and any integer $t$, \[ \mu_{\hat H^G_s, Y, \tau} \left ( \mathbf{X} =t \right) = \frac{1}{\sqrt{2\pi \kappa^2}} \exp \left[ - \frac{ (t - \langle \mathbf{X} \rangle_{\hat H^G_s, Y, \tau} )^2} {2 \kappa^2} \right] +o \left( \frac{1}{\sqrt{nh }} \right) \,, \] where $\kappa^2 = \var_{\hat H^G_s, Y, \tau}(\mathbf{X})$. In particular, \[ \mu_{\hat H^G_s, Y, \tau} \left ( \mathbf{X} =\ell \right) = \Omega \left( \frac{1}{\sqrt{nh }} \right) \,. \] \end{lemma} \begin{proof} We have $s= \Theta(nh)$, and by the independence of disjoint gadgets and the second moment bound in Lemma~\ref{lemGadgetProperties}, we have $\kappa^2 = \Theta(nh)$. Moreover, by our choice of $s$ and the fact that $M(Y) = M^*$, we have $| \langle \mathbf{X} \rangle_{\hat H^G_s, Y, \tau} -\ell| = O(\sqrt{nh})$, and so the second statement follows from the first. The proof of the first statement is similar to that of Proposition~\ref{propLocalCLTalg} in Appendix~\ref{secAppendixCLT}, but here things are especially simple because of the presence of $s= \Theta(nh)$ isolated vertices. We start by proving a central limit theorem with the standard method of characteristic functions. Let $\overline \mathbf{X} = \frac{1}{\kappa}\big(\mathbf{X} - \langle \mathbf{X} \rangle_{\hat H^G_s, Y, \tau} \big)$ and $\phi_{\overline \mathbf{X}}(t) = \langle e^{it \overline \mathbf{X}} \rangle_{\hat H^G_s, Y, \tau}$. Then \begin{align*} \phi_{\overline \mathbf{X}}(t) &= \left( \frac{1 + e^{it/\kappa}}{2} e^{-t/(2 \kappa)} \right)^s \prod_{x\in V(H)} \left\langle e^{\frac{it}{\kappa} (\mathbf{X} - \langle \mathbf{X} \rangle_{G, Y_x,\tau_{R^x}})} \right\rangle_{G, Y_x,\tau_{R^x}} \\ &= \left( 1 - \frac{ t^2 }{8 \kappa^2} + O(\kappa^{-3}) \right)^s \prod_{x\in V(H)} \left( 1- \frac{t^2 \var_{G, Y_x,\tau_{R^x}}(\mathbf{X})}{2 \kappa^2} +O\left(\kappa^{-3} n^{3/2} \right) \right) \\ &= e^{-t^2/2} + o(1) \,, \end{align*} since $hn^{3/2} \kappa^{-3} = O( h^{-1/2}) \to 0$. Here we used the bound on the third moment of $\mathbf{X}$ in a gadget given by Lemma~\ref{lemGadgetProperties}. This proves that $\overline \mathbf{X} \Rightarrow N(0,1)$. Let $\mathcal L$ denote the lattice $\langle \mathbf{X} \rangle_{\hat H^G_s, Y, \tau} + \mathbb Z/\kappa$. Let $\mathcal N(x) = \frac{1}{\sqrt{2 \pi} } e^{-x^2/2}$. We want to show that \[ \sup_{x \in \mathcal L} \left | \kappa \mu_{\hat H^G_s, Y, \tau} ( \overline \mathbf{X} = x) - \mathcal N(x) \right| = o(1) \,,\] since $\kappa = \Theta(\sqrt{nh})$. Using Fourier inversion (as in Appendix~\ref{secAppendixCLT}), we have for any $K>0$, \begin{align*} 2 \pi \sup_{x \in \mathcal L} &\left | \kappa\mu_{G,\beta, \lambda} ( \overline \mathbf{X} = x) - \mathcal N(x) \right| \\ &= \sup_{x \in \mathcal L} \left | \int_{-\pi \kappa }^{\pi \kappa} \phi_{\overline \mathbf{X}}(t) e^{-itx} \, dt - \int_{-\infty}^{\infty} e^{-t^2/2 - itx } \, dt \right | \\ &\le \int_{-\pi \kappa}^{\pi \kappa} \left | \phi_{\overline \mathbf{X}}(t) - e^{-t^2/2} \right | \, dt +\int_{|t| > \pi \kappa}e^{-t^2/2 } \, dt \\ &\le \int_{-K }^{K} \left | \phi_{\overline \mathbf{X}}(t) - e^{-t^2/2} \right | \, dt + \int_{|t| \ge K}e^{-t^2/2} \, dt + \int_{|t| \ge K} \left | \phi_{\overline \mathbf{X}}(t) \right | \, dt \\ &=: A_1 + A_2 +A_3 \,. \end{align*} Because $\phi_{\overline X}(t) = e^{-t^2/2} +o(1)$, applying the bounded convergence theorem gives that $A_1 \to 0$ as $n \to \infty$ for any fixed $K$, so we can choose $n$ large enough to guarantee $A_1 < \varepsilon/3$. We can pick $K$ large enough to ensure $A_2 < \varepsilon/3$. For $A_3$, we use the fact that the portion of the characteristic function coming from the isolated vertices has nice behavior. In particular, \begin{align*} | \phi_{\overline X}(t) | &\le \left( \frac{1 + e^{it/\kappa}}{2} e^{-t/(2 \kappa)} \right)^s \\ &\le e^{-\frac{t^2 s}{4 \kappa^2}} = e^{- \Omega(t^2)} \end{align*} since $ s= \Theta(\kappa^2)$. Then by choosing $K$ large enough again we can make $A_3 < \varepsilon /3$ as well. \qedhere \end{proof} With these ingredients we can prove Theorem~\ref{thmHardness}. \begin{proof}[Proof of Theorem~\ref{thmHardness}] Recall that we assume $\Delta\ge3$, $\beta>\beta_c(\Delta)$, and that $\eta\in [0,\eta_c)$. Let $G$ be the gadget graph that satisfies the conclusions of Lemmas~\ref{lemGadgetZ} and~\ref{lemGadgetProperties}, and recall the notation of Section~\ref{secHardnessReduction} which includes the graph $H^G_s$ on $N$ vertices formed from copies of $G$ and $s$ isolated vertices. Let $b$ be the value of $\gamma$-\csproblem{MEBC} on the graph $H$, and let $\varepsilon > 0$. We will obtain upper and lower bounds on $b$ in terms of $Z^{\mathrm{fix}}_{H^G_s}(\beta,2\ell - N)$ such that for suitably small $\zeta$, an $e^{N^\zeta}$-relative approximation to $Z^{\mathrm{fix}}_{H^G_s}(\beta,2\ell - N)$ constrains $b$ to an interval of length at most $h^{2-\varepsilon}$. Since $\beta$ and the magnetization $2 \ell - N$ are fixed, we will write $Z^{\mathrm{fix}}_{H^G_s}$ for $Z^{\mathrm{fix}}_{H^G_s}(\beta,2 \ell - N)$. Moreover, for a phase vector $Y \in \Sigma_H$, we write $Z^{\mathrm{fix}}_{H^G_s}(Y)$ for the contribution to $Z^{\mathrm{fix}}_{H^G_s}$ from spin assignments with phase vector $Y$. For $\tau \in \Sigma_R$ we write $Z^{\mathrm{fix}}_{H^G_s}(Y,\tau)$ for the contribution to $Z^{\mathrm{fix}}_{H^G}(Y)$ from spin assignments $\sigma$ which agree with $\tau$ on the terminals $R$. Similarly, since we only consider the usual Ising model with no external field we write $Z_{\hat H^G_s}$ for $Z_{\hat H^G_s}(\beta,1)$. We start by bounding the partition function $Z^{\mathrm{fix}}_{H^G_s}$ from above. The first step is to split the partition function into sums over $Y$ according to whether $M(Y)=M^*$. We have \[ Z^{\mathrm{fix}}_{H^G_s} = \sum_{Y\in \Sigma_H}Z^{\mathrm{fix}}_{H^G_s}(Y) = \sum_{Y : M(Y) = M^*}Z^{\mathrm{fix}}_{H^G_s}(Y) + \sum_{Y : M(Y) \ne M^*}Z^{\mathrm{fix}}_{H^G_s}(Y). \] For an arbitrary phase vector $Y$ we split $Z^{\mathrm{fix}}_{H^G_s}(Y)$ into a sum over spin assignments $\tau\in \Sigma_R$ to the terminals and pull out the factor of the summand contributed by edges in $\mathcal{E}$, giving \[ Z^{\mathrm{fix}}_{H^G}(Y) = \sum_{\tau\in \Sigma_R}Z^{\mathrm{fix}}_{\hat H^G_s}(Y,\tau)\prod_{uv \in \mathcal{E}}e^{\frac{\beta}{2}\tau_u\tau_v}. \] To handle the fixed-magnetization constraint, observe that when $\sigma$ is drawn from the Ising model $\mu_{\hat H^G_s,Y,\tau}$ we have \[ Z^{\mathrm{fix}}_{\hat H^G_s}(Y,\tau) = Z_{\hat H^G_s}(Y,\tau)\cdot \mu_{\hat H^G_s,Y,\tau}(\mathbf{X} = \ell), \] which we can control with Lemmas~\ref{lemLD} and~\ref{lemCLT}. In the case $M(Y)=M^*$ we have \[ Z^{\mathrm{fix}}_{\hat H^G_s}(Y,\tau) = Z_{\hat H^G_s}(Y,\tau)\cdot \Omega(1/\sqrt{nh}) , \] and in the case $M(Y)\ne M^*$ we use \[ Z^{\mathrm{fix}}_{\hat H^G_s}(Y,\tau) = Z_{\hat H^G_s}(Y,\tau) \cdot \exp(-\Omega(n/h)) . \] For the sum over $Y$ with $M(Y)=M^*$ this means for some constant $C>0$, \begin{equation}\label{eqUbYbal} \sum_{Y : M(Y)= M^*} Z^{\mathrm{fix}}_{H^G_s}(Y) \le \frac{C}{\sqrt{nh}}\sum_{\tau\in \Sigma_R}Z_{\hat H^G_s}(Y,\tau)\prod_{uv \in \mathcal{E}}e^{\frac{\beta}{2}\tau_u\tau_v}. \end{equation} Now we can apply the phase-conditioned, nearly-independent terminal spins property of the gadget. Using Lemma~\ref{lemGadgetZ}\ref{itmTerminalProductMeasure} for the inequality (and the fact that $(1+ O(n^{-2\theta}))^{h} = 1+o(1)$), we have \[ Z_{\hat H^G_s}(Y,\tau) = Z_{\hat H^G_s}(Y) \cdot \mu_{\hat H^G,Y}(\sigma_R = \tau) \le (1+o(1))Z_{\hat H^G_s}(Y)Q^Y_R(\tau), \] where $Q^Y_R(\tau)$ is the probability measure on $\Sigma_R$ such that \[ Q^Y_R(\tau) = \prod_{x\in V(H)} Q^{Y_x}_{R^x}(\tau_{R^x}). \] Continuing from~\eqref{eqUbYbal} and absorbing factors into the constant, we have \begin{align*} \sum_{Y : M(Y)=M^*} Z^{\mathrm{fix}}_{H^G_s}(Y) \le \frac{C }{\sqrt{nh}}\sum_{Y : M(Y)=M^*}Z_{\hat H^G_s}(Y) \sum_{\tau\in\Sigma_R} Q^Y_R(\tau)\prod_{uv \in \mathcal{E}}e^{\frac{\beta}{2}\tau_u\tau_v}, \end{align*} and the final sum over $\tau$ can be expressed in terms of the number $\cut(Y)$ of edges of $H$ which are cut by the phase vector $Y$. This observation appears in~\cite{Sly10} and is precisely why nearly-independent phase-correlated spins are important in reductions such as these. Recall $q$ defined in~\eqref{eqTreeMarginals}. For every edge $xy\in E(H)$ cut by $Y$, there are precisely $2k$ edges in $\mathcal{E}$ such that the measure $Q^Y_W$ gives one endpoint spin $+1$ with probability $q$ and the other endpoint spin $+1$ with probability $1-q$. Such edges are monochromatic with probability $2q(1-q)$. Similarly, for every edge $xy\in E(H)$ not cut by $Y$ there are precisely $2k$ edges in $\mathcal{E}$ which are monochromatic with probability $q^2 + (1-q)^2$. Then for constants $\Theta = 2q(1-q)e^{\beta/2} + \big(q^2 + (1-q)^2\big)e^{-\beta/2}$ and $\Gamma = 2q(1-q)e^{-\beta/2} + \big(q^2 + (1-q)^2\big)e^{\beta/2}$ we have \[ \sum_{\tau\in \Sigma_R} Q^Y(\tau)\prod_{uv \in \mathcal{E}}e^{\frac{\beta}{2}\tau_u\tau_v} = \Gamma^{2k|E(H)|}(\Theta/\Gamma)^{2k\cut(Y)}. \] Note that $\Theta < \Gamma$ so that smaller cuts give larger quantities above. Finishing the upper bound started in~\eqref{eqUbYbal}, we have \begin{align*} \sum_{Y : M(Y)=M^*} Z^{\mathrm{fix}}_{H^G_s}(Y) &\le \frac{C}{\sqrt{nh}} \sum_{Y : M(Y)=M^*} Z_{\hat H^G_s}(Y) \Gamma^{2k|E(H)|}(\Theta/\Gamma)^{2k\cut(Y)} \\ &\le \frac{C}{\sqrt{nh}}\Gamma^{2k|E(H)|}(\Theta/\Gamma)^{2kb} Z_{\hat H^G_s}, \end{align*} because the $\gamma$-\csproblem{MEBC} $b$ of $H$ gives the largest contribution $(\Theta/\Gamma)^{2k\cut(Y)}$, and the partition function $Z_{\hat H^G_s}$ is an upper bound on $\sum_{Y : M(Y)=M^*}Z_{\hat H^G_s}(Y)$. For phase vectors $Y$ with $M(Y)\ne M^*$ it suffices to consider the worst-case contribution from edges between gadgets. For such $Y$, $\left | \frac{s}{2} + 2n \sum_{x \in V(H)} \alpha^{Y_x} - \ell \right| > \delta n$, and so we can apply Lemma~\ref{lemLD} to give \begin{align*} \sum_{Y : M(Y)\ne M^*} Z^{\mathrm{fix}}_{H^G_s}(Y) &\le 2e^{-\frac{\delta n}{4h}}\sum_{\tau\in \Sigma_R}Z_{\hat H^G_s}(Y,\tau)\prod_{uv \in \mathcal{E}}e^{\frac{\beta}{2}\tau_u\tau_v} \\ &\le e^{-\Omega(n/h)} e^{\frac{\beta}{2}|\mathcal{E}|} \sum_{\tau\in \Sigma_R}Z_{\hat H^G_s}(Y,\tau) \\ &\le e^{\beta k|E(H)| -\Omega(n/h)} Z_{\hat H^G_s}, \end{align*} because $|\mathcal{E}|=2k|E(H)|$. Our construction ensures that $k|E(H)| \le kh^2 = o(n/h)$ so that this is a negligible fraction of $Z_{\hat H^G_s}$. Combining these bounds, for all large enough $n$ we have \[ Z^{\mathrm{fix}}_{H^G_s} \le \left(\frac{C}{\sqrt{nh}} \Gamma^{2k|E(H)|}(\Theta/\Gamma)^{2kb} + e^{\beta k|E(H)| -\Omega(n/h)} \right)Z_{\hat H^G_s}. \] The term $\Gamma^{2k|E(H)|}(\Theta/\Gamma)^{2kb}$ is smallest when $b=|E(H)|$, but even in this case it is still at least $e^{-\beta k|E(H)|}$ as $\Theta > e^{-\beta/2}$. Thus, we can absorb the `error' term arising from phase vectors $Y$ with $M(Y)\ne M^*$ into $C$: \begin{equation}\label{eqZfixUB} Z^{\mathrm{fix}}_{H^G_s} \le \frac{C}{\sqrt{nh}}\Gamma^{2k|E(H)|}(\Theta/\Gamma)^{2kb} Z_{\hat H^G_s}. \end{equation} To give a lower bound on $Z^{\mathrm{fix}}_{H^G}$ it suffices to consider a single phase vector $Y^*$ with $\cut(Y)=b$ that corresponds to the $\gamma$-\csproblem{MEBC} of $H$. Then $M(Y^*)=M^*$ and for some constant $C'>0$ (which will absorb $(1+o(1))$ factors in the calculation below), we have \begin{align*} Z^{\mathrm{fix}}_{H^G_s} &\ge Z^{\mathrm{fix}}_{H^G_s}(Y^*) = \sum_{\tau\in \Sigma_R}Z^{\mathrm{fix}}_{\hat H^G_s}(Y^*,\tau)\prod_{uv \in \mathcal{E}}e^{\frac{\beta}{2}\tau_u\tau_v} \\ &\ge \frac{C'}{\sqrt{nh}}\sum_{\tau\in \Sigma_R}Z_{\hat H^G_s}(Y^*,\tau)\prod_{uv \in \mathcal{E}}e^{\frac{\beta}{2}\tau_u\tau_v} \\ &\ge \frac{C'}{\sqrt{nh}} Z_{\hat H^G_s}(Y^*) \sum_{\tau\in \Sigma_R}Q^{Y^*}(\tau)\prod_{uv \in \mathcal{E}}e^{\frac{\beta}{2}\tau_u\tau_v} \\ &= \frac{C'}{\sqrt{nh}} Z_{\hat H^G_s}(Y^*) \Gamma^{2k|E(H)|}(\Theta/\Gamma)^{2kb}, \end{align*} where we apply Lemma~\ref{lemCLT} to obtain the second line and the lower bound in~Lemma~\ref{lemGadgetProperties}\ref{itmTerminalProductMeasure} to obtain the third. Finally, since we have perfect symmetry between the phases we have $Z_{\hat H^G_s}(Y^*)=2^{-h}Z_{\hat H^G_s}$ and \[ Z^{\mathrm{fix}}_{H^G_s} \ge \frac{C'2^{-h}}{\sqrt{nh}} \Gamma^{2k|E(H)|}(\Theta/\Gamma)^{2kb} Z_{\hat H^G_s}. \] The upper bound from~\eqref{eqZfixUB} and the lower bound above combine to give \[ \frac{C'2^{-h}}{\sqrt{nh}} \Gamma^{2k|E(H)|}(\Theta/\Gamma)^{2kb} \le \frac{Z^{\mathrm{fix}}_{H^G_s}}{Z_{\hat H^G_s}} \le \frac{C}{\sqrt{nh}} \Gamma^{2k|E(H)|}(\Theta/\Gamma)^{2kb}, \] which provides the bounds \[ T - \frac{\log(2^h/C')}{2k\log(\Gamma/\Theta)} \le b \le T + \frac{\log C}{2k\log(\Gamma/\Theta)} \] on the min-bisection $b$ of $H$, where \[ T = \frac{\log(Z_{\hat H^G_s}/Z^{\mathrm{fix}}_{H^G_s}) + 2k|E(H)|\log \Gamma -\log\sqrt{nh}}{2k\log(\Gamma/\Theta)}. \] We can approximate $Z_{\hat H^G_s}$ to within an absolute constant factor in (randomized) time polynomial in $N$ (which is polynomial in $h$) by Theorem~\ref{thmIsingFPRAS}. For the theorem we suppose that we have a relative $e^{N^\zeta}$-approximation of $Z^{\mathrm{fix}}_{H^G_s}$, and hence if $\tilde T$ is given by the definition of $T$ above with $Z_{\hat H^G_s}$ and $Z^{\mathrm{fix}}_{H^G_s}$ replaced by these approximate values, we have $|\tilde T - T| \le O(N^\zeta/k)$ and hence \[ \tilde T - O\left(\frac{N^\zeta+h}{k}\right) \le b \le \tilde T + O\left(\frac{N^\zeta}{k}\right). \] Since $k = \Theta(h^3)$, this constrains $b$ to an interval of length $O\big(N^{\zeta}h^{-3}\big)$. Using $N = O(nh)$ with $n = O(h^{\theta/4})$, it suffices to choose $\zeta$ small enough in terms of $\theta$ and $\varepsilon$ that $(1+4/\theta)\zeta < 5-\varepsilon$. Note that we could reduce from solving min-bisection exactly at the cost of weaker inapproximability for $Z^{\mathrm{fix}}$ in the proof. If $\zeta$ is chosen such that $(1+4/\theta)\zeta < 3$ then the bounds constrain the integer $b$ to an interval of length $o(1)$ and hence for large enough $h$ we can find $b$ exactly. \end{proof} \subsection{Proof of Lemma~\ref{lemGadgetProperties}}\label{secGadget} We prove the lemma in the case of the $+$ phase as the $-$ phase is the same. Note that we can ignore the contribution of vertices in $R_0$ and the attached trees to $\mathbf{X}$ in the bounds since there are $o(n^{1/2})$ of these vertices. So for this section $\mathbf{X}$ and $X(\sigma)$ will refer to the number of $+$ spins in the vertices of $G'$. We first prove the three bounds of the lemma without conditioning on $\{ \sigma_{R_0} =\tau \}$. We will show that for large enough $n$, with probability at least $8/10$ over the choice of gadget, we have the following bounds: \begin{align} \label{eqNoCondbounds1} \big \langle | \mathbf{X} - 2n\alpha^+ | \big \rangle_{G,+} &=O( \sqrt{n } ) \\ \label{eqNoCondbounds2} \big\langle |\mathbf{X} - 2n\alpha^+|^2 \big\rangle_{G,+} &= O(n) \\ \label{eqNoCondbounds2b} \big\langle |\mathbf{X} - 2n\alpha^+|^3 \big\rangle_{G,+} &= O(n^{3/2}) \\ \label{eqNoCondbounds3} \big\langle e^{t_0 (\mathbf{X} - 2\alpha^+n)} \big\rangle_{G,+} &\le e^{O( t_0^2 n)} \,. \end{align} Let $\xi: \mathbb{R} \to \mathbb{R}$ be a non-negative function that satisfies $\xi (x) \le e^{c |x|}$ for some constant $c>0$. We aim to prove bounds on $\langle \xi (\mathbf{X} - 2\alpha^+n) \rangle_{G,+}$ for four choices of functions $\xi$: $\xi(x) = |x|^k$ for $k \in \{1,2,3\}$, and $\xi(x) = e^{ t_0 x}$. For such a function $\xi$, we can write \begin{align*} \langle \xi (\mathbf{X} - 2\alpha^+n) \rangle_{G,+} &\le \frac{ \sum_{\alpha \ge 1/2} \xi (2 \alpha n - 2\alpha^+n) Z_{G,\alpha} }{ Z_{G,+} } \end{align*} (this is an inequality instead of an equality simply because we include all configurations with $\alpha=1/2$). By~\ref{itmZlowerBound} of Lemma~\ref{lemGadgetZ} we have $Z_{G,+} > \frac{1}{C} \mathbb{E} Z_{G,+}$ with probability at least $1-1/10$. By Markov's inequality we have \begin{align*} \sum_{\alpha \ge 1/2} \xi (2 \alpha n - 2\alpha^+n) Z_{G,\alpha} &\le 100 \sum_{\alpha \ge 1/2} \xi (2 \alpha n - 2\alpha^+n) \mathbb{E} Z_{G,\alpha} \end{align*} for all four choices of $\xi$ with probability at least $1-4/100$. Thus with probability at least $1- 1/10 -4/100 \ge 8/10$ we have \begin{align*} \langle \xi (\mathbf{X} - 2\alpha^+n) \rangle_{G,+} &\le 100 C \frac{ \sum_{\alpha \ge 1/2} \xi (2 \alpha n - 2\alpha^+n) \mathbb{E} Z_{G,\alpha} }{ \mathbb{E} Z_{G,+} } \,, \end{align*} so to prove~\eqref{eqNoCondbounds1}, \eqref{eqNoCondbounds2}, \eqref{eqNoCondbounds2b}, \eqref{eqNoCondbounds3} it is enough to show that $ \frac{ \sum_{\alpha \ge 1/2} \xi (2 \alpha n - 2\alpha^+n) \mathbb{E} Z_{G,\alpha} }{ \mathbb{E} Z_{G,+} }$ satisfies the desired bounds. Now using the bound \begin{align*} \frac{ \mathbb{E} Z_{G,\alpha} }{ \mathbb{E} Z_{G,+} }&= O (n^{-1/2}) e^{-\Omega(n (\alpha - \alpha^+)^2 )} \, \end{align*} from Lemma~\ref{lemGadgetZ}, we can bound \begin{align*} \frac{\sum_{\alpha \ge 1/2} \xi(2 \alpha n - 2\alpha^+ n ) \mathbb{E} Z_{G,\alpha} }{ \mathbb{E} Z_{G,+}} &\le O(n^{-1/2}) \sum_{n (1-2 \alpha^+)\le \ell \le 2n(1-\alpha^+)} \xi(\ell) e^{-\Omega(\ell^2/n)} +o(1)\\ &= O(n^{-1/2}) \int_{n (1-2 \alpha^+)} ^{ 2n(1-\alpha^+)} \xi(u) e^{-\Omega(u^2/n)} \, du \\ &= O(n^{1/2}) \int_{1-2\alpha^+}^{2(1-\alpha^+)} \xi( un) e^{-\Omega(n x^2)} \, dx \\ &= O \left ( n^{1/2} \int_{-\infty}^{\infty} \xi( xn) e^{-\Omega(n x^2)} \, dx \right)\, . \end{align*} Since \begin{align*} \int_{-\infty}^{\infty} |xn|^k e^{-\Omega(n x^2)} \, dx &= O(n^{(k-1)/2}) \intertext{and} \int_{-\infty}^{\infty} e^{t_0 nx} e^{-\Omega(n x^2)} \, dx &=e^{O(t_0^2 n)} \end{align*} we obtain~\eqref{eqNoCondbounds1}, \eqref{eqNoCondbounds2}, \eqref{eqNoCondbounds2b}, \eqref{eqNoCondbounds3}. Now we transfer these bounds to the measure conditioned on $ \{ \sigma_{R_0} =\tau \}$. For the moment generating function we have \begin{align*} \big\langle e^{t_0 (\mathbf{X} - 2\alpha^+n)} \big\rangle_{G,+, \tau} &= \frac{ \big\langle e^{t_0 (\mathbf{X} - 2\alpha^+n)} \mathbf 1_{\sigma_{R_0} = \tau} \big\rangle_{G,+} }{ \mu_{G,+} ( \sigma_{R_0} = \tau ) } \\ &\le \frac{ \big\langle e^{t_0(\mathbf{X} - 2\alpha^+n)} \big\rangle_{G,+} }{ Q^+_{R_0}(\tau) (1 -O(n^{-2 \theta})) } \\ &\le e^{O ( |R_0| )} e^{O(t_0^2 n )} \\ &= e^{O(t_0^2 n )} \,, \end{align*} where we used that $t_0^2n =O(n h^{-2}) = O(n^{1-\theta/2})$ and $|R_0| =O(n^{\theta}) = o(n^{1-\theta/2}) $. For the $k$th moment, \begin{align*} \big\langle |\mathbf{X} - 2n\alpha^+|^k \big\rangle_{G,+,\tau} &= \frac{ \big\langle |\mathbf{X} - 2n\alpha^+|^k \cdot \mathbf 1_{\sigma_{R_0} = \tau} \big\rangle_{G,+} }{ \mu_{G,+} ( \sigma_{R_0} = \tau ) } \\ &\le\frac{ \big\langle |\mathbf{X} - 2n\alpha^+|^k \cdot \mathbf 1_{\sigma_{R_0} = \tau} \cdot \mathbf 1 _{\sigma_{W_0} \in \mathcal B^c} \big\rangle_{G,+} + \big\langle |\mathbf{X} - 2n\alpha^+|^k \cdot \mathbf 1 _{\sigma_{W_0} \in \mathcal B} \big\rangle_{G,+} }{ Q^+_{R_0}(\tau) (1 -O(n^{-2 \theta})) } \\ &\le \frac{ \big\langle |\mathbf{X} - 2n\alpha^+|^k \cdot \mathbf 1_{\sigma_{R_0} = \tau} \cdot \mathbf 1 _{\sigma_{W_0} \in \mathcal B^c} \big\rangle_{G,+} + (2n)^k \exp(-n^{2 \theta}) }{ Q^+_{R_0}(\tau) (1 -O(n^{-2 \theta})) } \\ &= \frac{ \big\langle |\mathbf{X} - 2n\alpha^+|^k \cdot \mathbf 1_{\sigma_{R_0} = \tau} \cdot \mathbf 1 _{\sigma_{W_0} \in \mathcal B^c} \big\rangle_{G,+} }{ Q^+_{R_0}(\tau) (1 -O(n^{-2 \theta})) } + o(1) \\ &= \frac{ \sum_{\sigma \in \Sigma_G} |X(\sigma) - 2n \alpha^+|^k \mathbf 1_{\sigma_{R_0} = \tau} \cdot \mathbf 1 _{\sigma_{W_0} \in \mathcal B^c} \cdot\mu_{G,+}(\sigma) }{ Q^+_{R_0}(\tau) (1 -O(n^{-2 \theta})) } + o(1) \\ &= \frac{ \sum_{\sigma \in \Sigma_G} |X(\sigma) - 2n \alpha^+|^k \mu(\sigma_{R_0} = \tau| \sigma_{W_0}) \cdot \mathbf 1 _{\sigma_{W_0} \in \mathcal B^c} \cdot\mu_{G,+}(\sigma) }{ Q^+_{R_0}(\tau) (1 -O(n^{-2 \theta})) } + o(1) \\ &= \frac{ Q^+_{R_0}(\tau) (1 +O(n^{-3 \theta})) \big\langle |\mathbf{X} - 2n\alpha^+|^k \cdot \mathbf 1 _{\sigma_{W_0} \in \mathcal B^c} \big\rangle_{G,+} }{ Q^+_{R_0}(\tau) (1 -O(n^{-2 \theta})) } + o(1) \\ &\le (1+ O(n^{-2 \theta})) \big\langle |\mathbf{X} - 2n\alpha^+|^k \big\rangle_{G,+} + o(1) \\ &= O(n^{(k-1)/2}) \,, \end{align*} where we have used from Lemma~\ref{lemGadgetZ} that for all $\tau_{W_0}\in \mathcal B^c$, \[ \mu_{G,+} (\sigma_{R_0} = \tau | \sigma_{W_0} =\tau_{W_0}) = Q_{R_0}^+(\tau) (1+ O( n^{-3 \theta})) \,, \] and we have used the fact that conditioned on $\sigma_{W_0}$, $X(\sigma)$ and $\sigma_{R_0}$ are independent (using here that in this section $X(\sigma)$ only counts $+$ spins to the vertices of $G'$). \section{Extremal bounds on the mean magnetization} \label{secExtremal} The proof of Theorem~\ref{thmExtremal} is based on that of Krinsky in~\cite{krinsky1975bethe} which applies to lattices such as $\mathbb{Z}^d$. We require some simple calculus facts recorded in the following lemma. \begin{lemma}\label{lemCalculus} Let $\beta>0$, $h_1(x) = \artanh\big(\tanh x\tanh\tfrac{\beta}{2}\big)$, and let $h_2(x,y) = \tanh\big(x + \artanh(\tanh y\tanh\tfrac{\beta}{2})\big)$. Then $h_1$ is strictly concave on $(0,\infty)$, $h_2$ is strictly concave when $x,y\in(0,\infty)$, and $h_2(x,x)$ is an increasing function of $x$. \end{lemma} \begin{proof} For the first statement, note that \[ h_1''(x) = -\frac{2 \sinh \beta \sinh (2 x)}{(\cosh \beta+\cosh (2 x))^2}.\] Now let $g=\artanh$. For the second statement, note that the Hessian matrix of $h_2$ has determinant \[ \frac{\sinh \beta \sinh (2 y) \tanh \big(x+g(\tanh y \tanh\tfrac{\beta}{2})\big) }{\cosh^2\big(\tfrac{\beta}{2}-y\big) \cosh^2\big(\tfrac{\beta}{2}+y\big)\cosh^4\big(x+g(\tanh y \tanh\tfrac{\beta}{2})\big)} > 0, \] and \[ \frac{\partial^2}{\partial x^2}h_2(x,y) = -\frac{2 \sinh \left(g(\tanh y \tanh\tfrac{\beta}{2})+x\right)}{\cosh^3\left(g(\tanh y \tanh\tfrac{\beta}{2})+x\right)} < 0. \] This means that the Hessian is negative definite when $x,y\in(0,\infty)$. Finally, observe that \[ \frac{\partial}{\partial x}h_2(x,x) = \left(\frac{\sinh \beta}{\cosh \beta+\cosh (2 x)}+1\right) \sech^2\big(x+g(\tanh x\tanh\tfrac{\beta}{2})\big) >0.\qedhere \] \end{proof} \begin{proof}[Proof of Theorem~\ref{thmExtremal}] Let $G=(V,E)$ be a graph and consider the ferromagnetic Ising model with partition function \begin{align*} Z_G(\vec\beta,\lambda) = \sum_{\sigma \in \Sigma_G} e^{\frac{1}{2} \sum_{uv \in E(G)} \beta_{uv}\sigma_u \sigma _v} \lambda^{M(\sigma)} \,, \end{align*} where we allow each edge $uv\in E$ to have its own inverse temperature parameter $\beta_{uv}$. Specializing to $\beta_{uv} = \beta$ for all edges $uv$, we recover the definition used elsewhere in this work. When $\beta$ and $\lambda$ are understood from context, given a function $f$ with domain $\Sigma_G$, let $\langle f \rangle_G$ be the expected value of $f$ with respect to the Ising model on $G$. We also write $\langle f \rangle_{G-uv}$ for the expected value of $f$ with respect to the Ising model on the graph formed from $G$ by removing the edge $uv$, which is equivalent to setting the parameter $\beta_{uv}$ to zero. We extend this notation to $\langle f \rangle_{G-F}$ when we want to remove some set $F$ of edges. A key feature of the ferromagnetic Ising model with non-negative external field is the following list of Griffiths' inequalities~\cite{griffiths1967correlations}, also known as the GKS inequalities after Kelly and Sherman who generalized Griffiths' work~\cite{kelly1968general}. For $A\subset V$, let $\sigma_A = \prod_{v\in A}\sigma_v$. Then we have for any graph $G=(V,E)$, $A,B\subset V$, and $uv\in E$, \begin{align} \langle \sigma_A \rangle &\ge 0 \label{eqGr1}\\ \langle \sigma_A\sigma_B\rangle - \langle \sigma_A\rangle\langle\sigma_B\rangle &\ge 0 \label{eqGr2}\\ \langle \sigma_A\rangle - \langle \sigma_A\rangle_{G-uv} &\ge 0.\label{eqGr3} \end{align} In fact,~\eqref{eqGr2} implies~\eqref{eqGr3} by considering the derivative of $\langle \sigma_A\rangle$ with respect to $\beta_{uv}$. With $B=\{u,v\}$ we have \[ \frac{\partial}{\partial \beta_{uv}}\langle\sigma_A\rangle = \frac{1}{2}\langle \sigma_A\sigma_B\rangle - \frac{1}{2}\langle \sigma_A\rangle\langle\sigma_B\rangle \ge 0,\] where the inequality is by~\eqref{eqGr2}. We will apply Griffiths' inequalities during some careful manipulation of expectations using the following identities. For $s=\pm 1$ and any $\beta$ we have \begin{equation}\label{eqExpIdentity} e^{\frac{\beta}{2} s} = \left(1+ s\tanh \tfrac{\beta}{2}\right)\cosh \tfrac{\beta}{2}, \end{equation} which follows from the definitions of the hyperbolic functions in terms of exponential functions. We also use the addition formula \[ \artanh\left(\frac{x+y}{1+xy}\right) = \artanh x + \artanh y. \] From now on, we work with $\beta_{uv}=\beta$ for all $uv\in E$. Let $u\in V$ and $v, w\in N(u)$ with $v\ne w$. Applying~\eqref{eqExpIdentity} to the term $e^{\tfrac{\beta}{2}\sigma_u\sigma_v}$ which occurs in both the numerator and the denominator of $\langle \sigma_{u}\rangle$ gives \begin{equation} \langle \sigma_u \rangle = \frac{\langle \sigma_u\rangle_{G-uv} + \langle \sigma_{v}\rangle_{G-uv}\tanh \frac{\beta}{2}}{1+\langle\sigma_u\sigma_{v}\rangle_{G-uv}\tanh \frac{\beta}{2}}, \end{equation} and the same identity applied to the edge $uw$ in $G-uv$ gives \begin{equation} \langle \sigma_u \rangle_{G-uv} = \frac{\langle \sigma_u\rangle_{G-uv-uw} + \langle \sigma_{w}\rangle_{G-uv-uw}\tanh \frac{\beta}{2}}{1+\langle\sigma_u\sigma_w\rangle_{G-uv-uw}\tanh \frac{\beta}{2}}. \end{equation} To each of these we apply~\eqref{eqGr2} to the expectation in the denominator, giving \begin{align} \label{eqPreArtanh} \langle \sigma_u \rangle &\le \frac{\langle \sigma_u\rangle_{G-uv} + \langle \sigma_{v}\rangle_{G-uv}\tanh\tfrac{\beta}{2}}{1+\langle\sigma_u\rangle_{G-uv}\langle\sigma_{v}\rangle_{G-uv}\tanh\tfrac{\beta}{2}}, \text{ and} \\\label{eqPreArtanhuv} \langle \sigma_u \rangle_{G-uv} &\le \frac{\langle \sigma_u\rangle_{G-uv-uw} + \langle \sigma_{w}\rangle_{G-uv-uw}\tanh\tfrac{\beta}{2}}{1+\langle\sigma_u\rangle_{G-uv-uw}\langle\sigma_w\rangle_{G-uv-uw}\tanh\tfrac{\beta}{2}}. \end{align} Applying $g=\artanh$ to both sides of~\eqref{eqPreArtanh} and using the addition formula, we obtain \begin{equation}\label{eqMagu} g(\langle \sigma_u \rangle) \le g(\langle \sigma_u\rangle_{G-uv}) + g(\langle \sigma_v\rangle_{G-uv}\tanh\tfrac{\beta}{2}). \end{equation} Doing this again with~\eqref{eqPreArtanhuv}, we also use~\eqref{eqGr3} with the edge $uw$ in the graph $G-uv$, giving $\langle \sigma_w\rangle_{G-uv-uw} \le \langle \sigma_w\rangle_{G-uw}$ and hence \begin{equation}\label{eqToIterate} g(\langle \sigma_u \rangle_{G-uv}) \le g(\langle \sigma_u\rangle_{G-uv-uw}) + g(\langle \sigma_w\rangle_{G-uw}\tanh\tfrac{\beta}{2}). \end{equation} Observe that we can iterate the process used to obtain~\eqref{eqToIterate} over each $w\in N(u)\setminus\{v\}$ in turn to obtain \begin{equation}\label{eqPreSymmetry} g(\langle \sigma_u \rangle_{G-uv}) \le \log\lambda + \sum_{w\in N(u)\setminus \{v\}}g(\langle\sigma_{w}\rangle_{G-uw}\tanh\tfrac{\beta}{2}), \end{equation} where we have used the fact that removing the set $F_u := \{uv : v\in N(u)\}$ of edges incident to $u$ we have \[ \langle \sigma_u\rangle_{G-F_u} = \frac{\lambda -\lambda^{-1}}{\lambda +\lambda^{-1}} = \tanh (\log \lambda) \]because $u$ is an isolated vertex in $G-F_u$. At this point, Krinsky assumes that $G$ is both edge and vertex transitive so that for some $L>0$ and for all $uv\in E$ we have \[ \langle \sigma_u \rangle_{G-uv} = \langle \sigma_{v} \rangle_{G-uv} = \tanh L.\] In this special case,~\eqref{eqPreSymmetry} becomes \[ L \le \log\lambda + (\Delta-1)g(\tanh L\tanh\tfrac{\beta}{2}), \] where $\Delta$ is the degree of a vertex in $G$. This implies that $L$ is bounded above by the largest solution $L^*$ to \begin{equation}\label{eqSymmetryL*} L^* = \log\lambda + (\Delta-1)g(\tanh L^*\tanh\tfrac{\beta}{2}). \end{equation} Plugging this into~\eqref{eqMagu} and observing that for any vertex-transitive graph $\langle\sigma_u\rangle$ is the mean magnetization $\eta_G$, we have \[ \eta_G \le \tanh\big(L^*+g(\tanh L^*\tanh\tfrac{\beta}{2})\big). \] The right-hand side is precisely $\eta^+_{\Delta,\beta,\lambda}$, the mean magnetization of the $+$ measure on the infinite $\Delta$-regular tree, which one can derive from first principles (as in, e.g.,~\cite{Bax82}). In fact, it suffices to observe that every inequality we applied to obtain this bound holds with equality in the tree. That is, in the infinite $\Delta$-regular tree $\langle\sigma_u\sigma_{v}\rangle_{G-uv} = \langle\sigma_u\rangle_{G-uv}\langle\sigma_{v}\rangle_{G-uv}$ since removing $uv$ leaves $u$ and $v$ in different connected components so $\sigma_u$ and $\sigma_v$ are independent. Similarly, we have $\langle\sigma_u\sigma_w\rangle_{G-uv-uw} = \langle\sigma_u\rangle_{G-uv-uw}\langle\sigma_w\rangle_{G-uv-uw}$ and since $w$ is in a different component from the edge $uv$ after $uw$ is removed, $\langle \sigma_w\rangle_{G-uv-uw} = \langle \sigma_w\rangle_{G-uw}$. The tree is edge and vertex transitive, proving that the derived upper bound is given by the mean magnetization of some measure on the tree. As the $+$ measure stochastically dominates all other translation-invariant measures on the tree, it corresponds to the largest solution $L^*$ to~\eqref{eqSymmetryL*}. We now will apply this argument to a finite graph $G$ that is not necessarily vertex or edge transitive. First, we observe that we can reduce to the case that $G$ is regular by a well-known construction. Suppose that $G$ has maximum degree $\Delta$ but minimum degree $\delta\le \Delta-1$. We construct a graph $H$ with minimum degree $\delta+1$ such that $\eta_G \le \eta_H$. Let $H_0$ be formed from the disjoint union of two copies of $G$, so that the mean magnetization of $H_0$ is equal to that of $G$, For $i\ge 0$, if there is a vertex $u$ of degree $\delta$ in $H_i$ let $H_{i+1}$ be formed from $H_i$ by connecting $u$ to its copy in the other copy of $G$. The inequality~\eqref{eqGr3} shows that $\eta_{H_i}$ is non-decreasing as $i$ increases because adding the edge can only increase any term $\langle\sigma_v\rangle$, and the mean magnetization is the average of these terms over all vertices $v$. When the process terminates at some $H$, the minimum degree of $H$ is $\delta+1$, and we cannot have decreased the mean magnetization. Iterating this construction, we can obtain a $\Delta$-regular graph $H$ whose mean magnetization is an upper bound on the mean magnetization of $G$, hence it suffices to prove the theorem in the case of a $\Delta$-regular graph. In a $\Delta$-regular graph, careful averaging and applications of Jensen's inequality allow us to recover the result obtained for edge and vertex transitive graphs. We can interpret~\eqref{eqPreSymmetry} as a property of an oriented edge $\overrightarrow{uv}$, and average over all edges incident to $u$ oriented away from $u$. Let $L_{\overrightarrow{uv}}$ be given by $\tanh L_{\overrightarrow{uv}}=\langle \sigma_u \rangle_{G-uv}$, so that averaging~\eqref{eqPreSymmetry} over $v\in N(u)$ gives \begin{equation}\label{avgNu} \frac{1}{\Delta}\sum_{v\in N(u)} L_{\overrightarrow{uv}} \le \log\lambda + \frac{\Delta-1}{\Delta}\sum_{v\in N(u)} g(\tanh L_{\overrightarrow{vu}}\tanh\tfrac{\beta}{2}). \end{equation} By Lemma~\ref{lemCalculus}, the function $x \mapsto g\big(\tanh x\tanh\tfrac{\beta}{2}\big)$ is concave on $(0,\infty)$. This means that \eqref{avgNu} and Jensen's inequality give \begin{equation}\label{afterJensen} \frac{1}{\Delta}\sum_{v\in N(u)} L_{\overrightarrow{uv}} \le \log\lambda +(\Delta-1) g\bigg(\tanh\Big[\frac{1}{\Delta}\sum_{v\in N(u)}L_{\overrightarrow{vu}}\Big]\tanh\tfrac{\beta}{2}\bigg). \end{equation} To clean this up, we define \begin{align*} A_u &:= \frac{1}{\Delta}\sum_{v\in N(u)} L_{\overrightarrow{uv}},& B_u &:= \frac{1}{\Delta}\sum_{v\in N(u)} L_{\overrightarrow{vu}}, \end{align*} so that~\eqref{afterJensen} gives \begin{equation}\label{AuBu} A_u \le \log\lambda +(\Delta-1) g\left(\tanh B_u \tanh\tfrac{\beta}{2}\right). \end{equation} This we average over a uniform random $u\in V$ and again appeal to concavity. Here we finally obtain the desired equation because the averages satisfy \[ \overline L := \frac{1}{\Delta n}\sum_{uv\in E}\left(L_{\overrightarrow{uv}} + L_{\overrightarrow{vu}}\right) = \frac{1}{\Delta n}\sum_{u\in V}\sum_{v\in N(u)}L_{\overrightarrow{uv}} = \frac{1}{\Delta n}\sum_{u\in V}\sum_{v\in N(u)}L_{\overrightarrow{vu}}, \] so an application of Jenssen's inequality gives for $\overline L$ what we had for $L$ in the case of a transitive graph, \[ \overline L \le \log\lambda + (\Delta-1)g(\tanh \overline L\tanh\tfrac{\beta}{2} ). \] As before, this means that $\overline L\le L^*$. To conclude the argument in the $\Delta$-regular case, we apply the same averaging trick to~\eqref{eqMagu}. For any edge $uv\in E$, \[ g(\langle \sigma_u \rangle) \le g(\langle \sigma_u\rangle_{G-uv}) + g(\langle \sigma_{v}\rangle_{G-uv}\tanh\tfrac{\beta}{2}), \] so fixing $u$ and averaging over $v\in N(u)$ gives \[ g(\langle \sigma_u \rangle) \le \frac{1}{\Delta}\sum_{v\in N(u)}g(\langle \sigma_u\rangle_{G-uv}) + \frac{1}{\Delta}\sum_{v\in N(u)}g(\langle \sigma_{v}\rangle_{G-uv}\tanh\tfrac{\beta}{2}). \] Applying Jensen's inequality again, we have \[ g(\langle \sigma_u \rangle) \le A_u + g(\tanh B_u\tanh\tfrac{\beta}{2}), \] and so \begin{equation}\label{eqsigmau} \langle \sigma_u \rangle \le \tanh(A_u + g(\tanh B_u\tanh\tfrac{\beta}{2})). \end{equation} By Lemma~\ref{lemCalculus}, the right-hand side is concave as a function of $A_u$ and $B_u$. Averaging~\eqref{eqsigmau} over $u\in V$ and applying Jensen's inequality, we conclude \begin{align*} \eta_G = \frac{1}{n}\sum_{u\in V}\langle \sigma_u \rangle &\le \tanh( \overline L + g(\tanh \overline L\tanh\tfrac{\beta}{2}))\\ &\le \tanh( L^* + g(\tanh L^*\tanh\tfrac{\beta}{2})) = \eta_{\Delta,\beta,\lambda}^+, \end{align*} using the fact that $x\mapsto \tanh\big(x + g(\tanh x\tanh\tfrac{\beta}{2})\big)$ is non-decreasing proved in Lemma~\ref{lemCalculus}. \end{proof} \section{Algorithms} \label{secAlgorithms} In this section we prove Theorems~\ref{thmAlgFixedSubcriticalBeta} and~\ref{thmFixedSupercriticalBeta}\ref{algFixedSuper}. By symmetry, it suffices to consider the case when $\eta\ge0$. We can exclude the trivial case $\eta =1$ since there is just a single spin configuration in that case. We will use several ingredients from Section~\ref{secPrelim}. Fix $\beta, \eta, \Delta$ satisfying the conditions of either theorem, and let $G$ be a graph of maximum degree $\Delta$ on $n$ vertices. Let $\ell = \lfloor \frac{1+\eta}{2} n\rfloor$ so that our goal is to sample an Ising configuration $\sigma$ with $X(\sigma) = \ell$. Since we can efficiently sample from $\mu_{G,\beta,\lambda}$ for any $\lambda$ via Theorem~\ref{thmIsingFPRAS}, we can perform a binary search on values of $\lambda$, estimating $\langle \mathbf{X} \rangle_{G,\beta,\lambda}$, to find a $\lambda$ so that \begin{equation} \label{eqLamclose} \left| \langle \mathbf{X} \rangle_{G,\beta,\lambda} - \ell \right| = o(\sqrt{n}) \,. \end{equation} Given such an activity $\lambda$, we will approximately sample from $\mu_{G,\beta,\lambda}$ until we sample a configuration $\sigma$ with $X(\sigma) =\ell$ and then output $\sigma$. For this algorithm to be efficient we must ensure that the probability of hitting this value is not too small; in fact, we will show that it is $\Theta(n^{-1/2})$. For Theorem~\ref{thmAlgFixedSubcriticalBeta} this follows immediately from Proposition~\ref{propLocalCLTalg} which provides a local central limit theorem and $\Theta(n)$ variance for $\mathbf{X}$ for $\beta< \beta_c(\Delta)$ and any activity $\lambda$. For Theorem~\ref{thmFixedSupercriticalBeta}, we need to ensure that we can find $\lambda$ satisfying~\eqref{eqLamclose} that is bounded away from $1$ independently of $n$ so we can apply Proposition~\ref{propLocalCLTalg}. This is guaranteed by the extremal result, Theorem~\ref{thmExtremal}, and the conditions of the Theorem~\ref{thmFixedSupercriticalBeta}. In particular, because $\eta > \eta_+(\beta, \Delta)$ (and by continuity of the magnetization of the $+$ measure on the tree) there is some $\lambda_{\min} > 1$ so that $\eta = \eta^+_{\Delta, \beta, \lambda_{\min}}$. Theorem~\ref{thmExtremal} then says that to achieve mean magnetization $\eta$ on any $G \in \mathcal{G}_{\Delta}$ we must take $\lambda \ge \lambda_{\min}$, thus giving the required uniform bound away from $1$. In what follows we give the details of the approach. We note that the running time of our algorithm could certainly be improved by using a faster Ising sampler (e.g.~\cite{mossel2013exact}) or by using the techniques of~\cite{jain2021approximate}, but here we will not try to optimize the running time beyond finding polynomial-time algorithms. The existence of the efficient sampling schemes in Theorems~\ref{thmAlgFixedSubcriticalBeta} and~\ref{thmFixedSupercriticalBeta}\ref{algFixedSuper} are proved in Theorem~\ref{thmSampleK} in Section~\ref{subsecSample}. The existence of approximate counting algorithms follows from the sampling algorithms via a standard reduction. We provide the details in Appendix~\ref{secCounting}. \subsection{Bounds on the activity} Here we prove a lemma guaranteeing the existence of a good activity $\lambda$ for use in our sampling algorithms. We write $\lambda^{-1}_{\Delta,\beta}(\eta)$ for the value of $\lambda$ such that $\eta^+_{\beta,\Delta,\lambda}=\eta$. In particular, when $\eta > \eta_+ (\beta,\Delta)$ we have $\lambda^{-1}_{\Delta,\beta}(\eta) > 1$. \begin{lemma}\label{lemExistLambda} Let $\Delta\ge 3$, $\beta< \beta_c(\Delta)$, and $\eta \in [0,1)$ be fixed. Let $\lambda_{\min} = 1$ and $\lambda_{\max}=\sqrt{\frac{1+\eta}{1-\eta}} e^{\beta\Delta/2}$. Then for any $G \in \mathcal{G}_\Delta$ on $n$ vertices, there exists an integer $t \in \{ 0, \dots, \lfloor (\lambda_{\max} - \lambda_{\min})n \rfloor \}$ so that for $\ell = \lfloor \frac{\eta+1}{2} n \rfloor $ and $\lambda_t =\lambda_{\min} + \frac{t}{n}$ we have \begin{equation} \label{eqCloseLam} \left | \langle \mathbf{X} \rangle_{G, \beta, \lambda_t} - \ell \right | = O(1)\,, \end{equation} where the implied constant depends only on $\Delta, \beta, \eta$. The same holds for $\beta> \beta_c$ and $\eta \in (\eta_+ (\beta,\Delta), 1)$ with $\lambda_{\min} = \lambda^{-1}_{\Delta,\beta}(\eta) > 1$ and $\lambda_{\max}=\sqrt{\frac{1+\eta}{1-\eta}} e^{\beta\Delta/2}$. \end{lemma} Before we prove Lemma~\ref{lemExistLambda}, we need one simple bound on the magnetization of a bounded-degree graph. \begin{lemma}\label{lemLamBound} For all $\Delta \ge 1$, $\beta \ge 0$, $\eta \in [0,1)$, and any $G \in \mathcal{G}_{\Delta}$, the value of $\lambda$ such that the mean magnetization $\eta_G(\beta,\lambda)$ is exactly $\eta$ satisfies \[1 \le \lambda \le \sqrt{\frac{1+\eta}{1-\eta}} e^{\beta\Delta/2} \,. \] \end{lemma} \begin{proof} The lower bound follows from symmetry of the Ising model. For the upper bound, let $\sigma\in \Sigma_G$ be drawn from $\mu_{G,\beta,\lambda}$ and suppose that $\eta=\eta_G(\beta,\lambda)$. Let $u$ be a uniform random vertex of $G$, and let $Y=M(\sigma_{N(u)})$ be the magnetization of the neighbors of $u$. That is, when $u$ has exactly $j$ neighbors with spin $+$, $Y=2j-\deg(u)$. Then a direct computation in the Ising model gives \[ \eta = \left\langle\frac{\lambda e^{\frac{\beta}{2}Y} - \lambda^{-1}e^{-\frac{\beta}{2}Y}}{\lambda e^{\frac{\beta}{2}Y} + \lambda^{-1}e^{-\frac{\beta}{2}Y}}\right\rangle_{G,\beta,\lambda}= \left\langle\frac{\lambda^2 - e^{-\beta Y}}{\lambda^2 + e^{-\beta Y}}\right\rangle_{G,\beta,\lambda}. \] Since $Y\ge-\Delta$ and the function of $Y$ inside the expectation is increasing for $\beta>0$, we immediately obtain \[ \eta \ge \frac{\lambda^2-e^{\beta\Delta}}{\lambda^2 + e^{\beta\Delta}} \Longleftrightarrow \lambda \le \sqrt{\frac{1+\eta}{1-\eta}} e^{\beta\Delta/2}. \qedhere\] \end{proof} We now prove Lemma~\ref{lemExistLambda}. \begin{proof}[Proof of Lemma~\ref{lemExistLambda}] By Theorem~\ref{thmExtremal} and Lemma~\ref{lemLamBound}, the value of $\lambda$ such that $\eta_G(\beta,\lambda)=\eta$ satisfies $ \lambda_{\min} \le\lambda\le \lambda_{\max}$. A standard calculation gives that \[ \frac{\partial}{\partial\lambda}\eta_G(\beta,\lambda) = \frac{2}{n\lambda}\var(\mathbf{X}) \,. \] Then by Proposition~\ref{propLocalCLTalg}, we have $\frac{\partial}{\partial\lambda}\eta_G(\beta,\lambda) >0 $ and $\frac{\partial}{\partial\lambda}\eta_G(\beta,\lambda) = O(1)$. This means that $\eta_G(\beta,\lambda)$ and hence $\langle \mathbf{X} \rangle_{G,\beta,\lambda}$ are strictly increasing as functions of $\lambda$, and that $\langle \mathbf{X} \rangle_{G,\beta,\lambda}$ can increase by at most $O(1)$ on any interval of length $1/n$. \end{proof} \subsection{The sampling algorithm} \label{subsecSample} Our algorithm is the combination of a simple binary search on values of $\lambda$ and repeated sampling from distributions $\hat\mu_{\beta,\lambda}$ that approximate the usual Ising model $\mu_{G,\beta,\lambda}$. \medskip \textbf{Algorithm: Sample-$k$} \begin{itemize} \item INPUT: $\Delta,\beta,\eta,\varepsilon$ and $G \in \mathcal{G}_\Delta$ on $n$ vertices. \item OUTPUT: $\sigma\in\Sigma_G(k)$ distributed within $\varepsilon$ total variation distance of the fixed-magnetization Ising model $\nu_{G,\beta,k}$, where $k$ is the largest integer such that $k\equiv n\mod 2$ and $k\le\eta n$. \end{itemize} \begin{enumerate} \item Let $\lambda_{\min}, \lambda_{\max}$ be as given in Lemma~\ref{lemExistLambda}. \item For $t = 0, \dots, \lfloor (\lambda_{\max}-\lambda_{\min}) n \rfloor$, let $\lambda_t = \lambda_{\min} + t/n$. \item Let $\Lambda_0 = \{\lambda_t : t = 0, \dots, \lfloor (\lambda_{\max}-\lambda_{\min}) n \rfloor\}$. \item FOR $i=1, \dots , C\log n$, \begin{enumerate} \item Let $\lambda$ be a median of the set $\Lambda_{i-1}$. \item With $N=C'n^2\log\big(\frac{\log n}{\varepsilon}\big)$, take $N$ independent samples $\sigma_1,\dotsc$, $\sigma_N$ from a distribution $\hat \mu_{G,\beta,\lambda}$ on $\Sigma_G$ such that $\| \hat \mu_{G,\beta,\lambda} - \mu_{G,\beta,\lambda} \|_{TV} < \varepsilon' = \frac{1}{C N \log n}$. \item If there exists $j \in \{1, \dots , N\}$ so that $M(\sigma_j)=k$, then output $\sigma_j$ for the smallest such $j$ and HALT. \item Let $\overline k = \frac{1}{N} \sum_{j=1}^N M(\sigma_j)$. \item If $\overline k \le k$, let $\Lambda_i = \{ \lambda' \in \Lambda_{i-1} : \lambda' > \lambda \}$. If instead $\overline k > k$, let $\Lambda_i = \{ \lambda' \in \Lambda_{i-1} : \lambda' < \lambda \}$. \end{enumerate} \item If no spin assignment of magnetization $k$ has been obtained by the end of the FOR loop (or if $\Lambda_j = \emptyset$ at any step), output a spin assignment of magnetization $k$ by taking the first $(k+n)/2$ vertices in an arbitrary ordering on $V(G)$ and setting their spins to $+$ and remaining spins to $-$. \end{enumerate} \begin{theorem}\label{thmSampleK} Let $\hat \nu_{G,\beta,k}$ be the output distribution of the algorithm Sample-$k$. Then for $n$ large enough, \begin{enumerate} \item $\| \hat \nu_{G,\beta,k} - \nu_{G,\beta,k} \|_{TV} <\varepsilon$. \item The running time of Sample-$k$ is polynomial in $n$ and $\log(1/\varepsilon)$. \end{enumerate} \end{theorem} This proves the approximate sampling portions of Theorems~\ref{thmAlgFixedSubcriticalBeta} and~\ref{thmFixedSupercriticalBeta}\ref{algFixedSuper}. \begin{proof}[Proof of Theorem~\ref{thmSampleK}] We first give the proof under the assumption that each $\hat\mu_{\beta,\lambda}$ is precisely the Ising model $\mu_{G,\beta,\lambda}$, and subsequently we will reduce the general case that $\hat\mu_{\beta,\lambda}$ is close to $\mu_{G,\beta,\lambda}$ to this case with a standard coupling argument. We say a \emph{failure} occurs at step $i$ in the FOR loop if either \begin{enumerate}[(1)] \item\label{itmFail1} $|n\eta_G(\beta,\lambda)-\overline k| > 1/4$, or \item\label{itmFail2} $|n\eta_G(\beta,\lambda)-k| \le 1/2$ but none of the samples $\sigma_1,\dotsc,\sigma_N$ have magnetization exactly $k$ and so the algorithm did not HALT on line (d). \end{enumerate} Note that avoiding~\ref{itmFail1} means that the sample mean $\overline k$ of the $N$ spin assignments sampled is close to the true mean $n\eta_G(\beta,\lambda)$, and avoiding~\ref{itmFail2} means that in the case that the true mean magnetization is close to $k$, we successfully sample a spin assignment of the desired magnetization $k$. To establish that the probability of a failure occurring at any step is at most $\varepsilon/2$, it suffices to establish that the probability of each type of failure in a given step is at most $\varepsilon/(4C\log n)$. Consider an arbitrary step $i$ with the value of $\lambda$ assigned for that step in line (a), and note that $\overline k$ is the mean of $N$ independent samples from $\hat\mu_{\beta,\lambda}$. Under the assumption that $\hat\mu_{\beta,\lambda}=\mu_{G,\beta,\lambda}$, we have $\mathbb{E}\overline k=n\eta_G(\beta,\lambda)$, so by Hoeffding's inequality we have \[ \Pr(|n\eta_G(\beta,\lambda)-\overline k| > 1/4) \le 2e^{-N/(32n^2)}. \] This is at most the desired $\varepsilon/(4C\log n)$ when $N\ge \Omega(n^2\log(\log(n)/\varepsilon))$. For the second type of failure, we suppose that the current value of $\lambda$ means that $|n\eta_G(\beta,\lambda)-k| \le O(1)$, but that none of the $N$ samples from $\hat\mu_{\beta,\lambda}$ give a state with magnetization exactly $k$. Each `trial' to get a state of magnetization $k$ is independent at succeeds with probability $p\ge \Omega(1/\sqrt{n})$ by Lemma~\ref{propLocalCLTalg}. Then we have no successful trials with probability $(1-p)^N$, which is at most $\varepsilon/(4C\log n)$ when $N\ge \Omega(\sqrt{n}\log(\log(n)/\varepsilon))$. The above lower bounds on $N$ show that the value given in line (b) suffices. With a bound of $\varepsilon/2$ on the probability of any failure, we now show that the output state has distribution within total variation distance $\varepsilon/2$ of $\nu_{G,\beta,k}$ on $\Sigma_G(k)$. If no failure occurs then the algorithm must reach a value of $\lambda$ such that $|n\eta_G(\beta,\lambda)-k| \le 1/2$. This is because the starting search set $\Lambda_0$ contains such a value by Lemma~\ref{lemExistLambda}, and by binary search structure of the algorithm. Note that if there is no failure then $\overline k$ is an accurate representation of $n\eta_G(\beta,\lambda)$, so we continue searching in the larger half of the search set when $\overline k < k-1/4$ and so $n\eta_G(\beta,\lambda) \le \overline k + 1/4 < k$. The case that $\overline k>k+1/4$ is similar. The desired total variation distance now follows from the fact that for any $\lambda'$, $\nu_{G,\beta,k}$ is precisely $\mu_{G,\beta,\lambda'}$ conditioned on getting a spin assignment of magnetization exactly $k$. Under the assumption that $\hat\mu_{\beta,\lambda}=\mu_{G,\beta,\lambda}$, this means that if the algorithm outputs a state on line (d) during the FOR loop, then the output distribution is precisely $\nu_{G,\beta,k}$. Since we have proved that a state is output on line (d) of some step with probability at least $\varepsilon/2$, this is equivalent to showing that when $\hat\mu_{\beta,\lambda}=\mu_{G,\beta,\lambda}$ the output distribution is within total variation distance $\varepsilon/2$ of $\nu_{G,\beta,k}$. We do not need to assume access to efficient algorithms for sampling from $\mu_{G,\beta,\lambda}$ exactly, we can make do with good approximate samplers given by Theorem~\ref{thmIsingFPRAS}. A standard interpretation of total variation distance is that when each $\hat\mu_{\beta,\lambda}$ has total variation distance $\xi$ from $\mu_{G,\beta,\lambda}$, there is a coupling between the measures such that the probability they disagree is at most $\xi$. Then to prove Theorem~\ref{thmSampleK} in general we can add a third failure condition: that any sample from any $\hat\mu_{\beta,\lambda}$ disagrees with $\mu_{G,\beta,\lambda}$ under this coupling. We make at most $C N\log n$ calls to any approximate sampling algorithm, so by a union bound this type of failure occurs with probability at most $\varepsilon/2$ when we have the stated total variation distance $\xi \le \varepsilon/(2CN\log n)$. Now, with the above proof in the case of exact samplers we output a state distributed according to $\nu_{G,\beta,k}$ with probability at least $1-\varepsilon/2$, and with approximate samplers as described we get the same output unless the third type of failure occurs. That is, with probability at least $1-\varepsilon$ we output a state distributed according to $\nu_{G,\beta,k}$. In terms of total variation distance, this is an $\varepsilon$-approximate sampler for $\nu_{G,\beta,k}$ with running time $O(N\log n\cdot T(n,\varepsilon))$ as desired. \end{proof} \newcommand{\etalchar}[1]{$^{#1}$}
{'timestamp': '2021-11-05T01:22:00', 'yymm': '2111', 'arxiv_id': '2111.03033', 'language': 'en', 'url': 'https://arxiv.org/abs/2111.03033'}
arxiv
\section{Details Omitted From Section~\ref{sec:prelims}} \label{appx:prelims_omitted} \begin{proof}[Proof of Proposition~\ref{prop:weak_subs_rewrite}] Note that for an information structure $\mathcal{I} = (\Omega, \PP, S, Y)$ for $n$ experts and subsets $A \subseteq B \subseteq [n]$, we have \begin{equation} \label{eq:v_diff} v(Y_B) - v(Y_A) = \EE{(Y_B - Y_A)^2}. \end{equation} \[\] Indeed, we have \begin{align*} v(Y_B) - v(A) &= (\EE{(Y - \EE{Y})^2} - \EE{(Y - Y_B)^2}) - (\EE{(Y - \EE{Y})^2} - \EE{(Y - Y_A)^2})\\ &= \EE{(Y - Y_A)^2} - \EE{(Y - Y_B)^2} = \EE{(Y_B - Y_A)^2}, \end{align*} where the last step follows by setting the variables $A, B, C$ in Proposition~\ref{prop:pythag} to $Y$, $Y_B$, and $Y_A$, respectively. Proposition~\ref{prop:weak_subs_rewrite} follows directly from Equation~\ref{eq:v_diff} after rearranging the terms in Equation~\ref{eq:weak_subs}. \end{proof} \begin{proof}[Proof of Proposition~\ref{prop:pythag}] Observe that $\EE{AB} = \EE{\EE{AB \mid B}} = \EE{B^2}$, so $\EE{(A - B)^2} = \EE{A^2} - \EE{B^2}$. Additionally, note that \[\EE{AC} = \EE{\EE{AC \mid \mathcal{F}}} = \EE{\EE{A \mid \mathcal{F}} C} = \EE{BC},\] where in the second step we use that $C$ is defined on $\mathcal{F}$. Therefore, we have \begin{align*} \EE{(A - C)^2} &= \EE{A^2} + \EE{C^2} - 2\EE{BC} = \EE{A^2} - \EE{B^2} + \EE{B^2} - 2\EE{BC} + \EE{C^2}\\ &= \EE{(A - B)^2} + \EE{(B - C)^2}, \end{align*} as desired. \end{proof} \begin{proof}[Proof of Corollary~\ref{cor:improvement_rewrite}] We have \begin{align*} \frac{v(Z)}{v(Y_{[n]})} &= \frac{\EE{(Y - \EE{Y})^2} - \EE{(Y - Z)^2}}{\EE{(Y - \EE{Y})^2} - \EE{(Y - Y_{[n]})^2}}\\ &= \frac{\parens{\EE{(Y - Y_{[n]})^2} + \EE{(Y_{[n]} - \EE{Y})^2}} - \parens{\EE{(Y - Y_{[n]})^2} + \EE{(Y_{[n]} - Z)^2}}}{\EE{(Y - \EE{Y})^2} - \EE{(Y - Y_{[n]})^2}}\\ &= \frac{\EE{(Y_{[n]} - \EE{Y})^2} - \EE{(Y_{[n]} - Z)^2}}{\EE{(Y - Y_{[n]})^2}} = 1 - \frac{\EE{(Y_{[n]} - Z)^2}}{\EE{(Y_{[n]} - \EE{Y})^2}}. \end{align*} We use Proposition~\ref{prop:pythag} for $A = Y$, $B = Y_{[n]}$, $C = \EE{Y}$ in the second and third steps, and also for $A = Y$, $B = Y_{[n]}$, $C = Z$ in the second step. \end{proof} \section{Projective Substitutes Incentivize Information Revelation} \label{appx:information_revelation} Consider a central party (call them the \emph{elicitor}) who knows the information structure but does not know the experts' signals. Experts are truthful, but may be strategic: they will not lie about their signal, but may decide not to reveal it. The elicitor wishes to structure incentives that will encourage each expert to reveal their signal. The elicitor puts experts on teams, after which: \begin{enumerate} \item Each expert either reveals their signal to the elicitor, or does not. \item The elicitor announces which experts revealed their signals and announces the teams. \item Each team makes a prediction about the elicitor's belief and is scored using a quadratic scoring rule (i.e. penalized by the squared distance between their prediction of the elicitor's belief and the elicitor's actual belief). \end{enumerate} Does this mechanism incentivize experts to reveal their signals? The answer is yes if and only if the information structure satisfies projective substitutes. Formally: \begin{prop} An information structure satisfies projective substitutes if and only if in the above mechanism, revealing one's signal is a dominant strategy for every expert, regardless of who is on their team. \end{prop} \begin{proof} First suppose that the information structure satisfies projective substitutes, consider any expert $i$, let $A$ be $i$'s team, and let $B$ be the set of all other experts who reveal their signals. If $i$ does not reveal their signal, then the elicitor's belief will be $Y_B$ and $A$'s prediction of the elicitor's belief will be $Y_{B \to A}$. If $i$ reveals their signal, then the elicitor's belief will be $Y_{B \cup \{i\}}$ and $A$'s prediction of the elicitor's belief will be $Y_{B \cup \{i\} \to A} = Y_{B \cup \{i\} \to A \cup \{i\}}$. Therefore, by the projective substitutes, condition, $A$'s expected prediction error is smaller if $i$ reveals their signal to the expert. Conversely, suppose that the information structure does not satisfy projective substitutes. Then there are sets $A, B \subseteq [n]$ and $i \in A$ (see Remark~\ref{rem:proj_subs_facts}~\ref{item:proj_subs_equiv}) such that \[\EE{(Y_B - Y_{B \to A})^2} < \EE{(Y_{B \cup \{i\}} - Y_{B \cup \{i\} \to A \cup \{i\}})^2}.\] Consider expert $i$, suppose their team is $A$, and suppose that the set of experts excluding $i$ who reveal their signal is $B$. Then $i$ is incentivized not to reveal their signal to the elicitor, as revealing their signal will increase $A$'s expected prediction error. \end{proof} \section{Introduction} Suppose that you wish to estimate how much the GDP of the United States will grow next year: perhaps you are making financial decisions and want to know whether to expect a downturn. You don't personally know much about the question --- just that the historical average rate of GDP growth has been 3\% --- but on the internet you find several forecasts made by machine learning models. One model predicts 3.5\% growth next year; another predicts 1.5\%; a third predicts a downturn: -1\% growth. How might you take this information into account and turn it into one number: your best guess, all things considered? Because of the ubiquity of its applications, forecast aggregation is of critical importance to many fields: machine learning, operations research, economics, climate science, epidemiology, and national security, to name a few. Despite this, the theoretical tools we have for understanding this problem are fairly limited. What should we ask of a framework for comparing competing aggregation methods? First, for each fixed setup, it should enable the quantitative assessment of an aggregation method based on its performance relative to a natural benchmark (analogous to, for example, assessing an online learning algorithm via its regret with respect to the best fixed action in hindsight). Second, the framework should be general: rather than evaluating an aggregation method based on its performance under a particular assumption about the experts' information sets, it should assess the method based on its performance over a broad range of possible setups. We can model each expert as having partial information over the state of the world, and thus the quantity being estimated (which we denote $Y$). The experts' information sets may overlap in essentially arbitrary ways, which we formalize using the notion of an \emph{information structure}. No aggregation method is simultaneously optimal for every information structure. As such, it is natural to ask which aggregation method optimizes worst-case performance over a broad class of information structures. This is the approach we take, because it has the aforementioned advantages: it assesses aggregation methods based on their performance, but does so broadly rather than under specific assumptions. \subsection{Our Results} Without any conditions on the experts' information structure, no aggregation strategy can achieve a nontrivial performance guarantee.\footnote{For example, consider the ``XOR information structure" in which two experts receive independent, random bits, and $Y$ is their XOR. See Section~\ref{sec:improving} for further discussion.} In this work, we optimize for worst-case performance over all information structures that satisfy a condition that we call \emph{projective informational substitutes}. Roughly speaking, experts' signals are informational substitutes if the value of learning an additional signal has diminishing marginal returns. The projective substitutes condition is a particular formalization of this concept that builds on an alternative notion (``weak substitutes") introduced in \cite{cw16} --- a notion that proves inadequate for our purposes.\footnote{In Section~\ref{sec:random_expert} we introduce a ``secret sharing" information structure that shows that with no further assumptions beyond the weak substitutes condition, no aggregation strategy achieves a better performance guarantee than the strategy of choosing a random expert to trust.} Intuitively, substitutable signals allow for effective aggregation because signal interactions are more predictable, so it is possible to infer more from forecasts alone without knowing the information structure. We consider two settings: the \emph{prior-free setting} and the \emph{known prior setting}. In the prior-free setting, an aggregator receives only the experts' forecasts as input; in the known prior setting, the aggregator additionally knows the prior, i.e. the overall expected value of $Y$ (3\% in our leading example). In both settings, the expert must then output an aggregate forecast. One simple strategy is to pick an expert at random and ``aggregate" by outputing that expert's forecast. In expectation, this aggregate performs at least as well as the prior; and under the weak substitutes condition of \cite{cw16}, the strategy does at least $1/n$ times as well as someone who knew every expert's signal and the information structure, where $n$ is the number of experts.\footnote{We judge the performance of an aggregation strategy based on its improvement over the prior.} That is, choosing a random expert attains an \emph{approximation ratio} of $1/n$. Unfortunately, we exhibit an information structure that satisfies weak substitutes but on which no aggregation strategy can outperform a $1/n$-approximation (even in the known prior setting). However, under our slightly stronger assumption of projective substitutes, it is possible to improve upon this $1/n$ baseline. Thus, while one can ask about robust aggregation in many different settings, the projective substitutes condition appears to be a sweet spot: it allows for a broad array of possible information structures while still allowing at nontrivial performance guarantees in both the prior-free and known prior settings. These results are summarized in Figure~\ref{fig:results}.\\ \begin{figure} \centering \includegraphics[scale=0.9]{Results.png} \caption{We are interested in the innermost setting, where nontrivial positive results are possible. Intervals given for each setting are asymptotic (with $n$) positive and negative results, respectively.} \label{fig:results} \end{figure} \noindent In Section~\ref{sec:prior_free}, we investigate the prior-free setting. In this setting, we show that one can improve upon the random expert strategy under the projective substitutes condition, and also that our bound is tight for two experts and close to tight in the general case. \begin{itemize} \item \textbf{(Theorem~\ref{thm:prior_free_positive}) By taking the average of the experts' forecasts, it is possible to attain an approximation ratio of at least $\mathbf{(1 + \sqrt{3}/2)/n - O \parens{1/n^2} \approx 1.866/n}$.} In other words, knowing nothing about an information structure other than the fact that it satisfies the projective substitutes condition, one can significantly improve upon the $1/n$-approximation guarantee of choosing a random expert. To prove this result, we use the projective substitutes condition to show that one of two things must be true: either (a) the experts' forecasts are (in expectation) fairly different from each other, or (b) the forecasts are somewhat accurate, meaning that they improve substantially upon the prior. In case (a), averaging the experts' forecasts guarantees substantial improvement upon a random forecast; in case (b), even though averaging the forecasts does not improve substantially upon a random forecast, a random forecast already substantially outperforms the prior. \item \textbf{(Theorem~\ref{thm:prior_free_negative}) There is no aggregation method that attains an approximation ratio of more than $\mathbf{2/n - 1/n^2}$.} In fact, we show that our negative result holds for the following simple class of information structures (which satisfy projective substitutes): each expert receives a numerical signal $\sigma_i$ drawn independently from a normal distribution with some mean $\mu$ and variance $1$, and the quantity being forecast is $Y := \sum_i \sigma_i$. (Thus, this negative result holds for every restriction on information structures that accommodates this class of examples, not only for projective substitutes.) For any such information structure, expert $i$'s forecast is $Y_i := \sigma_i + (n - 1)\mu$. This means that $Y = \sum_i Y_i - n(n - 1)\mu$. Thus, an aggregator who knew the mean $\mu$ could predict $Y$ perfectly; however, in the prior-free setting, the aggregator does not know $\mu$. We show (in a formal sense) that for this one-parameter family of information structures, the best strategy is to average the forecasts. Put otherwise, despite the amount of knowledge that the aggregator has (namely, everything other than $\mu$), the aggregator cannot do better than reporting the average of the signals. This strategy attains a $2/n - 1/n^2$ approximation guarantee on these information structures. \item \textbf{(Theorem~\ref{thm:prior_free_negative_n2}) In the case of $\mathbf{n = 2}$ experts, the positive result given in Theorem~\ref{thm:prior_free_positive} --- which in this case is $\mathbf{\frac{3 + \sqrt{7}}{8} \approx 0.706}$ --- is tight (i.e. no aggregation method can do better).} We exhibit two information structures that, despite having rather different optimal aggregation strategies, the aggregator cannot distinguish between. \end{itemize} \noindent In Section~\ref{sec:known_prior}, we investigate the known prior setting. We prove that it is possible to improve upon the aforementioned guarantee of the prior-free setting by \emph{extremizing} the average of the experts' beliefs, i.e. moving it away from the prior. Previous work on forecasting has demonstrated an empirical case for extremization \cite{sbfmtu14} \cite{bmtsu14} \cite{su15}. However, there is comparatively little work grounding extremization from a theoretical standpoint. This work shows that in our robust aggregation setup, the aggregator benefits from extremizing the average. Additionally, our results suggest a particular amount by which to extremize. Specifically, we show that: \begin{itemize} \item \textbf{(Theorem~\ref{thm:known_prior_positive}) By extremizing the average of the experts' forecasts by a particular constant factor that depends on $\mathbf{n}$,\footnote{This factor approaches $\sqrt{3}$ as $n$ approaches infinity.} it is possible to attain an approximation ratio of at least $\mathbf{(3\sqrt{3}/2)/n - O(1/n^2) \approx 2.598/n}$.} The key approach is to introduce a new degree of freedom --- the \emph{extremization factor} --- to optimize over. Setting this factor equal to $1$ returns the optimization problem solved in the proof of Theorem~\ref{thm:prior_free_positive}, but allowing the factor to take on arbitrary values allows us to substantially improve the bound. \item \textbf{(Theorem~\ref{thm:known_prior_conditional_negative}) It is not possible to attain an approximation ratio of more than $\mathbf{4n/(n + 1)^2}$ using the above approach of averaging and extremizing by a constant factor.} This result holds even in the case when each expert receives a signal from the standard Gaussian distribution, and all that is unknown is whether the signals are fully correlated or fully independent. In the first case, it is optimal not to extremize; in the second, it is optimal to extremize a lot. We prove that no fixed extremization constant attains a better approximation guarantee than stated on both information structures. \item \textbf{(Theorem~\ref{thm:known_prior_negative_n2}) In the case of $\mathbf{n = 2}$ experts, the positive result given in Theorem~\ref{thm:known_prior_positive} --- which in this case is $\mathbf{\frac{7\sqrt{7} - 17}{2} \approx 0.760}$ --- is tight (i.e. no aggregation method can do better).} As with Theorem~\ref{thm:prior_free_negative_n2}, the idea is to exhibit two information structures that are indistinguishable to the expert but have substantially different optimal aggregation strategies. \end{itemize} \subsection{Related Work} \paragraph{Axiomatic and Bayesian approaches} Prior work on forecast aggregation tends to come in two flavors: axiomatic and Bayesian. The axiomatic approach to forecast aggregation seeks to define desirable properties of aggregation methods, and asks which methods satisfy these properties. For example, \cite{aw80} show that linear pooling (i.e. averaging) is the only aggregation method that satisfies both the unanimity preservation and eventwise independence axioms. Other work on the axiomatic approach includes \cite{gen84} and \cite{dl14}. One drawback of the axiomatic approach is that aggregation methods preferred by these approaches rarely work as characterizations of how one ought to aggregate predictions under specific (natural) information structures. By contrast, the Bayesian approach seeks to create models of experts' information and analyzes the correct way for a Bayesian aggregator to take the information into account. Prior work on aggregation with a Bayesian flavor includes \cite{winkler81}, \cite{mz93}, \cite{sbfmtu14}, \cite{fck15}, and \cite{lgjw17}. However, most prior work on Bayesian aggregation takes a \emph{parametric} view of aggregation: experts are modeled as Bayesians whose signals are drawn from a particular distribution with one or more parameters, and an aggregation method is chosen to optimize an objective function within the model. For example, \cite{lgjw17} considers a model in which experts have some shared information and additionally receive private samples that are independent and identically distributed according to an exponential family. While this is a natural model, it rests on specific assumptions about the information structure, and results in this model may not generalize well. \paragraph{Robust aggregation} Our model can be thought of as a hybrid of the axiomatic and Bayesian approaches, blending what we believe to be the most appealing parts of each. We draw from the Bayesian approach in using information structures as a formalism for the experts' knowledge, whereas the goal of producing a single role that satisfies some global property (in our case, worst-case optimality) is reminiscent of the axiomatic approach. Our model is non-parametric: rather than assuming a parameterized family of distributions, we seek to optimize our aggregation method against a broad class of information structures. Our work is most similar to \cite{abs18}, which likewise seeks to optimize an aggregation method against an adversarially selected information structure. However, the class of information structures that we consider is broader: while they consider the case of two Blackwell-ordered experts (i.e. two experts, an unknown one of whom knows strictly more than the other) and two conditionally independent experts, we consider an arbitrary number of experts from any information structure that satisfies the projective substitutes condition. \cite{lr20} have a similar model, but are also quite restrictive in terms of the information structures they consider. \cite{dil21} uses a similar model, but more distantly related: they consider arbitrary decision problems but restrict the aggregator to a finite number of decisions (just two decisions for many of their results) --- in our setting this would mean forcing the aggregator to choose among finitely many output choices. Another important difference is that most of the previously mentioned work specifically considers the aggregation of \emph{probabilistic} forecasts, whereas we are interested in aggregating expected value forecasts for arbitrary real-valued quantities. \paragraph{Extremization} Past empirical work has demonstrated that extremizing the average of the experts' forecasts often improves the aggregate forecast \cite{sbfmtu14} \cite{bmtsu14} \cite{su15}. \cite{bmtsu14} explains this by noting that any individual forecaster should incorporate the fact that they may be missing useful information available to other forecasters, and that simply averaging forecasts would fail to incorporate the full wisdom of the crowd. Studying aggregation in the context of information structures as well, \cite{su15} notes that the forecast average \emph{lacks resolution}, meaning that its variance is provably too low. However, the authors note that the information structure framework is in full generality ``too abstract to be applied in practice" and instead optimize their extremization factor for multivariate Gaussian distributions. On the other hand, our approach of robust aggregation is able not only to provide a theoretical justification for extremization, but also to suggest a particular factor of extremization (Theorem~\ref{thm:known_prior_positive}), thus giving rigorous backing to what had previously been justified either by empirical heuristics or by optimization over a quite narrow class of information structures. \paragraph{Informational substitutes} In this work we explore notions of informational substitutes and their relation to forecast aggregation. The concept of informational substitutes was introduced in \cite{bhk13} and refined by \cite{cw16}.\footnote{We recommend the ArXiv version of \cite{cw16} for the most up-to-date introduction to informational substitutes.} We build on \cite{cw16} by introducing our own notion of substitutes, projective substitutes. Contemporaneous work \cite{fnw21} explores informational substitutes, though in the context of experts exchanging information to reach agreement. \section{The Known Prior Setting} \label{sec:known_prior} Let us now expand the information available to the aggregator by allowing them knowledge of the prior $\EE{Y}$. How might this change the optimal aggregation strategy? Consider the following information structure: a coin comes up heads $Y$ fraction of the time, selected uniformly from $[0, 1]$. Each of two experts sees an independent flip of the coin. It can be calculated that an expert who sees heads has a posterior of $\frac{2}{3}$. However, consider the situation in which both experts report heads: collectively they have seen two heads and zero tails, conditional on which the expected value of $Y$ is $\frac{3}{4}$. In this setting, it is beneficial to push the average of the experts' reports away from the prior, a method known as \emph{extremization} in the forecasting literature. Extremization has been demonstrated empirically to improve the accuracy of aggregate forecasts, and the theoretical intuition for the benefit of extremization extends beyond the above example. An expert's report is the posterior resulting from observing a fraction of all available evidence. If many experts update upward from the prior as a result of each of their pieces of evidence, then it stands to reason that observing \emph{all of the evidence} would cause an update that is larger than the update of an average expert. \subsection{The Extremization Factor} Consider the following aggregation strategy, parametrized by a constant $d$ which we will call the \emph{extremization factor}. \begin{equation} \label{eq:ext_factor} X := \frac{1}{n} \sum_i Y_i + (d - 1) \parens{\frac{1}{n} \sum_i Y_i - \EE{Y}}. \end{equation} Setting $d = 1$ recovers the average of the reports; setting $d = 0$ simply returns the prior. In general, setting $d > 1$ extremizes the average (i.e. pushes it away from the prior) by a factor of $d$. As an example, consider the class of information structures in Theorem~\ref{thm:prior_free_negative}, where averaging achieved an approximation ratio of $\frac{2}{n} - \frac{1}{n^2}$. On the other hand, extremizing by a factor of $n$ (i.e. setting $d = n$ above) recovers $Y$ exactly (thus achieving an approximation ratio of $1$). We now prove that by extremizing, we can achieve an approximation ratio that is higher than what we could hope to attain without knowledge of the prior. In particular, we find that \textbf{by extremizing, it is possible to achieve an approximation ratio of at least $\frac{3\sqrt{3}}{2n} - O(1/n^2) \approx 2.598/n$}, a substantial improvement not only over our positive result in the prior-free setting, but also over our negative result. \subsection{Positive Result for the Known Prior Setting} \begin{theorem} \label{thm:known_prior_positive} Let $\mathcal{I} = (\Omega, \PP, S, Y)$ be an information structure for $n$ experts that satisfies projective substitutes, and let $X = \frac{1}{n} \sum_{i = 1}^n Y_i + (d - 1) \parens{\frac{1}{n} \sum_{i = 1}^n Y_i - \EE{Y}}$, where $d = \frac{n(\sqrt{3n^2 - 3n + 1} - 2)}{n^2 - n - 1}$. Then $X$ attains an approximation ratio of at least \[\frac{(3n^2 - 3n + 1)^{3/2} - 9n^2 + 9n + 1}{2(n^2 - n + 1)^2} \ge \frac{3\sqrt{3}}{2n} - O \parens{\frac{1}{n^2}}.\] \end{theorem} \begin{proof} Let $d > 0$ and let $X := \frac{1}{n} \sum_i Y_i + (d - 1) \parens{\frac{1}{n} \sum_i Y_i - \EE{Y}}$. As with the proof of Theorem~\ref{thm:prior_free_positive}, we start by upper bounding $\EE{(Y_{[n]} - X)^2}$. We have \begin{align*} \EE{(Y_{[n]} - X)^2} &= \EE{\parens{d \parens{Y_{[n]} - \frac{1}{n} \sum_i Y_i} - (d - 1) \parens{Y_{[n]} - \EE{Y}}}^2}\\ &= d^2 \EE{\parens{Y_{[n]} - \frac{1}{n} \sum_i Y_i}^2} + (d - 1)^2 \EE{(Y_{[n]} - \EE{Y})^2}\\ &\qquad - \frac{2d(d - 1)}{n} \EE{\parens{n Y_{[n]} - \sum_i Y_i}\parens{Y_{[n]} - \EE{Y}}}\\ &= d^2 \parens{\frac{1}{n} \sum_i \EE{(Y_{[n]} - Y_i)^2} - \frac{1}{n^2} \sum_{1 \le i < j \le n} \EE{(Y_i - Y_j)^2}}\\ &\qquad + (d - 1)^2 \EE{(Y_{[n]} - \EE{Y})^2} - \frac{2d(d - 1)}{n} \sum_i \EE{(Y_{[n]} - Y_i)^2}. \end{align*} In the last step, we adapt the first term using Equation~\ref{eq:formula_one} and adapt the last term by observing that \[\EE{(Y_{[n]} - Y_i)(Y_{[n]} - \EE{Y})} = \EE{Y_{[n]}(Y_{[n]} - Y_i)} - \EE{Y}\EE{Y_{[n]} - Y_i} = \EE{Y_{[n]}(Y_{[n]} - Y_i)} = \EE{(Y_{[n]} - Y_i)^2}\] (where the last step holds because for any given $Y_i$, $\EE{Y_{[n]} \mid Y_i} = Y_i$, so $\EE{Y_i(Y_{[n]} - Y_i)} = 0$). Grouping like terms, we have \[\EE{(Y_{[n]} - X)^2} = (d - 1)^2 \EE{(Y_{[n]} - \EE{Y})^2} - \frac{d(d - 2)}{n} \sum_i \EE{(Y_{[n]} - Y_i)^2} - \frac{d^2}{n^2} \sum_{1 \le i < j \le n} \EE{(Y_i - Y_j)^2}.\] Now, recall Lemma~\ref{lem:ab}. Consider any $a, b \ge 0$ satisfying $b \ge \frac{(2a - 1)^2}{4a}$; then for all $i, j$ we have \[\EE{(Y_i - Y_j)^2} \ge a \parens{\EE{(Y_{\{i,j\}} - Y_i)^2} + \EE{(Y_{\{i,j\}} - Y_j)^2}} - b \parens{\EE{(Y_i - \EE{Y})^2} + \EE{(Y_j - \EE{Y})^2}}.\] Therefore we have \begin{align*} &\EE{(Y_{[n]} - X)^2} \le (d - 1)^2 \EE{(Y_{[n]} - \EE{Y})^2} - \frac{d(d - 2)}{n} \sum_i \EE{(Y_{[n]} - Y_i)^2}\\ &\qquad - \frac{d^2}{n^2} \sum_{1 \le i < j \le n} \parens{a \parens{\EE{(Y_{\{i,j\}} - Y_i)^2} + \EE{(Y_{\{i,j\}} - Y_j)^2}} - b \parens{\EE{(Y_i - \EE{Y})^2} + \EE{(Y_j - \EE{Y})^2}}}\\ &= \parens{(d - 1)^2 + \frac{bd^2(n - 1)}{n}} \EE{(Y_{[n]} - \EE{Y})^2} - \parens{\frac{d(d - 2)}{n} + \frac{bd^2(n - 1)}{n^2}} \sum_i \EE{(Y_{[n]} - Y_i)^2}\\ &\qquad - \frac{ad^2}{n^2} \sum_{1 \le i < j \le n} \parens{\EE{(Y_{\{i,j\}} - Y_i)^2} + \EE{(Y_{\{i,j\}} - Y_j)^2}}, \end{align*} where in the last step we use the Pythagorean theorem to write $\EE{(Y_i - \EE{Y})^2}$ as $\EE{(Y - \EE{Y})^2} - \EE{(Y - Y_i)^2}$. Now we use Equation~\ref{eq:weak_subs_use}: \begin{align*} \EE{(Y_{[n]} - X)^2} &\le \parens{(d - 1)^2 + \frac{bd^2(n - 1)}{n}} \EE{(Y_{[n]} - \EE{Y})^2}\\ &\qquad - \parens{\frac{d(d - 2)}{n} + \frac{bd^2(n - 1)}{n^2} + \frac{ad^2}{n^2}} \sum_i \EE{(Y_{[n]} - Y_i)^2}. \end{align*} Now, supposing that $\frac{d(d - 2)}{n} + \frac{bd^2(n - 1)}{n^2} + \frac{ad^2}{n^2}$ is not positive, we may use Equation~\ref{eq:conditional_step} to obtain: \begin{align*} \EE{(Y_{[n]} - X)^2} &\le \parens{(d - 1)^2 + \frac{bd^2(n - 1)}{n} - \frac{n - 1}{n} \parens{d(d - 2) + \frac{bd^2(n - 1)}{n} + \frac{ad^2}{n}}} \EE{(Y_{[n]} - \EE{Y})^2}\\ &= \parens{1 + \frac{d^2 - 2d}{n} - (a - b) \frac{n - 1}{n^2} d^2} \EE{(Y_{[n]} - \EE{Y})^2}. \end{align*} With $d$ held fixed, our goal is to maximize $a - b$, just as in the proof of Theorem~\ref{thm:prior_free_positive}. This time, our constraints are $b \ge \frac{(2a - 1)^2}{4a}$ (as before) and $\frac{d(d - 2)}{n} + \frac{bd^2(n - 1)}{n^2} + \frac{ad^2}{n^2} \le 0$, which can be rewritten as $a + b(n - 1) \le \frac{2 - d}{d} n$. The optimal values are \[a = \frac{\frac{2}{d}n - 1 + \sqrt{\parens{\frac{2}{d}n - 1}^2 - n(n - 1)}}{2n} \text{ and } b = \frac{(2a - 1)^2}{4a}.\] Now, let $a$ and $b$ be as above. We may select $d$ as we please and seek to minimize the expression \[1 + \frac{d^2 - 2d}{n} - (a - b) \frac{n - 1}{n^2} d^2.\] We choose the value of $d$ in the theorem statement (which one can verify is optimal using a computer algebra system). This yields the desired approximation ratio. \end{proof} It is worth noting how $d$ varies with $n$. While $d$ increases with $n$, it reaches a limit --- namely, $\sqrt{3} \approx 1.732$.\footnote{Interestingly, the value of~$d$ recommended by our theoretical analysis is consonant with the empirical findings in~\cite{su15}.} Thus, the strategy given in Theorem~\ref{thm:known_prior_positive} does not extremize in the way that one might guess based on the optimal response to the information structures in our negative result for the prior-free setting, Theorem~\ref{thm:prior_free_negative}. This makes sense, because the signals received by each expert were independent; the worst-case optimal strategy, on the other hand, must compromise between doing well in such settings (where a large extremization factor makes sense) and ones where experts' information is highly dependent (where little or no extremization is optimal). \subsection{Negative Results for the Known Prior Setting} We first prove a conditional negative result: specifically, that our above approach of averaging and extremizing by a constant factor cannot achieve an approximation ratio better than $\frac{4}{n}$. \begin{theorem} \label{thm:known_prior_conditional_negative} Fix any $n \ge 1$. Let $\mathcal{I}_{\text{ind}}$ be the information structure in which each expert $i$ receives an independent signal $\sigma_i \sim N(0, 1)$. Let $\mathcal{I}_{\text{eq}}$ be the information structure in which each expert $i$ receives the \emph{same} signal $\sigma_i$, which is also drawn from $\sim N(0, 1)$. For both information structures, $Y = \sum_{i = 1}^n \sigma_i$. Then \begin{enumerate}[label=(\roman*)] \item $\mathcal{I}_{\text{ind}}$ and $\mathcal{I}_{\text{dep}}$ satisfy projective substitutes. \item There is no $d \in \RR$ for which the aggregation strategy that averages the experts' reports and extremizes by a factor of $d$ attains an approximation ratio of more than $\frac{4n}{(n + 1)^2}$ on both $\mathcal{I}_{\text{ind}}$ and $\mathcal{I}_{\text{dep}}$. \end{enumerate} \end{theorem} As with Theorem~\ref{thm:prior_free_negative}, the result extends to all settings that permit both $\mathcal{I}_{\text{ind}}$ and $\mathcal{I}_{\text{dep}}$. \begin{proof} The fact that $\mathcal{I}_{\text{ind}}$ satisfies projective substitutes follows from part \ref{item:negative_1} of Theorem~\ref{thm:prior_free_negative}. The fact that $\mathcal{I}_{\text{dep}}$ satisfies projective substitutes is clear because the right-hand side of Equation~\ref{eq:proj_subs} is zero. To show the second part, note that for $\mathcal{I}_{\text{ind}}$ we have $Y_i = \sigma_i$, so $Y = \sum_i Y_i$, and for $\mathcal{I}_{\text{dep}}$ we have $Y_i = n\sigma_i$, so $Y = \frac{1}{n} \sum_i Y_i$. Therefore, an extremization factor of $d$ (as in Equation~\ref{eq:ext_factor}) attains an approximation ratio of $1 - \frac{(n - d)^2}{n^2}$ for $\mathcal{I}_{\text{ind}}$ and $1 - (1 - d)^2$ for $\mathcal{I}_{\text{dep}}$. The $d$ that maximizes the minimum of these two expressions is $d = \frac{2n}{n + 1}$, which yields an approximation ratio of $\frac{4n}{(n + 1)^2}$ for both information structures. \end{proof} Finally, we note that Theorem~\ref{thm:known_prior_positive} tells us that by averaging and extremizing by a factor of $2(\sqrt{7} - 2) \approx 1.292$ achieves an approximation ratio of $\frac{7\sqrt{7} - 17}{2} \approx 0.760$. We show that this is tight. Note that this result, unlike Theorem~\ref{thm:known_prior_conditional_negative}, is unconditional. \begin{theorem} \label{thm:known_prior_negative_n2} In the known prior setting, no aggregation strategy achieves an approximation ratio larger than $\frac{7\sqrt{7} - 17}{2}$ on every two-expert information structure that satisfies projective substitutes. \end{theorem} \begin{proof} Let $\mathcal{I}_+$ be the following information structure, where $p = \frac{2 + \sqrt{7}}{12}$ and $x = \frac{\sqrt{2 + \sqrt{7}}}{3}$. We label the signals $-1$ and $1$ because these are the expected values conditional on the respective signals. \[\mathcal{I}_+ := \left\{Y = \begin{tabular}{c|cc} &$\sigma_2 = 1$&$\sigma_2 = -1$\\ \hline $\sigma_1 = 1$&$\frac{1 - (1 - 2p)x}{2p}$&$x$\\ $\sigma_1 = -1$&$x$&$\frac{-1 - (1 - 2p)x}{2p}$ \end{tabular} \qquad \PP = \begin{tabular}{c|cc} &$\sigma_2 = 1$&$\sigma_2 = -1$\\ \hline $\sigma_1 = 1$&$p$&$\frac{1}{2} - p$\\ $\sigma_1 = -1$&$\frac{1}{2} - p$&$p$ \end{tabular}\right\} \] Let $\mathcal{I}_-$ be the same information structure, but with $x = -\frac{\sqrt{2 + \sqrt{7}}}{3}$. It is a matter of calculation to verify that these information structures satisfy projective substitutes. The quantity $\EE{(Y - \EE{Y})^2}$ is the same for $\mathcal{I}_+$ and $\mathcal{I}_-$, so the aggregation strategy $X$ that guarantees the largest possible approximation ratio when the information structure is one of $\mathcal{I}_+$ and $\mathcal{I}_-$ is the one that minimizes the maximum value of $\EE{(Y - X)^2}$ over these two information structures. This is achieved by outputing $0$ when $(Y_1, Y_2)$ is $(1, -1)$ or $(-1, 1)$, $\frac{1}{2p}$ when $(Y_1, Y_2) = (1, 1)$, and $\frac{-1}{2p}$ when $(Y_1, Y_2) = (-1, -1)$. It is a matter of calculation to verify that this aggregation strategy achieves an approximation ratio of exactly $\frac{7\sqrt{7} - 17}{2}$. \end{proof} \begin{remark} \label{rem:other_information} The example in Theorem~\ref{thm:known_prior_negative_n2} in fact shows that for $n = 2$ experts it is impossible to achieve an approximation ratio larger than $\frac{7\sqrt{7} - 17}{2}$ even if the aggregator has access to substantially more information than the prior. In particular, the aggregator cannot do better even if given access to $\PP$ and to the random variables $Y_1, Y_2$ as functions (i.e. what the value of $Y_1$ is under every possible signal outcome $\sigma_1$, and similarly for $Y_2$). \end{remark} \subsection{Beyond Linear Extremization?} In this section we have focused on what \cite{su15} call \emph{linear extremization}: extremization by a fixed multiplicative factor. To our knowledge this is the only extremization method for real-valued forecasts that has been studied.\footnote{Other methods have been studied for extremizing probabilistic forecasts, see e.g. \cite{sbfmtu14}, but that is not our setting.} As byproducts of our upper and lower bounds on the power of this technique, our work provably separates what is possible with and without knowledge of the prior, justifies in a formal sense the practice of linear extremization (by showing that it is superior to straightforward averaging), and provides guidance as to how much extremization is appropriate. Our general model reveals a natural open question, namely whether there are more exotic aggregation strategies guaranteed to outperform linear extremization. This question, which can easily be phrased formally using the definitions and performance metrics of our general model, appears not to be formally explored in the existing literature and is an intriguing question for future work. \section{Preliminaries} \label{sec:prelims} \subsection{Information Structures} We consider a set $\Omega$ of possible states of the world, with a probability distribution $\PP$ over these states. Additionally there are $n$ experts labeled $1 \dots n$. Each expert $i$ learns the value of a random variable $\sigma_i: \Omega \to S_i$; we call $\sigma_i$ expert $i$'s \emph{signal} and $S_i$ their \emph{signal set}. We let $S := S_1 \times \dots \times S_n$ denote the space of signal tuples. An expert's signal can be thought of as partial information about the true state of the world $\omega \in \Omega$. Additionally, we consider a random variable $Y: \Omega \to \RR$ with $\EE{Y^2} < \infty$ whose value we wish to estimate. We use the term \emph{information structure} to refer to the tuple $\mathcal{I} := (\Omega, \PP, S, Y)$. In the case that $Y$ is determined by the experts' signals (i.e. for every profile of signals there is only one possible value of $Y$), we may summarize $\mathcal{I}$ with two tables, one showing $Y$ as a function of $(\sigma_1, \dots, \sigma_n)$ and the other showing $\pr{(\sigma_1, \dots, \sigma_n)}$. For example, consider the following information structure. \[ \left\{Y = \begin{tabular}{c|cc} &$\sigma_2 = 0$&$\sigma_2 = 1$\\ \hline $\sigma_1 = 0$&0&1\\ $\sigma_1 = 1$&1&0 \end{tabular} \qquad \PP = \begin{tabular}{c|cc} &$\sigma_2 = 0$&$\sigma_2 = 1$\\ \hline $\sigma_1 = 0$&1/4&1/4\\ $\sigma_1 = 1$&1/4&1/4 \end{tabular}\right\} \] We refer to this as the \emph{XOR information structure}, because it describes the following situation: two experts receive independent, uniformly random bits, and $Y$ is the XOR of these bits.\footnote{Note that when we write $\sigma_1 = 0$, $0$ is merely a label for a particular signal value in $S_1$; we could have labeled expert 1's signals $a$ and $b$ instead. Our choice of labels reflects the intuition of the XOR structure describing $Y$.} Consider a subset of experts $A \subseteq [n]$. We define $Y_A := \EE{Y \mid \sigma_i: i \in A}$. That is, $Y_A$ is the random variable whose value is the expectation of $Y$ given the signals of the experts in $A$. If $A = \{i\}$, we write $Y_i$ in place of $Y_{\{i\}}$. With the XOR information structure, $Y_1$ is a random variable whose value is always $\frac{1}{2}$ (since $\EE{Y \mid \sigma_1 = 0} = \EE{Y \mid \sigma_1 = 1} = \frac{1}{2}$). On the other hand, $Y_{\{1, 2\}}$ has value $0$ when $(\sigma_1, \sigma_2)$ is either $(0, 0)$ or $(1, 1)$, and $1$ otherwise. The random variable $Y_\emptyset$ is simply $\EE{Y}$, i.e. the unconditional expected value of $Y$. $Y_\emptyset$ can be thought of as the prior on $Y$. \subsection{Improving on the Prior} \label{sec:improving} In this work, we will be taking the perspective of an aggregator who receives estimates of $Y$ from each expert. The aggregator then produces an estimate $X$ of $Y$ which is as accurate as possible. In particular, we care about the \emph{robust} estimation of $Y$: a single estimate that is simultaneously as accurate as possible across all possible information structures (satisfying the projective substitutes condition, which we discuss below). We assess an aggregator's performance by the squared distance between their estimate $X$ and the true value $Y$. That is, the aggregator wishes to minimize $\EE{(Y - X)^2}$. We define the function $v(X)$ as follows to reflect the \emph{quality of $X$ as an estimate of $Y$}. \begin{defin} Given an information structure $\mathcal{I} = (\Omega, \PP, S, Y)$ and a random variable $X$, we define \[v(X) := \EE{(Y - \EE{Y})^2} - \EE{(Y - X)^2}.\] \end{defin} Thus, $v(\cdot)$ is the improvement in loss provided by $X$ over an uninformed estimate. For example, $v(Y_\emptyset) = 0$ and $v(Y) = \EE{(Y - \EE{Y})^2}$ is the variance of $Y$. We cannot possibly hope for any $X$ such that $v(X) > Y_{[n]}$, since $Y_{[n]}$ is the estimate produced by knowing all information that exists. This motivates comparing $v(X)$ against the benchmark $v(Y_{[n]})$. However, the aggregator does not know the underlying information structure --- only the experts' estimates. Specifically, we will consider two settings: \begin{enumerate}[label=(\arabic*)] \item The \emph{prior-free setting}: the aggregator's estimate is only based on the experts' estimates. That is, $X$ is a function of $Y_1, \dots, Y_n$. \item The \emph{known prior setting}: the aggregator knows the experts' estimates and the prior. That is, $X$ is a function of $Y_1, \dots, Y_n$ and $\EE{Y}$. \end{enumerate} That is, $X$ is a function of $n$ real numbers (or $n + 1$, in the known prior setting); we call this function the aggregator's \emph{aggregation strategy}. The aggregator's goal is to come up with an aggregation strategy that performs well across information structures (we formalize this below).\\ In the known prior setting, the aggregator can report $X = \EE{Y}$; then $v(X) = 0$ (we call this the \emph{trivial aggregation strategy}). In both settings it is possible to do at least as well by reporting e.g. $X = Y_1$. On the other hand, without any conditions on the information structure, it is not always possible to do better: in the XOR information structure (above), the aggregator is guaranteed to receive $Y_1 = Y_2 = \frac{1}{2}$, and it is impossible for the aggregator to improve upon simply reporting the prior of $\frac{1}{2}$. \subsection{Informational Complements and Substitutes} Intuitively, in the XOR information structure, the aggregator is impeded by the fact that the experts' signals are \emph{informational complements}: each signal (and the estimate it produces) is not valuable by itself, but the two signals are valuable when taken together. The opposite of informational complements is \emph{informational substitutes}. \cite{cw16} discuss a few different notions of substitutes, of which the most relevant one for us is \emph{weak informational substitutes}. This notion is a property of $v(\cdot)$ as a set function on the subsets of $[n]$. The function is guaranteed to be monotone --- that is, $v(Y_A) \le v(Y_B)$ for $A \subseteq B$ --- whereas the weak substitutes condition additionally requires submodularity.\footnote{The authors define informational substitutes with respect to an arbitrary value function; in our case, the value function is the function $v$.} \begin{defin}[\cite{cw16}] \label{def:weak_subs} We say that $\mathcal{I} = (\Omega, \PP, S, Y)$ for $n$ experts satisfies \emph{weak informational substitutes} if for all $A \subseteq B \subseteq [n]$ and $i \in [n]$, we have \begin{equation} \label{eq:weak_subs} v(Y_{A \cup \{i\}}) - v(Y_A) \ge v(Y_{B \cup \{i\}}) - v(Y_B). \end{equation} \end{defin} That is, $\mathcal{I}$ satisfies weak substitutes if the marginal improvement in the ability to estimate $Y$ from learning a signal $i$ is a decreasing function of the subset of signals already known. The XOR information structure does not satisfy weak substitutes: we have $v(\emptyset) = v(Y_1) = v(Y_2) = 0$ and $v(Y_{[2]}) = \frac{1}{4}$, so the marginal value of learning $\sigma_2$ is \emph{higher} if $\sigma_1$ is already known. By contrast, consider the information structure in which Alice and Bob are given the \emph{same} input bit $b$, and $Y = b$. In this case, the marginal value of Bob's signal is zero if Alice's signal is already known, so this information structure satisfies weak substitutes. \subsection{Random Expert Strategy Under Weak Substitutes} \label{sec:random_expert} It is not surprising that with no knowledge of the information structure, it is impossible to outperform the trivial strategy. Perhaps it would be possible to do better with only a coarse constraint on the information structure. It is not \emph{a priori} obvious that this should be possible. However, if $\mathcal{I}$ satisfies weak substitutes, then it is possible to outperform the trivial strategy by reporting a random expert's belief: \begin{prop} \label{prop:random_expert} Suppose that $\mathcal{I} = (\Omega, \PP, S, Y)$ satisfies weak substitutes, and let $X$ be equal to $Y_i$ for a uniformly random $i \in [n]$ (we call this the \emph{random expert strategy}). Then $v(X) \ge \frac{1}{n} v(Y_{[n]})$. \end{prop} \begin{proof} For $j \in [n]$, plug $A = \emptyset, B = [j - 1], i = j$ into Equation~\ref{eq:weak_subs}. Adding these $n$ inequalities (and recalling that $v(\emptyset) = 0$), we find that $\sum_{j = 1}^n v(Y_j) \ge v(Y_{[n]})$. Therefore, for $X$ as in the proposition statement, we have \[v(X) = \frac{1}{n} \sum_{i = 1}^n v(Y_i) \ge \frac{1}{n} v(Y_{[n]}),\] as desired. \end{proof} Put otherwise, the random expert strategy attains an \emph{approximation ratio} of $1/n$. \begin{defin} Given an information structure $\mathcal{I} = (\Omega, \PP, S, Y)$ with $n$ experts, the \emph{approximation ratio} of a random variable $Z$ is given by the quantity $v(Z)/v \parens{Y_{[n]}}$. \end{defin} Unfortunately, the following result (whose proof Appendix~\ref{appx:prelims_omitted}) shows that with no further assumptions, it is not possible to attain an approximation ratio larger than $1/n$: \begin{prop} \label{prop:weak_bad} For every $n$, there is an information structure that satisfies the weak substitutes condition, such that in both the prior-free and known prior settings, no aggregation strategy attains an approximation ratio greater than $1/n$ on the information structure. \end{prop} The key idea is to use Shamir secret sharing \cite{shamir79} to create an $(n, k)$-threshold scheme for a uniformly random $k \in [n]$. Then $v(\cdot)$ is additive (and thus submodular) on the subsets of $[n]$, but an aggregator who only knows the experts' reports will only be able to recover the secret if $k = 1$. \begin{proof} Let $p > n$ be a prime. Consider the following information structure (the \emph{secret sharing information structure}). \begin{itemize} \item An integer $k \in [n]$ is selected uniformly at random and announced. \item A random $(k - 1)$-th degree polynomial $P(x) = a_0 + a_1x + \dots + a_{k - 1}x^{k - 1}$ over $\FF_p$ is selected, with coefficients chosen uniformly at random from $\FF_p$, except that $a_0$ is either $-1$ or $1$ (also uniformly). For each $i \in [n]$, expert $i$ is told $P(i)$. \item The quantity $Y$ is equal to $1$ if $a_0 = 1$ and $-1$ if $a_0 = -1$. \end{itemize} Note that for a fixed choice of $k$, we have $Y_A = 0$ if $\abs{A} < k$ and $Y_A = \pm 1$ if $\abs{A} \ge k$. Therefore, for any $A$ we have that $Y_A = \pm 1$ with probability $\frac{\abs{A}}{n}$ and $0$ otherwise. Therefore, we have that $v(Y_A) = \frac{\abs{A}}{n}$, so $v(\cdot)$ is additive (and thus submodular). Thus, this information structure satisfies weak substitutes. On the other hand, note that with probability $\frac{n - 1}{n}$, all experts report $0$ to the aggregator, in which case the aggregator cannot do better in expectation than also reporting $0$. Thus, it is impossible for the aggregator to report an estimate $X$ with $v(X) > \frac{1}{n}$, and so an approximation ratio larger than $\frac{1}{n}$ is not attainable. \end{proof} The secret sharing information structure is a lottery over $n$ different information structures, for each of which $v(\cdot)$ is a threshold function: any $k - 1$ experts know nothing ($v(A) = 0$ if $\abs{A} < k$), while any $k$ experts know everything ($v(A) = 1$ if $\abs{A} \ge k$). Except for $k = 1$, these information structures have experts that should be intuitively regarded as \emph{complementary}. Indeed, these structures generalize the XOR information structure (which is the case of $n = k = 2$). This suggests that properties of $v(\cdot)$ as a set function on $[n]$ are insufficient to capture what we intuitively mean by substitutable signals. This motivates us to seek a natural but stronger notion of informational substitutes --- one that is well-motivated and not too restrictive, but which rules out information structures such as this one and allows an aggregator to outperform the guarantee of the random expert strategy. \subsection{Projective Substitutes} \label{sec:proj_subs} The following fact (which we prove in Appendix~\ref{appx:prelims_omitted}) helps to motivate the notion that we will introduce. \begin{prop} \label{prop:weak_subs_rewrite} The weak substitutes condition may be rewritten as: for any $i$ and $A \subseteq B$, we have \[\EE{(Y_B - Y_A)^2} \ge \EE{(Y_{B \cup \{i\}} - Y_{A \cup \{i\}})^2}.\] \end{prop} Intuitively, this interpretation of substitutes says: \textbf{For any expert $i$, a set $A$ of experts becomes better at predicting the belief of a superset of experts $B$ if $i$'s signal is announced.} Here, the \emph{belief} of a set $T$ of experts refers to the expected value of $Y$ conditioned on the experts' signals, i.e. $Y_T$. This matches the intuition of substitutes as diminishing marginal returns: if signal $i$ becomes known, the ``information gap" between $A$ and $B$ decreases. A more general notion of substitutes would require this to hold \emph{even when $B$ is not a supserset of $A$}. That is: for all $i, A, B$, the $A \cup \{i\}$ can predict the belief of $B \cup \{i\}$ better than $A$ can predict the belief of $B$. This captures the spirit of diminishing marginal returns in a somewhat broader context. Let us formalize the notion of $A$'s prediction of $B$'s belief. By this we mean the expected value of $Y_B$ given the signal outcomes of the experts in $A$, i.e. $\EE{Y_B \mid \{\sigma_i: i \in A\}}$. \begin{defin} Given an information structure $\mathcal{I} = (\Omega, \PP, S, Y)$ for $n$ experts and subsets $A, B \subseteq [n]$, \emph{$A$'s prediction of $B$'s belief} is defined as the expected value of $Y_B$ given the signal outcomes of the experts in $A$, i.e. \[Y_{B \to A} := \EE{Y_B \mid \{\sigma_i: i \in A\}}.\] \end{defin} We now state our substitutes definition, which strengthens the weak substitutes condition. \begin{defin} \label{def:projective_subs} An information structure $\mathcal{I} = (\Omega, \PP, S, Y)$ for $n$ experts satisfies \emph{projective substitutes} if for all $A, B \subseteq [n]$ and $i \in [n]$, we have \begin{equation} \label{eq:proj_subs} \EE{(Y_B - Y_{B \to A})^2} \ge \EE{(Y_{B \cup \{i\}} - Y_{B \cup \{i\} \to A \cup \{i\}})^2}. \end{equation} \end{defin} The secret sharing information structure does not satisfy projective substitutes: take $A, B, i$ with $\abs{B} \ge \abs{A}$ and $i \in A \setminus B$. On the other hand, the example below does satisfy projective substitutes. \begin{example} Consider the following information structure. \[\left\{Y = \begin{tabular}{c|cc} &$\sigma_2 = 1$&$\sigma_2 = 2$\\ \hline $\sigma_1 = 1$&0&1\\ $\sigma_1 = 2$&1&2 \end{tabular} \qquad \PP = \begin{tabular}{c|cc} &$\sigma_2 = 1$&$\sigma_2 = 2$\\ \hline $\sigma_1 = 1$&0.3&0.2\\ $\sigma_1 = 2$&0.2&0.3 \end{tabular}\right\} \] Let $A = \{1\}$ and $B = \{2\}$. It is not difficult to compute that \[Y_B = \begin{tabular}{c|cc} &$\sigma_2 = 1$&$\sigma_2 = 2$\\ \hline $\sigma_1 = 1$&0.4&1.6\\ $\sigma_1 = 2$&0.4&1.6 \end{tabular} \qquad \qquad Y_{B \to A} = \begin{tabular}{c|cc} &$\sigma_2 = 1$&$\sigma_2 = 2$\\ \hline $\sigma_1 = 1$&0.88&0.88\\ $\sigma_1 = 2$&1.12&1.12 \end{tabular}\] For example, in the $(\sigma_1, \sigma_2) = (1, 1)$ case we have that $Y_B = \frac{0.3 \cdot 0 + 0.2 \cdot 1}{0.3 + 0.2} = 0.4$. $Y_B$ is then used to compute $Y_{B \to A}$: for example, in the $(\sigma_1, \sigma_2) = (1, 1)$ case we have that $Y_{B \to A} = \frac{0.3 \cdot 0.4 + 0.2 \cdot 1.6}{0.3 + 0.2} = 0.88$, as this is the expected value of $Y_B$ conditioned on $\sigma_1 = 1$. It can be computed that $\EE{(Y_B - Y_{B \to A})^2} = 0.3456$, whereas $\EE{(Y_{B \cup \{1\}} - Y_{B \cup \{1\} \to A \cup \{1\}})^2} = \EE{(Y - Y_A)^2} = 0.24$, so Equation~\ref{eq:proj_subs} is satisfied for $A = \{1\}, B = \{2\}, i = 1$. It can be verified that Equation~\ref{eq:proj_subs} is in fact satisfied for \emph{all} $A, B, i$, so this information structure satisfies projective substitutes. \end{example} \begin{remark}[Facts about projective substitutes] \label{rem:proj_subs_facts} \phantom{} \begin{enumerate}[label=(\roman*)] \item The projective substitutes definition can be interpreted as describing the class of information structures in which full information revelation is a dominant strategy. We refer the reader to Appendix~\ref{appx:information_revelation} for details. \item The weak substitutes condition is equivalent to Equation~\ref{eq:proj_subs} holding for all $A \subseteq B$, so the projective substitutes condition is stronger. In fact it is strictly stronger, as it excludes the secret sharing information structure. \item \label{item:proj_subs_equiv} There are several equivalent formulations of projective substitutes. One definition replaces $\{i\}$ with an arbitrary set $X$. Another modifies the definition by only requiring Equation~\ref{eq:proj_subs} to hold if $i \in A$.\footnote{To see that this is equivalent, for any $A, i$ with $i \not \in A$ define $A' := A \cup \{i\}$. Then Equation~\ref{eq:proj_subs} for $A', B, i$ has the same right-hand side but a smaller or equal left-hand side, and is thus more difficult to satisfy.} \item The notation $Y_{B \to A}$ comes from the fact that, by Theorem~\ref{thm:projection}, $Y_{B \to A}$ is the projection of $Y_B$ onto the sigma algebra generated by the signals of the experts in $A$. As a consequence of this alternative formulation, $Y_{B \to A}$ is the closest random variable (by expected squared distance) to $Y_B$ among all random variables that depend only on the values $(\sigma_i)_{i \in A}$. \end{enumerate} \end{remark} In Sections~\ref{sec:prior_free} and \ref{sec:known_prior}, we explore how the projective substitutes condition allows us to improve upon the $1/n$-approximation guarantee attainable under the weak substitutes condition. \subsection{The Pythagorean Theorem} Finally, we will find the following fact to be useful throughout our work. \begin{prop}[Pythagorean theorem] \label{prop:pythag} Let $A$ be a random variable, $B = \EE{A \mid \mathcal{F}}$ where $\mathcal{F}$ is a sigma-algebra, and $C$ be a random variable defined on $\mathcal{F}$. Then \[\EE{(A - C)^2} = \EE{(A - B)^2} + \EE{(B - C)^2}.\] \end{prop} Informally, $B$ is the expected value of $A$ conditional on some partial information, and $C$ is a random variable whose value only depends on this information. We defer the proof to Appendix~\ref{appx:prelims_omitted}. We call Proposition~\ref{prop:pythag} the ``Pythagorean theorem" because it is precisely the Pythagorean theorem in the Hilbert space described by the following seminal theorem from probability theory. \begin{theorem}[\cite{zidak57}] \label{thm:projection} For a given probability space $(\Omega, \mathcal{F}, \PP)$, consider the Hilbert space $\mathcal{L}^2$ of square-integrable random variables with the inner product $\angles{X, Y} := \EE{XY}$. For a given sub-sigma-algebra $\mathcal{F}'$ of the probability space, the map $X \mapsto \EE{X \mid \mathcal{F}'}$ is same as the orthogonal projection map of $\mathcal{L}^2$ onto the subspace of $\mathcal{F}'$-measurable square-integrable random variables. \end{theorem} The Pythagorean theorem lets us rewrite the approximation ratio in a more convenient form. (See Appendix~\ref{appx:prelims_omitted} for the proof.) \begin{corollary} \label{cor:improvement_rewrite} The approximation ratio of a random variable $Z$ that depends only on $\sigma_1, \dots, \sigma_n$ is equal to \[1 - \frac{\EE{(Y_{[n]} - Z)^2}}{\EE{(Y_{[n]} - \EE{Y})^2}}.\] \end{corollary} \section{The Prior-Free Setting} \label{sec:prior_free} We begin our investigation in the prior-free setting and ask: what is the largest approximation ratio that can be guaranteed under the projective substitutes condition? In this section we give a positive result and a negative result. The positive result is that \textbf{averaging the experts' reports attains an approximation ratio of at least $\mathbf{(1 + \sqrt{3}/2)/n - O(1/n^2) \approx 1.866/n}$}. The negative result is that for all $n$, \textbf{no aggregation method attains an approximation ratio of more than $\mathbf{2/n - 1/n^2}$}. Thus, projective substitutes enables a significant improvement over the $1/n$-approximation guarantee of the random expert strategy, but no more than by a factor of two. \subsection{Positive Result for the Prior-Free Setting} \begin{theorem} \label{thm:prior_free_positive} Let $\mathcal{I} = (\Omega, \PP, S, Y)$ be an information structure for $n$ experts that satisfies projective substitutes, and let $X = \frac{1}{n} \sum_{i = 1}^n Y_i$. Then $X$ attains an approximation ratio of at least \[\frac{2}{n} - \frac{n - 1}{2n(2n - 1 + \sqrt{3n^2 - 3n + 1})} - \frac{1}{n^2} \ge \parens{1 + \frac{\sqrt{3}}{2}} \cdot \frac{1}{n} - O \parens{\frac{1}{n^2}}.\] \end{theorem} \begin{proof} Let $X = \frac{1}{n} \sum_{i = 1}^n Y_i$. By Corollary~\ref{cor:improvement_rewrite}, showing that $X$ achieves an approximation ratio of $\alpha$ is equivalent to showing that \begin{equation} \label{eq:alpha_rewrite} \EE{(Y_{[n]} - X)^2} \le (1 - \alpha)\EE{(Y_{[n]} - \EE{Y})^2}. \end{equation} The first step in our proof uses the following fact: for any numbers $y_1, \dots, y_n$ and $y$, we have \[\parens{y - \frac{y_1 + \dots + y_n}{n}}^2 = \frac{1}{n} \sum_{i = 1}^n (y - y_i)^2 - \frac{1}{n^2} \sum_{1 \le i < j \le n} (y_i - y_j)^2.\] This equality follows from rearranging terms, and applying it in expectation for $y = Y_{[n]}$ and $y_i = Y_i$ gives us the following equality. \begin{equation} \label{eq:formula_one} \EE{(Y_{[n]} - X)^2} = \frac{1}{n} \sum_{i = 1}^n \EE{(Y_{[n]} - Y_i)^2} - \frac{1}{n^2} \sum_{1 \le i < j \le n} \EE{(Y_i - Y_j)^2}. \end{equation} The left-hand side here is the same as in Equation~\ref{eq:alpha_rewrite}; meanwhile, the right-hand side has a term representing the average error of a random expert and another term representing the average expected distance between the experts' forecasts. The following lemma allows us to get a handle on this last term. \begin{lemma} \label{lem:ab} For all $i, j$, and for all $a, b \ge 0$ such that $b \ge \frac{(2a - 1)^2}{4a}$, we have \begin{equation} \label{eq:ab} \EE{(Y_i - Y_j)^2} \ge a \parens{\EE{(Y_{\{i,j\}} - Y_i)^2} + \EE{(Y_{\{i,j\}} - Y_j)^2}} - b \parens{\EE{(Y_i - \EE{Y})^2} + \EE{(Y_j - \EE{Y})^2}}. \end{equation} \end{lemma} The proof of Lemma~\ref{lem:ab} relies on the projective substitutes assumption. The lemma lets us flexibly lower bound the expected distance between $Y_i$ and $Y_j$ in terms of the average expected distance from $Y_{\{i, j\}}$ to $Y_i$ and $Y_j$. Intuitively, the projective substitutes condition guarantees such a bound because expert $i$ must be able to forecast $Y_{\{i, j\}}$ better than they can forecast $Y_j$. For now we assume the truth of Lemma~\ref{lem:ab} and return to the proof of Theorem~\ref{thm:prior_free_positive}. We note that we may rewrite \begin{equation} \label{eq:pythag_app} \EE{(Y_i - \EE{Y})^2} = \EE{(Y_{[n]} - \EE{Y})^2} - \EE{(Y_{[n]} - Y_i)^2}, \end{equation} by the Pythagorean theorem. Additionally, we note that by weak substitutes (which follows from projective substitutes), for all $i$ we have \begin{equation} \label{eq:weak_subs_use} \sum_{j \neq i} \EE{(Y_{\{i, j\}} - Y_i)^2} \ge \EE{(Y_{[n]} - Y_i)^2}. \end{equation} To see this, consider for example $i = 1$. By weak substitutes, $\EE{(Y_{\{1, j\}} - Y_1)^2} \ge \EE{(Y_{[j]} - Y_{[j - 1]})^2}$, so the left-hand side of Equation~\ref{eq:weak_subs_use} is greater than or equal to $\sum_{j > 1} \EE{(Y_{[j]} - Y_{[j - 1]})^2}$, which (by $n - 2$ applications of the Pythagorean theorem) is equal to $\EE{(Y_{[n]} - Y_1)^2}$. Now, combining Equations~\ref{eq:formula_one}, \ref{eq:ab}, \ref{eq:pythag_app}, and \ref{eq:weak_subs_use} gives us that \begin{equation} \label{eq:almost_done} \EE{(Y_{[n]} - X)^2} \le \frac{b(n - 1)}{n} \EE{(Y_{[n]} - \EE{Y})^2} + \parens{\frac{1}{n} - \frac{a}{n^2} - \frac{b(n - 1)}{n^2}} \sum_{i = 1}^n \EE{(Y_{[n]} - Y_i)^2}. \end{equation} for any $a, b$ satisfying Lemma~\ref{lem:ab}. Now, note that by weak substitutes we have \begin{equation} \label{eq:conditional_step} \sum_{i = 1}^n \EE{(Y_{[n]} - Y_i)^2} = n \EE{(Y_{[n]} - \EE{Y})^2} - \sum_{i = 1}^n \EE{(Y_i - \EE{Y})^2} \le (n - 1) \EE{(Y_{[n]} - \EE{Y})^2}, \end{equation} where the first step uses the Pythagorean theorem and the second step follows from Proposition~\ref{prop:random_expert}. Therefore, if $\frac{1}{n} - \frac{a}{n^2} - \frac{b(n - 1)}{n^2} \ge 0$, we may write Equation~\ref{eq:almost_done} as \[\EE{(Y_{[n]} - X)^2} \le \frac{n - 1}{n} \parens{1 - \frac{a - b}{n}} \EE{(Y_{[n]} - \EE{Y})^2}.\] To make this inequality as tight as possible, we wish to make $a - b$ as large as possible; our constraints are that $b \ge \frac{(2a - 1)^2}{4a}$ and $\frac{1}{n} - \frac{a}{n^2} - \frac{b(n - 1)}{n^2} \ge 0$. The optimal values are \[a = \frac{2n - 1 + \sqrt{3n^2 - 3n + 1}}{2n} \text{ and } b = \frac{(2a - 1)^2}{4a}.\] This gives us \[\alpha = 1 - \frac{n - 1)}{n} \parens{1 - \frac{a - b}{n}} = \frac{2}{n} - \frac{n - 1}{2n(2n - 1 + \sqrt{3n^2 - 3n + 1})} - \frac{1}{n^2},\] as desired. \end{proof} \begin{proof}[Proof of Lemma~\ref{lem:ab}] Recall from Theorem~\ref{thm:projection} that random variables can be thought of as points in a Hilbert space. Let $T_i$ be the projection of $Y_j$ onto the space of all affine combinations of $Y_i$ and $Y_{\emptyset}$, i.e. $\{\beta Y_i + (1 - \beta) Y_{\emptyset}: \beta \in \RR\}$. (Recall that $Y_{\emptyset}$ is the random variable that is always equal to $\EE{Y}$.) Define $T_i$ analogously. Note that $\EE{(Y_j - Y_{j \to i})^2} \le \EE{(Y_j - T_j)^2}$, since $Y_{j \to i}$ is the closest point to $Y_j$ of the subspace of random variables that depend only on $\sigma_i$, and the aforementioned affine space is a subset of that subspace. Additionally, by projective substitutes (with $A = \{i\}, B = \{j\}, i = i$ in Definition~\ref{def:projective_subs}), we have that $\EE{(Y_{\{i, j\}} - Y_i)^2} \le \EE{(Y_j - Y_{j \to i})^2}$. Therefore, we have that $\EE{(Y_{\{i, j\}} - Y_i)^2} \le \EE{(Y_j - T_j)^2}$, and similarly that $\EE{(Y_{\{i, j\}} - Y_j)^2} \le \EE{(Y_i - T_i)^2}$. It therefore suffices to show that \begin{equation} \label{eq:wish_to_show_1} \EE{(Y_i - Y_j)^2} \ge a \parens{\EE{(Y_i - T_i)^2} + \EE{(Y_j - T_j)^2}} - b \parens{\EE{(Y_i - Y_{\emptyset})^2} + \EE{(Y_j - Y_{\emptyset})^2}}. \end{equation} By the Pythagorean theorem,\footnote{While in most cases by ``Pythagorean theorem" we mean Proposition~\ref{prop:pythag}, in this case we are referring to the fact that for orthogonal vectors $\vect{x}$ and $\vect{y}$, we have $\norm{\vect{x}}^2 + \norm{\vect{y}}^2 = \norm{\vect{x} + \vect{y}}^2$ (and applying this fact to e.g. $\vect{x} = Y_i - T_i$, $\vect{y} = Y_j - T_i$). Proposition~\ref{prop:pythag} can be thought of as following from this fact (in the context of Theorem~\ref{thm:projection}).} we know the following four facts. \begin{align*} \EE{(Y_i - Y_j)^2} &= \EE{(Y_i - T_i)^2} + \EE{(Y_j - T_i)^2}; & \EE{(Y_i - Y_j)^2} &= \EE{(Y_j - T_j)^2} + \EE{(Y_i - T_j)^2}\\ \EE{(Y_i - Y_{\emptyset})^2} &= \EE{(Y_i - T_i)^2} + \EE{(T_i - Y_{\emptyset})^2}; & \EE{(Y_j - Y_{\emptyset})^2} &= \EE{(Y_j - T_j)^2} + \EE{(T_j - Y_{\emptyset})^2} \end{align*} These let us rewrite Equation~\ref{eq:wish_to_show_1} as such: \begin{align} \label{eq:wish_to_show_2} &\frac{1}{2} \parens{\EE{(Y_j - T_i)^2} + \EE{(Y_i - T_j)^2}} + \parens{a - \frac{1}{2}} \parens{\EE{(T_i - Y_{\emptyset})^2} + \EE{(T_j - Y_{\emptyset})^2}} \nonumber\\ &\ge \parens{a - b - \frac{1}{2}} \parens{\EE{(Y_i - Y_{\emptyset})^2} + \EE{(Y_j - Y_{\emptyset})^2}}. \end{align} We wish to show that this inequality holds so long as $b \ge \frac{(2a - 1)^2}{4a}$. To do so, we note the following fact: for any random variables $Q, R$ and non-negative reals $c_1, c_2$, we have that \[c_1 \EE{Q^2} + c_2 \EE{R^2} \ge \frac{c_1 c_2}{c_1 + c_2} \EE{(Q + R)^2}.\] This follows (after multiplying through by $c_1 + c_2$ and cancelling terms) from the fact that for all $q, r$ we have $(c_1 q)^2 + (c_2 r)^2 \ge 2 (c_1 q)(c_2 r)$. Now, we apply this identity to $Q := Y_j - T_i$ and $R := T_i - Y_{\emptyset}$, with $c_1 = \frac{1}{2}$ and $c_2 = a - \frac{1}{2}$, and also to $Q := Y_i - T_j$ and $R := T_j - Y_{\emptyset}$. This tells us that \begin{align*} &\frac{1}{2} \parens{\EE{(Y_j - T_i)^2} + \EE{(Y_i - T_j)^2}} + \parens{a - \frac{1}{2}} \parens{\EE{(T_i - Y_{\emptyset})^2} + \EE{(T_j - Y_{\emptyset})^2}}\\ &\ge \frac{2a - 1}{4a} \parens{\EE{(Y_i - Y_{\emptyset})^2} + \EE{(Y_j - Y_{\emptyset})^2}}. \end{align*} Therefore, Equation~\ref{eq:wish_to_show_2} holds so long as $\frac{2a - 1}{4a} \ge a - b - \frac{1}{2}$, which is equivalent to $b \ge \frac{(2a - 1)^2}{4a}$. \end{proof} \subsection{Negative Results for the Prior-Free Setting} \begin{theorem} \label{thm:prior_free_negative} Fix any $n \ge 1$. For every $\mu \in \RR$, let $\mathcal{I}_\mu$ be the information structure defined as follows: each expert $i$ receives an independent signal $\sigma_i \sim N(\mu, 1)$, and $Y := \sum_{i = 1}^n \sigma_i$. Then \begin{enumerate}[label=(\roman*)] \item $\mathcal{I}_\mu$ satisfies projective substitutes for all $\mu$. \label{item:negative_1} \item No aggregation strategy achieves an approximation ratio of more than $\frac{2}{n} - \frac{1}{n^2}$ on every $\mathcal{I}_\mu$. \label{item:negative_2} \end{enumerate} \end{theorem} We note that there may be stronger substitutes conditions (or other conditions) that the information structures $\mathcal{I}_{\mu}$ satisfy. The negative result of theorem~\ref{thm:prior_free_negative} carries over to any such setting. \begin{proof} We first prove \ref{item:negative_1}. Without loss of generality, assume that $\mu = 0$. For any $A, B$, we have $Y_B = \sum_{j \in B} \sigma_j$ and $Y_{B \to A} = \sum_{j \in A \cap B} \sigma_j$ (from the perspective of the experts in $A$, the values $\sigma_j$ for $j \in A \cap B$ are known and the values $\sigma_j$ for $j \in B \setminus A$ are zero in expectation). Therefore, for any $A, B, i$ we have \[\EE{(Y_B - Y_{B \to A})^2} = \parens{\sum_{j \in B \setminus A} \sigma_j}^2 = \parens{\sum_{j \in (B \cup \{i\}) \setminus (A \cup \{i\})} \sigma_j}^2 = \EE{(Y_{B \cup \{i\}} - Y_{B \cup \{i\} \to A \cup \{i\}})^2},\] so Equation~\ref{eq:proj_subs} is satisfied (with equality).\\ We now prove \ref{item:negative_2}, and we do so in two steps: first we show that taking the average of the experts' reports yields an approximation ratio of exactly $\frac{2}{n} - \frac{1}{n^2}$ for all $\mu$, and second we show that no aggregation method beats averaging for every $\mu$. For the first step, again assume without loss of generality that $\mu = 0$. Then $Y_{[n]} = Y = \sum_i \sigma_i$ and the average of the $Y_i$'s is $X = \frac{1}{n} \sum_i \sigma_i$. Therefore we have \[\EE{(Y_{[n]} - X)^2} = \EE{\parens{\frac{n - 1}{n} \sum_i \sigma_i}^2} = \parens{\frac{n - 1}{n}}^2 \EE{\parens{\sum_i \sigma_i}^2}.\] On the other hand, we have that $\EE{(Y_{[n]} - \EE{Y})^2} = \EE{(\sum_i \sigma_i)^2}$, so (using Corollary~\ref{cor:improvement_rewrite}) we have that the approximation ratio is \[1 - \parens{\frac{n - 1}{n}}^2 = \frac{2}{n} - \frac{1}{n^2}.\] This completes the first step. To complete the second step, we use the following well-known result from statistical theory.\footnote{This fact does not generalize to more than two dimensions, meaning that if the $x_i$ are vectors in three or more dimensions drawn independently from a normal distribution with unknown mean and known covariance matrix, then there is an estimator for the mean that Pareto dominates the sample mean according to expected squared vector distance. One such estimator is the \emph{James-Stein estimator} \cite{stein56}.} \begin{prop}[\cite{blyth51}, \cite{gs51}, \cite{hl51}] \label{prop:admissible} Let $x_1, \dots, x_n$ be drawn independently from a normal distribution with unknown mean $\mu$ and standard deviation $1$. Let $\hat{\mu} := \frac{1}{n} \sum_{i = 1}^n x_i$. Then for every function $X$ of $x_1, \dots, x_n$, there exists $\mu$ such that $\EE{(X - \mu)^2} \ge \EE{(\hat{\mu} - \mu)^2}$. \end{prop} Since $\EE{(\hat{\mu} - \mu)^2} = \frac{1}{n}$ for every $\mu$, we have the following fact as a corollary. \begin{corollary} \label{cor:mean_estimator} Let $x_1, \dots, x_n$ be drawn independently from a normal distribution with unknown mean $\mu$ and standard deviation $1$. Then for every aggregation strategy $X$ that takes as input $x_1, \dots, x_n$, we have $\max_\mu \EE{(X - \mu)^2} \ge \frac{1}{n}$. \end{corollary} (The only subtlety is that aggregation strategies are not required to be deterministic; however, replacing a randomized aggregation strategy with the deterministic strategy that outputs the expected value of the randomized strategy given the inputs can only reduce expected squared error.)\\ Returning to our proof, let $X$ be any aggregation strategy on inputs $Y_1, \dots, Y_n$. We define a new aggregation strategy: $\tilde{X} := \frac{1}{n - 1}(\sum_i Y_i - X)$. We claim that if $X$ achieves an approximation ratio of more than $\frac{2}{n} - \frac{1}{n^2}$ on every $\mu$, then $\tilde{X}$ violates Corollary~\ref{cor:mean_estimator}. Note that $Y_i = \sigma_i + (n - 1)\mu$, which means that the $Y_i$'s are independent samples from $N(n\mu, 1)$. Consider $\tilde{X}$ as an estimator for $n\mu$. We have \begin{align*} \EE{(n\mu - \tilde{X})^2} &= \EE{\parens{n\mu - \frac{1}{n - 1}\parens{\sum_i Y_i - X}}^2}\\ &= \frac{1}{(n - 1)^2} \EE{\parens{\sum_i Y_i - n(n - 1)\mu - X}^2} = \frac{1}{(n - 1)^2} \EE{(Y - X)^2}, \end{align*} where in the last step we use the fact that $Y = \sum_i \sigma_i = \sum_i Y_i - n(n - 1)\mu$. Now, suppose for contradiction that $X$ achieves an approximation ratio of more than $\frac{2}{n} - \frac{1}{n^2}$ on every $\mu$. Then for all $\mu$ we have \[\parens{\frac{n - 1}{n}}^2 = 1 - \parens{\frac{2}{n} - \frac{1}{n^2}} > \frac{\EE{(Y - X)^2}}{\EE{(Y - \EE{Y})^2}} = \frac{\EE{(Y - X)^2}}{n} = \frac{(n - 1)^2}{n} \EE{(n\mu - \tilde{X})^2},\] so $\EE{(n\mu - \tilde{X})^2} < \frac{1}{n}$ for every value of $n\mu$ (and thus for every $\mu$). This contradicts Corollary~\ref{cor:mean_estimator} and completes the proof. \end{proof} Theorems~\ref{thm:prior_free_positive} and \ref{thm:prior_free_negative} give us non-matching lower and upper bounds on the optimal approximation ratio under the projective substitutes condition. In particular, for $n = 2$ experts, Theorem~\ref{thm:prior_free_positive} tells us that averaging achieves an approximation ratio of $\frac{3 + \sqrt{7}}{8} \approx 0.706$, while Theorem~\ref{thm:prior_free_positive} tells us that no aggregation strategy can achieve an approximation ratio larger than $0.75$. We now show that for two experts, our positive result is tight. \begin{theorem} \label{thm:prior_free_negative_n2} In the prior-free setting, no aggregation strategy achieves an approximation ratio larger than $\frac{3 + \sqrt{7}}{8}$ on every two-expert information structure that satisfies projective substitutes. \end{theorem} \begin{proof} Let $\mathcal{I}_+$ be the following information structure, where $p = 1 - \frac{\sqrt{7}}{4}$ and $x = \sqrt{14} - 2\sqrt{2}$. We label the signals $-1$ and $1$ because these are the expected values conditional on the respective signals. \[\mathcal{I}_+ := \left\{Y = \begin{tabular}{c|cc} &$\sigma_2 = 1$&$\sigma_2 = -1$\\ \hline $\sigma_1 = 1$&$\frac{1 - (1 - 2p)x}{2p}$&$x$\\ $\sigma_1 = -1$&$x$&$\frac{-1 - (1 - 2p)x}{2p}$ \end{tabular} \qquad \PP = \begin{tabular}{c|cc} &$\sigma_2 = 1$&$\sigma_2 = -1$\\ \hline $\sigma_1 = 1$&$p$&$\frac{1}{2} - p$\\ $\sigma_1 = -1$&$\frac{1}{2} - p$&$p$ \end{tabular}\right\} \] Let $\mathcal{I}_-$ be the same information structure, but with $x = 2\sqrt{2} - \sqrt{14}$. It is a matter of calculation to verify that these information structures satisfy projective substitutes.\footnote{These information structures were found by finding values that would make the inequalities in the proofs of Theorem~\ref{thm:prior_free_positive} and Lemma~\ref{lem:ab} hold with equality.} Note that any aggregation strategy that outputs a number other than $1$ on input $(Y_1, Y_2) = (1, 1)$ has an approximation ratio of negative infinity on an information structure where $Y = 1$ deterministically. This is likewise true for $-1$ in place of $1$. Thus, if Theorem~\ref{thm:prior_free_negative_n2} were false, it would be disproved by an information structure that outputs $1$ on $\mathcal{I}_+$ and $\mathcal{I}_-$ if $(\sigma_1, \sigma_2) = (1, 1)$ and $-1$ if $(\sigma_1, \sigma_2) = (-1, -1)$. Conditional on this, the aggregation method that minimizes the maximum expected squared distance to $Y_{[n]}$ on $\mathcal{I}_+$ and $\mathcal{I}_-$ is the one that returns $0$ when $(\sigma_1, \sigma_2) = (1, -1)$ or $(\sigma_1, \sigma_2) = (-1, 1)$. It is a matter of calculation to verify that this aggregation strategy achieves an approximation ratio of exactly $\frac{3 + \sqrt{7}}{8}$. \end{proof}
{'timestamp': '2021-11-08T02:04:45', 'yymm': '2111', 'arxiv_id': '2111.03153', 'language': 'en', 'url': 'https://arxiv.org/abs/2111.03153'}
arxiv
\section{#1} \vspace{-1mm}} \newcommand{\SubSection}[1]{\vspace{-1mm} \subsection{#1} \vspace{-1mm}} \newcommand{\SubSubSection}[1]{\vspace{-1mm} \subsubsection{#1} \vspace{-1mm}} \newcommand{\Paragraph}[1]{\vspace{0mm} \noindent \textbf{#1} \hspace{0mm}} \usepackage{tikz} \usetikzlibrary{calc} \newcommand*\circled[1]{\tikz[baseline=(char.base)]{ \node[shape=circle, draw, inner sep=1pt, minimum height={\f@size*1.4},] (char) {\vphantom{WAH1g}#1};}} \newcommand{\greencheck}{\textcolor{black}{\ding{51}}} \newcommand{\textcolor{red}{\ding{55}}}{\textcolor{red}{\ding{55}}} \title{Voxel-based 3D Detection and Reconstruction of Multiple Objects from a Single Image} \author{% Feng Liu $\enskip \! \! $ $\enskip \! \! $ $\enskip \! \! $ $\enskip \! \! $ Xiaoming Liu \\ Department of Computer Science and Engineering \\ Michigan State University, East Lansing MI 48824\\ \texttt{\{liufeng6, liuxm\}@msu.edu} } \begin{document} \maketitle \subfile{sec_0_abstract.tex} \subfile{sec_1_intro.tex} \subfile{sec_2_prior.tex} \subfile{sec_3_method.tex} \subfile{sec_4_exp.tex} \subfile{sec_5_conclusion.tex} \bibliographystyle{unsrt}
{'timestamp': '2021-11-08T02:01:08', 'yymm': '2111', 'arxiv_id': '2111.03098', 'language': 'en', 'url': 'https://arxiv.org/abs/2111.03098'}
arxiv
\section{Introduction} Many real-world systems from the fields of social science, economy, biology, chemistry, etc. can be represented as networks or graphs\footnote{Formally, graph is a mathematical representation of a network. However, hereinafter, the terms ``graph'' and ``network'' will be used interchangeably.} \cite{applications}. A network consists of nodes representing objects, connected by edges representing relations between the objects. Nodes can often be divided into groups called clusters or communities. Members of such a cluster are more densely connected to each other than to the nodes outside the cluster. The task of finding such groups is called clustering or community detection. There have been plenty of algorithms proposed by researchers in the past to address this problem. Some of the community detection algorithms require the introduction of distance or proximity measure on the set of graph nodes: a function, which shows, respectively, the distance or proximity (similarity) between a pair of nodes. Only the shortest path distance had been studied for a long time. Nowadays, we have a surprising variety of measures on the set of graph nodes \cite[Chapter 15]{DezaDeza16}. Some of the proximity measures can be defined as kernels on graphs, i.e., symmetric positive semidefinite matrices \cite{cheb-on-kernels}. Previously, kernels have been applied mainly to analyze networks without attributes. However, in many networks, nodes are associated with attributes that describe them in some way. Thereby, multiple dimensions of information can be available: a structural dimension representing relations between objects, a compositional dimension describing attributes of particular objects, and an affiliation dimension representing the community structure \cite{bothorel2015clustering}. Combining information about relations between nodes and their attributes provides a deeper understanding of the network structure. Many methods for community detection in attributed networks have been proposed recently. Surveys \cite{bothorel2015clustering,chunaev2020community} describe existing approaches to this problem. We provide some information on this in Section \ref{sec:relwork}. However, kernel-based clustering, as already noted, has not yet been applied to attributed networks. In this paper, we extend the definition of a number of previously defined proximity measures to the case of networks with node attributes. Several similarity measures on attributes are used for this purpose. Then, we apply the obtained proximity measures to the problem of community detection in several real-world datasets. According to the results of our experiments, taking both node attributes and node relations into account can improve the efficiency of clustering in comparison with clustering based on attributes only or on structural data only. Also, the most effective attribute similarity measures in our experiments are the Cosine Similarity and Extended Jaccard Similarity. \section{Related Work} \label{sec:relwork} This section is divided into two parts. In the first one, we provide a quick overview of papers where various measures on the set of graph nodes are discussed. Then, we introduce a few studies focused on community detection in attributed networks. For a long time, only the shortest path distance has been widely used \cite{dijkstra1959note}. \cite[Chapter 15]{DezaDeza16} provides a survey of dozens of measures that have been proposed in various studies in the last decades. Among them there are inspired by physics Resistance (also known as Electric) measure \cite{sharpe1967solution}, logarithmic Walk measure discussed in \cite{cheb-walk}, the Forest measure related to Resistance \cite{cheb-forest-kernel}, and many others. In \cite{cheb-on-kernels}, the authors analytically study properties of various proximity measures\footnote{Here, we use the term ``proximity measure'' in a broaded sense and, unlike \cite{cheb-on-kernels}, do not require a proximity measure to satisfy the triangle inequality for proximities.} and kernels on graphs, including Walk, Communicability, Heat, PageRank, and several logarithmic measures. Then, these measures are compared in the context of spectral clustering on the stochastic block model. \cite{fouss2012experimental} provides a survey and numerical comparison of nine kernels on graphs in application to link prediction and clustering problems. In \cite {comparison-felix}, the authors numerically study the efficiency of the Corrected Commute-Time, Free Energy, Logarithmic Forest, Randomized Shortest-Path, Sigmoid Commute-Time, and Shortest-Path measures in experiments with 15 real-world datasets. In \cite{comparison-logarithmic,transformations} it was proposed to improve the efficiency of some existing proximity measures by applying simple mathematical functions like logarithm to them. Classically, community detection algorithms used either structure information (see, e.g., \cite{girvan2002community}) or information about node attributes (e.g., \cite{jain2010data}). Recently, the idea of detecting communities based both on the structure and attribute data has attracted a lot of attention. Taking into account that it is possible to consider also edge attributes, we will focus on the attributes of nodes. In \cite{zhou2009graph}, the authors proposed the SA-Clustering algorithm. The idea of the algorithm is the following: first, an attribute node is created for each value of each attribute. An attribute edge is drawn between the ``real'' node and attribute node if the node has the value of the attribute specified in the attribute node. The random walk model then is used to estimate the distance between nodes. Communities are determined using the $k$-medoids method. The CODICIL method is presented in \cite{ruan2013efficient}. This method adds content edges as a supplement to structure edges. The presence of a content edge between two nodes means the similarity of the node attributes. Then, the graph with content edges is clustered using the Metis and Multi-level Regularized Markov Clustering algorithms. Reference \cite{neville2003clustering} proposes the method for community detection in attributed networks based on weight modification. For every existing edge, the weight of the edge is assigned to the matching coefficient between the nodes. This coefficient equals to the number of attribute values the nodes have in common. The network with modified edges is clustered using the Karger’s Min-Cut, MajorClust, and Spectral algorithms. In \cite{yang2013community}, the CESNA method is proposed. This method assumes the attributed networks to be generated by a probabilistic model. Communities are detected using maximum-likelihood estimation on this model. For a more detailed review of recently proposed methods for community detection in attributed networks, see \cite{bothorel2015clustering,chunaev2020community}. \section{Background and Preliminaries} \subsection{Definitions} Let $G = (V, E, F)$ be an undirected weighted attributed graph with the set of nodes $V$ ($|V|=n$), the set of edges $E$ ($|E|=m$), and the tuple of attribute (or feature) vectors $F$. Each of the $n$ nodes is associated with $d$ attributes, so $F = (\mathbf{f}_1, ..., \mathbf{f}_n)$, where $\mathbf{f}_i \in {\mathbb R}^d$. In the experiments, we will consider networks with binary attributes. The \textit{adjacency matrix} $A$ of the graph is a square matrix with elements $a_{ij}$ equal to the weight of edge $(i, j)$ if node $i$ is connected to node $j$ and equal to zero otherwise. In some applications, each edge can also be associated with a positive value $c_{ij}$, which is the cost of following this edge. If cost does not appear naturally, it can be defined as $c_{ij} = \frac{1}{a_{ij}}$. The \textit{cost matrix} $C$ contains costs of all the edges. The \textit{degree} of a node is the sum of the weights of the edges linked to the node. The diagonal \textit{degree matrix} $D = \mathrm{diag} (A \cdot \textbf{1})$ shows degrees of all the nodes in the graph ($\mathbf{1}=(1,...,1)^T$). Given $A$ and $D$, the \textit{Laplacian matrix} is defined as $L = D - A$, and the \textit{Markov matrix} is $P = D^{-1}A$. A \textit{measure} on the set of graph nodes is a function $\kappa$ that characterizes proximity or similarity between the pairs of graph nodes. A \textit{kernel on graph} is a similarity measure that has a Gram matrix (symmetric positive semidefinite matrix) representation $K$. Given $K$, the corresponding distance matrix $\rm{\Delta}$ can be obtained from the equation \begin{equation} \label{eq:distance-to-kernel-transformation} K = - \frac{1}{2} H \rm{\Delta} H, \end{equation} where $H = I - \frac{1}{n} \textbf{1} \cdot \textbf{1}^T$. For more details about graph measures and kernels, we refer to \cite{cheb-on-kernels}. \subsection{Community Detection Algorithms} \subsubsection{$k$-means.} The $k$-means algorithm \cite{macqueen1967some} is used in this study for community detection based on the attribute information. \subsubsection{Spectral.} In this paper, we use the variation of the Spectral algorithm presented by Shi and Malik in \cite{shi2000normalized}. The approach is based on applying the $k$-means algorithm to the eigenvectors of the Laplacian matrix of the graph. For a detailed review of the mathematics behind the Spectral algorithm, we refer to the tutorial by Ulrike von Luxburg \cite{spectral-tutorial}. \subsection{Measures} \label{sec:measures} In this study, we consider five measures which have shown a good efficiency in \cite{cheb-on-kernels,comparison-felix}. \subsubsection{Communicability.} $K^\mathrm{C} = \sum_{n=0}^{\infty} \frac{ \alpha ^ n A ^ n}{n!}= \mathrm{exp}(\alpha A)$, $\alpha > 0$ \cite{comm-distance,comm-distance-2}. \subsubsection{Heat.} $K^\mathrm{H} = \sum_{n=0}^{\infty} \frac{ \alpha ^ n (-L) ^ n}{n!}= \mathrm{exp}(-\alpha L)$, $\alpha > 0$ \cite{heat-kernel}. \subsubsection{PageRank.} $K^{\mathrm{PR}} = (I - \alpha P) ^ {-1}$, $0 < \alpha < 1$ \cite{pagerank,fouss2012experimental}. \subsubsection{Free Energy.} Given $P$, $C$ and the parameter $\alpha$, the matrix $W$ can be defined as $W = \rm{exp}(-\alpha C) \circ P$ (the ``$\circ$'' symbol stands for element-wise multiplication). Then, $Z = (I - W)^{-1}$ and $S = (Z (C \circ W)) \div Z$ (the ``$\div$'' symbol stands for element-wise division). Finally, $\mathrm{\Delta}^{\mathrm{FE}} = \frac{\Phi + \Phi^T}{2}$, where $\Phi = \frac{\mathrm{log}(Z)}{\alpha}$. $K^{\mathrm{FE}}$ can be obtained from $\mathrm{\Delta}^{\mathrm{FE}}$ using transformation \eqref{eq:distance-to-kernel-transformation} \cite{kivimaki2014developments}. \subsubsection{Sigmoid Corrected Commute-Time.} First, let us define the Corrected Commute-Time (CCT) kernel: $K^{\mathrm{CCT}} = HD^{-\frac{1}{2}}M(I - M)^{-1}MD^{-\frac{1}{2}}H$, where $H = I - \frac{\mathbf{1} \cdot \mathbf{1}^T}{n}$, $M = D^{-\frac{1}{2}} (A - \frac{\mathbf{d} \cdot \mathbf{d}^T}{\mathrm{vol}(G)}) D^{-\frac{1}{2}}$, $\mathbf{d}$ is a vector of elements of the diagonal degree matrix $D$, $\mathrm{vol}(G) = \sum_{ij=1}^n a_{ij}$. Then, the elements of $K^{\mathrm{SCCT}}$ are equal to $K^{\mathrm{SCCT}}_{ij} = \frac{1}{1 + \mathrm{exp}(-\alpha K^{\mathrm{CCT}}_{ij}/\sigma)}$, where $\sigma$ is the standard deviation of the elements of $K^{\mathrm{CCT}}$, $\alpha > 0$ \cite{luxburg2010getting,comparison-felix}. \subsection{Clustering Quality Evaluation} To evaluate the community detection performance, we employ the Adjusted Rand Index (ARI) introduced in \cite{ari-hubert}. Some advantages of this quality index are listed in \cite{ari-best}. ARI is based on the Rand Index (RI) introduced in \cite{rand}. The Rand Index quantifies the level of agreement between two partitions of $n$ elements $X$ and $Y$. Given $a$ as the number of pairs of elements that are in the same clusters in both partitions, and $b$ the number of pairs of elements in different clusters in both partitions, the Rand Index is defined as $\frac{a + b}{\binom{n}{2}}$. The Adjusted Rand Index is the transformation of the Rand Index such that its expected value is 0 and maximum value is 1: $\rm{ARI} = \frac{\rm{Index} - \rm{ExpectedIndex}}{\rm{MaxIndex} - \rm{ExpectedIndex}}$. \section{Proximity-based Community Detection in Attributed Networks} \label{sec:clustering-method} In order to apply the proximity measures described in Section \ref{sec:measures} to attributed networks, we need a way to embed node attribute information into the adjacency matrix. This can be done by modifying edge weights based on the attributes: \begin{equation}\label{eq:similarity-measure}a^s_{ij} = \beta a_{ij} + (1 - \beta) s_{ij},\end{equation} where $\beta \in [0, 1]$ and $s_{ij} = s(\mathbf{f}_i, \mathbf{f}_j)$ is an attribute similarity measure calculated for nodes $i$ and $j$. An attribute similarity measure, as the name implies, shows to what extent two nodes are similar by attributes. By varying the coefficient $\beta$, we can make a trade-off between weighted adjacency and attribute similarity. So, when $\beta = 0$, the attributed adjacency matrix $A^s$ describes only nodes similarity by attributes, while with $\beta = 1$ it coincides with $A$. Given $A^s$, we can compute attributed versions of all the other matrices required to define proximity measures. Then, the proximity measures can be calculated and applied for detecting clusters using the Spectral method. To take node attributes into account, we use various attribute similarity measures. Let $\mathbf{f}_i = (f^1_i, ..., f^d_i)$ and $\mathbf{f}_j = (f^1_j, ..., f^d_j)$ be the attribute vectors of nodes $i$ and $j$, respectively. The attribute similarity measures are defined as following: \begin{itemize} \item Matching Coefficient\footnote{Since equality will be rare for continuous attributes, Matching Coefficient is mainly used for discrete attributes, especially binary ones.} \cite{vsulc2014evaluation}: $\displaystyle{s^{\mathrm{MC}}(\mathbf{f}_i, \mathbf{f}_j) = \frac{\sum_{k=1}^d \mathds{1}(f^k_i = f^k_j)}{d}}$, where $\mathds{1}(x)$ is the indicator function which takes the value of one if the condition $x$ is true and zero otherwise; \item Cosine Similarity \cite[Chapter 2]{tan2016introduction}: $\displaystyle{s^{\mathrm{CS}}(\mathbf{f}_i, \mathbf{f}_j) = \frac{\mathbf{f}_i \cdot \mathbf{f}_j}{||\mathbf{f}_i||_2 ||\mathbf{f}_j||_2}}$; \item Extended Jaccard Similarity \cite[Chapter 2]{tan2016introduction}: $\displaystyle{s^{\mathrm{JS}}(\mathbf{f}_i, \mathbf{f}_j) = \frac{\mathbf{f}_i \cdot \mathbf{f}_j}{||\mathbf{f}_i||_2^2 + || \mathbf{f}_j||_2^2 - \mathbf{f}_i \cdot \mathbf{f}_j}}$; \item Manhattan Similarity \cite{dang2012community}: $\displaystyle{s^{\mathrm{MS}}(\mathbf{f}_i, \mathbf{f}_j) = \frac{1}{1 + ||\mathbf{f}_i - \mathbf{f}_j||_1}}$; \item Euclidean Similarity \cite{dang2012community}: $\displaystyle{s^{\mathrm{ES}}(\mathbf{f}_i, \mathbf{f}_j) = \frac{1}{1 + ||\mathbf{f}_i - \mathbf{f}_j||_2}}$. \end{itemize} \section{Experiments} In this section, we compare attribute-aware proximity measures with the plain ones in experiments with several real-world datasets: \begin{itemize} \item WebKB \cite{lu2003link}: a dataset of university web pages. Each web page is classified into one of five classes: course, faculty, student, project, staff. Each node is associated with a binary feature vector ($d = 1703$) describing presence or absence of words from the dictionary. This dataset consists of four unweighted graphs: Washington ($n = 230$, $m = 446$), Wisconsin ($n = 265$, $m = 530$), Cornell ($n = 195$, $m = 304$), and Texas ($n = 187$, $m = 328$). \item CiteSeer \cite{sen2008collective}: an unweighted citation graph of scientific papers. The dataset contains 3312 nodes and 4732 edges. Each paper in the graph is classified into one of six classes (the topic of the paper) and associated with a binary vector ($d = 3703$) describing the presence of words from the dictionary. \item Cora \cite{sen2008collective}: an unweighted citation graph of scientific papers with a structure similar to the CiteSeer graph. The number of nodes: $n = 2708$, the number of edges: $m = 5429$, the number of classes: $c = 7$, and the number of words in the dictionary (the length of the feature vector): $d = 1433$. \end{itemize} These datasets are clustered using multiple methods. First, we apply the $k$-means algorithm, which uses only attribute information and ignores graph structure. Then, each dataset is clustered with the Spectral algorithm and five plain proximity measures that do not use attribute information. Finally, communities are detected using the Spectral algorithm and attribute-aware proximity measures that employ both data dimensions (structure and attributes). We use balanced versions of attribute similarity measures with $\beta = \frac{1}{2}$ in \eqref{eq:similarity-measure}. Each of the proximity measures depends on the parameter. So, we search for the optimal parameter in the experiments, and the results include clustering quality for the optimal parameter. \section{Results} In this section, we discuss the results of the experiments. In Table \ref{table:experiments-results}, ARI for all the tested proximity measures and similarity measures on all the datasets is presented. ``No'' column shows the result for plain proximity measures that do not use attribute information. The table also presents ARI for the $k$-means clustering algorithm. The top-performing similarity measure is marked in red for each proximity measure. \begin{table}[] \caption{Results of the experiments} \label{table:experiments-results} \centering \begin{tabular}{p{2.5cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}} \hline \multirow{2}{*}{Prox. Measure} & \multicolumn{6}{c}{Similarity Measure} \\ \cline{2-7} & MC & CS & JS & MS & ES & No \\ \hline \multicolumn{7}{c}{Washington} \\ \hline \multicolumn{1}{l}{Communicability}&0.048&\textcolor{red}{0.458}&0.352&0.13&0.24&0.05\\ \multicolumn{1}{l}{Heat}&0.058&\textcolor{red}{0.457}&0.444&0.093&0.055&0.043\\ \multicolumn{1}{l}{PR}&0.269&\textcolor{red}{0.461}&0.39&0.097&0.087&0.037\\ \multicolumn{1}{l}{FE}&0.291&\textcolor{red}{0.461}&0.322&0.129&0.243&0.009\\ \multicolumn{1}{l}{SCCT}&0.307&\textcolor{red}{0.397}&0.362&0.132&0.28&0.048\\ \multicolumn{1}{l}{$k$-means} & \multicolumn{6}{c}{0.095} \\ \hline \multicolumn{7}{c}{Wisconsin} \\ \hline \multicolumn{1}{l}{Communicability}&0.089&\textcolor{red}{0.459}&0.41&0.104&0.064&0.02\\ \multicolumn{1}{l}{Heat}&0.075&\textcolor{red}{0.472}&0.416&0.111&0.092&0.082\\ \multicolumn{1}{l}{PR}&0.126&\textcolor{red}{0.471}&0.36&0.13&0.067&0.045\\ \multicolumn{1}{l}{FE}&0.081&\textcolor{red}{0.441}&0.398&0.066&0.066&0.064\\ \multicolumn{1}{l}{SCCT}&0.056&0.354&\textcolor{red}{0.383}&0.103&0.089&0.045\\ \multicolumn{1}{l}{$k$-means} & \multicolumn{6}{c}{0.364} \\ \hline \multicolumn{7}{c}{Cornell} \\ \hline \multicolumn{1}{l}{Communicability}&0.012&\textcolor{red}{0.2}&0.107&0.034&0.058&0.035\\ \multicolumn{1}{l}{Heat}&0.064&\textcolor{red}{0.181}&0.109&0.069&0.046&0.072\\ \multicolumn{1}{l}{PR}&0.047&\textcolor{red}{0.118}&0.088&0.011&-0.025&0.063\\ \multicolumn{1}{l}{FE}&0.053&0.308&\textcolor{red}{0.309}&0.046&0.058&-0.013\\ \multicolumn{1}{l}{SCCT}&0.076&\textcolor{red}{0.193}&0.112&0.057&0.055&0.027\\ \multicolumn{1}{l}{$k$-means} & \multicolumn{6}{c}{0.066} \\ \hline \multicolumn{7}{c}{Texas} \\ \hline \multicolumn{1}{l}{Communicability}&0.118&\textcolor{red}{0.288}&0.281&0.177&0.23&0.008\\ \multicolumn{1}{l}{Heat}&0.137&0.212&\textcolor{red}{0.289}&0.076&0.156&-0.013\\ \multicolumn{1}{l}{PR}&0.221&0.174&\textcolor{red}{0.287}&0.073&0.133&0.0\\ \multicolumn{1}{l}{FE}&0.23&\textcolor{red}{0.342}&0.233&0.23&0.234&0.041\\ \multicolumn{1}{l}{SCCT}&0.274&\textcolor{red}{0.344}&0.258&0.21&0.253&0.15\\ \multicolumn{1}{l}{$k$-means} & \multicolumn{6}{c}{\textcolor{red}{0.409}} \\ \hline \multicolumn{7}{c}{CiteSeer} \\ \hline \multicolumn{1}{l}{Communicability}&0.0&0.24&\textcolor{red}{0.282}&0.001&0.001&0.113\\ \multicolumn{1}{l}{Heat}&0.001&0.258&\textcolor{red}{0.276}&0.005&0.004&0.112\\ \multicolumn{1}{l}{PR}&0.003&0.242&\textcolor{red}{0.266}&-0.0&0.001&0.109\\ \multicolumn{1}{l}{FE}&0.0&\textcolor{red}{0.41}&0.41&0.162&0.186&-0.001\\ \multicolumn{1}{l}{SCCT}&0.001&0.252&\textcolor{red}{0.31}&0.051&0.183&0.018\\ \multicolumn{1}{l}{$k$-means} & \multicolumn{6}{c}{0.1} \\ \hline \multicolumn{7}{c}{Cora} \\ \hline \multicolumn{1}{l}{Communicability}&0.0&0.107&\textcolor{red}{0.119}&0.09&0.027&0.002\\ \multicolumn{1}{l}{Heat}&0.071&\textcolor{red}{0.083}&0.061&0.076&0.024&0.002\\ \multicolumn{1}{l}{PR}&0.032&\textcolor{red}{0.138}&0.135&0.068&0.029&0.005\\ \multicolumn{1}{l}{FE}&0.023&\textcolor{red}{0.408}&0.404&0.301&0.236&-0.001\\ \multicolumn{1}{l}{SCCT}&0.025&0.156&\textcolor{red}{0.189}&0.127&0.184&0.002\\ \multicolumn{1}{l}{$k$-means} & \multicolumn{6}{c}{0.07} \\ \hline \end{tabular} \end{table} As we can see, taking attributes into account improves community detection quality for all the proximity measures. Attribute-aware proximity measures outperform $k$-means for all the datasets except Texas. Therefore, we can conclude that in most cases, the proximity measures based on structure and attribute information perform better than both the plain proximity measures which use only structure information and the $k$-means clustering method which uses only attribute information. Not all tested attribute similarity measures have shown good clustering quality. Figure \ref{fig:sim-measures-means} presents the average rank and standard deviation for attribute similarity measures and $k$-means. The rank is averaged over 6 datasets. The figure contains 5 graphs: one for each proximity measure. \begin{figure}[htp] \centering \includegraphics[width=.32\textwidth]{mean_communicability.eps} \includegraphics[width=.32\textwidth]{mean_heat.eps} \includegraphics[width=.32\textwidth]{mean_page_rank.eps} \medskip \includegraphics[width=.32\textwidth]{mean_free_energy.eps} \includegraphics[width=.32\textwidth]{mean_scct.eps} \caption{Average rank and standard deviation for attribute similarity measures and $k$-means} \label{fig:sim-measures-means} \end{figure} One can see that the Cosine Similarity and Extended Jaccard Similarity measures perform the best: they have the highest ranks for all the proximity measures. As for plain proximity measures, which are not combined with any similarity measure, they have one of the lowest ranks. The performance of the Matching Coefficient, the Manhattan Similarity, and the Euclidean Similarity measures varies for different proximity measures. In Table \ref{table:best-pairs}, the top-performing combinations of a proximity measure and a similarity measure are presented. As can be seen, the undisputed leader is Free Energy combined with the Cosine Similarity measure. \begin{table} \caption{The top-performing pairs of proximity measure and similarity measure} \label{table:best-pairs} \centering \begin{tabular}{p{0.5cm}p{3cm}p{3cm}p{2cm}} \noalign{\smallskip}\hline\noalign{\smallskip} № & Proximity measure & Similarity measure & Average rank \\ \noalign{\smallskip}\hline\noalign{\smallskip} 1 & FE & CS & 2.833 \\ 2 & FE & JS & 6.333 \\ 3 & Communicability & CS & 6.667 \\ 4 & SCCT & JS & 7.333 \\ 5 & SCCT & CS & 7.667 \\ 6 & Communicability & JS & 8.333 \\ 7 & PR & CS & 8.333 \\ 8 & Heat & CS & 8.667 \\ \hline \end{tabular} \end{table} \section{Conclusion} In this paper, we investigated the possibility of applying proximity measures for community detection in attributed networks. We studied a number of proximity measures, including Communicability, Heat, PageRank, Free Energy, and Sigmoid Corrected Commute-Time. Attribute information was embedded into proximity measures using several attribute similarity measures, i.e., the Matching Coefficient, the Cosine Similarity, the Extended Jaccard Similarity, the Manhattan Similarity, and the Euclidean Similarity. According to the results of the experiments, taking node attributes into account when measuring proximity improves the efficiency of proximity measures for community detection. Not all attribute similarity measures perform equally well. The top-performing attribute similarity measures were the Cosine Similarity and Extended Jaccard Similarity. Future studies may address the problem of choosing the optimal $\beta$ in \eqref{eq:similarity-measure}. Another area for future research is to find more effective attribute similarity measures.
{'timestamp': '2021-11-08T02:00:47', 'yymm': '2111', 'arxiv_id': '2111.03089', 'language': 'en', 'url': 'https://arxiv.org/abs/2111.03089'}
arxiv
\section{Relations Between UIC, MIC, and SCP} \section{Relations Between Incentive Compability Notions} \label{sec:ic-compare} The notions UIC, MIC, and $1$-SCP are incomparable as depicted in Figure~\ref{fig:ICgraph}. \begin{figure}[h] \centering \input{ICgraph.tex} \caption{Relationship among incentive compatibility notions. The same chart holds for UIC, MIC, and $1$-SCP under $\gamma$-strict-utility for any $\gamma \in [0, 1]$.} \label{fig:ICgraph} \ignore{\qquad \begin{subfigure}[b]{0.38\textwidth} \input{ICgraph-weak.tex} \caption{Weak UIC, weak MIC, and $1$-SCP are incomparable.} \label{fig:ICgraph} \end{subfigure} } \end{figure} We explain Figure~\ref{fig:ICgraph} in more detail below: \begin{itemize}[leftmargin=5mm] \item UIC $\not\Rightarrow$ MIC, UIC $\not\Rightarrow$ $1$-SCP: the second-price auction satisfies UIC, but does not satisfy MIC or $1$-SCP. This was pointed out in several earlier works~\cite{functional-fee-market,roughgardeneip1559,roughgardeneip1559-ec}. Recall that in the second-price auction, the highest $B$ bids are included in the block, the top $B-1$ are confirmed and they pay the $B$-th price, where $B$ is the block size. The miner gets all payment. \item MIC $\not\Rightarrow$ UIC, $1$-SCP $\not\Rightarrow$ UIC: the first-price auction satisfies MIC and $c$-SCP for any $c \geq 1$, but is not UIC. This was also pointed out in earlier works~\cite{functional-fee-market,roughgardeneip1559,roughgardeneip1559-ec}. Recall that in the first-price auction, the top $B$ bids are included and confirmed, they each pay their bid, and the miner gets all payment. \item MIC $\not\Rightarrow$ $1$-SCP: the posted price auction satisfies MIC but not $1$-SCP. Recall that in the posted-price auction, there is a fixed reserve price $r$. Everyone bidding at least $r$ is included and confirmed and pays exactly $r$. The miner gets all payment. It is easy to check that the mechanism is indeed MIC. However, it is not $1$-SCP, since if a user's true value is $0 < r' < r$, the miner can collude with the user, have the user bid $r$ instead, and the joint utility of the coalition strictly increases. \elaine{was this shown by roughgarden?} \item $1$-SCP $\not\Rightarrow$ MIC: this is the most subtle to see. We construct the following ``first-price-or-free'' mechanism which is $c$-SCP for any $c \geq 1$, but not MIC. The mechanism is not MIC since if there is only one bid, it makes sense for the miner to inject a fake bid to increase its utility. We show that the mechanism satisfies $c$-SCP for any $c \geq 1$ below. \end{itemize} \begin{mdframed} \begin{center} {\bf First-price-or-free mechanism} \end{center} \begin{itemize}[leftmargin=5mm,itemsep=1pt] \item Choose all bids in the current bid vector to include in the block. Let $\bfb = (b_1,\ldots,b_m)$ be the included bids of the block, where $b_1 \geq \cdots \geq b_m$. \item Only the highest bid ($b_1$) is confirmed. Every other bid is unconfirmed. \item If there is only one bid in the block ($m = 1$), the only confirmed user pays nothing. Otherwise, if $m \geq 2$, the only confirmed user pays $b_1$. \item The miner gets all the payment. \end{itemize} \end{mdframed} \ignore{ In this paper, we examine transaction fee mechanisms by three metrics: user incentive compatible (UIC), miner incentive compatible (MIC), and $c$-side-contract-proof ($c$-SCP). It is natural to ask what their relations are. Do we really need three properties to characterize a mechanism? In this section, we will show that none of them implies each other. Recall that in the first-price auction, every included bid is confirmed, and pays its bid to the miner. In the second price, if the block size is $B$, only the highest $B-1$ bids are confirmed, and they pay the price of $B^\text{th}$ bid to the miner. As Roughgarden \cite{roughgardeneip1559} pointed out, first-price auction is MIC and $c$-SCP for all $c$, while it is not UIC. On the other hand, second-price auction is known to be UIC, while it is not MIC and $1$-SCP. The relation MIC $\not\Rightarrow$ $1$-SCP can be seen from the following posted-price auction without burning. \begin{mdframed} \begin{center} {\bf Posted-price auction without burning} \end{center} \paragraph{Parameter:} posted-price $r$ \begin{itemize}[leftmargin=5mm,itemsep=1pt] \item Choose every bid $\geq r$ to include in the block. \item Every bid $\geq r$ is confirmed, and other bids are unconfirmed. \item All confirmed bids pay the posted-price $r$ \item All payment goes to the miner. \end{itemize} \end{mdframed} Posted-price auction without burning is MIC. Intuitively, the confirmation of each bid is independent of other bids, so injecting fake transactions would not help more transactions to be confirmed. Besides, to miner's best interest, it wants to confirm as many transactions as possible, so honestly including every bid $\geq r$ maximize miner's utility. However, it is not $1$-SCP. Consider a user whose true value is $r - \epsilon$, for any $0 < \epsilon < r$. The miner can sign a contract with that user, and asks it to bid $r$ instead. In this case, that user's utility becomes $\epsilon$, while the miner earns $r$ more. The last relation $1$-SCP $\not\Rightarrow$ MIC is the trickiest. At first glance, it seems that $1$-SCP should implies MIC trivially. If a mechanism can resist a coalition, why can't it resist a single miner deviation? However, it is possible that the deviation done by the miner only benefits the miner, while it hurts users. Consider the following mechanism. \begin{mdframed} \begin{center} {\bf Zero-or-all auction \Hao{Need a better name}} \end{center} \begin{itemize}[leftmargin=5mm,itemsep=1pt] \item Choose all bids in the mempool to include in the block. Let $\bfb = (b_1,\ldots,b_m)$ be the included bids of the block, where $b_1 \geq \cdots \geq b_m$. \item Only the highest bid ($b_1$) is confirmed. Every other bid is unconfirmed. \item If there is only one bid in the block ($m = 1$), the only confirmed user pays nothing. Otherwise, if $m \geq 2$, the only confirmed user pays $b_2$. \item The miner gets all the payment. \end{itemize} \end{mdframed} } \begin{theorem} The first-price-or-free mechanism is $c$-SCP for all $c \geq 1$. \end{theorem} \begin{proof} Suppose there is only one user with true value $v^*$. The miner and that user is the only possible coalition. If they play honestly, that user's bid is the only bid in the block, so it must be confirmed. Thus, in the honest case, the joint utility is $v^*$. If the coalition now deviates, then the confirmed bid is either a fake bid or the colluding user's bid. In either case, the coalition's utility cannot exceed $v^*$. Suppose the number of users is $m \geq 2$. There are two cases. First, suppose the highest bid $b_1$ does not belong to the coalition if all colluding users are bidding truthfully. In this case, the coalition's utility is $b_1$ when it behaves honestly, and $b_1 \geq v^*$ where $v^*$ denotes the highest true value of any colluding user. Second, the highest bid $b_1$ belongs to the coalition if colluding users are bidding truthfully. In this case, the coalition's utility is $b_1 = v^*$ if it behaves honestly. In either case, we show that if the coalition deviates, it cannot gain. Suppose $b'_1$ is the new highest bid after deviating. If $b'_1$ belongs to the coalition, then the miner revenue offsets the coalition's payment, and thus the coalition's utility cannot exceed the highest true value of any colluding user. If $b'_1$ does not belong to the coalition, it must be that $b'_1 \leq b_1$, and the coalition's utility is $b'_1 \leq b_1$. \ignore{ Suppose there are $m \geq 2$ users so that the bids in the mempool is $\bfb = (b_1,\ldots,b_m)$, where $b_1 \geq \cdots \geq b_m$. Let $v_i$ be the true value of user $i$ for $i \in [m]$. Now, suppose the miner and any subset of users form a coalition. Let $j$ be the user with the highest true value in the coalition. There are three possible cases. \begin{itemize} \item {\it Case 1: $v_j > b_1$.} In this case, if the miner and every user in the coalition play honestly, user $j$ should be confirmed, and the joint utility of the coalition is $v_j$. Since there is only one user can be confirmed in this mechanism, $v_j$ is the maximal utility the coalition can achieve. \item {\it Case 2: $v_j = b_1$.} In this case, if the miner and every user in the coalition play honestly, both user $1$ and user $j$ have a chance to be confirmed, while only one of them is actually confirmed. In either case, the joint utility of the coalition is $v_j$. It is the maximal utility the coalition can achieve. \item {\it Case 3: $v_j < b_1$.} In this case, if the miner and every user in the coalition play honestly, user $1$ should be confirmed, and the joint utility of the coalition is $b_1$. Since there is only one user can be confirmed in this mechanism, if the coalition bids strategically so that other user is confirmed, the utility of the coalition is either smaller or equal to $b_2$ or $v_j$. It cannot exceed $b_1$. \end{itemize} Therefore, in all cases, the utility of the coalition is maximized if the miner and every user in the coalition play honestly. The argument holds for any coalition, so the mechanism is $c$-SCP, for all $c$. } \end{proof} \paragraph{Relationship for incentive compatibility notions under $\gamma$-strict-utility.} Note that in Figure~\ref{fig:ICgraph}, for each arrow $X \not\Rightarrow Y$ shown by some example mechanism, it is easy to check that the same mechanism also shows that $X \not\Rightarrow \text{weak } Y$. Thus, Figure~\ref{fig:ICgraph} in fact also holds for UIC, MIC, and $1$-SCP under $\gamma$-strict-utility, for any choice of $\gamma \in [0, 1]$. \subsection{The Burning Second-Price Auction} \label{sec:burn2ndprice} \begin{mdframed} \begin{center} {\bf The burning second-price auction} \end{center} \paragraph{Parameters:} \begin{itemize}[leftmargin=5mm,itemsep=1pt] \item the block size $B$, \item the maximum coalition size $c \in \ensuremath{\mathbb{N}}\xspace$, \item the discount factor $\gamma \in [0,1]$, \item $k,k' \in \ensuremath{\mathbb{N}}\xspace$ such that $k + k' = B$ \elaine{note: changed to = here} and $1\leq k' \leq \lfloor\frac{\gamma k}{c} \rfloor$, where $k$ denotes the number of included bids that are eligible and might be confirmed with some probability, and $k'$ is the number of included bids that are not eligible for confirmation, but are used to set the price. \end{itemize} \paragraph{Mechanism:} \begin{itemize}[leftmargin=5mm,itemsep=1pt] \item {\it Inclusion rule.} Choose the $B$ highest bids to include in the block, breaking ties arbitrarily. Let $(b_1,\ldots, b_B)$ denote the included bids where $b_1 \geq \cdots \geq b_B$. If the block is not fully filled, any remaining empty slot is treated as a bid of $0$. \item {\it Confirmation rule.} Select a random subset $S \subseteq \{b_1, \ldots, b_k\}$ of size exactly $\lfloor\frac{\gamma k}{c}\rfloor$ using (trusted) on-chain randomness. The set $S$ is confirmed and all other bids $\{b_1, \ldots, b_B\} \setminus S$ are unconfirmed. \item {\it Payment rule.} Any confirmed bid pays $b_{k+1}$. All unconfirmed bids pay nothing. \item {\it Miner revenue rule.} The miner is paid $\gamma \cdot (b_{k+1} + \cdots + b_{k + k'})$. Burn any remaining payment collected from the confirmed bids. \end{itemize} \end{mdframed} \paragraph{Regarding on-chain randomness.} In the above burning second-price auction, the inclusion rule executed by the miner is deterministic, and only the confirmation rule that is executed by the blockchain is randomized. To implement such a mechanism in practice, we will need trusted on-chain randomness. How to sgenerate unbiased and unpredictable random coins in distributed environment has been extensively studied~\cite{Cachin00randomoracles,randpiper,spurt}. Since such ``trusted'' random coins could be expensive to generate in a decentralized environment, we would ideally like to avoid them. Unfortunately, we will show later that randomness is actually necessary to get weak incentive compatibility when $c \geq 2$. \ignore{ For example, in certain consensus protocols, the consensus nodes can jointly run a coin toss protocol for each block mined. The coin toss outcome is guaranteed to be unbiased and unpredicable as long as a majority or super-majority of the nodes behave honestly. } \paragraph{Some interesting observations.} We can make a few intereseting observations about this mechanism: \begin{enumerate}[leftmargin=5mm] \item First, the larger the coalition resistance parameter $c$, the smaller the number of confirmed bids $\floor{\frac{\gamma k}{c}}$. Similarly, when $\gamma$ is larger, i.e., when we are charging harsher costs for cheating, the mechanism can confirm more bids. In other words, both $c$ and $\gamma$ can be viewed as knobs that allow us to smoothly tradeoff the strength of incentive compatibility achieved and the efficiency of the mechanism. \item Second, when $\gamma = 0$, i.e., when there is no cost for overbid/fake unconfirmed bids, the number of confirmed bids $\floor{\frac{\gamma k}{c}} = 0$ --- in other words, the mechanism becomes degenerate. This is consistent with the impossibility result we have shown for (strong) incentive compatibility (see Corollary~\ref{cor:finiteblocksize}). \item Third, when $\gamma = 1$ and $c = 1$, the mechanism acutally becomes {\it deterministic}, since the number of confirmed bids $\floor{\frac{\gamma k}{c}} = k$. In other words, the top $k$ included bids are surely confirmed. We give a full description of the mechanism for this particularly interesting special case below. On the other hand, if $c > 1$, then the mechanism is randomized even for $\gamma = 1$. This is no co-incidence, since later, we will prove that randomness is actually necessary for $c > 1$ for any ``interesting'' mechanism. \elaine{can we prove that randomness is needed for c = 1 and $\gamma < 1$} \end{enumerate} \begin{mdframed} \begin{center} {\bf The burning second-price auction: special case when $c = 1$, $\gamma = 1$} \end{center} \paragraph{Parameters:} the block size $B$, and $0 < k' \leq k < B$ such that $k + k' = B$, where $k$ denotes the number of confirmed transactions per block, and $k'$ denotes the number of unconfirmed transactions in a block that are used to set the price and miner revenue. \paragraph{Mechanism:} \begin{itemize}[leftmargin=5mm,itemsep=1pt] \item Choose the $B$ highest bids to include in the block. The highest $k$ bids are considered confirmed, and they each pay the $(k+1)$-th price. Unconfirmed transactions, included or not, pay nothing. \item The miner is paid the sum of the $(k+1)$-th to the $B$-th prices (which cannot exceed the total payment by construction). All remaining payment collected from the confirmed transactions is burnt. \item If the block is not fully filled, any remaining empty slot is treated as a bid of $0$. \end{itemize} \end{mdframed} Interestingly, for the special case $\gamma = 1$ and $c = 1$, the mechanism behaves like an ordinary second-price auction from a user's perspective. However, the miner does not collect all payment from the users. Part of the payment is burnt, and the mechanism may employ multiple ``included but unconfirmed'' bids to set the miner's revenue. \ignore{TODO: comment on how to realize on-chain randomness, randomness expensive. write the deterministic special case gamma = 1 and c =1} \begin{theorem}[Burning second-price auction, restatement of Theorem~\ref{thm:intro-upper}] For any $c \geq 1$ and $\gamma \in (0, 1]$, the burning second-price auction satisfies UIC, MIC, and $c$-SCP under $\gamma$-strict utility. \label{thm:burn2ndprice} \end{theorem} The proof of Theorem~\ref{thm:burn2ndprice} is provided in Section~\ref{sec:proof-burn2ndprice}. \section{Conclusion and Open Questions} Mechanism design in decentralized settings (e.g., cryptocurrencies) departs significantly from the classical literature in terms of modeling and assumptions, and thus is relatively little understood. For example, our work shows that even how to formally define incentive compatibility is subtle and requires careful thought. Our work helps to unravel the mathematical structures of incentive compatible TFMs, we hope that our definitional contributions can serve as a basis for future work in this space. Our work also raises more open questions than the ones we can answer. \ignore{ \item Our burning second-price auction is $1$-SCP, but it does not resist collusion between the miner and $2$ users. For exmaple, if the miner colludes with two of the top $k-1$ users and replaces the $k$-th bid with another lower bid, then the coalition's joint utility increases. Does there exist a non-trivial TFM that simultaneously satisfies weak UIC, weak MIC, and $c$-weak-SCP for $c \geq 2$? } For example, are there other reasonable relaxations in the modeling and in incentive compatible notions that allow us to circumvent the impossibility results we showed? Can we formally model and reason about the repeated nature of the TFM, and reason about potential strategic behavior over a longer time scale? Can cryptography help in the design of transaction fee mechanisms? For example, the elegant work of Ferreira and Weinberg~\cite{commit-credible-auction} showed that using cryptographic commitments can help overcome some of the lower bound results shown by Akbarpour and Li~\cite{credibleauction}. However, as mentioned in Section~\ref{sec:related}, the modeling approach there is fundamentally incompatible with the setting for transaction fee mechanisms. Besides these, Roughgarden~\cite{roughgardeneip1559,roughgardeneip1559-ec} also presented a comprehensive list of open questions, most of which remain unanswered. \ignore{ \elaine{TODO: rewrite} Decentralized cryptocurrencies provide a new playground for mechanism design, and at the same time, raise exciting new challenges that require us to depart significantly from traditional modeling techniques and assumptions. \ignore{ For example, we can no longer assume a trusted mediator, and parties can more easily enter binding side contracts through the smart contracts provided by modern cryptocurrencies. Our work is inspired by a recent line of work~\cite{zoharfeemech,yaofeemech,functional-fee-market,eip1559,roughgardeneip1559,dynamicpostedprice} that strived to design the ``ideal'' transaction fee mechanism, and yet failed in different capacities. We prove an impossibility result, showing that it is impossible to satisfy incentive compatibility for the user and the miner, and at the same time resist side contracts between the miner and the user(s). } As such, mechanism design in a decentralized world is relatively little understood. The recent line of work on transaction fee mechanisms~\cite{zoharfeemech,yaofeemech,functional-fee-market,eip1559,roughgardeneip1559,dynamicpostedprice} as well as our work raise several intriguing questions. For example, if we could introduce a burn rule like EIP-1559, can we have a TFM that satisfies UIC, MIC, and side contract resilience simultaneously, both in the congested and uncongested regimes? Can we formally model and reason about the repeated nature of the TFM, and reason about potential strategic behavior over a longer time scale? See also Roughgarden~\cite{roughgardeneip1559,roughgardeneip1559-ec} for a list of open questions. } \section{Definitions}\label{section:definitions} In this section, we define a transaction fee mechanism (TFM) formally, as well as incentive compatibility notions. Our modeling choice can be viewed as a generalization of that of Roughgarden's~\cite{roughgardeneip1559,roughgardeneip1559-ec}. Specifically, Roughgarden's model only cares about which transactions are eventually confirmed, but does not care about which ones are included in the block. By contrast, our modeling explicitly separates the ``inclusion rule'' from the ``confirmation rule''. Both our lower bound and upper bound will demonstrate that explicitly separating the ``inclusion rule'' and the ``confirmation rule'' is important for understanding the feasibilities and infeasibilities of transaction fee mechanism design. See also Remarks~\ref{rmk:defn-tfm} and \ref{rmk:defn-ic} for additional philosophical discussions about the modeling. \subsection{Transaction Fee Mechanism} We consider a single auction instance corresponding to the action of mining the next block. Suppose that there is a mempool containing the list of pending transactions submitted by users. We may assume that each transaction is submitted by a distinct user. We consider a single parameter environment, i.e., each user $i$ has a true value $v_i \in \ensuremath{\mathbb{R}}$ for getting its transaction confirmed in the next block; moreover, its bid contains only a single value $b_i \in \ensuremath{\mathbb{R}}$ as well. Henceforth, we use ${\bf b} := (b_1, b_2, \ldots, b_m)$ to denote the vector of all bids; we also use the same notation ${\bf b}$ to denote the current mempool. For convenience, we often use the terms {\it bid} and {\it transaction} interchangeably, e.g., $b_i$ can be called a bid or a transaction. A Transaction Fee Mechanism (TFM) consists of the following (possibly randomized) algorithms: \begin{itemize}[leftmargin=5mm,itemsep=1pt] \item {\bf Inclusion rule $\ensuremath{{\bf I}}\xspace(\cdot)$}: given a bid vector $\bfb$, $\ensuremath{{\bf I}}\xspace(\bfb)$ outputs a subset of the vector $\bfb$, denoting the bids to be included in the block. \item {\bf Confirmation rule $\ensuremath{{\bf C}}\xspace(\cdot)$}: given a set of bids $\bfb'$ included in the block, the confirmation rule $\ensuremath{{\bf C}}\xspace(\bfb')$ outputs which of these bids are confirmed. \item {\bf Payment rule $\ensuremath{{\bf P}}\xspace(\cdot)$}: given a set of bids $\bfb'$ included in the block, the payment rule $\ensuremath{{\bf P}}\xspace(\bfb')$ outputs how much each confirmed bid pays. We assume that 1) any bid that is not confirmed pays a price of $0$; and 2) each transaction pays at most what it bids. \item {\bf Miner-revenue rule $\ensuremath{{\bf M}\xspace(\cdot)$}: given a set of bids $\bfb'$ included in the block, the miner-revenue rule $\ensuremath{{\bf M}\xspace(\bfb')$ outputs the total payment received by the miner for mining this block. We assume that the miner revenue does not exceed the total payment of all confirmed bids. \end{itemize} \elaine{highlight the defn contribution} The inclusion rule is implemented by the miner, possibly subject to certain validity constraints enforced by the blockchain (e.g., block size limit). The other rules, including confirmation, payment, and miner-revenue rules are enforced by the blockchain itself; and they use only on-chain information. There are a few important things to note about this definition: \begin{enumerate}[leftmargin=5mm,itemsep=1pt] \item {\it Included vs confirmed:} In the most general form, not all transactions included in the block must be confirmed. It could be that some transactions are included in the block to set the price, but they are not considered confirmed. For example, consider a Vickrey auction where the $k$ highest bids are included in the block, among which the $k-1$ highest are considered confirmed, paying the $k$-th price. In this case, the $k$-th transaction is included just to set the price. \item {\it Encoding the burn rule.} Not all the payment from the users will necessarily go to the miner of the block. It was pointed out earlier, e.g., in Ethereum's EIP-1559~\cite{eip1559,roughgardeneip1559,roughgardeneip1559-ec} that in a blockchain, part to all of the payment can be burnt. In our definition, we require that the miner revenue $\ensuremath{{\bf M}\xspace$ be upper bounded by the total payment from all confirmed transactions. In case the miner's revenue is strictly less than the total user payment, the difference is essentially ``burnt''. \end{enumerate} In some cases, the TFM may need to perform tie breaking. For example, if there are more bids bidding the same price than the block can contain, only a subset of them will be included. Our formulation implicitly implies that the TFM is {\it identity agnostic}, i.e., the TFM does not use the bidders' identities for tie-breaking. In other words, if we swap two users' actions, their outcomes would be swapped too. More formally, given a bid vector $\bfb := (b_1, \ldots, b_m)$ and two different users $i$ and $j$, let $x_i, x_j \in \{0, 1\}$ denote whether each user is confirmed, and let $p_i, p_j$ denote their respective payments. Now, imagine that we swap users $i$ and $j$'s roles as follows. We make $i$ bid $b_j$ and make $j$ bid $b_i$ instead, and we swap $i$ and $j$'s positions in the bid vector. In other words, we still have the same bid vector $\bfb$ as before. However, now, the $i$-th coordinate now contains the bid from user $j$ and the $j$-th coordinate now contains the bid from user $i$. In this case, the outcomes for $i$ and $j$ would be swapped too, that is, user $i$'s outcome becomes $x_j, p_j$ and user $j$'s outcome becomes $x_i, p_i$. \elaine{check that this is what we need in all the proofs later for tie-breaking} \ignore{ Throughout the paper, we assume that a TFM treats all users equally in the following sense: let $\bfb$ be an arbitrary bid vector where $b_i$ and $b_j$ correspond to users $i$ and $j$'s bids, respectively. If we now consider the same bid vector $\bfb$ but $b_i$ encodes user $j$'s bid, and $b_j$ encodes user $i$'s bid } \begin{remark}[On separating the inclusion and confirmation rules] In comparison, Roughgarden~\cite{roughgardeneip1559,roughgardeneip1559-ec} adopts a simpler notation that does not explicitly differentiate between the inclusion rule and the confirmation rule. Indeed, parts of our impossibility proofs do not care about this differentiation --- and in these cases, we use a simplified notation that coalesces the inclusion and confirmation rules (see Section~\ref{sec:imp-notation}). However, our results show that it is important to explicitly separate the inclusion rule and the confirmation rule in the modeling, to further our understanding about TFMs. For example, making the inclusion rule explicit is important for proving the impossibility under {\it finite} block size (see Corollary~\ref{cor:finiteblocksize}). Having this distinction is also useful in constructing our upper bounds. \label{rmk:defn-tfm} \end{remark} \subsection{Strategic Behavior and Utility} \paragraph{Strategic player.} We will consider three types of {\it strategic players}, 1) an individual user; 2) the miner of the current block; and 3) the miner colluding with a single user. Henceforth, we will use the term {\it strategic player} to refer to either a user, the miner, or the coalition of a miner and a single user. As mentioned earlier, user-user rendezvous is much more difficult since users are ephemeral, and this is likely why this line of works~\cite{zoharfeemech,functional-fee-market,roughgardeneip1559} focused on miner-user collusion (as opposed to user-user collusion). Moreover, it is easier for the miner to form a side contract with a single user rather than more users. \paragraph{Strategy space.} A strategic player may rely on strategic deviations to improve its utility. We first define the strategy space in the most general form, capturing all possible deviations. Our impossibility proof will rely on a much more restricted strategy space (which makes the impossibility result stronger) --- we will explicitly point out the strategy space needed by our impossibility in Section~\ref{sec:impossible}. On the other hand, our weakly incentive compatible upper bound in Section~\ref{sec:weakic} defends against the broad strategy space defined below. A strategic player can engage in the following types of deviations or a combination thereof: \begin{itemize}[leftmargin=5mm,itemsep=1pt] \item {\it Bidding untruthfully}. A user or a user-miner coalition can bid untruthfully, after examining all other users' bids. \item {\it Injecting fake transactions}. A user, miner, or a user-miner coalition can inject fake transactions, after examining all other users' bids. Fake transactions offer no intrinsic value to anyone, and their true value is $0$. \Hao{Does user injecting transaction mean spliting transaction attack? That is, a user can announce multiple transactions. If so, the current proof of 1-weak-SCP may not include this notion.} \item {\it Strategically choosing which transactions to include in the block.} A strategic miner or a miner-user coalition may not implement the inclusion rule faithfully. It may choose an arbitrary subset of transactions from the mempool to include in the block, as long as it satisfies any block validity rule enforced by the blockchain. \end{itemize} \paragraph{Utility.} The utility of the miner or a miner-user coalition is computed as the following, where $S$ denotes the set of all real and fake transactions submitted by the miner or the miner-user coalition: \[ \text{miner revenue} + \sum_{\forall b \in S \text{\ and $b$ confirmed}} (\text{true value of $b$} - \text{payment of $b$} ) \] The utility of a sole user is computed as as the following, where $S$ denotes the set of all real and fake transactions submitted by the user: \[ \sum_{\forall b\in S \text{\ and $b$ confirmed}} (\text{true value of $b$} - \text{payment of $b$} ) \] \ignore{ \begin{remark} It is also possible for a user to split a transaction that wants to pay $\chi = \chi_1 + \chi_2$ into two transactions each paying $\chi_1$ and $\chi_2$ to the same recipient. \end{remark} } \subsection{Incentive Compatibility} \label{sec:defn-ic} We would like to have mechanisms that incentivize honest behavior, i.e., no deviation of a strategic player can increase its utility. Depending on whether the strategic player is a user, the miner, or the coalition of the miner and a single user, we can define user incentive compatibility, miner incentive compatibility, and side-contract-proofness, respectively. \begin{definition}[User incentive compatibility] A TFM is said to be user incentive compatible (UIC), iff the following holds: assuming that the miner implements the mechanism honestly, an individual user's (expected) utility is always maximized if it bids truthfully, no matter what the other users' bids are. \label{defn:uic} \end{definition} \begin{definition}[Miner incentive compatibility] A TFM is said to be miner incentive compatible (MIC), iff no matter what the users' bids are, the miner's (expected) utility is always maximized if it it creates the block by honestly implementing the inclusion rule. \label{defn:mic} \end{definition} \begin{definition}[$c$-side-contract-proofness] For any $c \in \ensuremath{\mathbb{N}}\xspace$, a TFM is said to be $c$-side-contract-proof ($c$-SCP), iff for any coalition consisting of the miner and at least one and at most $c$ user(s), its (expected) utility is maximized when the colluding users bid truthfully and the miner plays by the book, no matter what the other users' bids are. \label{defn:scp} \end{definition} \begin{remark}[Comparison with Roughgarden's incentive compatibility notions] Our UIC and MIC notions are equivalent to Roughgarden's notions~\cite{roughgardeneip1559,roughgardeneip1559-ec}. For the SCP notion, we modify Roughgarden's offchain-agreement-proofness notion and parametrize it with the coalition size $c$. Note that Roughgarden's notion wants that there is no side contract that strictly benefits {\it every} coalition member in comparison with the honest on-chain strategy --- this is equivalent to saying that the coalition cannot deviate strategically to increase their {\it joint} utility. If they can increase their {\it joint} utility there is always a way to split it off using a binding side contract such that every coalition member strictly benefits. \ignore{ Our UIC and MIC notions are equivalent to Roughgarden's notions~\cite{roughgardeneip1559,roughgardeneip1559-ec} when subject to the same strategy space. While we describe the strategy space in the most general form, Roughgarden omits some possible strategies, e.g., he omits the possibility that a user (as opposed to the miner) may inject a fake transaction, or the possibility that a miner can arbitrarily choose which transactions to include in a block, which implies that the miner can strategically ignore some transactions. It turns out that the specific mechanism Roughgarden studied indeed resists the strategic behaviors he omitted --- but this is not necessarily true for all mechanisms, and there is value in making them explicit in a good definition. \Hao{Maybe add a remark here saying that Aviv Zohar considers user splitting bid attack>} As for the SCP notion, Roughgarden's definitions~\cite{roughgardeneip1559,roughgardeneip1559-ec}, as written, appear somewhat incomplete --- see Appendix~\ref{sec:roughgarden-defn} for details. We therefore fix the SCP definitions, and we believe that our notion is likely what Roughgarden actually meant. \elaine{todo: write this appendix} } \label{rmk:defn-ic} \end{remark} \section{Necessity for Blocks to Contain Unconfirmed Transactions} Observe that in our buring second-price auction, not all transactions in the block are confirmed. In particular, only the top $k$ have a chance of being confirmed, and remaining $B-k$ included bids are not confirmed. Instead, they serve the role of setting the price, i.e., they are used by the blockchain to compute the payment for each confirmed bid and the miner revenue. In the cryptocurrency community, there is an ongoing debate whether including unconfirmed transactions in a block is a good idea. The argument against this approach is that ``real estate'' on the blockchain is a scarce resource, so we ideally do not want to waste space including unconfirmed transactions in the block. We argue that having unconfirmed transactions in the block indeed can lead to more versatile mechanisms. To show this, we argue that if ``included'' must be equal to ``confirmed'', then, even weakly incentive mechanisms are not possible. More specifically, we prove the following corollary: \begin{corollary}[Impossibility for ``included = confirmed''] Assume that all transactions included in the block must be confirmed. Then, no (possibly randomized) TFM $({\bf x}, {\bf p}, \mu)$ with non-trivial miner revenue can satisfy weak UIC, weak MIC, and 1-weak-SCP at the same time --- this impossibility holds no matter whether the block size is finite or infinite. Moreover, if the block size is finite, then the only (possibly randomized) TFM that achieves weak UIC, weak MIC, and 1-weak-SCP is the trivial mechanism that always confirms nothing and pays the miner nothing. \label{cor:includedeqconfirmed} \end{corollary} \paragraph{Myerson's lemma still holds.} To prove this corollary, an important stepping stone is to prove that Myerson's lemma still holds for any weak UIC, weak MIC, and 1-weak-SCP (randomized) mechanism where ``included = confirmed''. It turns out that this is somewhat non-trivial to prove. Recall that in a randomized mechanism, the random coins come from two sources: 1) the miner can flip random coins to decide which transactions to include in the block; 2) once the inclusion choices are made, the blockchain flips random coins to determine which of the included transactions are confirmed, how much each confirmed transaction pays, and how much the miner gets. In other words, the randomness in the inclusion rule is chosen by the miner, whereas the randomness in the confirmation, payment, and miner-revenue rules are chosen by the blockchain. A strategic miner may choose its random coins arbitrarily and not uniformly at random, to increase its expected gain. On the other hand, we assume that the blockchain's randomness is trusted. In other words, we assume that the blockchain can toss fresh random coins that are revealed {\it after} the miner commits to its inclusion decision --- this makes our impossibility result stronger, since if the blockchain's randomness is revealed to the miner earlier, it makes mechanism design even harder. \paragraph{Terminology and notation.} Fix an arbitrary bid vector $\bfb = (b_1, \ldots, b_m)$. Let $S \subseteq \{b_1, \ldots, b_m\}$ denote a subset of these bids to include in the block. We often call $S$ an {\it inclusion outcome}. Note that if ``included = confirmed'', the miner is essentially choosing which transactions are confirmed directly, too. Whenever the miner picks an inclusion outcome $S \subseteq \{b_1, \ldots, b_m\}$, it can calculate its expected utility denoted $\mathbb{E}(\mu | S)$ where the expectation is taken over the choice of the blockchain's random coins. We use the notation $\mathbb{E}(\mu)$ to denote the miner's expected utility under $\bfb$, had it executed the TFM honestly. Fix an arbitrary bid vector $\bfb = (b_1, \ldots, b_m)$. We say that an inclusion outcome $S \subseteq \{b_1, \ldots, b_m\}$ is {\it possible} (w.r.t. $\bfb$), if it is encountered with non-zero probability in an honest execution of the TFM over $\bfb$. \begin{lemma} Suppose that a randomized TFM satisfies weak MIC, and moreover, any transaction included in the blockchain must be confirmed. Fix an arbitrary bid vector $\bfb = (b_1, \ldots, b_m)$. For any possible inclusion outcome $S \subseteq \{b_1, \ldots, b_m\}$ it must be that $\mathbb{E}(\mu | S) = \mathbb{E}(\mu)$. As a direct corollary, for any possible inclusion outcomes $S, S' \subseteq \{b_1, \ldots, b_m\}$ it must be that $\mathbb{E}(\mu | S) = \mathbb{E}(\mu | S')$. \label{lem:minerindiff} \end{lemma} \begin{proof} \elaine{TODO: we need to fix the defns for MIC for randomized case to incorprate ``expected'' utility} Suppose that there is a possible inclusion outcome $S$ where $\mathbb{E}(\mu|S) \neq \mathbb{E}(\mu)$. It must be that there is a possible inclusion outcome $S^*$ where $\mathbb{E}(\mu|S^*) > \mathbb{E}(\mu)$. In this case, instead of choosing the miner coins at random as prescribed by the mechanism, it strictly benefits the miner to choose the specific inclusion outcome $S^*$. This violates weak MIC. \end{proof} \ignore{ \begin{lemma} Suppose that a randomized TFM satisfies 1-weak-SCP, and moreover, any transaction included in the blockchain must be confirmed. Fix an arbitrary bid vector $\bfb = (b_1, \ldots, b_m)$, and consider an arbitrary inclusion outcome $S \subseteq \{b_1, \ldots, b_m\}$ that is possible w.r.t. $\bfb$. It must be that $S$ includes the highest $|S|$ number of bids\footnote{This does not preclude having two possible inclusion outcomes $S$ and $S'$ that include different number of bids.} from the bid vector $\bfb$. \label{lem:inclhighest} \end{lemma} \begin{proof} Suppose there is a possible inclusion outcome $S$ that does not include the highest $|S|$ bids, that is, there is some bid $b_j$ that gets included and thus confirmed, but another bid $b_i > b_j$ is not included. Imagine that the users' true values are reflected by the vector $\bfb$. The miner now colludes with the $i$-th user and the coalition adopts the following strategy. The miner executes the inclusion rule honestly. If the inclusion outcome happens to be $S$, then the miner asks user $i$ to bid $b_j < b_i$ instead of its true value $b_i$. \elaine{TODO: this also needs some clarification in modeling} The miner now includes the set $S$ where the coordinate $b_j$ is replaced with user $i$'s bid (which also equals $b_j$ now). In comparison with truthful bidding and honest execution of the inclusion rule, the coalition's utility increases by $\Pr[S] \cdot (b_i - b_j) > 0$ if it adopts the above strategy. \end{proof} } \begin{lemma} Suppose that a randomized TFM satisfies weak MIC and 1-weak-SCP, and moreover, any transaction included in the blockchain must be confirmed. Suppose that under some bid vector $\bfb = (b_1, \ldots, b_m)$, there is at least one possible inclusion outcome that includes $b_i$, and at least one possible inclusion outcome that does not include $b_i$. Then, consider any possible inclusion outcome $S$ that includes $b_i$, it must be that conditioned on $S$, user $i$ pays its full bid $b_i$ with probability $1$. \label{lem:payfullbid} \end{lemma} \begin{proof} Suppose that the claim does not hold, i.e., there is a possible inclusion outcome that includes $b_i$, but user $i$ pays $p_i < b_i$; and moreover, there is at least one possible inclusion outcome that does not include $b_i$. Let $S^*$ be a possible inclusion outcome that includes $b_i$ that minimizes the payment of user $i$. In this case, the miner can form a coalition with user $i$, and the miner can choose the inclusion outcome $S^*$ with probability $1$. Due to weak MIC and Lemma~\ref{lem:minerindiff}, the miner's utility is still $\mathbb{E}(\mu)$ when it adopts this strategy, i.e., the same as playing honestly. However, user $i$'s utility is positive and is maximized under $S^*$. Furthermore, since there is at least one possible inclusion outcome that does not include $b_i$ where user $i$'s utility is $0$, it must be that user $i$'s expected utility is strictly greater under this strategy than playing honestly. Therefore, the coalition strictly benefits under this strategy, which violates $1$-weak-SCP. \end{proof} \begin{lemma} Suppose that a randomized TFM satisfies weak UIC, weak MIC, and 1-weak-SCP, and moreover, any included transaction must be confirmed. Then, the TFM must satisfy the constraints imposed by the Myerson's Lemma. \label{lem:myerson-incleqconf} \end{lemma} \begin{proof} \elaine{copied from the deterministic version of this proof, repeated text. consider refactoring} Recall that a mechanism disincentivizes an individual user from overbidding or underbidding under the old utility notion, we say that it is user-DSIC (short for dominant- strategy-incentive-compatible). Similarly, if a mechanism disincentivizes an individual user from overbidding or underbidding under the new utility notion, we say that it is weakly user-DSIC. Clearly, UIC implies user-DSIC and weak UIC implies weakly user-DSIC, since in our definitions of (weak) UIC, the user can misbehave in more ways besides over- or under-bidding. Since Myerson's lemma holds for user-DSIC, it suffices to show that any (randomized) TFM where ``included = confirmed'' and satisfying weak user-DSIC, weak MIC, and 1-weak-SCP must also satisfy user-DSIC. Suppose that this is not true, i.e., there is some TFM where ``included = confirmed'' and satisfying weak user-DSIC, weak MIC, and 1-weak-SCP, however, the TFM does not satisfy user-DSIC. Notice that if a user underbids, its utility is the same under the old and new utility notions. Therefore, there must exist a bid vector $\bfb = (b_1, \ldots, b_m)$ some user $j \in [m]$, and a bid $b'_j > b_j$, such that the user $j$ is incentivized to overbid under the old utility notion, but not incentivized to overbid under the new utility notion. There are the following cases, and we rule each one out, which allows us to reach a contradiction. Below we use the terms ``included'' and ``confirmed'' interchangeably, and we define $\bfb' := (\bfb_{-j}, b'_j)$. \begin{itemize}[leftmargin=5mm] \item {\it Case 1: user $j$ is confirmed with probability $1$ under $\bfb'$.} In this case, user $j$'s utility is the same under the old and new utility definitions, and therefore, it is not possible that user $j$ wants to deviate under the old utility but does not want to under the new utility notion. \item {\it Case 2: user $j$ is unconfirmed with probability $1$ under $\bfb'$.} In this case, under the old utility, user $j$'s utility is $0$ even when it bids $b'_j$. Therefore, user $j$ does not want to deviate under the old utility notion which contradicts our assumption. \item {\it Case 3: user $j$ sometimes confirmed and sometimes unconfirmed under $\bfb'$.} Since the TFM is weak MIC and 1-weak-SCP, and satisfies ``included = confirmed'', by Lemma~\ref{lem:payfullbid}, whenever the user $j$ is confirmed, it must pay its full bid. Therefore, under the old utility notion, if user $j$ bids $b'_j$ instead, its utility is always $0$. This means that the user does not want to deviate under the old utility notion, which contradicts our assumption. \end{itemize} \end{proof} \paragraph{Proof of Corollary~\ref{cor:includedeqconfirmed}.} We now continue with the proof of Corollary~\ref{cor:includedeqconfirmed}. The proof of Lemma~\ref{lemma:randomInequality} also makes use of the strategic deviation where a user colluding with the miner overbids relative to its true value. Specifically, the proof of Lemma~\ref{lemma:randomInequality} relies on the fact that such overbidding comes for free if the offending transaction is not confirmed. In general, this is not true under the new utility function associated with weak incentive compatibility. However, we now argue that if ``included'' must be equal to ``confirmed'', then, the effect of this deviation (where the overbid transaction is not confirmed) can alternatively be realized in a way that is free of charge. More concretely, instead of having the colluding user actually carry out the overbidding, we instead exploit the miner's ability to include an arbitrary subset of the mempool in the block. Let ${\bf b}$ be the current mempool, which includes the colluding user's bid $b$. If in the proof of Lemma~\ref{lemma:randomInequality}, the miner wants the user to overbid $b' > b$ instead, it can simply pretend that the colluding user's bid is $b'$. In other words, the miner can simulate running the mechanism on ${\bf b} \backslash \{b\} \cup \{b'\}$. As a result, the transaction $b'$ would not be confirmed, and thus $b'$ would not be included in the block, either. Therefore, the fact that the colluding user has not authorized/signed the transaction $b'$ does not matter in carrying out this deviation\footnote{In other words, $b'$ exists only in the simulation in the miner's head, but is not released to the public network.}. It is easy to see that as long as Myerson's Lemma holds and any overbid transaction that is not confirmed in the present block comes for free, Lemma~\ref{lemma:randomInequality} still holds. Therefore, we conclude that Lemma~\ref{lemma:randomInequality} still holds even under weak UIC and 1-weak-SCP, if we insist that ``included'' be equal to ``confirmed''. Now, as long as Lemma~\ref{lemma:randomInequality} and Myerson's Lemma still hold, the proof of Theorem~\ref{theorem:randomized} follows in the same way as before, and so does the proof of Corollary~\ref{cor:finiteblocksize}. \elaine{double check that the corollary holds after it's fixed} \Hao{If the mechanism is deterministic, then I think Corollary~\ref{cor:finiteblocksize} still holds, because the attack in the proofx is actually asking the user to ``underbid.'' However, if the mechanism is randomized, that means whether a bid is confirmed is probabilistic. Then, it is not clear what's inclusion = confirmation. I think ``inclusion = confirmation'' only makes sense if the mechanism is deterministic.} If we restrict ourselves to {\it deterministic} mechanisms, we can actually prove a counterpart of Corollary~\ref{cor:includedeqconfirmed} without having to even rely on weak MIC. This is formally stated in the following corollary: \begin{corollary} Assume that all transactions included in the block must be confirmed. Then, no deterministic TFM $({\bf x}, {\bf p}, \mu)$ with non-trivial miner revenue can satisfy weak UIC and 1-weak-SCP at the same time --- this impossibility holds no matter whether the block size is finite or infinite. Moreover, if the block size is finite, then the only deterministic TFM that achieves weak UIC and 1-weak-SCP is the trivial mechanism that always confirms nothing and pays the miner nothing. \end{corollary} \begin{proof} Almost the same as the proof of Corollary~\ref{cor:includedeqconfirmed}, except that now, since the TFM is promised to be deterministic, we can use Fact~\ref{fct:myerson-weakuic} instead of Lemma~\ref{lem:myerson-incleqconf} to establish the fact that Myerson's lemma still holds. \end{proof} \section{Introduction} \label{sec:intro} In decentralized blockchains such as Bitcoin and Ethereum, miners are incentivized to participate in and collectively maintain the public ledger, since they can collect block rewards and transaction fees. Today, a simple ``pay your bid'' auction is implemented by major blockchains. In a ``pay your bid'' auction, the miners' dominant strategy is to take the highest bids. However, users may be incentivized to bid strategically, e.g., bid close to $0$ when there is no congestion, or bid the minimum possible to get selected when there is congestion. Earlier works~\cite{zoharfeemech,yaofeemech,functional-fee-market} pointed out such strategic bidding is indeed happening in real life, and is generally considered undesirable. Consequently, several works~\cite{zoharfeemech,yaofeemech,functional-fee-market,eip1559,roughgardeneip1559,roughgardeneip1559-ec,dynamicpostedprice} call out to the community to rethink the design of transaction fee mechanisms (TFMs). These works raise the following important question: {\it what is the ideal transaction fee mechanism}? \paragraph{Desiderata of a dream TFM.} Partly due to its decentralized nature, transaction fee mechanism (TFM) design departs from classical mechanism design~\cite{myerson,agt} in modeling and assumptions. First, we are confronted with several new challenges that arise from the strategic behavior of the miner and of miner-user coalitions: \begin{itemize}[leftmargin=5mm] \item {\it Challenge 1: strategic behavior of the miner.} In the classical setting, we typically assume that the auctioneer is trusted and implements the prescribed mechanism honestly --- therefore, we mainly care about how to design mechanisms such that the users are incentivized to bid truthfully. In a decentralized environment, the auctioneer is no longer fully trusted. In a blockchain transaction fee mechanism, the miners and the logic of the blockchain jointly serve as the ``auctioneer''. Although the logic of the blockchain is hard-coded and unalterable, miners can deviate from the prescribed mechanism, and behave strategically to increase its financial gains. As a simple example, consider a classical Vickrey auction~\cite{vickrey}. Suppose that each block has size $B$. We can then include the top $B$ bids into the block, among which the first $B-1$ are considered {\it confirmed} and they pay the $B$-th price. If there are strictly fewer than $B$ bids, everyone gets confirmed and they all pay a price of $0$. All users' payment goes to the miner that mines the block. Classical algorithmic game theory~\cite{vickrey,agt} tells us that such a Vickrey auction is dominant strategy incentive compatible (DSIC) for the users, assuming that the miner indeed behaves honestly. Unfortunately, several prior works~\cite{functional-fee-market,roughgardeneip1559} pointed out that the Vickrey auction is not incentive compatible for the miner, since the miner may want to inject a fake transaction whose price is between the $(B-1)$-th and $B$-th price to increase its revenue. \item {\it Challenge 2: miner-user collusion.} In a decentralized blockchain, it is easy for two or more parties to form binding side contracts through smart contracts. A miner could collude with a user to increase the joint utility of the coalition, and the two can then split the gains with a binding side contract. In the aforementioned Vickrey auction example, the miner could alternatively ask the $B$-th bidder to raise its bid to be infinitesimally smaller than the $(B-1)$-th bid, and then split its gains with the $B$-th bidder in a side contract. Most prior works~\cite{zoharfeemech,functional-fee-market,roughgardeneip1559,roughgardeneip1559-ec} focused on miner-user collusion rather than user-user collusion, likely for the following reason: it is much easier to facilitate miner-user rendezvous since the big miners are well-known. In comparison, users are ephemeral and thus user-user rendezvous is much more costly to facilitate. \end{itemize} With these challenges in mind, prior works~\cite{zoharfeemech,roughgardeneip1559} have suggested the following desiderata for a ``dream'' transaction fee mechanism: \begin{enumerate}[leftmargin=6mm] \item {\it User incentive compatibility (UIC).} Assuming that the miner implements the mechanism honestly, then following the honest bidding strategy or truthful bidding should be a dominant strategy for the users. \item {\it Miner incentive compatibility (MIC).} Assuming that users follow the honest bidding strategy or bid truthfully, a miner's dominant strategy should be to implement the prescribed mechanism faithfully. \item {\it Miner-user side contract proofness ($c$-SCP).} No coalition of the miner and up to $c$ users can increase their joint utility through any deviation. In the above, $c$ is a parameter that specifies an upper bound on the coalition's size. The larger the $c$, the more side contract resilient. Note that it is generally harder for a miner and a large number of users to engage in a side contract, than, say, a miner and a single user. \end{enumerate} To the best of our knowledge, all prior works~\cite{zoharfeemech,yaofeemech,functional-fee-market,roughgardeneip1559} fall short of achieving all three properties at the same time --- see Section~\ref{sec:related} for more detailed discussions on these prior works. The closest we have come to achieving all three properties is Ethereum's recent EIP-1559~\cite{eip1559} proposal. The very recent work of Roughgarden~\cite{roughgardeneip1559} showed that (a close variant of) EIP-1559 can achieve all three properties {\it assuming that the block size is infinite} (or more precisely, assuming that the base fee is set high enough such that the number of transactions willing to pay the base fee is upper bounded by the block size). However, when there is congestion, EIP-1559 acts like a first-price auction and therefore fails to satisfy UIC, i.e., strategic bidding could improve an individual user's utility. \paragraph{\underline{Open question 1:}} With all these failed attempts, it is natural to ask: {\it is it actually feasible to have a ``dream'' transaction fee mechanism that satisfies all three properties simultaneously?} Is the community's lack of success so far due to a more fundamental mathematical impossibility? Roughgarden also raised this as a major open question in his recent work~\cite{roughgardeneip1559,roughgardeneip1559-ec}. \paragraph{\underline{Open question 2:}} If there is indeed a mathematical impossibility, then the natural next question to ask is: are the current incentive compatibility notions overly stringent? If so, can we relax the incentive compatibility notion to circumvent the impossibilities? \paragraph{TFM design space enriched by new elements.} In comparison with classical mechanism design, transaction fee mechanisms may employ a couple novel features that are idiosyncratic to blockchains. For example, Ethereum's EIP-1559~\cite{eip1559,roughgardeneip1559} suggested the novel usage of a {\it burn rule}, where part to all of the fees collected from the confirmed transactions may be ``burnt'' rather than paid to the miner. Another design consideration that is being debated in the community is whether we should allow blocks to contain unconfirmed transactions that are just there to ``set the price''. Although this approach has been employed by some suggested mechanisms~\cite{zoharfeemech,yaofeemech}, an argument against it is that real estate on a blockchain is scarce --- therefore, we ideally do not waste space including unconfirmed transactions~\cite{Roughgarden-priv}. An intriguing question is the following: \paragraph{\underline{Open question 3:}} Do these novel elements actually make a difference in the design of transaction fee mechanisms? Can they help achieve incentive compatible mechanism designs that would otherwise be impossible? \ignore{ \subsubsection{to move} Of course, for the decentralized parties to form side contracts would require a rendezvous process. The rendezvous process is easy to implement for miner-user coalitions since the big miners are well-known in major blockchains today. In comparison, users are ephemeral, and thus user-user rendezvous is much more costly to implement. Perhaps for this reason, prior works on transaction fee mechanisms~\cite{zoharfeemech,roughgardeneip1559,roughgardeneip1559-ec} focused mostly on resilience to miner-user collusion (as opposed to user-user collusion). } \subsection{Our Results and Contributions} \subsubsection{Impossibility of a Having a ``Dream'' Transaction Fee Mechanism} We prove an impossibility result (Theorem~\ref{thm:intromain}) showing that assuming finite block size, there is no non-trivial transaction fee mechanism (TFM) that satisfies UIC and 1-SCP, where 1-SCP means resilience against side contracts between the miner and {\it a single} user. Consequently, there is also no non-trivial TFM that satisfies all three desired properties. \begin{theorem}[Impossibility of a ``dream'' transaction fee mechanism (informal)] Suppose that the block size is finite. There does not exist a non-trivial, single-parameter transaction fee mechanism (TFM) that simultaneously satisfies UIC and 1-SCP. Moreover, this impossibility holds for both deterministic and randomized mechanisms. \label{thm:intromain} \end{theorem} Another way to understand Theorem~\ref{thm:intromain} is the following: the only TFM that satisfies UIC and 1-SCP simultaneously is the trivial mechanism that always confirms nothing and pays the miner nothing. \subsubsection{Definitional Contribution: Incentive Compatibility under $\gamma$-Strict Utility} \label{sec:introweakic} While our aforementioned impossibility result paints a pessimistic outlook, we observe that the previously formulated incentive compatibility notions appear too draconian and somewhat flawed. So far, almost all prior works~\cite{zoharfeemech,yaofeemech,functional-fee-market,roughgardeneip1559,roughgardeneip1559-ec} model the TFM in a standalone setting, where the players are myopic and care only about their gain or loss in the current auction instance. In this setting, if a strategic player (which is either a user, a miner, or a miner-user coalition) injects a fake transaction whose true value is $0$, or if it overbids (i.e., bids more than the transaction's true value), we assume that the offending transaction is free of charge as long as it is not confirmed in the present block --- since an unconfirmed transaction need not pay any fees. In practice, however, the TFM is executed in a repeated setting as blocks get confirmed. Any transaction that has been posted to the network cannot be retracted even if it is not confirmed in the present block. In particular, a fake or overbid transaction could be confirmed in a future block, and thus the strategic player would end up paying fees to the future block, potentially mined by a different miner. For example, consider the Vickrey auction example again, where we include the $B$ highest bids in the block, among which the top $B-1$ are confirmed and pay the $B$-th price. Suppose that all payment goes to the miner. In this case, the miner may want to inject a fake transaction whose bid is in between the $(B-1)$-th and the $B$-th price, to increase its revenue. In prior works as well as our aforementioned impossibility result, we assume that injecting this fake transaction is free because it is unconfirmed. However, in practice, the injected transaction may be confirmed and paying fees in a future block. A natural question is whether we can capture this cost of cheating in our model, and thus circumvent the aforementioned impossibility. In our new approach, we still model the TFM as a single-shot auction, but we want to more accurately charge the cost of cheating in the utility model. Unfortunately, we are faced with a notable challenge: accurately predicting the cost of cheating is difficult, since what the offending transaction actually pays in the future depends on the environment, e.g., what other users are bidding, as well as the mechanism itself. \paragraph{Defining $\gamma$-strict utility.} To make progress, we take the following approach. We first ask what is the worst-case cost of cheating. This is when the overbidding or fake transaction that is unconfirmed in the present ends up paying its full bid in the future, thus incurring a cost as high as the difference between the bid and the true value of the transaction. This is the worst case for the cheater and thus the best case for the mechanism designer. Asking whether there is a mechanism that satisfies incentive compatibility under the most strict cost model is equivalent to asking: can we at least design mechanisms that defend against {\it paranoid} strategic players who only want to deviate if there is a sure chance of gain and no chance of losing. Understanding the feasibility of mechanism design under the worst-case cost can provide shed light on whether this is a worthwhile direction. Further, it is also useful to adopt the worst-case cost model in proving lower bounds, since that makes the lower bounds stronger. Next, we generalize the cost model and imagine that in reality, the offender only needs to pay $\gamma$ fraction of the worst-case cost, where $\gamma \in [0, 1]$ is also called the {\it discount} factor. This generalization is useful because in practice, we can often estimate the cost of cheating from past data. A mechanism that satisfies UIC (or MIC, $c$-SCP, resp.) under this cost model is also said to satisfy UIC (or MIC, $c$-SCP, resp.) under {\it $\gamma$-strict utility}. Specifically, when $\gamma = 0$, there is no cost of cheating --- in this case, our new incentive compatibility notions would then degenerate to the previous notions. When $\gamma =1$, this is when we are charging the worst-case cost for cheating. Since we are often particularly interested in the case of $\gamma = 1$ (e.g., when proving lower bounds), for convenience, a mechanism that satisfies UIC (or MIC, $c$-SCP, resp.) under $1$-strict utility is also said to satisfy {\it weak UIC (or weak MIC, $c$-weak-SCP, resp.)}. We present our new incentive compatibility notions more formally in Section~\ref{sec:weakic}. \ignore{ \paragraph{Definitional contribution: weak incentive compatibility.} As a result, a strategic player who is paranoid and risk-averse may be deterred from strategic overbidding or injection of fake transactions for fear or losing fees to a future block. We therefore suggest a relaxed notion called weak incentive compatibility, which captures the potential cost of an overbid/fake and unconfirmed transaction. Specifically, if an overbid/fake transaction is unconfirmed in the present, the strategic player will assume the worst case, i.e., it will cost fees as high as the bid in a future block. Based on this, we redefine the utility function of the strategic player (see Section~\ref{sec:weakic} for more details). We then define {\it weak UIC}, {\it weak MIC}, and {\it 1-weak-SCP} in the same way as before, except that we now adopt the new utility function. } \subsubsection{The Mathematical Structure of Incentive Compatibility under $\gamma$-Strict Utility} \paragraph{The burning second-price auction.} Using our new $\gamma$-strict utility notion, we can circumvent the aforementioned impossibility (Theorem~\ref{thm:intromain}). Specifically, we describe a new mechanism called the burning second-price auction (see Section~\ref{sec:burn2ndprice}) that achieves UIC, MIC, and $c$-SCP under $\gamma$-strict utility for any $\gamma \in (0, 1]$, and any choice of coalition resilience parameter $c \geq 1$. The mechanism is randomized, and one can view the parameters $c$ and $\gamma$ that allow us to tradeoff the degree of incentive compatibility and the efficiency of the mechanisms (in terms the expected number of bids confirmed). \ignore{ \begin{mdframed} \begin{center} {\bf The burning second-price auction} \end{center} \paragraph{Parameters:} the block size $B$, and $0 < k' \leq k < B$ such that $k + k' = B$, where $k$ denotes the number of confirmed transactions per block, and $k'$ denotes the number of unconfirmed transactions in a block that are used to set the price and miner revenue. \paragraph{Mechanism:} \begin{itemize}[leftmargin=5mm,itemsep=1pt] \item Choose the $B$ highest bids to include in the block. The highest $k$ bids are considered confirmed, and they each pay the $(k+1)$-th price. \item The miner is paid the sum of the $(k+1)$-th to the $B$-th prices. All remaining payment collected from the confirmed transactions is burnt. \item If the block is not fully filled, any remaining empty slot is treated as a bid of $0$. \end{itemize} \end{mdframed} In Section~\ref{sec:weakic}, we shall prove that the burning second-price auction indeed satisfies weak UIC, weak MIC, and 1-weak-SCP, as stated in the following theorem: } Formally, we prove the following theorem: \begin{theorem}[Burning second price auction] For any $\gamma \in (0, 1]$ and any $c \geq 1$, there exists a TFM that satisfies UIC, MIC, and $c$-SCP under $\gamma$-strict utility. Further, the TFM can support any finite block size, and except for the case when $c = 1$ and $\gamma = 1$, the TFM is randomized. \label{thm:intro-upper} \end{theorem} \ignore{ One way to view this positive result is that {\it the repeated nature of the TFM can help us in mechanism design} --- even though our modeling approach is still single-shot even for weak incentive compatibility, here, we do charge costs potentially lost in future auction instances due to strategic deviation in the present. \elaine{move this text} For our impossibility results, we model the TFM as a single-shot auction --- this is also the modeling approach adopted in prior works\cite{zoharfeemech,yaofeemech,functional-fee-market,eip1559,roughgardeneip1559,dynamicpostedprice}. In other words, we assume that the players are {\it myopic} and care only about their utility in the current auction instance. For our new, weak incentive compatibility notion, we still model the TFM as a single-shot auction. However, in this case, we assume that the strategic player is no longer completely myopic --- in particular, it will be aware of potential losses in the future that stem from strategic deviations, and these costs are accounted for in the utility function. } \ignore{ \elaine{move elsewhere: In general, miners and users can also adopt strategic behaviors over a longer time-scale~\cite{roughgardeneip1559,roughgardeneip1559-ec}. However, since transaction fee mechanism in a decentralized environment remains poorly understood, in this paper, we shall focus on {\it myopic} players who care about only their utility in the next auction instance, associated with the mining of a single block. The same approach was also taken by most prior works in this space~\cite{zoharfeemech,yaofeemech,functional-fee-market,eip1559,roughgardeneip1559,dynamicpostedprice}. \elaine{modify the text: we have weak ic} } } \paragraph{Necessity of randomness.} As mentioned in Theorem~\ref{thm:intro-upper}, except for the special case $c = 1$ and $\gamma = 1$, our burning second-price auction is randomized. In particular, the mechanism employs trusted on-chain to pick a random subset of eligible, included transactions to confirm. Although unbiased and unpredictable on-chain randomness can be generated using standard cryptographic techniques~\cite{Cachin00randomoracles,randpiper,spurt}, such coin toss protocols introduce some extra overhead, and ideally we would like to avoid them. Unfortunately, we prove a lower bound that for $c \geq 2$, randomness is necessary to achieve UIC and $c$-SCP for any $\gamma \in [0, 1]$, as long as the mechanism is ``useful'' in the sense that it sometimes confirms at least $2$ bids. \begin{theorem}[Necessity of randomness for weak incentive compatibility] Consider an arbitrary deterministic TFM and assume finite block size. Suppose that there exists a bid vector such that the TFM confirms at least two bids. Then, the TFM cannot satisfy both weak UIC and $2$-weak-SCP simultaneously. \label{thm:intro-lb-weak} \end{theorem} In the above lower bound, the restriction that the mechanism must sometimes confirm $2$ bids is necessary. Specifically, we construct a deterministic mechanism called the solitary mechanism (Appendix~\ref{section:solitary}) that always confirms a single bid, and achieves weak UIC, weak MIC, and $c$-weak-SCP for any $c \geq 1$. \subsubsection{Understanding New Design Elements for TFM} Finally, as mentioned, unlike classical auctions, TFMs can employ a couple new design elements. First, the mechanism can employ a ``burn rule'', which allows part to all of the users' payment to be ``burnt'' on the blockchain, and not paid to the miner of the present block. For example, Ethereum's EIP-1559 makes critical use of such a burn rule~\cite{eip1559,roughgardeneip1559,roughgardeneip1559-ec}. Second, some prior works~\cite{zoharfeemech,yaofeemech} have suggested including transactions in a block that are not confirmed eventually, but serve the role of setting the price for others. For example, even though we know that the Vickrey auction is not an awesome auction in a decentralized environment, hypothetically, imagine we want to implement the Vickrey auction on a blockchain. This would require that the block to include $B$ bids, among which only the top $B-1$ are eventually confirmed, whereas the $B$-th bid is included only to set the price. Moreover, our own burning second-price auction (Theorem~\ref{thm:intro-upper}) also include some transactions in the block that have no chance of being confirmed, but are just there to set the price. Do these new design elements make a difference in TFM design, and can they help us achieve incentive compatibility designs that would otherwise be impossible? We give a nuanced answer to this question. First, we point our that our earlier impossibility results (Theorems~\ref{thm:intromain} and \ref{thm:intro-lb-weak}) hold even when the TFM is allowed to employ both of these design elements. \ignore{ As mentioned, the decentralized nature raises new challenges for the design of transaction fee mechanisms. On the other hand, there are also features of the blockchain that can potentially help us in designing TFM. } \ignore{ Our results reveal a nuanced answer to this question. On one hand, we show that assuming finite block size, the impossibility stated in Theorem~\ref{thm:intromain} still holds even for (possibly randomized) TFMs with a burn rule: } On the other hand, we also show scenarios in which these new design elements do make a difference. Specifically, we prove the following results. \paragraph{The burn rule is critical to Ethereum's EIP-1559.} \ignore{ On the other hand, we show having a burn rule does make a difference assuming infinite block size. In particular, this implies that {\it the burn rule indeed makes a fundamental difference in a mechanism like EIP-1559}. } Recall that Roughgarden~\cite{roughgardeneip1559,roughgardeneip1559-ec} argued that {\it assuming infinite block size}, Ethereum's EIP-1559 approximates a simple ``posted price, burn all'' auction: there is an a-priori fixed price tag $r$, and anyone who bids at least $r$ would get their transaction confirmed, paying only $r$. All users' payment is burnt, and the miner gets nothing. Roughgarden~\cite{roughgardeneip1559,roughgardeneip1559-ec} also proved that this simple ``posted price, burn all'' auction would indeed satisfy UIC, MIC, and $c$-SCP for any $c \geq 1$, assuming infinite block size. \ignore{ \begin{corollary}[Impossibility for TFMs with burn (informal)] Suppose that the block size is finite. The impossibility result stated in Theorem~\ref{thm:intromain} holds even for (possibly randomized) TFMs with a burn rule. \label{cor:intromain} \end{corollary} } We show that without the burn rule, even under infinite block size, the only way for a TFM to satisfy both UIC and $1$-SCP is for users to always pay nothing. More generally, we prove that even when assuming infinite block size and whether we allow a burn rule or not, any (randomized) TFM that satisfies both UIC and 1-SCP must always pay the miner nothing: \begin{theorem}[The burn rule makes a difference assuming infinite block size] Any (randomized) TFM that satisfies both UIC and 1-SCP must always pay the miner nothing. This impossibility holds regardless of whether the block size is infinite or finite, and regardless of whether the TFM has a burn rule or not\footnote{In fact, in our actual proof, we prove Theorem~\ref{thm:introburn} first, which is then used as a stepping stone towards proving Theorem~\ref{thm:intromain}.}. \label{thm:introburn} \end{theorem} \ignore{ Based on Theorem~\ref{thm:intromain}, for TFMs {\it without} a burn rule, to satisfy both UIC and 1-SCP, it is necessary that users always pay nothing. In other words, } As a direct implication, if we want a mechanism like EIP-1559 that has non-trivial user payment and satisfies all three properties in the infinite block size regime, a burn rule is necessary. Therefore, Theorem~\ref{thm:introburn} and Roughgarden's result~\cite{roughgardeneip1559,roughgardeneip1559-ec} together show that having a burn rule does make a difference assuming infinite block size. \paragraph{Necessity for blocks to contain unconfirmed transactions.} \ignore{ Observe that in the burning second price auction, not all transactions included in the block are confirmed. Specifically, the $k$-th bid is included in the block but left unconfirmed. In some sense, it is included just to set the price. } In the cryptocurrency community, there is an ongoing debate whether it is a waste of space for blocks to contain unconfirmed transactions. We argue that the ability for a block to contain unconfirmed transactions could indeed make a difference for the mechanism designer. Specifically, we prove a corollary showing that if one insist on confirming all transactions included in a block, then even with the weak incentive compatibility notion, it is still impossible to construct any non-trivial (possibly randomized) TFM that satisfies weak UIC and 1-weak-SCP. \begin{corollary}[Allowing unconfirmed transactions in a block can make a difference] Suppose that all transactions in a block must be confirmed. Then, there is no non-trivial (possibly randomized) TFM that satisfies weak UIC and 1-weak-SCP simultaneously. \label{cor:intro-incleqconf} \end{corollary} \paragraph{Additional results.} In the appendices, we additionally show a variant of Theorem~\ref{thm:intro-lb-weak} that says if the TFM is not allowed to have a burning rule, then Theorem~\ref{thm:intro-lb-weak} holds even when the block size is allowed to be infinite. \ignore{ Moreover, our modeling of TFM is general and captures mechanisms that adopt a burn rule like in Ethereum's EIP-1559~\cite{eip1559,roughgardeneip1559}. Specifically, a burn rule allows part to all of the users' payment to be ``burnt'' on the blockchain, and not paid to the miner of the present block. } \ignore{ \subsection{Old Text: Our Results and Contributions} \paragraph{Main impossibility result.} In this paper, we prove an impossibility result (Theorem~\ref{thm:intromain}) showing that unfortunately, there is no non-trivial transaction fee mechanism (TFM) that satisfies all three properties at the same time. Here, non-trivial means that users do not always pay $0$. The impossibility results holds for the following natural family of TFMs: 1) we consider the standard single parameter environment~\cite{myerson,agt}, i.e., each user has a single parameter that characterizes its true value of getting the transaction confirmed, and moreover, each user's bid is also captured by a single parameter; and 2) we assume that a user's payment goes to the miner of the block that confirmed its transaction. \begin{theorem}[Main impossibility result] Consider a single parameter environment and a family of transaction fee mechanisms (TFMs) where all users' payment goes to the miner of the block. There does not exist a non-trivial transaction fee mechanism (TFM) that simultaneously satisfies user incentive compatibility (UIC), miner incentive compatibility (MIC), and resilience to the collusion of the miner and a single user. \end{theorem} Moreover, the impossibility holds in a strong sense: \begin{enumerate}[leftmargin=8mm,itemsep=1pt] \item even when the miner is restricted to colluding with only a single user, asking it to change its bid; \item even if the only possible unilateral miner deviation is injecting a single fake transaction; and \item no matter whether the block size is bounded or infinite. \end{enumerate} Our impossibility result also sheds important new light regarding an open question raised by Roughgarden~\cite{roughgardeneip1559-ec}, that is, can we characterize the mechanisms that satisfy UIC, MIC, and side contract resilience? \paragraph{Implications for EIP-1559: is the burn rule necessary?} \ignore{ EIP-1559 works as follows: a user's payment is computed from the following: \begin{enumerate}[leftmargin=5mm,itemsep=1pt] \item a fixed {\it base fee} $r$ that is determined by the history of the blockchain and not by the miners; importantly, the base fee is {\it burnt} (i.e., paid to no one), rather than paid to the miner; \item a {\it tip} $t$ proposed by the user and paid directly to the miner; and \item a user may specify a fee cap $c \geq r$ such that if the $r + t > c$, the user would actually pay a tip of $c - r$. \end{enumerate} } Ethereum's EIP-1559~\cite{eip1559} is designed to gracefully switch between a first-price auction and a posted-price auction, depending on the congestion level. When there is congestion, the mechanism approximates a first-price auction and thus is not UIC. On the other hand, assuming that the block size is infinite (i.e., plentiful), the mechanism approximates a single-parameter, posted-price auction with a novel {\it burn rule} which we shall explain below. In the infinite block regime, Roughgarden~\cite{roughgardeneip1559} showed that indeed, (a slight variant of) EIP-1559 satisfies all three properties. \ignore{ achieves all three properties in the infinite block size regime but fails to satisfy UIC when there is congestion~\cite{roughgardeneip1559}. Henceforth, let us focus on the infinite block size regime where EIP-1559 behaves nicely. Although it may seem like the EIP-1559 requires multiple parameters to specify a bid,} Concretely, EIP-1559 approximates the following {\it single-parameter}, {\it posted-price} auction in the infinite block size regime: \begin{mdframed} {\bf A single-parameter, posted-price auction that EIP-1559 approximates in the infinite block size regime} \begin{enumerate}[leftmargin=5mm,itemsep=1pt] \item Users bid their true value; \item There is an a-priori fixed reserve price $r$ (i.e., the base fee). If a user's bid is at least the reserve price $r$, then its transaction gets confirmed and it pays a price of $r$; \item The entirety of $r$ is burnt and not paid to the miner\footnote{Note that in reality, to give the miner some small incentive to include the transaction in the block, we can burn almost the entirety of the total payment $r$ but pay $1$ gwei to the miner where we assume that a gwei is the smallest currency unit in Ethereum. }. \end{enumerate} \end{mdframed} Showing that this posted-price mechanism satisfies UIC, MIC, and side contract resilience in the infinite block size regime is fairly straightforward~\cite{roughgardeneip1559}. Intriguingly, the above mechanism employs a novel ingredient that is idiosyncratic to blockchains, that is, a {\it burn rule}\footnote{Throughout this paper, we use the term ``burn rule'' in a broad sense --- as long as the ``burnt'' amount is not paid to the current miner, we do not care whether it removed from circulation or not. Roughgarden~\cite{roughgardeneip1559} discussed some other possibilities besides just removing it from circulation.}. Roughgarden~\cite{roughgardeneip1559} argued that the burn rule is essential to achieving side-contract resilience {\it as far this particular mechanism is concerned}. Had we removed the burn rule and instead paid all proceeds to the miner, the above posted-price auction would still satisfy UIC and MIC, but would not be side contract resilient. In particular, suppose a user's true value is $r - \epsilon$ for some very small positive $\epsilon$, the miner can ask the user to raise its bid to $r$. In this way, the coalition's joint utility would increase by $r - \epsilon$ which can be redistributed through a binding side contract. Recall that our impossibility holds regardless of whether block size is infinite or bounded; however, the impossibility holds assuming that all proceeds are paid to the miner. Therefore, an important implication of our main theorem is that {\it any} non-trivial, single-parameter mechanism that achieves all three properties, even if only for the infinite block size regime, {\it would have to rely on a burn rule}. In other words, not only is the burn rule important to EIP-1559, it is essential to {\it any} non-trivial, single-parameter mechanism that matches EIP-1559's properties in the infinite block size regime. \ignore{ \paragraph{All three properties are needed for the impossibility.} \elaine{NOT TRUE} Observe that by our definition, a TFM that is fails to satisfy either UIC or MIC cannot be resilient to the coalition of the miner and a single user either: if an individual user or the miner alone can increase its utility, so can a miner-user coalition. We also know that the Vickrey auction and the first-price auction would satisfy UIC and MIC alone, respectively. So, does there exist a non-trivial mechanism that is MIC and UIC but is not side contract resilient? The answer is yes. Consider the following simple posted-price auction. There is a reserve price $r$, and let $k$ be the block size. Among all bids that are at least $r$, select $k$ of them to include in the block and confirm, and all of them pay the posted price $r$. It is important that if there are more than $k$ bids, we {\it select a subset in a way that is independent of the actual bids}, e.g., we can select by the bidders' identities. } \elaine{uic and mic: posted price} } \section{Weak Incentive Compatibility with Larger Coalitions} \section{Additional Results for Weak Incentive Compatibility} In this section, we present some additional results that further unfold the mathematical landscape of weakly incentive compatible mechanisms. \subsection{The Solitary Mechanism} \label{section:solitary} Earlier in Section~\ref{sec:lb-rand-weak}, we ruled out the existence of a deterministic, 2-user-friendly mechanism that satisfies weak UIC and 2-weak-SCP simultaneously, assuming finite block size. In this section, we show that the 2-user-friendly restriction is necessary for this theorem to hold. In particular, we describe a mechanism called the solitary mechanism, which always confirms a single transaction, and satisfies weak UIC, weak MIC, and $c$-weak-SCP for all $c \in \ensuremath{\mathbb{N}}\xspace$. \Hao{I changed it to c-SCP.} \begin{mdframed} \begin{center} {\bf The solitary mechanism} \end{center} \begin{itemize}[leftmargin=5mm,itemsep=1pt] \item Choose the highest two bids to include in the block. \item Only the highest bid is confirmed. Other bids are all unconfirmed. The highest bid pays the second highest bid, and the miner is paid the second highest bid. \end{itemize} \end{mdframed} \begin{theorem}[The solitary mechanism]\label{theorem:solitary} The solitary mechanism satisfies weak UIC, weak MIC, and $c$-weak-SCP for all $c > 0$. The theorem holds no matter the block size is infinite or finite. \end{theorem} \begin{proof} We prove the three properties one by one. \paragraph{Weak UIC.} A user has two kinds of strategies to deviate from the honest behavior: to bid strategically or to inject fake transactions. Since the payment is decided by the second highest bid, injecting fake transactions can only increase the payment, no matter whether the user is bidding truthfully or not. Moreover, since this is exactly a classical second-price auction, bidding truthfully is known to be DSIC for an individual user, even under the old utility notion where overbidding is never penalized. Therefore, bidding untruthfully is not incentive compatible under the new utility notion as well. \paragraph{Weak MIC.} The miner has two kinds of strategies to deviate from honest behavior: not to choose the highest two bids and to inject fake bids. \elaine{may need to add to defn: reordering bids.} Without loss of generality, we assume that the miner chooses the included bids first, and replaces some of them with fake bids then. We will show that both steps would not increase the miner's utility. The miner's revenue is decided by the second highest bid that is included, so if miner does not choose the highest two bids to include, its revenue can only decrease or remain the same. Next, suppose that the miner replaces one or both of the included bids with fake ones. If after the replacement, the highest bid is a fake one, then the miner has to pay the fee for the highest bid which is equal to its revenue. Therefore, the miner's utility cannot be greater than $0$. If after the replacement, the highest bid is not a fake one but the second highest bid is a fake one, and the bid amount is $b$. Then, the miner revenue is $b$. However, the cost to inject the fake bid $b$ is also $b$. Thus, the miner does not gain overall. \ignore{ \elaine{this argument is a little buggy} If the miner's injected bid is the highest bid, the miner pays the price to itself, and miner's utility becomes zero. If the miner's injected bid $b$ is the second highest bid, its revenue becomes $b$. However, this fake transaction also costs miner $b$ since it is unconfirmed, so miner's utility is still zero. Thus, any deviation does not increase miner's utility. } \paragraph{Weak $c$-SCP.} Consider an arbitrary coalition of the miner and a subset of the users. Suppose the coalition plays honestly: \begin{itemize}[leftmargin=5mm,itemsep=1pt] \item if the top confirmed bidder is in the coalition, the coalition's utility is top bidder's true value denoted $v_1$; \item if the top confirmed bidder is not in the coalition, then the coalition's utility is the true value of the 2nd bidder $v_2 \leq v_1$. \end{itemize} Now, consider an arbitrary strategy where two bids are included and the higher of the two gets confirmed. Each included bid can either come from some user, or is a fake bid. Without loss of generality, we may equivalently assume that a fake bid belongs to some imaginary user which belongs to the coalition, and its true value is $0$. We may use the fake indices $0$ and $-1$ to refer to the one or two imaginary users. There are the following cases: \begin{itemize}[leftmargin=5mm,itemsep=1pt] \item {\it Case 1: The confirmed user $i$ belongs to the coalition.} In this case, the coalition's utility is upper bounded by (the possibly imaginary) user $i$'s true value $v_i$. If $i$ has the highest true value, it means the coalition's utility is upper bounded by $v_1$; else if $i$ does not have the highest true value, it means that the coalition's utility is upper bounded by $v_2$. Either way, the coalition's utility cannot exceed the aforementioned honest case. \item {\it Case 2: The confirmed user $i$ does not belong to the coalition.} In this case, suppose that the included but unconfirmed user is denoted $j$ where $j$ is possibly an imaginary user. The coalition's utility is $b_j - \max(0, b_j - v_j) \leq v_j$ where $b_j$ is user $j$'s bid, $v_j$ is its true value, and the part $\max(0, b_j - v_j)$ is the penalty due to overbidding. Since the confirmed user $i$ does not belong to the coalition, it must be a real user and it must be bidding its truthful value, i.e., $b_i = v_i$. Note that the $b_j$ cannot be bidding higher than $b_i$ since $b_j$ is unconfirmed but $b_i$ is confirmed. Therefore, $v_j \leq b_j \leq b_i = v_i$. This also implies that that $v_j \leq v_2$, and thus the coalition's utility is also upper bounded by $v_2$. Recall that the coalition's utility is at least $v_2$ had it played honestly; therefore, the coalition does not gain anything in comparison with playing honestly. \end{itemize} \end{proof} \subsection{The Solitary-Or-Posted-Price Mechanism} \label{sec:solitarypostedprice} Earlier in Section~\ref{sec:lb-rand-weak}, we ruled out the existence of a deterministic, 2-user-friendly mechanism that satisfies weak UIC and 2-weak-SCP simultaneously, assuming {\it finite block size}. In this section, we show that the finite block size restriction is necessary for this lower bound to hold, by showing a deterministic, 2-user-friendly mechanism that satisfies weak UIC, weak MIC, and 2-weak-SCP, but only under {\it infinite} block size. \begin{mdframed} \begin{center} {\bf The solitary-or-posted price mechanism} \end{center} \paragraph{Parameters:} a reserve price $r$. \paragraph{Mechanism:} \begin{itemize}[leftmargin=5mm,itemsep=1pt] \item Choose the top two bids as well as every other bid that is at least $r$ to include in the block. \elaine{i changed this description. at least 2 must be included} \item Every bid at least $r$ is confirmed, and the highest bid in the block is always confirmed (even if it is smaller than $r$). \item Let $b_2$ be the second highest bid in the block. Every confirmed bid pays $\min(b_2, r)$, and miner is paid $\min(b_2, r)$. The remaining payment is burnt. \end{itemize} \end{mdframed} \begin{theorem}[Solitary-or-posted-price mechanism] Suppose the block size is infinite. The solitary-or-posted-price mechanism satisfies weak UIC, weak MIC, and $c$-weak-SCP for all $c > 0$. \end{theorem} \begin{proof} \ignore{ We prove the properties one by one. \paragraph{Weak UIC.} Just like the proof of Theorem \ref{theorem:solitary}, it does not benefit a user for it to inject a fake transaction. Consider a bid vector $\bfb = (b_1, \ldots, b_m)$ where $b_1 \geq \cdots \geq b_m$. For the user bidding $b_1$, suppose $b_1$ is its true value. The user must be confirmed and paying $\min(b_2, r)$ if it bids honestly. If user changes its bid and becomes unconfirmed, its utility cannot increase. If the user changes its bid such that stays confirmed, there are two cases: 1) after changing the bid, it is still ranked top. In this case, its payment and utility are unaffected; 2) after changing its bid, the user is not longer ranked the top. In this case, the new bid must be at least $r$ for it to be confirmed, and the user is now paying $r$. However, before the change, the user was paying $\min(b_2, r)$. Therefore, the user's utility cannot increase. Consider any other user $b_i$ where $i \geq 2$, and suppose $b_i$ is its true value. First, suppose $b_i$ is confirmed under $\bfb$. In this case, it must be that $b_1 \geq b_2 \geq b_i \geq r$. If the user changes its bid and causes itself to be unconfirmed, the utilty cannot increase. If the user changes its bid such that it remains confirmed, then the new bid must still be at least $r$, and the user's payment and utility are unaffected. Second, suppose $b_i$ is unconfirmed under $\bfb$. In this case, it must be that $b_i < r$. If the user changes its bid and remains unconfirmed, its utility cannot increase. If the user changes its bid such that it now becomes confirmed, the user's new bid must be at least $r$ or the highest bid, i.e., the new bid must have increased. In this case, the user is paying at least $\min(b_2, r) \geq b_i$. Thus, its utility cannot increase. } We prove the three properties one by one. \paragraph{Weak UIC.} A user has two kinds of strategies to deviate from the honest behavior: to bid strategically or to inject fake transactions. Since the payment is decided by $\min(b_2, r)$, injecting fake transactions can only increase the payment, no matter whether the user is bidding truthfully or not. Suppose the real bid vector is $\bfb = (b_1,\ldots,b_m)$, where $b_1 \geq \cdots \geq b_m$. Suppose user $i$ bids truthfully and other users may bid arbitrarily. Let $v_i$ and $b'_i$ be user $i$'s true value and strategic bid, respectively. \begin{itemize} \item {\it Case 1: $b_2 \geq r$.} User $i$ is facing a posted-price auction such that it if confirmed if and only if $b'_i \geq r$. In this case, it is not hard to see that no matter user $i$ overbids or underbids, its utility does not increase. \item {\it Case 2: $b_2 < r$.} When $v_i = b_1$, then user $i$'t utility is $v_i - b_2 \geq 0$ in the honest case. If user $i$ overbids, it still pays $b_2$ so the utility does not change. If user $i$ underbids, it is either confirmed with the same payment, or becomes unconfirmed. In either case, the utility does not increase. \end{itemize} \ignore{ \paragraph{Weak MIC.} A miner has two kinds of strategies to deviate from honest behavior: not to choose the highest two bids and to inject fake bids. \elaine{may need to add to defn: reordering bids.} Without loss of generality, we assume that the miner chooses the included bids first, and replaces some of them with fake bids then. We will show that both steps would not increase the miner's utility. The miner's revenue is decided by the second highest bid that is included, so if miner does not choose the highest two bids to include, its revenue can only decrease or remain the same. Next, if the miner's injecting bid is the highest bid, the miner pays the price to itself, and miner's utility becomes zero. If the miner's injecting bid $b \geq r$ is the second highest bid, its revenue becomes $r$. However, this fake bid costs miner $r$ since it is confirmed and needs to pay, so miner's utility is still zero. If the miner's injecting bid $b < r$ is the second highest bid, its revenue becomes $b$. However, this fake bid also costs miner $b$ since it is unconfirmed, so miner's utility is still zero. If the miner's injecting bid is not among the top $2$, it does not affect the revenue, while it may introduce extra cost, so miner's utility does not increase. Thus, any deviation does not increase miner's utility. } \paragraph{Weak MIC.} The miner has two strategies to deviate: not to choose the highest two bids and to inject fake bids. Without loss of generality, we assume that the miner chooses the included bids first, and replaces some of them with fake bids then. We will show that both steps would not increase the miner's utility. The miner's revenue is decided by the second highest bid that is included, so if miner does not choose the highest two bids to include, its revenue can only decrease or remain the same. Now, suppose the miner replaces some of the included bids with fake ones. If any fake bid is confirmed, then the fake bid must be paying an amount equal to the miner revenue, and thus the miner's utility is at most $0$. If no fake bid is confirmed, and some fake bid is unconfirmed and its bid amount is $b$. Then, it must be that $b$ is the second highest bid and the highest bid is smaller than $r$. In this case, the miner gets revenue $b$; however, it costs $b$ to inject this fake bid. Thus, the miner does not gain overall. \paragraph{Weak $c$-SCP.} Suppose there are $m$ users, and their true values are $(v_1,\ldots,v_m)$ where $v_1 \geq \cdots \geq v_m$. Henceforth, we also call the user with the highest true value $v_1$ the top user. There are two possible cases. \begin{itemize}[leftmargin=5mm,itemsep=1pt] \item {\it Case 1: $v_2 < r$.} When everyone behaves honestly, the miner's revenue is $v_2$, user $1$'s utility is $v_1 - v_2$, and all other users are zero since they are unconfirmed. Suppose the miner colludes with a subset of users, and they prepare a bid vector $\bfe = (e_1,\ldots,e_m)$ where $e_1 \geq \cdots \geq e_m$. Each bid $e_i$ in $\bfe$ is either a non-colluding bid coming from a non-coalition user in which case $e_i = v_i$, or it is a colluding bid, i.e., one that comes from a colluding user or a fake bid. If only one user $i$ is confirmed in $\bfe$, there are two possibilities. \begin{itemize}[leftmargin=5mm,itemsep=1pt] \item Suppose user $i$ is not in the coalition. The utility of the coalition is miner's revenue ($e_2$) minus potential extra cost if there are overbid or fake bids that are unconfirmed. If $i$ is not the top user, then $e_2 \leq v_i \leq v_2$. This means the utility of the coalition cannot exceed $v_2$, which can be achieved by playing honestly. If $i$ is top user, to make the miner's revenue larger than the honest case, it must be that $e_2$ is a colluding bid and $e_2 > v_2$. Let $v'$ be the true value of this colluding user or $v' =0$ if $e_2$ is fake. Since $e_2$ is unconfirmed in $\bfe$, its utility becomes $v' - e_2$. Thus, the utility of the coalition cannot exceed $v' \leq v_2$, which can be achieved by playing honestly. \item Suppose user $i$ is in the coalition. The utility of the coalition is $v_i$ minus potential extra cost. However, if top user is also in the coalition, the utility of the coalition is $v_1$ in the honest case, and is at most $v_i \leq v_1$ in the strategic case. If the top user is not in the coalition, the utility of the coalition is $v_2$ in the honest case, and is at most $v_i \leq v_2$ in the strategic case. \end{itemize} If there are two or more confirmed bids in $\bfe$, the miner's revenue becomes $r$, while each confirmed user needs to pay $r$. In this case, the utility of the top user decreases by $r - v_2$. The utilities of all other bids (including fake ones) are non-positive, since if they are confirmed, they have to pay $r$ which is higher than their true values. Since $v_2 < r$, there must be a colluding user (that is not the top user) bidding $b' \geq r$ or the miner injects a fake bid $b' \geq r$. Let $v'$ be the true value of this colluding user or $v' = 0$ if the bid is fake. The utility of this bid is $v' - r$. The joint utility of this colluding or fake bid and the miner is $v' \leq v_2$, so the joint utility does not increase. \item {\it Case 2: $v_2 \geq r$.} When everyone behaves honestly, the miner's utility is $r$, user $i$'s utility is $v_i - r$ for all confirmed user $i$, and all other users are zero since they are unconfirmed. In this case, miner's utility is already maximized. Suppose the miner colludes with a subset of users, and they prepare a bid vector $\bfe$. If there is only one confirmed bid in $\bfe$, then only the confirmed user can benefit by the deviation since its payment decreases. However, the amount that the confirmed user gains is exactly what the miner loses, so the joint utility of any coalition does not increase. If there are two or more confirmed bids in $\bfe$, then every user's utility is maximized when they bid truthfully, since the payment is fixed at $r$ regardless of others' bids. \end{itemize} \end{proof} \subsection{Necessity of Burning} Earlier in Section~\ref{sec:lb-rand-weak}, we ruled out the existence of a deterministic, 2-user-friendly mechanism that satisfies weak UIC and 2-weak-SCP simultaneously, assuming {\it finite block size}. In this section, we show that if the mechanism is not allowed to use a burning mechanism, i.e., if the miner's payment must be the sum of all users' payment, then, the same lower bound would hold even under infinite block size. This lower bound also shows that the burning in the solitary-or-posted-price mechanism is necessary. \begin{theorem}\label{theorem:twoweakSCP} Let $(\bfx, \bfp,\mu)$ be a deterministic mechanism without burning. If $(\bfx, \bfp,\mu)$ is 2-user-friendly, then it cannot achieve UIC and $2$-weak-SCP at the same time. \end{theorem} The remainder of this section will focus on proving Theorem~\ref{theorem:twoweakSCP}. We first prove a useful lemma that says in a mechanism satisfying the desired properties, if in some bid vector, all unconfirmed bids are bidding $0$, then all confirmed bids must be paying $0$. \begin{lemma}\label{lem:unconfirmed0} Let $(\bfx, \bfp,\mu)$ be a deterministic mechanism without burning that is weak UIC and $2$-weak-SCP. Suppose there exists a bid vector $\bfb = (b_1, \ldots, b_m)$ that confirms at least one bid, and moreover, all unconfirmed bids are $0$. Then, all confirmed bids must pay $0$. \end{lemma} \begin{proof} Due to Lemma~\ref{lemma:samePayment}, let $p := p(\bfb)$ denote the universal payment for $\bfb$. Let $\epsilon < p/2m$ be a sufficiently small positive number. By Lemma~\ref{lemma:confirmInvariant} and Myerson's Lemma, we can change all confirmed bids in $\bfb$ to $p + \epsilon$ such that all confirmed bids in $\bfb$ remain confirmed, and their payment unaffected. Let $\bfb'$ be the resulting bid vector, and let $u \in [m]$ be the number of confirmed users in $\bfb'$, and recall all unconfirmed users bid $0$. Since there is no burning, $\mu(\bfb') = u \cdot p$. Let $i$ be a confirmed user in $\bfb'$. Now, suppose that the real bid vector is actually $\bfb'' := (\bfb'_{-i}, p-\epsilon)$, and this also represents everyone's true value. User $i$ becomes unconfirmed in $\bfb''$ by Myerson's Lemma. Thus $\mu(\bfb'') \leq (p+\epsilon) \cdot (u - 1)$. In this case, the miner can collude with user $i$ and ask it to bid $p+\epsilon$ instead. In this case, user $i$'s utility is $-\epsilon$, however, the miner's revenue is $p \cdot u > \mu(\bfb'') + \epsilon$. Thus, the coalition can strictly gain from this deviation, which violates $1$-weak-SCP. \ignore{ Due to Lemma~\ref{lemma:ordered}, one largest bid denoted $b_i$ must be confirmed. By Lemma~\ref{lemma:confirmInvariant}, we can increase $b_i$ to an arbitrarily large amount without affecting its payment. Suppose we have increased $b_i$ to some sufficiently large $\Gamma > |\bfb|_1$, and let $\bfb' := (\bfb_{-i}, \Gamma)$ be the resulting vector. } \end{proof} \begin{lemma}\label{lemma:twointervals2} Let $(\bfx, \bfp,\mu)$ be a deterministic mechanism without burning which is $2$-user-friendly, weak-UIC, $2$-weak-SCP, and with non-trivial miner revenue. Then, there exists a bid vector $\bfb = (b_1,\ldots,b_m)$ where two different users $i,j$ are confirmed, and moreover, $\mu(\bfb)> 0$, $b_i > p_i(\bfb)$ and $b_j > p_j(\bfb)$. \end{lemma} \begin{proof} It suffices to show that there exists a bid vector $\bfb$ such that $\mu(\bfb) > 0$ and at least two users' bids are confirmed. If so, we can use the same argument in the proof of Lemma~\ref{lemma:twointervals} to show that there exists a bid vector $\bfb'$ such that $\mu(\bfb') > 0$, and moreover at least two users' bids are confirmed, and they are both bidding strictly higher than their payment. In particular, cases 1 and 2 follow just like the proof of Lemma~\ref{lemma:twointervals}. For case 3, suppose that $\bfb$ is a bid vector such that $\mu(\bfb) > 0$ and two different users $i$ and $j$ are confirmed, and both bid exactly their payment. In this case, the proof of Lemma~\ref{lemma:twointervals} constructed a new bid vector $\bfb'$ which is otherwise equal to $\bfb$ except that $b_i$ and $b_j$ now bid $b_i + \Delta$ for an arbitrary $\Delta > 0$, and showed that under $\bfb'$, both $i$ and $j$ are confirmed and bidding strictly above payment. Here, we only need to additionally argue that $\mu(\bfb') > 0$. This can be achieved by choosing $\Delta$ to be sufficiently small, and then applying Lemma~\ref{lem:minerutilkto0}. Therefore, below, we focus on proving that there exists a bid vector $\bfb$ such that $\mu(\bfb) > 0$ and at least two users' bids are confirmed. Suppose this is not true. In other words, for any bid vector $\bfb$ satisfying $\mu(\bfb) > 0$, only one user is confirmed. We will show that this contradicts $2$-weak-SCP. \ignore{ For the first case, given $\bfb$, the argument in the proof of Lemma \ref{lemma:twointervals} guarantees there must exist a bid vector we want, including non-trivial miner revenue. Henceforth, we will focus on the second case, and we are going to show that it must violate $2$-weak-SCP. } \ignore{ Suppose $\bfb = (b_1,\ldots,b_m)$ is the bid vector satisfying $\mu(\bfb) > 0$, while only user $i$ is confirmed. We will show that there must be another user $j$ such that $b_j > 0$. For the sake of reaching a contradiction, suppose $b_i$ is the only non-zero bid. Since there is no burning and other users' bids are all zero, we have $\mu(\bfb) = p_i(\bfb) > 0$. For any $0 < \epsilon < \mu(\bfb)$, imagine that the real bid vector is $(\bfb_{-i}, p_i(\bfb) - \epsilon)$. Since user $i$'s bid is lower than $p_i(\bfb)$, it is unconfirmed. However, other users' bids are all zero, so miner's revenue is zero. The miner can collude with user $i$, and ask it to bid $p_i(\bfb)$ instead. In this case, user $i$ is confirmed due to Myerson's Lemma, and its utility becomes $-\epsilon$, while miner's utility becomes $\mu(\bfb)$. Thus the coalition strictly gains, and this violates $1$-weak-SCP. Therefore, there must be another user $j$ such that $b_j > 0$. } Since the mechanism is $2$-user-friendly, Lemma~\ref{lemma:twointervals} guarantees that there exists a bid vector $\bfc = (c_1,\ldots,c_m)$ such that $x_1(\bfc) = x_2(\bfc) = 1$ and $c_1 > p(\bfc)$ and $c_2 > p(\bfc)$. By our assumption, it must be $\mu(\bfc) = 0$. Because there is no burning, we have $p(\bfc) = 0$. By Lemma~\ref{lemma:confirmInvariant}, we can increase user $1$'s and user $2$'s bids arbitraily without changing their confirmation and payment. As a result, we obtain $\bfc' = (\Gamma, \Gamma, c_3, \ldots, c_m)$, where $\Gamma = |\bfc|_1$. By Lemma~\ref{lemma:paychangeslow2}, we can now reduce each bid $b_3, \ldots, b_m$ down to zero one by one, without changing user $1$'s and user $2$'s confirmation. Formally, we obtain a bid vector $\bfc'' = (\Gamma, \Gamma, 0, \ldots, 0)$ such that $x_1(\bfc'') = x_2(\bfc'') = 1$. By our assumption, both confirmed users in $\bfc''$ are paying $0$. Since the mechanism has non-trivial miner revenue, there must exist a bid vector $\bfb$ where $\mu(\bfb) >0$. By our assumption, only one user denoted $i$ is confirmed in $\bfb$. By Lemma~\ref{lem:unconfirmed0}, there must be another user $j$ bidding non-zero. Suppose $\bfb$ also represents everyone's true value. In this case, miner's utility is $\mu(\bfb)$, user $i$'s utility is $b_i - \mu(\bfb)$, and user $j$'s utility is zero. The miner can collude with user $i$ and user $j$, and ask them to bid $\Gamma$ instead. Then, the coalition prepares a bid vector $\bfc'' = (\Gamma, \Gamma, 0, \ldots, 0)$ where the first two bids are user $i$ and user $j$'s bids. In this case, the miner's utility is zero, while user $i$'s utility is $b_i$ and user $j$'s utility is $b_j$. The joint utility increases by $b_j > 0$, which violates $2$-weak-SCP. \end{proof} \paragraph{The proof of Theorem \ref{theorem:twoweakSCP}.} By Lemma~\ref{lemma:samePayment} and Lemma~\ref{lemma:twointervals2}, there exists a bid vector $\bfb^{(0)} = (b_1,\ldots,b_m)$ such that $\mu(\bfb^{(0)}) > 0$, $x_1(\bfb^{(0)}) = x_2(\bfb^{(0)}) = 1$, $b_1 > p(\bfb^{(0)})$ and $b_2 > p(\bfb^{(0)})$ --- note that we can always relabel the bids to make the first two bids represent two confirmed bids. Now, one by one, we reduce every unconfirmed bid down to zero and increase every confirmed bid to a sufficiently large value $\Gamma > |\bfb|_1$. Formally, for $i = 1,\ldots,m$, we define \[ \bfb^{(i)} = \left\{\begin{matrix} (\bfb^{(i-1)}_{-i}, 0), & \text{ if } x_i(\bfb^{(i-1)}) = 0,\\ (\bfb^{(i-1)}_{-i}, \Gamma), & \text{ if } x_i(\bfb^{(i-1)}) = 1. \end{matrix}\right. \] By Lemma~\ref{lemma:confirmInvariant}, when increasing user $1$'s and user $2$'s bids, their confirmation, payment, and miner revenue do not change. Later on, when increasing any confirmed user $i$'s bid where $i > 2$, any previous user bidding $\Gamma$ would still remain confirmed and pay the same. When decreasing any unconfirmed user $i$'s bid to $0$ where $i > 2$, since $\Gamma$ is sufficiently large, and by Lemma~\ref{lemma:paychangeslow2}, any previous user bidding $\Gamma$ would remain confirmed, and although their payment may change, change in the payment is slow. Thus, at the end, users $1$ and $2$ are confirmed in the final vector $\bfb^{(m)}$. \ignore{ both of them will bid $\Gamma$ in $\bfb^{(m)}$. By Lemma \ref{lemma:paychangeslow2}, the payment grows slowly, so we have $\Gamma > p(\bfb^{(m)})$. Then, by Lemma \ref{lemma:unconfirmedPayment}, every user who bids $\Gamma$ must be confirmed in $\bfb^{(i)}$ for all $i$. } \ignore{ Next, there are two possible cases. \begin{enumerate} \item $\mu(\bfb^{(m)}) > 0$; and \item $\mu(\bfb^{(i)}) = 0$ for some $i = 1,\ldots,m$. \end{enumerate} } By Lemma~\ref{lem:unconfirmed0} and the fact that there is no burning, it must be that $\mu(\bfb^{(m)}) = 0$. \ignore{ We start from the first case. Conceptually, once we reduce confirmed users bid continuously, miner's revenue must ``suddenly drops'' at some moment. At that moment, the miner has incentive to sign a contract with that user. Formally, let $\epsilon = p(\bfb^{(m)}) / 2$. By Lemma \ref{lemma:confirmInvariant}, we can tune each confirmed user's bid to $p(\bfb^{(m)}) + \epsilon$ without changing their comfirmation, payment, and miner's revenue. As a result, we obtain $\bfb'$ such that $x_i(\bfb') = 1$ for all $i$ such that $x_i(\bfb) = 1$. Additionally, $p(\bfb') = p(\bfb^{(m)})$, and $\mu(\bfb') = \mu(\bfb^{(m)})$. Let $t$ be the number of confirmed users in $\bfb^{(m)}$. Imagine the real bid vector is $(\bfb^{(m)}_{-1}, p(\bfb^{(m)}) - \epsilon)$. Since user $1$'s bid is lower than $p(\bfb')$, it is unconfirmed and pays nothing. In this case, user $1$'s utility is zero, and miner's utility is at most $(t-1)(p(\bfb') + \epsilon)$. The miner can sign a contract with user $1$, and ask it to bid $p(\bfb')$ instead. In this case, user $1$'s utility becomes $-\epsilon$, while miner's utility becomes $\mu(\bfb') = t\cdot p(\bfb')$. It violates $2$-weak-SCP. } Let $i^*$ be the smallest integer $i \in \{1,\ldots,m\}$ such that $\mu(\bfb^{(i)}) = 0$. Then, we have $\mu(\bfb^{(i^* - 1)}) > 0$ and $\mu(\bfb^{(i^*)}) = 0$. By Lemma~\ref{lemma:confirmInvariant}, increasing a confirmed user's bid does not change miner revenue, so user $i^*$ must be unconfirmed in $\bfb^{(i^* - 1)}$. Imagine the real bid vector is $\bfb^{(i^* - 1)}$ which also represents everyone's true value. In this case, the miner's revenue is $\mu(\bfb^{(i^* - 1)})$, user $1$'s utility is $\Gamma - p(\bfb^{(i^* - 1)})$, and user $i^*$'s utility is zero. The miner can collude with user $1$ and user $i^*$, and ask user $i^*$ to bid $\Gamma$ instead. The coalition now prepares a bid vector $\mu(\bfb^{(i^*)})$ where the second coordinate $\Gamma$ actually comes from user $i^*$ and $b_{i^*} = 0$ is a fake bid injected by the miner. Since there is no burning and $\mu(\bfb^{(i^*)}) = 0$, the payment must be zero. Therefore, the miner's revenue becomes zero, while user $1$'s utility becomes $\Gamma$, and user $i^*$'s utility becomes $b_{i^*}$. By Lemma~\ref{lem:minerutilkto0}, we have $b_{i^*} \geq \mu(\bfb^{(i^* - 1)})$, and thus the coalition strictly gains from this deviation, which violates $2$-weak-SCP. \ignore{ \begin{lemma}\label{lemma:unconfirmInvariant} Let $(\bfx, \bfp,\mu)$ be a deterministic mechanism which is UIC and $2$-weak-SCP. Let $\bfb = (b_1, \ldots, b_m)$ be an arbitrary bid vector, where there exists a user $i$ having an unconfirmed bid, i.e., $x_i(\bfb) = 0$. Then, for any bid vector $\bfb' = (\bfb_{-i}, b_i')$ such that $b_i' \geq 0$ and $\Delta := b_i - b'_i > 0$, the followings holds. \begin{enumerate} \item Miner's revenue is constrainted by $\mu(\bfb) - \Delta \leq \mu(\bfb') \leq \mu(\bfb)$. \item For any user $j$, if $x_j(\bfb) = 1$ and $b_j > p_j(\bfb) + \Delta$, it must be $x_j(\bfb') = 1$ and $p_j(\bfb') \leq p_j(\bfb) + \Delta$. \end{enumerate} \end{lemma} \begin{proof} First, we show that miner's revenue is constrainted by $\mu(\bfb) - \Delta \leq \mu(\bfb')$. For the sake of reaching a contradiction, suppose that $\mu(\bfb) - \Delta > \mu(\bfb')$. Imagine that the real bid vector is $\bfb'$. In this case, the miner can sign a contract to ask user $i$ to bid $b_i$ instead. User $i$'s utility decreases by $\Delta$. However, miner's utility changes from $\mu(\bfb')$ to $\mu(\bfb)$, which increases by more than $\Delta$. That means the joint utility of miner and user $i$ would increase by signing the contract, which violates $2$-weak-SCP. Next, we show that miner's revenue is constrainted by $\mu(\bfb') \leq \mu(\bfb)$. For the sake of reaching a contradiction, suppose that $\mu(\bfb') > \mu(\bfb)$. Imagine that the real bid vector is $\bfb$. In this case, the miner can sign a contract to ask user $i$ to bid $b'_i$ instead. Notice that user $i$ utility does not change, because it underbids. However, miner's utility changes from $\mu(\bfb)$ to $\mu(\bfb')$, which increases. That means the joint utility of miner and user $i$ would increase by signing the contract, which violates $2$-weak-SCP. Finally, we show that user $j$'s bid must still be confirmed and its payment never increases more than $\Delta$. For the sake of reaching a contradiction, suppose that $x_j(\bfb') = 0$ or $p_j(\bfb') > p_j(\bfb) + \Delta$. Because $(\bfx, \bfp,\mu)$ is UIC, user $j$'s true value is $b_j$. When user $i$ bids $b_i$, user $j$'s utility is $b_j - p_j(\bfb)$; when user $i$ bids $b'_i$ and $x_j(\bfb') = 0$, user $j$'s utility is $0 < b_j - p_j(\bfb) - \Delta$; when user $i$ bids $b'_i$ and $x_j(\bfb') = 1$, user $j$'s utility is $b_j - p_j(\bfb') < b_j - p_j(\bfb) - \Delta$. Consequently, if user $i$ bids $b_i$ instead of $b'_i$, user $j$'s utility always increases by more than $\Delta$. Now, imagine that the real bid vector is $\bfb'$. The miner can sign a contract to ask user $i$ to bid $b_i$ instead. In this case, user $i$'s utility decreases by $\Delta$, miner's utility never decreases, and user $j$'s utility increases by more than $\Delta$. Therefore, their joint utility increases, which violates $2$-weak-SCP. \end{proof} \begin{mdframed} \underline{{\bf Procedure} ${\sf ReduceBids}$:} \vspace{5pt} \noindent \textbf{Termination condition:} The procedure terminates if one of the followings holds. \begin{itemize} \item The miner's revenue $\mu(\bfb) = 0$. \item $b_i = 0$ for all $i \in S^\complement$ ($S^\complement = [m]\setminus S$). \end{itemize} \noindent Let $\Delta = \mu(\bfb)/m$ and $\bfb := \bfb^{(0)}$. Repeat the following until the termination condition holds: \begin{enumerate}[leftmargin=5mm,itemsep=2pt] \item \label{step:confirmed} While there exists a user $j$ such that $x_j(\bfb) = 1$ but $b_j \neq p_j(\bfb) + 2 \Delta$, do the following: \begin{itemize} \item For all $i \in [m]$, if $x_i(\bfb) = 1$, set $b_i := p_i(\bfb) + 2 \Delta$ and add $i$ to $S$. \end{itemize} \item \label{step:unconfirmed} For all $i \in [m]$: \begin{itemize} \item If $x_i(\bfb) = 0$ and $b_i > 0$, set $b_i := b_i - \min(\Delta, b_i)$. \item Go to Step \ref{step:confirmed}. \end{itemize} \end{enumerate} \end{mdframed} First, we show that the procedure always terminates within finite steps. According to Lemma \ref{lemma:confirmInvariant}, for any user $i$, if $b_i = p_i(\bfb) + 2\Delta$ for some $\bfb$ at Step \ref{step:confirmed}, its payment would not change throughout the following setting at Step \ref{step:confirmed}. Thus, there is only $m$ iterations at most before the procedure moves on to Step \ref{step:unconfirmed}. By Lemma \ref{lemma:confirmInvariant} and Lemma \ref{lemma:unconfirmInvariant}, once a user $i$ is added to $S$, it would stay confirmed throughout the entire procedure. Besides, a bid can increase only at Step \ref{step:confirmed}, and it must be added to $S$ after increasing. In other words, if a user $i$ is in $S^\complement$ when the procedure terminates, $b_i$ must be non-increasing throughout the procedure. At Step \ref{step:unconfirmed}, a member in $S^\complement$ either reduces by $\Delta$ or becomes zero. Thus, after finite number of Step \ref{step:unconfirmed}, the value $\sum_{i \in S^\complement} b_i$ must become zero. Notice that it is exactly one of the termination conditions. Therefore, the procedure terminates within finite steps. Next, suppose that the procedure terminates because $\mu(\bfb) = 0$. According to Lemma \ref{lemma:confirmInvariant}, Step \ref{step:confirmed} never changes miner's revenue. Thus, the procedure must terminate because of Step \ref{step:unconfirmed}. Let $k$ be the user who makes $\mu(\bfb) = 0$ when user $k$ reduces its bid at Step \ref{step:unconfirmed}. Let $\bfc = (c_1,\ldots, c_m)$ be the bid vector just before the last Step \ref{step:unconfirmed}; that is, $\bfc$ is the vector such that $\bfb = (\bfc_{-k}, c_{k} - \min(\Delta, c_{k}))$. Additionally, because the mechnism is without burning and $\mu(\bfb)$ is already zero, every user's payment must still be zero once we reduce $b_k$ further. \Hao{Here we use the fact of without burn.} By Lemma \ref{lemma:unconfirmInvariant}, we can reduces $b_k$ by $\Delta$ many times while remaining the confirmation of other bids. Consequently, we reach another bid vector $\bfd = (\bfb_{-k}, 0)$ such that $x_i(\bfb) = 1$ implies $x_i(\bfd) = 1$ for all $i$. Similarly, we also have $x_i(\bfc) = 1$ implies $x_i(\bfb) = 1$ for all $i$ by Lemma \ref{lemma:unconfirmInvariant}. Thus, we conclude that $x_i(\bfc) = 1$ implies $x_i(\bfd) = 1$ for all $i$. Because $\mu(\bfc) > 0$, there exists a user $l$ whose bid is confirmed in $\bfc$ such that $p_l(\bfc) > 0$. Besides, $b_1$ and $b_2$ must be added to $S$, so we have $|S| \geq 2$ when the procedure terminates. Thus, there exists another user $t$ such that $x_t(\bfd) = 1$ and $t \neq l$. Now, imagine that the real bid vector is $\bfc$. In this case, miner's utility is $\mu(\bfc) > 0$, user $l$'s utility is $b_l - p_l(\bfc)$, and user $k$'s utility is zero since it is unconfirmed. Because of UIC, user $k$'s true value is $b_k$. Besides, by Lemma \ref{lemma:unconfirmInvariant}, we know that $b_k \geq \mu(\bfc) - \mu(\bfb) = \mu(\bfc)$. The miner can sign a contract with user $l$ and user $k$ to ask user $k$ to bid $b_t$ instead. In this case, the coalition prepares a bid vector $\bfd$ where the $b_t$ item actually comes from user $k$ and $b_k = 0$ is a fake transaction injected by the miner. As we have shown, $x_i(\bfc) = 1$ implies $x_i(\bfd) = 1$ for all $i$, so we have $x_l(\bfd) = 1$. In this case, miner's utility is $\mu(\bfd) = 0$, user $l$'s utility is $b_l$, and user $k$'s utility is $b_k \geq \mu(\bfc)$. Notice that the coalition's utility increases, so it violates $2$-weak-SCP. Finally, suppose that the procedure terminates because $b_i = 0$ for all $i \in S^\complement$, while $\mu(\bfb) > 0$. Because $\mu(\bfb) > 0$, there must exist a user $r$ such that $p_r(\bfb) > 0$. Let $\epsilon = p_r(\bfb) / m$ and consider a bid vector $\bfe = (e_1,\ldots, e_m)$ such that $e_i = p_i(\bfe) + \epsilon$ for all $i \in S$ and $e_i = 0$ for all $i \in S^\complement$. By Lemma \ref{lemma:unconfirmInvariant}, whenever we reduces a bid $b$ by $\Delta$ at Step \ref{step:unconfirmed}, other users' payments can only increase by $\Delta$ at most. Thus, for all $i \in S$, user $i$'s bid must strictly larger than its payment throughout the procedure. In this case, Lemma \ref{lemma:confirmInvariant} guarantees that we can tune the bid from $b_i$ to $e_i$ one by one so that $x_i(\bfb) = x_i(\bfe) = 1$ and $p_i(\bfb) = p_i(\bfe)$ for all $i \in S$. Now, imagine that the real bid vector is $\bfe' = (\bfe_{-r}, p_r(\bfe) - \epsilon/2)$. Notice that user $r$ becomes unconfirmed. In this case, miner's utility is $\mu(\bfe')$ and user $r$'s utility is zero. However, for all $i \neq r$, user $i$'s payment $p_i(\bfe')$ is upperbounded by $e_i$, so we have $\sum_{i \neq r}p_i(\bfe') \leq \sum_{i \neq r}p_i(\bfe) + \epsilon\cdot(m-1)$. Because $\mu(\bfe') = \sum_{i \neq r}p_i(\bfe')$ and $\mu(\bfe) = \sum_{i \neq r}p_i(\bfe) + \epsilon\cdot m$, we have $\mu(\bfe) - \mu(\bfe') \geq \epsilon$. \Hao{Here we use the fact of without burn.} The miner can sign a contract with user $r$ and ask it to bid $e_i$ instead. In this case, miner's utility becomes $\mu(\bfe)$ and user $r$'s utility becomes $e_i - p_i(\bfe) = -\epsilon /2$. Thus, their joint utility increases by $\epsilon / 2$, which violates $2$-weak-SCP. } \section{Weak UIC + 2-Weak-SCP + 2-User-Friendly + Finite Block $\Longrightarrow$ Impossibility} \section{Randomness is Necessary for Weak Incentive Compatibility} \label{sec:lb-rand-weak} Recall that when $c = 1$, our burning 2nd price auction becomes deterministic; but for all $c > 1$, the mechanism is randomized. In this section, we show that the randomness is in fact necessary for $c \geq 2$. To state this impossibility result, we first need to introduce a new notion that captures ``non-degenerate'' mechanisms, that is, we consider mechanisms that sometimes confirm $2$ or more transactions: \begin{definition}[2-user-friendly] We call a mechanism is \emph{2-user-friendly} if there exists a bid vector $\bfb$ such that $x_i(\bfb) = x_j(\bfb) = 1$ for some $i \neq j$. \end{definition} We prove the following impossibility result --- throughout this section, we will assume that $\gamma = 1$ (also called weak incentive compatibility), since this makes our impossibility result stronger. The same impossibility result trivially extends to the case when $\gamma < 1$ as well. \begin{theorem}\label{theorem:twoweakSCPwithburn} Suppose the block size is finite. Let $(\bfx, \bfp,\mu)$ be a deterministic mechanism. If $(\bfx, \bfp,\mu)$ is 2-user-friendly, then it cannot achieve weak UIC and $2$-weak-SCP at the same time. \end{theorem} We stress that the $2$-user-friendly restriction is in fact necessary for the above impossibility to hold. In particular, in Appendix~\ref{section:solitary}, we give a deterministic mechanism that always confirms only one transaction, and satisfies weak UIC, weak MIC, and $c$-weak-SCP for any $c$. \elaine{double check this statement} \Hao{Isn't it has been proven?} Moreover, in Appendix~\ref{sec:solitarypostedprice}, we additionally show that the finite block size requirement is also necessary for the above impossibility to hold. We presented a roadmap of the proof of Theorem~\ref{theorem:twoweakSCPwithburn} in Section~\ref{sec:roadmap-lb-weak}. Therefore, we now directly jump to the detailed proof. To prove Theorem~\ref{theorem:twoweakSCPwithburn}, we first prove that Myerson's lemma still holds for any deterministic, weakly UIC mechanism. \begin{fact} Myerson's lemma holds for any deterministic, weakly UIC mechanism. \label{fct:myerson-weakuic} \end{fact} \begin{proof} \elaine{maybe just say user-dsic is equivalent to uic and suppress the use of this term?} Recall that in the definition of UIC or weak UIC, a user's strategy space involves not only bidding untruthfully, but also injecting fake transactions. To prove that Myerson's lemma holds for weak UIC, we only care about bidding untruthfully, and we do not care about injecting fake transactions. Henceforth, if a mechanism disincentivizes an individual user from overbidding or underbidding under the {\it old} utility notion, we say that it is user-DSIC (short for dominant-strategy-incentive-compatible). Similarly, if a mechanism disincentivizes an individual user from overbidding or underbidding under the {\it new} utility notion, we say that it is weakly user-DSIC. Clearly, UIC implies user-DSIC and weak UIC implies weakly user-DSIC. Since Myerson's lemma holds for user-DSIC, it suffices to show that any {\it deterministic} TFM that is weakly user-DSIC must be user-DSIC, too. Suppose for the sake of contradiction that there is a deterministic TFM that is weakly user-DSIC but not user-DSIC. This means that there is an untruthful bidding strategy that is profitable under the old utility notion (i.e., $0$-strict utility) but not profitable any more under the new utility notion (i.e., $1$-strict utility). In comparison with the old utility, the only difference in the new utility is that ``overbidding but unconfirmed'' is charged an additional cost. Therefore, such an untruthful bidding strategy as mentioned above must be overbidding but unconfirmed. However, we know that under the old utility notion, such an untruthful bidding strategy results in utility $0$ and thus is not profitable. Thus the user does not want to adopt this strategy even under the old utility. This leads to a contradiction. \ignore{ First, observe that even with weak UIC, Myerson's Lemma still holds. This is because no matter whether an overbid and unconfirmed transaction comes for free, an individual user would never want to overbid if the corresponding transaction is not confirmed. Only when the overbid transaction is confirmed, is it possible for the user to increase its utility by overbidding. } \end{proof} \ignore{ \elaine{change narrative after restructuring} The solitary mechanism in Section~\ref{section:solitary} can resist the coalition of the miner and any number of users, however, it confirms only one transaction. It is natrual to ask whether we can design a mechanism sometimes confirm more than one user, while still achieving $c$-SCP for any $c$ as in the solitary mechanism. This notion is formalized as follow. } \begin{lemma}\label{lemma:confirmInvariant} Let $(\bfx, \bfp,\mu)$ be a deterministic mechanism which is weak UIC and $2$-weak-SCP. Let $\bfb = (b_1, \ldots, b_m)$ be an arbitrary bid vector, where there exists a user $i$ having a confirmed bid, i.e., $x_i(\bfb) = 1$. Then, for any bid vector $\bfb' = (\bfb_{-i}, b'_i)$ such that $x_i(\bfb') = 1$, the followings holds. \begin{enumerate} \item Miner's revenue does not change; that is, $\mu(\bfb) = \mu(\bfb')$. \item For any user $j$, if $x_j(\bfb) = 1$ and $b_j > p_j(\bfb)$, it must be $x_j(\bfb') = 1$ and $p_j(\bfb) = p_j(\bfb')$. \end{enumerate} \end{lemma} \begin{proof} Because $x_i(\bfb) = x_i(\bfb') = 1$, we know that $p_i(\bfb) = p_i(\bfb')$ by Myerson's lemma. Recall that there is no cost for overbidding as long as the bid is confirmed. Therefore, user $i$'s utility does not change no matter it bids $b_i$ or $b'_i$. However, if $\mu(\bfb) \neq \mu(\bfb')$, the miner can sign a side contract to ask user $i$ to bid the price that makes miner's revenue higher, thus violating 2-weak-SCP. For example, suppose $\mu(\bfb) < \mu(\bfb')$, then, in case the actual bid vector is $\bfb$ (where everyone's bidding its true value), the coalition of user $i$ and the miner can gain by having user $i$ bid $b'_i$ instead of its true value $b_i$. Similarly, if $\mu(\bfb) > \mu(\bfb')$, a symmetric argument holds. Thus, it must be $\mu(\bfb) = \mu(\bfb')$. We next prove that $x_j(\bfb') = 1$ for any user $j$ with $x_j(\bfb) = 1$ and $b_j > p_j(\bfb)$. For the sake of reaching a contradiction, suppose that $x_j(\bfb') = 0$. We now show that the coalition of the miner, user $i$, and user $j$ can gain if everyone's true value is $\bfb'$. Suppose user $i$ were to bid its true value $b'_i$, user $j$'s utility would be $0$ since $x_j(\bfb') = 0$. Therefore, the coalition is better off having user $i$ bid $b_i$ instead. In this case, user $j$'s utility would be $b_j - p_j(\bfb) > 0$. Furthermore, as we have shown, $\mu(\bfb') = \mu(\bfb)$, and moreover, by Myerson's Lemma, user $i$'s payment and utility do not change as long as it bids high enough to be confirmed. Thus the coalition gains positively by having user $i$ bid $b_i$ instead of its true value $b'_i$. This violates $2$-weak-SCP. Finally, we prove that $p_j(\bfb) = p_j(\bfb')$ for any user $j$ with $x_j(\bfb) = 1$ and $b_j > p_j(\bfb)$. Because we have shown $x_j(\bfb) = x_j(\bfb') = 1$, user $j$'s utility is $v_j - p_j(\bfb)$ if user $i$ bids $b_i$, and $v_j - p_j(\bfb')$ if user $i$ bids $b'_i$. Suppose for the sake of contradiction that $p_j(\bfb) \neq p_j(\bfb')$. There are two cases. First, suppose that $p_j(\bfb) > p_j(\bfb')$. Imagine now that everyone's true value is $\bfb'$. In this case, the miner can collude with both user $i$ and user $j$, and have user $i$ bid $b_i$ rather than its true value to increase the coalition's joint utility. This violates $2$-weak-SCP. Similarly, we can rule out the casw where $p_j(\bfb) < p_j(\bfb')$ due to a symmetric argument. \end{proof} \begin{lemma}\label{lemma:samePayment} Let $(\bfx, \bfp,\mu)$ be a deterministic mechanism that achieves weak UIC and $1$-weak-SCP. Then, for all users $i,j$, if $x_i(\bfb) = x_j(\bfb) = 1$, it must be $p_i(\bfb) = p_j(\bfb)$. In other words, all confirmed users must pay the same price. \end{lemma} \begin{proof} Suppose $i$ and $j$ are two confirmed users; that is $x_i(\bfb) = x_j(\bfb) = 1$. For the sake of reaching a contradiction, we assume that $p_i(\bfb) \neq p_j(\bfb)$. There are two possible cases: \begin{enumerate} \item At least one user's bid is higher than its payment; that is, either $b_i > p_i(\bfb)$ or $b_j > p_j(\bfb)$ (or both). \item Both users pay their bids; that is, $b_i = p_i(\bfb)$ and $b_j = p_j(\bfb)$. \end{enumerate} We start from the first case. Without loss of generality, assume $b_i > p_i(\bfb)$. According to Lemma \ref{lemma:confirmInvariant}, user $j$ can increase its bid without changing user $i$'s confirmation and payment. Furthermore, by Myerson's lemma, user $j$'s payment should not change. Thus, we have another bid vector $\bfb' = (\bfb_{-j}, b'_j)$ such that $b_i > p_i(\bfb')$ and $b'_j > p_j(\bfb')$. Using Lemma \ref{lemma:confirmInvariant} again, we can increase user $i$'s and user $j$'s bid arbitrarily while remaining their confirmation and payment. Consequently, we have a bid vector $\bfc = (c_1,\ldots,c_m)$ such that user $i$ and user $j$ have the same bid. Formally, $x_i(\bfc) = x_j(\bfc) = 1$, $c_i > p_i(\bfc) = p_i(\bfb)$, $c_j > p_j(\bfc) = p_j(\bfb)$ and $c_i = c_j$. Without loss of generality, we assume $p_i(\bfc) > p_j(\bfc)$. Imagine that the real bid vector is $\bfc$. In this case, miner's utility is $\mu(\bfc)$, and user $i$'s utility is $c_i - p_i(\bfc)$. The miner can sign a contract with user $i$, and switch user $i$'s and user $j$'s positions in the bid vector. Since users $i$ and $j$ are bidding the same, the miner's revenue is unaffected if their positions are switched. On the other hand, user $i$ and user $j$'s payments will be switched as a result. \elaine{note: we are dealing with tie-breaking implicitly in the modeling. the same approach was used in the finite-block size impossibility for strong ic} Thus, user $i$'s utility has increased to $c_i - p_j(\bfb)$. This violates $1$-weak-SCP. Next, we analyze the second case. Without loss of generality, we assume $b_i = p_i(\bfb) > b_j = p_j(\bfb)$. By Myerson's lemma, user $j$ can increase its bid without changing its payment. Thus, user $j$ can increase its bid to $b_i$, and we have a bid vector $\bfb' = (\bfb_{-j}, b_i)$. By Lemma \ref{lemma:confirmInvariant}, miner's revenue should not change, so we have $\mu(\bfb) = \mu(\bfb')$. If $x_i(\bfb') = 1$, it goes back to the first case, so we assume $x_i(\bfb') = 0$. Now, imagine that the real bid vector is $\bfb'$. In this case, miner's utility is $\mu(\bfb') = \mu(\bfb)$, and user $i$'s utility is zero. However, the miner can sign a contract with user $i$, and ask it to bid $b_j$ instead. Consequently, the miner prepares a bid vector $\bfb$, where $b_j$ comes from user $i$. In this case, miner's utility is still $\mu(\bfb') = \mu(\bfb)$, while user $i$'s utility becomes $b_i - p_j(\bfb) > 0$. This violates $1$-weak-SCP. \end{proof} \begin{lemma}\label{lemma:ordered} Let $(\bfx, \bfp,\mu)$ be a deterministic mechanism that achieves weak UIC and $2$-weak-SCP. Then, for all users $i,j$, if $x_i(\bfb) = 1$ and $x_j(\bfb) = 0$, it must be $b_i \geq b_j$. In other words, the confirmed bids must be the highest $k$ bids for some $k \in \mathbb{N}$ where $k$ may be a function of the bid vector. \end{lemma} \begin{proof} For the sake of reaching a contradiction, suppose that there exist two users $i,j$ such that $x_i(\bfb) = 1$ and $x_j(\bfb) = 0$, while $b_i < b_j$. By Myerson's lemma, user $i$ can increase its bid to $b_j$ without changing its confirmation and payment. Thus, we have a bid vector $\bfb' = (\bfb_{-i}, b_i = b_j)$ such that $x_i(\bfb') = 1$ and $p_i(\bfb') = p_i(\bfb)$. There are two possible cases: either $x_j(\bfb') = 1$ or $x_j(\bfb') = 0$. First, we assume $x_j(\bfb') = 1$. Imagine the real bid vector is $\bfb$ which also represents everyone's true value. In this case, miner's utility is $\mu(\bfb)$, user $i$'s utility is $b_i - p_i(\bfb)$, and user $j$'s utility is zero. However, the miner can sign a contract with user $i$ and user $j$, and ask user $i$ to bid $b_j$ instead. By Lemma \ref{lemma:samePayment}, we have $p_i(\bfb') = p_j(\bfb')$. Because $p_i(\bfb') = p_i(\bfb)$ and $p_i(\bfb) \leq b_i < b_j$, we have $p_j(\bfb') < b_j$. Besides, by Lemma \ref{lemma:confirmInvariant}, $\mu(\bfb) = \mu(\bfb')$. Therefore, after signing the contract, miner's utility is still $\mu(\bfb)$, user $i$'s utility is still $b_i - p_i(\bfb)$, while user $j$'s utility becomes $b_j - p_j(\bfb') > 0$. This violates $2$-weak-SCP. Next, we assume $x_j(\bfb') = 0$. Imagine the real bid vector is $\bfb'$ which also represents everyone's true value. Recall that in $\bfb'$, user $i$ and user $j$ are bidding the same; however, user $i$ is confirmed but user $j$ is not. Furthermore, user $i$ is bidding strictly higher than its payment as we have shown above. The coalition of the miner and user $j$ can strictly benefit, if the miner switched user $i$ and user $j$'s positions in the bid vector; since this does not affect the miner's utility, but user $j$'s utility now becomes positive. This violates $1$-weak-SCP. \ignore{ In this case, miner's utility is $\mu(\bfb) = \mu(\bfb')$, and user $j$'s utility is zero. However, the miner can sign a contract with user $j$, and ask user $j$ to bid $b_i$ instead. The miner prepares a bid vector $\bfb$, where $b_i$ comes from user $j$ and $b_j$ comes from user $i$. In this case, miner's utility is still $\mu(\bfb) = \mu(\bfb')$, while user $j$'s utility becomes $b_j - p_i(\bfb) > 0$ because $b_j > b_i \geq p_i(\bfb)$. This violates $2$-weak-SCP. } \end{proof} \paragraph{Notation for the universal payment.} According to Lemma \ref{lemma:samePayment}, all confirmed users must pay the same price. Thus, we may simplify the notation, and define $p(\bfb)$ to be the universal payment price for all confirmed users under the bid vector $\bfb$. If no one is confirmed under $\bfb$, then we define $p(\bfb) = 0$. \elaine{i changed it to 0 rather than infty} \begin{lemma}\label{lemma:unconfirmedPayment} Let $(\bfx, \bfp,\mu)$ be a deterministic mechanism that achieves weak UIC and $2$-weak-SCP. Let $\bfb$ be a bid vector such that at least one user is confirmed. Then, for any unconfirmed user $i$, it must be $b_i \leq p(\bfb)$. \end{lemma} \begin{proof} For the sake of reaching a contradiction, suppose there exists an unconfirmed user $i$ such that $b_i - p(\bfb) = \Delta$ for some $\Delta > 0$. Let $j$ be a confirmed user in $\bfb$. By Lemma~\ref{lemma:ordered}, we know that $b_j \geq b_i$. Now, consider another bid vector $\bfb' = (\bfb_{-j}, p(\bfb) + \Delta/2)$. By Myerson's Lemma, user $j$ is still confirmed and is still paying $p(\bfb)$. However, notice that user $j$'s new bid $p(\bfb) + \Delta/2 < b_i$. By Lemma~\ref{lemma:ordered}, user $i$ must be confirmed too under the bid vector $\bfb'$, and by Lemma~\ref{lemma:samePayment}, it would be paying the same as user $j$, which is $p(\bfb)$. Now, imagine that everyone's true value is the vector $\bfb$. If everyone bids honestly, the miner's utility is $\mu(\bfb)$, user $j$'s utility is $b_j - p(\bfb)$, and user $i$'s utility is zero. If the miner colludes with users $i,j$, the coalition can benefit by having user $j$ bid $p(\bfb) + \Delta/2$ instead. In this case, miner's utility is still $\mu(\bfb)$ due to Lemma~\ref{lemma:confirmInvariant}, user $j$'s utility is still $b_j - p(\bfb)$, while user $i$'s utility increases to $\Delta/2$. This violates $2$-weak-SCP. \end{proof} \begin{lemma}\label{lem:minerutilkto0} Let $(\bfx, \bfp,\mu)$ be a deterministic, weak UIC, and $1$-weak-SCP mechanism. Then, for any bid vector $\bfb$, any user $k$, and any $0< \Delta \leq b_k$, it must be that $\mu(\bfb) - \Delta \leq \mu(\bfb_{-k}, b_k - \Delta) \leq \mu(\bfb)$. \end{lemma} \begin{proof} We first prove the direction $\mu(\bfb_{-k}, b_k -\Delta) \leq \mu(\bfb)$. We want to show that if the users' true value is $\bfb$, but now user $k$ bids $b_k - \Delta$ instead of its true value $b_k$, then the miner revenue should not increase. There are two cases. \begin{itemize}[leftmargin=5mm,itemsep=1pt] \item First, if user $k$ is unconfirmed under $\bfb$ or confirmed but paying its full bid $b_k$, then its utility is $0$ under $\bfb$. In this case, obviously decreasing user $k$'s bid should not make the miner benefit; since otherwise the coalition of user $k$ and the miner can benefit by having user $k$ bid $b_k - \Delta$ instead, thus violating $1$-weak-SCP. \item Second, suppose that user $k$ is initially confirmed under $\bfb$ and moreover, $b_k > p(\bfb)$. We can first decrease user $k$'s bid to exactly $\max(b_k - \Delta, p(\bfb))$, and let $\bfb' := (\bfb_{-k}, \max(b_k - \Delta, p(\bfb)))$ be the resulting new bid vector. Due to Myerson's Lemma, Lemma~\ref{lemma:confirmInvariant}, and Lemma~\ref{lemma:samePayment}, $x_k(\bfb') = 1$, $\mu(\bfb') = \mu(\bfb)$, and $p(\bfb') = p(\bfb)$. Then, we can decrease user $k$'s bid from $\max(b_k - \Delta, p(\bfb))$ to $b_k - \Delta$, and due to the same argument as the first case, the miner's revenue should not increase. \end{itemize} We next prove the other direction, that is, $\mu(\bfb) - \Delta \leq \mu(\bfb_{-k}, b_k - \Delta)$. If no one is confirmed under $\bfb$, the statement trivially holds. Henceforth, we assume that at least one user is confirmed under $\bfb$. Again, there are two cases. \begin{itemize}[leftmargin=5mm,itemsep=1pt] \item First, suppose that user $k$ is not confirmed under $\bfb$ or confirmed but paying its full bid $b_k$. Due to Lemma~\ref{lemma:unconfirmedPayment}, we know that $b_k \leq p(\bfb)$. By Myerson's Lemma, user $k$ should be unconfirmed or confirmed but paying full bid under $\bfb' := (\bfb_{-k}, b_k - \Delta)$. Now, suppose everyone's true value is actually $\bfb'$, notice that user $k$'s utility is $0$. We argue that if user $k$ bids $b_k$ instead of its true value $b_k -\Delta$, it should not make the miner revenue increase by more than $\Delta$. If so, the coalition of user $k$ and the miner can strictly benefit by having user $k$ bid $b_k$ instead of its true value $b_k - \Delta$, since the cost of such overbidding is at most $\Delta$ under the new utility notion. This violates $1$-weak-SCP. \item Second, suppose that user $k$ is confirmed under $\bfb$ and moreover $b_k > p(\bfb)$. In this case, due to Myerson's Lemma, Lemma~\ref{lemma:confirmInvariant}, and Lemma~\ref{lemma:samePayment}, the miner's revenue should not be affected when we reduce user $k$'s bid to $\max(p(\bfb), b_k - \Delta)$. We now further decrease user $k$'s bid from $\max(p(\bfb), b_k - \Delta)$ to $b_k - \Delta$ --- due to the same analysis as the first case, the miner's revenue should not increase by more than $\Delta$ in this process. \end{itemize} \ignore{ There are two cases. user $k$ is initially unconfirmed under $\bfb$, and the miner revenue increases when user $k$ bids $0$ instead, then the miner's revenue increase when user $k$ decreases its bid from its true value $b_k$ to $0$, then the coalition of } \end{proof} \begin{lemma}\label{lemma:paychangeslow} Let $(\bfx, \bfp,\mu)$ be a deterministic mechanism which is weak UIC and $2$-weak-SCP. Let $\bfb = (b_1, \ldots, b_m)$ be an arbitrary bid vector. Suppose that there exist three different users $i,j,k$ such that $x_i(\bfb_{-k}, 0 ) = x_j(\bfb_{-k}, 0) = 1$, and moreover, $b_i - p(\bfb_{-k}, 0) > b_k$ and $b_j - p(\bfb_{-k}, 0) > b_k$. Then, it must be that $x_i(\bfb) = x_j(\bfb) = 1$ and $p(\bfb) \leq p(\bfb_{-k}, 0) + b_k/2$. \end{lemma} \begin{proof} We first prove that $x_i(\bfb) = x_j(\bfb) = 1$. Suppose not, without loss of generality, let us suppose $x_i(\bfb) = 0$ since the case $x_j(\bfb) = 0$ has a symmetric proof. Imagine that the real bid vector is $\bfb$ which also represents everyone's true value. Suppose the miner and user $i$ form a coalition, and they replace user $k$'s bid with an injected $0$-bid. Due to Lemma~\ref{lem:minerutilkto0}, the miner's utility decreases by at most $b_k$ as a result. However, user $i$ now becomes confirmed and its utility is $b_i - p(\bfb_{-k}, 0) > b_k$. Therefore, the coalition strictly gains which violates $1$-weak-SCP. We next prove that $p(\bfb) \leq p(\bfb_{-k}, 0) + b_k/2$. For the sake of reaching a contradiction, suppose $p(\bfb) > p(\bfb') + b_i/2$. Imagine the real bid vector is $\bfb$ which is also everyone's true value. In this case, miner's utility is $\mu(\bfb)$, user $i$'s utility is $b_i - p(\bfb)$, and user $j$'s utility is $b_j - p(\bfb)$. However, the miner can collude with user $i$ and user $j$, and miner replaces $b_k$ with an injected $0$. Notice that injecting a $0$-bid costs nothing. In this case, miner's utility becomes $\mu(\bfb') \geq \mu(\bfb) - b_k$, where the inequality follows from Lemma~\ref{lem:minerutilkto0}. On the other hand, user $i$'s utility becomes $b_i - p(\bfb')$, and user $j$'s utility becomes $b_j - p(\bfb')$. Because $p(\bfb) > p(\bfb') + b_k/2$, user $i$'s and user $j$'s utilities each increases more than $b_k/2$. Consequently, the coalition's joint utility increases, which violates $2$-weak-SCP. \end{proof} \begin{lemma}\label{lemma:paychangeslow2} Let $(\bfx, \bfp,\mu)$ be a deterministic mechanism which is weak UIC and $1$-weak-SCP. Let $\bfb = (b_1, \ldots, b_m)$ be an arbitrary bid vector. Let $i$ and $k$ be two different users, and suppose that $x_i(\bfb) = 1$ and $b_i - p(\bfb) > b_k$. Then, $x_i(\bfb_{-k}, 0) = 1$ and $p(\bfb_{-k}, 0) \leq p(\bfb) + b_k$. \end{lemma} \begin{proof} For the sake of contradiction, suppose either $x_i(\bfb_{-k}, 0) = 0$ or $p(\bfb_{-k}, 0) > p(\bfb) + b_k$. Imagine that the real bid vector is $\bfb' := (\bfb_{-k}, 0)$, which also represents everyone's true value. Now, the miner replaces user $k$'s $0$-bid in $\bfb'$ with an injected bid $b_k$. Injecting this bid costs at most $b_k$. Due to Lemma~\ref{lem:minerutilkto0}, the miner's utility cannot decrease, i.e., $\mu(\bfb) \geq \mu(\bfb')$. However, consider user $i$'s utility. If $x_i(\bfb') = 0$ but $x_i(\bfb) = 1$, user $i$'s utility has increased from $0$ to $b_i - p(\bfb) > b_k$. Else, if $x_i(\bfb') = x_i(\bfb) = 1$, but $p(\bfb') > p(\bfb) + b_k$, then user $i$'s utility increases by strictly more than $b_k$ too. In either case, the coalition of the miner and user $i$ can strictly increase their joint utility by replacing user $k$'s bid with the injected $b_k$ bid, which violates $1$-weak-SCP. \end{proof} \ignore{ \begin{lemma}\label{lemma:paymentGrowsSlowly} Let $(\bfx, \bfp,\mu)$ be a deterministic mechanism which is $2$-weak-SCP. Let $\bfb = (b_1, \ldots, b_m)$ be an arbitrary bid vector. If there exist three different users $i,j,k$ such that $x_i(\bfb) = x_j(\bfb) = 1$, then, it must be $p(\bfb_{-k}, 0) - b_k \leq p(\bfb) \leq p(\bfb_{-k}, 0) + b_k/2$. The statement holds no matter user $k$ is confirmed or not. \end{lemma} \begin{proof} Let $\bfb' = (\bfb_{-k}, 0)$. We first show that $|\mu(\bfb) - \mu(\bfb')| \leq b_k$. For the sake of reaching a contradiction, suppose $\mu(\bfb) - b_k > \mu(\bfb')$. Imagine the real bid vector is $\bfb'$. The miner can sign a contract with user $k$, and asks it to bid $b_k$ instead. Depending on whether user $k$ is confirmed, it may have different utility, while its utility can only decrease by $b_k$ at most, while miner's utility increases more than $b_k$. This violates $2$-weak-SCP. On the other hand, for the sake of reaching a contradiction, suppose $\mu(\bfb') - b_k > \mu(\bfb)$. Imagine the real bid vector is $\bfb$. The miner can sign a contract with user $k$, and asks it to bid zero instead. User $k$'s utility can only decrease by $b_k$ at most, while miner's utility increases more than $b_k$. This violates $2$-weak-SCP. Thus, we conclude $|\mu(\bfb) - \mu(\bfb')| \leq b_k$. Next, we show that $p(\bfb) \leq p(\bfb_{-k}, 0) + b_k/2$. For the sake of reaching a contradiction, suppose $p(\bfb) > p(\bfb') + b_i/2$. Imagine the real bid vector is $\bfb$. In this case, miner's utility is $\mu(\bfb)$, user $i$'s utility is $b_i - p(\bfb)$, and user $j$'s utility is $b_j - p(\bfb)$. However, the miner can sign a contract with user $i$ and user $j$, and miner replaces $b_k$ with a injected $0$. Notice that injecting a zero costs the miner nothing. In this case, miner's utility becomes $\mu(\bfb')$, which decreases by $b_k$ at most. On the other hand, user $i$'s utility becomes $b_i - p(\bfb')$, and user $j$'s utility becomes $b_j - p(\bfb')$. Because $p(\bfb) > p(\bfb') + b_k/2$, user $i$'s and user $j$'s utilities each increases more than $b_k/2$. Consequently, the joint utility increases, so it violates $2$-weak-SCP. Finally, we show that $p(\bfb') - b_k \leq p(\bfb)$. For the sake of reaching a contradiction, suppose $p(\bfb') > p(\bfb) + b_k$. Imagine the real bid vector is $\bfb'$. In this case, miner's utility is $\mu(\bfb')$, user $i$'s utility is $b_i - p(\bfb')$, and user $j$'s utility is $b_j - p(\bfb')$. However, the miner can sign a contract with user $i$ and user $j$, and miner injects a fake bid $b_k$. This fake bid costs the miner $b_k$ at most. In this case, miner's utility becomes at least $\mu(\bfb) - b_k$, which decreases by $2\cdot b_k$ at most. On the other hand, user $i$'s utility becomes $b_i - p(\bfb)$, and user $j$'s utility becomes $b_j - p(\bfb)$. Because $p(\bfb') > p(\bfb) + b_k$, user $i$'s and user $j$'s utilities each increases more than $b_k$. Consequently, the joint utility increases, so it violates $2$-weak-SCP. \end{proof} } \begin{lemma}\label{lemma:twointervals} Let $(\bfx, \bfp,\mu)$ be a deterministic mechanism which is $2$-user-friendly, weak-UIC and $2$-weak-SCP. Then, there exists a bid vector $\bfb = (b_1,\ldots,b_m)$ where two different users $i,j$ are confirmed, and moreover, $b_i > p_i(\bfb)$ and $b_j > p_j(\bfb)$. \end{lemma} \begin{proof} Since $(\bfx, \bfp,\mu)$ is 2-user-friendly, there exists a bid vector $\bfb$ such that at least two users' bids are confirmed. There are three possible cases: \begin{enumerate} \item There are two users $i,j$ such that $b_i > p_i(\bfb)$ and $b_j > p_j(\bfb)$. \item Only a single confirmed user bids strictly above its payment. Without loss of generality, we may assume user $j$ is confirmed and $b_j > p_j(\bfb)$; however, for any confirmed user $i \neq j$, $b_i = p_i(\bfb)$, and there exists at least one such $i$. \item For any confirmed bid $b_i$, it holds that $b_i = p_i(\bfb)$. \end{enumerate} The first case is exactly what we want. For the second case, we can raise $i$'s bid by an arbitrary amount $\Delta > 0$, and the new bid vector is $(\bfb_{-i}, b_i + \Delta)$. By Myerson's Lemma, $i$ should still be confirmed and paying the same price. Due to Lemma~\ref{lemma:confirmInvariant}, $j$ should still be confirmed and paying the same price, too. Therefore, the bid vector $(\bfb_{-i}, b_i + \Delta)$ satisfies the claim we want to prove. Moreover, due to Lemma~\ref{lemma:confirmInvariant}, it must be $\mu(\bfb) = \mu(\bfb_{-i}, b_i + \Delta)$.\footnote{$\mu(\bfb) = \mu(\bfb_{-i}, b_i + \Delta)$ is not important for this proof, while this fact will be useful in the proof of Lemma \ref{lemma:twointervals2}.} We now focus on the third case which is the trickiest. Due to Lemma~\ref{lemma:samePayment}, it must be that everyone confirmed has the same bid, and thus $b_i = b_j$. Fix an arbitrary $\Delta > 0$. Consider the bid vector $\bfb^*$ which is the same as $\bfb$ except that user $i$ and user $j$'s bids are replaced with $b_i + \Delta$. We claim that the bid vector $\bfb^*$ satisfies the claim we want to prove. In other words, $x_i(\bfb^*) = x_j(\bfb^*) =1$ and $b_i + \Delta > p(\bfb^*)$. Suppose this is not the case. There are three cases: \begin{enumerate}[leftmargin=5mm,itemsep=1pt] \item both $i$ and $j$ are not confirmed under $\bfb^*$; \item exactly one of them is not confirmed under $\bfb^*$ --- without loss of generality, we may assume that $j$ is not confirmed under $\bfb^*$. In this case, by Lemma~\ref{lemma:unconfirmedPayment}, it must be that $p_i(\bfb^*) = b_i + \Delta$; \Hao{I change the wording from ``at least'' to ``exactly''} \item both $i$ and $j$ are confirmed under $\bfb^*$ but $b_i + \Delta = p(\bfb^*)$. \end{enumerate} In all of these cases, user $i$ and $j$ both have utility $0$ if the true values are $\bfb^*$. Let $\bfb' := (\bfb_{-i}, b_i + \Delta)$. \ignore{ By Myerson's Lemma, $i$ should still be confirmed and paying the same price $p(\bfb') = p(\bfb)$. It must be that $j$ is unconfirmed under $\bfb'$. Otherwise, $j$ must be paying the same price $p(\bfb') = p(\bfb)$ due to Lemma~\ref{lemma:samePayment} --- we are now back to the second case, and and using the same argument as the second case, we can conclude that $\bfb^*$ satisfies the claim, which violates our assumption. } By Lemma~\ref{lem:minerutilkto0}, $\mu(\bfb^*) \geq \mu(\bfb') \geq \mu(\bfb^*) - \Delta$. By Lemma~\ref{lemma:confirmInvariant}, $\mu(\bfb') = \mu(\bfb)$. Thus, $\mu(\bfb^*) \geq \mu(\bfb) \geq \mu(\bfb^*) - \Delta$.\footnote{$\mu(\bfb^*) \geq \mu(\bfb)$ is not important for this proof, while this fact will be useful in the proof of Lemma \ref{lemma:twointervals2}.} Now, suppose the true values are $\bfb^*$. The miner can collude with users $i$ and $j$, and have them bid $b_i = b_j$ instead. Both users $i$ and $j$ are paying $b_i$ in this case. Therefore, each of them has utilty $\Delta$ now. On the other hand, the miner's utility decreases by at most $\Delta$, and therefore the coalition's utility increases. This violates $2$-weak-SCP. \end{proof} \ignore{ \begin{lemma}\label{lemma:twointervals} Let $(\bfx, \bfp,\mu)$ be a deterministic mechanism which is $2$-user-friendly, UIC and $2$-weak-SCP. Then, there exists a bid vector $\bfb = (b_1,\ldots,b_m)$ and two users $i,j$ whose bids are confirmed such that $\mu(\bfb) > 0$, $b_i > p_i(\bfb)$ and $b_j > p_j(\bfb)$. \end{lemma} \begin{proof} Because $(\bfx, \bfp,\mu)$ is 2-user-friendly, there exists a bid vector $\bfb$ such that at least two users' bids are confirmed, and miner's revenue $\mu(\bfb) > 0$. There are three possible cases: \begin{enumerate} \item There are two users $i,j$ such that $b_i > p_i(\bfb)$ and $b_j > p_j(\bfb)$. \item Only a single confirmed bid $b_j$ satisfies $b_j > p_j(\bfb)$; that is, $b_i = p_i(\bfb)$ for any confirmed bid $b_i$ where $i \neq j$. \item For any confirmed bid $b_i$, it holds that $b_i = p_i(\bfb)$. \end{enumerate} The first case is exactly what we want, so we analyze the second and the third cases. \Hao{I found the third case is tricky, and I haven't had a shorter proof by Lemma \ref{lemma:samePayment} and Lemma \ref{lemma:ordered}.} We start from the second case. Recall that $\bfb$ contains at least two confirmed bids, so there exists a confirmed bid $i \neq j$ such that $b_i = p_i(\bfb)$. By Myerson's lemma, we can enhance user $i$'s bid without changing its confirmation and payment. Because $b_j$ is a confirmed bid such that $b_j > p_j(\bfb)$, Lemma \ref{lemma:confirmInvariant} guarantees that $x_j(\bfb') = x_j(\bfb) = 1$ and $p_j(\bfb') = p_j(\bfb)$. Thus, user $j$ also has a confirmed bid, and its bid is higher than its payment. Next, we analyze the third case. Without loss of generality, we assume $x_1(\bfb) = x_2(\bfb) = 1$. Let $\Delta = |\bfb|_1$. Now, imagine that the real bid vector is $\bfb' = (b_1 + \Delta, b_2 + \Delta, b_3, \ldots, b_m)$. We are going to show that $x_1(\bfb') = x_2(\bfb') = 1$. For the sake for reaching a contradiction, suppose $x_1(\bfb') = 0$. We now calculate the joint utility of miner, user $1$ and user $2$. Because user $1$ is unconfirmed, its true value does not contribute to the joint utility. Thus, the joint utility is upperbounded by user $2$ and miner's revenue ``comes from other users.'' In this case, the joint utility of miner, user $1$ and $2$ is upperbounded by $|\bfb'|_1 - (b_1 + \Delta) \leq |\bfb|_1 + \Delta$. However, the miner can sign a contract with user $1$ and $2$, and ask them to bid $b_1$ and $b_2$, respectively. In this case, miner's utility is $\mu(\bfb)$. Because user $1$'s true value is $b_1 + \Delta$ and $p_1(\bfb) = b_1$, we know that user $1$'s utility is $\Delta$. Similarly, user $2$'s utility is $\Delta$. Consequently, the joint utility becomes $\mu(\bfb) + 2\Delta > |\bfb|_1 + \Delta$. This violates $2$-weak-SCP, so we have $x_1(\bfb') = x_2(\bfb') = 1$. Now, if either $b_1 + \Delta > p(\bfb')$ or $b_2 + \Delta > p(\bfb')$, it becomes either the first case or the second case. Thus, we assume $b_1 + \Delta = b_2 + \Delta = p(\bfb')$ throughout the following proof. Let's consider the bid vector $\bfb'' = (b_1 + \Delta, b_2, b_3, \ldots, b_m)$. By Myerson's lemma, we know that $x_1(\bfb'') = 1$ and $p(\bfb'') = p(\bfb)$. Besides, by Lemma \ref{lemma:confirmInvariant}, we have $\mu(\bfb) = \mu(\bfb'')$. If $x_2(\bfb'') = 1$, then it becomes either the second case. The remaining proof is going to show that $x_2(\bfb'') = 0$ is impossible. Imagine the real bid vector is $\bfb''$. If $\mu(\bfb') > \mu(\bfb'') + \Delta$, the miner can sign a contract with user $2$, and ask it to bid $b_2 + \Delta$ instead. User $2$'s utility decreases by $\Delta$ at most, while miner's utility increases more than $\Delta$. This violates $2$-weak-SCP, so we have $\mu(\bfb') - \Delta \leq \mu(\bfb'')$. Finally, imagine that the real bid vector is $\bfb'$. In this case, miner's utility is $\mu(\bfb')$, and user $1$ and $2$'s utilities are both zero, because $b_1 + \Delta = p_1(\bfb')$ and $b_2 + \Delta = p_2(\bfb')$. The miner can sign a contract with user $1$ and $2$, and ask them to bid $b_1$ and $b_2$, respectively. In this case, miner's utility becomes $\mu(\bfb)$, while user $1$ and $2$'s utilities are both $\Delta$. Consequently, their joint utility becomes $\mu(\bfb) + 2\Delta = \mu(\bfb'') + 2\Delta > \mu(\bfb')$. This violates $2$-weak-SCP. \end{proof} } \paragraph{Proof of Theorem \ref{theorem:twoweakSCPwithburn}.} By Lemmas~\ref{lemma:samePayment} and \ref{lemma:twointervals}, there exists a bid vector $\bfb = (b_1,\ldots,b_m)$ such that $x_1(\bfb) = x_2(\bfb) = 1$, $b_1 > p(\bfb)$ and $b_2 > p(\bfb)$ --- we can always relabel the bids to make any two confirmed users with positive utility labeled as users $1$ and $2$. Let $B$ denote the block size, and we define $\Gamma = 2^{B + 8} \cdot |\bfb|_1 \cdot \max(m, B+1)$ to be a sufficiently large number. Now, we consider a bid vector $\bfc = (c_1,c_2,\ldots,c_m)$, where $c_1 = c_2 = \Gamma$ and $c_i = 0$ for all $i \geq 3$. We are going to show that $x_1(\bfc) = x_2(\bfc) = 1$. By the Myerson's Lemma and Lemma~\ref{lemma:confirmInvariant}, from $\bfb$, we can increase $b_1$ without changing the confirmation and the payment of $b_1$ and $b_2$, so $x_1(\Gamma, b_2, \ldots, b_m) = 1$ and $x_2(\Gamma, b_2, \ldots, b_m) = 1$. Similarly, we can then increase $b_2$ and we obtain $x_1(\Gamma, \Gamma, b_3, \ldots, b_m) = 1$, $x_2(\Gamma, \Gamma, b_3, \ldots, b_m) = 1$ and $p(\Gamma, \Gamma, b_3, \ldots, b_m) = p(\bfb)$. Next, we reduce all remaining bids to zero one by one. Repeatedly applying Lemma~\ref{lemma:paychangeslow2} and observing that $\Gamma$ is sufficiently large, we have that $x_1(\bfc) = x_2(\bfc) = 1$, and the payment increases by $\sum_{i = 3}^m b_i$ at most, so $p(\bfc) \leq p(\bfb) + \sum_{i = 3}^m b_i < |\bfb|_1$. Without loss of generality, we may henceforth assume that $m > B$. If not, that is, if $m < B$, we can always add $0$ bids one by one until there are at least $B+1$ bids --- we claim that this does not change the miner's utility nor user $1$ or $2$'s confirmation status and payment. To see this, notice that adding or removing a $0$-bid is free of charge for the miner or a miner-user coalition. Therefore, adding or removing a $0$-bid should not change the joint utility of the miner and user $1$ by $1$-weak-SCP. This implies that user $2$'s confirmation status and payment should not change, since otherwise, user $2$'s utility would change, and thus the joint utility of the miner and users $1$ and $2$ would change. This means that the coalition of the miner and users $1$ and $2$ can cheat by adding or removing a $0$-bid to increase their joint utility, thus violating $2$-weak-SCP. By a symmetric argument, user $1$'s confirmation status or payment should not change either. Now, since the joint utility of the miner and user $1$ should not change due to adding or removing a $0$-bid, the miner's utility should be unaffected too. \ignore{ To see this, suppose adding a $0$-bid to $\bfc$ changes the miner's utility. Suppose the miner's utility decreases. Then, suppose the actual bid is actually $\bfc || 0$, the miner can simply remove the $0$ to increase its utility, which violates weak MIC. \Hao{we use MIC here. Need to change theorem statement?} Similarly, we can argue that the miner's utility does not increase. Now, suppose that adding a $0$-bid changes user $1$'s confirmation status or payment --- since miner's utility does not change, this means that adding a $0$-bid changes the utility of the coalition of the miner and user $1$. Using a similar argument but now for the miner-user coalition, we can rule this out, too, due to $1$-weak-SCP. } Now, we consider another bid vector $\bfd = (d_1,d_2,\ldots,d_m)$, where $d_i = \Gamma$ for all $i\in [B + 1]$ and $d_i = 0$ for $i > B+1$. We are going to show that $x_i(\bfd) = 1$ for all $i \in [B+1]$ --- note that this is sufficient for reaching a contradiction since the block size is only $B$. To see this, we start from $\bfc$, and increase the bids of each user $j \in \{3, \ldots, m\}$ one by one. Intuitively, Lemma~\ref{lemma:paychangeslow} guarantees that if the payment grows at all during the process, it must grow slower than the increase in a user's bid, so at some point, user $j$'s bid will catch up with the payment, as long as there is still a large enough gap left between $\Gamma$ and the payment. Formally, since $\Gamma - p(\bfc) > 2|\bfb|_1$, by Lemma~\ref{lemma:paychangeslow}, it must be that $p(\Gamma, \Gamma, 2|\bfb|_1,0,\ldots,0) \leq p(\bfc) + |\bfb|_1 < 2|\bfb|_1$, and $x_3(\Gamma, \Gamma, 2|\bfb|_1,0,\ldots,0) = 1$. We now further increase user $3$'s bid to $\Gamma$, and by Lemma~\ref{lemma:confirmInvariant}, users $1$ to $3$ remain confirmed and $p(\Gamma, \Gamma,\Gamma, 0,\ldots,0) < 2|\bfb|_1$. By the same reasoning, since $\Gamma - p(\Gamma, \Gamma,\Gamma, 0,\ldots,0) > 4 |\bfb|_1$, by Lemma~\ref{lemma:paychangeslow}, it must be that $p(\Gamma, \Gamma, \Gamma, 4|\bfb|_1 ,\ldots,0) \leq p(\Gamma, \Gamma,\Gamma, 0,\ldots,0) + 2|\bfb|_1 < 4|\bfb|_1$, and $x_4(\Gamma, \Gamma, \Gamma, 4|\bfb|_1,0,\ldots,0) = 1$. Therefore, $p(\Gamma, \Gamma, \Gamma, \Gamma, 0,\ldots,0) < 4|\bfb|_1$. We can now repeat this process and raise the bid of each user $i \in [B+1]$ to $\Gamma$. It is not hard to check that our choice of $\Gamma$ is sufficiently large for the reasoning to go through in all steps. \ignore{ \elaine{TO FIX: why is m greater than B?} In this case, each user has the utility at least $3|\bfb|_1$. Let $\tau$ denote the user's utility when the bid vector is $\bfd$. Finally, imagine that there are $B+1$ users, each with a bid $\Gamma$. No matter what the inclusion rule is, there must be a user cannot be included and gets the utility zero. In expectation, user $i$'s bid is chosen by a honest miner is at most $B/(B+1)$, so the expected utility is $\frac{B}{B+1} \cdot \tau$. The miner can sign a contract with user $i$, and guarantees that user $i$'s bid is included. In this case, miner's utility is still $\mu(\bfd)$, while user $i$'s utility becomes $\tau$. This violates $2$-weak-SCP. } \section*{Acknowledgments} We gratefully acknowledge helpful technical discussions with Kai-Min Chung during an early phase of the project. We also thank T-H. Hubert Chan for insightful technical discussions. \bibliographystyle{alpha} \section{Impossibility Results} \label{sec:impossible} \subsection{Simplified Notation and Restricted Strategy Space for our Impossibility} \label{sec:imp-notation} To rule out the existence of a UIC and 1-SCP mechanism under finite block size, our proof takes two main steps. First, we shall prove that any TFM that satisfies UIC and 1-SCP simultaneously must always have $0$ miner-revenue (Theorem~\ref{theorem:deterministic} and \ref{theorem:randomized}), no matter whether the block size is infinite or finite. These theorems hold even when the strategic player is onfined to a very restricted strategy space: assuming that the miner always implements the mechanism faithfully; however, either an individual user or a user colluding with the miner may bid untruthfully. In the second part of the proof, we additionally throw in the finite block size restriction which leads to the stated impossibility result (Corollary~\ref{cor:finiteblocksize}). \paragraph{Simplified notations for deterministic mechanisms.} We can simplify the notation in the first part of our proof, since this part makes use of a very restricted strategy space as mentioned above. Instead of using the full tuple $(\ensuremath{{\bf I}}\xspace, \ensuremath{{\bf C}}\xspace, \ensuremath{{\bf P}}\xspace, \ensuremath{{\bf M}\xspace)$ to denote the TFM, we will use the following simplified notation: \begin{enumerate}[leftmargin=5mm] \item {\bf Allocation rule} ${\bf x}$: given a bid vector ${\bf b} := (b_1, \ldots, b_m) \in \ensuremath{\mathbb{R}}^m$, the allocation rule ${\bf x}({\bf b})$ outputs a vector $(x_1, x_2, \ldots, x_m) \in \{0, 1\}^m$, indicating whether each transaction (i.e., bid) in ${\bf b}$ is {\it confirmed} in the next block. \item {\bf Payment rule} ${\bf p}$: given a bid vector ${\bf b} := (b_1, \ldots, b_m) \in \ensuremath{\mathbb{R}}^m$, the payment rule ${\bf p}({\bf b})$ outputs a vector $(p_1, p_2, \ldots, p_m) \in \ensuremath{\mathbb{R}}^m$, indicating the price paid by each transaction in ${\bf b}$. It is guaranteed that $p_i \leq b_i$ for $i \in [m]$, i.e., a user never pays more than its bid. \item {\bf Miner-revenue} rule ${\mu}$: given a bid vector ${\bf b} := (b_1, \ldots, b_m) \in \ensuremath{\mathbb{R}}^m$, the miner-revenue rule $\mu(\bfb)$ outputs a single value in $\ensuremath{\mathbb{R}}$ denoting the amount paid to the miner. \end{enumerate} More specifically, one can view: \begin{itemize}[leftmargin=5mm,itemsep=1pt] \item $\bfx$ as the composition of the inclusion rule $\ensuremath{{\bf I}}\xspace$ and the blockchain-enforced confirmation rule $\ensuremath{{\bf C}}\xspace$; \item $\bfp$ as the composition of the inclusion rule $\ensuremath{{\bf I}}\xspace$ and the blockchain-enforced payment rule $\ensuremath{{\bf P}}\xspace$; and \item $\mu$ as the composition of the inclusion rule $\ensuremath{{\bf I}}\xspace$ and the blockchain-enforced miner-revenue rule $\ensuremath{{\bf M}\xspace$. \end{itemize} \paragraph{Additional notations.} For convenience, we often use the notation $x_i({\bf b})$ and $p_i({\bf b})$ to denote whether the $i$-th transaction in ${\bf b}$ is confirmed in the next mined block, and what price it actually pays. We assume that if $x_i({\bf b}) = 0$, then, $p_i({\bf b}) = 0$ --- in other words, if the $i$-th transaction is not confirmed in the next block, then the $i$-th user pays nothing. Let $\bfb = (b_1, b_2, \ldots, b_m)$ be a bid vector. We often use the notation $\bfb_{-i} = (b_1, b_2, \ldots, b_{i-1}, b_{i+1}, \ldots, b_m)$ to denote everyone except user $i$'s bids; and the notation $(\bfb_{-i}, b_i)$ and $\bfb$ are used interchangeably. \paragraph{Notations for randomized mechanisms.} We use the same notations $({\bf x}, {\bf p}, \mu)$ to denote a randomized mechanism but their meaning is modified as follows. The allocation rule now outputs the probability that each bid is confirmed, that is, $x_i(\bfb) \in [0,1]$ is the probability that user $i$'s bid is confirmed given the included bids are $\bfb$. Also, we view $p_i(\bfb)$ as the expected payment of user $i$ and $\mu(\bfb)$ as the expected miner-revenue. \elaine{TODO: move this to defn section in the end.} \ignore{ \begin{itemize \item {\bf Burning rule} ${\bf q}$: given a bid vector ${\bf b} := (b_1, \ldots, b_m) \in \ensuremath{\mathbb{R}}^m$, the burning rule ${\bf q}({\bf b})$ outputs a vector $(q_1, q_2, \ldots, q_m) \in \ensuremath{\mathbb{R}}^m$, indicating the amount of currency being destroyed. \end{itemize} } We say that a TFM enjoys {\it non-trivial miner revenue} iff $\mu(\cdot)$ is not the constant $0$ function, i.e., the miner sometimes can receive positive revenue. \subsection{Preliminary: Myerson's Lemma} \label{sec:myerson} If a single-parameter TFM satisfies UIC (even when the user's strategy space is restricted only to untruthful bidding), the mechanism's allocation rule ${\bf x}$ and payment rule ${\bf p}$ must satisfy the famous Myerson's Lemma~\cite{myerson}. \ignore{ Note that our UIC notion adopts a richer strategy space than the classical notion of Dominant Strategy Incentive Compatible (DSIC) --- we consider untruthful bidding and injecting fake bids as possible strategic deviations, whereas the traditional DSIC notion considers only untruthful bidding. The enriched strategy space makes the mechanism design harder, and therefore Myerson's Lemma should still apply just like for traditional, single-parameter, DSIC auctions. } Specifically, we only need a special case of Myerson's Lemma: the mechanism can be randomized, and each user's bid is either confirmed or unconfirmed. In this case, the allocation rule $x_i$ returns a real number in $[0,1]$, which is the probability that user $i$'s bid is confirmed. Additionally, $p_i$ is the expected payment of user $i$. \ignore{ Consider a single-parameter auction defined by the pair $({\bf x}, {\bf p})$. } Myerson's Lemma implies the following: \begin{lemma}[Myerson's Lemma] Let $({\bf x}, {\bf p}, \mu)$ be a single-parameter TFM that is UIC. Then, it must be that \begin{enumerate}[leftmargin=5mm] \item The allocation rule ${\bf x}$ is {\it monotone}, where monotone is defined as follows. Consider ${\bf b} := (b_1, \ldots, b_m)$, and let ${\bf b}_{-i}$ be the vector obtained when we remove $b_i$ from ${\bf b}$. An allocation rule ${\bf x}$ is said to be monotone iff for any ${\bf b} := (b_1, \ldots, b_m)$, and any $b'_i > b_i$, it must be that $x_i({\bf b}_{-i}, b'_i) \geq x_i({\bf b}_{-i}, b_i)$. \item The payment rule ${\bf p}$ is defined as follows. For any user $i$, bids $\bfb_{-i}$ from other users, and bid $b_i$ from user $i$, it must be \begin{equation}\label{eq:payment} p_i(\bfb_{-i}, b_i) = b_i \cdot x_i(\bfb_{-i}, b_i) - \int_0^{b_i} x_i(\bfb_{-i}, t) dt. \end{equation} \end{enumerate} \label{lem:myerson} \end{lemma} \ignore{ Fix an allocation rule ${\bf x}$, if there is a corresponding payment rule ${\bf p}$ such that the TFM $({\bf x}, {\bf p}, \_)$ is UIC, then we say that ${\bf x}$ is {\it implementable} (note that we do not care about \begin{lemma}[Myerson's Lemma] Myerson's lemma characterizes the space of DSIC auctions. Let $({\bf x}, {\bf p})$ a single-parameter auction where ${\bf x}$ gives binary outcomes. Then, \begin{enumerate}[leftmargin=5mm] \item The allocation rule ${\bf x}$ is implementable iff ${\bf x}$ is {\it monotone}, where monotone is defined as follows. Consider ${\bf b} := (b_1, \ldots, b_m)$, and let ${\bf b}_{-i}$ be the vector obtained when we remove $b_i$ from ${\bf b}$. An allocation rule ${\bf x}$ is said to be monotone iff for any ${\bf b} := (b_1, \ldots, b_m)$, and any $b'_i > b_i$, it must be that $x_i({\bf b}_{-i}, b'_i) \geq x_i({\bf b}_{-i}, b_i)$. \item If ${\bf x}$ is implementable, then there is a unique payment rule ${\bf p}$ that makes the auction DSIC, and moreover this ${\bf p}$ is defined as follows. For any user $i$, bids $\bfb_{-i}$ from other users, and bid $b_i$ from user $i$, it must be \begin{equation}\label{eq:payment} p_i(\bfb_{-i}, b_i) = b_i \cdot x_i(\bfb_{-i}, b_i) - \int_0^{b_i} x_i(\bfb_{-i}, t) dt. \end{equation} \end{enumerate} \label{lem:myerson} \end{lemma} } \paragraph{Deterministic special case.} When the mechanism is deterministic, the allocation rule $x_i$ returns either $0$ or $1$. In this case, the unique payment rule can be simplified as \[ p_i(\bfb_{-i}, b_i) = \left\{\begin{matrix} \min \{z \in [0, b_i]: x_i(\bfb_{-i}, z) = 1\}& \text{ if $x_i(\bfb_{-i}, b_i) = 1$,} \\ 0& \text{ if $x_i(\bfb_{-i}, b_i) = 0$.} \end{matrix}\right. \] Conceptually, user $i$ only needs to pay the minimal price which makes its bid confirmed. To prove our impossibility for randomized mechanisms, we need to open up Myerson's Lemma and use the following technical lemma that is used in the proof of Myerson's Lemma. More specifically, the proof of Myerson's Lemma showed that if a mechanism is UIC, then a user $i$'s payment must satisfy the following inequality (also called a ``payment sandwich'') where the allocation rule ${\bf x}$ is monotone: \[ r \cdot \left(x_i(\bfb_{-i}, r') - x_i(\bfb_{-i},r)\right) \leq p({\bfb_{-i}}, r') - p({\bfb_{-i}}, r) \leq r' \cdot \left(x_i(\bfb_{-i}, r') - x_i(\bfb_{-i},r)\right) \] Assume that the above payment sandwich holds for a non-decreasing function $x_i(\bfb_{-i}, \cdot)$, and moreover, $p(\bfb_{-i}, 0) = 0$, then Myerson showed that the payment rule is of a unique form as shown in Equation~(\ref{eq:payment}). To prove this, Myerson essentially proved the following technical lemma. \begin{lemma}[Technical lemma implied by the proof of Myerson's Lemma~\cite{myerson,myerson-lecture-hartline}] Let $f(z)$ be a non-decreasing function. Suppose that $ z \cdot (f(z')-f(z)) \leq g(z') - g(z) \leq z' \cdot (f(z')-f(z)) $ for any $z' \geq z \geq 0$, and moreover, $g(0) = 0$. Then, it must be that \[ g(z) = z \cdot f(z) - \int_0^{z} f(t) dt. \] \label{lem:sandwich} \end{lemma} \subsection{Deterministic Mechanisms: UIC + 1-SCP $\Longrightarrow$ Zero Miner Revenue} \label{sec:trivial-miner-rev} As a warmup, we first prove a lower bound for deterministic mechanisms. Then, in Section~\ref{sec:randomized-lb}, we generalize the proof to randomized mechanisms. The following theorem states that no deterministic TFM with non-trivial miner revenue can achieve UIC and $1$-SCP simultaneously, no matter whether the block size is finite or infinite. \begin{theorem}[Deterministic TFM: UIC + 1-SCP $\Longrightarrow$ 0 miner revenue] \label{theorem:deterministic} There is no deterministic TFM with non-trivial miner revenue that achieves UIC and $1$-SCP at the same time. Moreover, the theorem holds no matter whether the block size is finite or infinite. \end{theorem} The rest of this section will be dedicated to proving the theorem. The following claim states that if an individual user changes its bid in a way that does not affect whether it is confirmed, then the miner's revenue should not change. \begin{claim} Suppose that a TFM $({\bf x}, {\bf p}, \mu)$ satisfies UIC and 1-SCP. Suppose that $x_i(\bfb_{-i}, b_i) = x_i(\bfb_{-i}, b'_i)$. Then, it must be that $\mu(\bfb_{-i}, b_i) = \mu(\bfb_{-i}, b'_i)$. \label{clm:inconsequentialbidchange} \end{claim} \begin{proof} Since the TFM satisfies UIC, the tuple $(\bfx, \bfp)$ satisfies Myerson's Lemma. We know that $x_i(\bfb_{-i}, b_i) = x_i(\bfb_{-i}, b'_i) = 0$ or $x_i(\bfb_{-i}, b_i) = x_i(\bfb_{-i}, b'_i) = 1$. In the former case, $p_i(\bfb_{-i}, b_i) = p_i(\bfb_{-i}, b'_i) = 0$. In the latter case, by Myerson's Lemma, no matter whether user $i$'s bid is $b_i$ or $b'_i$, its payment equals the minimal amount it bids that still allows the transaction to be confirmed. Therefore, in either case, we have that $p_i(\bfb_{-i}, b_i) = p_i(\bfb_{-i}, b'_i)$. Suppose that $\mu_i(\bfb_{-i}, b_i) \neq \mu_i(\bfb_{-i}, b'_i)$. Without loss of generality, we may assume that $\mu_i(\bfb_{-i}, b'_i) > \mu_i(\bfb_{-i}, b_i)$. In this case, imagine that all users' true values are represented by the vector $(\bfb_{-i}, b_i)$. Now, consider the coalition of the miner and user $i$. If user $i$ bids $b_i$ truthfully, the coalition's joint utility is $U := \mu(\bfb_{-i}, b_i) + b_i - p_i(\bfb_{-i}, b_i)$. However, if user $i$' strategically bids $b'_i$ instead, the coalition's joint utility is $U' := \mu(\bfb_{-i}, b'_i) + b_i - p_i(\bfb_{-i}, b'_i)$. Since $p_i(\bfb_{-i}, b_i) = p_i(\bfb_{-i}, b'_i)$, $U' - U = \mu(\bfb_{-i}, b'_i) - \mu(\bfb_{-i}, b_i) > 0$. This shows that the coalition can gain if user $i$ bids untruthfully, thus violating $1$-SCP. \end{proof} \begin{lemma} Let $({\bf x}, {\bf p}, \mu)$ be any TFM with non-trivial miner revenue. Then, there exists a bid vector $\bfb = (b_1,\ldots,b_m)$ and a user $i$ such that $\mu(\bfb_{-i},0) < \mu(\bfb)$. \label{lem:decrease} \end{lemma} \begin{proof} Since the mechanism enjoys non-trivial miner revenue, there exists a bid vector $\bfb^{(0)} = (b_1,\ldots,b_m)$ such that $\mu(\bfb^{(0)}) > 0$. Now, consider the following sequence of bid vectors: for $i \in [m]$, let $\bfb^{(i)}$ be obtained by setting the first $i$ coordinates of $\bfb^{(0)}$ to $0$. Observe that $\bfb^{(m)} = {\bf 0}$. Since a user can pay at most its bid, we have $\mu(\bfb) \leq |\bfp(\bfb)|_1 \leq |\bfb|_1$ for any bid vector $\bfb$. Therefore, $\mu(\bfb^{(m)}) \leq |\bfb^{(m)}|_1 = 0$. Since $\mu(\bfb^{(0)}) > 0$, there exists an $i\in [m-1]$ such that $0 = \mu(\bfb^{(i)}) < \mu(\bfb^{(i-1)})$. \end{proof} \begin{lemma} If there exists a bid vector $\bfb = (b_1,\ldots,b_m)$ and a user $i$ such that $\mu(\bfb_{-i}, 0) < \mu(\bfb)$, then the TFM $({\bf x}, {\bf p}, \mu)$ is either not UIC or not 1-SCP. \label{lem:nodecrease} \end{lemma} \begin{proof} For the sake of reaching a contradiction, suppose that $({\bf x}, {\bf p}, \mu)$ is both UIC and 1-SCP. By Myerson's Lemma, we have $x_i(\bfb_{-i}, 0) \leq x_i(\bfb)$. Due to Claim~\ref{clm:inconsequentialbidchange}, it must be $x_i(\bfb_{-i}, 0) = 0$ and $x_i(\bfb) = 1$. Let $\Delta = \mu(\bfb) - \mu(\bfb_{-i}, 0) > 0$ and $\epsilon = \frac{1}{2} \cdot \min(\Delta, p_i(\bfb)) > 0$. Imagine that everyone else except user $i$ is bidding $\bfb_{-i}$, and user $i$'s true value is $v_i = p_i(\bfb) - \epsilon > 0$. Due to Myerson's Lemma, since $v_i < p_i(\bfb)$, user $i$'s bid would be unconfirmed if it were to bid truthfully. In this case, by Claim~\ref{clm:inconsequentialbidchange}, the miner's utility is $\mu(\bfb_{-i}, 0)$ and user $i$'s utility is zero. However, the miner can sign a side contract and ask user $i$ to bid $p_i(\bfb)$ instead. By Myerson's Lemma, at this moment, user $i$'s bid will indeed be confirmed. By Claim~\ref{clm:inconsequentialbidchange}, the miner's utility is now $\mu(\bfb)$ and user $i$'s utility is now $v_i - p_i(\bfb) = -\epsilon$. Consequently, their joint utility becomes $\mu(\bfb) - \epsilon$, which has increased by $\Delta - \epsilon > 0$. This violates 1-SCP. \end{proof} \paragraph{Proof of Theorem~\ref{theorem:deterministic}.} Theorem~\ref{theorem:deterministic} follows directly from the combination of Lemma~\ref{lem:decrease} and Lemma~\ref{lem:nodecrease}. \subsection{Randomized Mechanisms: UIC + 1-SCP $\Longrightarrow$ Zero Miner Revenue} \label{sec:randomized-lb} We now generalize Theorem~\ref{theorem:deterministic} to even randomized mechanisms. In a randomized TFM, the random coins could come from either the miner or the blockchain itself. Since we are proving an impossibility, without loss of generality, we may assume that the blockchain comes with an unpredictable random source. Our impossibility result actually does not care where the random coins come from. Earlier in Section~\ref{sec:roadmap-main-lb}, we presented the intuition for this impossiblity. Therefore, below, we directly jump to the formal description. \paragraph{Notations for randomized mechanisms.} Recall that for randomized mechanisms, the allocation rule now outputs the probability that each bid is confirmed; that is, $x_i(\bfb) \in [0,1]$ is the probability that user $i$'s bid is confirmed given the included bids are $\bfb$. Also, $p_i(\bfb)$ is now the expected payment of user $i$ and $\mu(\bfb)$ is the expected miner-revenue. \elaine{moved a bunch of text to roadmap} For convenience, we define the following quantity: $$ \pi_{\bfb_{-i}}(r) = p_i(\bfb_{-i},r) - \mu(\bfb_{-i},r) $$ One can think of $\pi_{\bfb_{-i}}(r)$ as a virtual user $i$'s payment in the virtual auction (see Section~\ref{sec:roadmap-main-lb}). The following theorem is a generalization of Theorem~\ref{theorem:deterministic} to even randomized mechanisms. \begin{theorem}[Randomized TFM: UIC + 1-SCP $\Longrightarrow$ 0 miner revenue] \label{theorem:randomized} There is no randomized TFM with non-trivial miner revenue that achieves UIC and $1$-SCP at the same time. Moreover, the theorem holds no matter whether the block size is finite or infinite. \end{theorem} We will now prove this theorem. First, we introduce a useful lemma. \begin{lemma}\label{lemma:randomInequality} Let $({\bf x}, {\bf p}, \mu)$ be any randomized TFM. If $({\bf x}, {\bf p}, \mu)$ is 1-SCP, then, for any bid vector $\bfb$, user $i$, and $r, r'$ such that $r < r'$, it must be \[ r \cdot \left(x_i(\bfb_{-i}, r') - x_i(\bfb_{-i},r)\right) \leq \pi_{\bfb_{-i}}(r') - \pi_{\bfb_{-i}}(r) \leq r' \cdot \left(x_i(\bfb_{-i}, r') - x_i(\bfb_{-i},r)\right). \] \end{lemma} \begin{proof} First, we prove the case of $r \cdot \left(x_i(\bfb_{-i}, r') - x_i(\bfb_{-i},r)\right) \leq \pi_{\bfb_{-i}}(r') - \pi_{\bfb_{-i}}(r)$. For the sake of reaching a contradiction, suppose there exists a vector $\bfb$, a user $i$ and $r < r'$ such that \begin{equation}\label{eq:sidecontract} r \cdot \left(x_i(\bfb_{-i}, r') - x_i(\bfb_{-i},r)\right) > \pi_{\bfb_{-i}}(r') - \pi_{\bfb_{-i}}(r). \end{equation} Imagine that the real bid vector is $(\bfb_{-i}, r)$ and user $i$'s true value is $r$. If they do not have a side contract, the miner's expected utility is $\mu(\bfb_{-i},r)$ and user $i$'s expected utility is $r\cdot x_i(\bfb_{-i},r) - p_i(\bfb_{-i},r)$. However, the miner can sign a contract with user $i$ and ask user $i$ to bid $r'$ instead. In this case, the miner's expected utility becomes $\mu(\bfb_{-i},r')$ and user $i$'s expected utility becomes $r\cdot x_i(\bfb_{-i},r') - p_i(\bfb_{-i},r')$ since the user's true value is still $r$. By Eq.(\ref{eq:sidecontract}), their joint expected utility increases by $r \cdot \left(x_i(\bfb_{-i}, r') - x_i(\bfb_{-i},r)\right) - (\pi_i(\bfb_{-i},r') - \pi_i(\bfb_{-i},r)) > 0$. This violates 1-SCP. The other case $\pi_{\bfb_{-i}}(r') - \pi_{\bfb_{-i}}(r) \leq r' \cdot \left(x_i(\bfb_{-i}, r') - x_i(\bfb_{-i},r)\right)$ can be proven by a similar argument, so we only sketch the proof. Suppose the inequality does not hold, that is, suppose that $\pi_{\bfb_{-i}}(r') - \pi_{\bfb_{-i}}(r) > r' \cdot \left(x_i(\bfb_{-i}, r') - x_i(\bfb_{-i},r)\right)$. Imagine that the real bid vector is $(\bfb_{-i}, r')$ and user $i$'s true value is $r'$. The miner can sign a contract with user $i$ and ask user $i$ to bid $r$ instead. In this case, their joint expected utility increases by $\pi_{\bfb_{-i}}(r') - \pi_{\bfb_{-i}}(r) - r' \cdot \left(x_i(\bfb_{-i}, r') - x_i(\bfb_{-i},r)\right) > 0$. This violates 1-SCP. \end{proof} \paragraph{Proof of Theorem~\ref{theorem:randomized}} We now continue with the proof of Theorem~\ref{theorem:randomized}. Consider the following quantity: $$ \widetilde{\pi}_{\bfb_{-i}}(r) = p_i(\bfb_{-i},r) - \mu(\bfb_{-i},r) - (p_i(\bfb_{-i},0) - \mu(\bfb_{-i},0)) $$ By Lemma~\ref{lemma:randomInequality}, and the fact that definition of $\widetilde{\pi}_{\bfb_{-i}}(r)$ and ${\pi}_{\bfb_{-i}}(r)$ differs by only a fixed constant, it must be that \begin{equation} r \cdot \left(x_i(\bfb_{-i}, r') - x_i(\bfb_{-i},r)\right) \leq \widetilde{\pi}_{\bfb_{-i}}(r') - \widetilde{\pi}_{\bfb_{-i}}(r) \leq r' \cdot \left(x_i(\bfb_{-i}, r') - x_i(\bfb_{-i},r)\right). \label{eqn:sandwich} \end{equation} Now, observe that the above expression exactly agrees with the ``payment sandwich'' in the proof of Myerson's Lemma~\cite{myerson,myerson-lecture-hartline}. Furthermore, we have that $\widetilde{\pi}_{\bfb_{-i}}(0) = 0$ by definition; and ${\bf x}$ must be monotone because the TFM is UIC and satisfies Myerson's Lemma. Due to Lemma~\ref{lem:sandwich}, it must be that $\widetilde{\pi}_{\bfb_{-i}}(\cdot)$ obeys the unique payment rule specified by Myerson's Lemma, that is, \[ \widetilde{\pi}_{\bfb_{-i}}(r) = b_i \cdot x_i(\bfb_{-i}, b_i) - \int_0^{b_i} x_i(\bfb_{-i}, t) dt. \] On the other hand, since the TFM is UIC, its payment rule itself must also satisfy the same expression, that is, \[ p_i(\bfb_{-i}, r) = b_i \cdot x_i(\bfb_{-i}, b_i) - \int_0^{b_i} x_i(\bfb_{-i}, t) dt. \] We therefore have that \[ \widetilde{\pi}_{\bfb_{-i}}(r) = p_i(\bfb_{-i},r) - \mu(\bfb_{-i},r) - (p_i(\bfb_{-i},0) - \mu(\bfb_{-i},0)) = p_i(\bfb_{-i}, r) \] In other words, $\mu(\bfb_{-i},r) = \mu(\bfb_{-i},0) - p(\bfb_{-i},0)$, which is a constant that is independent of user $i$'s bid $r$ when $\bfb_{-i}$ is fixed. We now argue that this actually implies $\mu(\bfb_{-i},r) = 0$, i.e., a possibly randomized TFM that is UIC and 1-SCP must always have 0 miner revenue. Suppose this is not true, i.e., suppose there exists a randomized TFM with non-trivial miner revenue $(\bfx, \bfp, \mu)$ that is UIC and $1$-SCP. Since it enjoys non-trivial miner revenue, there exists a bid vector $\bfb^{(0)} = (b_1,\ldots,b_m)$ such that $\mu(\bfb^{(0)}) > 0$. Now, consider the following sequence of bid vectors: for $i \in [m]$, let $\bfb^{(i)}$ be obtained by setting the first $i$ coordinates of $\bfb^{(0)}$ to $0$. Observe that $\bfb^{(m)} = {\bf 0}$. Recall that we have argued for a fixed $\bfb_{-i}$, the miner revenue $\mu(\bfb_{-i}, \cdot)$, is a constant function independent of user $i$'s bid. Thus, $\mu(\bfb^{(i-1)}) = \mu(\bfb^{(i)})$ for all $i \in [m]$. Consequently, we obtain $\mu(\bfb^{(0)}) = \mu(\bfb^{(m)})$. However, users can only pay their bids at most, so we have $\mu(\bfb^{(m)}) \leq |\bfb^{(m)}|_1 = 0$. This contradicts the assumption that $\mu(\bfb^{(0)}) > 0$. \ignore{ \subsection{Old Proof} We will now prove this theorem. First, we introduce some useful lemmas. \begin{lemma}\label{lemma:randomInequality} Let $({\bf x}, {\bf p}, \mu)$ be any randomized TFM. If $({\bf x}, {\bf p}, \mu)$ is 1-SCP, then, \elaine{i removed UIC, you don't need UIC here.} for any bid vector $\bfb$, user $i$, and $r, r'$ such that $r < r'$, it must be \[ r \cdot \left(x_i(\bfb_{-i}, r') - x_i(\bfb_{-i},r)\right) \leq \pi_{\bfb_{-i}}(r) - \pi_{\bfb_{-i}}(r') \leq r' \cdot \left(x_i(\bfb_{-i}, r') - x_i(\bfb_{-i},r)\right). \] \end{lemma} \begin{proof} First, we prove the case of $r \cdot \left(x_i(\bfb_{-i}, r') - x_i(\bfb_{-i},r)\right) \leq \pi_{\bfb_{-i}}(r) - \pi_{\bfb_{-i}}(r')$. For the sake of reaching a contradiction, suppose there exists a vector $\bfb$, a user $i$ and $r < r'$ such that \begin{equation}\label{eq:sidecontract} r \cdot \left(x_i(\bfb_{-i}, r') - x_i(\bfb_{-i},r)\right) > \pi_{\bfb_{-i}}(r) - \pi_{\bfb_{-i}}(r'). \end{equation} Imagine that the real bid vector is $(\bfb_{-i}, r)$ and user $i$'s true value is $r$. If they do not have a side contract, the miner's expected utility is $\mu(\bfb_{-i},r)$ and user $i$'s expected utility is $r\cdot x_i(\bfb_{-i},r) - p_i(\bfb_{-i},r)$. However, the miner can sign a contract with user $i$ and ask user $i$ to bid $r'$ instead. In this case, the miner's expected utility becomes $\mu(\bfb_{-i},r')$ and user $i$'s expected utility becomes $r\cdot x_i(\bfb_{-i},r') - p_i(\bfb_{-i},r')$ (note that user's true value does not change). By Eq.(\ref{eq:sidecontract}), their joint expected utility increases by $r \cdot \left(x_i(\bfb_{-i}, r') - x_i(\bfb_{-i},r)\right) - \pi_{\bfb_{-i}}(r) + \pi_{\bfb_{-i}}(r') > 0$. This violates 1-SCP. The case of $\pi_{\bfb_{-i}}(r) - \pi_{\bfb_{-i}}(r') \leq r' \cdot \left(x_i(\bfb_{-i}, r') - x_i(\bfb_{-i},r)\right)$ can be proven by a similar argument, so we only sketch the proof. Suppose the inequality does not hold, that is, suppose that $\pi_{\bfb_{-i}}(r) - \pi_{\bfb_{-i}}(r') > r' \cdot \left(x_i(\bfb_{-i}, r') - x_i(\bfb_{-i},r)\right)$. Imagine that the real bid vector is $(\bfb_{-i}, r')$ and user $i$'s true value is $r'$. The miner can sign a contract with user $i$ and ask user $i$ to bid $r$ instead. In this case, their joint expected utility increases by $\pi_{\bfb_{-i}}(r) - \pi_{\bfb_{-i}}(r') - r' \cdot \left(x_i(\bfb_{-i}, r') - x_i(\bfb_{-i},r)\right) > 0$. This violates 1-SCP. \end{proof} \begin{lemma}[Technical Lemma]\label{lemma:monomain} Let $f:[0,\infty] \rightarrow [0,\infty]$ be a non-decreasing function. If $g:[0,\infty] \rightarrow [0,\infty]$ is a function satisfying \[ a \cdot (f(b) - f(a)) \leq g(a) - g(b) \leq b \cdot (f(b) - f(a)) \] for any $0 \leq a < b$, then, it must be \[ g(a) - g(b) = b \cdot f(b) - a \cdot f(a) - \int_a^b f(x) dx. \] \end{lemma} \begin{proof} The complete proof of this technical lemma is given in Section~\ref{sec:monotonicFunc}. \end{proof} \begin{lemma}\label{lemma:randomEquality} Let $({\bf x}, {\bf p}, \mu)$ be any randomized TFM. If $({\bf x}, {\bf p}, \mu)$ is UIC and 1-SCP, then, for any bid vector $\bfb$, user $i$, and $r, r'$ such that $r < r'$, it must be \[ \pi_{\bfb_{-i}}(r) - \pi_{\bfb_{-i}}(r') = p_i(\bfb_{-i},r') - p_i(\bfb_{-i},r). \] Equivalently, it must be \[ \mu(\bfb_{-i},r) = \mu(\bfb_{-i},r'). \] \end{lemma} \begin{proof} Because $({\bf x}, {\bf p},\mu)$ is UIC, by Myerson's Lemma, $x_i(\bfb_{-i}, \cdot)$ is a non-decreasing function for any vector $\bfb$ and user $i$. Thus, by Lemma \ref{lemma:randomInequality} and Lemma \ref{lemma:monomain}, we have \[ \pi_{\bfb_{-i}}(r) - \pi_{\bfb_{-i}}(r') = r' \cdot x_i(\bfb_{-i}, r') - r \cdot x_i(\bfb_{-i}, r) - \int_r^{r'} x_i(\bfb_{-i}, x) dx. \] Now, by Myerson's Lemma, we know that the payment rule must be \[ p_i(\bfb_{-i}, r) = r\cdot x_i(\bfb_{-i}, r) - \int_0^r x_i(\bfb_{-i}, t)dt. \] Therefore, we have \[ \pi_{\bfb_{-i}}(r) - \pi_{\bfb_{-i}}(r') = p_i(\bfb_{-i},r') - p_i(\bfb_{-i},r). \] Recall that $\pi_{\bfb_{-i}}(r) = \mu(\bfb_{-i},r) - p_i(\bfb_{-i},r)$. Direct calculation shows that \[ \mu(\bfb_{-i},r) = \mu(\bfb_{-i},r'). \] \end{proof} \paragraph{Proof of Theorem \ref{theorem:randomized}} For the sake of reaching a contradiction, suppose there exists a randomized TFM with non-trivial miner revenue $(\bfx, \bfp, \mu)$ that is UIC and $1$-SCP. Because it enjoys non-trivial miner revenue, there exists a bid vector $\bfb^{(0)} = (b_1,\ldots,b_m)$ such that $\mu(\bfb^{(0)}) > 0$. Now, consider the following sequence of bid vectors: for $i \in [m]$, let $\bfb^{(i)}$ be obtained by setting the first $i$ coordinates of $\bfb^{(0)}$ to $0$. Observe that $\bfb^{(m)} = {\bf 0}$. By Lemma \ref{lemma:randomEquality}, we have $\mu(\bfb^{(i-1)}) = \mu(\bfb^{(i)})$ for all $i \in [m]$. Consequently, we obtain $\mu(\bfb^{(0)}) = \mu(\bfb^{(m)})$. However, users can only pay their bids at most, so we have $\mu(\bfb^{(m)}) \leq |\bfb^{(m)}|_1 = 0$. This contradicts the assumption that $\mu(\bfb^{(0)}) > 0$. } \subsection{UIC + 1-SCP + Finite Block Size $\Longrightarrow$ Impossibility} \label{sec:finite} \elaine{TODO: in roadmap, write about implication for eip1559} Theorem~\ref{theorem:randomized} holds no matter whether the block size is finite or infinite. In this section, we prove a corollary stating that if the block size is finite, then no non-trivial TFM can satisfy UIC and 1-SCP simultaneously. Particularly, assuming finite block size, the only TFM that satisfies both UIC and 1-SCP is the one that never confirms any transaction, and always pays the miner nothing. This corollary holds assuming the following strategic behavior is possible: an individual user or a user colluding with the miner can bid untruthfully; and the miner can arbitrarily decide which transactions to include in the block (as long as it respects the block's validity constraint). \begin{corollary}[UIC + 1-SCP + finite block size $\Longrightarrow$ impossibility] Suppose the size of a block is finite. Then, the only randomized TFM $(\bfx, \bfp, \mu)$ that satisfies both UIC and 1-SCP is the trivial mechanism that never confirms any transaction no matter how users bid, and always pays the miner nothing. \label{cor:finiteblocksize} \end{corollary} \begin{proof} For the sake of reaching a contradiction, suppose that there is a non-trivial TFM that satisfies UIC and 1-SCP. By Theorem~\ref{theorem:randomized}, any TFM that satisfies both UIC and 1-SCP must have constant zero miner revenue. Henceforth, we may assume that the miner always gets zero payment. Let $B$ denote an upper bound on the block size. Since the TFM is non-trivial, there exists a bid vector $\bfb = (b_1,\ldots,b_m)$ and a user $i^*$ such that $x_{i^*}(\bfb) > 0$. Now, let $\epsilon$ be any positive number, let $n > \frac{B \cdot (b_{i^*} + \epsilon)}{x_{i^*}(\bfb) \cdot \epsilon}$ be a sufficiently large integer. Consider another bid vector $\bfb' = (b_1,\ldots,b_m, b_{m+1}, \ldots, b_{m+n})$ where $b_j = b_{i^*} + \epsilon$ for all $j \in [m+1, m+n]$. Imagine that the real bid vector is actually $\bfb'$ and each user bids truthfully, i.e., user $j$'s true value is $v_j = b_j$ for all $j \in [m+n]$. Since the block size is at most $B$, there must be a user $j \in [m+1, m+n]$ who bids $b_j$ is included with probability at most $B/n < \frac{x_{i^*}(\bfb) \cdot \epsilon}{b_{i^*} + \epsilon}$. Consider the coalition of the miner and user $j$. If everyone bids truthfully and the miners runs the honest mechanism, then their joint utility is strictly less than $b_j \cdot \frac{B}{n} < (b_{i^*} + \epsilon) \cdot \frac{x_{i^*}(\bfb) \cdot \epsilon}{b_{i^*} + \epsilon} = x_{i^*}(\bfb) \cdot \epsilon$ --- since the miner always gets 0 revenue and user $j$'s utility is upper bounded by $b_j \cdot \frac{B}{n}$. However, the miner can sign a contract with user $j$. The contract asks user $j$ to change the bid from $b_j$ to $b_{i^*}$, and the miner pretends that the actual bid vector is $\bfb$, where the coordinate $b_{i^*}$ actually comes from user $j$. In this case, the coalition's joint utility is $(v_j - b_{i^*}) \cdot x_{i^*}(\bfb) = \epsilon \cdot x_{i^*}(\bfb)$. Therefore, the coalition can increase its expected utility by deviating. This violates $1$-SCP. \ignore{ Notice that the miner's on-chain revenue is always zero, no matter which bids are included in the block. However, the probability that user $j$'s bid is confirmed becomes $x_{i^*}(\bfb) > 0$. Notice that the user's payment is zero when the bid is not confirmed, and the payment is upper bounded by its bid when the bid is confirmed. Thus, the user's utility is zero when the bid is not confirm, and the utility is at least $v_j - b_{i^*} = \epsilon$ when the bid is confirmed. Consequently, user $j$'s expected utility is at least $x_{i^*}(\bfb) \cdot \epsilon > 0$. This violates 1-SCP. } \end{proof} \subsection{Burning Second-Price Mechanism} \label{sec:proof-burn2ndprice} Earlier in Section~\ref{sec:burn2ndprice}, we presented the burning second-price mechanism which can be parametrized with any $\gamma \in (0, 1]$ and $c \geq 1$. We now prove Theorem~\ref{thm:burn2ndprice}, that is, for any $c \geq 1$ and $\gamma \in (0, 1]$, the burning second-price auction satisfies UIC, MIC, and $c$-SCP under $\gamma$-strict utility. We prove the properties one by one. Throughout this proof, we assume the $\gamma$-strict utility notion. We may assume that $\gamma \in (0, 1]$, since if $\gamma = 0$, the burning second-price auction always confirms nothing and it trivially satisfies all these properties. \paragraph{UIC.} According to the utility definition for the user, any injected fake transaction cannot lead to an increase in the user's utility. Therefore, we may assume that the user does not inject any fake transactions, and the only strategic behavior is bidding untruthfully. Let $\bfb = (b_1,\cdots,b_m)$ be an arbitrary bid vector, where $b_1\geq\cdots \geq b_m$ and user $i$ bids truthfully (i.e.~$b_i = v_i$). \elaine{fixed some tie breaking issues.} Suppose $i \geq k+1$ and thus $b_i \leq b_{k+1}$. If user $i$ bids honestly, its utility is $0$ since it is unconfirmed. Imagine that user $i$ changes its bids to $b_i'$. There are two cases. First, user $i$'s new bid $b'_i$ is still not ranked among the top $k$ (possibly after the tie-breaking). In this case, its utility is either zero if $b'_i < v_i$ or negative if $b'_i > v_i$. Second, the new bid $b'_i$ is now ranked among the top $k$. We have $b'_i \geq b_{k+1}$. Further, user $i$'s utility becomes \[ (1 - \frac{\gamma}{c}) \cdot \gamma (b'_i - b_i) + \frac{\gamma}{c} \cdot (b_i - b_{k}), \] where the first term captures the cost if $b'_i$ is not confirmed, and the second term captures the cost if $b'_i$ is confirmed. Since $b'_i - b_i < 0$ and $b_i - b_{k} \leq 0$, its utility only decreases. \elaine{the 2nd ineuquality should be $\leq$.} The case of $i \leq k$ can be shown by a similar argument. In this case, if user $i$ bids honestly, it is among the top $k$, and its utility is at least $0$. Now, imagine user $i$ changes its bid to $b'_i$. There are two cases. First, if $b'_i$ cause user $i$ to be no longer among the top $k$, then its utility is $0$. Second, with the new bid $b'_i$, user $i$ is still among the top $k$. If it underbids its utility is the same as bidding honestly. If it overbids, its utility is the same as bidding honestly conditioned on it is confirmed, and its utility decreases by $\gamma (b'_i - b_i)$ conditioned on it is not confirmed. \Hao{I explain the case "with the new bid $b'_i$, user $i$ is still among the top $k$" more.} \Hao{We may need to add a remark that if the user's fake transaction has true value, then the spliting bid attack can happen. For example, a user with true value $10$ may want to bid $3,3,3$. Once three bids are all among the top $k$, it gets better chance to be confirmed (user wants ``at least'' one of them to be confirmed).} \paragraph{MIC.} A miner has two kinds of strategies to deviate from honest behavior: not to choose the highest bids and to inject fake bids. Without loss of generality, we assume that the miner chooses the included bids first, and then replaces some of the real bids with fake bids. We may also assume that all injected fake bids are included in the block. We will show that both steps would not increase the miner's utility. Let $(c_1,\ldots,c_B)$ be the highest $B$ bids in the bid vector, where $c_1 \geq \cdots \geq c_B$. The miner's revenue is $\gamma(c_{k+1} + \cdots + c_B)$. Now, suppose the miner does not choose the highest bids. Let $(d_1,\ldots,d_B)$ be the resulting bids, where $d_1 \geq \cdots \geq d_B$ --- we may assume that there are always infinitely many $0$-bids that are ``for free'', and the miner can choose these $0$-bids too. Then, miner's revenue becomes $\gamma(d_{k+1} + \cdots + d_B)$. Since $(c_1,\ldots,c_B)$ are the highest $B$ bids, we have $c_j \geq d_j$ for all $j \in [B]$. Thus, miner's revenue does not increase. We will next show that whenever the miner replaces an included real bid with a fake bid, the miner's utility does not increase. Notice that if the fake bid is confirmed, it costs the $(k+1)$-th price among the included bids. If the fake bid $b$ is unconfirmed, it costs $\gamma \cdot b$, since its true value is zero. Let $\bfe = (e_1,\ldots,e_B)$ be an arbitrary bid vector where $e_1 \geq \cdots \geq e_B$. The bids $\bfe$ may or may not be the highest bids and some of them may be fake. Suppose the miner replaces $e_i$ with the fake bid $f$. There are four possible cases. \begin{enumerate} \item $i \leq k$ and $f$ is among the top $k$ \item $i \leq k$ and $f$ is not among the top $k$ \item $i > k$ and $f$ is among the top $k$ \item $i > k$ and $f$ is not among the top $k$ \end{enumerate} Henceforth, no matter which case, let $e'_1 \geq \cdots \geq e'_B$ denote the included bids after replacing $e_i$ with $f$. Let $\mu := \gamma(e_{k+1} + \cdots + e_B)$ be the miner's revenue before replacing $e_i$ with the fake bid $f$, and let $\mu' := \gamma(e'_{k+1} + \cdots + e'_B)$ be the miner's revenue after replacing $e_i$ with the fake bid $f$. \Hao{removed: it must be $f \geq e_{k+1}$. we don't need this condition.} In the first case, for each bid among the top $k$, the probability that it is confirmed is $\gamma/c$, so the extra cost for the miner is \[ (1 - \frac{\gamma}{c}) \cdot \gamma \cdot f + \frac{\gamma}{c} \cdot e_{k+1} \geq 0 \] where the first term captures the expected cost if $f$ is not confirmed, and the second term captures the expected cost if $f$ is confirmed. In this case, it is easy to see that $e'_{k + j} = e_{k + j}$ for any $j > 0$, and thus $\mu' = \mu$. Therefore, miner's expected utility does not increase. In the second case, $f$ must be unconfirmed, so it costs the miner $\gamma\cdot f$ additionally to inject $f$. Also, since $f$ is not among the top $k$, it must be $f \leq e_{k+1}$. Because $e_{k+1}$ (or another bid equal to $e_{k+1}$) is among the new top $k$, the miner's revenue becomes $\gamma(e_{k+2} + \cdots e_B + f)$. \elaine{note: i changed this expression} Thus, the miner revenue decreases by $\gamma(e_{k+1} - f)$. \elaine{i changed this expression} Including the extra cost $\gamma\cdot f$, miner's utility actually decreases by \[ \gamma(f + e_{k+1} - f) \geq \gamma \cdot e_{k+1}. \] In the third case, it must be $f \geq e_k$. Moreover, $e_k$ becomes the largest definitely unconfirmed bid, so miner's extra cost is $(1 - \frac{\gamma}{c}) \cdot \gamma \cdot f + \frac{\gamma}{c} \cdot e_{k}\geq \gamma \cdot e_k$. However, it is not hard to see that $\mu' - \mu \leq \gamma \cdot e_k$. Therefore, overall, the miner's expected utility does not increase. In the fourth case, $f$ is unconfirmed, so it costs the miner $\gamma \cdot f$ additionally. If $f \leq e_i$, then it must be $e'_{k+j} \leq e_{k + j}$ for any $j > 0$. Therefore, we have $\mu' \leq \mu$, and the miner's revenue does not increase. Otherwise, if $f > e_i$, we have $(e'_{k+1} + \cdots + e'_B) - (e_{k+1} + \cdots + e_B) = f - e_i$. Thus, the increase in miner revenue is $\gamma(e'_{k+1} + \cdots + e'_B) - \gamma(e_{k+1} + \cdots + e_B) \leq \gamma(f - e_i) \leq \gamma \cdot f$, which is strictly smaller than the extra cost. Thus the miner's expected utility does not increase. Finally, because $\bfe$ is an arbitrary vector which may include fake bids already, we conclude that the miner's expected utility does not increase even if there are multiple fake bids. \ignore{ Let $i' \in [B]$ be the rank of $f$ after replacing $e_i$ with $f$. For any $t \in [B - k]$, conditioned on $T = t$, there are the following cases: \begin{itemize}[leftmargin=5mm] \item if $i > k+t$ and $i' > k+t$, then the miner's expected revenue is unaffected after replacing $e_i$ with $f$; \item if $i \leq k + t$ and $i' \leq k+t$, then the miner's revenue increases by at most $\gamma \cdot \max(0, f - e_i) \leq \gamma f$; \item if $i \leq k + t$ and $i' > k+t$, the miner's revenue cannot increase; \item if $i > k+t$ and $i' \leq k+t$, the miner's revenue increases by $$\gamma \cdot \left((e_{k+1} + \ldots + e_{k + t - 1} + f) - (e_{k+1} + \ldots + e_{k + t})\right) \leq \gamma \cdot f $$ \end{itemize} Since the above holds for any $t \in [B-k]$, the miner's increase in revenue is not enough to outweight its cost $\gamma f$. } \paragraph{$c$-SCP.} A coalition of a miner and up to $c$ user(s) has three kinds of strategies to deviate from the honest behavior: the miner may not include the highest bids, the miner can inject fake bids, and some of the user(s) can bid untruthfully. Let $C$ be the set of colluding users, where $|C| \leq c$. Without loss of generality, we assume the coalition prepares the block in the following order. \begin{enumerate} \item The miner chooses the included bids arbitrarily. We may imagine that there are infinitely many $0$-bids that are ``for free'' and the miner can choose from these as well. \item The miner replaces some of the included real bids (not including the users in $C$) with fake bids. Without loss of generality, we may assume that all injected fake bids are included in the block. \item A subset of users in $C$ change their bids and bid untruthfully. \end{enumerate} \elaine{removed: C included assumption, does not need to be explicit?} We now show that the joint utility of the coalition does not increase after each step. \paragraph{The first step of $c$-SCP.} We may imagine that the miner deletes the real bids one by one, and then includes the highest among the remaining bids. We argue that after deleting each bid, the coalition's expected utility does not increase. Let $\bfe = (e_1, \ldots, e_m)$ be the current bid vector where $e_1 \geq \cdots \geq e_m$, which may already have some bids deleted from the real bid vector. Suppose the miner deletes a bid from $\bfe$. If the deleted bid is not among the top $B$, then it does not affect the coalition's utility. If the deleted bid is ranked between $[k+2, B]$, then the miner's utility cannot increase and no user's utility increases. If the deleted bid is among the top $k$, then the miner's revenue decreases by at least $\gamma \cdot (e_{k+1} - e_{k+2})$. Every user who was among the top $k$ before and after this deletion has $\frac{\gamma}{c} \cdot (e_{k+1} - e_{k+2})$ increase in expected utility. The bid $e_{k+1}$ (or another bid of equal value) now becomes among the top $k$, and its increase in expected utility is also $\frac{\gamma}{c} \cdot (e_{k+1} - e_{k+2})$. The utility of the user who got deleted decreases. All other users' utilities are unaffected. Thus, as long as the number of colluding users $|C| \leq c$, the increase in utility for users in $C$ is upper bounded by $\gamma \cdot (e_{k+1} - e_{k+2})$. Overall, the coalition does not gain in expected utility. If the deleted bid is ranked $k+1$ in $\bfe$, the miner's decrease in revenue is at least $\gamma \cdot (e_{k+1} - e_{k+2})$. For each user among the top $k$ in $\bfe$, its increase in utility is $\frac{\gamma}{c} \cdot (e_{k+1} - e_{k+2})$. The utility of all other users are unaffected. Thus, as long as $|C| \leq c$, the increase in utility for users in $C$ is upper bounded by $\gamma \cdot (e_{k+1} - e_{k+2})$. Overall, the coalition does not gain in expected utility. \elaine{i rewrote the first step.} \Hao{Looks good to me} \ignore{ From the proof of MIC, we have seen that miner's utility does not increase after this step. Thus, we only need to argue how the joint utility changes when the users' utilities increase. Let $\bfc = (c_1,\ldots,c_B)$ be the highest $B$ bids in the mempool and $\bfd = (d_1,\ldots,d_B)$ be the bids chosen by the miner, where $c_1 \geq \cdots \geq c_B$ and $d_1 \geq \cdots \geq d_B$. Since $\bfc$ contains the highest $B$ bids, it must be that $c_i \geq d_i$ for all $i$. For any user $i$, there are two possible cases that user $i$'s utility can increase: \begin{enumerate} \item User $i$'s bid is not among the top $k$ before injecting and is among the top $k$ afterward. \item User $i$'s bid is among the top $k$ before and after injecting, but its payment reduces afterward. \end{enumerate} For the first case, when it is not among the top $k$, its utility is zero. For each bid among the top $k$, the probability that it is confirmed is $\gamma/c$. Thus, when it is among the top $k$, its utility is $(v_i - d_{k+1})\cdot \gamma / c$. In other words, user $i$'s utility increases by $\gamma (v_i - d_{k+1}) / c$. Because $v_i$ is unconfirmed in $\bfc$, we have $v_i \leq c_{k+1}$; because $v_i$ is confirmed in $\bfd$, we have $d_k \leq v_i$. Thus, we have $d_{k+1} \leq d_k \leq v_i \leq c_{k+1}$, and $c_{k+1} - d_{k+1} \geq v_i - d_{k+1}$. Recall that miner's utility is $\gamma(c_{k+1} + \cdots + c_t)$ in the honest case and $\gamma(d_{k+1} + \cdots + d_t)$ in the strategic case. Because $c_{k+1} - d_{k+1} \geq v_i - d_{k+1}$ and $c_i \geq d_i$ for all $i$, miner's utility decreases at least by $\gamma (v_i - d_{k+1})$. For the second case, to make the payment lower, it must be $c_{k+1} > d_{k+1}$. Thus, user $i$'s utility increases by $\gamma (c_{k+1} - d_{k+1}) / c$, while miner's utility decreases at least by $\gamma (c_{k+1} - d_{k+1})$ because $c_i \geq d_i$ for all $i$. To sum up, in both cases, the lost of miner is at least $c$ times as more as an individual user's gain. Thus, even the miner colludes with $c$ users, their joint utility does not increase. } \paragraph{The second step of $c$-SCP.} Let $\bfe$ be an initial bid vector which may already have some bids deleted, and some real bids replaced with fake bids. Suppose the miner replaces some $e_i$ where $i \in [B]$ with a fake bid $f$. Due to the proof of MIC, the miner's utility does not increase after the second step. If no user's expected utility increases after replacing a real bid with a fake one, then the coalition's expected utility cannot increase. Therefore, we only need to consider the cases in which there exists some user whose expected utility increases after replacement. Recall that in the proof of MIC, we divided into four possible cases. In cases 1 and 3, no user's expected utility would increase. Below, we focus on cases 2 and 4. In case 2, $i \leq k$ and $f$ is not among the top $k$. In this case, for every user $j \in [k]$ and $j\neq i$, its expected utility increases by $\frac{\gamma}{c}(e_{k+1} - \max(f, e_{k+2}))$. The bid $e_{k+1}$ now becomes the top $k$, and its utility also increases by $\frac{\gamma}{c}(e_{k+1} - \max(f, e_{k+2}))$. The bid $e_i$'s expected utility decreases, and all other users' expected utilities are unaffected. However, the miner's utility decreases by at least $\gamma \cdot (e_{k+1} - \max(f, e_{k+2}))$. Therefore, as long as $|C| \leq c$, the coalition's expected utility does not increase. In case 4, $i > k$ and $f$ is not among the top $k$. For some user's utility to increase, it must be that $i = k+1$ and $f < e_{k+1}$, i.e., the payment price must have decreased to $\max(f, e_{k+2})$. Similarly, for every user $j \in [k]$, its increase in expected utility is $\frac{\gamma}{c}(e_{k+1} - \max(f, e_{k+2}))$, and every other user's utility is unaffected. The miner's decrease in utility is at least $\gamma \cdot (e_{k+1} - \max(f, e_{k+2}))$. Therefore, as long as $|C| \leq c$, the coalition's expected utility does not increase. \elaine{i rewrote this proof to be more clear} \Hao{Looks good to me} \ignore{Therefore, we only need to argue how the joint utility changes when the users' utilities increase. Let $\bfe = (e_1,\ldots,e_B)$ be an arbitrary bid vector where $e_1 \geq \cdots \geq e_B$. The bids $\bfe$ may or may not be the highest bids and some of them may be fake. We are going to show that whenever the miner replaces a single bid $e_j$ with its fake bid $f$, miner's lost is at least $c$ times as more as an individual user's gain. For any user $i$, there are two possible cases that user $i$'s utility can increase: \begin{enumerate} \item User $i$'s bid is not among the top $k$ before injecting and is among the top $k$ afterward. \item User $i$'s bid is among the top $k$ before and after injecting, but its payment reduces afterward. \end{enumerate} In the first case, the following three conditions must hold: 1) $i$'s bid is $e_{k+1}$ in $\bfe$; 2) $j \leq k$; 3) $f$ is not among the top $k$. Thus, user $i$'s utility increases by $\gamma (v_i - \max(f, e_{k+2})) / c$. However, from the proof of MIC, we have seen that miner's utility decreases by $\gamma (e_{k+1} - e_{k+2})$ when $j \leq k$ and $f$ is not among the top $k$. Recall that user $i$ bids truthfully at this step, we have $v_i = e_{k+1}$. Consequently, miner loses $\gamma (e_{k+1} - e_{k+2})$, while user $i$ only gains $\gamma (e_{k+1} - \max(f, e_{k+2})) / c \leq \gamma (e_{k+1} - e_{k+2}) / c$. In the second case, the miner must replace $e_{k+1}$ with $f$ such that $f < e_{k+1}$. Let $e'_1 \geq \cdots \geq e'_B$ be the bid vector after replacing $e_{k+1}$ with $f$. It must be $e'_z \leq e_z$ for all $z$, so miner's revenue at least decreases by $\gamma(e_{k+1} - e'_{k+1}) = \gamma (e_{k+1} - \max(f, e_{k+2}))$. If we consider the extra cost of injecting $f$, miner's utility decreases even more. On the other hand, user $i$'s payment reduces from $e_{k+1}$ to $\max(f, e_{k+2})$, and its utility increases by $\gamma (e_{k+1} - \max(f, e_{k+2}))/c$. To sum up, once a user benefits, miner's lost is at least $c$ times as more as an individual user's gain. Therefore, even the miner colludes with $c$ users, their joint utility does not increase. } \paragraph{The third step of $c$-SCP.} At this step, the colluding users change their bids one by one. Without loss of generality, we assume the colluding users change their bids in an ascending order according to their true values; that is, the users with lower true values change their bids first. Let $\bfe = (e_1,\ldots,e_B)$ be an arbitrary bid vector included in the block, where $e_1 \geq \cdots \geq e_B$. The bids $\bfe$ may or may not be the highest bids and some of them may be fake or overbidding bids. Note that if any user whose bid is not included in the block changes its bid, the coalition's joint utility cannot increase. Thus, we may assume that a colluding user $i$ included in the block changes its bid. Since the colluding users change their bids one by one, that means user $i$ has not changed its bid before, and $e_i$ must be the user's true value. Henceforth, we often use $e_i$ to refer to the user that placed this bid without risking ambiguity. We will show that the joint utility of miner and all users in $C$ would not increase if $e_i$ changes its bid to $b_i$. \Hao{I rewrite the narrative here} When $e_i$ is replaced with $b_i$, there are four possible cases. \begin{enumerate}[leftmargin=5mm,itemsep=1pt] \item $i > k$ and $b_i$ is among the top $k$ \item $i > k$ and $b_i$ is not among the top $k$ \item $i \leq k$ and $b_i$ is among the top $k$ \item $i \leq k$ and $b_i$ is not among the top $k$ \end{enumerate} Henceforth, no matter which case, let $e'_1 \geq \cdots \geq e'_B$ denote the included bids after replacing $e_i$ with $b_i$. In the first case, $e_k$ becomes the largest unconfirmed bid. $e_i$'s utility was zero before, and it becomes $(1 - \frac{\gamma}{c}) \cdot \gamma \cdot (e_i - b_i) + \frac{\gamma}{c} \cdot (e_i - e_k)$ afterwards. Since $b_i \geq e_k \geq e_i$, the decrease in utility is at least $\gamma (e_k - e_i)$. Besides $e_i$, all other users' utilities cannot increase. The miner's revenue increases by at most $\gamma (e_k - e_{k+1}) \leq \gamma (e_k - e_i)$. Thus, the coalition's expected joint utility does not increase. \ignore{ Because $e_k \geq e_{k+1}$, other users' payments never decrease and their utilities never increase. Miner's on-chain revenue was $\gamma (e_{k+1} + \cdots + e_{k+k'})$ before, and it becomes $\gamma (e'_{k+1} + \cdots + e'_{k+k'})$ afterward. However, $\sum_{z = k+1}^B e'_{z} - \sum_{z = k+1}^B e_{i} = e_k - v_i$. Thus, miner's revenue increases at most by $\gamma(e_k - v_i)$, so the joint utility does not increase. } In the second case, we have $\sum_{i = 1}^{k'} e'_{k+i} - \sum_{i = 1}^{k'} e_{k+i} = b_i - e_i$. Thus the miner's change in revenue is $\gamma \cdot (b_i - e_i)$. For the users who are among the top $k$, their payment become $e'_{k+1}$. There are two subcases. \begin{itemize}[leftmargin=5mm,itemsep=1pt] \item If $e_i$ is overbidding ($b_i > e_i$), it must be $e'_{k+1} \geq e_{k+1}$, so the utilities of the users among top $k$ do not increase. $e_i$'s utility reduces from zero to $\gamma (e_i - b_i) < 0$. Since the miner's revenue increases at most by $\gamma (b_i - e_i)$, the coalition's joint expected utility does not increase. \item If $e_i$ is underbidding ($b_i < e_i$), it must be $e_{k+1} \geq e'_{k+1}$. In this case, it must be $e_j \geq e'_j$ for all $j$. Further, $e_i$'s utility is still zero; and the miner's revenue decreases at least $\gamma(e_i - b_i) \geq \gamma \cdot (e_{k+1} - e'_{k+1})$. The utility of each user among top $k$ increases only by $\gamma(e_{k+1} - e'_{k+1})/c$. All other users' utilities are unaffected. Thus, even if the miner colludes with $c$ users, their joint expected utility does not increase. \end{itemize} In the third case, $e_i$'s utility and miner's utility do not change individually. Moreover, all other users' utilities do not change either, because $e_{k+1} = e'_{k+1}$. Thus, the joint utility of the coalition does not change. In the fourth case, the miner's revenue reduces from $\gamma(e_{k+1} + \cdots + e_B)$ to $\gamma(e_{k+2} + \cdots + e_B + b_i) = \gamma(e_{k+1} - b_i)$. We now consider each user's change in utility. \begin{itemize}[leftmargin=5mm,itemsep=1pt] \item Since the user $e_i$'s bid is replaced with $b_i$ and now becomes unconfirmed, its utility reduces from $\gamma(e_i - e_{k+1})/c$ to zero. Also, note that $e_i$ (who now bids $b_i$) must belong to $C$. \item For anyone that was among top $k$ before and after the replacement, its new payment is $\max(b_i, e_{k+2})$ if confirmed. Thus its expected utility increases by $\frac{\gamma}{c} \cdot (e_{k+1} - \max(b_i, e_{k+2}))$. \Hao{This case should be increases} \item Now consider the user that bids $e_{k+1}$. This is the most complicated case. Let $v$ be this user's true value. If this user is a coalition member, and its bid $e_{k+1}$ was previously changed, then we know that $v \leq e_i$ since we are changing the coalition users' bids in ascending order of their true value. In all other cases, $v = e_{k+1} \leq e_i$. After the replacement of $e_i$ with $b_i$, conditioned on not being confirmed, the user's utility does not change since previously it was always unconfirmed. Conditioned on being confirmed, the user's utility increases by at most $v - \max(b_i, e_{k+2}) + \max(0, \gamma \cdot (e_{k+1} - v))$, where the part $\max(0, \gamma \cdot (e_{k+1} - v))$ is because the user might be overbidding, i.e., $v < e_{k+1}$, and before the replacement it was always unconfirmed. Therefore, the user's expected gain in utility is $\frac{\gamma}{c} (v - \max(b_i, e_{k+2}) + \max(0, \gamma \cdot (e_{k+1} - v)))$. \item For every other user, its utility is unaffected. \end{itemize} Now, suppose that the user bidding $e_{k+1}$ belongs to the coalition. We know that $e_i$, whose bid is being changed to $b_i$, belongs to the coalition too. The joint utility of $e_{k+1}$ and $e_i$ increases by $\frac{\gamma}{c} (v - \max(b_i, e_{k+2}) + \max(0, \gamma \cdot (e_{k+1} - v))) - \frac{\gamma}{c} (e_i - e_{k+1})$. If $e_{k+1} \geq v$, their increase in utility is upper bounded by \begin{align*} & \frac{\gamma}{c} \big[ v - \max(b_i, e_{k+2}) + \gamma \cdot (e_{k+1} - v) \big] - \frac{\gamma}{c} (e_i - e_{k+1}) \\ = & \frac{\gamma}{c} \big[v - \max(b_i, e_{k+2}) + \gamma \cdot (e_{k+1} - v) - e_i + e_{k+1}\big]\\ = & \frac{\gamma}{c} \big[e_{k+1} - \max(b_i, e_{k+2}) + \gamma \cdot (e_{k+1} - v) - (e_i - v) \big]\\ \leq & \frac{\gamma}{c} \big[e_{k+1} - \max(b_i, e_{k+2}) + \gamma \cdot (e_{k+1} - v) - (e_{k+1} - v) \big]\\ \leq & \frac{\gamma}{c} (e_{k+1} - \max(b_i, e_{k+2})) \end{align*} If $e_{k+1} < v$, their increase in utility is upper bounded by \frac{\gamma}{c} (v - \max(b_i, e_{k+2}) - e_i + e_{k+1}) \leq \frac{\gamma}{c} (e_{k+1} - \max(b_i, e_{k+2}))$, too. All other users' expected utilities are either unaffected or increases by at most $\frac{\gamma}{c} (e_{k+1} - \max(b_i, e_{k+2}))$. Therefore, as long as $|C| \leq c$, the coalition's joint utility cannot increase. Suppose that the user bidding $e_{k+1}$ does not belong to the coalition. This case is easier since all users' expected utilities cannot increase by more than $\frac{\gamma}{c} (e_{k+1} - \max(b_i, e_{k+2}))$. Therefore, as long as $|C| \leq c$, the coalition's joint utility cannot increase. \Hao{The proof looks good to me} \ignore{ For those users who were among the top $k$ in $\bfe$ (except user $i$), their payment changes from $e_{k+1}$ to $\max(b_i, e_{k+2})$, so each utility increases by $\gamma(e_{k+1} - \max(b_i, e_{k+2}))/c$. Finally, there is a lucky user $r$ who bids $e_{k+1}$ now becomes $e'_k$ and has a chance to be confirmed. This case is more complicated, since it depends on whether $e_{k+1}$ is underbidding to user $r$. Let $v_r$ be the true value of user $r$, and consider the following two cases. \begin{itemize} \item Suppose $e_{k+1} \geq v_r$. User $r$'s utility was $\gamma(v_r - e_{k+1})$ before, while it becomes \[ (1-\frac{\gamma}{c}) \cdot \gamma (v_r - e_{k+1}) + \frac{\gamma}{c} \cdot (v_r - \max(b_i, e_{k+2})) \] afterward. Thus, user $r$'s utility increases at most by $\gamma(e_{k+1} - \max(b_i, e_{k+2})) / c$. The joint utility of the coalition decreases at least by \begin{equation}\label{eq:burning2price} \frac{\gamma}{c}(v_i - e_{k+1}) + \gamma(e_{k+1} - \max(b_i, e_{k+k'+1})) - (c-1)\frac{\gamma}{c}(e_{k+1} - \max(b_i, e_{k+2})) -\frac{\gamma}{c} (e_{k+1} - \max(b_i, e_{k+2})), \end{equation} where the first term is user $i$'s lost, the second term is miner's lost, the third term is the gain of users who were among the top $k$ (except user $i$), and the fourth term is user $r$'s gain. Eq.(\ref{eq:burning2price}) can be simplified as \[ \frac{\gamma}{c}(v_i - e_{k+1}) - \gamma \cdot \max(b_i, e_{k+k'+1}) + \gamma \cdot \max(b_i, e_{k+2}). \] Because $e_{k+2} \geq e_{k+k'+1}$, we have $\gamma \cdot \max(b_i, e_{k+2}) \geq \gamma \cdot \max(b_i, e_{k+k'+1})$. Besides, in the fourth case, we have $v_i = e_j \geq e_k \geq e_{k+1}$. Thus, Eq.(\ref{eq:burning2price}) must be non-negative, which means the joint utility does not increase. \item Suppose $e_{k+1} < v_r$. That means user $r$ underbids, so user $r$ had changed its bid before user $i$ does. Recall that we assume the colluding users change their bids in an ascending order according to their true values, so we have $v_i \geq v_r$. In this case, user $r$'s utility was zero before, while it becomes $\gamma(v_r - \max(b_i, e_{k+2})) / c$ afterward. The joint utility of the coalition decreases at least by \begin{equation}\label{eq:burning2price2} \frac{\gamma}{c}(v_i - e_{k+1}) + \gamma(e_{k+1} - \max(b_i, e_{k+k'+1})) - (c-1)\frac{\gamma}{c}(e_{k+1} - \max(b_i, e_{k+2})) - \frac{\gamma}{c}(v_r - \max(b_i, e_{k+2})). \end{equation} Eq.(\ref{eq:burning2price2}) can be simplified as \[ \frac{\gamma}{c}(v_i - v_r) - \gamma \cdot \max(b_i, e_{k+k'+1}) + \gamma \cdot \max(b_i, e_{k+2}). \] Because $v_i \geq v_r$, Eq.(\ref{eq:burning2price2}) must be non-negative, which means the joint utility does not increase. \end{itemize} } \subsection{Additional Related Work} \label{sec:related} \paragraph{Transaction fee mechanism.} We now review some additional related work besides the most closely reladed work EIP-1559~\cite{eip1559} and that of Roughgarden~\cite{roughgardeneip1559,roughgardeneip1559-ec}. Specifically, we will review the transaction fee mechanisms that have been proposed, and explain which of the three properties they each fail to satisfy. Lavi, Sattath, and Zohar~\cite{zoharfeemech} pointed out that today's ``pay your bid'' auction has resulted in complex strategic bidding behavior. In particular, when there is no congestion, users would bid almost $0$, resulting in very little transaction fee revenue for the miners. To alleviate the problem, \cite{zoharfeemech} suggests two alternative mechanisms, Monopolistic Price, and Random Sampling Optimal Price (RSOP), initially proposed in \cite{competitiveauction}. As \cite{zoharfeemech} acknowledged, Monopolistic Price is not strictly user incentive compatible (by the classical DSIC notion), and is not even 1-side-contract resilient. For RSOP, \cite{zoharfeemech} demonatrated an attack showing that it is not MIC. In fact, a slightly modified attack can also show that RSOP is not side contract resilient. Yao~\cite{yaofeemech} proved that although Monopolistic Price is not strictly UIC, it is nearly UIC assuming any i.i.d. distribution of the users' true values, and as the number of users goes to infinity. Further, Yao also proved a conjecture in \cite{zoharfeemech} regarding the relative revenue of the two mechanisms. Basu, Easley, O'Hara, and Sirer~\cite{functional-fee-market} suggested mechanism that involves paying the transfaction fees forward to some number of future blocks. Roughgarden~\cite{roughgardeneip1559} simplified and analyzed their scheme, and argued that it does not satisfy any of the three properties, although it is approximately UIC when the number of users goes to infinity. Ferreira, Moroz, Parkes, and Stern~\cite{dynamicpostedprice} suggest a modification to EIP-1559: whereas EIP-1559 approximates a first price auction in the congested regime and approximates a posted price auction in the infinite block size regime, \cite{dynamicpostedprice} suggest to adopt a posted price mechanism no matter which regime one is in, by modifying the reserve price over time. \cite{dynamicpostedprice}'s approach does not adopt a burn rule, and fails to satisfy even $1$-side-contract-proofness. \paragraph{More remotely related work.} Several works in the mechanism design literature are related to our work. Akbarpour and Li~\cite{credibleauction} proposed a notion called credible auctions, i.e., auctions where the auctioneer does not have incentives to implement any ``safe'' deviations. In particular, safe deviations are for which there exists a plausible explanation. While their definition is somewhat similar in spirit to miner incentive compatibility (MIC), their modeling is incomptible with TFM. In TFM, all transactions included in the block must be visible to the public, whereas Akbarpour and Li~\cite{credibleauction} consider auctions where a bidder may not be able to see others' bids --- and the cheating auctioneer could exploit this to explain his cheating behavior away. The elegant work of Ferreira and Weinberg~\cite{commit-credible-auction} showed that using cryptographic commitments can help overcome some of the lower bound results shown by Akbarpour and Li~\cite{credibleauction}. A line of works also consider collusion among bidders in auctions~\cite{coalitionic,goldberghartline,chen-collusive,optcollusionproof,econcollusion,decklbaummicali}. Traditional auctions like the Vickrey auction do not satisfy incentive compatibility if bidders can collude through binding side contracts. Therefore, this line of work explores under what modeling assumptions or incentive compatibility notions is it possible to resist bidder collusion. The transaction fee mechanism (TFM) line of work has not focused on user-user collusion --- as mentioned earlier, user-user rendezvous is difficult to facilitate since users are ephemeral in decentralized blockchain settings. \elaine{anything else to cite?} \section{Technical Roadmap} \subsection{Transaction Fee Mechanism and Incentive Compatibility} \label{sec:roadmap-tfm} In a transaction fee mechanism (TFM), we are selling slots in a block to bidders who want to get their transactions included and confirmed in the block. For simplicity, we assume that all slots are identical commodities, and we often use the terms ``transaction'' and ``bid'' interchangeably. For convenience, we assume that each bid comes from a different user. \paragraph{Transaction fee mechanism.} A transaction fee mechanism (TFM) includes the following rules: \begin{itemize}[leftmargin=5mm,itemsep=1pt] \item An {\it inclusion rule} executed by the miner. Given a bid vector $\bfb = (b_1, b_2, \ldots, b_m)$, the inclusion rule decides which of the bids to include in the block; \item A {\it confirmation rule} executed by the blockchain. The confirmation rule chooses a subset of the included bids to confirmed. In the most general form, not all transactions included in the block are necessarily confirmed, and only confirmed transactions are considered final, i.e., the money has been transferred to the merchant's account and the merchant can now provide the promised service. \item A {\it payment rule} and a {\it miner revenue} rule executed by the blockchain, which decides (using only information recorded in the block) how much each confirmed bid pays, and how much revenue the miner gets. Any (possibly included) transaction that is not confirmed pays nothing. Furthermore, we assume that the miner's revenue is upper bounded by the total payment collected from all confirmed bids. In particular, if the miner's revenue is strictly smaller than the total payment of all bids, then we often say that part of the payment is {\it burnt}. \end{itemize} In our model, a strategic miner (possibly colluding with some users) may not implement the honest inclusion rule, if deviating can benefit the miner (or coalition). However, the blockchain is trusted to implement the confirmation, payment, and miner-revenue rules honestly. In comparison with Roughgarden's model~\cite{roughgardeneip1559,roughgardeneip1559-ec}, we explicitly distinguish the inclusion rule from the confirmation rule in our modeling. By contrast, Roughgarden's model calls the union of the inclusion rule and the confirmation rule the {\it allocation rule}. Making the distinction between the inclusion and confirmation rules explicit is useful for us since we want to tease out the fine boundaries between feasibility and infeasibility, depending on whether the block size is finite or infinite. \paragraph{Strategy space and incentive compatibility.} A {\it strategic player} can be a user, a miner, or the coalition of the miner and up to $c$ users. The strategic player can deviate in the following ways: 1) if one or more users are involved, then some of the users can decide to bid untruthfully {\it after} examining all other bids; 2) the strategic player can inject fake bids after examining all other bids; and 3) if the miner is involved, then the miner may not implement the inclusion rule honestly. Every user has a true value for its transaction to be confirmed. If a user is confirmed, its utility is its true value minus its payment. An unconfirmed user has utility $0$. The miner's utility is its revenue. If the miner colludes with some users, the coalition's joint utility is the sum of the utilities of all coalition members. \paragraph{Incentive compatibility.} The honest strategy for a user is to bid its true value. The honest strategy for a miner is to implement the correct inclusion rule. A TFM is incentive compatible for a strategic player iff deviating from the honest strategy cannot increase the strategic player's expected utility; i.e., playing honestly is the strategic player's best strategy (or one of the best strategies). A TFM is said to be user incentive compatible (UIC), if it is incentive compatible for any individual user. A TFM is said to be miner incentive compatible (MIC), if it is incentive compatible for the miner. Finally, a TFM is said to be $c$-side-contract-proof, if it is incentive compatible for any coalition consisting of the miner and at least $1$ and at most $c$ users. The notions UIC, MIC, and $c$-SCP are incomparable as shown in Appendix~\ref{sec:ic-compare}. Note that in a blockchain environment, user-user coalitions are much harder to form: since users are ephemeral, rendezvous between them is challenging. By contrast, there are typically a stable set of big miners which makes miner-user rendezvous easy. For this reason, most works in this space are more interested in defending against miner-user rather than user-user coalitions. \subsection{Impossibility of a ``Dream'' TFM under Finite Block Size} \label{sec:roadmap-main-lb} We now sketch how to prove Theorem~\ref{thm:intromain}, that is, assuming finite block size, no non-trivial TFM can achieve UIC and 1-SCP at the same time. We shall first sketch how the proof works for deterministic TFMs, then we explain how to generalize the proof to the randomized case. \paragraph{Deterministic case: miner has $0$ revenue.} Recall that if a TFM satisfies UIC, it must respect the constraints imposed by the famous Myerson's Lemma~\cite{myerson}. For deterministic mechanisms, this means that the confirmation decision is {\it monotone}, and moreover, every confirmed bid pays {\it the minimum price it could have bid and still remained confirmed}, assuming everyone else's bids remain the same. To prove Theorem~\ref{thm:intromain}, we go through an intermediate stepping stone: we shall actually prove Theorem~\ref{thm:introburn} first, that is, any TFM that satisfies both UIC and $1$-SCP {\it must always pay the miner nothing}, regardless whether the block size is finite or infinite. Henceforth, let $\mu(\bfb)$ denote the miner revenue under the bid vector $\bfb$. We use $p_i(\bfb)$ to denote user $i$'s payment under $\bfb$, and if user $i$ is unconfirmed, $p_i(\bfb) = 0$. Consider an arbitrary deterministic TFM that is UIC and $1$-SCP. Consider an arbitrary bid vector $\bfb = (b_1, \ldots, b_m)$ and we want to argue that the miner has $0$ revenue under $\bfb$. To do this, we want to lower each user's bid to $0$ one by one, and argue that the miner revenue is unaffected in this process. If this is the case, we can show that the miner revenue is $0$ under $\bfb$, since at the very end of this process, when we have lowered everyone's bid to $0$, the miner revenue must be $0$. \ignore{ First, we show that if user $i$ bids anywhere in between $[p_i, \infty]$ which allows user $i$ to be confirmed by Myerson's Lemma, then the miner revenue must be unaffected. If this is not true, then suppose that the miner and user $i$ form a coalition, and suppose that user $i$'s true value is at least $p_i$. In this case, user $i$ should bid not necessarily its true value, the amount that maximizes the miner revenue in the range $[p_i, \infty]$. The coalition gains under this strategic behavior since user is indifferent to any bid in this range, whereas the miner's utility is maximized, and this violates $1$-SCP. } It suffices to prove the following. Let $\bfb = (b_1, \ldots, b_m)$ be an arbitrary bid vector and $i \in [m]$ be an arbitrary user. We want to show that $\mu(\bfb) = \mu(\bfb_{-i}, 0)$. First, we show that if a user changes its bid such that its confirmation status remains unaffected, then the miner revenue should stay the same (Claim~\ref{clm:inconsequentialbidchange}). If this is not true, then the miner and the user can collude, and there is a way for the user to bid untruthfully without affecting its confirmation status and thus its utility, but increasing the miner revenue. Overall, the coalition strictly gains and this violates $1$-SCP. Suppose that $p_i$ is the minimum price that some user $i$ could bid to let it be confirmed, assuming that everyone else is bidding $\bfb_{-i}$. The above means that if user $i$ bids anywhere between $[p_i, \infty]$ such that it remains confirmed, then the miner revenue is unaffected. Similarly, if user $i$ bids anywhere between $(p_i, 0]$ such that it is unconfirmed, then the miner revenue is unaffected too. It remains to rule out the possibility that there is a sudden jump in miner revenue, when user $i$ lowers its bid from $p_i$ to $p_i - \epsilon$ for an aribitrarily small $\epsilon$. Suppose for the sake of contradiction that there is a sudden $\Delta > 0$ increase in the miner revenue when user $i$ lowers its bid from $p_i$ to $p_i - \epsilon$ (and the proof for the other direction is similar). From what we proved earlier, the entire jump of $\Delta$ must occur within an arbitrarily small interval $p_i$ and $p_i -\epsilon$, and in particular, we may assume that $\epsilon < \Delta$. \ignore We next show that $\mu(\bfb_{-i}, p_i) = \mu(\bfb_{-i}, 0)$ which is sufficient to prove the statement. Below we rule out the case $\mu(\bfb_{-i}, p_i) > \mu(\bfb_{-i}, 0)$, since the other case $\mu(\bfb_{-i}, p_i) < \mu(\bfb_{-i}, 0)$ has a similar proof. Let $\epsilon < \Delta := \mu(\bfb_{-i}, p_i) - \mu(\bfb_{-i}, 0)$ be an arbitrarily small number. We have shown that $\mu(\bfb_{-i}, 0) = \mu(\bfb_{-i}, p_i - \epsilon)$. This means that if user $i$ bids $p_i$ instead of $p_i-\epsilon$, the miner can gain $\Delta > \epsilon$ in utility. } In this case, if the miner colludes with user $i$ whose true value is actually $p_i-\epsilon$, the user should bid $p_i$ instead. This way, the miner's gain $\Delta$ outweighs the user's loss $\epsilon$, and the coalition strictly gains. This violates $1$-SCP. A formal presentation of this proof can be found in Section~\ref{sec:trivial-miner-rev}. \paragraph{Theorem~\ref{thm:introburn} + finite block size $\Longrightarrow$ Theorem~\ref{thm:intromain}.} Once we have proven Theorem~\ref{thm:introburn}, i.e., the miner always has $0$ revenue, we can now throw in the finite block size assumption, to prove Theorem~\ref{thm:intromain}. We show it for the deterministic case below. Specifically, suppose there is a bid vector $\bfb = (b_1, \ldots, b_m)$ under which some bid $b_i$ is confirmed where $i \in [m]$. Now, imagine that the real world actually consists of the bids $\bfb$ plus sufficiently many users bidding $b_i + \epsilon$, such that the number of users bidding $b_i + \epsilon$ exceeds the block size. We know that one of the users bidding $b_i + \epsilon$ must be unconfirmed --- let us call this user $u$. The miner can now collude with $u$, and ask $u$ to bid $b_i$ instead. The miner can now pretend that the world consists of the bid vector $\bfb$ where $b_i$ is replaced with $u$'s bid, and run the honest mechanism. This helps the user $u$ get confirmed and gain a positive utility, and meanwhile, the miner itself always gets $0$ revenue no matter what it does. Thus, overall, the coalition strictly gains, which violates $1$-SCP. \ignore{ Next, we argue that user $i$ can change its bid in between $(p_i, 0]$ without affecting the miner revenue. Suppose that user $i$'s true value is $p_i$. Bidding anywhere in this range gives user $i$ utility $0$, since it is either unconfirmed or confirmed but paying its true value $p_i$. If bidding in the range $[p_i, 0]$ } \paragraph{Generalizing to randomized TFMs.} At a high level, our earlier impossibility proof for deterministic TFMs use Myerson's Lemma as a blackbox. Since the TFM is UIC, we argue that the mechanism must fall within the solution space characterized by Myerson's Lemma. Our proof then shows that the constraints imposed by Myerson conflict with the requirements of 1-SCP. For the randomized case, instead of following the same blueprint, we present an alternative proof that uses Myerson's Lemma (the randomized case) in a slightly non-blackbox manner --- we review Myerson's Lemma generalized to the randomized case in Section~\ref{sec:myerson}. Below, keep in mind that the notations $p_i(\bfb)$ and $\mu(\bfb)$ can be random variables. We first give a slightly incorrect intuition. As a thought experiment, imagine that the coalition of the miner and user $i$ forms a ``virtual-user'' $i$. Virtual-user $i$ 's true value is $v_i$, i.e., same as user $i$'s true value. Virtual-user $i$'s payment is $p_i(\bfb) - \mu(\bfb)$. Observe that virtual-user $i$'s true value minus its payment is exactly the coalition's utility in the original TFM. Now, imagine a ``virtual auction'' among a set of virtual users, where each virtual user $i$ is the coalition of the miner and the user $i$. Each virtual user's strategy space is either overbidding or underbidding. Since the original TFM satisfies 1-SCP, it must be that each virtual user does not want to overbid or underbid, i.e., the virtual auction is dominant strategy incentive compatible for each virtual user. Now, we can apply Myerson's Lemma to this virtual auction, and argue that each virtual user's payment $p_i(\bfb) - \mu(\bfb)$ must satisfy the unique payment rule stipulated by Myerson's Lemma. However, since the original TFM is UIC, it must be that each user's payment $p_i(\bfb)$ also satisfies the unique payment rule stipulated by Myerson's Lemma. This gives us $p_i(\bfb) - \mu(\bfb) = p_i(\bfb)$, i.e., $\mu(\bfb) = 0$. The above argument is slightly incorrect, though, since the unique payment rule of Myerson's Lemma relies on the border condition that if a user bids $0$, it pays $0$. When we consider the virtual auction, a virtual user's payment is of the form $p_i(\bfb) - \mu(\bfb)$ --- and it is not immediately clear that this quantity is $0$ (even though at the end of the proof, we can see that it is indeed $0$). It takes a little more work to make this intuition correct, and we give a formal proof below that makes slightly non-blackbox usage of the proof of the Myerson's Lemma --- see Section~\ref{sec:randomized-lb} for details. The above proves Theorem~\ref{thm:introburn} for the randomized case. Similarly, we can now rely on Theorem~\ref{thm:introburn} and additionally throw in the finite block size assumption to get Theorem~\ref{thm:intromain} for the randomized case. The proof of this is a little more complicated than the deterministic case, and we defer the formal details to Section~\ref{sec:finite}. \subsection{Incentive Compatibility under $\gamma$-Strict Utility} \paragraph{$\gamma$-strict utility.} As observed earlier in Section~\ref{sec:introweakic}, the current modeling approach does not charge for certain costs of cheating. Specifically, an overbid or fake transaction that is not confirmed in the present is incorrectly assumed to be free of cost. We therefore refine the model by changing the utility definition to account for this cost. As mentioned, since the exact cost is hard to predict, we define a parametrizeable utility notion called $\gamma$-strict utility, where the discount factor $\gamma \in [0, 1]$ can potentially be measured from historical data. In comparison with the utility notion introduced in Section~\ref{sec:roadmap-tfm}, the only difference here is that for any overbid or fake transaction that is not confirmed in the present, we charge the strategic player $\gamma$ times the worst-case cost, where the worst-case cost is the difference between the bid amount and the true value, since the strategic player may end up paying the full bid amount in a future block (of which it may not be the miner). We may assume that any fake transaction has a true value of zero. We can define UIC, MIC, and $c$-SCP just like before but now using the $\gamma$-strict utility notion. The notions UIC, MIC, and $c$-SCP under $\gamma$-strict utility are incomparable for any $\gamma \in [0, 1]$ as shown in Appendix~\ref{sec:ic-compare}. \paragraph{Burning second-price mechanism.} For any $\gamma \in (0, 1]$ and any $c \geq 1$, we present a TFM that achieves UIC, MIC, and $c$-SCP under $\gamma$-strict utility. \input{burn-2nd-price} \subsection{Necessity of Randomness for Weak Incentive Compatibility} \label{sec:roadmap-lb-weak} We present an informal roadmap for the proof of Theorem~\ref{thm:intro-lb-weak}, that is, any deterministic and 2-user-friendly TFM cannot satisfy weak UIC and 2-weak-SCP simultaneously. Recall that weak incentive compatibility corresponds to the case when $\gamma = 1$. In other words, we are charging the worst-case cost for cheating, and this makes our lower bounds stronger. Henceforth, if there exists a bid vector such that the TFM confirms at least two bids, we say that the TFM is {\it 2-user-friendly}. \paragraph{Myerson's lemma holds for deterministic and weak UIC mechanisms.} Recall that Myerson's Lemma holds for any UIC mechanism. Since we now are considering a more relaxed notion, namely, weak UIC, it may not be immediately clear that Myerson's Lemma still holds. Fortunately, we can prove that assuming {\it deterministic} and no random coins, then even weak UIC mechanisms must satisfy the requirements imposed by Myerson's Lemma (Fact~\ref{fct:myerson-weakuic}). We stress that this observation is actually somewhat subtle, since it is not too clear whether Myerson's Lemma holds for {\it randomized} mechanisms that satisfy weak UIC. \paragraph{Weak UIC + $2$-weak-SCP + $2$-user-friendly $\Longrightarrow$ several natural properties.} Next, we establish a few natural structural properties for any deterministic, $2$-user-friendly TFM that is both weak UIC and $2$-weak-SCP. \begin{enumerate}[leftmargin=5mm] \item All confirmed bids must pay the same, and thus there is a universal payment (Lemma~\ref{lemma:samePayment}); \item The mechanism must confirm the highest bids where the number of confirmed bids may depend on the bid vector (Lemma~\ref{lemma:ordered}); and \item The universal payment must be at least as high as the top unconfirmed bid (Lemma~\ref{lemma:unconfirmedPayment}). In other words, anyone bidding strictly higher than the universal payment must be confirmed. \end{enumerate} \paragraph{Influence of an individual bidder.} Earlier in Section~\ref{sec:trivial-miner-rev} when we proved the impossibility for (strong) incentive compatibility, we used the fact that when an individual user moves its bid up or down, as long as its confirmation decision is unaffected, the user's own utility does not change. Now, due to $1$-SCP, the miner's revenue should be unaffected too. This statement is not entirely true any more now that we have changed our utility definition. In particular, if an unconfirmed user increases its bid while still remaining unconfirmed, there is now an extra cost to the user. The key to proving Theorem~\ref{theorem:twoweakSCPwithburn} is to understand how fast the universal payment and miner revenue can change as we change a single user's bid. There are a few cases (stated informally below): \begin{itemize}[leftmargin=5mm] \item {\bf Lemma~\ref{lemma:confirmInvariant}\footnote{We in fact need to use this lemma to prove the aforementioned natural properties. }.} If a confirmed user changes its bid such that it is still confirmed, then the miner revenue is unaffected. This can be shown using the same argument as in Section~\ref{sec:trivial-miner-rev} relying on weak UIC and 1-weak-SCP, since for a confirmed bid, the new and old utility notions coincide. Additionally, using $2$-weak-SCP, we can show something even stronger: if there are two confirmed bids $b_1$ and $b_2$ such that $b_1 > p$ where $p$ is the universal payment, then, $b_1$'s confirmation status and the universal payment amount are also unaffected when $b_2$ changes its bid as long as it remains confirmed. \item {\bf Lemma~\ref{lem:minerutilkto0}.} If an individual user changes its bid by $\Delta$, then the miner utility cannot change by more than $\Delta$. Roughly speaking, this is because even under our new utility notion, the extra cost to a user is at most $\Delta$ if it changes its bid by $\Delta$. If the miner revenue changed by more than $\Delta$, then the miner-user coalition has a deviating strategy that allows them to strictly gain. \item {\bf Lemma~\ref{lemma:paychangeslow}.} If a user $k$ increases its bid from $0$ to $\Delta$, the universal payment cannot increase by more than $\Delta/2$. Had it not been the case, then the coalition of a miner and two confirmed users can gain in the following way: replace user $k$'s bid $b_k > 0$ with a $0$-bid instead. In this way, the two colluding users each pay a lot less, and due to the earlier Lemma~\ref{lem:minerutilkto0}, the miner's revenue does not change that much. So overall, the coalition can strictly gain. \item {\bf Lemma~\ref{lemma:paychangeslow2}.} If a user $k$ drops its bid from $b_k$ to $0$, then the universal payment cannot increase by more than $b_k$. Otherwise, the miner can collude with one paying user, and suppose user $k$'s actual bid is $0$, but the miner changes it to a fake bid of $b_k$. In this case, the paying user would pay a lot less which outweighs the cost to the miner is only $b_k$. \end{itemize} \begin{figure*}[t] \[\begin{array}{cccccccl} & & \text{\bf bids} & & & & \text{\bf universal payment}\\ b_1 > p, & b_2 > p, & \_, & \_, & \ldots, & \_ & p\\[-6pt] & & & & & & & \biggl.\biggr\} \text{\ Lemma~\ref{lemma:confirmInvariant}}\\[-7pt] {\color{blue}\Gamma \ \text{(big)}}, & {\color{blue}\Gamma \ \text{(big)}}, & \_, & \_, & \ldots, & \_ & p\\[-6pt] & & & & & & & \biggl.\biggr\} \text{\ Lemma~\ref{lemma:paychangeslow2}}\\[-8pt] \Gamma \ \text{(big)}, & \Gamma \ \text{(big)}, & {\color{blue}0}, & \_, & \ldots, & \_ & {\color{blue} p_1}\\[-6pt] & & & & & & & \biggl.\biggr\} \text{\ Lemma~\ref{lemma:paychangeslow2}}\\[-8pt] \Gamma \ \text{(big)}, & \Gamma \ \text{(big)}, & {0}, & {\color{blue}0}, & \ldots, & \_ & {\color{blue} p_2}\\[-3pt] & & & & \vdots & & & \biggl.\biggr\} \text{\ Lemma~\ref{lemma:paychangeslow2}}\\[-4pt] \Gamma \ \text{(big)}, & \Gamma \ \text{(big)}, & {0}, & {0}, & \ldots, & {\color{blue} 0} & {\color{blue} p'}\\[-9pt] & & & & & & & \biggl.\biggr\} \text{\ Lemma~\ref{lemma:paychangeslow}}\\[-9pt] \Gamma \ \text{(big)}, & \Gamma \ \text{(big)}, & {\color{blue} p'_1 + \epsilon}, & {0}, & \ldots, & {0} & {\color{blue} p'_1}\\[-5pt] & & & & & & & \biggl.\biggr\} \text{\ Lemma~\ref{lemma:confirmInvariant}}\\[-9pt] \Gamma \ \text{(big)}, & \Gamma \ \text{(big)}, & {\color{blue} \Gamma \ \text{(big)}}, & {0}, & \ldots, & {0} & {p'_1}\\[-5pt] & & & & & & & \biggl.\biggr\} \text{\ Lemma~\ref{lemma:paychangeslow}}\\[-8pt] \Gamma \ \text{(big)}, & \Gamma \ \text{(big)}, & \Gamma \ \text{(big)}, & {\color{blue} p'_2 + \epsilon}, & \ldots, & {0} & {\color{blue} p'_2}\\[-5pt] & & & & & & & \biggl.\biggr\} \text{\ Lemma~\ref{lemma:confirmInvariant}}\\[-8pt] \Gamma \ \text{(big)}, & \Gamma \ \text{(big)}, & \Gamma \ \text{(big)}, & {\color{blue} \Gamma \ \text{(big)}}, & \ldots, & {0} & {p'_2}\\[-3pt] & & & & \vdots & & & \biggl.\biggr\} \text{\ Lemmas~\ref{lemma:confirmInvariant}, \ref{lemma:paychangeslow}}\\[-9pt] \Gamma \ \text{(big)}, & \Gamma \ \text{(big)}, & { \Gamma \ \text{(big)}}, & { \Gamma \ \text{(big)}}, & \ldots, & {\color{blue} \Gamma \ \text{(big)}} & {\color{blue} p''}\\[-9pt] \end{array} \] \caption{{\bf Proof roadmap for Theorem~\ref{theorem:twoweakSCPwithburn}.} We construct a sequence of bid vectors, and show that if the mechanism satisfies the desired properties, then, in the last configuration, every bid must be confirmed. Since there are more bids than the block size, we reach a contradiction. The notation ``\_'' denotes a bid whose value we do not care about (as long as $\Gamma$ is big enough w.r.t. all these values).} \label{fig:proofroadmap} \end{figure*} \paragraph{Demonstrating the contradiction (Figure~\ref{fig:proofroadmap}).} With the above key observations, we can finally demonstrate a contradiction, assuming that there indeed exists a deterministic, $2$-user-friendly mechanism that is weak UIC and $2$-weak-SCP. \begin{enumerate}[leftmargin=5mm] \item First, we show that there exists a bid vector $\bfb = (b_1, b_2, \ldots, b_m)$ such that there are two (or more) users confirmed, and both users bid strictly higher than the payment. Note that $2$-user-friendliness guarantees the existence of a vector $\bfb$ such that two users are confirmed, but does not directly guarantee that both of them bid strictly above the payment --- it actually requires a bit of work to show this (which we defer to the subsequent formal presentation). Henceforth, without loss of generality, we may assume that $b_1$ and $b_2$ are the two confirmed bids, and let $p$ be the payment. We know that $b_1 > p$, and $b_2 > p$. \item Next, using Lemma~\ref{lemma:confirmInvariant}, we can increase both $b_1$ and $b_2$ to some sufficiently large number $\Gamma$, without affecting the payment $p$ or the miner revenue, and the resulting bid vector is $(\Gamma, \Gamma, b_3, \ldots, b_m)$. \item Next, we can lower $b_3, \ldots, b_m$ all to $0$. Due to Lemma~\ref{lemma:paychangeslow2} and the sufficiently large choice of $\Gamma$, the increase in the payment is relatively small in comparison with $\Gamma$. This means that at the end, the first two users' bid amount $\Gamma$ is still much greater than the universal payment, despite the possible increase in the universal payment. Therefore, the first two users must be still confirmed at the end (formally showing this requires a bit extra work). At this moment, we have a bid vector $(\Gamma, \Gamma, 0, 0, \ldots, 0)$, where the first two users are confirmed, and there is still a sufficiently large gap between their bid $\Gamma$ and the universal payment $p'$. \item Next, one by one, we shall increase the bids of users $3$ through $m$. For each user $j \in \{3, 4, \ldots, m\}$, as we increase their bid at some rate $r$, the universal payment increases at rate at most $r/2$ due to Lemma~\ref{lemma:paychangeslow}. At some point, $j$'s bid will surpass the universal payment, and at this point, due to the third \elaine{hardcoded ref} natural property mentioned earlier, user $j$ must become confirmed. Note that during this entire process, users $1$ and $2$ remain confirmed since their bids $\Gamma$ is sufficiently large. \item Repeating the above process, we will eventually obtain a bid vector such that all $m$ users are confirmed. Now, as long as $m$ is strictly greater than the block size $B$, we reach a contradiction --- note that this is the only place where we use the finite block size assumption in the entire proof. It turns out that we can safely assume $m > B$, since if the initial vector $\bfb$ has fewer than $B$ users, we can always append $0$ bids to $\bfb$ ``for free'' (and showing this requires a little extra work which we defer to the subsequent formal exposition). \end{enumerate} \section{Weak Incentive Compatibility} \section{Rethinking the Incentive Compatibility Notions} \label{sec:weakic} So far in our impossibility results, we have assumed it is free of charge for a strategic player to inject a fake transaction or overbid (i.e., bid higher than its true value), as long as the offending transaction is not confirmed in the present block. \ignore{ Consider the Vickrey auction example again: suppose we include in the block the highest $k$ transactions, among which the top $k-1$ are confirmed, paying the $k$-th price; suppose that all payment goes to the miner. In this case, the miner may want to inject a fake transaction $b'$ whose bid is in between the $(k-1)$-th and $k$-th price. So far, we have assumed that since $b'$ is not confirmed, the miner can inject $b'$ free of charge. } Not only so, in fact, the same model was implicitly or explicitly adopted in earlier works on transaction fee mechanism design~\cite{roughgardeneip1559,roughgardeneip1559-ec,functional-fee-market}, too. Such a model, however, may be overly draconian, since there is actually some cost associated with cheating that the existing model does not charge. In reality, the TFM is not a standalone auction, it is repeatedly executed as blocks get confirmed. Although an overbid or fake transaction need not pay fees to the present miner if it is not confirmed, in real life, any transaction that has been submitted to the network cannot be retracted. Therefore, the offending transaction could be confirmed and paying fees in a future block (e.g., paid to a different miner or simply burnt). \ignore{ Observe that in the proof of Claim~\ref{claim:burningBelowClaim}, we used the following strategy from a miner-user coalition: the miner asks the user to raise its bid to more than its true value. Although this offending transaction is not confirmed in the present block, it can possibly increase the miner's revenue --- note that this means that the offending transaction must be included (but not confirmed) in the block, since the blockchain eventually uses included transactions to decide the prices $\bfp$ and miner revenue $\mu$. If this offending transaction is not confirmed in the present block, it need not pay any fees to the current miner. In our current model as well as those adopted in prior work~\cite{roughgardeneip1559,roughgardeneip1559-ec}, we simply assumed that such an offending transaction that is not confirmed in the present incurs no cost. In practice, however, the TFM is not run in a standalone fashion as in our model. Any transaction submitted to the network can never be revoked, so an offending transaction that is not confirmed in the present may be confirmed in the future. } Consequently, a risk-averse miner-user coalition may be deterred from such deviations for fear of losing the offending transaction's fees to a future block. Therefore, a natural and interesting question is: \begin{itemize}[leftmargin=5mm] \item[] {\it If we fix the existing model and more carefully account for the cost of such cheating, can this help us circumvent the impossibility results?} \end{itemize} One challenge we are faced with, however, is the difficulty of accurately characterizing the cost of such cheating. If an overbid or fake transaction is confirmed in a future block, it is hard for us to predict how much the offending transaction will end up paying, since the payment amount may not be equal to the bid, and the payment amount depends on the environment (e.g., the other bids), as well as the mechanism itself. Despite this difficulty, we still want to understand whether this direction is worth exploring. A reasonable approach is to start by asking what is the worst-case cost. Once we understand what is the worst-case cost, we can consider how to define a more general, parametrized cost model. \begin{enumerate}[leftmargin=6mm] \item {\it Worst-case cost.} A worthwhile first step is to consider the {\it worst-case cost} for the aforementioned deviation. Specifically, whenever a strategic player injects a fake transaction or overbids and the offending transaction cannot be confirmed in the present block, the strategic player assumes the worst case scenario, i.e., the offending transaction can end up paying fees as high as its bid in the future. \Hao{Maybe it is helpful to mention that the worst-case cost is ``the easiest case'' for mechanism design. Thus, that why it gives us the strongest lower-bound.} Assuming the worst-case cost is useful in several ways. First, it is {\it useful for proving lower bounds}. If we can prove lower bounds even for the worst-case cost, it would directly imply lower bounds if in reality, the cost is actually smaller than the worst case. Second, assuming the worst-case cost is also equivalent to considering strategic players who are {\it paranoid} --- they only want to deviate if they will surely benefit, and there is no possible scenario in which they will lose. In other words, we are asking whether there is a mechanism that can at least discourage such paranoid players from deviating. \item {\it General, parametrized cost model.} As mentioned, it is challenging to accurately capture or predict the cost of overbid or fake transactions that are unconfirmed in the present. In practice, however, one might be able to measure the cost of such cheating from historical data. This motivates a more generalized cost model, where we assume that there is some discount factor $\gamma \in [0, 1]$, and the cost of such cheating is actually $\gamma$ times the worst-case cost. \ignore{ In particular, when $\gamma = 0$, there is no cost to cheat --- in this case, our new definitions would be equivalent to the incentive compability notions in Section~\ref{section:definitions}. When $\gamma = 1$, we are effectively assuming worst-case cost. } \end{enumerate} \ignore{ In this section, we will define a weaker notion of incentive compatibility. In this weaker variant, we assume that the strategic player is paranoid or risk averse. Whenever it injects a fake transaction or overbids, and the offending transaction cannot be confirmed in the present block, the strategic player will assume the worst case, i.e., the offending transaction will lose fees as high as its bid in the future. } \subsection{Defining $\gamma$-Strict Utility} \ignore{We define a weak incentive compatibility notion which can be applied to a user, a miner, or a miner-user coalition. We will then describe a mechanism that satisfies this weak incentive compatibility notion. } As we argued, the utility notions in prior work ignore certain costs associated with cheating. We therefore define a more refined utility notion that charges such cost parametrized by a ``strictness'' parameter $\gamma \in [0, 1]$. In other words, when $\gamma = 1$, we are charging the worst-case cost, and equivalently, we are asking whether there are incetive compatible TFMs against {\it paranoid} players who only want to deviate if there is a sure gain and no risk of losing. We will also be using $\gamma = 1$ to prove lower bounds, and this gives stronger lower bound results. When $\gamma = 0$, we are charging no cost --- in this case, our new incentive compatibility definitions would be equivalent to the old notions in Section~\ref{section:definitions}. Recall that the term ``strategic player'' can refer to a user, a miner, or a miner-user coalition. An {\it offending transaction} is one whose bid exceeds the transaction's true value: it can be an untruthful bid or an injected fake transaction, since we may assume that a fake transaction's true value is $0$. In the {\it worst-case} scenario, an offending transaction that is not confirmed in the present block may be charged a transaction fee equal to its full bid, when it is confirmed in a future block (possibly mined by a different miner). Let $v$ be the true value of the offending transaction (and $v=0$ if the offending transaction is fake), and let $b \geq v$ be the bid value. Therefore, in the worst-case scenario, the offending transaction can cost $b - v$ in utility, due to losing fees to a future block. In practice, if we can measure the actual cost from historical data, we may be able to learn a parameter $\gamma \in [0, 1]$, and model the actual cost as $\gamma$ times the worst-case cost, that is, $\gamma \cdot (b - v)$. \ignore{ In our weak incentive compatibility notion, we assume that the strategic player is pessimistic and paranoid: if any offending transaction is not confirmed in the present block, it will be charged a cost corresponding to the worst-case scenario, i.e, when the offending transaction is confirmed in a future block, costing a transaction fee equal to its bid. Specifically, let $v$ be the true value of the offending transaction (and $v=0$ if the offending transaction is fake), and let $b$ be the bid value. In the worst-case scenario, the offending transaction can cost $b - v$ in utility, due to losing fees to a future block. } \ignore{If the offending transaction $b$ is a real, overbidding transaction, the value $v$ of getting confirmed in a future block may even be discounted in comparison with the value $v_{\rm now}$ of getting confirmed immediately. In this case, the cost of the offending transaction could even be higher, which only makes our mechanism design easier. Therefore, without loss of generality, we may assume that $b-v$ is the worst-case cost of this offending transaction. } \ignore{ \elaine{TODO: remove the following repeat text, i've moved it to defn sec} \paragraph{Strategy space.} Since we will be designing a weakly incentive compatible mechanism rather than proving an impossibility now, we want to consider a broad strategy space that captures all possible deviations. In the most general form, a strategic player can engage in the following types of deviations or a combination thereof: \begin{itemize}[leftmargin=5mm,itemsep=1pt] \item {\it Bidding untruthfully}. A user or a user-miner coalition can bid untruthfully, after examining all other users' bids. \item {\it Injecting fake transactions}. A user, miner, or a user-miner coalition can inject fake transactions, after examining all other users' bids. Fake transactions are offer no intrinsic value to anyone, and therefore their true value is $0$. \item {\it Strategically choosing which transactions to include in the block.} More generally, in a TFM, the miner decides which transactions from the mempool to include in a block (possibly subject to validity constraints enforced by the blockchain protocol such as block size limit), and then the blockchain decides from the on-chain state which included transactions are confirmed, the payment vector $\bfp$ for confirmed transactions, as well as the miner income $\mu$. A strategic miner or a miner-user coalition may not implement the inclusion rule faithfully. It may choose an arbitrary subset of transactions from the mempool to include in the block, as long as it satisfies any block validity rule enforced by the blockchain. \end{itemize} } \elaine{in practice, the true value may even decrease if confirmed in future blocks.} \paragraph{$\gamma$-strict utility.} We now formally define the utility function of a strategic player: \begin{mdframed} \begin{center} {\bf $\gamma$-strict utility} \end{center} \begin{itemize}[leftmargin=5mm,itemsep=1pt] \item If the strategic player includes the miner, then let $u \leftarrow \mu$ where $\mu$ is the miner's revenue in the present block; else let $u \leftarrow 0$. \item For any real or fake transaction the strategic player has submitted with true value $v$ and a bid of $b$: \begin{itemize}[leftmargin=5mm,itemsep=0pt] \item if the transaction is confirmed in the present block, let $u \leftarrow u + v - p$ where $p$ denotes its payment. \item if the transaction is {\it not} confirmed in the present block and moreover $b > v$, then let $u \leftarrow u - \gamma\cdot(b-v)$. See also Remark~\ref{rmk:overbid-weakic}. \end{itemize} \item Output the final utility $u$. \end{itemize} \end{mdframed} \begin{definition}[Incentive compatibility under $\gamma$-strict utility] Let $X \in \{\text{UIC, MIC, $c$-SCP}\}$. We can now define $X$ under $\gamma$-strict utility just like in Definitions~\ref{defn:uic}, \ref{defn:mic}, and \ref{defn:scp}, respectively, except that now we adopt the aforementioned $\gamma$-strict utility. \end{definition} \begin{definition}[Weak incentive compatibility] For convenience, for the special case $\gamma = 1$, we also refer to our incentive compatibility notions as {\it weak} incentive compatibility. More specifically, we use the following aliases: \begin{align*} \text{weak UIC} & = \text{UIC under $1$-strict utility}\\ \text{weak MIC} & = \text{MIC under $1$-strict utility}\\ \text{$c$-weak-SCP} & = \text{$c$-SCP under $1$-strict utility} \end{align*} \end{definition} \ignore{ \begin{definition}[Weak incentive compatibility] \ignore{ We say that a TFM is weakly incentive compatible for a strategic player, iff the following holds: no deviations restricted to the aforementioned strategy space can increase the strategic player's utility in comparison with following the rules and bidding truthfully. If a TFM is weakly incentive compatible for any user (or the miner, resp.), we say that it is {\it weakly UIC} (or {\it weakly MIC}, resp.). If a TFM is weakly incentive compatible for any miner-user coalition containing up to $c$ users, we say that the TFM is {\it $c$-weakly-SCP}. } The notions of weak UIC, weak MIC, and $1$-weak-SCP are defined exactly like in Definitions~\ref{defn:uic}, \ref{defn:mic}, and \ref{defn:scp}, respectively, except that now we adopt the aforementioned new utility function. \end{definition} } \begin{remark} Since the miner has the ability to include an arbitrary set of transactions in the block, without loss of generality, we may assume that the following deviations never take place since they do not help the miner or the miner-user coalition: \begin{enumerate}[leftmargin=5mm,itemsep=1pt] \item the miner or the miner-user coalition never bids untruthfully for any transaction {\it not} included in the block; \item miner or the miner-user coalition never injects a fake transaction that is {\it not} included in the block. \end{enumerate} Therefore, one can equivalently view our new utility definition as only charging an additional cost for overbid or fake transactions that are unconfirmed but included in the block. Note that any transaction included in the block must have been broadcast to the network and cannot be retracted. \label{rmk:overbid-weakic} \end{remark} \ignore{ It turns out that weak UIC and UIC are equivalent, but weak MIC and weak SCP are strict relaxations of MIC and SCP. In the following fact, we prove that weak UIC and UIC are equivalent. This means that the Myerson's lemma holds for weak UIC too. \begin{fact}[Weak UIC = UIC] A TFM is weak UIC if and only iff it is UIC. \end{fact} \begin{proof} The direction that UIC implies weak UIC is straightforward. Below, we prove that any weak UIC mechanism is also UIC. For the sake of reaching a contradiction, suppose there is some TFM that is weak UIC but not UIC. This means that some user is incentivized to deviate under the old utility notion, but would not be incentivized any more under the new utility notion. In comparison with the old utility definition, the only difference in the new utility is that we now charge a cost for overbid or fake transactions that are unconfirmed. If there is some user deviation that is profitable under the old utility but not the new one, such a deviation must involve overbidding or injecting a fake transaction that is not confirmed. However, observe that under the old utility, \elaine{this is not true. but myerson's lemma still holds} \end{proof} }
{'timestamp': '2021-11-08T02:04:43', 'yymm': '2111', 'arxiv_id': '2111.03151', 'language': 'en', 'url': 'https://arxiv.org/abs/2111.03151'}
arxiv
\section{Introduction} The idea of building intelligent agents and systems that learn purely by interaction with their environment, known as reinforcement learning \citep{sutton_reinforcement_2018}, is an appealing approach to artificial intelligence with solid connections to neuroscience and psychology \citep{niv_reinforcement_2009, botvinick_deeprl_neuroscience_2020}. Reinforcement learning has generated significant interest both in the research community and in public awareness, especially in combination with deep learning \citep{lecun_deep_2015}, a paradigm known as deep reinforcement learning \citep{Arulkumaran2017ABS}. It has given rise to impressive achievements in various contexts, including building champion game players \citep{silver_mastering_2016, vinyals_grandmaster_2019, openai_dota_2019, schrittwieser_mastering_2020}, and solving long-standing problems in biology \citep{jumper_highly_2021} to list a few. However, human intelligence has defining characteristics lacking in state-of-the-art deep reinforcement learning systems. One important restriction of these systems is that they require significantly large amounts of data to learn~\citep{lake_building_2017, Tsividis2017HumanLI}, as they need a lot of (repeated) exposure to learn rules/concepts contained in data samples which manifests as \textit{slow} learning. In contrast, humans can learn quickly and efficiently, making use of little data. As pointed out by~\cite{botvinick_reinforcement_fast_and_slow_2019}, a source of slowness in deep reinforcement learning can be attributed to the requirement for incremental parameter adjustment in gradient-based optimization of deep neural networks. A technique that has been proposed to tackle the data efficiency problem is Neural Episodic Control (NEC)~\citep{pmlr-v70-pritzel17a}. Instead of gradually learning a representation of the solution, i.e.\ the expected future reward of an action in a certain situation, it stores observed experiences, i.e.\ the resulting rewards of an action, directly in a memory. Encountering a similar situation again, the experiences in the memory are recalled to decide which action yields the best outcome. As a result, episodic control learns significantly faster than gradient-based techniques. Another typical trait of human learning is the ability to seamlessly transfer knowledge across similar tasks leading to a faster learning process in new tasks. This problem is typically tackled under the frameworks of meta~\citep{Hospedales2021MetaLearningIN} and transfer learning~\citep{Taylor2009TransferLF, zhu2020transfer}. One such ability of humans is to reevaluate previously learned behaviors given a new task setting \citep{momennejad2017successor}. For example, to reevalute all the possible ways you learned to drive home from work while maximize a new weighted combination of using minimum time and having scenic views. The framework of Successor Features and Generalized Policy Improvement (SF\&GPI) provides a mechanisms to replicate this human ability. It decomposes the representation of learned behaviors in an environment dynamics part, i.e.\ what will happen when I do this behavior, and a reward part, i.e.\ how to evaluate this outcome. Given a set of learned behaviors, i.e. their environment dynamics, and a new reward function the expected return for each behavior can be computed and the best behavior chosen. The central idea proposed in this paper is a framework combining NEC with SF\&GPI, which we call Successor Feature Neural Episodic Control (SFNEC). We hypothesize that this would provide advantages from both approaches by merging the learning speed conferred by episodic control with flexible transfer from SF\&GPI. We choose these two frameworks for the following reasons. First, episodic control has both a well-founded cognitive science inspiration~\citep{tulving_1972, Lengyel2007HippocampalCT} and displays impressive sample efficiency results in reinforcement learning tasks~\citep{Blundell2016ModelFreeEC, pmlr-v70-pritzel17a}. Likewise, for successor features, the elegance of the SF\&GPI framework and the connections of successor representation~\citep{dayan_improving_SR_1993, gershman_successor_2018} to neuroscience form the basis of our motivation. Additionally, a recent study~\citep{tomov_multi-task_2021} suggests that humans use a strategy similar to SF\&GPI for multi-task reinforcement learning. To summarize, our main contributions are: \begin{itemize} \item Introduction of SFNEC, a novel approach integrating sample-efficient learning using episodic control with meta learning using SF\&GPI \item Empirical validation of SFNEC by showing its advantage over baseline SF\&GPI, and NEC \end{itemize} \section{Background} \subsection{Reinforcement Learning} Reinforcement learning~\citep{sutton_reinforcement_2018} refers to a learning process where an agent attempts to maximize cumulative rewards it can obtain while interacting with its environment. Reinforcement learning problems are formalized as \textit{Markov Decision Processes} (MDPs)~\citep{puterman_markov_1994}. A MDP is a tuple ($\mdp{S}, \mdp{A}, p, \mdp{R}, \gamma$), where $\mdp{S}$ is the state space, $\mdp{A}$ is the action space, $p$ is the state transition probability distribution function $p(s_{t+1} | s_t, a_t)$ defining the probability of ending in state $s_{t+1} \in \mdp{S}$ after an agent takes action $a_t \in \mdp{A}$ in state $s_t \in \mdp{S}$ at the current time step $t$, and $\mdp{R}$ is the reward function associated with a transition $(s_t, a_t, s_{t+1})$. The goal of a reinforcement learning agent is to learn a \textit{policy} $\pi$, a mapping from states to actions, so as to maximize the expected sum of discounted rewards $G_t = \ensuremath{\mathbb{E}}^\pi[\sum_{j = 0}^{\infty} \gamma^{j}r_{t+j}]$, called the \textit{return}, where $r_{t+j}$ are the rewards received at each time step, and $\gamma \in [0, 1)$ is the discount factor used to determine how much weight is accorded to future rewards. \textit{Value function} based methods represent a large class of reinforcement learning algorithms based on classical \textit{dynamic programming}~\citep{bellman_dynamic_2010}. They learn a value function, here an \textit{action value function}, that can be recursively represented according to the Bellman equation: \begin{equation*} Q^\pi(s_t, a_t) = \ensuremath{\mathbb{E}}^\pi\left[\sum_{j = 0}^{\infty} \gamma^{j}r_{t+j}\right] = \ensuremath{\mathbb{E}}\left[r_t + \gamma Q^\pi(s_{t+1}, a_{t+1})\right]~. \end{equation*} The policy is then defined by maximizing the Q-function: $\pi(s) = \ensuremath{\mathrm{argmax}}_a Q^\pi(s,a)$. A widely used method within this class of algorithms is $Q$-learning~\citep{watkins_q-learning_1992} trying to learn the optimal Q-function: $Q^*(s_t, a_t) = \ensuremath{\mathbb{E}}\big[r_t + \gamma~ \ensuremath{\mathrm{argmax}}_{a_{t+1}} Q^\pi(s_{t+1}, a_{t+1})\big]$. \david{should the $Q$ function inside the bracket also be $Q^*$?} Classical $Q$-learning is restricted to small problems because it requires a table of all state-action pairs which becomes prohibitive or even unfeasible when attempting to scale to high dimensional state spaces. Thus, more recently, powerful function approximators such as deep neural networks are used which allow methods like $Q$-learning to scale to high dimensional state spaces, as exemplified in Deep Q-Network~\citep{Mnih2013DQN} and more recent variants. \subsection{Episodic Control} Episodic memory~\citep{tulving_1972} is a model from the field of psychology, which refers to an autobiographical kind of memory about one's personal experiences. Likewise, episodic control~\citep{Lengyel2007HippocampalCT} implies the utilization of episodic memory for reinforcement learning by replaying stored action sequences from previous experiences. \paragraph{Neural Episodic Control:} Neural Episodic Control (NEC)~\citep{pmlr-v70-pritzel17a} is a computational model of episodic control. Central to NEC, is a memory structure called \textit{differentiable neural dictionary} (DND) which is a table $M_a$ of a pair of dynamically growing arrays of keys and values $(K_a, V_a)$ for each action $a \in \mdp{A}$. The keys here represent a learned representation of the agent state, while the values are $Q$-value estimates. To estimate the $Q$-value for a particular $(s, a)$ pair, a lookup is performed with the corresponding DND for action $a$ using a query key $h$, which is a lower-dimensional representation of $s$. The governing equation is: $Q(s, a) = \sum_{i} w_i v_i$, where $v_i$ corresponds to $Q$-values stored in $V_a$ and $w_i$ are weights corresponding to the result of a normalized kernel $k$ between the query key $h$ and keys $h_i$ in $K_a$ as follows $w_i = k(h, h_i) / \sum_j k(h, h_j).$ Two techniques were employed to enable the scalability of this model. First, the number of elements involved in lookups was limited to the top $50$ nearest neighbours, efficiently found using a k-d tree. Second, the sizes of the DNDs were kept limited by removing the least recently used items. Furthermore, the values stored in memory were $N$-step Q-value estimates: \[ Q^{(N)}(s_t, a_t) = \ensuremath{\mathbb{E}} \left[ \sum^{N - 1}_{j = 0}\gamma^jr_{t + j} + \gamma^N\max_{a^\prime} Q(s_{t + N}, a^\prime) \right]~.\] Updates to keys already found in the DND memory store while learning were done using $Q$-learning as $Q_i \leftarrow Q_i + \alpha(Q^{(N)}(s, a) - Q_i)$. \subsection{Meta and Transfer Learning} Meta \citep{li2018deep} and transfer learning \citep{Taylor2009TransferLF, Lazaric2012TransferIR,zhu2020transfer} refer to methods that allow knowledge learned from one or several tasks to be reused when faced with new tasks. In reinforcement learning, these tasks are defined by a set of MDPs $\mathcal{M}$. To have a transfer between MDPs, some shared structure must exist between them. For example, consider an agent facing a set of navigation tasks in a sequence. Assuming the dynamics remain the same across these tasks, we can specify the desired behaviour by rewarding the agent to reach specific locations. Thus, specifying different tasks for an agent in this environment corresponds to different reward functions based on its location. In this paper, we are interested in this setting for transfer where successive tasks solved by an agent only differ in their reward functions. A prominent method for this setting is the SF\&GPI framework~\citep{Barreto2017SuccessorFF}. \paragraph{Successor Features:} Successor features (SF) are based on the idea of learning a value function representation that decouples rewards from environment dynamics~\citep{Barreto2017SuccessorFF}. This is accomplished under the assumption that rewards are a linear combination of features $\mat{\phi}_t = \mat{\phi}(s_t, a_t, s_{t+1}) \in \ensuremath{\mathbb{R}}^n$ that depend on a state transition and a weight vector $\mat{\mathrm{w}} \in \ensuremath{\mathbb{R}}^n$: $r_t = \mat{\phi}_t^\top \mat{\mathrm{w}}$. Features describe the essential aspects of states for evaluating them with a reward function in a low-dimensional representation. Each MDP in $\mathcal{M}$ has a different weight vector that defines its reward function, and the features are shared between all MDPs. As a result, the $Q$-function rewrites as: \begin{equation*} Q^\pi(s_t, a_t) ~=~ \ensuremath{\mathbb{E}}^\pi\left[ \sum_{i = t}^\infty \gamma^{i-t} r_i \right] ~=~ \ensuremath{\mathbb{E}}^\pi\left[ \sum_{i = t}^\infty \gamma^{i-t} \mat{\phi}_i^\top\mat{\mathrm{w}} \right] ~=~ \mat{\psi}^\pi(s_t, a_t)^\top \mat{\mathrm{w}} ~, \end{equation*} where $\mat{\psi}^\pi(s, a)$ are known as the successor features (SF) of ($s_t$, $a_t$) under policy $\pi$. Also, SF satisfy a Bellman equation: $\mat{\psi}(s_t, a_t) = \mat{\phi}_{t} + \gamma \ensuremath{\mathbb{E}}^\pi[\mat{\psi}^\pi(s_{t+1}, \pi(s_{t+1}))]$, and thus can be learned using conventional reinforcement learning methods. \paragraph{Generalized Policy Improvement:} Generalized policy improvement (GPI) is an operation to combine multiple policies, i.e.\ policies that were learned in previous tasks, to define a policy $\pi(s)$ for a new task: $\pi(s) \in \ensuremath{\mathrm{argmax}}_a \max_i Q^{\pi_i}(s, a)$. Using the SF decomposition $Q^{\pi_i}(s_t, a_t) = \mat{\psi}^{\pi_i}(s_t, a_t)^\top \mat{\mathrm{w}}$, the GPI operator becomes $\pi(s) \in \ensuremath{\mathrm{argmax}}_a \max_i \mat{\psi}^{\pi_i}(s_t, a_t)^\top \mat{\mathrm{w}}$. As a result, the operator allows reevaluating old policies in a new task with reward weight vector $\mat{\mathrm{w}}$ to chose the best action according to them. Based on this, an algorithm for transfer using SF\&GPI was proposed in \citep{Barreto2017SuccessorFF} called SFQL. \section{Method: The SFNEC Model} \begin{figure} \centering \includegraphics[width=0.72\linewidth]{figures/SFNEC_diagram.pdf} \caption{SFNEC architecture to store in an episodic manner $\mat{\psi}$-values. } \label{fig:sfnecmodel} \end{figure} Our proposed model, SFNEC (Fig.~\ref{fig:sfnecmodel}), extends NEC to learn successor features $\mat{\psi}(s,a) \in \ensuremath{\mathbb{R}}^n$ in place of scalar action-values. Like NEC, which learns $N$-step $Q$-values, SFNEC learns $N$-step $\mat{\psi}$-values: \begin{equation} \label{eqn:nsteppsi} \mat{\psi}^{(N)}(s_t, a_t) = \ensuremath{\mathbb{E}} \left[ \sum_{j=0}^{N - 1} \gamma^j \mat{\phi}_{t + j} + \gamma^N \max_{a^\prime}\mat{\psi}(s_{t + N}, a^\prime) \right] ~. \end{equation} To perform a lookup using the SFNEC model, we use Equation~\ref{eqn:psilookup}: \begin{equation} \label{eqn:psilookup} \mat{\psi}(s_t, a) = \sum_{i} \frac{k(s_t, s_i)}{\sum_{j} k(s_t, s_j)} * \mat{\psi}_i ~, \end{equation} where $\mat{\psi}_i$ corresponds to a previously stored $\mat{\psi}_i$-value for a state $s_i$ in memory, and $k$ is the kernel used to compute a similarity score between the query state $s_t$ and states in memory $s_i$. We note that we directly used the state vector $s_t$ as keys in memory for our experiments. In general, the NEC architecture allows training an embedding network to learn a lower-dimensional state embedding to be used as keys in memory. Similar to NEC, we limit the elements in memory used during lookups to the top nearest neighbours, e.g., $50$. Likewise, we also used the inverse distance kernel used in \citep{pmlr-v70-pritzel17a}: $k(s, s_i) = \frac{1}{\|s-s_i\|_2^2 + \delta}$. During training, $\mat{\psi}$-values are updated after observing $N$ transitions. When the $\mat{\psi}$-value for a state action pair $(s, a)$ does not exist previously in memory, $N$-step estimates computed using Equation~\ref{eqn:nsteppsi} are inserted in the corresponding DND for action $a$. On the other hand, $\mat{\psi}$-values already in memory are updated using: $\mat{\psi}_i\leftarrow \mat{\psi}_i + \alpha(\mat{\psi}^{(N)}(s, a) - \mat{\psi}_i)$. We defer for details of the algorithm and the training procedure to Appendix~\ref{app:agents}. \newpage \section{Experiments} \label{sec:experiments} \begin{wrapfigure}{r}{0.5\textwidth} \vspace{-4mm} \centering \includegraphics[width=0.65\linewidth]{figures/object_collection.pdf} \caption{ \chris{You need your own figure for the final version to avoid copyright issues!} 2-D object collection environment proposed in \citep{Barreto2017SuccessorFF}. } \label{fig:object_collection_task} \end{wrapfigure} \chris{Describe the connections between tasks, rewards, weights and features.} We evaluated SFNEC in the two-dimensional object collection environment (Fig.~\ref{fig:object_collection_task}) proposed by \cite{Barreto2017SuccessorFF}. The environment consists of four rooms with a start location in the bottom left denoted 'S', and a goal location in the top right denoted 'G'. Multiple objects exist within the rooms belonging to three classes shown as a circle, square, and triangle. The goal is to navigate from the start position to the goal position while picking up objects to maximize the cumulative rewards. Objects once picked up disappear and reappear at the beginning of a new episode. To utilize the SF\&GPI framework as defined in~\citep{Barreto2017SuccessorFF}, it is necessary to have a linear decomposition of rewards into features and weights as $r_t = \mat{\phi}^{\top} \mat{\mathrm{w}}$. The features describe the picked up object classes and if the goal state is reached using a binary representation: $\mat{\phi} \in \{0, 1\}^4$. The first three feature components represent if an object belonging to one of the three classes has been picked, while the last component represents if the goal state is reached. Thus, rewards associated with each transition can be expressed as a dot product between these features and weight vectors $\mat{\mathrm{w}} \in \ensuremath{\mathbb{R}}^4$ that contain the reward associated with picking up each object class and reaching the goal. Different tasks in the environment are then defined by setting a weight vector $\mat{\mathrm{w}}$. To demonstrate good performance, an agent faces a series of tasks, each being a different instantiation of $\mat{\mathrm{w}}$ with the aim of maximizing the sum of rewards accumulated by the agent. In general, we follow the same setup for this environment as in \citep{Barreto2017SuccessorFF} with further details given in Appendix~\ref{app:experiments}. We compare SFNEC with SFQL, NEC, and a version of SFNEC without GPI. \paragraph{Results:} \label{subsec:four_room_results} We compared the average return per task over $10$ runs of each algorithm (Fig.~\ref{fig:four_room_results}). SFNEC with GPI performs best, outperforming NEC and SFQL agents. We expect this as SFNEC combines learning speed from episodic control on each task with the strong transfer conferred by SF\&GPI. Furthermore, we note that NEC and SFNEC without GPI show a significantly improved learning speed over the SFQL baseline during the first $10$ tasks due to their episodic memory even without having a transfer mechanism. \begin{figure}[htbp] \centering \includegraphics[width=\textwidth]{figures/sfnec_paper_average_return_per_task_per_step.pdf} \caption{ SFNEC has a higher learning speed than other methods. Depicted is the mean of the average return per task over 10 runs with the standard error shown as the shaded regions.} \label{fig:four_room_results} \end{figure} \section{Discussion} \label{chap:discussion} \paragraph{Complementary benefits of episodic control and SF\&GPI:} Like SFQL, SFNEC learns $\mat{\psi}$-values and utilizes GPI. However, SFNEC uses episodic memory, which means the main advantage we expect would be improved learning speed compared to SFQL. This is confirmed in the results (Fig.~\ref{fig:four_room_results}) as SFNEC rises in performance much faster than SFQL, even though they reach similar performance levels in the long run due to both algorithms utilizing GPI for transfer. On the other hand, NEC and SFNEC without GPI also employ episodic control but differ from SFNEC by not utilizing GPI but attempting to learn each task from scratch rapidly. More specifically, NEC directly learns $Q$-values, while SFNEC without GPI learns $\mat{\psi}$-values. We observe that SFNEC without GPI and NEC perform similarly and can demonstrate reasonably strong performance in learning all tasks individually due to their usage of episodic control. However, they are not able to match the long-run performance of SFNEC. Putting both comparisons together, we deduce that the combination of episodic control with transfer using the SF\&GPI framework in SFNEC brings together rapid learning and transfer. However, as can be seen towards the right end of Fig.~\ref{fig:four_room_results}, SFQL would most probably overtake SFNEC in subsequent phases. This is similar to the observation reported in~\cite{pmlr-v70-pritzel17a} where parametric methods like DQN outperform NEC in the long run. We leave an investigation of integrating methods proposed to tackle this into SFNEC for subsequent work. \paragraph{Learning a lower-dimensional state embedding:} We conducted further preliminary experiments with SFNEC that attempted to learn a lower-dimensional state embedding for the keys of the DND, like the original setup in NEC. However, this did not yield good results yet. We hypothesize that this might be due to higher approximation errors introduced when learning an embedding. With the method we used in this paper, where we did not learn an embedding, we have the advantage that the keys are stable as they come directly from environment observations. Thus, learning is easier for the agent as it is not burdened with a representation learning stage. Logically, we can expect that if the agent cannot learn a good embedding to produce keys in the DND for a particular task, then reusing this on a new task can lead to erroneous predictions of the $\mat{\psi}$-values. Essentially, this would mean the approximation error could be high for the policies involved in the GPI procedure because of inaccurately learned embeddings, which could result in poor performance. \section{Related work} \label{chap:related} \paragraph{Episodic Control:} Several improvements and extensions to NEC have been proposed. In \citep{lin_episodic_2018} Episodic Memory Deep Q Network was proposed, an architecture that augments DQN with an episodic memory-based estimate. They found that combining this with a TD estimate improved sample efficiency and long-term performance over DQN and NEC. \cite{sarrico_sample-efficient_2019} investigated adding principled exploration to NEC by combining episodic control with maximum entropy mellowmax policy. \citep{agostinelli_memory-efficient_2019} on the other hand, proposed using dynamic online k-means to improve the memory efficiency of NEC. Likewise,~\citep{Zhu2020EpisodicRL} proposed to further optimize the usage of the contents of the episodic memory store by considering the relationship between contents of episodic memory. Finally,~\citep{Hu2021GeneralizableEM} recently introduced \textit{Generalizable Episodic Memory} which extends the applicability of episodic control to continuous action domains. These extensions are parallel developments to SFNEC and could be integrated with it. \paragraph{Successor Features:} A few extensions to successor features exist. A relaxation of the condition that reward functions be expressed as a linear decomposition, as well as a demonstration of how to combine deep neural networks with SF\&GPI was introduced in \citep{Barreto2019SF}. Another direction aims to learn appropriate features from data such as by optimally reconstruct rewards \citep{Barreto2017SuccessorFF}, using the concept of mutual information \citep{hansen2019fast}, or the grouping of temporal similar states \citep{madjiheurem2019state2vec}. A further direction is the generalization of the $\psi$-function over policies \citep{borsa2018universal} analogous to universal value function approximation \citep{schaul2015universal}. Similar approaches use successor maps \citep{madarasz2019better}, goal-conditioned policies \citep{ma2020universal}, or successor feature sets \citep{brantley2021successor}. However, none of these extensions studied the usage of SF in combination with episodic memory. \section{Conclusion} \label{chap:conclusion} We introduced SFNEC, and showed its viability as a framework that combines rapid learning and transfer. However, a few problems would need to be addressed to obtain a robust practical implementation. An example would be investigating methods for reducing memory requirements as this is a real-world constraint. Similarly, deciding when to learn tasks or automatically detect task switches is an area to tackle. Some suggestions for tackling such problems have been pointed out in \citep{Barreto2017SuccessorFF}, and we believe it would be fruitful work to investigate applying SFNEC on real-world tasks with an evaluation of different techniques to handle these various challenges.
{'timestamp': '2021-11-08T02:02:35', 'yymm': '2111', 'arxiv_id': '2111.03110', 'language': 'en', 'url': 'https://arxiv.org/abs/2111.03110'}
arxiv
\section{Conclusion} \label{sec:conclusion} We have presented an approach for learning robot-tool manipulation by watching instructional videos. From the video, we extract the 3D tool trajectory and propose an alignment procedure to find a suitable simulation state that approximates the real-world setup observed in the video. We use the alignment procedure followed by trajectory optimization to initialize the control policy search in the simulated environment. Our evaluation shows that learning such policies is nontrivial, and the video demonstration is essential for success. By leveraging the video, we overcome the need for costly manual demonstration in the robot's environment. This opens up the possibility of considering a wider range of target tools, tasks, and robots including moving platforms and humanoids. \bibliographystyle{IEEEtran} \section{Introduction} Robotic systems are an essential part of the modern world. Robots assemble products on manufacturing lines, transport goods in warehouses, or clean floors in our living rooms. However, outside of controlled settings, robots are far behind humans in terms of dexterity and agility when it comes to using human tools in uncontrolled environments~\cite{4141029}. Existing approaches to designing robotic skills in human environments, for example, pouring water~\cite{4115573, caccavale_kinesthetic_2019}, using kitchen tools~\cite{5723326}, drilling~\cite{atkinson2007robotic}, or hammering~\cite{fitzgerald_human-guided_2019}, rely on complex motion planning~\cite{4115573, 5723326, atkinson2007robotic} or on learning from expert demonstrations provided in the robot's environment by manually guiding the robotic manipulator~\cite{caccavale_kinesthetic_2019, fitzgerald_human-guided_2019}. Manual demonstration or teleoperation are costly and robot-dependent, limiting the scalability of the approach, especially when transferring skills to different robotic platforms such as industrial manipulators or humanoids. This work aims to replace the manual demonstration by information extracted from an instructional video that can be found on the Internet (Fig.~\ref{fig:teaser},~A). Leveraging information from online instructional videos opens up the exciting possibility of quickly learning a wide variety of new skills without the need for costly manual demonstrations or expert motion programming. \begin{figure}[t] \centering \includegraphics[width=1\linewidth]{pictures/teaser_image.png} \caption{ {\bf Learning tool manipulation from unconstrained instructional videos} here shown on learning the spade task policy for the Panda robot. \vspace{-5mm} } \label{fig:teaser} \end{figure} \begin{figure*}[t] \centering \vspace*{5pt} \includegraphics[width=\linewidth]{pictures/approach_flatten_v6.png} \caption{ {\bf An overview of the proposed approach.} Input consists of (a)~a simulated environment and (b)~an input video demonstration. The proposed approach proceeds along the following four steps: (i)~extract the 3D trajectory of the human and the tool from the input video using~\cite{DBLP:journals/corr/abs-1904-02683}, (ii)~align the simulated environment with the input video using the extracted tool trajectory (Sec.~\ref{subsec:trajectory_alignment}), (iii)~learn robot policy in the simulated environment using reinforcement learning guided by trajectory optimization (Sec.~\ref{subsec:policy_learning}), and (iv)~execute the learned policy on the real robot. The two main technical contributions of this work are in steps (ii) and (iii). \vspace{-5mm}} \label{fig:approach} \end{figure*} For extracting information from videos, we use a motion reconstruction approach~\cite{DBLP:journals/corr/abs-1904-02683} that provides an automatic reconstruction of the whole human body and the tool motion demonstrated in a video. In this work, we describe a generic approach for transferring this extracted motion to a robotic system to solve a tool manipulation task by a robot. We assume that we have access to a simulated environment for the task with a sparse reward function that indicates the completion of the task. Such environments can be constructed using standard simulation tools such as~\cite{physx}. Using only the sparse reward signal for learning the tool manipulation policy is extremely difficult, as we also show in Section~\ref{subsec:evaluation}. We demonstrate that a good policy can be learned by using an Internet video as a demonstration to guide the learning process. Using the human video demonstration for learning the tool manipulation task presents the following two technical challenges: First, how to adjust a simulated environment to approximately resemble the scene in the video? Second, how to map the human motion to the robot morphology, which is also known as motion retargeting? We present the following contributions that address these challenges. First, we design an alignment procedure that aligns the simulated environment with the real-world scene observed in the video. This alignment procedure uses the trajectory extracted from the video to condition sampling of the scene object positions and properties as well as the unknown tool rotation. Second, we combine reinforcement learning with an optimization procedure to find a control policy and the placement of the robot based on the tool motion in the aligned environment. The overview of the proposed approach is shown in Fig.~\ref{fig:approach}. Focusing on the tool trajectory has the advantage of being independent of the kinematic structure of the robot and allows us to easily train control policies for different robot morphologies. We illustrate the effectiveness and versatility of our approach on three different robots: Franka Emika Panda, UR5, and the Talos humanoid robot with a fixed lower body, applied for three different manipulation tasks involving various tools: spade, hammer, and scythe. Additionally, we show the transferability of the trained spade policy to the real Franka Emika Panda robotic arm~\cite{franka-panda-robot}, as shown in Fig.~\ref{fig:teaser}. lease refer to our project page~\cite{project_page} for the supplementary video and code. \section{Related work} \label{sec:related_works} \noindent \textbf{Reinforcement learning}~(RL) methods have been applied in robotics for solving various robotics tasks, for example, helicopter control~\cite{abbeel_application_2007}, putting a ball in a cup~\cite{NIPS2008_3545}, pouring water into a glass~\cite{4115573}, stacking blocks~\cite{riedmiller_learning_nodate} or solving Rubik's cube with a robotic hand~\cite{openai2019solving}. Solving these tasks usually requires having a dense reward that is obtained by manual reward shaping. Even with a dense reward, the policy search often falls in a local optima. Such poor local optima can be avoided by using a guided policy search~\cite{levine2013GPS} that guides RL using samples from a guiding distribution constructed with trajectory optimization methods. We build on this line of work and consider powerful trajectory optimization techniques as a way to initialize reinforcement learning. Guided policy search was successfully applied, for example, for end-to-end training of policies that map input images to robot motor torques~\cite{levine2016GPSvisuomotor} for tasks such as hanging a coat hanger on a clothes rack or fitting the claw of a toy hammer under a nail. However, many problems, including the ones tackled in our work, are specified only by a sparse reward, in which the rewarding signal is given only after the task is successfully completed. Solving tasks with sparse rewards remains a challenging open problem because of the need for complicated environment exploration. This problem can be addressed, for example, by using smaller auxiliary tasks along with a sparse goal reward and a scheduler that combines smaller tasks into a sequence of actions~\cite{riedmiller_learning_nodate}. However, this approach relies on computing the auxiliary rewards, which may be environment dependent and requires substantial domain knowledge. Another way to improve exploration in environments with sparse rewards is to learn from demonstrations, which we also explore in this work. \noindent \textbf{Learning from demonstration} can initialize the agent and speed up the optimal policy search~\cite{ARGALL2009469}. It has been successfully shown on various tasks~\cite{fitzgerald_human-guided_2019, NIPS2008_3545, lfd1, lfd2, lfd_in_rl}. Examples include learning Dynamic Movement Primitives (DMPs)~\cite{fitzgerald_human-guided_2019}, that can be further adjusted to unfamiliar tools using human demonstrated corrections. Others have used a combination of DMPs and RL to learn in-contact skills~\cite{lfd1} or have included demonstrations into the replay buffer along with the agent's experience~\cite{lfd_in_rl}. In another example~\cite{abbeel2010autonomous}, a probabilistic approach is used to find an intended trajectory from multiple expert demonstrations to guide the design of a controller for autonomous helicopter flight. For all these methods, however, the demonstrations are given in the agent's environment. In contrast, we aim at replacing the demonstration in the agent's environment by a demonstration in an instructional video downloaded from the Internet. \noindent \textbf{Learning skills from videos.} Using videos to improve the efficiency of RL has been studied in the past for human or animal motion skills ~\cite{DBLP:journals/corr/abs-1804-02717, RoboImitationPeng20, 2018-TOG-SFV}. DeepMimic~\cite{DBLP:journals/corr/abs-1804-02717} uses a reference motion in combination with the task-specific goal to learn a set of motion skills. Reference motions are presented as a sequence of character target poses obtained by manual pre-processing of mocap clips. SFV~\cite{2018-TOG-SFV} uses human poses automatically estimated from the input video. The agent learns to replicate the reference human motion. Related is also~\cite{RoboImitationPeng20} that learns from animal videos and re-targets the observed motion to the simulation. Instead of extracting from the video and re-targeting the motion of the human, we focus on the motion of the tool. This allows transferring the learned skills to robots of varying morphologies that differ from the morphology of the human observed in the video. Another approach~\cite{ImitationFromObservation} uses “imitation-from-observation” that translates the available expert demonstration to the current robot context. This allows to compute a reward signal in an unseen environment and apply RL to learn a control policy. In contrast, we use video demonstration for policy initialization rather than computing reward based on demonstration. Another direction for learning skills from videos is using representations learned from unlabeled videos to compute reward functions for RL~\cite{sermanet2018time, mees2020adversarial}. Learning the representation typically requires recorded or generated training sets (133 sequences for a pouring task in~\cite{sermanet2018time}, 300 simulated videos, and 60 real-world videos per skill in~\cite{mees2020adversarial}). In contrast, we only require a single input demonstration video. This is possible because we extract the 3D motion of the tool and the person from the video using the approach developed in~\cite{DBLP:journals/corr/abs-1904-02683} that uses pre-learnt generic person and object detectors. \noindent \textbf{Estimating 3D pose from video.} In this work, we use~\cite{DBLP:journals/corr/abs-1904-02683} for estimating the 3D motion of the human and the tool in the video. While other methods often focus on reconstructing only the 3D pose of the object, typically from a single input RGB image~\cite{ brachmann_uncertainty-driven_2016, grabner_3d_2018,rad_bb8_2017, xiang_posecnn_2018}, the approach described in~\cite{DBLP:journals/corr/abs-1904-02683} provides a 3D trajectory of the tool (spade, hammer) manipulated by a human, where the tool trajectory is estimated jointly with the trajectory of the human. \noindent \textbf{Robot-tool interaction} research has addressed a range of problems including identifying suitable tools for a certain task~\cite{brown_tool_2011, tee_towards_2018}, tool grasping~\cite{hoffmann_adaptive_2014,wang_rf-compass_2013} or tool guidance using visual feedback~\cite{kemp_robot_nodate}. In contrast, we focus on learning to imitate the full 3D trajectory of the tool extracted from an input video and assume that the tool is rigidly connected to the target robot manipulator. Given the focus on the tool, the morphology of the target robot can be easily changed. \section{Learning Tool Manipulation Policy} \label{sec:approach} Our aim is to learn a policy for the robot that manipulates a tool to complete a specified task, as illustrated in Fig.~\ref{fig:approach}. The input of the proposed approach consists of: (a)~a simulated environment with a sparse reward signal $r^g$ and (b)~an instructional video of a human operating the tool in a real-world scene. This approach is generic and can be used in various environments, but in the following we will use the spade environment as a running example to simplify the explanation. More environments are shown in Sec.~\ref{sec:experiments}. The simulated environment is parameterized by a set of parameters $\mathcal{P}$ that include the positions and other properties (\emph{e.g}\onedot} \def\Eg{\emph{E.g}\onedot rotation) of the scene elements. The exact values for parameters $\mathcal{P}$ are not known \textit{a priori}, and only upper and lower limits for these parameters are provided. The proposed approach (see Fig.~\ref{fig:approach}) starts from the instructional video. We (i)~extract the tool motion from the video and apply an (ii)~alignment step to transform the simulated environment to approximately resemble the setup shown in the input video. This allows us to use the extracted trajectory as a guiding signal via trajectory optimization in the subsequent (iii) reinforcement learning, which finds a control policy for the robot. Finally, we (iv)~transfer the sequence of actions from the simulated environment to the real robot. These steps are described in detail next. \subsection{Extracting the tool trajectory from the video} Our input is an instructional video of the tool manipulation performed by a human. We use the approach described in~\cite{DBLP:journals/corr/abs-1904-02683} to extract the 3D trajectories of the human body and the manipulated tool from the video. The approach combines visual recognition techniques with trajectory optimization to find the 3D trajectory of the tool and the human that best explains the observed input video while modeling contact interactions and full body dynamics. The tool is represented as a line segment and the tool trajectory is represented by the 3D positions of the line segment's endpoints over time. Modeling the tool as a simple 3D line segment is general and encompasses a large set of tools manipulated by humans, including hammers, shovels, or rakes. Given this simplified model, the tool's orientation is not completely determined because the rotation about one axis (along the length of the tool) is unknown. This unknown parameter can be determined, together with other unknown parameters of the environment in the subsequent alignment phase. \subsection{Aligning the simulated environment with the input video} \label{subsec:trajectory_alignment} From the video, we extract the 3D trajectory of the tool, and the sequence of 3D human poses. However, we do not extract any information about the environment and how the tool is related to the other scene elements. For the spade example shown in Fig.~\ref{fig:approach}, the position of the sand pile or the target location where the sand needs to be transferred are unknown. Hence, aligning the simulated environment with the input video scene constitutes a major challenge. To deal with this challenge, we have designed an alignment procedure that proceeds along the following steps: (i) we construct distribution $\mathbb{P}$ for parameters $\mathcal{P}$ of the simulation (\emph{e.g}\onedot} \def\Eg{\emph{E.g}\onedot~the placement of the sand and the target box) based on the trajectory extracted from the video; (ii) we sample the simulation parameters from the constructed distribution, (iii) we follow the extracted trajectory in simulated environment and observe if there is any goal reward (\emph{e.g}\onedot} \def\Eg{\emph{E.g}\onedot~has any sand been transferred to the target box). A positive goal reward means that our simulation with the currently sampled parameters $\mathcal{P}$ is a sufficient approximation of the scene from the video. In detail, the goal is to find a set of parameters $\mathcal{P}$ that leads to non-zero goal reward $r^g$, where $r^g$ is obtained from the environment after following the extracted trajectory. The main idea of the proposed alignment approach is that a suitable distribution of parameters of the simulated environment can be constructed by analyzing the trajectory of the tool because the tool interacts with the important elements of the environment. Hence, we extract keypoints along the tool trajectory and place the task-related scene elements (\emph{e.g}\onedot} \def\Eg{\emph{E.g}\onedot~the sand deposit or the goal box) at candidate locations given by those keypoints. \vspace*{1mm} \noindent \textbf{Identifying keypoints along the trajectory.} We assume that the trajectory has keypoints at positions in which the tool interacts with the important scene elements in the environment. These keypoints will act as candidates for the placement of the scene elements. We identify a set of keypoints $\mathcal K = \{\bm{k_1},\dots,\bm{k_m}\}$ as points at which the tool velocity is high (top 5\%) or low (bottom 5\%). \vspace*{1mm} \noindent \textbf{Sampling scene elements.} The positions of the scene elements $\bm x_j$ are sampled randomly from a Gaussian mixture with means located at the computed keypoints~$\bm{k_i}$ and tunable covariance matrix~$\Sigma$: $ \bm x_j \sim \sum_{i=1}^m w_i \mathcal{N}(\bm{k_i},\Sigma)$, where $w_i$ is a weight of the corresponding component. To avoid sampling two objects too close to each other, we define a minimum distance between objects as: $d_{th} = 0.1 (d_{\text{max}}-d_{\text{min}})$ where $d_{\text{max}}$ is the maximum and $d_{\text{min}}$ is the minimum distance between any two points of the entire extracted tool trajectory. \vspace*{1mm} \noindent \textbf{Sampling unknown tool rotation, tool offset and other parameters.} We sample the unknown tool rotation \mbox{$\alpha \sim \mathcal{U}(-\pi;\pi)$}. We assume that the rotation of the tool can only change at keypoints, and is constant on the segments between two keypoints. The position offset of the tool along the $z$ axis is sampled as $p_z \sim \mathcal{N}(0,0.5)$. In addition, we sample a trajectory scale uniformly from the values $\{0.5, 0.75, 1\}$. The scale is used to resize the trajectory to allow a smaller robot to reach each of the trajectory points without violating kinematic constraints (\emph{e.g}\onedot} \def\Eg{\emph{E.g}\onedot~joint limits). Other parameters, denoted~$p_i$, are sampled from the uniform distribution $p_i \sim \mathcal{U}(a_i,b_i)$, where $[a_i;b_i]$ are parameter bounds for $p_i$ given by the environment. \vspace*{1mm} \noindent \textbf{Trajectory tracking in simulation.} The simulation scene is created based on the sampled parameters. The simulated tool executes the trajectory extracted from the video ten times and the average goal reward is recorded. We repeat the sampling procedure at most 20,000~times and store the first $K$ parameters $\mathcal{P}_i \sim \mathbb{P}$ that lead to non-zero goal reward~$r^g$. Next, we select $\mathcal{P}_i$ that leads to maximal non-zero goal reward~$r^g$ after executing the robot trajectory. \subsection{Learning tool manipulation policy in the simulation} \label{subsec:policy_learning} The output of the alignment, described in the previous section, are $K$ candidate parameter sets $\mathcal{P}_i$ that adjust the simulated environment to approximately resemble the setup from the input video. The next goal is to use this simulated environment to find a good control policy for the robot. This is a challenging task because the reward signal provided by the environment is sparse. To overcome this challenge, we will show how to use the aligned tool demonstration as an initialization for the robot policy search. We formulate the policy search as a reinforcement learning problem with a fixed time horizon~$H$. The objective function $J(\bm\theta)$ that we wish to maximize is the finite-horizon expected return defined as \begin{equation} \begin{aligned} J(\bm\theta) = \mathbb{E}_{\bm\tau \sim \pi_{\bm\theta}} \left[ \sum\nolimits_{t = 0}^H \gamma^t r_t \right] \, , \label{eq:rl_return} \end{aligned} \end{equation} where $\bm \tau$ is the trajectory generated by the policy $\pi_{\bm\theta}$ parameterized by~$\bm \theta$, $r_t$ is the reward at time $t$ that is composed of the sparse goal reward $r^g_t$ and a penalty for exceeding the joint velocity limits, and $\gamma$ is a discount factor, set to 0.999 in our experiments, that influences the importance of the reward in time. The policy~$\pi_{\bm\theta}(\bm{a_t} | \bm{s_t})$ is a neural network that computes action~$\bm a_t$ based on the observed state~$\bm s_t$. In our setup, action $\bm{a_t} \in \mathbb{R}^N$ is the velocity vector of the robot joints, where $N$ is the total number of degrees of freedom of the robot. State $\bm{s_t} \in \mathbb{R}^{M}$ consists of the position~($\mathbb{R}^{3}$) and the quaternion representation of orientation~($\mathbb{R}^{4}$) of the tool together with the robot joint positions~($\mathbb{R}^{N}$ for a robot with $N$ degrees of freedom) and the time variable (\emph{i.e}\onedot} \def\Ie{\emph{I.e}\onedot~$M = 7 + N + 1$). \noindent \textbf{Guiding policy search via trajectory optimization.} Our sparse reward problem is challenging to solve and reinforcement learning is unlikely to find a policy without a good initialization. The objective is to use the tool trajectory extracted from the video and aligned with the simulation as an initialization for the robot policy. This is, however, challenging as the tool trajectory is in Cartesian coordinates and cannot directly be used as a policy initialization as the policy operates in the joint space of the robot. In addition, the position of the robot in the environment is a priori unknown and can greatly affect the difficulty and feasibility of the resulting manipulation problem. To address these challenges, we formulate the following trajectory optimization problem to find (i) the sequence of control velocities of the robot $\bm{v_0}^*,\ldots,\bm{v_T}^*$ and (ii) the robot base mounting position $\bm b^*$ that follow the trajectory of the tool extracted from the video: \begin{equation} \begin{aligned} \bm b^*, \bm v_0^* , \dots , \bm v_T^* = \argmin_{\bm b, \bm v_0, \dots, \bm v_T}{\sum_{t=0}^T{c_t(\bm b, \bm q_t, \bm v_t) }}\\ \text{s.t. } \bm q_t = \bm q_{t-1} + \bm v_t \Delta t \, , \label{eq:optimization_problem} \end{aligned} \end{equation} where the initial joint position $q_0$ is given and constant, and cost $c_t$ is computed as \begin{align} c_t(\bm b, \bm q_t, \bm v_t) = d(\bm b, \bm q_t, \bm p_t) + w_v \bm v_t^\top \bm v_t + w_b c_b(\bm q_t) \, , \label{eq:joint_optimization} \end{align} where $d(\bm b, \bm q_t, \bm p_t$) denotes the squared distance between the tool pose computed by forward kinematics using the base mounting~$\bm b$ together with the robot configuration~$\bm q_t$ and the target tool pose $\bm p_t$ obtained from the alignment step, the term $\bm v_t^\top \bm v_t$ regularizes the velocity giving preference to smaller velocities, function $c_b(\cdot)$ represents a barrier function that penalizes the violation of the joint limits, scalar weight~$w_v$ controls the velocity regularization and scalar weight~$w_b$ controls the stiffness of the barrier function. The constraint $\bm q_t = \bm q_{t-1} + \bm v_t \Delta t$ in~\eqref{eq:optimization_problem} represents system dynamics, where $\bm q_t$ and $\bm q_{t-1}$ are the configurations of the robot at time $t$ and $t-1$, respectively, $\bm v_t$ is the joint velocity of the robot at time $t$ and $\Delta t$ is the time step. We use Differential Dynamic Programming~(DDP)~\mbox{\cite{crocoddyl20icra}} together with Pinocchio~\cite{carpentier2019pinocchio} to find the fixed robot base position and the sequence of joint velocities that minimize the cost~\eqref{eq:joint_optimization}. \begin{figure*} \centering \vspace*{5pt} \begin{subfigure}[b]{0.32\textwidth} \centering \includegraphics[width=\textwidth]{pictures/video_simulation_drawing_spade_part.png} \caption{Spade environment and input videos} \label{fig:simulation_vs_video_spade} \end{subfigure} \hfill \begin{subfigure}[b]{0.32\textwidth} \centering \includegraphics[width=\textwidth]{pictures/video_simulation_drawing_hammer_part.png} \caption{Hammer environment and input videos} \label{fig:simulation_vs_video_hammer} \end{subfigure} \hfill \begin{subfigure}[b]{0.32\textwidth} \centering \includegraphics[width=\textwidth]{pictures/video_simulation_drawing_scythe_part.png} \caption{Scythe environment and input videos} \label{fig:simulation_vs_video_scythe} \end{subfigure} \caption{\textbf{Input videos and the corresponding environments for learning the robot manipulation policy for three different tools: (a) spade, (b) hammer, (c) scythe. } Each figure shows five different input videos and the input simulation environment that is automatically aligned with each input video using our approach. } \label{fig:simulation_vs_video} \end{figure*} The described procedure is repeated for each of the candidate parameter set $\mathcal{P}_i$ from the alignment stage. The resulting sequence of robot joint velocities, $\bm v_0, \dots, \bm v_T$ is executed in the simulated environment parameterized by $\mathcal{P}_i$. We select the set of parameters $\mathcal{P}_i$ that leads to a maximal non-zero goal reward $r^g$. The corresponding sequence of robot joint velocities is used to compute state-action pairs ($\bm s_t$, $\bm a_t$) to train an initial policy via behavior cloning~\cite{pomerleau1989alvinn}. This initial policy is further fine-tuned by the proximal policy optimization RL algorithm~\cite{ppo} that maximizes the reward defined in~\eqref{eq:rl_return}. These steps are crucial for the success of our approach, as will be shown in the experiments (Sec.~\ref{sec:experiments}). \noindent \textbf{Automatic domain randomization (ADR).} So far, the policy has been learned for a fixed state of the simulated environment found during the alignment step. To generalize the learned policy for different scene setups, we extend state $\bm s_t$ with the position of the objects and sample these positions during training via automatic domain randomization (ADR)~\cite{openai2019solving}. This approach gradually extends the scope of the learned policy by gradually increasing the ranges of possible object positions within the environment. The outcome is a policy that generalizes to different positions of objects in the environment as will be shown in Sec.~\ref{sec:experiments}. \section{Experiments} \label{sec:experiments} \begin{figure*} \centering \vspace*{7pt} \includegraphics[width=\linewidth]{pictures/results_log_scale.pdf} \caption{ \textbf{(Log scale) The goal reward obtained in individual environments.} The bar plots show the total goal reward $r^g$ obtained after different stages of our approach: (i)~tool motion (without robot) transferred from the video to the aligned environment~\textcolor{color1}{(blue)}, (ii)~initial robot policy after trajectory optimization~\textcolor{color2}{(orange)}, (iii)~final robot policy after RL~\textcolor{color3}{(green)}. Results are compared to (iv)~baseline RL approach using only the sparse reward from the environment \textcolor{color4}{(red)} and (v)~baseline RL approach with a manually engineered dense reward~\textcolor{color5}{(gray)}. We learn a separate policy for each input video. Note, that the baseline (iv) did not find a successful policy in any of the experiments and leads to a zero reward, represented by a small bar in the plot. Results are shown for five different videos for the (a)~spade, (b)~hammer, and (c)~scythe environment. For each environment we also report results of learning from kinesthetic demonstration (the last column denoted \textit{LfD}). Plot~(d) shows results for the spade task with three different robots: Panda, UR-5 and Talos. The red horizontal line in each plot shows the success threshold for the given environment. \vspace{-5mm} } \label{fig:main_results_log_scale} \end{figure*} We demonstrate the proposed approach on the following three tasks: (i) transferring sand-like material with a spade, (ii) hammering a nail, and (iii) cutting grass with a scythe. The spade task is also demonstrated for three different robots: (a) Franka Emika Panda, (b) UR5, and (c) the standing Talos robot with a fixed lower body. The learned spade manipulation policy for Franka Emika Panda is demonstrated on the real robot. In the following, we provide the details of the simulated environments (Sec.~\ref{subsec:simulated_envs}), outline the structure of the learned policies (Sec.~\ref{subsec:policy_structure}), and provide the quantitative and qualitative evaluation of the learned policies (Sec.~\ref{subsec:evaluation}). {\bf Please see additional results including real robot experiments in the supplementary video available at~\cite{project_page}.} \subsection{Simulated environments} \label{subsec:simulated_envs} All physics simulations are performed in the PhysX engine~\cite{physx}, with the control frequency set to 24~Hz. We have created three simulated environments: for the spade, hammer and scythe tools. In each environment we include a negative reward for joint velocities above the limits of the robot. \noindent\textbf{Spade environment.} The goal in the spade environment is to transfer sand from the sand deposit to the desired position called the goal box. The input videos depicts a human holding the spade and transferring leaves or gravel from a pile to a burrow, as shown in Fig.~\ref{fig:simulation_vs_video_spade}. The simulated environment for this task includes the spade tool, the goal box, and the deposit with sand-like material. We approximate sand with a collection of spheres, and the sand deposit is formed by three walls, which prevent free movement of the spheres. The placement of the scene elements and sand box orientation are found automatically by the proposed alignment procedure, described in Sec.~\ref{subsec:trajectory_alignment}, such that the environment approximately resembles the input video. The control policy is trained in the aligned simulated scene and is then executed on the real robot. The environment for the real robot experiment is built to match the simulated scene. The goal reward $r_t^g$ in the spade environment is defined as the number of spheres delivered to the goal box. \noindent\textbf{Hammer environment.} The goal in the hammer environment is to plant the nail. The five input videos depict a human using a hammer to break the concrete or to hit a tire, as shown in Fig.~\ref{fig:simulation_vs_video_hammer}. The simulated environment for this task includes the hammer tool and the target nail object. The nail object is connected to the ground plane and constrained to move only in the $z$ direction and only in the range of 0 to 100~mm. The goal reward $r_t^g $ for the hammer environment is computed based on the position of the nail along $z$-axis denoted as~$d_t^z$. The reward is one, if the target is nailed completely ($d_t^z < 0.001$) and zero otherwise. The reward encodes whether or not the nail has completely entered into the material. \noindent\textbf{Scythe environment.} The goal in the scythe environment is to cut grass. The five input videos depict a human using a scythe to cut grass. Sample frames from the input videos are shown in Fig.~\ref{fig:simulation_vs_video_scythe}. The simulated environment for this task includes the scythe tool and patch of several grass elements, where each grass element is represented by a thin vertical cuboid. Grass is randomly generated inside the patch. The placement of the grass patch is found automatically by the proposed alignment procedure (Sec.~\ref{subsec:trajectory_alignment}) to approximately resemble the input video scene. The goal reward $r_t^g $ for the scythe environment is defined as the number of cut grass elements. A grass element is considered as cut if it is intersected by the tool blade close to the ground plane (\emph{i.e}\onedot} \def\Ie{\emph{I.e}\onedot the $z$-coordinate of the intersection point is less than a predefined threshold~$z_{max}$) and the speed of the blade in the cut direction is higher than a pre-defined threshold~$v_{min}$. \subsection{Policy structure} \label{subsec:policy_structure} The policies for the robot were trained with the Proximal Policy Optimization algorithm~\cite{ppo}. For the policy, we use a neural network with two fully-connected hidden layers that consist of 400 and 300 neurons, respectively, and have ReLU activations. The input to the policy is state vector $\bm s_t$. The output of the policy is the mean value $\mu(\bm s_t)$ of the action distribution. The action $\bm{a_t} \in \mathbb{R}^N$ is the velocity vector for the robot joints, where $N$ is the number of degrees of freedom. The action is sampled from the Gaussian distribution $\bm a_t~\sim~\mathcal{N}(\mu(\bm s_t), \Sigma)$, where the covariance matrix $\Sigma$ is diagonal with learnable elements. The value function approximator is a neural network with two hidden layers consisting of 400 and 300 neurons with ReLU activations. \subsection{Evaluation} \label{subsec:evaluation} \noindent\textbf{Quantitative evaluation.} We compare the performance of the following policies: \noindent\textit{(i)~tool in the aligned environment} that imitates the tool motion extracted from the video in the aligned scene~(Sec.~\ref{subsec:trajectory_alignment} - tool motion without a robot), \textit{(ii)~initial robot policy after trajectory optimization} as described in Sec.~\ref{subsec:policy_learning}, \textit{(iii)~final robot policy} learned with the proposed approach, \textit{(iv)~baseline sparse RL approach} that learns a robot policy using PPO~\cite{ppo} with only the sparse goal reward given by the environment without using the video to initialize the learning , and \textit{(v)~baseline RL approach with manually engineered dense reward}. For the spade environment, dense reward consists of the exponential distance between (a) the tool and the sand deposit and (b) the exponential distance between the pile of sand and the goal box. For the hammer environment, the dense reward consists of the exponential distance between the tool and the nail. For the scythe environment, we define two 3D points $\bm x^A$ and $\bm x^B$ that are located on the opposite sides of the grass patch at the ground level. The dense reward includes a positive reward for the tip of the tool being close to the point $\bm x^A$ in the first half of the trajectory and to point $\bm x^B$ in the second half of the trajectory. Also, we add a reward for keeping the tool rotation close to the reference rotation (scythe parallel to the ground). Additional details about computing the dense reward are in the extended version of this work available at~\cite{project_page}. Moreover, for each tool type we conduct an experiment where we learn a policy from an expert kinesthetic demonstration. We record a trajectory of an expert manipulating the robot to complete the task and use this trajectory to train a policy via behavior cloning~\cite{pomerleau1989alvinn}. This policy is further finetuned by PPO~\cite{ppo} and the resulting reward is reported in Fig.~\ref{fig:main_results_log_scale} as \textit{LfD}. The performance of the policies learned from the expert kinesthetic demonstrations are comparable to results obtained with our method which confirms our hypothesis that we can use the video instead of a kinesthetic demonstration to learn a tool manipulation policy. Please refer to the supplementary video for the visualization of the obtained trajectories. The quantitative evaluation of the policies is shown in Fig.~\ref{fig:main_results_log_scale}. Along with reporting goal reward $r^g$ obtained by the final policy, we also define the following notion of success: (a) spade environment - at least 10 spheres in the goal box for at least half of the episode, (b) hammer environment - the nail is planted in the first second, (c) scythe environment - all grass elements in the patch are cut in the first second. With this definition of a success rate, the proposed approach achieves 100\% success for all environments. Note that different videos result in a different alignment with the simulated environment and therefore have different intermediate, (i)+(ii), and final, (iii), results. Ideally, the reward gained after repeating the tool motion without the robot in the aligned environment (i) and executing the initial policy with the robot (ii) should be the same. The small differences are caused by the robot kinematics constraints that do not allow the initial robot policy (ii) to exactly follow the aligned tool trajectory (i) from the video. Also, we penalize velocity limit violation in the RL step and the resulting policies respect the joint velocity limits of the robot, but might take more time to solve the task. This is reflected by the performance drop in the hammer environment where step~(i) of the approach has a higher reward than the final policy, which respects the velocity limits. For our approach, it is crucial that repeating the tool motion in the aligned environment (i) gets a non-zero reward. A non-zero reward is preserved by the initial robot policy obtained by trajectory optimization (ii) as the optimization procedure is designed to follow the aligned tool trajectory. The final policy (iii) learned by RL obtains the highest reward in most of the cases. Frames from the trajectory produced by the spade final policy are shown in~\cref{fig:teaser} and other final policies are depicted in the companion video. The superior performance of the final policy (iii) could be attributed to the meaningful policy initialization as a result of alignment (i) and trajectory optimization (ii) steps, which can effectively guide the learning process to solve the underlying sparse reward task. Without good initialization, the agent does not obtain any reward and performs a random blind search in the environment. This random search is unlikely to find a proper policy for tasks with sequential dependencies, for example, in the spade environment the agent needs to grab the spheres before transferring them into the goal box. This is confirmed by our sparse reward baseline~(iv), which obtains zero reward for all environments. The dense reward baseline~(v) achieves performance that is comparable to the proposed approach, however, only for 60\% of the alignments for each task. In addition, the dense reward needs to be manually engineered and fine-tuned for each task separately. \noindent\textbf{Adaptation to different robot kinematic structures.} Using the tool trajectory instead of the human motion allows us to be agnostic to the robot morphology when we transfer between the input video and simulation. This allows us to easily train new policies for other robots with different morphologies without the need for motion re-targeting, which is one of the key limitations of the current state-of-the-art methods~\cite{DBLP:journals/corr/abs-1804-02717, RoboImitationPeng20, 2018-TOG-SFV}. To demonstrate this capability, we have trained a new policy for the spade task using two additional robots: the 6~DoF UR-5 manipulator and standing Talos robot with a fixed lower body, which has 11~DoF: 2 for the torso and 9 for the right arm. Note that Franka Emika Panda robot that is used in all other experiments has 7~DoF. The quantitative evaluation of the spade task policies for the three mentioned robots is shown in Fig.~\ref{fig:main_results_log_scale}~(d). The results show that all robots achieved a similarly high reward after learning via the proposed approach. The visualization of the learned policies is shown in Fig.~\ref{fig:diff_robots_visual}. \noindent\textbf{Policy generalization.} We have applied ADR (Sec.~\ref{subsec:policy_learning}) in the spade environment and learned a policy for the goal box position randomly sampled from a 100x90~cm rectangle around the initial position. The performance of the policy for different box placements is shown in Fig.~\ref{fig:heatmap_spade_ADR} and in the supplementary video. \begin{figure}[!b] \centering \vspace*{-7pt} \includegraphics[width=\linewidth]{pictures/adr.pdf} \caption{ \textbf{Policy generalization in the spade environment.} We evaluate the policy learned by the automatic domain randomization (ADR) for various goal box positions (green cells correspond to the different centers of the goal box). The colorbar on the right shows the number of spheres transferred to the goal box. The initial position of the goal box (purple) is used as a starting point for ADR, which generalizes the policy to cover the range of goal box positions specified in black. The sand deposit (red) and the robot base (blue) are fixed. The blue curves show the robot working area (dotted) and the working area extended by the tool length (dashed). } \vspace*{-5pt} \label{fig:heatmap_spade_ADR} \end{figure} \begin{figure} \centering \vspace*{7pt} \includegraphics[width=\linewidth]{pictures/diff_robots_2_frames_numbers.png} \caption{ \textbf{Visualization of the learned policies for different robot morphologies.} Three different robots were used in our experiments: (A)~Franka Emika Panda, (B)~UR5 robot, and (C)~standing Talos robot with a fixed lower body. Frames are chosen to represent similar stage of motion that may occur at different timesteps for different policies. For Franka Emika Panda robot, sand and goal box are elevated to correspond to the real experiment (Fig.~\ref{fig:teaser}). For the Talos robot, sand and goal box are elevated to knee level. } \label{fig:diff_robots_visual} \end{figure} \noindent\textbf{Real robot experiments.} For the real robot experiments, we use the 7~DoF Franka Emika Panda robotic arm~\cite{franka-panda-robot}. As discussed in Sec.~\ref{subsec:policy_learning}, inputs and outputs of the policy represent only kinematic quantities. Therefore, we can compute the joint trajectory of the robot offline by using the forward kinematics of the robot. This trajectory is then executed on the real robot in an open-loop manner. According to the success rate defined for the simulated experiments, we achieve 100\% success rate for the real-world experiment. The visualization of the robot controlled by the policy is shown in Fig.~\ref{fig:teaser}. Please see the supplementary video for the recording. \noindent\textbf{Limitations and assumptions.} Our approach has several limitations. First, we assume that the simulated environment with a sparse reward is known and contains only task-related objects whose positions are found during the alignment stage. Second, we assume that the tool type is known (spade, hammer, or scythe) and the selected input videos feature a human manipulating a tool of that type. The tool motion reconstruction module [7] uses this tool type information for training the tool detection module and a simplified stick-like 3D model of the tool for the tool 3D motion estimation. Third, we assume the human and the manipulated tool are well visible in the video without significant (self-)occlusions. Fourth, we trim only one cycle of motion for tasks with sequential dependency (\emph{i.e}\onedot} \def\Ie{\emph{I.e}\onedot spade). \section{Dense reward details} \label{sec:dense_reward} \noindent\textbf{Manually designed dense reward.} In this appendix we provide details of computing the dense reward that we manually designed for the baseline RL approach (Sec.~\ref{subsec:evaluation}). For the spade environment, the dense reward consists of the exponential distance between (a) the tool tip position $\bm x^T$ and the sand deposit $\bm x^S$, and (b) the exponential distance between the pile of sand ($K$ spheres with positions $\bm x^1 \dots \bm x^K$) and the goal box position $\bm x^G$: \begin{equation} \begin{aligned} r_t^{d}~=~\frac{1}{H}\exp\left(-\frac{b}{2} \, d( \bm x^T_t, \bm x^S_t) \right)+ \\ \sum_{i = 1} ^ K{\frac{1}{H K}\exp\left(-\frac{b}{2} \, d( \bm x^G_t, \bm x^i_t) \right)} , \label{eq:dense_spade} \end{aligned} \end{equation} where $H$ is the environment horizon, $b$ is the reward length-scale parameter and function~$d(\cdot, \cdot)$ measures the Euclidean distance between two 3D points. For the hammer environment, the dense reward consists of the exponential distance between the tool tip position $\bm x^T$ and the nail position $\bm x^N$: \begin{equation} \begin{aligned} r_t^{d}~=~\frac{1}{H}\exp\left(-\frac{b}{2} \, d( \bm x^T_t, \bm x^N_t) \right), \label{eq:dense_spade} \end{aligned} \end{equation} where $H$ is the environment horizon, $b$ is the reward length-scale parameter and function~$d(\cdot, \cdot)$ measures the Euclidean distance between two 3D points. For the scythe environment, we define two 3D points $\bm x^A$ and $\bm x^B$ that are located on the opposite sides of the grass patch at the ground plane. The dense reward includes (a) exponential distance between the tip of the tool $\bm{x}^T$ and the point $\bm x^A$ in the first half of the trajectory, (b) exponential distance between the tip of the tool $\bm{x}^T$ and the point $\bm x^B$ in the second half of the trajectory, and (c) exponential distance between the tool rotation $\bm q^T$ and reference rotation $\bm q^R$ (scythe is parallel to the ground): \begin{equation} \begin{aligned} r_t^{d}~=~\mathds{1}_{t<H/2}\frac{1}{H}\exp\left(-\frac{b}{2} \, d( \bm{x}^T_t, \bm{x}^A) \right) +\\ \mathds{1}_{t\geq H/2}\frac{1}{H}\exp\left(-\frac{b}{2} \, d( \bm{x}^T_t, \bm{x}^B) \right) + \\ \frac{1}{H}\exp\left(-\frac{b}{2} \, d^I( \bm q^T_t, \bm q^R_t) \right), \label{eq:dense_spade} \end{aligned} \end{equation} where $H$ is the environment horizon, $b$ is the reward length-scale parameter, function~$d(\cdot, \cdot)$ measures the Euclidean distance between two 3D points, and function~$d^I(\bm q_1, \bm q_2)$ measures the intrinsic distance between two rotations which is computed as a positive length of the geodesic arc connecting $\bm q_1$ to $\bm q_2$.
{'timestamp': '2021-11-08T02:00:47', 'yymm': '2111', 'arxiv_id': '2111.03088', 'language': 'en', 'url': 'https://arxiv.org/abs/2111.03088'}
arxiv
\section{Introduction} Artificial intelligence methods exceed human performance on many tasks and thus have found widespread use, yet the resulting models are often black boxes. There is a growing demand to create scalable human-friendly implementations. The creation of explainable white-box artificial intelligence methods is necessary to have users trust, manage, and use these in making crucial decisions \cite{xai2,xai1}. This need is also present in the area of clustering and dimensionality reduction methods for high-dimensional data. Clustering and dimensionality reduction methods are frequently employed to get a grasp of the high-level structure of data. Especially non-linear dimensionality reduction methods such as Isomap \cite{isomap}, LLE \cite{lle}, t-SNE \cite{tsne}, and UMAP \cite{umap} manage to effectively map data onto a low-dimensional space, retaining the relative distances from the high-dimensional space, but this low-dimensional space is often difficult to understand \cite{sedlmair2012}. \ptitle{Related work} Possible solutions in several directions have been studied: we may explore the 2D projection by letting the data glyphs correspond to specific attributes (e.g., color the points using the values for a specific attribute) or draw attribute isolines (as in DimReader \cite{faust2018}). Such solutions are limited to a single or very few attributes at a time and it is not obvious how to make them practical for data whose original dimensionality is large (e.g., from 20 attributes or more). There also exist approaches that focus on data points rather than attributes: `Forward projections' show how points would move in the low-dimensional embedding if their attributes would change, and we may also do the inverse exercise of `backward projection', i.e., how the attributes would need to change to move a point in a certain direction (which does not have a unique solution, so an inductive bias is necessary to resolve this) \cite{cavallo2018chi}. However, it is not practical to learn the structure of a large data set by exploring each point individually. `Probing clusters' \cite{stahnke2016} means to explore the feature values for manually selected sets of points that for example appear to form a cluster. This may lead to insights on the high-level structure. Yet, for high-dimensional data we are still left with the problem that this does not scale to a large number of attributes. Most similar to our work is the Clustrophile 2 tool \cite{cavallo2018vis}, which lets users explore a diverse set of pre-generated clusterings by means of a scatter plot showing a low-dimensional projection, as well as an attribute similarity matrix and/or a decision tree for the cluster assignment. However, the decision tree does not explicitly show how each cluster stands out, while the similarity matrix is only a visual aid that puts the burden of the comparison fully on the user, who are likely quickly overwhelmed for data with a large number of attributes. \ptitle{Contributions} We propose in this paper to take a very different approach: to compute an interpretable clustering that facilitates the analysis of a scatter plot of dimensionality-reduced data. We do this in several steps: (1) first we use information theory to quantify the informativeness of the mean and variance statistics for a given subset of points and given subset of attributes. (2) To control the trade-off between the complexity of the clustering and the amount of information gained, we introduce a simple notion of complexity for such a `bicluster pattern', which gives us control of how complicated the explanations for the clusters may be. (3) Integrating this with an approach to cluster the data on the low-dimensional representation, we obtain coherent clusters on the dimensionality-reduced scatter plot along with a subset of attributes that are informative (in the information-theoric sense), to explain this cluster. (4) Using this, we attempt to automatically generate an optimal explainable clustering on low-dimensional representations of data sets, so that users can meaningfully explore complex data with a limited time cost for interpreting apparent structure. The contributions of this paper are as follows: \begin{itemize} \item We define bicluster patterns, their informativeness using information theory and a simple notion of their interpretational complexity. \item We derive an algorithm to optimally cluster a dimensionality-reduced scatter plot such that the clusters are as informative as possible using a few attributes in the high-dimensional space. \item We study the computational complexity of this problem and argue for the use of hierarchical clustering to reduce the search space of possible solutions. \item We provide an implementation of that algorithm as well as a browser-based tool called ExClus (see Fig.~\ref{fig:dash_app}) that can be used to explore data in practice. \item We present experimental results on a few datasets to explore the usefulness of the tool as well as the effect of the two hyperparameters that govern the interpretional complexity of bicluster patterns. We present some early feedback from users and empirically study the scalability of the method. \item We find that ExClus has great potential to further facilitate data exploration with dimensionality-reduction methods and that the method is sufficiently scalable to use also on large data. \end{itemize} The ExClus tool is freely available at https://github.com/aida-ugent/ExClus \begin{figure}[h] \centering \includegraphics[width=0.94\textwidth]{dash_exclus_app_updated.png} \caption{The ExClus user application. Results are generated by applying the algorithm on the UCI Adult data set, an extract from the 1994 USA census \cite{uci}.} \label{fig:dash_app} \end{figure} The paper is structured as follows: in Section~\ref{sec:method} we first formalize the type of patterns that we aim to extract and define the informativeness and descriptional complexity of these patterns. We then introduce the optimization algorithm to extract the patterns. In Section~\ref{sec:exclus} we introduce ExClus and the user interface. Experiments are given in Section~\ref{sec:experiments} and conclusions are presented in Section~\ref{sec:conclusions}. \section{Method\label{sec:method}} The general idea is to define the substructure that we aim to find as a pattern, which we call a \emph{bicluster pattern}. Informally, this is a subset of points and the mean and variance statistics for a subset of the attributes. The approach then builds upon the framework for subjective interestingness for patterns \cite{debie2013ida}, which suggests the use of information theory to quantify how much information a user gets per time unit spent. There are three key concepts in this framework: information content, description complexity, and subjective interestingness. The \emph{information content} expresses how much the user learns by showing them a specific pattern. The \emph{description complexity} aims to express the difficulty of understanding the pattern, and the \emph{subjective interestingness} is simply the ratio of the two. The term `subjective' explicates that how much we learn can only be specified with respect to prior expectations over the data. In practice we will use a prior based on the data, but it may also be chosen subjectively. Barring issues of feasibility, the prior could reflect the actual knowledge of a user. We discuss each of these concepts in more detail: In Section~\ref{sec:bicluster}, we express the \emph{information content} of a bicluster pattern, i.e., the number of bits of information that we learn by showing the statistics for this bicluster, in comparison to given prior expectations. In Section~\ref{sec:descriptioncomplexity}, we also introduce the \emph{description complexity} that aims to capture how difficult or time consuming it is to process the presented information, for a human end-user. In Section~\ref{sec:exclusproblem}, we then formalize the \emph{explainable clustering problem}: to find a set of bicluster patterns that partition the data into clusters that are coherent with respect to a given 2D projection, such that the \emph{subjective interestingness} of the clustering is maximized. \subsection{Bicluster patterns and their information content\label{sec:bicluster}} \ptitle{Notation} Let $\mathbb{X}$ be an $n\times m$ data matrix with $\mathbb{X}_i$ denoting data point $i \in \{1, \ldots, n\}$ and $\mathbb{X}_{ij}$ the value for the $j$-{th} attribute ($j \in \{1, \ldots, m\}$) of $\mathbb{X}_i$. We write $t(j) \in \{\textrm{bool},\textrm{real}\}$ to denote the type of attribute $j$. \begin{definition} A bicluster pattern $\mathcal{P}$ is a tuple $\left(D,A,\mathcal{S}\right)$ with $D \subseteq \{1, \ldots, n\}$ a set of data points indices, $A \subseteq \{1, \ldots, m\}$ a set of attribute indices, and the statistics $\mathcal{S} = \{\mathcal{S}_{A_1},\ldots,\mathcal{S}_{A_{|A|}}\}$, corresponding to the attributes whose indices are in $A$. For boolean attributes ($t(j) = \textrm{bool}$), $\mathcal{S}_j \in [0,1]$ is a frequency and for real-valued attributes ($t(j) = \textrm{real}$) both a mean and standard deviation: $\mathcal{S}_j \in \mathbb{R} \times \mathbb{R}^+$. \end{definition} To express how much we learn by observing the statistics for a set of attributes for a subset of the data, we first need to express what we are comparing against, i.e., we have to define a prior distribution for the data. We take a simple approach here and use as prior the maximum likelihood statistics fitted on the full data, without accounting for any co-variate structure. That is, each attribute is assumed to be independent. Although in some context it may be preferable to already account for co-variates between the attributes, in many cases the independence assumption is good as it is also transparent for the user. Similarly, the information that we obtain by observing a bicluster pattern are the maximum likelihood statistics $\mathcal{S}$ for the set of points $D$ and the attributes $A$. The statistics may be used to derive a Maximum Entropy model for the data. As the statistics are assumed independent, indeed also the Maximum Entropy model is independent and we may write it for each attribute separately. It depends on the attribute type, so for brevity we write this model as $\mathcal{M}_{t(j)}(\mathcal{S}_j)$. The Maximum Entropy model is a Gaussian distribution for real-valued attributes and a Bernoulli distribution for boolean attributes. The information content of a pattern $\mathcal{P}$ is equivalent to the Kullback-Leibler divergence between the prior expectations and the statistics contained in $\mathcal{P}$: \begin{align} I(\mathcal{P}) = \sum_{i=1}^{|D|} \sum_{j=1}^{|A|} D_{KL}\left( \mathcal{M}_{t(A_j)}(\mathcal{S}_{A_j}^D) || \mathcal{M}_{t(A_j)}(\mathcal{S}_{A_j}^{\mathbb{X}}) \right). \end{align} Note that we overloaded $D_{KL}$ here to refer to the KL divergence, but in all other occurrences $D$ indeed refers to a subset of the data points included in a bicluster pattern. The KL divergences are straightforward to compute analytically for both the Bernoulli and Gaussian distribution. Note that it may happen that the variance of a bicluster for a specific real-valued attribute is zero, in which case the KL divergence will be infinite. Therefore, we add a small value $\epsilon$ to all variance estimates. Resolving this in a more robust manner by for example considering the precision of the real-valued numbers is left for future work. \subsection{Description complexity\label{sec:descriptioncomplexity}} The aim of the description complexity is to quantify how difficult it is to process the presented information, i.e., how time consuming it is to internalize. Unfortunately we have no realistic models of human cognition so we will just need to work on assumptions. It is important to realize that our aim here is not to do model selection in the statistical sense and we are not presenting the patterns to another computer. The aim is simply to have a formula that is suitably parameterized such that we can balance the amount of information and the complexity of the identified patterns. In previous papers on subjective interestingness, the description complexity was quantified as a linear function over the number of statistics that is presented to the user. Often, this leads to a more tractable optimization problem. We instead choose to make it explicit that providing more statistics realistically has a superlinear effect on the amount of time to process the information. Because we are going to present the user not a single bicluster pattern, but a set that partitions the data, we define the description complexity directly for a set of bicluster patterns as $\alpha$ plus the total number of statistics to the power $\beta$: \begin{align} C(\{\mathcal{P}_1,\ldots,\mathcal{P}_k\}) = \alpha + \left( \sum_{i=1}^{k} \sum_{j=1}^{|A^{\mathcal{P}_i}|} |\mathcal{S}_{A_j^{\mathcal{P}_i}}| \right)^\beta. \end{align} Here $|\mathcal{S}_{A_j}| = 1$ for boolean attributes and $|\mathcal{S}_{A_j}| = 2$ for real-valued attributes. This formula also includes two hyperparameters, $\alpha$, and $\beta$, which allow for tuning by users and enable the identification of more intuitive solutions. \subsection{Explainable clustering problem\label{sec:exclusproblem}} Finally, we want to find a clustering that makes a trade-off between the total information content and description complexity. Hence, we define the subjective interestingness for a set of bicluster patterns as \begin{equation} S(\{\mathcal{P}_1,\ldots,\mathcal{P}_k\}) = \frac{\sum_{i=1}^k I(\mathcal{P}_i)}{C(\{\mathcal{P}_1,\ldots,\mathcal{P}_k\})}. \label{SI_general} \end{equation} The missing component is that we have not related these concepts yet to the low-dimensional projection that we started out from. Let $\mathbb{Y}$ denote this low-dimensional---typically 2D---projection of $\mathbb{X}$. We may now define the explainable clustering problem. \begin{problem} The explainable clustering problem is to find a set of bicluster patterns $\{\mathcal{P}_1,\ldots,\mathcal{P}_k\}$ ($k \geq 1$) that partition the data (i.e., they cover all data points $\bigcup_{i=1}^k D_i = \{1,\ldots,n\}$ and no data point is covered twice $D_i \cap D_j = \emptyset \ \forall i \neq j$) in a coherent manner with respect to $\mathbb{Y}$ and that maximize the subjective interestingness $S(\{\mathcal{P}_1,\ldots,\mathcal{P}_k\})$. \end{problem} Here we have not defined exactly when a partitioning may be called coherent with respect to $\mathbb{Y}$. Indeed, this may differ per usage scenario and we argue that it is not obvious there may exist a universally applicable definition. We will argue for a particular choice in the following section that also benefits the design of an efficient optimization algorithm. \section{Search algorithm} We are faced with a difficult optimization problem: we want to cluster the data in a given low-dimensional projection, in such a manner that the attribute values are coherent and we are concurrently selecting attributes to explain the clusters. We first considered a two-step approach; first clustering the data and then computing the optimal explanations. Alternatively, we could derive an iterative optimization scheme, e.g., an EM scheme switching between data point assignment and the explanation attributes. However, we opt for a third solution where we constrain the search space to make it feasible to optimize the cluster assignment, number of clusters, and the attribute selection in an integrated manner. \subsection{The ExClus algorithm} \label{algorithm} \ptitle{Step 1} We start by computing a hierarchical agglomerative clustering using the Euclidean distance on the projection $\mathbb{Y}$. A tested and popular method for clustering data, this conveniently ensures coherence of the final clustering solution and it constrains the search space. The resulting dendrogram will be used to guide the full clustering, but we will not use the distances in $\mathbb{Y}$ to select clusters. \ptitle{Step 2} Given the optimization problem, we have to consider how to cut the dendrogram to obtain the best set of bicluster patterns. We are still faced with a large number of possible clusterings. If the tree is sufficiently large and balanced, the number of possible clusterings with $k$ clusters is given the corresponding Catalan number, which is already 1430 for $k=8$, for example. To obtain an approximate solution, we optimize the clustering by splitting one cluster of at a time. That is, we start with everything in one cluster, then consider all possible splits for $k=2$. This can be done in time linear in the size of the dendrogram, as indeed we may exactly split any branch off. For each possible split, we can optimize the attributes by ranking them and greedily considering whether we should add a boolean or a real-valued attribute (because they weigh differently in the description complexity). We obtain indeed the optimal solution for $k=2$ given the constraints, but then we take the $k=2$ solution and split this once more in any position in the tree to obtain a solution for $k=3$, which is not guaranteed to be optimal. The procedure continues for $k > 3$. This procedure could go on until the number of clusters is equal to the number of samples. This would be time consuming and it is highly unlikely that a solution with very large $k$ would maximize the subjective interestingness. Hence, we implement a time limit to ensure the runtime stays in an acceptable range. This limit can be any value, from a few milliseconds to only stopping when all calculations end. \subsection{Solution refinement\label{solution_refinement}} It is not obvious how to tune the hyperparameters, so we expect this to be done through trial-and-error. From experiments presented in Section~\ref{sec:experiments}, we find they can have a dramatic effect on the resulting solution and the differences may also be abrupt. Restarting the algorithm from scratch is then not always desirable to find a good solution. Hence, we also introduce a procedure to modify the current solution given new hyperparameter values. This modification again uses the dendrogram, but instead of starting at one cluster, it starts from the previously obtained result. The procedure then evaluates both whether splitting more clusters off, as described in Section \ref{algorithm}, or merging some clusters back together that were previously split off results in a higher subjective interestingness. \section{User application\label{sec:exclus}} In this section we present the user interface of ExClus, which is based on the previously introduced formalization and algorithm. The application allows testing and intuitive usage of the presented algorithm. In the following, we highlight different aspects of the interface and summarize user feedback. \subsection{Design choices} The interactive tool helps users to understand data sets by generating clusters and their explanations simultaneously. Users can browse through through the explanations at their own pace and tune the algorithm to retrieve more insights. The application is created with Dash, a Python framework for building data science web applications. Figure~\ref{fig:dash_app} shows the user interface. \ptitlesmallskip{Dashboard} The dashboard, situated at the top of the application, shows some essential information on the currently presented clustering. After tuning the hyperparameters to get different results, it also shows how these values changed. Alone, these values do not tell much, but after tuning, it is helpful the compare how they changed. \begin{itemize} \item \textbf{\# clusters:} How many clusters the algorithm generated. \item \textbf{\# attributes:} Each cluster needs a certain number of attributes as an explanation (at least one). For example, cluster one might need only one attribute, but cluster two might need four. This number is the sum of all these attributes for all clusters. \item \textbf{Information content:} This is the entire clustering's Information Content\footnote{It is a deliberate choice to show the Information Content and not the Subjective Interestingness score, as the latter depends on the values of the hyperparameters. It is not sensible to compare those values across different hyperparameter choices, while the Information Content can indeed be compared.}. \end{itemize} \ptitlesmallskip{Data Embedding} In the top left of the interface we show a scatter plot of the low-dimensional data and display the clustering result from ExClus with different colors. Going from multiple dimensions to only two with a non-linear transformation, which dimensionality reduction techniques as t-SNE \cite{tsne} do, results in difficult to interpret axes, so the only thing deductible from the graph, besides the clustering, is that points close together on the 2D plot are similar in the high-dimensional space. \ptitlesmallskip{Cluster explanations} This part of the application provides the identified explanations of why specific points form a cluster. When users select one cluster using the drop-down menu, we show the relative size of the cluster and the description of attributes that make this cluster distinct from the rest of the data. We sort the attributes by decreasing information content and use different visualizations for binary and real-valued attributes as shown in Figure \ref{fig:explain_cluster4}. For binary attributes, we illustrate the distribution of values in a stacked bar chart. The left bar shows the distribution within the selected cluster and the right bar the distribution of the entire data set. For real-valued attributes, we derived the information content by fitting Gaussian distributions using mean and standard deviation as parameters. To compare the selected cluster to the entire dataset, we plot both probability density functions for the Gaussian distributions in the prior model and the model of the cluster. \begin{figure}[t] \centering \begin{subfigure}{0.5\linewidth} \centering \includegraphics[width=0.90\linewidth]{cluster_4_stacked_bar.png} \caption{Explanation of a binary attribute.} \label{explain_cluster_4:binary} \end{subfigure}% \begin{subfigure}{0.5\linewidth} \centering \includegraphics[width=0.90\linewidth]{cluster_4_gaussian.png} \caption{Explanation of a real-valued attribute} \label{explain_cluster4:non-binary} \end{subfigure} \caption{Part of the explanation for cluster four in Figure \ref{fig:dash_app}.} \label{fig:explain_cluster4} \end{figure} \ptitlesmallskip{Hyperparameter tuning} Below the data visualization we display the current parameter values that influence the number of clusters and the detailedness of their explanations. Range sliders allow the user to change $\alpha$, $\beta$, and the runtime limit of the greedy search. A more extensive look into the effects of these parameters follows in Section \ref{sec:experiments}. Next to the parameter sliders we provide two ways of applying the new parameter values: \textit{refine} and \textit{recalc}. The refine option starts the algorithm from the current clustering as described in Section \ref{solution_refinement}. The recalc option starts the algorithm from scratch. That way, users can either build on the current clustering and understanding of the data or investigate a new approach. \section{Experiments\label{sec:experiments}} In this section we discuss an empirical evaluation that we conducted to test ExClus. First we present the results from case studies on three data sets, secondly we consider quantitatvely the effects of the hyperparameters, and finally we discuss experiments on the scalability of the method. \subsection{Use cases} This section gives a short evaluation of the algorithm's results to give an initial insight into the application's possibilities. \ptitlesmallskip{UCI Adult} The UCI Adult data set is an extraction from a 1994 USA census database, and the attributes included are: age (continuous), gender (male/female), ethnicity (white/other), education level (continuous), hours worked per week (continuous), and income (${\leq}50$k, ${>}50$k). This experiment uses a sample of only 2500 of the nearly 32000 data points for performance reasons. An example of the algorithm's result is visible in Figure~\ref{fig:dash_app}. Dissecting the clustering reveals that the dimensionality reduction method mostly used three attributes to create the clusters: gender, income, and ethnicity. However, by tuning the hyperparameters, the algorithm can split these clusters further to reveal more details on the people included in each group or put clusters back together to show they are part of a more general pattern. For example, cluster two (green) contains all the white males with an income above \$50k, which is more than 30\% of the data set. There is a possibility of splitting this cluster further to distinguish between attributes such as education level or hours worked per week by reducing $\beta$. However, this can overwhelm a user initially, so it is better to start with few clusters and then refine them to learn more details. Other significant sections in this clustering are cluster zero (blue), which are the female counterparts of cluster two, and this cluster's explanation is also partially shown in Figure~\ref{fig:dash_app}. The top right then contains all the high-income white people, with the red cluster being females and the other two (black and magenta) males, where the algorithm further separates them on high education level (black) and average education level (magenta). This difference also reveals that the dimensionality reduction does not reveal every pattern because there is no such split for the females as there are not enough high-income females included for the dimensionality reduction method to emphasize it. Finally, the bottom right has three clusters, including only other than white ethnicities, and the algorithm split them in almost the same manner as the white people, but again with less detail as there are not that many of them in the data sample. \ptitlesmallskip{German socio-economic data} This data set includes the socio-economic information of 412 German districts \cite{boley2013}. There are more than thirty attributes, but many of them are related, and overall, there are three main categories. First, the voting record attributes contain the voting percentages for the five largest parties (Green, Left, CDU, SPD, and FDP) in the 2005 and 2009 elections, where we included only the latter attribtes. Another block of attributes define the age distribution for the district, such as the percentage of old or young people. The remaining attributes give information on the workforce, such as which percentage of people work in which sector (agriculture, finance, service, etc.). The application's outcome for two different parameter settings, shown in Figure~\ref{german_clustering}, highlight a challenge in making ExClus effective. Notably, for hyperparameter settings that gave solutions with only a few clusters on other data, the solution here has two clusters with only a tiny number of data points (cluster zero and one). On the UCI Adult data this happened only with extreme parameter settings. Changing the hyperparameters here worsens this issue. On the one hand, a user could solve this by changing the hyperparameters of the dimensionality reduction method, t-SNE in this case, but it can be a strenuous task to test different embeddings on the application each time. Furthermore, assuming that the low-dimensional representation is given, we would prefer that the application deals with this problem regardless of the embedding. It appears the problem is at least partly related to the dendrogram of the agglomerative hierarchical cluster. Specifically, the problem disappears if we consider another linkage criterion, where we used single linkage in other cases, here complete or average appears to be preferable. The single linkage appears to fail here because the clusters are not as homogeneous as for other data sets. \begin{figure}[t] \centering \begin{subfigure}{0.5\linewidth} \centering \includegraphics[width=0.9\linewidth]{sl_germany_alpha250_beta12.png} \caption{Single linkage} \label{german_clustering_sl} \end{subfigure}% \begin{subfigure}{0.5\linewidth} \centering \includegraphics[width=0.9\linewidth]{cl_germany_alpha250_beta16.png} \caption{Complete linkage} \label{german_clustering_cl} \end{subfigure} \caption{Results from the ExClus algorithm on the German socio-economics data for hyperparameter values $\alpha$ 250, $\beta$ 1.6 and different linkage criteria.\label{german_clustering}} \end{figure} \begin{figure}[t] \centering \includegraphics[width=0.9\textwidth]{germany_maps.png} \caption{Patterns discovered on the GSE data in the subjectively interesting subgroup discovery paper (Lijffijt et al. \cite{lijffijt2018subjectively}). Reproduced with permission.} \label{fig:germany_maps} \end{figure} Interestingly, looking at the clusters in Figure~\ref{german_clustering_cl}, and highlighting the districts on a German map, they align almost entirely with the patterns discovered in previous research by Lijffijt et al. in their research on finding subjectively interesting subgroups in data sets with real-valued attributes \cite{lijffijt2018subjectively}. Comparing some of the attributes included in the explanations of the clusters further proves that these patterns are almost equal. Take, for example, cluster two (green), which maps to pattern b in Figure \ref{fig:germany_maps}. Just as in the paper, this cluster consists of districts with a higher population density, indicating they are cities, with a political favor towards the Green party and a large percentage of middle-aged people. \ptitlesmallskip{Cytometry data} Cytometry measures the characteristics of cells and has a broad range of applications. In this case, the experiment uses single-cell data of one mouse also used in previous research, which looked at different ways to make sense of increasingly higher dimensional data retrieved with a specific cytometry technique \cite{cytometry}. Each cell is described by nine markers and the researchers in question used dimensionality reduction and clustering methods, which makes it ideal to evaluate ExClus and compare results. \begin{figure}[tp] \centering \begin{subfigure}{0.5\linewidth} \centering \includegraphics[width=0.77\textwidth]{cytometry_paper_tsne.png} \end{subfigure}% \begin{subfigure}{0.5\linewidth} \centering \includegraphics[width=0.77\textwidth]{cytometry_alpha250_beta12.png} \end{subfigure} \caption{(left) t-SNE dimensionality reduction on the cytometry data. Type of cell indicated by color. Obtained from the original paper \cite{cytometry}. (right) ExClus' clustering output on the Cytometry data set with hyperparameters $\alpha$ 250, $\beta$ 1.2.\label{fig:cytometry}} \end{figure} Figure \ref{fig:cytometry}(left) shows the results directly obtained from the original research paper. This dimensionality reduced version of the data set, calculated with t-SNE, has colored labels for each data point. The markers indicate which type of cell it is. These results are similar to the ones obtained from ExClus (Figure~\ref{fig:cytometry}, right). The two large clusters are immediately distinguishable as similar and the smaller clusters also align almost perfectly. For example, the blue cluster from the ExClus results corresponds to the purple cluster from the original paper and the magenta cluster corresponds to the blue cluster. Furthermore, ExClus simplifies the explanations. In the original cytometry paper color maps, showing the expressions of each gene marker, allows for analyzing the dimensionality reduced clustering. On the other hand, ExClus selects the most important attributes and represents them as a distributions compared to the data set's average. For example, to evaluate the blue cluster using the original method a user would have to examine all nine color maps while the ExClus algorithm only presents two attributes. This case study shows that ExClus can explain the data set to the same extent as the paper, but with a lower descriptional complexity as a user does not need to scan all the different marker figures, which eventually simplifies and speeds up the process of understanding a data set. \subsection{Hyperparameters} Both parameters affect the number of clusters and detailedness of explanations, but they do this differently. $\alpha$ is a startup cost for the description length allowing for a more detailed explanation and more clusters as it results in the need for a larger description length before having a substantial impact on the ratio. This parameter's value has values between zero and a thousand. On the other hand, $\beta$ serves as a penalty for the description length and usually has a value between one and two. If the value is larger than one, this applies a penalty that increases super-linearly with an increasing description length, forcing a faster cutoff on explanation and clustering. \begin{figure}[tp] \centering \begin{subfigure}{0.48\linewidth} \centering \includegraphics[height=52mm]{alpha_beta_clusters_attributes_hyperparameters.png} \caption{Number of attributes and clusters for various $\alpha$ (color) and $\beta$ (marker symbol) on the Cytometry data.\label{fig:hyper}} \end{subfigure}% \hfill \begin{subfigure}{0.48\linewidth} \centering \includegraphics[height=52mm]{n_clusters_alpha_effect_uci.png} \caption{Number of clusters for various $\alpha$ (x-axis) and $\beta$ (colored lines) on the UCI Adult data.\label{fig:hyper_necessary}} \end{subfigure} \caption{Effects of varying the hyperparameters $\alpha$ and $\beta$.} \end{figure} Figure~\ref{fig:hyper} shows the effect of $\alpha$ and $\beta$ on the number of clusters and attributes. This graph reveals an almost linear increase in the number of clusters and attributes, where $\beta$ divides the values into different sections, and $\alpha$ ensures a further evolution within each section. Furthermore, Figure \ref{fig:hyper_necessary} is a testament to why these parameters are necessary. It presents the number of clusters (y-axis) in the clustering the ExClus algorithm decided on for different values of $\alpha$ (x-axis) and $\beta$ (color). If $\alpha$ is zero, there are almost no clusters, and changing $\beta$ does not affect the results. Besides that, if $\beta$ is one (no penalty), $\alpha$ changes the results almost uncontrollably (blue graph). While $\alpha$ and $\beta$ might not have a straightforward relationship and interaction, they are both necessary and allow users to change the number of clusters and the number of attributes. \begin{figure}[t] \centering \begin{subfigure}{0.48\linewidth} \centering \includegraphics[width=0.88\textwidth]{iterations_after_runtime_average_cytometry.png} \caption{Number of iterations vs. number of \emph{data points} on the Cytometry data.\label{fig:scale_points}} \end{subfigure}% \hfill \begin{subfigure}{0.48\linewidth} \centering \includegraphics[width=0.88\textwidth]{iterations_after_runtime_genex_average.png} \caption{Number of iterations vs. number of \emph{features} on the Gene expression data.\label{fig:scale_attr}} \end{subfigure} \caption{Number of iterations the algorithm reaches within specified runtimes.} \end{figure} \subsection{Scalability} Data sets can scale in two dimensions. On the one hand, the number of data points can increase, and on the other hand, the number of features can increase. Both can have severe effects on the runtime, and they should be taken into consideration whenever the algorithm runs. The algorithm goes through multiple iterations of the greedy optimization step. Each iteration searches for the optimal clustering with the number of clusters equal to the iteration. When the runtime ends, it selects the iteration's outcome with the highest subjective interestingness. Therefore, it is best to define scalability in the number of iterations the algorithm reaches. Figure \ref{fig:scale_points} presents these effects when the number of data points increases and Figure \ref{fig:scale_attr} when the number of features increases. While both figures show an exponential decrease in iterations, this only becomes a noticeable issue if the data set is enormous (more than 100,000 data points or more than 500 features). Furthermore, in most cases, some sampling or feature importance selection will occur if the data set is this large because dimensionality reduction methods and hierarchical clustering techniques can also suffer from scalability issues. Besides that, it is unlikely for these data sets that a clustering with a vast number of clusters will be the optimal result as understanding more than a hundred patterns is highly complex. However, while it is not a limiting issue in most cases, the algorithm does have room for improvement in certain areas that could increase performance. \section{Conclusion\label{sec:conclusions}} This paper introduced a new method to assist users in analyzing high-dimensional data sets. It contributes to the state of the art in considering how to find a good balance between informativeness and the complexity of information presented to the user, by making a trade-off between information and its descriptional complexity. Specifically, while generating clusterings and their accompanied optimal explanations automatically. The presented algorithm to identify an explainable clustering on top of a scatter plot of dimensionality-reduced data is implemented in a publicly-available tool called ExClus. From case studies we have observed that ExClus can be used to effectively analyse data, by comparing results with previous studies on that data (German SE and Cytometry data), highlighting ExClus enables identification of previously known and possibly new patterns with little effort. Further study could include investigation in methods to choose or support users in choosing good values for the hyperparameters. ExClus allows quick experimentation with hyperparameters, but for now it remains an exercise of trial-and-error for users of the system. Secondly, we have omitted from the scope of this study which dimensionality-reduction method to use. We have used t-SNE in all experiments, which is not the most scalable algorithm and about which many critiques have been written. It would be worthwhile to investigate which dimensionality-reduction methods would synergize best with ExClus. Finally, we have observed that the linkage criterion can be important to consider. More generally, it may be interesting to study other ways to build a restricted search space like the agglomerative clustering approach used here. \bibliographystyle{splncs04}
{'timestamp': '2021-11-08T02:05:08', 'yymm': '2111', 'arxiv_id': '2111.03168', 'language': 'en', 'url': 'https://arxiv.org/abs/2111.03168'}
arxiv
\section{Introduction} Constraint Optimization Problems (COPs) are commonly solved by systematic tree search, such as branch-and-bound, where a specialized solver prunes those parts of the search space with worse cost than the current best solution. In Constraint Programming (CP), these systematic techniques work without prior knowledge and are steered by the constraint model. However, the worst-case computational cost to fully explore the search space is exponential and the search performance depends on solver configuration, such as selection of right parameters, heuristics, and search strategies, as well as appropriate formulations of the constraint problems to enable efficient pruning of the search space. Machine Learning (ML) methods, on the other hand, are data-driven and are trained with labeled data or by interaction with their environment, without explicitly considering the problem structure or any solving procedure. At the same time, ML methods can only approximate the optimum and are therefore not a full alternative. The main computational cost of these methods lies in their training, but the cost when estimating an outcome for a new input is low. This low inference cost makes ML an interesting candidate for integration with more costly tree search. Previous research has examined this integration to several extents, albeit selecting the appropriate algorithm within a solver and to configure it for a given instance, learning additional constraints to model a problem, or learning partial solutions. In this paper, we provide an overview of the body of knowledge on using ML for CP. We focus on approaches where the ML model is trained in a supervised way from existing problem instances with solutions, and collected information gathered while solving them. We discuss of the characteristics of supervised ML and CP and how to use predictive ML to improve CP solving procedures. A graphical overview of predictive ML applications for CP is shown in Figure~\ref{fig:overview}. The second part of the paper discusses a boundary estimation method called Bion\xspace, which combines logic-driven constraint optimization and data-driven ML, for solving COPs. A ML-based estimation model predicts boundaries for the objective variable of a problem instance, which can then be exploited by a CP solver to prune the search space. To reduce the risk of inaccurate estimations, which can render the COP unsatisfiable, the ML model is trained with an asymmetric loss function and adjusted training labels. Setting close bounds for the objective variable is helpful to prune the search space \cite{Milano2006,Gualandi2012}. However, estimating tight bounds in a problem- and solver-agnostic way is still an open problem \cite{Ha2015}. Such a generic method would allow many COP instances to be solved more efficiently. Our method has first been introduced in \cite{Spieker2020a}, where an initial analysis of the results led us to conclude that Bion\xspace was a promising approach to solve COPs. Here, we revisit and broaden the presentation of Bion\xspace in the general context of predictive machine learning for constraint optimization. We extend our experimental evaluation analysis and show that boundary estimation is effective to support COP solving. Bion\xspace is a two-phase procedure: First, an objective boundary for the problem instance is estimated with a previously trained ML regression model~; Second, the optimization model is extended by a boundary constraint on the objective variable and a constraint solver is used to solve the problem instance. This two-phases approach decouples the boundary estimation from the actual solver and enables its combination with different optimized solvers. Training the estimation model with many problem instances is possible without any domain- or expert- knowledge and applies to a wide range of problems. Solving practical assignment, planning or scheduling problems often requires to repeatedly solve the very same COP with different inputs. Bion\xspace is well fitted for these problems, where training samples, which resemble realistic scenarios, can be collected from previous iterations. Besides, for any COP, Bion\xspace can be used to pre-train problem-specific ML models which are then deployed to solve new instances. \begin{figure}[t] \centering \includegraphics[width=\columnwidth]{figures/PredML4Optim-RelWork.pdf} \caption{Overview of the applications of ML and CP considered in this paper. Depending on the application type, training data can be extracted at different points in the CP solving process.} \label{fig:overview} \end{figure} The remainder of this paper is structured as follows. In Section \ref{sec:background}, we discuss the necessary background for the integration of predictive ML and CP, including data curation and preparation of problem instances to be usable in ML. Section \ref{sec:predml} reviews existing work on predictive ML and CP for algorithm selection and configuration, constraint learning, and learning to solve. Afterwards, we introduce Bion\xspace in Section \ref{sec:boundaryestimation}, a ML-based method to estimate boundaries of the objective variable of COPs as a problem- and solver-independent method tool to support constraint optimization solvers. We discuss training techniques to avoid inaccurate estimations, compare various ML models such as gradient tree boosting, support vector machine and neural networks, with symmetric and asymmetric loss functions. A technical CP contribution lies in the dedicated feature selection and user-parameterized label shift, a new method to train these models on COP characteristics. In Section \ref{sec:experiments}, Bion\xspace's ability to prune objective domains, as well as the impact of the estimated boundaries on solver performance, is evaluated on seven COPs that were previously used in the MiniZinc challenges to compare CP solvers efficiency. Finally, Section \ref{sec:conclusion} concludes the paper with an outlook on future applications of predictive ML to CP. \section{Background} \label{sec:background} This section presents a background discussion on constraint optimization and supervised machine learning. We introduce the necessary terminology and foundations under the context of predictive ML for CP. For an in-depth introduction beyond the scope of this paper, we refer the interested reader to the relevant literature in constraint optimization \cite{Rossi2006,Marriott1998} and machine learning \cite{Hastie2009,Domingos2012,Murphy2022}. \subsection{Constraint Optimization Problems} Throughout this paper, constraint optimization is considered in the context of Constraint Programming over Finite Domains \cite{Rossi2006}. In that respect, every variable $\mathbf{x}$ of an optimization problem is associated with a finite set of possible values, called a Finite Domain (FD) and, noted $D_\mathbf{x}$. Each value is associated with a unique integer without any loss of generality and thus, $D_\mathbf{x} \subseteq \underline{\mathbf{x}}..\overline{\mathbf{x}}$, where $\underline{\mathbf{x}}$ (resp. $\overline{\mathbf{x}}$) denotes the lower (resp. upper) bound of $D_\mathbf{x}$. Each variable $\mathbf{x}$ takes one, yet unknown value in its domain, i.e., $\mathbf{x} \in D_\mathbf{x}$ and $\underline{\mathbf{x}} \leq \mathbf{x} \leq \overline{\mathbf{x}}$, even if not all the values of $\underline{\mathbf{x}}..\overline{\mathbf{x}}$ are necessarily part of $D_{\mathbf{x}}$. A constraint is a relation among a subset of the decision variables, which restrain the possible set of tuples of values taken by these variables. In Constraint Programming over FD, different type of constraints can be considered, including arithmetical, logical, symbolic or global relations. For instance, $\mathbf{x} + \mathbf{y} * \mathbf{z} = 5$ is an arithmetical constraint while $\mathbf{x=f}\, \lor\, \mathbf{y=t}\, \lor\, (\mathbf{z} > 0) = \mathbf{t}$, where $\mathbf{t}$ (resp. $\mathbf{f}$) stands for True (resp. False), is a logical constraint. Symbolic and global constraints include a large panel of non-fixed length relations such as \texttt{all\_different}$([\mathbf{x_1,\dots,x_n}])$, which constrains each variable $\mathbf{x_i}$ to take a different value, \texttt{element}$([\mathbf{x_1,\dots,x_n}], \mathbf{i,v})$, which enforces the relation $\mathbf{v}=\mathbf{x_i}$, where $\mathbf{v,i}$ and $\mathbf{x_1,\dots,x_n}$ can all be unknowns. More details and examples can be found in \cite{Rossi2006,Marriott1998}. \begin{Definition}[Constrained Optimization Problem (COP)] A COP is a triple $\langle \ensuremath{\mathcal{V}}\xspace, \ensuremath{\mathcal{C}}\xspace, f_\ensuremath{\mathbf{z}}\xspace \rangle$ where \ensuremath{\mathcal{V}}\xspace denotes a set of FD variables, called {\it decision variables}, $\ensuremath{\mathcal{C}}\xspace$ denotes a set of constraints and $f_\ensuremath{\mathbf{z}}\xspace$ denotes an optimization function which depends on the variables of \ensuremath{\mathcal{V}}\xspace. $f_\ensuremath{\mathbf{z}}\xspace$'s value ranges in the domain of the variable \ensuremath{\mathbf{z}}\xspace % (\ensuremath{\mathbf{z}}\xspace in $\underline{\mathbf{z}}..\overline{\mathbf{z}}$), called the {\it objective variable}. \end{Definition} Solving a COP instance requires finding a variable assignment, i.e., the assignment of each decision variable to a unique value from its domain, such that all constraints are satisfied and the objective variable \ensuremath{\mathbf{z}}\xspace takes an optimal value. Note that COPs have to be distinguished from well-known {\it Constraint Satisfaction Problems} (CSPs) where the goal is only to find satisfying variable assignments, without taking care of the objective variable. \begin{Definition}[Feasible/Optimal Solutions] Given a COP instance $\langle \ensuremath{\mathcal{V}}\xspace, \ensuremath{\mathcal{C}}\xspace, f_\ensuremath{\mathbf{z}}\xspace \rangle$, a {\it feasible solution} is an assignment of all variables \ensuremath{\mathcal{V}}\xspace in their domain, such that all constraints are satisfied. $\ensuremath{\mathbf{z}}\xspace_{cur}$ denotes the value of objective variable \ensuremath{\mathbf{z}}\xspace for such a feasible solution. An {\it optimal solution} is a feasible solution, which optimizes the function $f_\ensuremath{\mathbf{z}}\xspace$ to the optimal objective value $\ensuremath{\mathbf{z}}\xspace_{opt}$. \end{Definition} \begin{Definition}[Satisfiable/Unsatisfiable/Solved COP] A COP instance $\langle \mathcal{V}, \mathcal{C}, f_\ensuremath{\mathbf{z}}\xspace \rangle$ is {\it satisfiable} (resp. {\it unsatisfiable}) iff it has at least one feasible solution (resp. no solution). A COP is said to be {\it solved} if and only if at least one of its optimal solutions is provided. \end{Definition} Solving a COP instance can be done by a typical \textit{branch-and-bound} search process which incrementally improves a feasible solution until an optimal solution is found. Roughly speaking, in case of minimization, branch-and-bound works as follows: starting from an initial feasible solution, it incrementally adds to $\mathcal{C}$ the constraint $\ensuremath{\mathbf{z}}\xspace < \ensuremath{\mathbf{z}}\xspace_{cur}$, such that any later found feasible solution has necessarily a smaller objective value than the current value. This is helpful to cut the search tree of all feasible solutions which have a value equal to or larger than the current one. If there is no smaller feasible value and all possible variable assignments have been explored, then the current solution is actually an optimal solution. Interestingly, the search process can be time-controlled and interrupted at any time. Whenever the search process is interrupted before completion, it returns $\ensuremath{\mathbf{z}}\xspace_{cur}$ as the best feasible solution found so far by the search process, i.e., a near-optimal solution. This solution is provided with neither proof of optimality nor guarantee of proximity to an optimal solution, but it is still sufficient in many applications. This branch-and-bound search process is fully implemented in many Constraint Programming (CP) solvers. These solvers provide a wide range of features and heuristics to tune the search process for specific optimization problems. At the same time, they do not reuse any of the already-solved instances of a constraint problem to improve the optimization process for a new instance. In addition to presenting existing works on predictive learning for constraint optimization, this paper proposes a new method to reuse existing known boundaries to nurture a machine learning model to improve the optimization process for a new instance. \subsection{Supervised Machine Learning} \label{sec:mlmodels} At the core of the predictive applications described in this paper, a supervised ML model is trained and deployed. In supervised machine learning, the model is trained from labeled input/output examples to approximate the underlying, usually unknown function. \begin{Definition}[Supervised Machine Learning] Given a set of training examples $\{(x_1,y_1),\allowbreak(x_2,y_2),\allowbreak\dots,\allowbreak(x_n,y_n)\}$, a supervised machine learning model approximates a function $P: X \rightarrow Y$, with $X$ being the input space, and $Y$ being the output space. Here, $x_i$ is a vector of instance features and $y_i$ is the corresponding label, representing the target value to be predicted. \end{Definition} Every value in $x$ corresponds to a \textit{feature}, that is, a problem instance characteristic that describes the input to the model. In most cases, the input consists of multiple features and is also described as the \textit{feature vector}. The output of the model, $\hat{y}$, is defined as a vector, too, although it is more common to have a model that only predicts a single value. This is the case in regression problems, when predicting a continuous value, or binary classification, when deciding whether to activate a functionality or not. % The model $P$ is trained from a training set, consisting of example instances $(x_i,y_i)$. Training the model describes the process to minimize the error between estimated value $\hat{y}$ and true (observed) value $y$ of the training examples. The error is assessed with a loss function, that can be different depending on the task of the machine learning model. We show examples for two commonly used types of loss functions. For regression problems, where a continuous output value is estimated, the loss is assessed via the \textit{mean squared error}. In classification, where the input is assigned to one of multiple classes, the \textit{cross-entropy loss} is calculated. \begin{Definition}[Mean Squared Error (MSE)] Given a set of $N$ estimated and observed target values $\{(\hat{y}_1, y_1),(\hat{y}_2, y_2),\dots,(\hat{y}_N, y_N)\}$, the MSE is calculated as: \[L = \frac{1}{N} \sum_{i=1}^{N} (\hat{y}_i - y_i)^2\] Within the calculation of MSE, positive and negative errors have the same effect, but larger errors are stronger penalized, i.e. they have a larger influence, than smaller errors. \end{Definition} \begin{Definition}[Cross-Entropy Loss] Given a set of $N$ estimates and $K$ classes, the cross-entropy (also log-likelihood) is calculated as: \[L = -\frac{1}{N} \sum_{i=1}^{N} \sum_{k=1}^{K} y_{ik} \log \hat{y_{ik}}\] with $\hat{y_{ik}}$ being the probability of $x_i$ belonging to class $k$ and \[ y_{ik} = \begin{cases} 1 & \text{if $x_i$ belongs to class $k$}\\ 0 & \text{otherwise} \end{cases} \] \end{Definition} An example for the training scheme is shown in Figure \ref{fig:mltraining} for a linear regression model. The weights $a_0, a_1$ of the linear function are adjusted such that the total error between estimated and true values is minimized. In the given example the training examples do not strictly follow a linear trend and are therefore difficult to approximate with only a small error. This is an indicator to use a more complex model for better results and to describe the output via different features than only $x$, if possible. \begin{figure}[t] \centering \resizebox{\columnwidth}{!}{% \begin{tikzpicture} \pgfplotsset{ width=10cm, height=5cm, compat=1.4, legend style={font=\footnotesize}} \begin{axis}[ xlabel={x}, ylabel={y}, ylabel style={rotate=-90}, legend cell align=left, legend pos=outer north east, xticklabels={,,}, yticklabels={,,}, ticks=none] \addplot[only marks] table[row sep=\\]{ X Y\\ 1 0.5\\ 2 1.5\\ 3 2\\ 4 0.75\\ 6 0.8\\ 8 2.5\\ 9 0.5\\ 10 2\\ }; \addlegendentry{Training sample $(x,y)$} \addplot table[row sep=\\, y={create col/linear regression={y=Y}}] % { X Y\\ 1 0.5\\ 2 1.5\\ 3 2\\ 4 0.75\\ 6 0.8\\ 8 2.5\\ 9 0.5\\ 10 2\\ }; \addlegendentry{Estimation $(x,\hat{y})$} \addplot[mark=none, dashed] coordinates {(1,0.5) (1,1.04)}; \addplot[mark=none, dashed] coordinates {(2,1.5) (2,1.11)}; \addplot[mark=none, dashed] coordinates {(3,2) (3,1.17)}; \addplot[mark=none, dashed] coordinates {(4,0.75) (4,1.24)}; \addplot[mark=none, dashed] coordinates {(6,0.8) (6,1.36)}; \addplot[mark=none, dashed] coordinates {(8,2.5) (8,1.49)}; \addplot[mark=none, dashed] coordinates {(9,0.5) (9,1.55)}; \addplot[mark=none, dashed] coordinates {(10,2) (10,1.62)}; \addlegendentry{Estimation error $\hat{y} - y$} \end{axis} \end{tikzpicture} } \caption{Training a supervised machine learning model: Illustrative example for linear regression $y = a_0 + a_1*x$. During training the weights $a_0, a_1$ are adjusted to minimize the estimation error.} \label{fig:mltraining} \end{figure} \subsection{Machine Learning Models} Many supervised ML models exist and have been shown to be applicable to a wide range of problems. However, there is no one best model and depending on the application, different models can show good performance. In this section, we introduce five widely used machine learning models for the application in predictive ML for CP: Gradient Tree Boosting, Neural Network, Support Vector Machine, k-Nearest Neighbors, and Linear Regression. We briefly discuss each model and highlight relevant characteristics for applying them for constraint problems. \subsubsection{Gradient Tree Boosting} Gradient Tree Boosting (GTB), also Gradient Boosting Machine, is an ensemble method where multiple individual weak models, whose error rate slightly outperforms random guessing, are combined into a strong learner \cite[]{Friedman2001}. At each iteration, additional weak models are trained on a modified subset of data to add information to the previous prediction. The individual weak models in GTB are decision trees, which by themselves have weak estimation accuracy compared to other models, but are robust to handle different types of inputs and features \cite[Ch. 10]{Hastie2009}. \subsubsection{Neural Network} A multi-layer Neural Network (NN) approximates the function to-be-learned over multiple layers of nodes or neurons. Neural networks can be applied for different problems, e.g. classification or regression, especially when there is a large amount of training data. Designing a neural network requires selecting an architecture and the number of layers and nodes, as well as performing a careful hyper-parameter optimization to achieve accurate results \cite[]{Domingos2012}. An ensemble of multiple NNs can be formed to reduce the generalization error of a single NN \cite[]{Zhou2002}, by taking the average of all predictions. As errors are expected to be randomly distributed around the actual value, an ensemble can reduce the error. \subsubsection{Support Vector Machine} Support Vector Machines (SVM) map their inputs into a high-dimensional feature space. This feature space is defined by a kernel function, which is a central component. Once the data has been mapped, linear regression is performed in this high-dimensional space \cite[]{Cortes1995}. One common variant for regression problems are \(\epsilon\)-SVR, which are usually trained using a soft margin loss \cite[]{Smola2004}. Under soft margin loss an error is penalized only if it is larger than a parameter \(\epsilon\), otherwise it is similar to a squared error function. Having the additional margin of allowed errors avoids minimal adjustments during training and allows for higher robustness of the final model. \subsubsection{Nearest Neighbors} Nearest neighbors methods, also k-Nearest Neighbors (kNN) or neighbors, relate an unseen instance to the closest samples, i.e. the nearest neighbors, in the training set \cite[]{Larose2004}. The distance between points is calculated from a distance metric, which is often the euclidean distance. In case of k-nearest neighbors, the number of neighbors to consider is fixed to $k$, which is usually a small integer value. Other methods set the number of neighbors dynamically from the data density in the training set and a threshold for the maximum distance. For regression problems, the estimated value $y$ is calculated by a weighted average over the neighbors' values. The weights are either uniform or proportional to the distance. Nearest neighbor methods have the advantage to be simple and non-parameterized, i.e. they do not require a training phase, but the complete training is necessary to process new instances. Because searching through all training samples for each estimation is inefficient for a large training set, tree-based data structures can be used to organize the data for faster access, for example, K-D trees \cite[]{Bentley1975} or Ball trees \cite[]{Omohundro1989}. \subsubsection{Linear Regression} Linear regression (LR) is a simple statistical approach to find a linear relationship between a set of input features and the target value. Applying linear regression is effective in scenarios where a linear relationship can be assumed. In other scenarios, LR is less accurate than the other introduced methods. However, because it is easy to train and apply, LR is commonly used as a baseline method to identify and justify the need for more complex, non-linear methods in ML applications. The model is formed by the linear relationships between each of the \(n\) features and the target value, the dependent variable \(y\). This relationship is captured by the parameter \(a_i\) for each feature \(x_i\): \(y = a_0 + a_1 x_1 + a_2 x_2 + \dots + a_n x_n\). Linear regression is trained via the \textit{ordinary least squares} method \cite[Ch. 3]{Hastie2009}, an iterative method to minimize the squared error between estimated and true target. \subsection{Data Curation} Machine learning methods are data-driven and need a data corpus to be trained, before they can be used to make estimations on new instances. In this section, we discuss the collection of a data corpus, its organization for training the model, and the pre-processing to transform the data into a format that is usable as model input. \subsubsection{Collection} A sufficient amount of training data is the basis to train a supervised ML model. Data for CSPs and COPs, that is, problem instances, can either be downloaded from open repositories for existing constraint problems, collected from historical data, or synthetically generated. For many problems, constraint models and instances can be freely accessed from online repositories. The CSP library (CSPLib) \cite[]{Jefferson1999} contains a large collection of constraint models, instances, and their results in different modeling languages. Furthermore, problem-specific libraries exist, such as TSPLib \cite[]{Reinelt1991} for the traveling sales person problem and related problems, or ASLib \cite[]{Bischl2016} for algorithm selection benchmarks. Finally, there are repositories of constraint models and instances in language-specific repositories, for example in MiniZinc\footnote{Online at: \url{https://github.com/MiniZinc/minizinc-benchmarks}} or XCSP3\footnote{Online at: \url{http://www.xcsp.org/}}. Having a generator allows us to create a large training corpus for a particular problem, but as it also requires additional effort to develop the generator program. This solution might not be suitable in all cases. Another approach is to generate instances directly from the constraint model \cite[]{Gent2014}. The constraint model is reformulated by defining the given instance parameters as variables to be found by the solver. Solving this reformulation with random value assignment then leads to a satisfiable problem instance of the original constraint model. However, for all generators, the difference between generated instances, that are distributed over the whole possible instance space, and realistic instances, that might only occupy a small niche of the possible instance space, has to be considered by either adjusting the generator to create realistic instances or to ensure the training and test set include realistic instances from other sources. \subsubsection{Data Organization} Data used to build a ML model is split into three parts: a) the training set, b) the development (dev) or validation set, and c) the test set. The training set is used to train the model via a learning algorithm, whereas the dev set is only used to control the parameters of the learning algorithm. The test set is not used during training or to adjust any parameters, but only serves to evaluate the performance of the trained model. Especially the test set should be similar to those instances that are most likely to be encountered in practical applications. The training set holds the largest part of the data, ranging from 50-80\% of the data, while the rest of the data is equally divided between validation and test set. This is a rough estimate and the exact split is dependent on the total size of the data set. In any case, it should be ensured the validation and test set are sufficiently large to evaluate the trained model. \subsubsection{Representation} The representation refers to the format into which a problem instance is transformed before it can be used as ML input. An expressive representation is crucial for the design of a ML model with high influence on its later performance. Representation consists of feature selection and data preparation, which are introduced in the following. \paragraph{Feature Selection} Feature selection defines which information is available for the model to make predictions and if insufficient or the wrong information is present, it is not possible to learn an accurate prediction model, independent of the selected machine learning technique. A good feature selection contains all features which are necessary to calculate the output and captures relations between instance data and the quantity to estimate. As a long-term vision, it is desirable to learn a model end-to-end, that is from the raw COP formulation and instance parameters, without having to extract handcrafted features. Currently, most machine learning techniques work with fixed, numerical input and output vectors. There are machine learning techniques capable to handle variable-length inputs and outputs, for example, recurrent neural networks like LSTM \cite[]{Hochreiter1997}, but these have, to the best of our knowledge, not yet been successfully applied in the area of predictive ML for CP and will not be further discussed here. Instead we focus on the common case to handcraft a fixed-size feature vector. For the selection of features, we first need to consider the application of the machine learning model. Is it a problem-specific application, that handles only instances of one defined optimization problem, or is it a problem-independent application, that handles instances of many different optimization problems? In COP-specific applications, domain knowledge can be exploited. For example, when building a predictive model for the travelling sales person (TSP) problem \cite[]{Hutter2014}, features describing the spatial distribution of the cities and the total area size are valuable \cite[]{Smith-Miles2010}. Similarly, the constrained vehicle routing problem (CVRP) has been investigated to identify problem-specific features that are beneficial to reason over solution quality \cite[]{Arnold2019b} or aid the search process \cite[]{Arnold2019,Accorsi2020,Lucas2020}. Without domain knowledge, more generic features have to be used to capture the characteristics and variance of different constraint models and their instances. One approach is the design of portfolio solvers, where a learning model is used to decide which solver to run for a given problem instance \cite[]{Xu2007,OMahony2008,Malitsky2012, Seipp2015, Amadini2015, Amadini2016a}. Feature extraction exploits the structure of the general constraint model and the specific instance, its constraints, variables and their domains. Features are further categorized as static features, which are constant for one model and instance, and dynamic features, which change during search and are therefore especially relevant for algorithm configuration and selection tasks. As a representative explanation, Table \ref{tab:features} shows an overview of features to describe problem instances. While many of these features are constant for multiple instances of the same constraint problem, e.g. the number of constants or which constraints were defined, the variables and their domains depend on the instance parameters and can offer descriptive information that discriminate several instances of the same problem. \begin{table}[thbp] \centering \small \caption{Examples for static COP features from the feature extractor \texttt{mzn2feat} \cite{Amadini2014}, which analyses COPs formulated in the MiniZinc constraint modeling language \cite{Nethercote2007}. The descriptions are quoted from \cite{Amadini2014}. NV: Number of variables, NC: Number of constraints, CV: variation coefficient, H: entropy of a set of values\label{tab:features}} \begin{tabularx}{\columnwidth}{lX} \toprule Category & Features \\ \midrule Variables & The number of variables $NV$; the number $cv$ of constants; the number $av$ of aliases; the ratio $\frac{av+cv}{NV}$; the ratio $\frac{NV}{NC}$; the number of defined variables (i.e. defined as a function of other variables); the number of introduced variables (i.e. auxiliary variables introduced during the FlatZinc conversion); sum, min, max, avg, CV, and H of the: variables domain size, variables degree, domain size to degree ratio \\ Domains & The number of: boolean variables $bv$ and the ratio $\frac{bv}{NV}$; float variables $fv$ and the ratio $\frac{fv}{NV}$; integer variables $iv$ and the ratio $\frac{iv}{NV}$; set variables $sv$ and the ratio $\frac{sv}{NV}$; array constraints $ac$ and the ratio $\frac{av}{NV}$; boolean constraints $bc$ and the ratio $\frac{bc}{NC}$; int constraints $ic$ and the ratio $\frac{ic}{NC}$; float constraints $fc$ and the ratio $\frac{fc}{NC}$; set constraints $sc$ and the ratio $\frac{sc}{NC}$; \\ Constraints & The total number of constraints $NC$, the ratio $\frac{NC}{NV}$, the number of constraints with FlatZinc annotations; the logarithm of the product of the: constraints domain (product of the domain size of each variable in that constraint) and constraints degree; sum, min, max, avg, CV, and H of the: constraints domain, constraints degree, domain to degree ratio \\ Global Constraints & The total number $gc$ of global constraints, the ratio $\frac{gc}{NC}$ and the number of global constraints for each one of the 27 equivalence classes in which we have grouped the 47 global constraints \\ Graphs & From the Constraint Graph $CG$ and the Variable Graph $VG$ we compute min, max, avg, CV, and H of the: $CG$ nodes degree, $CG$ nodes clustering coefficient, $VG$ nodes degree, $VG$ nodes diameter \\ Solving & The number of labeled variables (i.e. the variables to be assigned); the solve goal; the number of search annotations; the number of variable choice heuristics; the number of value choice heuristics \\ Objective & The domain $dom$, the degree $deg$, the ratios $\frac{dom}{deg}$ and $\frac{deg}{NC}$ of the variable $v$ that has to be optimized; the degree $de$ of $v$ in the variable graph, its diameter $di$, $\frac{de}{di}$, $\frac{di}{de}$. Moreover, named $\mu_{dom}$ and $\sigma_{dom}$ the mean and the standard deviation of the variables domain size and $\mu_{deg}$ and $\sigma_{deg}$ the mean and the standard deviation of the variables degree, we compute $\frac{dom}{\mu_{dom}}$, $\frac{deg}{\mu_{deg}}$, $\frac{dom-\mu_{dom}}{\sigma_{dom}}$, and $\frac{deg - \mu_{deg}}{\sigma_{deg}}$ \\ \bottomrule \end{tabularx} \end{table} Several studies have been performed to analyze the ability of these generic features to characterize and discriminate COP characteristics \cite[]{Roberts2009,Hutter2013,Amadini2015a,Bischl2016}. Their main conclusion is that a small number of features can be sufficient discriminators, but that there is no single set of best features for all constraint problems used in their experiments. An approach to overcome this issue is therefore to start with a larger set of features than practically necessary and, perform {\it dimensionality reduction} (see the next Section for a detailed explanation) % to remove features with little descriptive information. \paragraph{Data Preparation} \label{sec:datapreparation} Once the features are selected and retrieved, the next step is to pre-process the data, such that it can be used by the machine learning model, by performing dimensionality reduction and scaling. A dimensionality reduction step can shrink the size of the feature vector. Reducing the dimensionality, which means having less model inputs, can thereby also reduce the model complexity. Features that are constant for all instances are removed, as well as features that only show minimal variance below a given threshold. Other dimensionality reduction techniques, e.g. principal component analysis (PCA), apply statistical procedures to reduce the data to a lower-dimensional representation while preserving its variance. These reduction techniques can further reduce the number of features, but at the downside that it is no longer possible to directly interpret the meaning of each feature. Feature scaling is necessary for many models and means to transform the values of each feature, which might in different ranges, into one common range. Scaled features reduce model complexity as it is not necessary to have the weights of a model account for different input ranges. One common technique is to scale the feature by subtracting its mean and dividing by the standard deviation, which transforms the features to approximately resemble a normal distribution with zero mean and unit variance. Another technique is called \textit{minmax-normalization} and scales the feature based on the smallest and largest occurring values, such that all values scaled into the range $[-1, 1]$. Note that it is important to keep track of how each preparation step is performed on the training set, as it has to be repeated in the same way on each new instance during testing and production. This means the feature vector of a new instance contains the same features and each feature is scaled by the same parameters, e.g. it is scaled by the training set's mean and standard deviation. \section{Predictive Machine Learning for Constraint Optimization} \label{sec:predml} Opportunities for integration of predictive ML in constraint programming are vast and relevant in several research directions \cite[]{Bengio2018}. We first look at general categorizations and approaches to the combination of predictive ML and CP, before we discuss the body of knowledge in specialized research areas. \begin{figure}[t] \centering \includegraphics[width=0.75\textwidth]{figures/ICP.pdf} \caption{The inductive constraint programming loop (adapted from \cite[]{Bessiere2017}). The CP and ML components can interact with each other and react upon influences from the external world and observations.} \label{fig:icp} \end{figure} A recent work by \citeauthor{Bessiere2017} introduces a general framework for the integration of ML and CP, called the \textit{inductive constraint programming loop} (ICP) \cite[]{Bessiere2017}. The framework is based on four main building blocks: a CP component, a ML component, which can be controlled, as well as an external world, that cannot be controlled, and which produces observations. All these building blocks are interconnected and can receive and provide information from and to each other, e.g. the CP component receives new constraint problems via a World-to-CP relation and returns solutions via a corresponding Apply-to-World relation. An overview of the ICP framework and all defined relations is shown in Figure \ref{fig:icp}. The majority of predictive machine learning applications for CP can be embedded into the ICP framework, as they exploit the ML-to-CP relation, where the ML model transfers information to the component, which is their main purpose. Furthermore, these applications also exploit the opposite CP-to-ML relation to return feedback from the solver, e.g. runtimes, found solutions, to the ML model for improvement. \citeauthor{Lombardi2017} present a general framework for embedding ML-trained models in optimization techniques, called empirical model learning \cite[]{Lombardi2017}. The approach deploys trained ML models directly in the COP as additional global constraints. Experimental results show, that the embedded empirical ML model can improve the total solving process. The proposed integration further leads to easier deployment of the trained ML model and to reduce the complexity of the setup, but, at the same time, the complexity of the model itself is increased as compared to the pure COP. \subsection{Algorithm Selection and Configuration} The area of algorithm selection and configuration applies predictive ML to analyze individual problem instances and decide for the most appropriate solver, its heuristic, or the setting of certain tuning parameters of a solver. All these techniques have in common, that they work on a knowledge base that is mostly not restricted to a single constraint optimization problem, but applicable to instances from many different problems. Furthermore, these approaches affect changes onto the solver, but do not modify or adjust the constraint problem or the problem instance. Algorithm selection within a constraint solver can be used to decide, which search strategy to use. A search strategy consists of a variable selection, that is which variable will next have a value assigned, and a value selection, that is which value is assigned to the variable. \citeauthor{Arbelaez2009} propose a classification model to select from up to 8 different heuristics, consisting of both variable and value selection \cite[]{Arbelaez2009}. The search strategy is repeatedly selected during search, e.g. upon backtracking, to be able to adapt to characteristics of the problem instance in different regions of the search space. The machine learning model uses a SVM (Support Vector Machine, see Section \ref{sec:mlmodels}) and a set of 57 features to describe an instance. In \cite[]{Arbelaez2010}, this work is extended to a life-long learning constraint solver, whose inner machine learning model is repeatedly re-trained based on newly encountered problem instances and the experiences from selected search heuristics. The methodology is refined to select a heuristic for a predefined checkpoint window, i.e. a heuristic is fixed for a sequence of decisions, before the next heuristic is selected. In total 95 features, describing static features, such as the problem definition, and variable and constraint information, and dynamic features to monitor the search performance. Similarly, \citeauthor{Gent2010} classify problem instances to decide whether solving them benefits from lazy learning, an effective but costly CSP search method \cite[]{Gent2010}. They analyze the primal graph of the instance to extract instance features. The primal graph represents every variable as a node, and variables that occur in the scope of a constraint are connected via edges. Using this graph structure allows to extract features like the edge density, graph width, or the proportion of constraints that share the same variable. \citeauthor{Chu2015} investigate methods to learn a value selection heuristic \cite[]{Chu2015}. As part of their work, they discuss the problem of gathering samples to train the ML model. Ideally, one would require exactly solved instances, but in practice this incurs high computational cost for every training instance. Their approach is to define an alternative scoring function to be used as the training target. This scoring function is chosen such that it does not require exact solving of the instance and therefore gathering the training data is cheaper overall. Besides supervised ML techniques, adaptive ML methods, such as reinforcement learning, are also applied to configure search algorithms and their parameters, e.g. in large neighborhood search \cite[]{Mairy2011} or to select tree search heuristics \cite[]{Loth2013}. Reliable information about expected runtimes for an algorithm on a problem instance can be helpful not only for algorithm selection and configuration, but further for selecting hard benchmark instances, that distinguish different algorithms and to analyze hardness properties of problem classes \cite[]{Hutter2014}. \citeauthor{Hutter2014} propose \textit{empiricial performance models} (EPM) for runtime prediction. These EPMs use a set of generic and problem-specific features to model the runtime characteristics. Another study on runtime prediction for TSP has been published in \cite[]{Mersmann2013}, where the authors define a set of 47 TSP-specific features to asses instance hardness and algorithm performance. For a comprehensive overview on literature in runtime prediction, we refer the interested reader to \cite[]{Hutter2014}. The previously discussed work considered algorithm configuration and selection within one solver to optimize its performance. As mentioned earlier, other approaches are focused towards combining multiple distinct solvers into a \textit{portfolio solver} \cite[]{Amadini2016a}. Using machine learning and heuristics, the planning component of the portfolio solver determines the execution schedule of the solver \cite[]{Malitsky2012,Seipp2015}. In case of parallel portfolio solvers, a subset of solvers is run in parallel until a solution is found or, if the optimal solution is wanted, can exchange information about intermediate solutions found during search, e.g. sharing the best found objective bound \cite[]{Amadini2014c}. Popular portfolio solvers include SATZilla \cite[]{Xu2007}, CPHydra \cite[]{OMahony2008}, Sunny-CP \cite[]{Amadini2014b}, or HaifaCSP \cite[]{Veksler2016}. \subsection{Constraint Learning} During the last decade, considerable progress has been made in the field of automatic constraint learning. Starting from a dataset of solutions and non-solutions examples, several approaches have been proposed to extract constraint models fitting the data. Pioneering this question, the ICON European project\footnote{\url{http://www.icon-fet.eu}} explored different approaches to this problem. It is worth noticing that these approaches to learn in CP are different from the previously described usages of predictive ML to CP, as, unlike statistical ML, the learning model is based on logic-driven approaches which extracts an exact model from examples. Nevertheless, constraint learning approaches can be used to define predictive models to support other constraint models too, and are therefore included here as well. In \cite[]{Beldiceanu2011,Beldiceanu2012}, Beldiceanu and Simonis have proposed {\sc ModelSeeker}, an approach that returns the best candidate global constraint representing a pattern occurring in a set of positive examples. Following initial research ideas published in \cite[]{Bessiere2007}, \citeauthor{Bessiere2007} subsequently developed {\it Constraint Acquisition} as a strong inductive constraint learning framework \cite[]{Bessiere2015,Tsouros2019,Tsouros2020}. Starting from sequences of integers representing solution and non-solutions, constraint acquisition progressively refines a admissible and maximal model which accommodates all positive and negative examples. In \cite[]{Lallouet2007,Lallouet2010}, \citeauthor{Lallouet2007} had already proposed a constraint acquisition method based on inductive logic programming where both positive and negative examples can be handled, but the method captured the constraint network structure using some input background knowledge. Constraint Acquisition is independent of any background knowledge and just requires a bias, namely a subset of a constraint language, to be given as input. Interestingly, these constraint learning approaches are all derived from initial ideas developed in Inductive Logic Programming (ILP) \cite[]{DeRaedt2016}. The framework developed in this paper does not originate from ILP and does not try to infer a full CSP or Constraint Optimization model from sequences of positive and negative examples. Instead, it learns from existing solved instances to acquire suggested boundaries for the optimization variables. In that respect, it can complement Constraint Acquisition methods by exploiting solved instances and not only solutions and non-solutions. \subsection{Learning to Solve} Applications and research on predictive ML for CP are sometimes classified as \textit{learning to solve}, putting an emphasis on the ML component and its contribution to CP. These terminology is especially present in research that focuses on learning to solve optimization problems without the need for an additional solver \cite[]{Vinyals2015,Bello2017,Dai2017,Kumar2020,Cappart2021}. Connected to the development of deep learning techniques, these approaches are able to solve small instances of constraint problems, but are not competitive to the capabilities of state-of-the-art constraint solvers. A recent survey on the usage of reinforcement learning for combinatorial optimization can be found in \cite{Mazyavkina2021}. \section{Estimating Objective Boundaries} \label{sec:boundaryestimation} In this part of the paper, we present one application of predictive machine learning for constraint optimization, namely Bion\xspace, a novel boundary estimation technique. Boundary estimation supports the constraint solver by adding additional boundaries on the objective of a problem instance. The objective boundaries are estimated via a machine learning model, that has been trained on previously solved problem instances. Through the additional constraints, the search space of the constraint problem is pruned, which again allows to find good solutions early during search. In general, exact solvers already include heuristics to find feasible initial solutions that can be used for bounding the search \cite[]{Hooker2012}. For example, some CP and MIP solvers use LP relaxations of the problem to find boundary. Other CP solvers rely on good branching heuristics and constraint propagation to find close bounds early \cite[]{Rossi2006}. These approaches are central to the modus operandi of the solvers and crucial for their performance. Boundary estimation via predictive ML runs an additional bounding step before executing the solver and uses a ML-based heuristic, that is learned from historical data to already bound the objective and search space of the COP instance. With boundary estimation, a different approach to COP solving is taken. The CP solver exploits the constraint structure of a COP and considers only the current instance. In contrast, we train the ML model, which we refer to as the \textit{estimator}, on the structure of instance parameters and the actual objective value from example instances. Thus it only indirectly infers the model constraints, but it is not explicitly made aware of them. Our approach combines data- and logic-driven approaches to solve COPs and benefits from the estimation provided by the data-driven prediction and also the optimal solution computed by the logic-driven COP solver. In principle, Bion\xspace boosts the solving process by reducing the search space with estimated tight boundaries on the optimal objective. We now introduce the concept of estimated boundaries, which refers to providing close lower and upper bounds for the optimal value \ensuremath{\z_{opt}}\xspace of \ensuremath{f_{\z}}\xspace. \begin{Definition}[Estimation] An \emph{estimation} is a domain $\ensuremath{\hat{\lb{\z}}}\xspace..\ensuremath{\hat{\ub{\z}}}\xspace$ which defines boundaries for the domain of $\ensuremath{f_{\z}}\xspace$. The domain boundaries are predicted by a supervised ML model $P : \mathbb{R}^n \rightarrow \mathbb{R}^2$, that is, $\langle \ensuremath{\hat{\lb{\z}}}\xspace, \ensuremath{\hat{\ub{\z}}}\xspace \rangle = P(\mathbf{x})$. \end{Definition} \begin{Definition}[Admissible/Inadmissible Estimations] An estimation $\ensuremath{\hat{\lb{\z}}}\xspace..\ensuremath{\hat{\ub{\z}}}\xspace$ is \emph{admissible} iff $\ensuremath{\z_{opt}}\xspace \in \ensuremath{\hat{\lb{\z}}}\xspace..\ensuremath{\hat{\ub{\z}}}\xspace$. % Otherwise, the estimation is said to be inadmissible. \end{Definition} We further classify the two domain boundaries as \emph{cutting} and \emph{limiting} boundaries in relation to their effect on the solver's search process. Depending on whether the COP is a minimization or maximization problem, these terms refer to different domain boundaries. \begin{Definition}[Cutting Boundary] The \emph{cutting boundary} is the domain boundary that reduces the number of reachable solutions. For minimization, this is the upper domain boundary \ub{\ensuremath{\mathbf{z}}\xspace}; for maximization, the lower domain boundary \lb{\ensuremath{\mathbf{z}}\xspace}. \end{Definition} \begin{Definition}[Limiting Boundary] The \emph{limiting boundary} is the domain boundary that does not reduce the number of reachable solutions, but only reduces the search space to be explored. For minimization, this is the lower domain boundary \lb{\ensuremath{\mathbf{z}}\xspace}; for maximization, the upper domain boundary \ub{\ensuremath{\mathbf{z}}\xspace}. \end{Definition} For the sake of simplicity, in the rest of the paper, we focus exclusively on minimization problems, however, Bion\xspace is similarly applicable to maximization problems. \subsection{Optimization with Boundary Constraints} \label{sec:process} We first present the full process to solve a COP with Bion, which receives as inputs both an optimization model, describing the problem in terms of the variables \ensuremath{\mathcal{V}}\xspace and constraints \ensuremath{\mathcal{C}}\xspace, and its instance parameters which include data structure sizes, boundaries and constraints parameters. The COP is the same for all instances, only the parameters given as a separate input can change. The process of solving COPs with an already trained estimator is shown as a pseudocode formulation in Algorithm \ref{alg:bion}. For simplicity of the formulation, we represent the static COP and the instance parameters merged into one triple $\langle \ensuremath{\mathcal{V}}\xspace, \ensuremath{\mathcal{C}}\xspace, f_\ensuremath{\mathbf{z}}\xspace \rangle$. \begin{algorithm}[t] \begin{algorithmic}[1] \Function{SolveWithBion}{COP Instance $\langle \ensuremath{\mathcal{V}}\xspace, \ensuremath{\mathcal{C}}\xspace, f_\ensuremath{\mathbf{z}}\xspace \rangle$, Estimator $P$, Solver $S$} \State $x \gets$ \Call{preprocess}{$\langle \ensuremath{\mathcal{V}}\xspace, \ensuremath{\mathcal{C}}\xspace, f_\ensuremath{\mathbf{z}}\xspace \rangle$} \Comment{Extract feature vector $x$ from COP instance} \State $\langle \ensuremath{\hat{\lb{\z}}}\xspace, \ensuremath{\hat{\ub{\z}}}\xspace \rangle \gets P(x)$ \Comment{Predict objective boundary} \State $\ensuremath{\mathcal{C}}\xspace' \gets \ensuremath{\mathcal{C}}\xspace \cup \{z \in [\ensuremath{\hat{\lb{\z}}}\xspace, \ensuremath{\hat{\ub{\z}}}\xspace]\}$ \Comment{Update COP with boundary constraint} \State Result $\gets$ \Call{solve}{$\langle \ensuremath{\mathcal{V}}\xspace, \ensuremath{\mathcal{C}}\xspace', f_\ensuremath{\mathbf{z}}\xspace \rangle$} \Comment{Solve updated COP with CP solver} \If{Result = Unsatisfiable} \State $\ensuremath{\mathcal{C}}\xspace'' \gets \ensuremath{\mathcal{C}}\xspace \cup \{z \notin [\ensuremath{\hat{\lb{\z}}}\xspace, \ensuremath{\hat{\ub{\z}}}\xspace]\}$ \Comment{Update COP with negated boundary constraint} \State Result $\gets$ \Call{solve}{$\langle \ensuremath{\mathcal{V}}\xspace, \ensuremath{\mathcal{C}}\xspace'', f_\ensuremath{\mathbf{z}}\xspace \rangle$} \Comment{Solve updated COP with CP solver} \EndIf \State \Return Result, $x, z$ \Comment{Return solver result; include $x$ and $z$ for future model training} \EndFunction \end{algorithmic} \caption{Pseudocode formulation for the COP solving process with Bion} \label{alg:bion} \end{algorithm} Boundary estimation adds a preprocessing step to COP solving, as well as a rule for handling unsatisfiable instances. During preprocessing, the current problem instance is analyzed and the trained estimator estimates a boundary on the objective value of this specific instance. To provide the estimated boundary, instance-specific features are extracted from the COP model and its instance parameters. These features serve as the input of the estimator, which returns the estimated boundary value. Afterwards, Bion\xspace adds the boundary value as an additional constraint on the objective variable to the optimization model. The extended, now instance-specific model and the unmodified instance parameters are then given to the solver. If the solver returns a solution, the process ends, as the problem is solved. However, if the approximated objective value is too low, i.e. the estimation is inadmissible, it can render the problem unsatisfiable. In this case, Bion\xspace restarts the solver with the inverted boundary constraint, such that the estimation is a lower bound on \ensuremath{\mathbf{z}}\xspace. If the COP is now satisfiable, the estimation was inadmissible. Otherwise, unsatisfiability is due to other reasons. When the COP is solved, both the input and the objective value are stored for future training of the estimator. \subsection{Feature Selection} \label{sec:features} Each COP consists of constraints, variables, and their domains. To use these components as estimator inputs, it is necessary to extract and transform features, which describe a problem and its data in a meaningful way. As we discussed, a good set of features captures relations between instance data and the quantity to estimate, i.e., the objective value. Furthermore, the features are dynamic in terms of the individual variability of an instance, but static in the number of features, that is, each instance of one problem is represented by the same features. Among the various types of variable structures one can find in COPs, non-fixed data structures such as arrays, lists or sets, are the main contributors of variability and of major relevance for feature selection. For each of these data structures, $9$ common metrics from the main categories of descriptive statistics are calculated to gather an abstract, but comprehensive description of the contained data: (1) the number of elements, including the (2) minimum and (3) maximum values. The central tendency of the data is described by both (4) arithmetic mean and (5) median, the dispersion by the (6) standard deviation and (7) interquartile range. Finally, (8) skewness and (9) kurtosis describe the shape of the data distribution. Scalar variables are each added as features with their value. The constraints of a model are fixed for all instances, but due to different data inputs, the inferred final models for each problem instance differ. To capture information about the variables generated during compilation and model-specific, we use $95$ features as implemented in the current version of \texttt{mzn2feat} \cite[]{Amadini2014}, which are listed in Table \ref{tab:instances}. Several of these features have the same value for all instances as they capture static properties of the COP, but some add useful information for different instances, which supports the learning performance. Nevertheless, preliminary experiments showed that including the non-static features of the constraint model improves estimation accuracy. In general, all features can have varying relevance to express the data, depending on the model and the necessary input. However, as Bion\xspace is designed to be problem-independent, the same features are at first calculated for all problems. During the data preprocessing phase of the model training, all features with zero variance, that is, the same value for all instances, are removed to reduce the model complexity. Each feature is further standardized by subtracting the mean and dividing by the standard deviation. \subsection{Avoiding Inadmissible Estimations} \label{sec:training} One main risk, when automatically adding constraints to a COP, is to render the problem unsatisfiable. In the case of boundary estimation\xspace, an inadmissible estimation below the optimum value prohibits the solver from finding any feasible solution. Even though this is often detected early by the solver, there is no guarantee and thus it is necessary to tame this issue. To mitigate the risk, three counter-measures are considered in the design of Bion\xspace. First, during COP solving with Bion\xspace, unsatisfiable instances provide information about the problem and allow us to restart the solver with an inverted boundary constraint, such that an upper bound becomes a lower bound; Second, training the estimator with an asymmetric loss function penalizes errors on the side of inadmissible underestimates stronger than admissible overestimates, and thereby discourages misestimations; Third, besides exploiting the training error, the estimator is explicitly trained to overestimate. This requires adjusting the training label from the actual optimal objective value towards an overestimation. \subsubsection{Symmetric vs. Asymmetric Loss} \label{sec:losses} Common loss functions used for training ML models, such as MSE, are symmetric and do not differentiate between positive or negative errors. An asymmetric loss function, on the other hand, assigns higher loss values for either under- or overestimations, which means that certain errors are more penalized than others. Figure~\ref{fig:loss_functions} shows an example of quadratic symmetric and asymmetric loss functions. \begin{figure}[t] \centering \resizebox{0.5\textwidth}{!}{% \begingroup% \makeatletter% \begin{pgfpicture}% \pgfpathrectangle{\pgfpointorigin}{\pgfqpoint{2.979679in}{1.103342in}}% \pgfusepath{use as bounding box, clip}% \begin{pgfscope}% \pgfsetbuttcap% \pgfsetmiterjoin% \definecolor{currentfill}{rgb}{1.000000,1.000000,1.000000}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.000000pt}% \definecolor{currentstroke}{rgb}{1.000000,1.000000,1.000000}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.000000in}{0.000000in}}% \pgfpathlineto{\pgfqpoint{2.979679in}{0.000000in}}% \pgfpathlineto{\pgfqpoint{2.979679in}{1.103342in}}% \pgfpathlineto{\pgfqpoint{0.000000in}{1.103342in}}% \pgfpathclose% \pgfusepath{fill}% \end{pgfscope}% \begin{pgfscope}% \pgfsetbuttcap% \pgfsetmiterjoin% \definecolor{currentfill}{rgb}{1.000000,1.000000,1.000000}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.000000pt}% \definecolor{currentstroke}{rgb}{0.000000,0.000000,0.000000}% \pgfsetstrokecolor{currentstroke}% \pgfsetstrokeopacity{0.000000}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.216536in}{0.216536in}}% \pgfpathlineto{\pgfqpoint{2.970079in}{0.216536in}}% \pgfpathlineto{\pgfqpoint{2.970079in}{1.093742in}}% \pgfpathlineto{\pgfqpoint{0.216536in}{1.093742in}}% \pgfpathclose% \pgfusepath{fill}% \end{pgfscope}% \begin{pgfscope}% \definecolor{textcolor}{rgb}{0.150000,0.150000,0.150000}% \pgfsetstrokecolor{textcolor}% \pgfsetfillcolor{textcolor}% \pgftext[x=1.593308in,y=0.129036in,,top]{\color{textcolor}\rmfamily\fontsize{9.600000}{11.520000}\selectfont Residual}% \end{pgfscope}% \begin{pgfscope}% \definecolor{textcolor}{rgb}{0.150000,0.150000,0.150000}% \pgfsetstrokecolor{textcolor}% \pgfsetfillcolor{textcolor}% \pgftext[x=0.129036in,y=0.655139in,,bottom,rotate=90.000000]{\color{textcolor}\rmfamily\fontsize{9.600000}{11.520000}\selectfont Loss}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.216536in}{0.216536in}}{\pgfqpoint{2.753543in}{0.877205in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \pgfsetlinewidth{1.204500pt}% \definecolor{currentstroke}{rgb}{0.000000,0.000000,0.000000}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{{4.440000pt}{1.920000pt}}{0.000000pt}% \pgfpathmoveto{\pgfqpoint{0.216536in}{0.502539in}}% \pgfpathlineto{\pgfqpoint{0.262582in}{0.486351in}}% \pgfpathlineto{\pgfqpoint{0.308628in}{0.470713in}}% \pgfpathlineto{\pgfqpoint{0.354674in}{0.455626in}}% \pgfpathlineto{\pgfqpoint{0.400720in}{0.441090in}}% \pgfpathlineto{\pgfqpoint{0.446766in}{0.427104in}}% \pgfpathlineto{\pgfqpoint{0.492812in}{0.413669in}}% \pgfpathlineto{\pgfqpoint{0.538857in}{0.400784in}}% \pgfpathlineto{\pgfqpoint{0.584903in}{0.388450in}}% \pgfpathlineto{\pgfqpoint{0.630949in}{0.376667in}}% \pgfpathlineto{\pgfqpoint{0.676995in}{0.365435in}}% \pgfpathlineto{\pgfqpoint{0.723041in}{0.354753in}}% \pgfpathlineto{\pgfqpoint{0.769087in}{0.344621in}}% \pgfpathlineto{\pgfqpoint{0.815133in}{0.335040in}}% \pgfpathlineto{\pgfqpoint{0.861179in}{0.326010in}}% \pgfpathlineto{\pgfqpoint{0.907224in}{0.317531in}}% \pgfpathlineto{\pgfqpoint{0.953270in}{0.309602in}}% \pgfpathlineto{\pgfqpoint{0.999316in}{0.302224in}}% \pgfpathlineto{\pgfqpoint{1.045362in}{0.295396in}}% \pgfpathlineto{\pgfqpoint{1.091408in}{0.289119in}}% \pgfpathlineto{\pgfqpoint{1.137454in}{0.283392in}}% \pgfpathlineto{\pgfqpoint{1.183500in}{0.278217in}}% \pgfpathlineto{\pgfqpoint{1.229546in}{0.273591in}}% \pgfpathlineto{\pgfqpoint{1.275591in}{0.269517in}}% \pgfpathlineto{\pgfqpoint{1.321637in}{0.265993in}}% \pgfpathlineto{\pgfqpoint{1.367683in}{0.263019in}}% \pgfpathlineto{\pgfqpoint{1.413729in}{0.260597in}}% \pgfpathlineto{\pgfqpoint{1.459775in}{0.258725in}}% \pgfpathlineto{\pgfqpoint{1.505821in}{0.257403in}}% \pgfpathlineto{\pgfqpoint{1.551867in}{0.256632in}}% \pgfpathlineto{\pgfqpoint{1.597912in}{0.256412in}}% \pgfpathlineto{\pgfqpoint{1.643958in}{0.256742in}}% \pgfpathlineto{\pgfqpoint{1.690004in}{0.257623in}}% \pgfpathlineto{\pgfqpoint{1.736050in}{0.259055in}}% \pgfpathlineto{\pgfqpoint{1.782096in}{0.261037in}}% \pgfpathlineto{\pgfqpoint{1.828142in}{0.263570in}}% \pgfpathlineto{\pgfqpoint{1.874188in}{0.266654in}}% \pgfpathlineto{\pgfqpoint{1.920234in}{0.270288in}}% \pgfpathlineto{\pgfqpoint{1.966279in}{0.274472in}}% \pgfpathlineto{\pgfqpoint{2.012325in}{0.279208in}}% \pgfpathlineto{\pgfqpoint{2.058371in}{0.284494in}}% \pgfpathlineto{\pgfqpoint{2.104417in}{0.290330in}}% \pgfpathlineto{\pgfqpoint{2.150463in}{0.296717in}}% \pgfpathlineto{\pgfqpoint{2.196509in}{0.303655in}}% \pgfpathlineto{\pgfqpoint{2.242555in}{0.311144in}}% \pgfpathlineto{\pgfqpoint{2.288601in}{0.319183in}}% \pgfpathlineto{\pgfqpoint{2.334646in}{0.327772in}}% \pgfpathlineto{\pgfqpoint{2.380692in}{0.336913in}}% \pgfpathlineto{\pgfqpoint{2.426738in}{0.346603in}}% \pgfpathlineto{\pgfqpoint{2.472784in}{0.356845in}}% \pgfpathlineto{\pgfqpoint{2.518830in}{0.367637in}}% \pgfpathlineto{\pgfqpoint{2.564876in}{0.378980in}}% \pgfpathlineto{\pgfqpoint{2.610922in}{0.390873in}}% \pgfpathlineto{\pgfqpoint{2.656968in}{0.403317in}}% \pgfpathlineto{\pgfqpoint{2.703013in}{0.416312in}}% \pgfpathlineto{\pgfqpoint{2.749059in}{0.429857in}}% \pgfpathlineto{\pgfqpoint{2.795105in}{0.443953in}}% \pgfpathlineto{\pgfqpoint{2.841151in}{0.458599in}}% \pgfpathlineto{\pgfqpoint{2.887197in}{0.473796in}}% \pgfpathlineto{\pgfqpoint{2.933243in}{0.489544in}}% \pgfpathlineto{\pgfqpoint{2.970079in}{0.502539in}}% \pgfpathlineto{\pgfqpoint{2.970079in}{0.502539in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.216536in}{0.216536in}}{\pgfqpoint{2.753543in}{0.877205in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{1.204500pt}% \definecolor{currentstroke}{rgb}{0.000000,0.000000,1.000000}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.216536in}{1.053869in}}% \pgfpathlineto{\pgfqpoint{0.244164in}{1.022185in}}% \pgfpathlineto{\pgfqpoint{0.271791in}{0.991143in}}% \pgfpathlineto{\pgfqpoint{0.299419in}{0.960744in}}% \pgfpathlineto{\pgfqpoint{0.327046in}{0.930987in}}% \pgfpathlineto{\pgfqpoint{0.354674in}{0.901872in}}% \pgfpathlineto{\pgfqpoint{0.382302in}{0.873399in}}% \pgfpathlineto{\pgfqpoint{0.409929in}{0.845568in}}% \pgfpathlineto{\pgfqpoint{0.437557in}{0.818380in}}% \pgfpathlineto{\pgfqpoint{0.465184in}{0.791834in}}% \pgfpathlineto{\pgfqpoint{0.492812in}{0.765930in}}% \pgfpathlineto{\pgfqpoint{0.520439in}{0.740669in}}% \pgfpathlineto{\pgfqpoint{0.548067in}{0.716050in}}% \pgfpathlineto{\pgfqpoint{0.575694in}{0.692072in}}% \pgfpathlineto{\pgfqpoint{0.603322in}{0.668738in}}% \pgfpathlineto{\pgfqpoint{0.630949in}{0.646045in}}% \pgfpathlineto{\pgfqpoint{0.658577in}{0.623995in}}% \pgfpathlineto{\pgfqpoint{0.686204in}{0.602587in}}% \pgfpathlineto{\pgfqpoint{0.713832in}{0.581821in}}% \pgfpathlineto{\pgfqpoint{0.741459in}{0.561697in}}% \pgfpathlineto{\pgfqpoint{0.769087in}{0.542216in}}% \pgfpathlineto{\pgfqpoint{0.796714in}{0.523377in}}% \pgfpathlineto{\pgfqpoint{0.824342in}{0.505180in}}% \pgfpathlineto{\pgfqpoint{0.851969in}{0.487625in}}% \pgfpathlineto{\pgfqpoint{0.879597in}{0.470713in}}% \pgfpathlineto{\pgfqpoint{0.907224in}{0.454443in}}% \pgfpathlineto{\pgfqpoint{0.934852in}{0.438815in}}% \pgfpathlineto{\pgfqpoint{0.962479in}{0.423829in}}% \pgfpathlineto{\pgfqpoint{0.990107in}{0.409486in}}% \pgfpathlineto{\pgfqpoint{1.017735in}{0.395785in}}% \pgfpathlineto{\pgfqpoint{1.045362in}{0.382726in}}% \pgfpathlineto{\pgfqpoint{1.072990in}{0.370309in}}% \pgfpathlineto{\pgfqpoint{1.100617in}{0.358535in}}% \pgfpathlineto{\pgfqpoint{1.128245in}{0.347402in}}% \pgfpathlineto{\pgfqpoint{1.155872in}{0.336913in}}% \pgfpathlineto{\pgfqpoint{1.183500in}{0.327065in}}% \pgfpathlineto{\pgfqpoint{1.211127in}{0.317859in}}% \pgfpathlineto{\pgfqpoint{1.238755in}{0.309296in}}% \pgfpathlineto{\pgfqpoint{1.266382in}{0.301375in}}% \pgfpathlineto{\pgfqpoint{1.294010in}{0.294096in}}% \pgfpathlineto{\pgfqpoint{1.321637in}{0.287460in}}% \pgfpathlineto{\pgfqpoint{1.349265in}{0.281466in}}% \pgfpathlineto{\pgfqpoint{1.376892in}{0.276114in}}% \pgfpathlineto{\pgfqpoint{1.404520in}{0.271404in}}% \pgfpathlineto{\pgfqpoint{1.432147in}{0.267336in}}% \pgfpathlineto{\pgfqpoint{1.459775in}{0.263911in}}% \pgfpathlineto{\pgfqpoint{1.487402in}{0.261128in}}% \pgfpathlineto{\pgfqpoint{1.515030in}{0.258987in}}% \pgfpathlineto{\pgfqpoint{1.542657in}{0.257489in}}% \pgfpathlineto{\pgfqpoint{1.570285in}{0.256632in}}% \pgfpathlineto{\pgfqpoint{1.597912in}{0.256409in}}% \pgfpathlineto{\pgfqpoint{1.800514in}{0.256632in}}% \pgfpathlineto{\pgfqpoint{2.003116in}{0.257282in}}% \pgfpathlineto{\pgfqpoint{2.205718in}{0.258357in}}% \pgfpathlineto{\pgfqpoint{2.408320in}{0.259859in}}% \pgfpathlineto{\pgfqpoint{2.610922in}{0.261788in}}% \pgfpathlineto{\pgfqpoint{2.813523in}{0.264143in}}% \pgfpathlineto{\pgfqpoint{2.970079in}{0.266254in}}% \pgfpathlineto{\pgfqpoint{2.970079in}{0.266254in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.216536in}{0.216536in}}{\pgfqpoint{2.753543in}{0.877205in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \pgfsetlinewidth{0.501875pt}% \definecolor{currentstroke}{rgb}{0.000000,0.000000,0.000000}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{{1.850000pt}{0.800000pt}}{0.000000pt}% \pgfpathmoveto{\pgfqpoint{1.593308in}{0.216536in}}% \pgfpathlineto{\pgfqpoint{1.593308in}{0.742860in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfsetrectcap% \pgfsetmiterjoin% \pgfsetlinewidth{1.003750pt}% \definecolor{currentstroke}{rgb}{0.800000,0.800000,0.800000}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.216536in}{0.216536in}}% \pgfpathlineto{\pgfqpoint{0.216536in}{1.093742in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfsetrectcap% \pgfsetmiterjoin% \pgfsetlinewidth{1.003750pt}% \definecolor{currentstroke}{rgb}{0.800000,0.800000,0.800000}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.216536in}{0.216536in}}% \pgfpathlineto{\pgfqpoint{2.970079in}{0.216536in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfsetbuttcap% \pgfsetmiterjoin% \definecolor{currentfill}{rgb}{1.000000,1.000000,1.000000}% \pgfsetfillcolor{currentfill}% \pgfsetfillopacity{0.800000}% \pgfsetlinewidth{0.803000pt}% \definecolor{currentstroke}{rgb}{0.800000,0.800000,0.800000}% \pgfsetstrokecolor{currentstroke}% \pgfsetstrokeopacity{0.800000}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.468688in}{0.633714in}}% \pgfpathlineto{\pgfqpoint{2.884524in}{0.633714in}}% \pgfpathquadraticcurveto{\pgfqpoint{2.908968in}{0.633714in}}{\pgfqpoint{2.908968in}{0.658159in}}% \pgfpathlineto{\pgfqpoint{2.908968in}{1.008186in}}% \pgfpathquadraticcurveto{\pgfqpoint{2.908968in}{1.032631in}}{\pgfqpoint{2.884524in}{1.032631in}}% \pgfpathlineto{\pgfqpoint{0.468688in}{1.032631in}}% \pgfpathquadraticcurveto{\pgfqpoint{0.444244in}{1.032631in}}{\pgfqpoint{0.444244in}{1.008186in}}% \pgfpathlineto{\pgfqpoint{0.444244in}{0.658159in}}% \pgfpathquadraticcurveto{\pgfqpoint{0.444244in}{0.633714in}}{\pgfqpoint{0.468688in}{0.633714in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfsetbuttcap% \pgfsetroundjoin% \pgfsetlinewidth{1.204500pt}% \definecolor{currentstroke}{rgb}{0.000000,0.000000,0.000000}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{{4.440000pt}{1.920000pt}}{0.000000pt}% \pgfpathmoveto{\pgfqpoint{0.493133in}{0.933659in}}% \pgfpathlineto{\pgfqpoint{0.737577in}{0.933659in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \definecolor{textcolor}{rgb}{0.150000,0.150000,0.150000}% \pgfsetstrokecolor{textcolor}% \pgfsetfillcolor{textcolor}% \pgftext[x=0.835355in,y=0.890882in,left,base]{\color{textcolor}\rmfamily\fontsize{8.800000}{10.560000}\selectfont Symmetric Loss (Squared Error)}% \end{pgfscope}% \begin{pgfscope}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{1.204500pt}% \definecolor{currentstroke}{rgb}{0.000000,0.000000,1.000000}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.493133in}{0.752534in}}% \pgfpathlineto{\pgfqpoint{0.737577in}{0.752534in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \definecolor{textcolor}{rgb}{0.150000,0.150000,0.150000}% \pgfsetstrokecolor{textcolor}% \pgfsetfillcolor{textcolor}% \pgftext[x=0.835355in,y=0.709757in,left,base]{\color{textcolor}\rmfamily\fontsize{8.800000}{10.560000}\selectfont Asymmetric Loss (a = -0.8)}% \end{pgfscope}% \end{pgfpicture}% \makeatother% \endgroup% } \caption{Quadratic symmetric and asymmetric loss functions. The asymmetric loss assigns a higher loss to a negative residuals, but lower loss to overestimations, than the symmetric squared error loss.} \label{fig:loss_functions} \end{figure} \textit{Shifted Squared Error Loss} is an imbalanced variant of squared error loss. The parameter \(a\) shifts the penalization towards under- or overestimation and influences the magnitude of the penalty. Formally speaking, \begin{Definition}[Shifted Squared Error Loss] \[ L(r) = r^2 \cdot (sgn(r) + a)^2 \text{ with absolute error } r = \hat{y} - y\] where $\hat{y}$ is the estimated value and $y$ is the true target value, and $a$ is a parameter which shifts the penalization towards under- or overestimation. \end{Definition} In Section~\ref{sec:experiments}, we compare the usage of both symmetric and asymmetric loss functions plus label shift to evaluate the importance of adjusting model training to the problem instances. \subsubsection{Label Shift} \label{sec:labelshift} Boundary estimation only approximates the objective function of the COP, which means there is no requirement on the convergence towards a truly optimum solution. Said otherwise, Bion\xspace can accept estimation errors after training. This allows Bion\xspace to work with fewer training examples than what could be expected with a desired exact training method. This is appropriate here, as collecting labeled data requires solving many COPs instances first, which can be very costly. However, there is a risk that the trained model underestimates (in case of minimization) the actual objective value. Such an inadmissible estimation, as defined above, leads to an unsatisfiable constraint system and prohibits the COP solver from finding any feasible solution. On the other hand, a too loose, but admissible overestimation may not sufficiently approximate the actual optimum. To address this risk, we introduce {\it label shift} in Bion\xspace, which adjusts the training procedure with one user-controlled parameter. Label shift is similar to the concept of prediction shift described in \cite[]{Tolstikov2017}, but based on the specific COP model. \begin{Definition}[Label Shift] \begin{align*} y' &= y + \lambda \,(\ub{z} - y)\,\quad \text{\emph{(Overestimation)}}\\ y' &= y - \lambda \,(y - \lb{z})\,\quad \text{\emph{(Underestimation)}} \end{align*} \end{Definition} where \(\ub{z}\) is the upper bound of the objective domain, \(y\) is the optimal objective value of the training instance, and \(y'\) is the adjusted label for training the estimator, as the result of the label shift adjustment. Label shift depends on \(\lambda\), which is an adjustment factor to shift the target value \(y\) between the domain boundary and the actual optimum. The trade-off between a close and admissible estimation and an inadmissible estimation is thus controlled by the value of $\lambda$. \subsection{Estimated Boundaries during Search} % \label{sec:method_cp} Using Bion\xspace to solve a COP consists of the following steps: \begin{enumerate} \item (Initially) Train an estimator model for the COP \item Extract a feature vector from each COP instance \item Estimate both a lower and an upper objective boundaries \item Update the COP with estimated boundaries \item Solve the updated COP with the solver \end{enumerate} The boundaries provided by the estimator can be embedded as hard constraints on the objective variable, i.e., by adding $\ensuremath{\mathbf{z}}\xspace \in \ensuremath{\hat{\lb{\z}}}\xspace \dots \ensuremath{\hat{\ub{\z}}}\xspace$. The induced overhead is negligible, but dealing with misestimations requires additional control. If all feasible solutions are excluded, because the cutting bound is wrongly estimated, the instance is rendered unsatisfiable. This issue is handled by reverting to the original domain. If only optimal solutions are excluded, because the limiting bound is wrongly estimated, then only non-optimal solutions can be returned and this stays impossible to notice. This issue cannot be detected in a single optimization run of the solver. However, in practical cases where the goal is to find good-enough solutions early rather than finding truly-proven optima, it can be an acceptable risk to come-up with an good approximation of the optimal solutions only. Conclusively, hard boundary constraints are especially suited for cases where a high confidence in the quality of the estimator has been gained, and the occurrence of inadmissible estimations is unlikely. \section{Experiments} \label{sec:experiments} We experimentally evaluate our method Bion\xspace in three experiments, which focus on the impact of label shift and asymmetric loss functions for training the estimator, on the estimators' performance to bound the objective domain, and on the impact of estimated boundaries on solver performance. \subsection{Setup} \label{sec:expsetup} \subsubsection{Constraint Optimization Problems} We selected seven problems, that were previously used in MiniZinc challenges \cite{Stuckey2014} to evaluate CP solvers. These problems are those with the largest number of instances in the MiniZinc benchmarks\footnote{Accessible at https://github.com/MiniZinc/minizinc-benchmarks/}, ranging from 50 to multiple thousands. In practice, it is more likely to only have few examples instances available, therefore we also include problems with few training examples. These COPs, which are all minimization problems, are listed in Table~\ref{tab:instances} along with the type of objective function, whether they contain a custom search strategy, and the number of available instances. Considering training sets of different sizes, from 50 to over 11,000 instances, is relevant to understand scenarios that can benefit from boundary estimation. The column \emph{Objective} describes the objective function type, which is related to the solver's ability to efficiently propagate domain boundaries. The COPs have two main groups of objective functions. One group minimizes the sum, the other minimizes the maximum of a list of variables. For the models minimizing the maximum, two formulations are present in our evaluation models. \emph{Max-Max} uses the MiniZinc built-in \textrm{max} ($\ensuremath{\mathbf{z}}\xspace = max(V)$), whereas \emph{Leq-Max} constraints the objective to be greater-or-equal all variables ($\forall\,\mathbf{v} \in V\,:\,\mathbf{v} \leq \ensuremath{\mathbf{z}}\xspace$). Both formulations are decomposed into different FlatZinc constraints, which can have an impact on the ability to propagate constraints. \begin{table}[t] \centering \small \caption{Overview of benchmark problems. All considered problems are minimization problems with a large variety in the number of available training instances.\label{tab:instances}} \begin{tabularx}{\columnwidth}{XXXr} \toprule Problem & Objective & Search & Instances \\ \midrule MRCPSP & Max-Max & Model-Specific & 11182 \\ % RCPSP & Leq-Max & Model-Specific & 2904 \\ % Bin Packing & Sum & Solver-Default & 500 \\ % Cutting Stock & Sum & Solver-Default & 121 \\ % Jobshop & Leq-Max & Solver-Default & 74 \\ % VRP & Sum & Model-Specific & 74 \\ % Open Stacks & Max-Max & Model-Specific & 50 \\ % \bottomrule \end{tabularx} \end{table} \subsubsection{Training Settings} We implement Bion\xspace in Python using scikit-learn \cite[]{scikit-learn}. Exceptions are NNs, where Keras \cite[]{Chollet2015} and TensorFlow \cite[]{abadi2016tensorflow} are used, and GTB, where XGBoost \cite[]{Chen2016} is used, both to support custom loss functions. mzn2feat \cite[]{Amadini2014} is used for COP feature extraction. In our comparison, we consider asymmetric (\ensuremath{\text{GTB}_{a}}\xspace, \ensuremath{\text{NN}_{a}}\xspace) and symmetric versions (\ensuremath{\text{GTB}_{s}}\xspace, \ensuremath{\text{NN}_{s}}\xspace) of GTB and NN, and symmetric versions of SVM and linear regression. The performed experiments are targeted towards evaluating the general effectiveness of boundary estimation\xspace over a range of different problems. Therefore, we used the default parameters of each ML model as provided by the chosen frameworks as much as possible. As loss factors for the asymmetric loss functions, we set \(a = -1\) for \ensuremath{\text{GTB}_{a}}\xspace and \(a = -0.8\) for \ensuremath{\text{NN}_{a}}\xspace, where a smaller \(a\) caused problems during training. The model parameters were not adjusted for individual problems. Parameter tuning is also often not performed in a practical application, although it potentially allows to improve the performance for some problems. For Bin Packing, we introduced a trivial upper boundary as there was originally no finite boundary in the model. \subsection{Boundary Estimation Performance} \label{sec:mlresults} We evaluate the capability to learn close and admissible objective boundaries, that prune the objective variable's domain. To this end, we focus on 1) the impact of label shift and asymmetric loss functions for training the estimator, 2) the estimators' performance to bound the objective domain, and 3) the impact of estimated boundaries on solver performance. Estimation performance is measured through repeated 10-fold validation. In each repetition, the instances are randomly split into ten folds. Nine of these folds form the training set, the other the validation set. The model is trained 10 times, one time with each fold as validation set. We repeat this process 30 times, to account for stochastic effects, and report median values. Training times for the models are dependent on the number of training samples available. We trained on commodity hardware without GPU acceleration. In general, training takes less than five seconds per model, except for MRCPSP with up to 30 seconds. Another exception are the neural networks which take on average 1 minute to train and maximum 6 minutes for MRCPSP. \subsubsection{Adjustment Factors for Label Shift} To avoid inadmissible estimations, we introduced the label shift method. Label shift trains the estimator not on the exact objective value, but adjusts the label of the training samples according to a configuration parameter \(\lambda\). We evaluate the effect of the adjustment factor (\(\lambda \in \{0, 0.1, 0.2, \dots, 1.0\}\)) on the quality of estimations. The results are shown in Figure~\ref{fig:labelshift}, both the ratio of admissible estimations and the ratio of instances for which the domain is pruned. Here, we do not distinguish the different benchmark problems, but aggregate the results as they show similar behavior for the different problems. \begin{figure}[H] \centering \begingroup% \makeatletter% \begin{pgfpicture}% \pgfpathrectangle{\pgfpointorigin}{\pgfqpoint{3.105713in}{1.489426in}}% \pgfusepath{use as bounding box, clip}% \begin{pgfscope}% \pgfsetbuttcap% \pgfsetmiterjoin% \definecolor{currentfill}{rgb}{1.000000,1.000000,1.000000}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.000000pt}% \definecolor{currentstroke}{rgb}{1.000000,1.000000,1.000000}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.000000in}{0.000000in}}% \pgfpathlineto{\pgfqpoint{3.105713in}{0.000000in}}% \pgfpathlineto{\pgfqpoint{3.105713in}{1.489426in}}% \pgfpathlineto{\pgfqpoint{0.000000in}{1.489426in}}% \pgfpathclose% \pgfusepath{fill}% \end{pgfscope}% \begin{pgfscope}% \pgfsetbuttcap% \pgfsetmiterjoin% \definecolor{currentfill}{rgb}{1.000000,1.000000,1.000000}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.000000pt}% \definecolor{currentstroke}{rgb}{0.000000,0.000000,0.000000}% \pgfsetstrokecolor{currentstroke}% \pgfsetstrokeopacity{0.000000}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.533154in}{0.420041in}}% \pgfpathlineto{\pgfqpoint{3.096113in}{0.420041in}}% \pgfpathlineto{\pgfqpoint{3.096113in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{0.533154in}{1.442996in}}% \pgfpathclose% \pgfusepath{fill}% \end{pgfscope}% \begin{pgfscope}% \definecolor{textcolor}{rgb}{0.150000,0.150000,0.150000}% \pgfsetstrokecolor{textcolor}% \pgfsetfillcolor{textcolor}% \pgftext[x=0.649653in,y=0.304763in,,top]{\color{textcolor}\rmfamily\fontsize{8.800000}{10.560000}\selectfont 0.0}% \end{pgfscope}% \begin{pgfscope}% \definecolor{textcolor}{rgb}{0.150000,0.150000,0.150000}% \pgfsetstrokecolor{textcolor}% \pgfsetfillcolor{textcolor}% \pgftext[x=0.882649in,y=0.304763in,,top]{\color{textcolor}\rmfamily\fontsize{8.800000}{10.560000}\selectfont 0.05}% \end{pgfscope}% \begin{pgfscope}% \definecolor{textcolor}{rgb}{0.150000,0.150000,0.150000}% \pgfsetstrokecolor{textcolor}% \pgfsetfillcolor{textcolor}% \pgftext[x=1.115645in,y=0.304763in,,top]{\color{textcolor}\rmfamily\fontsize{8.800000}{10.560000}\selectfont 0.1}% \end{pgfscope}% \begin{pgfscope}% \definecolor{textcolor}{rgb}{0.150000,0.150000,0.150000}% \pgfsetstrokecolor{textcolor}% \pgfsetfillcolor{textcolor}% \pgftext[x=1.348641in,y=0.304763in,,top]{\color{textcolor}\rmfamily\fontsize{8.800000}{10.560000}\selectfont 0.15}% \end{pgfscope}% \begin{pgfscope}% \definecolor{textcolor}{rgb}{0.150000,0.150000,0.150000}% \pgfsetstrokecolor{textcolor}% \pgfsetfillcolor{textcolor}% \pgftext[x=1.581637in,y=0.304763in,,top]{\color{textcolor}\rmfamily\fontsize{8.800000}{10.560000}\selectfont 0.2}% \end{pgfscope}% \begin{pgfscope}% \definecolor{textcolor}{rgb}{0.150000,0.150000,0.150000}% \pgfsetstrokecolor{textcolor}% \pgfsetfillcolor{textcolor}% \pgftext[x=1.814634in,y=0.304763in,,top]{\color{textcolor}\rmfamily\fontsize{8.800000}{10.560000}\selectfont 0.25}% \end{pgfscope}% \begin{pgfscope}% \definecolor{textcolor}{rgb}{0.150000,0.150000,0.150000}% \pgfsetstrokecolor{textcolor}% \pgfsetfillcolor{textcolor}% \pgftext[x=2.047630in,y=0.304763in,,top]{\color{textcolor}\rmfamily\fontsize{8.800000}{10.560000}\selectfont 0.3}% \end{pgfscope}% \begin{pgfscope}% \definecolor{textcolor}{rgb}{0.150000,0.150000,0.150000}% \pgfsetstrokecolor{textcolor}% \pgfsetfillcolor{textcolor}% \pgftext[x=2.280626in,y=0.304763in,,top]{\color{textcolor}\rmfamily\fontsize{8.800000}{10.560000}\selectfont 0.4}% \end{pgfscope}% \begin{pgfscope}% \definecolor{textcolor}{rgb}{0.150000,0.150000,0.150000}% \pgfsetstrokecolor{textcolor}% \pgfsetfillcolor{textcolor}% \pgftext[x=2.513622in,y=0.304763in,,top]{\color{textcolor}\rmfamily\fontsize{8.800000}{10.560000}\selectfont 0.5}% \end{pgfscope}% \begin{pgfscope}% \definecolor{textcolor}{rgb}{0.150000,0.150000,0.150000}% \pgfsetstrokecolor{textcolor}% \pgfsetfillcolor{textcolor}% \pgftext[x=2.746618in,y=0.304763in,,top]{\color{textcolor}\rmfamily\fontsize{8.800000}{10.560000}\selectfont 0.6}% \end{pgfscope}% \begin{pgfscope}% \definecolor{textcolor}{rgb}{0.150000,0.150000,0.150000}% \pgfsetstrokecolor{textcolor}% \pgfsetfillcolor{textcolor}% \pgftext[x=2.979615in,y=0.304763in,,top]{\color{textcolor}\rmfamily\fontsize{8.800000}{10.560000}\selectfont 0.8}% \end{pgfscope}% \begin{pgfscope}% \definecolor{textcolor}{rgb}{0.150000,0.150000,0.150000}% \pgfsetstrokecolor{textcolor}% \pgfsetfillcolor{textcolor}% \pgftext[x=1.814634in,y=0.130924in,,top]{\color{textcolor}\rmfamily\fontsize{9.600000}{11.520000}\selectfont Adjustment Factor \(\displaystyle \lambda\)}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{0.803000pt}% \definecolor{currentstroke}{rgb}{0.800000,0.800000,0.800000}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.533154in}{0.420041in}}% \pgfpathlineto{\pgfqpoint{3.096113in}{0.420041in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \definecolor{textcolor}{rgb}{0.150000,0.150000,0.150000}% \pgfsetstrokecolor{textcolor}% \pgfsetfillcolor{textcolor}% \pgftext[x=0.340115in,y=0.373611in,left,base]{\color{textcolor}\rmfamily\fontsize{8.800000}{10.560000}\selectfont 0}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{0.803000pt}% \definecolor{currentstroke}{rgb}{0.800000,0.800000,0.800000}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.533154in}{0.675780in}}% \pgfpathlineto{\pgfqpoint{3.096113in}{0.675780in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \definecolor{textcolor}{rgb}{0.150000,0.150000,0.150000}% \pgfsetstrokecolor{textcolor}% \pgfsetfillcolor{textcolor}% \pgftext[x=0.262354in,y=0.629350in,left,base]{\color{textcolor}\rmfamily\fontsize{8.800000}{10.560000}\selectfont 25}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{0.803000pt}% \definecolor{currentstroke}{rgb}{0.800000,0.800000,0.800000}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.533154in}{0.931518in}}% \pgfpathlineto{\pgfqpoint{3.096113in}{0.931518in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \definecolor{textcolor}{rgb}{0.150000,0.150000,0.150000}% \pgfsetstrokecolor{textcolor}% \pgfsetfillcolor{textcolor}% \pgftext[x=0.262354in,y=0.885088in,left,base]{\color{textcolor}\rmfamily\fontsize{8.800000}{10.560000}\selectfont 50}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{0.803000pt}% \definecolor{currentstroke}{rgb}{0.800000,0.800000,0.800000}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.533154in}{1.187257in}}% \pgfpathlineto{\pgfqpoint{3.096113in}{1.187257in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \definecolor{textcolor}{rgb}{0.150000,0.150000,0.150000}% \pgfsetstrokecolor{textcolor}% \pgfsetfillcolor{textcolor}% \pgftext[x=0.262354in,y=1.140827in,left,base]{\color{textcolor}\rmfamily\fontsize{8.800000}{10.560000}\selectfont 75}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{0.803000pt}% \definecolor{currentstroke}{rgb}{0.800000,0.800000,0.800000}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.533154in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{3.096113in}{1.442996in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \definecolor{textcolor}{rgb}{0.150000,0.150000,0.150000}% \pgfsetstrokecolor{textcolor}% \pgfsetfillcolor{textcolor}% \pgftext[x=0.184592in,y=1.396565in,left,base]{\color{textcolor}\rmfamily\fontsize{8.800000}{10.560000}\selectfont 100}% \end{pgfscope}% \begin{pgfscope}% \definecolor{textcolor}{rgb}{0.150000,0.150000,0.150000}% \pgfsetstrokecolor{textcolor}% \pgfsetfillcolor{textcolor}% \pgftext[x=0.129036in,y=0.931518in,,bottom,rotate=90.000000]{\color{textcolor}\rmfamily\fontsize{9.600000}{11.520000}\selectfont Admissible (\%)}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.121569,0.466667,0.705882}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.121569,0.466667,0.705882}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.649653in}{0.464003in}}% \pgfpathlineto{\pgfqpoint{0.665605in}{0.490590in}}% \pgfpathlineto{\pgfqpoint{0.649653in}{0.517177in}}% \pgfpathlineto{\pgfqpoint{0.633700in}{0.490590in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.121569,0.466667,0.705882}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.121569,0.466667,0.705882}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.882649in}{0.904932in}}% \pgfpathlineto{\pgfqpoint{0.898601in}{0.931518in}}% \pgfpathlineto{\pgfqpoint{0.882649in}{0.958105in}}% \pgfpathlineto{\pgfqpoint{0.866697in}{0.931518in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.121569,0.466667,0.705882}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.121569,0.466667,0.705882}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.115645in}{1.097728in}}% \pgfpathlineto{\pgfqpoint{1.131597in}{1.124315in}}% \pgfpathlineto{\pgfqpoint{1.115645in}{1.150902in}}% \pgfpathlineto{\pgfqpoint{1.099693in}{1.124315in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.121569,0.466667,0.705882}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.121569,0.466667,0.705882}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.348641in}{1.211818in}}% \pgfpathlineto{\pgfqpoint{1.364593in}{1.238405in}}% \pgfpathlineto{\pgfqpoint{1.348641in}{1.264991in}}% \pgfpathlineto{\pgfqpoint{1.332689in}{1.238405in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.121569,0.466667,0.705882}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.121569,0.466667,0.705882}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.581637in}{1.273195in}}% \pgfpathlineto{\pgfqpoint{1.597589in}{1.299782in}}% \pgfpathlineto{\pgfqpoint{1.581637in}{1.326369in}}% \pgfpathlineto{\pgfqpoint{1.565685in}{1.299782in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.121569,0.466667,0.705882}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.121569,0.466667,0.705882}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.814634in}{1.331163in}}% \pgfpathlineto{\pgfqpoint{1.830586in}{1.357749in}}% \pgfpathlineto{\pgfqpoint{1.814634in}{1.384336in}}% \pgfpathlineto{\pgfqpoint{1.798682in}{1.357749in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.121569,0.466667,0.705882}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.121569,0.466667,0.705882}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.047630in}{1.370710in}}% \pgfpathlineto{\pgfqpoint{2.063582in}{1.397297in}}% \pgfpathlineto{\pgfqpoint{2.047630in}{1.423883in}}% \pgfpathlineto{\pgfqpoint{2.031678in}{1.397297in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.121569,0.466667,0.705882}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.121569,0.466667,0.705882}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.280626in}{1.411379in}}% \pgfpathlineto{\pgfqpoint{2.296578in}{1.437966in}}% \pgfpathlineto{\pgfqpoint{2.280626in}{1.464552in}}% \pgfpathlineto{\pgfqpoint{2.264674in}{1.437966in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.121569,0.466667,0.705882}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.121569,0.466667,0.705882}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.513622in}{1.416409in}}% \pgfpathlineto{\pgfqpoint{2.529574in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.513622in}{1.469582in}}% \pgfpathlineto{\pgfqpoint{2.497670in}{1.442996in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.121569,0.466667,0.705882}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.121569,0.466667,0.705882}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.746618in}{1.416409in}}% \pgfpathlineto{\pgfqpoint{2.762571in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.746618in}{1.469582in}}% \pgfpathlineto{\pgfqpoint{2.730666in}{1.442996in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.121569,0.466667,0.705882}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.121569,0.466667,0.705882}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.979615in}{1.416409in}}% \pgfpathlineto{\pgfqpoint{2.995567in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.979615in}{1.469582in}}% \pgfpathlineto{\pgfqpoint{2.963663in}{1.442996in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{1.084050pt}% \definecolor{currentstroke}{rgb}{0.121569,0.466667,0.705882}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.649653in}{0.490590in}}% \pgfpathlineto{\pgfqpoint{0.882649in}{0.931518in}}% \pgfpathlineto{\pgfqpoint{1.115645in}{1.124315in}}% \pgfpathlineto{\pgfqpoint{1.348641in}{1.238405in}}% \pgfpathlineto{\pgfqpoint{1.581637in}{1.299782in}}% \pgfpathlineto{\pgfqpoint{1.814634in}{1.357749in}}% \pgfpathlineto{\pgfqpoint{2.047630in}{1.397297in}}% \pgfpathlineto{\pgfqpoint{2.280626in}{1.437966in}}% \pgfpathlineto{\pgfqpoint{2.513622in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.746618in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.979615in}{1.442996in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.121569,0.466667,0.705882}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.649653in}{0.479801in}}% \pgfpathlineto{\pgfqpoint{0.649653in}{0.504699in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.121569,0.466667,0.705882}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.882649in}{0.931518in}}% \pgfpathlineto{\pgfqpoint{0.882649in}{0.970863in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.121569,0.466667,0.705882}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.115645in}{1.113736in}}% \pgfpathlineto{\pgfqpoint{1.115645in}{1.148964in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.121569,0.466667,0.705882}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.348641in}{1.217946in}}% \pgfpathlineto{\pgfqpoint{1.348641in}{1.245460in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.121569,0.466667,0.705882}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.581637in}{1.296859in}}% \pgfpathlineto{\pgfqpoint{1.581637in}{1.315126in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.121569,0.466667,0.705882}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.814634in}{1.340700in}}% \pgfpathlineto{\pgfqpoint{1.814634in}{1.361515in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.121569,0.466667,0.705882}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.047630in}{1.381618in}}% \pgfpathlineto{\pgfqpoint{2.047630in}{1.403162in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.121569,0.466667,0.705882}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.280626in}{1.432450in}}% \pgfpathlineto{\pgfqpoint{2.280626in}{1.439336in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.121569,0.466667,0.705882}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.513622in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.513622in}{1.442996in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.121569,0.466667,0.705882}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.746618in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.746618in}{1.442996in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.121569,0.466667,0.705882}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.979615in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.979615in}{1.442996in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{1.000000,0.498039,0.054902}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{1.000000,0.498039,0.054902}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.649653in}{0.495887in}}% \pgfpathcurveto{\pgfqpoint{0.652145in}{0.495887in}}{\pgfqpoint{0.654537in}{0.496878in}}{\pgfqpoint{0.656299in}{0.498641in}}% \pgfpathcurveto{\pgfqpoint{0.658062in}{0.500403in}}{\pgfqpoint{0.659052in}{0.502794in}}{\pgfqpoint{0.659052in}{0.505287in}}% \pgfpathcurveto{\pgfqpoint{0.659052in}{0.507780in}}{\pgfqpoint{0.658062in}{0.510171in}}{\pgfqpoint{0.656299in}{0.511934in}}% \pgfpathcurveto{\pgfqpoint{0.654537in}{0.513697in}}{\pgfqpoint{0.652145in}{0.514687in}}{\pgfqpoint{0.649653in}{0.514687in}}% \pgfpathcurveto{\pgfqpoint{0.647160in}{0.514687in}}{\pgfqpoint{0.644769in}{0.513697in}}{\pgfqpoint{0.643006in}{0.511934in}}% \pgfpathcurveto{\pgfqpoint{0.641243in}{0.510171in}}{\pgfqpoint{0.640253in}{0.507780in}}{\pgfqpoint{0.640253in}{0.505287in}}% \pgfpathcurveto{\pgfqpoint{0.640253in}{0.502794in}}{\pgfqpoint{0.641243in}{0.500403in}}{\pgfqpoint{0.643006in}{0.498641in}}% \pgfpathcurveto{\pgfqpoint{0.644769in}{0.496878in}}{\pgfqpoint{0.647160in}{0.495887in}}{\pgfqpoint{0.649653in}{0.495887in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{1.000000,0.498039,0.054902}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{1.000000,0.498039,0.054902}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.882649in}{1.024414in}}% \pgfpathcurveto{\pgfqpoint{0.885142in}{1.024414in}}{\pgfqpoint{0.887533in}{1.025404in}}{\pgfqpoint{0.889295in}{1.027167in}}% \pgfpathcurveto{\pgfqpoint{0.891058in}{1.028930in}}{\pgfqpoint{0.892049in}{1.031321in}}{\pgfqpoint{0.892049in}{1.033814in}}% \pgfpathcurveto{\pgfqpoint{0.892049in}{1.036307in}}{\pgfqpoint{0.891058in}{1.038698in}}{\pgfqpoint{0.889295in}{1.040460in}}% \pgfpathcurveto{\pgfqpoint{0.887533in}{1.042223in}}{\pgfqpoint{0.885142in}{1.043214in}}{\pgfqpoint{0.882649in}{1.043214in}}% \pgfpathcurveto{\pgfqpoint{0.880156in}{1.043214in}}{\pgfqpoint{0.877765in}{1.042223in}}{\pgfqpoint{0.876002in}{1.040460in}}% \pgfpathcurveto{\pgfqpoint{0.874239in}{1.038698in}}{\pgfqpoint{0.873249in}{1.036307in}}{\pgfqpoint{0.873249in}{1.033814in}}% \pgfpathcurveto{\pgfqpoint{0.873249in}{1.031321in}}{\pgfqpoint{0.874239in}{1.028930in}}{\pgfqpoint{0.876002in}{1.027167in}}% \pgfpathcurveto{\pgfqpoint{0.877765in}{1.025404in}}{\pgfqpoint{0.880156in}{1.024414in}}{\pgfqpoint{0.882649in}{1.024414in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{1.000000,0.498039,0.054902}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{1.000000,0.498039,0.054902}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.115645in}{1.187604in}}% \pgfpathcurveto{\pgfqpoint{1.118138in}{1.187604in}}{\pgfqpoint{1.120529in}{1.188595in}}{\pgfqpoint{1.122292in}{1.190357in}}% \pgfpathcurveto{\pgfqpoint{1.124054in}{1.192120in}}{\pgfqpoint{1.125045in}{1.194511in}}{\pgfqpoint{1.125045in}{1.197004in}}% \pgfpathcurveto{\pgfqpoint{1.125045in}{1.199497in}}{\pgfqpoint{1.124054in}{1.201888in}}{\pgfqpoint{1.122292in}{1.203651in}}% \pgfpathcurveto{\pgfqpoint{1.120529in}{1.205414in}}{\pgfqpoint{1.118138in}{1.206404in}}{\pgfqpoint{1.115645in}{1.206404in}}% \pgfpathcurveto{\pgfqpoint{1.113152in}{1.206404in}}{\pgfqpoint{1.110761in}{1.205414in}}{\pgfqpoint{1.108998in}{1.203651in}}% \pgfpathcurveto{\pgfqpoint{1.107236in}{1.201888in}}{\pgfqpoint{1.106245in}{1.199497in}}{\pgfqpoint{1.106245in}{1.197004in}}% \pgfpathcurveto{\pgfqpoint{1.106245in}{1.194511in}}{\pgfqpoint{1.107236in}{1.192120in}}{\pgfqpoint{1.108998in}{1.190357in}}% \pgfpathcurveto{\pgfqpoint{1.110761in}{1.188595in}}{\pgfqpoint{1.113152in}{1.187604in}}{\pgfqpoint{1.115645in}{1.187604in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{1.000000,0.498039,0.054902}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{1.000000,0.498039,0.054902}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.348641in}{1.287459in}}% \pgfpathcurveto{\pgfqpoint{1.351134in}{1.287459in}}{\pgfqpoint{1.353525in}{1.288450in}}{\pgfqpoint{1.355288in}{1.290212in}}% \pgfpathcurveto{\pgfqpoint{1.357051in}{1.291975in}}{\pgfqpoint{1.358041in}{1.294366in}}{\pgfqpoint{1.358041in}{1.296859in}}% \pgfpathcurveto{\pgfqpoint{1.358041in}{1.299352in}}{\pgfqpoint{1.357051in}{1.301743in}}{\pgfqpoint{1.355288in}{1.303506in}}% \pgfpathcurveto{\pgfqpoint{1.353525in}{1.305269in}}{\pgfqpoint{1.351134in}{1.306259in}}{\pgfqpoint{1.348641in}{1.306259in}}% \pgfpathcurveto{\pgfqpoint{1.346148in}{1.306259in}}{\pgfqpoint{1.343757in}{1.305269in}}{\pgfqpoint{1.341994in}{1.303506in}}% \pgfpathcurveto{\pgfqpoint{1.340232in}{1.301743in}}{\pgfqpoint{1.339241in}{1.299352in}}{\pgfqpoint{1.339241in}{1.296859in}}% \pgfpathcurveto{\pgfqpoint{1.339241in}{1.294366in}}{\pgfqpoint{1.340232in}{1.291975in}}{\pgfqpoint{1.341994in}{1.290212in}}% \pgfpathcurveto{\pgfqpoint{1.343757in}{1.288450in}}{\pgfqpoint{1.346148in}{1.287459in}}{\pgfqpoint{1.348641in}{1.287459in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{1.000000,0.498039,0.054902}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{1.000000,0.498039,0.054902}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.581637in}{1.350827in}}% \pgfpathcurveto{\pgfqpoint{1.584130in}{1.350827in}}{\pgfqpoint{1.586521in}{1.351817in}}{\pgfqpoint{1.588284in}{1.353580in}}% \pgfpathcurveto{\pgfqpoint{1.590047in}{1.355343in}}{\pgfqpoint{1.591037in}{1.357734in}}{\pgfqpoint{1.591037in}{1.360227in}}% \pgfpathcurveto{\pgfqpoint{1.591037in}{1.362719in}}{\pgfqpoint{1.590047in}{1.365110in}}{\pgfqpoint{1.588284in}{1.366873in}}% \pgfpathcurveto{\pgfqpoint{1.586521in}{1.368636in}}{\pgfqpoint{1.584130in}{1.369626in}}{\pgfqpoint{1.581637in}{1.369626in}}% \pgfpathcurveto{\pgfqpoint{1.579145in}{1.369626in}}{\pgfqpoint{1.576753in}{1.368636in}}{\pgfqpoint{1.574991in}{1.366873in}}% \pgfpathcurveto{\pgfqpoint{1.573228in}{1.365110in}}{\pgfqpoint{1.572238in}{1.362719in}}{\pgfqpoint{1.572238in}{1.360227in}}% \pgfpathcurveto{\pgfqpoint{1.572238in}{1.357734in}}{\pgfqpoint{1.573228in}{1.355343in}}{\pgfqpoint{1.574991in}{1.353580in}}% \pgfpathcurveto{\pgfqpoint{1.576753in}{1.351817in}}{\pgfqpoint{1.579145in}{1.350827in}}{\pgfqpoint{1.581637in}{1.350827in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{1.000000,0.498039,0.054902}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{1.000000,0.498039,0.054902}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.814634in}{1.392421in}}% \pgfpathcurveto{\pgfqpoint{1.817126in}{1.392421in}}{\pgfqpoint{1.819518in}{1.393412in}}{\pgfqpoint{1.821280in}{1.395174in}}% \pgfpathcurveto{\pgfqpoint{1.823043in}{1.396937in}}{\pgfqpoint{1.824033in}{1.399328in}}{\pgfqpoint{1.824033in}{1.401821in}}% \pgfpathcurveto{\pgfqpoint{1.824033in}{1.404314in}}{\pgfqpoint{1.823043in}{1.406705in}}{\pgfqpoint{1.821280in}{1.408468in}}% \pgfpathcurveto{\pgfqpoint{1.819518in}{1.410231in}}{\pgfqpoint{1.817126in}{1.411221in}}{\pgfqpoint{1.814634in}{1.411221in}}% \pgfpathcurveto{\pgfqpoint{1.812141in}{1.411221in}}{\pgfqpoint{1.809750in}{1.410231in}}{\pgfqpoint{1.807987in}{1.408468in}}% \pgfpathcurveto{\pgfqpoint{1.806224in}{1.406705in}}{\pgfqpoint{1.805234in}{1.404314in}}{\pgfqpoint{1.805234in}{1.401821in}}% \pgfpathcurveto{\pgfqpoint{1.805234in}{1.399328in}}{\pgfqpoint{1.806224in}{1.396937in}}{\pgfqpoint{1.807987in}{1.395174in}}% \pgfpathcurveto{\pgfqpoint{1.809750in}{1.393412in}}{\pgfqpoint{1.812141in}{1.392421in}}{\pgfqpoint{1.814634in}{1.392421in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{1.000000,0.498039,0.054902}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{1.000000,0.498039,0.054902}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.047630in}{1.414381in}}% \pgfpathcurveto{\pgfqpoint{2.050123in}{1.414381in}}{\pgfqpoint{2.052514in}{1.415371in}}{\pgfqpoint{2.054277in}{1.417134in}}% \pgfpathcurveto{\pgfqpoint{2.056039in}{1.418897in}}{\pgfqpoint{2.057030in}{1.421288in}}{\pgfqpoint{2.057030in}{1.423781in}}% \pgfpathcurveto{\pgfqpoint{2.057030in}{1.426274in}}{\pgfqpoint{2.056039in}{1.428665in}}{\pgfqpoint{2.054277in}{1.430428in}}% \pgfpathcurveto{\pgfqpoint{2.052514in}{1.432190in}}{\pgfqpoint{2.050123in}{1.433181in}}{\pgfqpoint{2.047630in}{1.433181in}}% \pgfpathcurveto{\pgfqpoint{2.045137in}{1.433181in}}{\pgfqpoint{2.042746in}{1.432190in}}{\pgfqpoint{2.040983in}{1.430428in}}% \pgfpathcurveto{\pgfqpoint{2.039220in}{1.428665in}}{\pgfqpoint{2.038230in}{1.426274in}}{\pgfqpoint{2.038230in}{1.423781in}}% \pgfpathcurveto{\pgfqpoint{2.038230in}{1.421288in}}{\pgfqpoint{2.039220in}{1.418897in}}{\pgfqpoint{2.040983in}{1.417134in}}% \pgfpathcurveto{\pgfqpoint{2.042746in}{1.415371in}}{\pgfqpoint{2.045137in}{1.414381in}}{\pgfqpoint{2.047630in}{1.414381in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{1.000000,0.498039,0.054902}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{1.000000,0.498039,0.054902}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.280626in}{1.433596in}}% \pgfpathcurveto{\pgfqpoint{2.283119in}{1.433596in}}{\pgfqpoint{2.285510in}{1.434586in}}{\pgfqpoint{2.287273in}{1.436349in}}% \pgfpathcurveto{\pgfqpoint{2.289035in}{1.438112in}}{\pgfqpoint{2.290026in}{1.440503in}}{\pgfqpoint{2.290026in}{1.442996in}}% \pgfpathcurveto{\pgfqpoint{2.290026in}{1.445488in}}{\pgfqpoint{2.289035in}{1.447880in}}{\pgfqpoint{2.287273in}{1.449642in}}% \pgfpathcurveto{\pgfqpoint{2.285510in}{1.451405in}}{\pgfqpoint{2.283119in}{1.452395in}}{\pgfqpoint{2.280626in}{1.452395in}}% \pgfpathcurveto{\pgfqpoint{2.278133in}{1.452395in}}{\pgfqpoint{2.275742in}{1.451405in}}{\pgfqpoint{2.273979in}{1.449642in}}% \pgfpathcurveto{\pgfqpoint{2.272217in}{1.447880in}}{\pgfqpoint{2.271226in}{1.445488in}}{\pgfqpoint{2.271226in}{1.442996in}}% \pgfpathcurveto{\pgfqpoint{2.271226in}{1.440503in}}{\pgfqpoint{2.272217in}{1.438112in}}{\pgfqpoint{2.273979in}{1.436349in}}% \pgfpathcurveto{\pgfqpoint{2.275742in}{1.434586in}}{\pgfqpoint{2.278133in}{1.433596in}}{\pgfqpoint{2.280626in}{1.433596in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{1.000000,0.498039,0.054902}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{1.000000,0.498039,0.054902}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.513622in}{1.433596in}}% \pgfpathcurveto{\pgfqpoint{2.516115in}{1.433596in}}{\pgfqpoint{2.518506in}{1.434586in}}{\pgfqpoint{2.520269in}{1.436349in}}% \pgfpathcurveto{\pgfqpoint{2.522032in}{1.438112in}}{\pgfqpoint{2.523022in}{1.440503in}}{\pgfqpoint{2.523022in}{1.442996in}}% \pgfpathcurveto{\pgfqpoint{2.523022in}{1.445488in}}{\pgfqpoint{2.522032in}{1.447880in}}{\pgfqpoint{2.520269in}{1.449642in}}% \pgfpathcurveto{\pgfqpoint{2.518506in}{1.451405in}}{\pgfqpoint{2.516115in}{1.452395in}}{\pgfqpoint{2.513622in}{1.452395in}}% \pgfpathcurveto{\pgfqpoint{2.511129in}{1.452395in}}{\pgfqpoint{2.508738in}{1.451405in}}{\pgfqpoint{2.506976in}{1.449642in}}% \pgfpathcurveto{\pgfqpoint{2.505213in}{1.447880in}}{\pgfqpoint{2.504222in}{1.445488in}}{\pgfqpoint{2.504222in}{1.442996in}}% \pgfpathcurveto{\pgfqpoint{2.504222in}{1.440503in}}{\pgfqpoint{2.505213in}{1.438112in}}{\pgfqpoint{2.506976in}{1.436349in}}% \pgfpathcurveto{\pgfqpoint{2.508738in}{1.434586in}}{\pgfqpoint{2.511129in}{1.433596in}}{\pgfqpoint{2.513622in}{1.433596in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{1.000000,0.498039,0.054902}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{1.000000,0.498039,0.054902}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.746618in}{1.433596in}}% \pgfpathcurveto{\pgfqpoint{2.749111in}{1.433596in}}{\pgfqpoint{2.751502in}{1.434586in}}{\pgfqpoint{2.753265in}{1.436349in}}% \pgfpathcurveto{\pgfqpoint{2.755028in}{1.438112in}}{\pgfqpoint{2.756018in}{1.440503in}}{\pgfqpoint{2.756018in}{1.442996in}}% \pgfpathcurveto{\pgfqpoint{2.756018in}{1.445488in}}{\pgfqpoint{2.755028in}{1.447880in}}{\pgfqpoint{2.753265in}{1.449642in}}% \pgfpathcurveto{\pgfqpoint{2.751502in}{1.451405in}}{\pgfqpoint{2.749111in}{1.452395in}}{\pgfqpoint{2.746618in}{1.452395in}}% \pgfpathcurveto{\pgfqpoint{2.744126in}{1.452395in}}{\pgfqpoint{2.741734in}{1.451405in}}{\pgfqpoint{2.739972in}{1.449642in}}% \pgfpathcurveto{\pgfqpoint{2.738209in}{1.447880in}}{\pgfqpoint{2.737219in}{1.445488in}}{\pgfqpoint{2.737219in}{1.442996in}}% \pgfpathcurveto{\pgfqpoint{2.737219in}{1.440503in}}{\pgfqpoint{2.738209in}{1.438112in}}{\pgfqpoint{2.739972in}{1.436349in}}% \pgfpathcurveto{\pgfqpoint{2.741734in}{1.434586in}}{\pgfqpoint{2.744126in}{1.433596in}}{\pgfqpoint{2.746618in}{1.433596in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{1.000000,0.498039,0.054902}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{1.000000,0.498039,0.054902}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.979615in}{1.433596in}}% \pgfpathcurveto{\pgfqpoint{2.982108in}{1.433596in}}{\pgfqpoint{2.984499in}{1.434586in}}{\pgfqpoint{2.986261in}{1.436349in}}% \pgfpathcurveto{\pgfqpoint{2.988024in}{1.438112in}}{\pgfqpoint{2.989015in}{1.440503in}}{\pgfqpoint{2.989015in}{1.442996in}}% \pgfpathcurveto{\pgfqpoint{2.989015in}{1.445488in}}{\pgfqpoint{2.988024in}{1.447880in}}{\pgfqpoint{2.986261in}{1.449642in}}% \pgfpathcurveto{\pgfqpoint{2.984499in}{1.451405in}}{\pgfqpoint{2.982108in}{1.452395in}}{\pgfqpoint{2.979615in}{1.452395in}}% \pgfpathcurveto{\pgfqpoint{2.977122in}{1.452395in}}{\pgfqpoint{2.974731in}{1.451405in}}{\pgfqpoint{2.972968in}{1.449642in}}% \pgfpathcurveto{\pgfqpoint{2.971205in}{1.447880in}}{\pgfqpoint{2.970215in}{1.445488in}}{\pgfqpoint{2.970215in}{1.442996in}}% \pgfpathcurveto{\pgfqpoint{2.970215in}{1.440503in}}{\pgfqpoint{2.971205in}{1.438112in}}{\pgfqpoint{2.972968in}{1.436349in}}% \pgfpathcurveto{\pgfqpoint{2.974731in}{1.434586in}}{\pgfqpoint{2.977122in}{1.433596in}}{\pgfqpoint{2.979615in}{1.433596in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{1.084050pt}% \definecolor{currentstroke}{rgb}{1.000000,0.498039,0.054902}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.649653in}{0.505287in}}% \pgfpathlineto{\pgfqpoint{0.882649in}{1.033814in}}% \pgfpathlineto{\pgfqpoint{1.115645in}{1.197004in}}% \pgfpathlineto{\pgfqpoint{1.348641in}{1.296859in}}% \pgfpathlineto{\pgfqpoint{1.581637in}{1.360227in}}% \pgfpathlineto{\pgfqpoint{1.814634in}{1.401821in}}% \pgfpathlineto{\pgfqpoint{2.047630in}{1.423781in}}% \pgfpathlineto{\pgfqpoint{2.280626in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.513622in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.746618in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.979615in}{1.442996in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{1.000000,0.498039,0.054902}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.649653in}{0.497645in}}% \pgfpathlineto{\pgfqpoint{0.649653in}{0.577419in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{1.000000,0.498039,0.054902}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.882649in}{1.016765in}}% \pgfpathlineto{\pgfqpoint{0.882649in}{1.033814in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{1.000000,0.498039,0.054902}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.115645in}{1.189658in}}% \pgfpathlineto{\pgfqpoint{1.115645in}{1.205099in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{1.000000,0.498039,0.054902}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.348641in}{1.296859in}}% \pgfpathlineto{\pgfqpoint{1.348641in}{1.302235in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{1.000000,0.498039,0.054902}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.581637in}{1.357749in}}% \pgfpathlineto{\pgfqpoint{1.581637in}{1.364307in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{1.000000,0.498039,0.054902}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.814634in}{1.398201in}}% \pgfpathlineto{\pgfqpoint{1.814634in}{1.402407in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{1.000000,0.498039,0.054902}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.047630in}{1.422536in}}% \pgfpathlineto{\pgfqpoint{2.047630in}{1.427441in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{1.000000,0.498039,0.054902}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.280626in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.280626in}{1.442996in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{1.000000,0.498039,0.054902}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.513622in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.513622in}{1.442996in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{1.000000,0.498039,0.054902}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.746618in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.746618in}{1.442996in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{1.000000,0.498039,0.054902}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.979615in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.979615in}{1.442996in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfsetrectcap% \pgfsetmiterjoin% \pgfsetlinewidth{1.003750pt}% \definecolor{currentstroke}{rgb}{0.800000,0.800000,0.800000}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.533154in}{0.420041in}}% \pgfpathlineto{\pgfqpoint{0.533154in}{1.442996in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfsetrectcap% \pgfsetmiterjoin% \pgfsetlinewidth{1.003750pt}% \definecolor{currentstroke}{rgb}{0.800000,0.800000,0.800000}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.533154in}{0.420041in}}% \pgfpathlineto{\pgfqpoint{3.096113in}{0.420041in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.172549,0.627451,0.172549}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.172549,0.627451,0.172549}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.630853in}{1.221149in}}% \pgfpathlineto{\pgfqpoint{0.668452in}{1.221149in}}% \pgfpathmoveto{\pgfqpoint{0.649653in}{1.202350in}}% \pgfpathlineto{\pgfqpoint{0.649653in}{1.239949in}}% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.172549,0.627451,0.172549}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.172549,0.627451,0.172549}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.863849in}{1.340700in}}% \pgfpathlineto{\pgfqpoint{0.901448in}{1.340700in}}% \pgfpathmoveto{\pgfqpoint{0.882649in}{1.321900in}}% \pgfpathlineto{\pgfqpoint{0.882649in}{1.359500in}}% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.172549,0.627451,0.172549}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.172549,0.627451,0.172549}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.096845in}{1.390084in}}% \pgfpathlineto{\pgfqpoint{1.134445in}{1.390084in}}% \pgfpathmoveto{\pgfqpoint{1.115645in}{1.371284in}}% \pgfpathlineto{\pgfqpoint{1.115645in}{1.408884in}}% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.172549,0.627451,0.172549}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.172549,0.627451,0.172549}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.329841in}{1.418304in}}% \pgfpathlineto{\pgfqpoint{1.367441in}{1.418304in}}% \pgfpathmoveto{\pgfqpoint{1.348641in}{1.399504in}}% \pgfpathlineto{\pgfqpoint{1.348641in}{1.437103in}}% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.172549,0.627451,0.172549}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.172549,0.627451,0.172549}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.562838in}{1.432431in}}% \pgfpathlineto{\pgfqpoint{1.600437in}{1.432431in}}% \pgfpathmoveto{\pgfqpoint{1.581637in}{1.413632in}}% \pgfpathlineto{\pgfqpoint{1.581637in}{1.451231in}}% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.172549,0.627451,0.172549}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.172549,0.627451,0.172549}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.795834in}{1.442081in}}% \pgfpathlineto{\pgfqpoint{1.833433in}{1.442081in}}% \pgfpathmoveto{\pgfqpoint{1.814634in}{1.423281in}}% \pgfpathlineto{\pgfqpoint{1.814634in}{1.460880in}}% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.172549,0.627451,0.172549}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.172549,0.627451,0.172549}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.028830in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.066430in}{1.442996in}}% \pgfpathmoveto{\pgfqpoint{2.047630in}{1.424196in}}% \pgfpathlineto{\pgfqpoint{2.047630in}{1.461795in}}% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.172549,0.627451,0.172549}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.172549,0.627451,0.172549}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.261826in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.299426in}{1.442996in}}% \pgfpathmoveto{\pgfqpoint{2.280626in}{1.424196in}}% \pgfpathlineto{\pgfqpoint{2.280626in}{1.461795in}}% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.172549,0.627451,0.172549}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.172549,0.627451,0.172549}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.494823in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.532422in}{1.442996in}}% \pgfpathmoveto{\pgfqpoint{2.513622in}{1.424196in}}% \pgfpathlineto{\pgfqpoint{2.513622in}{1.461795in}}% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.172549,0.627451,0.172549}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.172549,0.627451,0.172549}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.727819in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.765418in}{1.442996in}}% \pgfpathmoveto{\pgfqpoint{2.746618in}{1.424196in}}% \pgfpathlineto{\pgfqpoint{2.746618in}{1.461795in}}% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.172549,0.627451,0.172549}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.172549,0.627451,0.172549}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.960815in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.998414in}{1.442996in}}% \pgfpathmoveto{\pgfqpoint{2.979615in}{1.424196in}}% \pgfpathlineto{\pgfqpoint{2.979615in}{1.461795in}}% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{1.084050pt}% \definecolor{currentstroke}{rgb}{0.172549,0.627451,0.172549}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.649653in}{1.221149in}}% \pgfpathlineto{\pgfqpoint{0.882649in}{1.340700in}}% \pgfpathlineto{\pgfqpoint{1.115645in}{1.390084in}}% \pgfpathlineto{\pgfqpoint{1.348641in}{1.418304in}}% \pgfpathlineto{\pgfqpoint{1.581637in}{1.432431in}}% \pgfpathlineto{\pgfqpoint{1.814634in}{1.442081in}}% \pgfpathlineto{\pgfqpoint{2.047630in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.280626in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.513622in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.746618in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.979615in}{1.442996in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.172549,0.627451,0.172549}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.649653in}{1.187257in}}% \pgfpathlineto{\pgfqpoint{0.649653in}{1.238405in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.172549,0.627451,0.172549}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.882649in}{1.317331in}}% \pgfpathlineto{\pgfqpoint{0.882649in}{1.351282in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.172549,0.627451,0.172549}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.115645in}{1.381618in}}% \pgfpathlineto{\pgfqpoint{1.115645in}{1.397297in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.172549,0.627451,0.172549}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.348641in}{1.411249in}}% \pgfpathlineto{\pgfqpoint{1.348641in}{1.422536in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.172549,0.627451,0.172549}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.581637in}{1.425419in}}% \pgfpathlineto{\pgfqpoint{1.581637in}{1.438421in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.172549,0.627451,0.172549}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.814634in}{1.441167in}}% \pgfpathlineto{\pgfqpoint{1.814634in}{1.442996in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.172549,0.627451,0.172549}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.047630in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.047630in}{1.442996in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.172549,0.627451,0.172549}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.280626in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.280626in}{1.442996in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.172549,0.627451,0.172549}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.513622in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.513622in}{1.442996in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.172549,0.627451,0.172549}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.746618in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.746618in}{1.442996in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.172549,0.627451,0.172549}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.979615in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.979615in}{1.442996in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.839216,0.152941,0.156863}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.839216,0.152941,0.156863}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.630853in}{1.362819in}}% \pgfpathlineto{\pgfqpoint{0.668452in}{1.400418in}}% \pgfpathmoveto{\pgfqpoint{0.630853in}{1.400418in}}% \pgfpathlineto{\pgfqpoint{0.668452in}{1.362819in}}% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.839216,0.152941,0.156863}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.839216,0.152941,0.156863}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.863849in}{1.418058in}}% \pgfpathlineto{\pgfqpoint{0.901448in}{1.455658in}}% \pgfpathmoveto{\pgfqpoint{0.863849in}{1.455658in}}% \pgfpathlineto{\pgfqpoint{0.901448in}{1.418058in}}% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.839216,0.152941,0.156863}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.839216,0.152941,0.156863}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.096845in}{1.424196in}}% \pgfpathlineto{\pgfqpoint{1.134445in}{1.461795in}}% \pgfpathmoveto{\pgfqpoint{1.096845in}{1.461795in}}% \pgfpathlineto{\pgfqpoint{1.134445in}{1.424196in}}% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.839216,0.152941,0.156863}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.839216,0.152941,0.156863}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.329841in}{1.424196in}}% \pgfpathlineto{\pgfqpoint{1.367441in}{1.461795in}}% \pgfpathmoveto{\pgfqpoint{1.329841in}{1.461795in}}% \pgfpathlineto{\pgfqpoint{1.367441in}{1.424196in}}% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.839216,0.152941,0.156863}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.839216,0.152941,0.156863}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.562838in}{1.424196in}}% \pgfpathlineto{\pgfqpoint{1.600437in}{1.461795in}}% \pgfpathmoveto{\pgfqpoint{1.562838in}{1.461795in}}% \pgfpathlineto{\pgfqpoint{1.600437in}{1.424196in}}% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.839216,0.152941,0.156863}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.839216,0.152941,0.156863}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.795834in}{1.424196in}}% \pgfpathlineto{\pgfqpoint{1.833433in}{1.461795in}}% \pgfpathmoveto{\pgfqpoint{1.795834in}{1.461795in}}% \pgfpathlineto{\pgfqpoint{1.833433in}{1.424196in}}% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.839216,0.152941,0.156863}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.839216,0.152941,0.156863}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.028830in}{1.424196in}}% \pgfpathlineto{\pgfqpoint{2.066430in}{1.461795in}}% \pgfpathmoveto{\pgfqpoint{2.028830in}{1.461795in}}% \pgfpathlineto{\pgfqpoint{2.066430in}{1.424196in}}% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.839216,0.152941,0.156863}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.839216,0.152941,0.156863}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.261826in}{1.424196in}}% \pgfpathlineto{\pgfqpoint{2.299426in}{1.461795in}}% \pgfpathmoveto{\pgfqpoint{2.261826in}{1.461795in}}% \pgfpathlineto{\pgfqpoint{2.299426in}{1.424196in}}% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.839216,0.152941,0.156863}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.839216,0.152941,0.156863}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.494823in}{1.424196in}}% \pgfpathlineto{\pgfqpoint{2.532422in}{1.461795in}}% \pgfpathmoveto{\pgfqpoint{2.494823in}{1.461795in}}% \pgfpathlineto{\pgfqpoint{2.532422in}{1.424196in}}% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.839216,0.152941,0.156863}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.839216,0.152941,0.156863}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.727819in}{1.424196in}}% \pgfpathlineto{\pgfqpoint{2.765418in}{1.461795in}}% \pgfpathmoveto{\pgfqpoint{2.727819in}{1.461795in}}% \pgfpathlineto{\pgfqpoint{2.765418in}{1.424196in}}% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.839216,0.152941,0.156863}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.839216,0.152941,0.156863}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.960815in}{1.424196in}}% \pgfpathlineto{\pgfqpoint{2.998414in}{1.461795in}}% \pgfpathmoveto{\pgfqpoint{2.960815in}{1.461795in}}% \pgfpathlineto{\pgfqpoint{2.998414in}{1.424196in}}% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{1.084050pt}% \definecolor{currentstroke}{rgb}{0.839216,0.152941,0.156863}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.649653in}{1.381618in}}% \pgfpathlineto{\pgfqpoint{0.882649in}{1.436858in}}% \pgfpathlineto{\pgfqpoint{1.115645in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{1.348641in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{1.581637in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{1.814634in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.047630in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.280626in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.513622in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.746618in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.979615in}{1.442996in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.839216,0.152941,0.156863}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.649653in}{1.374445in}}% \pgfpathlineto{\pgfqpoint{0.649653in}{1.385351in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.839216,0.152941,0.156863}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.882649in}{1.432413in}}% \pgfpathlineto{\pgfqpoint{0.882649in}{1.439927in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.839216,0.152941,0.156863}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.115645in}{1.441973in}}% \pgfpathlineto{\pgfqpoint{1.115645in}{1.442996in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.839216,0.152941,0.156863}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.348641in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{1.348641in}{1.442996in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.839216,0.152941,0.156863}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.581637in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{1.581637in}{1.442996in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.839216,0.152941,0.156863}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.814634in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{1.814634in}{1.442996in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.839216,0.152941,0.156863}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.047630in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.047630in}{1.442996in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.839216,0.152941,0.156863}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.280626in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.280626in}{1.442996in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.839216,0.152941,0.156863}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.513622in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.513622in}{1.442996in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.839216,0.152941,0.156863}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.746618in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.746618in}{1.442996in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.839216,0.152941,0.156863}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.979615in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.979615in}{1.442996in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.580392,0.403922,0.741176}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.580392,0.403922,0.741176}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.649653in}{0.488055in}}% \pgfpathlineto{\pgfqpoint{0.645432in}{0.475065in}}% \pgfpathlineto{\pgfqpoint{0.631773in}{0.475065in}}% \pgfpathlineto{\pgfqpoint{0.642823in}{0.467036in}}% \pgfpathlineto{\pgfqpoint{0.638602in}{0.454046in}}% \pgfpathlineto{\pgfqpoint{0.649653in}{0.462075in}}% \pgfpathlineto{\pgfqpoint{0.660703in}{0.454046in}}% \pgfpathlineto{\pgfqpoint{0.656482in}{0.467036in}}% \pgfpathlineto{\pgfqpoint{0.667532in}{0.475065in}}% \pgfpathlineto{\pgfqpoint{0.653873in}{0.475065in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.580392,0.403922,0.741176}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.580392,0.403922,0.741176}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.882649in}{0.728090in}}% \pgfpathlineto{\pgfqpoint{0.878428in}{0.715100in}}% \pgfpathlineto{\pgfqpoint{0.864769in}{0.715100in}}% \pgfpathlineto{\pgfqpoint{0.875819in}{0.707071in}}% \pgfpathlineto{\pgfqpoint{0.871599in}{0.694081in}}% \pgfpathlineto{\pgfqpoint{0.882649in}{0.702109in}}% \pgfpathlineto{\pgfqpoint{0.893699in}{0.694081in}}% \pgfpathlineto{\pgfqpoint{0.889478in}{0.707071in}}% \pgfpathlineto{\pgfqpoint{0.900528in}{0.715100in}}% \pgfpathlineto{\pgfqpoint{0.886870in}{0.715100in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.580392,0.403922,0.741176}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.580392,0.403922,0.741176}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.115645in}{0.865072in}}% \pgfpathlineto{\pgfqpoint{1.111424in}{0.852082in}}% \pgfpathlineto{\pgfqpoint{1.097765in}{0.852082in}}% \pgfpathlineto{\pgfqpoint{1.108816in}{0.844053in}}% \pgfpathlineto{\pgfqpoint{1.104595in}{0.831063in}}% \pgfpathlineto{\pgfqpoint{1.115645in}{0.839091in}}% \pgfpathlineto{\pgfqpoint{1.126695in}{0.831063in}}% \pgfpathlineto{\pgfqpoint{1.122474in}{0.844053in}}% \pgfpathlineto{\pgfqpoint{1.133525in}{0.852082in}}% \pgfpathlineto{\pgfqpoint{1.119866in}{0.852082in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.580392,0.403922,0.741176}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.580392,0.403922,0.741176}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.348641in}{0.950318in}}% \pgfpathlineto{\pgfqpoint{1.344420in}{0.937328in}}% \pgfpathlineto{\pgfqpoint{1.330762in}{0.937328in}}% \pgfpathlineto{\pgfqpoint{1.341812in}{0.929299in}}% \pgfpathlineto{\pgfqpoint{1.337591in}{0.916309in}}% \pgfpathlineto{\pgfqpoint{1.348641in}{0.924337in}}% \pgfpathlineto{\pgfqpoint{1.359691in}{0.916309in}}% \pgfpathlineto{\pgfqpoint{1.355471in}{0.929299in}}% \pgfpathlineto{\pgfqpoint{1.366521in}{0.937328in}}% \pgfpathlineto{\pgfqpoint{1.352862in}{0.937328in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.580392,0.403922,0.741176}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.580392,0.403922,0.741176}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.581637in}{1.042031in}}% \pgfpathlineto{\pgfqpoint{1.577417in}{1.029041in}}% \pgfpathlineto{\pgfqpoint{1.563758in}{1.029041in}}% \pgfpathlineto{\pgfqpoint{1.574808in}{1.021012in}}% \pgfpathlineto{\pgfqpoint{1.570587in}{1.008022in}}% \pgfpathlineto{\pgfqpoint{1.581637in}{1.016051in}}% \pgfpathlineto{\pgfqpoint{1.592688in}{1.008022in}}% \pgfpathlineto{\pgfqpoint{1.588467in}{1.021012in}}% \pgfpathlineto{\pgfqpoint{1.599517in}{1.029041in}}% \pgfpathlineto{\pgfqpoint{1.585858in}{1.029041in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.580392,0.403922,0.741176}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.580392,0.403922,0.741176}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.814634in}{1.089173in}}% \pgfpathlineto{\pgfqpoint{1.810413in}{1.076182in}}% \pgfpathlineto{\pgfqpoint{1.796754in}{1.076182in}}% \pgfpathlineto{\pgfqpoint{1.807804in}{1.068154in}}% \pgfpathlineto{\pgfqpoint{1.803583in}{1.055164in}}% \pgfpathlineto{\pgfqpoint{1.814634in}{1.063192in}}% \pgfpathlineto{\pgfqpoint{1.825684in}{1.055164in}}% \pgfpathlineto{\pgfqpoint{1.821463in}{1.068154in}}% \pgfpathlineto{\pgfqpoint{1.832513in}{1.076182in}}% \pgfpathlineto{\pgfqpoint{1.818854in}{1.076182in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.580392,0.403922,0.741176}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.580392,0.403922,0.741176}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.047630in}{1.132550in}}% \pgfpathlineto{\pgfqpoint{2.043409in}{1.119560in}}% \pgfpathlineto{\pgfqpoint{2.029750in}{1.119560in}}% \pgfpathlineto{\pgfqpoint{2.040800in}{1.111532in}}% \pgfpathlineto{\pgfqpoint{2.036580in}{1.098541in}}% \pgfpathlineto{\pgfqpoint{2.047630in}{1.106570in}}% \pgfpathlineto{\pgfqpoint{2.058680in}{1.098541in}}% \pgfpathlineto{\pgfqpoint{2.054459in}{1.111532in}}% \pgfpathlineto{\pgfqpoint{2.065509in}{1.119560in}}% \pgfpathlineto{\pgfqpoint{2.051851in}{1.119560in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.580392,0.403922,0.741176}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.580392,0.403922,0.741176}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.280626in}{1.204293in}}% \pgfpathlineto{\pgfqpoint{2.276405in}{1.191303in}}% \pgfpathlineto{\pgfqpoint{2.262746in}{1.191303in}}% \pgfpathlineto{\pgfqpoint{2.273797in}{1.183274in}}% \pgfpathlineto{\pgfqpoint{2.269576in}{1.170284in}}% \pgfpathlineto{\pgfqpoint{2.280626in}{1.178312in}}% \pgfpathlineto{\pgfqpoint{2.291676in}{1.170284in}}% \pgfpathlineto{\pgfqpoint{2.287455in}{1.183274in}}% \pgfpathlineto{\pgfqpoint{2.298506in}{1.191303in}}% \pgfpathlineto{\pgfqpoint{2.284847in}{1.191303in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.580392,0.403922,0.741176}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.580392,0.403922,0.741176}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.513622in}{1.257204in}}% \pgfpathlineto{\pgfqpoint{2.509401in}{1.244214in}}% \pgfpathlineto{\pgfqpoint{2.495743in}{1.244214in}}% \pgfpathlineto{\pgfqpoint{2.506793in}{1.236186in}}% \pgfpathlineto{\pgfqpoint{2.502572in}{1.223195in}}% \pgfpathlineto{\pgfqpoint{2.513622in}{1.231224in}}% \pgfpathlineto{\pgfqpoint{2.524672in}{1.223195in}}% \pgfpathlineto{\pgfqpoint{2.520452in}{1.236186in}}% \pgfpathlineto{\pgfqpoint{2.531502in}{1.244214in}}% \pgfpathlineto{\pgfqpoint{2.517843in}{1.244214in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.580392,0.403922,0.741176}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.580392,0.403922,0.741176}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.746618in}{1.291303in}}% \pgfpathlineto{\pgfqpoint{2.742398in}{1.278313in}}% \pgfpathlineto{\pgfqpoint{2.728739in}{1.278313in}}% \pgfpathlineto{\pgfqpoint{2.739789in}{1.270284in}}% \pgfpathlineto{\pgfqpoint{2.735568in}{1.257294in}}% \pgfpathlineto{\pgfqpoint{2.746618in}{1.265322in}}% \pgfpathlineto{\pgfqpoint{2.757669in}{1.257294in}}% \pgfpathlineto{\pgfqpoint{2.753448in}{1.270284in}}% \pgfpathlineto{\pgfqpoint{2.764498in}{1.278313in}}% \pgfpathlineto{\pgfqpoint{2.750839in}{1.278313in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.580392,0.403922,0.741176}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.580392,0.403922,0.741176}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.979615in}{1.459050in}}% \pgfpathlineto{\pgfqpoint{2.975394in}{1.446060in}}% \pgfpathlineto{\pgfqpoint{2.961735in}{1.446060in}}% \pgfpathlineto{\pgfqpoint{2.972785in}{1.438032in}}% \pgfpathlineto{\pgfqpoint{2.968564in}{1.425041in}}% \pgfpathlineto{\pgfqpoint{2.979615in}{1.433070in}}% \pgfpathlineto{\pgfqpoint{2.990665in}{1.425041in}}% \pgfpathlineto{\pgfqpoint{2.986444in}{1.438032in}}% \pgfpathlineto{\pgfqpoint{2.997494in}{1.446060in}}% \pgfpathlineto{\pgfqpoint{2.983835in}{1.446060in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{1.084050pt}% \definecolor{currentstroke}{rgb}{0.580392,0.403922,0.741176}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.649653in}{0.469255in}}% \pgfpathlineto{\pgfqpoint{0.882649in}{0.709290in}}% \pgfpathlineto{\pgfqpoint{1.115645in}{0.846272in}}% \pgfpathlineto{\pgfqpoint{1.348641in}{0.931518in}}% \pgfpathlineto{\pgfqpoint{1.581637in}{1.023231in}}% \pgfpathlineto{\pgfqpoint{1.814634in}{1.070373in}}% \pgfpathlineto{\pgfqpoint{2.047630in}{1.113751in}}% \pgfpathlineto{\pgfqpoint{2.280626in}{1.185493in}}% \pgfpathlineto{\pgfqpoint{2.513622in}{1.238405in}}% \pgfpathlineto{\pgfqpoint{2.746618in}{1.272503in}}% \pgfpathlineto{\pgfqpoint{2.979615in}{1.440251in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.580392,0.403922,0.741176}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.649653in}{0.458843in}}% \pgfpathlineto{\pgfqpoint{0.649653in}{0.498730in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.580392,0.403922,0.741176}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.882649in}{0.680622in}}% \pgfpathlineto{\pgfqpoint{0.882649in}{0.747387in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.580392,0.403922,0.741176}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.115645in}{0.829223in}}% \pgfpathlineto{\pgfqpoint{1.115645in}{0.868288in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.580392,0.403922,0.741176}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.348641in}{0.920936in}}% \pgfpathlineto{\pgfqpoint{1.348641in}{0.955289in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.580392,0.403922,0.741176}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.581637in}{1.012649in}}% \pgfpathlineto{\pgfqpoint{1.581637in}{1.033814in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.580392,0.403922,0.741176}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.814634in}{1.054273in}}% \pgfpathlineto{\pgfqpoint{1.814634in}{1.090253in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.580392,0.403922,0.741176}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.047630in}{1.102011in}}% \pgfpathlineto{\pgfqpoint{2.047630in}{1.123103in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.580392,0.403922,0.741176}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.280626in}{1.156568in}}% \pgfpathlineto{\pgfqpoint{2.280626in}{1.187257in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.580392,0.403922,0.741176}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.513622in}{1.197486in}}% \pgfpathlineto{\pgfqpoint{2.513622in}{1.255768in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.580392,0.403922,0.741176}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.746618in}{1.256306in}}% \pgfpathlineto{\pgfqpoint{2.746618in}{1.272503in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.580392,0.403922,0.741176}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.979615in}{1.439336in}}% \pgfpathlineto{\pgfqpoint{2.979615in}{1.441167in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfsetbuttcap% \pgfsetmiterjoin% \definecolor{currentfill}{rgb}{1.000000,1.000000,1.000000}% \pgfsetfillcolor{currentfill}% \pgfsetfillopacity{0.800000}% \pgfsetlinewidth{0.803000pt}% \definecolor{currentstroke}{rgb}{0.800000,0.800000,0.800000}% \pgfsetstrokecolor{currentstroke}% \pgfsetstrokeopacity{0.800000}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.956634in}{0.481152in}}% \pgfpathlineto{\pgfqpoint{3.010557in}{0.481152in}}% \pgfpathquadraticcurveto{\pgfqpoint{3.035002in}{0.481152in}}{\pgfqpoint{3.035002in}{0.505597in}}% \pgfpathlineto{\pgfqpoint{3.035002in}{0.815497in}}% \pgfpathquadraticcurveto{\pgfqpoint{3.035002in}{0.839941in}}{\pgfqpoint{3.010557in}{0.839941in}}% \pgfpathlineto{\pgfqpoint{0.956634in}{0.839941in}}% \pgfpathquadraticcurveto{\pgfqpoint{0.932190in}{0.839941in}}{\pgfqpoint{0.932190in}{0.815497in}}% \pgfpathlineto{\pgfqpoint{0.932190in}{0.505597in}}% \pgfpathquadraticcurveto{\pgfqpoint{0.932190in}{0.481152in}}{\pgfqpoint{0.956634in}{0.481152in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.121569,0.466667,0.705882}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.121569,0.466667,0.705882}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.103301in}{0.703688in}}% \pgfpathlineto{\pgfqpoint{1.119253in}{0.730275in}}% \pgfpathlineto{\pgfqpoint{1.103301in}{0.756862in}}% \pgfpathlineto{\pgfqpoint{1.087349in}{0.730275in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \definecolor{textcolor}{rgb}{0.150000,0.150000,0.150000}% \pgfsetstrokecolor{textcolor}% \pgfsetfillcolor{textcolor}% \pgftext[x=1.323301in,y=0.698192in,left,base]{\color{textcolor}\rmfamily\fontsize{8.800000}{10.560000}\selectfont LR}% \end{pgfscope}% \begin{pgfscope}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{1.000000,0.498039,0.054902}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{1.000000,0.498039,0.054902}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.103301in}{0.578148in}}% \pgfpathcurveto{\pgfqpoint{1.105794in}{0.578148in}}{\pgfqpoint{1.108185in}{0.579138in}}{\pgfqpoint{1.109948in}{0.580901in}}% \pgfpathcurveto{\pgfqpoint{1.111710in}{0.582664in}}{\pgfqpoint{1.112701in}{0.585055in}}{\pgfqpoint{1.112701in}{0.587548in}}% \pgfpathcurveto{\pgfqpoint{1.112701in}{0.590040in}}{\pgfqpoint{1.111710in}{0.592431in}}{\pgfqpoint{1.109948in}{0.594194in}}% \pgfpathcurveto{\pgfqpoint{1.108185in}{0.595957in}}{\pgfqpoint{1.105794in}{0.596947in}}{\pgfqpoint{1.103301in}{0.596947in}}% \pgfpathcurveto{\pgfqpoint{1.100808in}{0.596947in}}{\pgfqpoint{1.098417in}{0.595957in}}{\pgfqpoint{1.096654in}{0.594194in}}% \pgfpathcurveto{\pgfqpoint{1.094892in}{0.592431in}}{\pgfqpoint{1.093901in}{0.590040in}}{\pgfqpoint{1.093901in}{0.587548in}}% \pgfpathcurveto{\pgfqpoint{1.093901in}{0.585055in}}{\pgfqpoint{1.094892in}{0.582664in}}{\pgfqpoint{1.096654in}{0.580901in}}% \pgfpathcurveto{\pgfqpoint{1.098417in}{0.579138in}}{\pgfqpoint{1.100808in}{0.578148in}}{\pgfqpoint{1.103301in}{0.578148in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \definecolor{textcolor}{rgb}{0.150000,0.150000,0.150000}% \pgfsetstrokecolor{textcolor}% \pgfsetfillcolor{textcolor}% \pgftext[x=1.323301in,y=0.555464in,left,base]{\color{textcolor}\rmfamily\fontsize{8.800000}{10.560000}\selectfont GTB\(\displaystyle _s\)}% \end{pgfscope}% \begin{pgfscope}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.172549,0.627451,0.172549}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.172549,0.627451,0.172549}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.763570in}{0.730275in}}% \pgfpathlineto{\pgfqpoint{1.801170in}{0.730275in}}% \pgfpathmoveto{\pgfqpoint{1.782370in}{0.711476in}}% \pgfpathlineto{\pgfqpoint{1.782370in}{0.749075in}}% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \definecolor{textcolor}{rgb}{0.150000,0.150000,0.150000}% \pgfsetstrokecolor{textcolor}% \pgfsetfillcolor{textcolor}% \pgftext[x=2.002370in,y=0.698192in,left,base]{\color{textcolor}\rmfamily\fontsize{8.800000}{10.560000}\selectfont GTB\(\displaystyle _a\)}% \end{pgfscope}% \begin{pgfscope}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.839216,0.152941,0.156863}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.839216,0.152941,0.156863}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.763570in}{0.568748in}}% \pgfpathlineto{\pgfqpoint{1.801170in}{0.606347in}}% \pgfpathmoveto{\pgfqpoint{1.763570in}{0.606347in}}% \pgfpathlineto{\pgfqpoint{1.801170in}{0.568748in}}% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \definecolor{textcolor}{rgb}{0.150000,0.150000,0.150000}% \pgfsetstrokecolor{textcolor}% \pgfsetfillcolor{textcolor}% \pgftext[x=2.002370in,y=0.555464in,left,base]{\color{textcolor}\rmfamily\fontsize{8.800000}{10.560000}\selectfont NN\(\displaystyle _a\)}% \end{pgfscope}% \begin{pgfscope}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.580392,0.403922,0.741176}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.580392,0.403922,0.741176}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.468972in}{0.749075in}}% \pgfpathlineto{\pgfqpoint{2.464751in}{0.736085in}}% \pgfpathlineto{\pgfqpoint{2.451092in}{0.736085in}}% \pgfpathlineto{\pgfqpoint{2.462142in}{0.728056in}}% \pgfpathlineto{\pgfqpoint{2.457922in}{0.715066in}}% \pgfpathlineto{\pgfqpoint{2.468972in}{0.723094in}}% \pgfpathlineto{\pgfqpoint{2.480022in}{0.715066in}}% \pgfpathlineto{\pgfqpoint{2.475801in}{0.728056in}}% \pgfpathlineto{\pgfqpoint{2.486851in}{0.736085in}}% \pgfpathlineto{\pgfqpoint{2.473193in}{0.736085in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \definecolor{textcolor}{rgb}{0.150000,0.150000,0.150000}% \pgfsetstrokecolor{textcolor}% \pgfsetfillcolor{textcolor}% \pgftext[x=2.688972in,y=0.698192in,left,base]{\color{textcolor}\rmfamily\fontsize{8.800000}{10.560000}\selectfont SVM}% \end{pgfscope}% \begin{pgfscope}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.549020,0.337255,0.294118}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.549020,0.337255,0.294118}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.468972in}{0.568748in}}% \pgfpathlineto{\pgfqpoint{2.487772in}{0.606347in}}% \pgfpathlineto{\pgfqpoint{2.450172in}{0.606347in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \definecolor{textcolor}{rgb}{0.150000,0.150000,0.150000}% \pgfsetstrokecolor{textcolor}% \pgfsetfillcolor{textcolor}% \pgftext[x=2.688972in,y=0.555464in,left,base]{\color{textcolor}\rmfamily\fontsize{8.800000}{10.560000}\selectfont NN\(\displaystyle _s\)}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.549020,0.337255,0.294118}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.549020,0.337255,0.294118}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.649653in}{0.605832in}}% \pgfpathlineto{\pgfqpoint{0.668452in}{0.643432in}}% \pgfpathlineto{\pgfqpoint{0.630853in}{0.643432in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.549020,0.337255,0.294118}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.549020,0.337255,0.294118}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.882649in}{1.015014in}}% \pgfpathlineto{\pgfqpoint{0.901448in}{1.052613in}}% \pgfpathlineto{\pgfqpoint{0.863849in}{1.052613in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.549020,0.337255,0.294118}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.549020,0.337255,0.294118}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.115645in}{1.199181in}}% \pgfpathlineto{\pgfqpoint{1.134445in}{1.236780in}}% \pgfpathlineto{\pgfqpoint{1.096845in}{1.236780in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.549020,0.337255,0.294118}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.549020,0.337255,0.294118}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.348641in}{1.283193in}}% \pgfpathlineto{\pgfqpoint{1.367441in}{1.320793in}}% \pgfpathlineto{\pgfqpoint{1.329841in}{1.320793in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.549020,0.337255,0.294118}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.549020,0.337255,0.294118}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.581637in}{1.342359in}}% \pgfpathlineto{\pgfqpoint{1.600437in}{1.379959in}}% \pgfpathlineto{\pgfqpoint{1.562838in}{1.379959in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.549020,0.337255,0.294118}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.549020,0.337255,0.294118}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.814634in}{1.378497in}}% \pgfpathlineto{\pgfqpoint{1.833433in}{1.416096in}}% \pgfpathlineto{\pgfqpoint{1.795834in}{1.416096in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.549020,0.337255,0.294118}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.549020,0.337255,0.294118}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.047630in}{1.403737in}}% \pgfpathlineto{\pgfqpoint{2.066430in}{1.441336in}}% \pgfpathlineto{\pgfqpoint{2.028830in}{1.441336in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.549020,0.337255,0.294118}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.549020,0.337255,0.294118}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.280626in}{1.422366in}}% \pgfpathlineto{\pgfqpoint{2.299426in}{1.459965in}}% \pgfpathlineto{\pgfqpoint{2.261826in}{1.459965in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.549020,0.337255,0.294118}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.549020,0.337255,0.294118}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.513622in}{1.424196in}}% \pgfpathlineto{\pgfqpoint{2.532422in}{1.461795in}}% \pgfpathlineto{\pgfqpoint{2.494823in}{1.461795in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.549020,0.337255,0.294118}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.549020,0.337255,0.294118}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.746618in}{1.424196in}}% \pgfpathlineto{\pgfqpoint{2.765418in}{1.461795in}}% \pgfpathlineto{\pgfqpoint{2.727819in}{1.461795in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetbuttcap% \pgfsetroundjoin% \definecolor{currentfill}{rgb}{0.549020,0.337255,0.294118}% \pgfsetfillcolor{currentfill}% \pgfsetlinewidth{0.813038pt}% \definecolor{currentstroke}{rgb}{0.549020,0.337255,0.294118}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.979615in}{1.424196in}}% \pgfpathlineto{\pgfqpoint{2.998414in}{1.461795in}}% \pgfpathlineto{\pgfqpoint{2.960815in}{1.461795in}}% \pgfpathclose% \pgfusepath{stroke,fill}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{1.084050pt}% \definecolor{currentstroke}{rgb}{0.549020,0.337255,0.294118}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.649653in}{0.624632in}}% \pgfpathlineto{\pgfqpoint{0.882649in}{1.033814in}}% \pgfpathlineto{\pgfqpoint{1.115645in}{1.217981in}}% \pgfpathlineto{\pgfqpoint{1.348641in}{1.301993in}}% \pgfpathlineto{\pgfqpoint{1.581637in}{1.361159in}}% \pgfpathlineto{\pgfqpoint{1.814634in}{1.397297in}}% \pgfpathlineto{\pgfqpoint{2.047630in}{1.422536in}}% \pgfpathlineto{\pgfqpoint{2.280626in}{1.441166in}}% \pgfpathlineto{\pgfqpoint{2.513622in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.746618in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.979615in}{1.442996in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.549020,0.337255,0.294118}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.649653in}{0.616294in}}% \pgfpathlineto{\pgfqpoint{0.649653in}{0.655087in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.549020,0.337255,0.294118}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{0.882649in}{1.031893in}}% \pgfpathlineto{\pgfqpoint{0.882649in}{1.048813in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.549020,0.337255,0.294118}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.115645in}{1.206014in}}% \pgfpathlineto{\pgfqpoint{1.115645in}{1.237764in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.549020,0.337255,0.294118}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.348641in}{1.295814in}}% \pgfpathlineto{\pgfqpoint{1.348641in}{1.309925in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.549020,0.337255,0.294118}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.581637in}{1.357749in}}% \pgfpathlineto{\pgfqpoint{1.581637in}{1.364307in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.549020,0.337255,0.294118}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{1.814634in}{1.391292in}}% \pgfpathlineto{\pgfqpoint{1.814634in}{1.402077in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.549020,0.337255,0.294118}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.047630in}{1.418291in}}% \pgfpathlineto{\pgfqpoint{2.047630in}{1.424696in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.549020,0.337255,0.294118}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.280626in}{1.439336in}}% \pgfpathlineto{\pgfqpoint{2.280626in}{1.442996in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.549020,0.337255,0.294118}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.513622in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.513622in}{1.442996in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.549020,0.337255,0.294118}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.746618in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.746618in}{1.442996in}}% \pgfusepath{stroke}% \end{pgfscope}% \begin{pgfscope}% \pgfpathrectangle{\pgfqpoint{0.533154in}{0.420041in}}{\pgfqpoint{2.562958in}{1.022954in}}% \pgfusepath{clip}% \pgfsetroundcap% \pgfsetroundjoin% \pgfsetlinewidth{2.168100pt}% \definecolor{currentstroke}{rgb}{0.549020,0.337255,0.294118}% \pgfsetstrokecolor{currentstroke}% \pgfsetdash{}{0pt}% \pgfpathmoveto{\pgfqpoint{2.979615in}{1.442996in}}% \pgfpathlineto{\pgfqpoint{2.979615in}{1.442996in}}% \pgfusepath{stroke}% \end{pgfscope}% \end{pgfpicture}% \makeatother% \endgroup% \caption{Admissible estimations in relation to adjustment factor $\lambda$. Label shift increases admissible estimations for both symmetric and asymmetric models. } \label{fig:labelshift} \end{figure} The results confirm that choosing \(\lambda\) is a trade-off, where a larger value increases admissible estimations, but reduces pruning. Furthermore, the difference between symmetric and asymmetric loss is visible. Without label shift, the symmetric models have close to 50\% admissible estimations, which is expected as the symmetric error is equally distributed between inadmissible underestimations and admissible overestimations. The asymmetric models achieve \(88/92\%\) (\ensuremath{\text{GTB}_{a}}\xspace/\ensuremath{\text{NN}_{a}}\xspace) admissible estimations without label shift, but with an increased \(\lambda\) the performance further improves. For \ensuremath{\text{GTB}_{s}}\xspace and \ensuremath{\text{NN}_{s}}\xspace, the largest ratio of domain pruning is achieved with an adjustment factors of 0.4 and 0.3, whereas for the asymmetric versions \(\lambda = 0.2\) is the best value. The best adjustment for the linear model is 0.6, and 0.4 for SVM. The asymmetric estimators already overestimate the actual objective value and therefore only need a small \(\lambda\). In conclusion, applying label shift is beneficial to increase the number of admissible estimations and to control the effectiveness of boundary estimation. When choosing \(\lambda\) for a different setting, a reasonable value is \(\lambda \in [0.1, 0.5]\), it is therefore recommendable to start with a low \(\lambda\) and increase only, if the number of admissible estimations is insufficient. \subsection{Estimation Performance} We analyze here the capability of each model to estimate tight domain boundaries, as compared to the original domains of the COP. As evaluation metrics, the size of the estimated domain is compared to the original domain size. Furthermore, the distance between cutting boundary and optimal objective value is compared between the estimated and original domain. A closer gap between cutting bound and objective value leads to a relatively better first solution when using the estimations and is therefore of practical interest. Table \ref{tab:prediction} shows the estimation performance per problem and estimator. The results show that asymmetric models are able to estimate closer boundaries than symmetric models. For each model, the estimation performance is consistent over all problems. \begin{table}[th] \centering \small \caption{Reduction in objective domain through estimated boundaries (in \%). \emph{Gap}: Domain size between cutting boundary and optimum ($(1 - (|\ensuremath{\hat{\ub{\z}}}\xspace - \ensuremath{\z_{opt}}\xspace|/|\ub{\ensuremath{\mathbf{z}}\xspace} - \ensuremath{\z_{opt}}\xspace|)) * 100$). \emph{Size}: Ratio between new and initial domain size ($(1 - (|\ensuremath{\hat{\ub{\z}}}\xspace - \ensuremath{\hat{\lb{\z}}}\xspace|/|\ub{\ensuremath{\mathbf{z}}\xspace} - \lb{\ensuremath{\mathbf{z}}\xspace}|)) * 100$). Cells show the median and the median absolute deviation (MAD): No superscript indicator \(\leq 5 \leq {}^{+} \leq 10 < {}^{*} \leq 20 < {}^{**} \leq 30 < {}^{***}\).\\\label{tab:prediction}% } \begin{tabularx}{\textwidth}{lRR|RR|RR|RR|RR|RR} \toprule {} & \multicolumn{2}{c}{GTB$_a$} & \multicolumn{2}{c}{GTB$_s$} & \multicolumn{2}{c}{LR} & \multicolumn{2}{c}{NN$_a$} & \multicolumn{2}{c}{NN$_s$} & \multicolumn{2}{c}{SVM} \\ {} & Gap & Size & Gap & Size & Gap & Size & Gap & Size & Gap & Size & Gap & Size \\ \midrule Bin Packing & 68 & 65 & 60 & 58 & 48 & 48 & \textbf{78}\textsuperscript{*} & \textbf{68}\textsuperscript{*} & 50 & 48 & 15 & 18 \\ Cutting Stock & \textbf{64}\textsuperscript{*} & 66 & 58\textsuperscript{*} & 59 & 48\textsuperscript{*} & 49 & 41\textsuperscript{***} & \textbf{71}\textsuperscript{+} & 48\textsuperscript{*} & 49 & 29\textsuperscript{*} & 17 \\ Jobshop & 69 & 69 & 60 & 60 & 50 & 50 & \textbf{87} & \textbf{81} & 50 & 48 & 19 & 20 \\ MRCPSP & 64 & 61 & 60 & 59 & 49 & 49 & \textbf{80} & \textbf{76} & 49 & 49 & 13 & 19 \\ Open Stacks & \textbf{64}\textsuperscript{*} & \textbf{60}\textsuperscript{+} & 59\textsuperscript{*} & 53 & 43\textsuperscript{**} & 43 & 56\textsuperscript{**} & 33\textsuperscript{*} & 47\textsuperscript{*} & 42\textsuperscript{+} & 15\textsuperscript{+} & 15 \\ RCPSP & 65 & 64 & 60 & 60 & 50 & 50 & \textbf{80}\textsuperscript{+} & \textbf{76}\textsuperscript{+} & 50 & 50 & 13 & 20 \\ VRP & 70 & 70 & 60 & 60 & 50 & 50 & \textbf{89} & \textbf{88} & 50 & 50 & 0 & 0 \\ \bottomrule \end{tabularx} \end{table} First, we look at the share of admissible estimations. Most models achieve $100$ \% admissible estimations in all problems. Exceptions exist for Cutting Stock (\ensuremath{\text{GTB}_{a}}\xspace , \ensuremath{\text{GTB}_{s}}\xspace, LR: 91 \%, SVM: 50 \%) and RCPSP (\ensuremath{\text{NN}_{s}}\xspace, SVM: 83 \%, all other models: $\ge 98 \%$). In general, \ensuremath{\text{NN}_{a}}\xspace has the highest number of admissible estimations, followed by \ensuremath{\text{GTB}_{a}}\xspace. The largest reduction is achieved by \ensuremath{\text{NN}_{a}}\xspace, making it the overall best performing model. \ensuremath{\text{GTB}_{a}}\xspace is also capable to consistently reduce the domain size by over $60$ \%, but not as much as \ensuremath{\text{NN}_{a}}\xspace. Cutting Stock and Open Stacks are difficult problems for most models, as indicated by the deviations in the results. LR and \ensuremath{\text{NN}_{s}}\xspace reduce the domain size by approximately 50 \%, when the label shift adjustment factor $\lambda$ is $0.5$, as selected in the previous experiment. Conclusively, these results show that Bion\xspace has an excellent ability to derive general estimation models from the extracted instance features. The estimators reduce substantially the domains and provide tight boundaries. \subsection{Effect on Solver Performance} Our final experiment investigates the effect of objective boundaries on the actual solver performance, as described in Section~\ref{sec:method_cp}. This includes both estimated boundaries as well as fixed boundaries calculated from the known best solution and the first solution found by the solver without boundary constraints. The goal for this combination of estimated and fixed boundaries is to understand how helpful objective boundaries actually are and also how well boundary estimation provides useful boundaries. By setting the fixed boundary in relation to the first found solution, we enforce an actual, non-trivial reduction in the solution space for the solver. The setup for the experiments is as follows. For each COP, 30 instances are randomly selected. Each instance is solved using four distinct configurations, namely \begin{enumerate} \item the unmodified model without boundary constraints; \item the estimations from \ensuremath{\text{NN}_{a}}\xspace as upper and lower boundary constraints; \item the estimations from \ensuremath{\text{NN}_{a}}\xspace, only as an upper boundary constraint; \item a fixed upper boundary of the middle between the optimum and the first found solution when using no boundary constraints ($\ensuremath{\mathbf{z}}\xspace_{first}$): $\ub{z} = \ensuremath{\z_{opt}}\xspace + \lfloor(\ensuremath{\mathbf{z}}\xspace_{first} - \ensuremath{\z_{opt}}\xspace) / 2\rfloor$. \end{enumerate} We selected three distinct solvers with different solving paradigms and features: Chuffed (as distributed with MiniZinc 2.1.7) \cite[]{Chu2016}, Gecode 6.0.1 \cite[]{Schulte2018}, and Google OR-Tools 6.8. These solvers represent state-of-the-art implementations, as shown by their high rankings in the MiniZinc challenges. All runs are performed with a 4 hour timeout on a single CPU core of an Intel E5-2670 with 2.6 GHz. Three metrics are used for evaluation (all in \,\%), each comparing a run with some boundary constraint to the unmodified run. The \emph{Equivalent Solution Time} compares the time it takes the unmodified run to reach a solution of similar or better quality than the first found solution when using boundary constraints. It is calculated as $(t_{Original} - t_{Bounds})/t_{Original} * 100$. The \emph{Quality of First} compares the quality of the first found solutions with and without boundary constraints and is calculated as $(1 - \ensuremath{\mathbf{z}}\xspace_{Bounds} / \ensuremath{\mathbf{z}}\xspace_{Original}) * 100$. The \emph{Time to Completion}, finally, relates the times until the search is completed and the optimal solution is found. It is calculated in the same fashion as the Equivalent Solution Time. The results are shown in Table~\ref{tab:solver}, listed per solver and problem. We do not list the results for the Cutting Stock problem for Chuffed and OR-Tools, because none of the configurations, including the unmodified run, found a solution for more than one instance. Gecode found at least one solution for 26 of 30 instances, but none completed, and we include the results for the 26 instances. For all other problems and instances all solvers and configurations found at least one solution. \begin{table}[th] \footnotesize \centering \caption{Effect of boundaries on solver performance (in \%). \emph{Fixed}: Upper boundary set to middle between optimum and first found solution of unbounded run. \emph{Upper}: Upper boundary set to estimated boundary. \emph{Both}: Upper and lower boundary set to estimated boundaries. Results are averaged over 30 instances, lower values are better.\\\label{tab:solver} } \begin{tabularx}{\textwidth}{lRRR|RRR|RRR} \toprule {} & \multicolumn{3}{c}{Equiv. Solution Time} & \multicolumn{3}{c}{Quality of First} & \multicolumn{3}{c}{Time to Completion} \\ {} & Fixed & Upper & Both & Fixed & Upper & Both & Fixed & Upper & Both \\ \midrule Bin Packing & -9.4 & 36.1 & 13.0 & -37.9 & -57.7 & -57.7 & 36.1 & 2140.7 & 2364.5 \\ Jobshop & -96.5 & -96.4 & -96.6 & -38.1 & -60.0 & -60.0 & -27.6 & -53.6 & -42.5 \\ MRCPSP & 0.0 & 0.0 & 0.0 & -10.8 & -0.4 & 0.0 & 1.2 & 0.3 & -3.4 \\ Open Stacks & -1.3 & -1.3 & -0.9 & -24.0 & -13.2 & -13.2 & 2.0 & -0.4 & 2.9 \\ RCPSP & -3.2 & 197.4 & 25.3 & -3.3 & 0.0 & 0.0 & -4.2 & 0.0 & -4.2 \\ VRP & 0.4 & 0.0 & 0.0 & -23.5 & 0.0 & 0.0 & 2.0 & 7.0 & 7.0 \\ \bottomrule \end{tabularx} \\ \begin{center}(a) Chuffed\end{center} \begin{tabularx}{\textwidth}{lRRR|RRR|RRR} \toprule Bin Packing & 53.5 & 0.3 & -0.6 & -4.7 & 0.0 & 0.0 & -10.3 & -4.0 & -13.0 \\ Cutting Stock & 5627.0 & 7.3 & -29.5 & -8.5 & -5.5 & -2.6 & -- & -- & -- \\ Jobshop & 189.3 & -6.4 & 37.4 & -10.9 & 6.1 & 6.1 & 0.0 & 0.0 & 0.0 \\ MRCPSP & 0.0 & 0.0 & 23.6 & -10.8 & -0.4 & -0.2 & 1.3 & 0.0 & 4.0 \\ Open Stacks & 0.0 & -1.5 & 0.0 & -24.0 & -12.8 & -12.8 & 8.9 & 6.4 & 6.8 \\ RCPSP & -17.2 & 56.8 & -14.4 & -2.8 & 0.0 & 0.0 & -11.8 & 12.0 & -9.4 \\ VRP & 0.0 & 0.0 & 0.0 & -21.0 & 0.0 & 0.0 & -19.0 & -18.0 & -8.0 \\ \bottomrule \end{tabularx} \\ \begin{center}(b) Gecode\end{center} \begin{tabularx}{\textwidth}{lRRR|RRR|RRR} \toprule Bin Packing & -22.7 & 35.0 & 39.2 & -37.4 & -57.0 & -57.2 & 104.4 & 170.0 & 172.4 \\ Jobshop & 1.1 & 0.0 & 0.0 & -16.5 & -0.8 & -0.8 & 0.0 & 0.0 & 0.0 \\ MRCPSP & -3.2 & -3.0 & 45.3 & -10.8 & -0.4 & 0.0 & -2.4 & -2.1 & 1.2 \\ Open Stacks & -5.0 & -2.6 & -3.1 & -24.0 & -13.2 & -13.2 & 6.3 & -1.2 & 2.3 \\ RCPSP & 0.0 & 147.2 & 30.4 & -3.3 & 0.0 & 0.0 & -6.6 & 27.0 & 7.8 \\ VRP & -95.3 & 0.0 & 0.0 & -38.2 & 0.0 & 0.0 & 32.0 & -3.0 & -5.0 \\ \bottomrule \end{tabularx} \\ \begin{center}(c) OR-Tools\end{center} \end{table} We obtain mixed results for the different solvers and problems, which indicates that the capability to effectively use objective boundaries is both problem- and solver-specific, and that deploying tighter constraints on the objective domain is not beneficial in every setting. This holds true both for the boundaries determined by boundary estimation (columns \emph{Upper} and \emph{Both}) and the fixed boundary, which is known to reduce the solution space in relation to the otherwise first found solution when using no boundary constraints. The general intuition, and also confirmed by the literature, is that in many cases a reduced solution space allows more efficient search and for several of the COPs, this is confirmed. An interpretation for why the boundary constraints in some cases hinder effective search, compared to the unbounded case, is that the solvers can apply different techniques for domain pruning or search once an initial solution is found. However, when the solution space is strongly reduced finding this initial solution is difficult as the right part of the search tree is only discovered late in the process. The best results are obtained for solving Jobshop with Chuffed, where the constraints improve both the time to find a good initial solution and the time until the search is completed. Whether both an upper and lower boundary constraint can be useful is visible for the combination of Gecode and RCPSP. Here, posting only the upper boundary is not beneficial for the Equivalent Solution Time, but with both upper and lower boundary Gecode is 14\,\% faster than without any boundaries. Chuffed has a similar behaviour for RCPSP regarding Time to Completion, where the upper boundary alone has no effect, but posting both bounds reduces the total solving time by 4\,\%. At the same time, we observe that posting both upper and lower boundaries, even though they reduce the original domain boundaries, do not always help to improve the solver performance. Two examples are the combination of Chuffed and Jobshop or OR-Tools with Open Stacks. In both cases does the lower boundary constraints reduce the performance compared to the behaviour with only the upper boundary, here in terms of Time to Completion. In addition to the specific solver implementations, a reasons for the effectiveness of objective boundaries the actual ability of the COP model to propagate the posted boundary constraints seems relevant. However, when considering the relation between the COPs objective function formulations (see Table~\ref{tab:instances}) and effectiveness of boundary constraints, we do not observe a strong link in our results, that would clearly explain the measured results. In conclusion, objective boundary constraints can generally improve solver performance. Still, there are dependencies on the right combination of solver and COP model to make best use of the reduced domain. Which combination is most effective and what the actual reasons for better performance are is yet an open question and, to the best of our knowledge, has not been clearly answered in the literature. From the comparison with a fixed objective boundary that is known to reduce the solution space, we observe that the estimated boundaries are often competitive and provide a similar behaviour when the external requirements are met. This makes boundary estimation a promising approach for further investigation and, once the external requirements on the combination of solver and COP model are properly identified, also practical deployment. \section{Conclusion} \label{sec:conclusion} Predictive ML has been shown to be very successful in supporting many important applications of CP, including algorithm configuration and selection, learning constraint models, and providing additional insights to support CP solvers. In the first part of the paper, we presented the integration in these applications and discussed necessary components for their success, such as data curation and trained ML models. Given the increasing interest in ML and the vast development of the field, we expect integration of predictive ML and CP to receive further attention as well. We broadly identified three types of integration, that we expect to be most relevant for future applications and research: The first is to have a ML model included in the solver itself and thereby to foster either learning during infer and search or lifelong learning of a solver. In this scenario, ML helps for configuration, filtering consistency and propagators selection, labelling heuristics selection and potentially for any solver decisions. Second, embedding ML models into the constraint model at compile time. Combining ML and CP in one model allows us to model problems that can not be solved by one of the paradigms alone. Furthermore, interaction of both paradigms can potentially enable further synergies at solving-time. The third and final category is a loose coupling between ML and CP by having a solver- and model- external ML component that can make predictions, which can affect both the solver and the model. Each of these three integration types has advantages and drawbacks and different application areas for which they are the most appropriate. In the second part of the paper, we presented one application of predictive ML for CP, namely boundary estimation\xspace. We introduced Bion\xspace, a novel boundary estimation method for constraint optimization problems (COP), which belongs to the third type mentioned above. A ML model is trained to estimate close boundaries on the objective value of a COP instance. To avoid inadmissible misestimations, training is performed using asymmetric loss and label shift, a technique to automatically adjust training labels. Boundary estimation has its strength in the combination of data-driven machine learning and exact constraint optimization through branch-and-bound. Decoupling these two parts enables broad adaptation to different problems and compatibility with a wide range of solvers. Because estimator training requires a set of sample instances, Bion\xspace is suited for scenarios where a COP has to be frequently solved with different data inputs. After additional instances have been solved, it is then possible to retrain the model to improve the estimations. An experimental evaluation showed the capability to estimate admissible boundaries and prune the objective domain with marginal overhead for the solver. Testing the estimated boundaries on CP solvers showed that boundary estimation is effective to support solving COPs. The example of boundary estimation with Bion\xspace motivates the potential advantage of integrating ML and constraint optimization, that we identified and discussed in the first part of this article. At the same time, it stresses the necessity for data-efficient learning models and generic instance representations to capture relevant problem and instance information. \section*{Acknowledgment} This research was supported by the Research Council of Norway through the T-Largo grant (Project No.: 274786) and the European Commission through the H2020 project AI4EU (Project No.: 825619). \bibliographystyle{plainnat}
{'timestamp': '2021-11-08T02:04:50', 'yymm': '2111', 'arxiv_id': '2111.03160', 'language': 'en', 'url': 'https://arxiv.org/abs/2111.03160'}
arxiv
\section{Introduction and Related work} Gender classification and age estimation can benefit a wide range of applications, e.g. visual surveillance, targeted advertising, human-computer interaction (HCI) systems, content-based searching etc \cite{applications}. In order to solve these two tasks accurately and efficiently, a modified version of the Local Deep Neural Networks (LDNN) \cite{LDNN} is proposed. The proposed method achieves similar results to most state-of-the-art methods while the amount of computation needed is largely reduced. We also investigate which face regions are important for gender/age-group classification. The conclusion drawn is that the eyes and mouth regions are the most informative ones for age classification, whereas just the eyes region is important for gender classification. \subsection{Age and gender classification using CNNs} A convolutional neural network (CNN) consisting of three convolutional layers was used in \cite{CNN} to achieve 86.8$\pm$1.4\% and 50.7$\pm$5.1\% accuracy for gender and age-group classification, respectively, on the Adience database. Random patches of size 227 by 227 were cropped from the original and mirrored images in order to augment the training data and avoid overfitting. When testing, five 227-by-227 patches were generated from every single image. Four of them were aligned with the four corners of the image and one of them was aligned with the centre of the image. These five patches were then reflected horizontally, resulting in ten patches generated from every single image. The final prediction of the image was the average of these ten patches. The results of age classification on the Adience database were improved to 64.0$\pm$4.2\% using the VGG-16 CNN architecture pre-trained on ImageNet \cite{new_DEX}. \subsection{Local deep neural networks (LDNNs)} \label{ssec:localDNN} LDNNs follow a different approach where small patches around important regions of images are extracted and then fed into deep neural networks to do gender/age classification \cite{LDNN}. The process is shown in Figure~\ref{fig:train_a_LDNN}. Initially, filters, e.g. edge or corner detectors, are used to find edges in images. Subsequently, patches are extracted around the detected edges. Finally, all patches are used to train neural networks. During testing, the predictions of all the patches obtained from one image are averaged as the final result for that image \cite{LDNN}. Classification rates of 96.25\% and 77.87\% in image and patch level, respectively, were achieved on the LFW database and 90.58\% and 72.83\% in image and patch level, respectively, were achieved on the Gallagher's database using LDNN \cite{LDNN}. Using patches obtained in this way seldom leads to overfitting since most redundant information has been removed during filtering. Therefore, a simple feed forward neural network without dropout is used \cite{LDNN}. \begin{figure}[h] \centering \includegraphics[width =0.9\hsize]{./figures/LDNN-structure.jpg} \caption{Training a LDNN \cite{LDNN}.} \label{fig:train_a_LDNN} \end{figure} \section{Databases} \subsection{Labeled Faces in the Wild} The Labeled Faces in the Wild (LFW) database contains 13,233 face photographs labeled with the name and gender of the person pictured. Images of faces were collected from the web with the only constraint that they were detected by the Viola-Jones face detector \cite{LFWTech}. \bigskip \begin{figure}[h] \centering \includegraphics[width =0.15\hsize]{./figures/LFW/1.jpg} \includegraphics[width =0.15\hsize]{./figures/LFW/2.jpg} \includegraphics[width =0.15\hsize]{./figures/LFW/3.jpg} \includegraphics[width =0.15\hsize]{./figures/LFW/4.jpg} \includegraphics[width =0.15\hsize]{./figures/LFW/5.jpg} \includegraphics[width =0.15\hsize]{./figures/LFW/6.jpg} \includegraphics[width =0.15\hsize]{./figures/LFW/7.jpg} \includegraphics[width =0.15\hsize]{./figures/LFW/8.jpg} \includegraphics[width =0.15\hsize]{./figures/LFW/9.jpg} \includegraphics[width =0.15\hsize]{./figures/LFW/10.jpg} \caption{Examples in the LFW 3D version.} \label{fig:lfw_examples} \end{figure} There are four versions of LFW - the original version, funneled version \cite{lfw_funneled}, deep funneled version \cite{lfw_deepfunneled} and frontalised version (3D version). LFW is an imbalanced database including 10,256 images of men and 2,977 images of women from 5,749 subjects, 1,680 of which have two or more images \cite{LFWTech} \cite{LFWTechUpdate}. The 3D version is used in this work since the images are already cropped, aligned and frontalised properly as shown in Figure~\ref{fig:lfw_examples}. \subsection{Adience database} The Adience database contains 26,580 face photos from 2,284 individuals with gender and age labels of the person pictured. The images of faces were collected from the Flickr albums and released by their authors under the Creative Commons (CC) license. The images are completely unconstrained as they were taken under different variations in appearance, noise, pose, lighting etc \cite{Adience}. \bigskip There are three versions of the Adience database, including the original version, aligned version and frontalised version (3D version) with 26,580, 19,487 and 13,044 images respectively\cite{Adience}. The 3D version is used in this work since most images are already frontalised and aligned to the centre of the image. However, images in the Adience database 3D version may be extremely blurry or frontalised incorrectly as shown in Figure~\ref{fig:3d_ad_ex}. Additionally, people in the images could show emotions. Therefore, patches extracted from those images may not always contain the same face region which may result in lower classification rates. \bigskip \begin{figure}[h] \centering \includegraphics[width = 0.15\hsize]{./figures/ex_AD/c1.jpg} \includegraphics[width = 0.15\hsize]{./figures/ex_AD/c2.jpg} \includegraphics[width = 0.15\hsize]{./figures/ex_AD/c3.jpg} \includegraphics[width = 0.15\hsize]{./figures/ex_AD/c4.jpg} \includegraphics[width = 0.15\hsize]{./figures/ex_AD/c5.jpg} \includegraphics[width = 0.15\hsize]{./figures/ex_AD/w1.jpg} \includegraphics[width = 0.15\hsize]{./figures/ex_AD/w2.jpg} \includegraphics[width = 0.15\hsize]{./figures/ex_AD/w3.jpg} \includegraphics[width = 0.15\hsize]{./figures/ex_AD/w4.jpg} \includegraphics[width = 0.15\hsize]{./figures/ex_AD/w5.jpg} \caption{Examples in the Adience database 3D version} \label{fig:3d_ad_ex} \end{figure} \subsubsection{Age groups merging} There are eight age groups and another 20 different age labels in the Adience database as shown in Table \ref{AD_age_all}. Using only the eight age groups is not feasible as no images for the $6^{th}$ group - (38, 43) exist in folds 1 or 2. Therefore, images that are labeled with one of the 20 age labels were merged to one of the eight age groups. In order to use all images labeled with age and to make the data more balanced, images were grouped as following: \begin{itemize} \item The $1^{st}$ age group: images labeled with '(0, 2)' or '2' \item The $2^{nd}$ age group: images labeled with '(4, 6)' or '3' \item The $3^{rd}$ age group: images labeled with '(8, 12)' or '13' \item The $4^{th}$ age group: images labeled with '(15, 20)', '(8, 23)' or '22' \item The $5^{th}$ age group: images labeled with '(25, 32)', '(27, 32)', '23', '29' or '34' \item The $6^{th}$ age group: images labeled with '(38, 43)', '(38, 48)', '(32, 43)', '(38, 42)', '35', '36', '42' or '45' \item The $7^{th}$ age group: images labeled with '(48, 53)', '55' or '56' \item The $8^{th}$ age group: images labeled with '(60, 100)', '57' or '58' \end{itemize} \begin{table}[h] \centering \caption{All age labels in Adience database \cite{Adience}} \label{AD_age_all} \begin{tabular}{|c|c|c|c|c|c|} \hline & Fold\_0 & Fold\_1 & Fold\_2 & Fold\_3 & Fold\_4 \\ \hline (0, 2) & 675 & 173 & 633 & 117 & 219 \\ \hline (4, 6) & 366 & 338 & 268 & 200 & 414 \\ \hline (8, 12) & 161 & 447 & 349 & 405 & 226 \\ \hline (15, 20) & 111 & 374 & 162 & 322 & 152 \\ \hline (25, 32) & 1,143 & 442 & 508 & 628 & 629 \\ \hline (38, 43) & 403 & 0 & 0 & 326 & 328 \\ \hline (48, 53) & 167 & 94 & 81 & 71 & 159 \\ \hline (60, 100) & 94 & 98 & 129 & 80 & 182 \\ \hline 2 & 0 & 0 & 3 & 0 & 0 \\ \hline 3 & 12 & 0 & 2 & 3 & 0 \\ \hline (8, 23) & 0 & 0 & 0 & 1 & 0 \\ \hline 13 & 3 & 103 & 0 & 0 & 0 \\ \hline 22 & 0 & 77 & 2 & 7 & 0 \\ \hline 23 & 0 & 29 & 11 & 29 & 0 \\ \hline (27, 32) & 0 & 1 & 0 & 42 & 0 \\ \hline 29 & 0 & 0 & 6 & 0 & 0 \\ \hline (32, 43) & 0 & 300 & 208 & 0 & 0 \\ \hline 34 & 0 & 0 & 0 & 75 & 0 \\ \hline 35 & 21 & 80 & 8 & 77 & 28 \\ \hline 36 & 3 & 0 & 0 & 42 & 0 \\ \hline (38, 42) & 0 & 10 & 0 & 22 & 0 \\ \hline (38, 48) & 1 & 0 & 0 & 0 & 5 \\ \hline 42 & 0 & 0 & 0 & 1 & 0 \\ \hline 45 & 1 & 47 & 2 & 3 & 2 \\ \hline 55 & 3 & 44 & 3 & 3 & 8 \\ \hline 56 & 0 & 0 & 1 & 0 & 0 \\ \hline 57 & 0 & 0 & 2 & 4 & 10 \\ \hline 58 & 2 & 0 & 0 & 2 & 0 \\ \hline \end{tabular} \end{table} We have defined this merging protocol so results may not be directly comparable with other works that potentially use a different protocal. However, we were not able to find any publicly available protocol. \subsubsection{One-off age classification rates} Due to the similarity of people in adjacent age groups, images classified into adjacent age groups are also considered to be classified correctly and the corresponding result is called one-off classification rate \cite{CNN}. \subsubsection{Three subsets of the Adience database 3D version} Images labeled with gender are not necessarily labeled with age groups and vice-versa. This leads to three subsets of the Adience database 3D version. The $1^{st}$ subset consists of 12,194 images labeled with gender. The $2^{nd}$ subset consists of 12,991 images labeled with age. The $3^{rd}$ subset, where the experiments were conducted, consists of 12,141 images labeled with both gender and age as shown in Table \ref{3D_AD}. \begin{table}[h] \centering \caption{Images labeled with both gender and age in the Adience database 3D version \cite{Adience}} \label{3D_AD} \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|} \hline Group & $1^{st}$ & $2^{nd}$ & $3^{rd}$ & $4^{th}$ & $5^{th}$ & $6^{th}$ & $7^{th}$ & $8^{th}$ & Total \\ \hline Male & 533 & 693 & 736 & 508 & 1,635 & 1,011 & 333 & 291 & 5,740 \\ \hline Female & 494 & 910 & 952 & 699 & 1,867 & 875 & 296 & 308 & 6,401 \\ \hline Total & 1,027 & 1,603 & 1,688 & 1,207 & 3,502 & 1,886 & 629 & 599 & 12,141\\ \hline \end{tabular} \end{table} \section{The proposed LDNN nine-patch method} The LDNN approach (see Section \ref{ssec:localDNN}) generates hundreds of patches for every single image. As a consequence, it is computationally expensive to train a neural network when there are thousands of images. In order to reduce the computational cost, we propose the nine-patch method which generates only nine patches for every single image. Figure~\ref{fig:ninePatchesOfTheImage} shows an example of the nine patches of an image. The nine patches are indexed from left to right and then from top to bottom; The top left patch is indexed as the $1^{st}$ patch and the bottom right is indexed as the $9^{th}$ as shown in Figure~\ref{fig:ninePatchesOfTheImage}. The height and width of patches are set to half of the height and width of images. The overlapping ratio of adjacent patches is 50\%; the $2^{nd}$ patch overlaps 50\% with the $1^{st}$ and the $3^{rd}$ patch and the $4^{th}$ patch overlaps 50\% with the $1^{st}$ and the $7^{th}$ patch. \begin{figure}[h] \centering \includegraphics[width = 0.59\hsize]{./figures/9p_index.png} \caption{The nine patches of the image} \label{fig:ninePatchesOfTheImage} \end{figure} If images are frontalised and cropped properly, like images in the LFW database 3D version, the $1^{st}$ patch should certainly contain the left eye and the mouth should be contained in the $8^{th}$ patch. \subsection{Pre-processing} Initially, images are converted into grey-scale (from 0.0 - black to 1.0 - white). For images in the Adience database, the face is cropped using a fixed box - [20 20 100 100], which indicates that the coordinate of the top-left corner of the fixed box is [20 20] and the height and width of the box are both 100. For images in the LFW database, no box is needed since images are already cropped and aligned perfectly. Subsequently, images are resized to 60 by 60. Then the nine 30-by-30 patches are generated. For every single patch, pixel values were normalised to the standard Gaussian distribution with zero mean and unity variance. \subsection{Methodology} During training, the nine patches are extracted as shown in Figure~\ref{fig:ninePatchesOfTheImage} and used to train a neural network. The testing procedure is shown in Figure~\ref{fig:methodology}. When testing, for every single image, the corresponding nine patches are classified by the trained neural network. Subsequently, the outputs or the posteriors of the nine patches are averaged. The averaged result is the final prediction of the image and the image will be classified to the class with the highest posterior. \begin{figure}[h] \centering \includegraphics[width = 1\hsize]{./figures/methodology2.jpeg} \caption{The methodology of the nine-patch method} \label{fig:methodology} \end{figure} \bigskip \section{Experimental Results on the LFW database} We have run a series of experiments on the LFW database, including optimisation of parameters and different combinations. In order to test the nine-patch method, five-cross-validation using the same five folds as \cite{LDNN} is used. Around $\frac{2}{3}$ of patches of men are randomly discarded in each fold to balance the data. \subsection{Parameters of neural networks} \label{sec:Parameters of neural networks} We have run a series of experiments to identify a suitable set of training parameters. We have experimented with the number of hidden layers, number of hidden units per layer, dropout rates, activation functions (leaky ReLU), learning rate update policies etc. As a result, we have found that the following set of parameters leads to good performance: \begin{itemize} \item learning algorithm: SGD + Momentum \item 0.8 and 0.5 retain dropout probability for input and hidden units, respectively \item Initial learning rate: 3 \item Learning rate update rule: $lr \leftarrow lr*0.998$ from the first epoch to the last \item Initial momentum: 0.5 \item Final momentum: 0.99 \item Momentum would increase from the first epoch until the $500^{th}$ epoch. \item Number of hidden units: 512 \item Number of hidden layers: 2 \item Activation function: ReLU \item Weights were initialised with He's method \cite{he2015delving} \end{itemize} \subsection{A replication of LDNN} Firstly, the original LDNN method is replicated. After images have been cropped and resized to 60*60, a sobel/canny edge detector is used to obtain edges from the images. Subsequently, a low pass filter, e.g. a Gaussian filter, is used. Then a threshold is set so that strong edges, e.g. contours, would be preserved while noisy points and weak edges would be removed, resulting in the binary mask shown in Figure~\ref{fig:cannyandsobel}. Around every single white pixel in the binary mask, a patch with size 13*13 is generated. \begin{figure}[h] \centering \includegraphics[width = 1\hsize]{./figures/methodology/cannyprocess.jpeg} \caption{Comparison between using the Sobel and Canny edge detector} \label{fig:cannyandsobel} \end{figure} There is a trade-off between the number of patches and the information left after pre-processing. When most useful edges are preserved, the number of patches is extremely large. For example, in the case shown in Figure~\ref{fig:cannyandsobel}, a nine-by-nine Gaussian kernel $N(\mu =0,\sigma =2)$ is used as the low pass filter and the threshold is set to 0.2. There are 425/485 patches on average for one image when the Sobel/Canny edge detector are used respectively as listed in Table \ref{table:cannyandsobel}, which leads to 425*2647 = 1,124,975 or 485*2647 = 1,283,795 patches respectively for a single fold of the LFW database. Due to the huge number of patches and the limited amount of memory, it is not feasible to train a neural network using all of the four training folds. \bigskip \begin{table}[h] \centering \caption{Comparison between our implementation of LDNNs and the original version presented in \cite{LDNN}. } \label{table:cannyandsobel} \begin{tabular}{|c|c|c|c|c|} \hline & Sobel & Canny & LDNN \cite{LDNN} & LDNN with location\cite{LDNN} \\ \hline Number of patches per image & 425 & 485 & unknown & unknown \\ \hline Patch level & 63.27\% & 64.95\% & 74.50\% & 77.26\% \\ \hline Image level & 91.55\% & 93.68\% & 95.79\% & 96.25\% \\ \hline \end{tabular} \end{table} Instead of using three or four folds, only one fold was used for training and one fold was used for testing, leaving three folds unused. This leads to classification rates of 91.55\%/93.68\% as shown in Table \ref{table:cannyandsobel}, which are lower than those reported in \cite{LDNN} $(\sim 96\%)$. However, this could well be the result of using a smaller training set that contains only one fold. \begin{figure}[p] \centering \includegraphics[width = 0.19\hsize]{./figures/patch_size/30/30_1.jpg} \includegraphics[width = 0.19\hsize]{./figures/patch_size/30/30_2.jpg} \smallbreak \includegraphics[width = 0.19\hsize]{./figures/patch_size/30/30_3.jpg} \includegraphics[width = 0.19\hsize]{./figures/patch_size/30/30_4.jpg} \caption{Patch size 30} \label{fig:patch_size_30} \bigskip \centering \includegraphics[width = 0.12\hsize]{./figures/patch_size/20/20_1.jpg} \includegraphics[width = 0.12\hsize]{./figures/patch_size/20/20_2.jpg} \includegraphics[width = 0.12\hsize]{./figures/patch_size/20/20_3.jpg} \smallbreak \includegraphics[width = 0.12\hsize]{./figures/patch_size/20/20_4.jpg} \includegraphics[width = 0.12\hsize]{./figures/patch_size/20/20_5.jpg} \includegraphics[width = 0.12\hsize]{./figures/patch_size/20/20_6.jpg} \smallbreak \includegraphics[width = 0.12\hsize]{./figures/patch_size/20/20_7.jpg} \includegraphics[width = 0.12\hsize]{./figures/patch_size/20/20_8.jpg} \includegraphics[width = 0.12\hsize]{./figures/patch_size/20/20_9.jpg} \caption{Patch size 20} \label{fig:patch_size_20} \bigskip \centering \includegraphics[width = 0.09\hsize]{./figures/patch_size/15/15_1.jpg} \includegraphics[width = 0.09\hsize]{./figures/patch_size/15/15_2.jpg} \includegraphics[width = 0.09\hsize]{./figures/patch_size/15/15_3.jpg} \includegraphics[width = 0.09\hsize]{./figures/patch_size/15/15_4.jpg} \smallbreak \includegraphics[width = 0.09\hsize]{./figures/patch_size/15/15_5.jpg} \includegraphics[width = 0.09\hsize]{./figures/patch_size/15/15_6.jpg} \includegraphics[width = 0.09\hsize]{./figures/patch_size/15/15_7.jpg} \includegraphics[width = 0.09\hsize]{./figures/patch_size/15/15_8.jpg} \smallbreak \includegraphics[width = 0.09\hsize]{./figures/patch_size/15/15_9.jpg} \includegraphics[width = 0.09\hsize]{./figures/patch_size/15/15_10.jpg} \includegraphics[width = 0.09\hsize]{./figures/patch_size/15/15_11.jpg} \includegraphics[width = 0.09\hsize]{./figures/patch_size/15/15_12.jpg} \smallbreak \includegraphics[width = 0.09\hsize]{./figures/patch_size/15/15_13.jpg} \includegraphics[width = 0.09\hsize]{./figures/patch_size/15/15_14.jpg} \includegraphics[width = 0.09\hsize]{./figures/patch_size/15/15_15.jpg} \includegraphics[width = 0.09\hsize]{./figures/patch_size/15/15_16.jpg} \caption{Patch size 15} \label{fig:patch_size_15} \end{figure} \subsection{Patch size and overlapping} In order to identify the most suitable patch size, we have run a series of experiments with different patch sizes. The highest classification rate in image level without overlapping is obtained when patch size is 30 as shown in Table \ref{patch_size_512}. As shown in Figures~\ref{fig:patch_size_30} and \ref{fig:patch_size_15}, the reason that patch size 15 and 30 lead to over 94\% classification rates in image level could be that important facial regions, e.g. eyes, are not split into more than two patches. Especially when the patch size is 30, the $1^{st}$ patch of the first row would contain the entire left eye and the second would contain the right, which leads to the highest classification rate in image level without overlapping. Additionally, using patch size 30 requires the smallest amount of computation. Thus, patch size is set to 30. \begin{table}[h] \centering \caption{Classification rates with different patch sizes and 512 hidden units for each hidden layer.} \label{patch_size_512} \begin{tabular}{|c|c|c|c|c|c|} \hline Patch Size & 13*13 & 15*15 & 20*20 & 30*30 & Entire images \cite{LDNN}\\ \hline Patch level & 73.12\% & 75.13\% & 78.50\% & 87.56\% & 92.60\%\\ \hline Image level & 93.366\% & 94.028\% & 92.852\% & 94.21\% & 92.60\%\\ \hline \end{tabular} \end{table} Using 50\% overlapping ratio increases the classification rates by 1\% approximately while using 75\% overlapping ratio does not further improve the performance as shown in Table \ref{50_75_overlapping}. Therefore, the overlapping ratio is set to 50\%, which is also less computationally expensive. \bigskip \begin{table}[h] \centering \caption{Using overlapping ratios 0\%, 50\% and 75\% when patch size was 30} \label{50_75_overlapping} \begin{tabular}{|c|c|c|c|} \hline overlapping ratios & no overlapping & 50\% & 75\% \\ \hline Patch level &87.56\% & 88.34\% & 84.22\% \\ \hline Image level &94.21\% & 95.072\% & 94.25\% \\ \hline \end{tabular} \end{table} \subsection{Classification rate of individual patches} For every single experiment using the nine patches, the classification rate of each patch is recorded. Results are shown in Table \ref{cr_Different9Patches}. It is consistent with all experiments that the highest classification rate comes from the patches that contain the eye. \begin{figure}[h] \centering \includegraphics[width = 0.11\hsize]{./figures/patch_size/stride/30_15/30_1.jpg} \includegraphics[width = 0.11\hsize]{./figures/patch_size/stride/30_15/30_2.jpg} \includegraphics[width = 0.11\hsize]{./figures/patch_size/stride/30_15/30_3.jpg} \caption{The first, second and third patch from left to right} \label{fig:patches_index1} \includegraphics[width = 0.11\hsize]{./figures/patch_size/stride/30_15/30_4.jpg} \includegraphics[width = 0.11\hsize]{./figures/patch_size/stride/30_15/30_5.jpg} \includegraphics[width = 0.11\hsize]{./figures/patch_size/stride/30_15/30_6.jpg} \caption{The fourth, fifth and sixth patch from left to right} \label{fig:patches_index2} \includegraphics[width = 0.11\hsize]{./figures/patch_size/stride/30_15/30_7.jpg} \includegraphics[width = 0.11\hsize]{./figures/patch_size/stride/30_15/30_8.jpg} \includegraphics[width = 0.11\hsize]{./figures/patch_size/stride/30_15/30_9.jpg} \caption{The seventh, eighth and ninth patch from left to right} \label{fig:patches_index3} \end{figure} \begin{table}[h] \centering \caption{Classification rates of patches} \label{cr_Different9Patches} \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|} \hline & $1^{st}$ & $2^{nd}$ & $3^{rd}$ & $4^{th}$ & $5^{th}$ & $6^{th}$ & $7^{th}$ & $8^{th}$ & $9^{th}$ \\ \hline Cr & 89.31\% & 87.75\% & 90.49\% & 90.11\% & 88.60\% & 90.84\% & 86.00\% & 86.01\% & 86.70\% \\ \hline \end{tabular} \end{table} Compared with the last three patches that do not contain the eyes as shown in Figure~\ref{fig:patches_index1} to Figure~\ref{fig:patches_index3}, the classification rates of the first six patches are $2$ to $4\%$ higher. \subsection{Five rows} In this experiment, five rows with 60-by-20 pixels are cropped for every single image as shown in Figure~\ref{fig:60_20fiverows}. Five neural networks are trained using one of the five rows separately. When testing, for every single image, the five rows are cropped and classified by the corresponding neural network. The final output of the image is the average of the outputs of the five rows cropped from the image. \bigskip \begin{figure}[h] \centering \includegraphics[width = 0.225\hsize]{./figures/rows/20_row1.jpg} \smallbreak \includegraphics[width = 0.225\hsize]{./figures/rows/20_row2.jpg} \smallbreak \includegraphics[width = 0.225\hsize]{./figures/rows/20_row3.jpg} \smallbreak \includegraphics[width = 0.225\hsize]{./figures/rows/20_row4.jpg} \smallbreak \includegraphics[width = 0.225\hsize]{./figures/rows/20_row5.jpg} \caption{Five 60*20 rows.} \label{fig:60_20fiverows} \end{figure} Results are shown in Table \ref{5rows_cr}. As expected, the highest classification rate of a single row comes from the second row, which contains the two eyes as shown in Figure~\ref{fig:60_20fiverows}. Combining the five rows achieves 93.73\% classification rate, which is higher than any single row results. However, the performance is lower than the nine-patch method. \begin{table}[h] \centering \caption{Classification rate of the five rows.} \label{5rows_cr} \begin{tabular}{|c|c|c|c|c|c|c|} \hline & The $1^{st}$ row & The $2^{nd}$ row & The $3^{rd}$ row & The $4^{th}$ row & The $5^{th}$ row & Combined \\ \hline Accuracy & 89.73\% & 92.59\% & 90.58\% & 89.07\% & 90.24\% & 93.73\% \\ \hline \end{tabular} \end{table} \subsection{Using entire images} Images are converted into greyscale and are resized to [32 32] and are mapped to the standard Gaussian distribution. The neural networks are then trained using entire images directly, which results in 92.72\% classification accuracy. \subsection{Combinations} In this section, we experiment with several combination of the nine patches, the entire images and the five rows. The best combination is shown in Figure~\ref{fig:2rowEntirePatches} and results in a classification rate of 95.64\% as shown in Table \ref{comparisonCombinations}. \bigskip \begin{figure}[h] \centering \includegraphics[width = 1\hsize]{./figures/combine/patchEntire2Row.jpeg} \caption{Combining the nine-patch method with entire images and the second row} \label{fig:2rowEntirePatches} \end{figure} The best performance was achieved by combining the neural network (A) trained using the nine-patch method with the neural network (B) trained using entire images and the neural network (C) trained using the second row. When testing, for every single image, the nine patches are classified by the neural network (A) and the image itself is fed to the neural network (B) and the second row of the image is fed to the neural network (C). When combining these three sets of neural networks, the posteriors from the neural network (A) are multiplied by $\frac{1}{9}$, which means an entire image shares the same weight as the nine patches extracted from the image. \bigskip \begin{table}[h] \centering \caption{Comparison between the combination and using the nine-patch method only} \label{comparisonCombinations} \begin{tabular}{|c|c|c|c|} \hline & Entire images & The nine-patch method & The combination \\ \hline Accuracy & 92.72\% & 95.072\% & 95.64\% \\ \hline \end{tabular} \end{table} \bigskip To summarise, the highest classification rate that the nine-patch method can achieve on the LFW database is 95.072\% and combining the nine-patch method with entire images and the second row results in 95.64\%, both of which outperform the highest results that DNN, Deep Convolutional Neural Networks (DCNN), Gabor+PCA+SVM or BoostedLBP+SVM can achieve on the LFW database \cite{LDNN}. Additionally, compared with LDNN, the nine-patch method reduces the amount of computation largely while the classification rate is only around 0.5\% lower. \section{Experimental results on the Adience database} Initially, experiments for gender/age classification are conducted separately on the 3D version. Subsequently, the neural networks that are responsible for gender classification are used to assist age-group classification. Similarly, five cross validation using the same folds as \cite{CNN} is conducted to evaluate the performance. \subsection{Gender classification} We have trained neural networks using the nine-patch method and entire images with the same parameters as in Section \ref{sec:Parameters of neural networks}. Results are shown in Table \ref{gendercrOnAdience}. The nine-patch method leads to a slight improvement ($1\%$ approximately) compared with training neural networks using entire images. Compared with the results on the LFW database, the gender classification rates achieved on the Adience database are approximately 17\% lower. The main reason is that images in the Adience database are not frontalised perfectly. As a consequence, patches do not always contain the same region of faces. \begin{table}[h] \centering \caption{Results of gender classification} \label{gendercrOnAdience} \begin{tabular}{|c|c|c|} \hline & Using entire images & The nine-patch method \\ \hline CR & 77.79\% & 78.63\% \\ \hline \end{tabular} \end{table} The classification rates for each patch are shown in Table \ref{cr_DifferentPatches_Adience3D}. Unlike the LFW database, for the Adience database 3D version, higher classification rates only come from the second row, which consists of the $4^{th}$, the $5^{th}$ and the $6^{th}$ patches while the classification rates of the other six patches are 2\% - 4\% lower. The reason may be that the first three patches may not contain the eye or may be distorted seriously. For the second row (the $4^{th}$ to the $6^{th}$ patch), the patches contain the entire eye and a part of the nose as shown in Figures~\ref{fig:patches_index_3DAdience1} to \ref{fig:patches_index_3DAdience3}. Therefore, the classification rates of patches in the second row are the highest. \begin{figure}[h] \centering \includegraphics[width = 0.11\hsize]{./figures/adience3D/1.jpg} \includegraphics[width = 0.11\hsize]{./figures/adience3D/2.jpg} \includegraphics[width = 0.11\hsize]{./figures/adience3D/3.jpg} \caption{The first, second and third patch from left to right} \label{fig:patches_index_3DAdience1} \includegraphics[width = 0.11\hsize]{./figures/adience3D/4.jpg} \includegraphics[width = 0.11\hsize]{./figures/adience3D/5.jpg} \includegraphics[width = 0.11\hsize]{./figures/adience3D/6.jpg} \caption{The fourth, fifth and sixth patch from left to right} \label{fig:patches_index_3DAdience2} \includegraphics[width = 0.11\hsize]{./figures/adience3D/7.jpg} \includegraphics[width = 0.11\hsize]{./figures/adience3D/8.jpg} \includegraphics[width = 0.11\hsize]{./figures/adience3D/9.jpg} \caption{The seventh, eighth and ninth patch from left to right} \label{fig:patches_index_3DAdience3} \end{figure} \begin{table}[h] \centering \centering \caption{Gender classification rates of the nine patches on the 3D version} \label{cr_DifferentPatches_Adience3D} \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|} \hline & $1^{st}$ & $2^{nd}$ & $3^{rd}$ & $4^{th}$ & $5^{th}$ & $6^{th}$ & $7^{th}$ & $8^{th}$ & $9^{th}$ \\ \hline Cr & 70.82\% & 69.66\% & 71.55\% & 73.75\% & 72.15\% & 74.19\% & 70.98\% & 69.61\% & 71.42\% \\ \hline \end{tabular} \end{table} \subsection{Age-group classification} We also carry out age-group classification using entire images and the nine-patch method. Results are shown in Table \ref{ResultsAge3D}. The age-group classification rate using the nine-patch method is 40.25\%. Compared with using entire images, the nine-patch method increases the classification rate by 0.75\% approximately and increases the one-off classification rate by 1\% approximately. \bigskip \begin{table}[h] \centering \caption{Results of age classification rates on the 3D version} \label{ResultsAge3D} \begin{tabular}{|c|c|c|} \hline & Entire images (DNN) & The nine-patch method \\ \hline Accuracy & 39.50\% & 40.25\% \\ \hline One-off & 76.18\% & 77.05\% \\ \hline \end{tabular} \bigskip \centering \caption{Age classification rates of the nine patches on the Adience database 3D version} \label{cr_DifferentPatches_AdienceAligned_Age} \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|} \hline & $1^{st}$ & $2^{nd}$ & $3^{rd}$ & $4^{th}$ & $5^{th}$ & $6^{th}$ & $7^{th}$ & $8^{th}$ & $9^{th}$ \\ \hline Cr & 35.07\% & 37.50\% & 35.64\% & 37.73\% & 39.52\% & 37.67\% & 33.52\% & 37.22\% & 34.53\% \\ \hline \end{tabular} \end{table} The age-group classification rate of each patch is shown in Table \ref{cr_DifferentPatches_AdienceAligned_Age}. Similarly, the highest classification rates come from the patches in the second row that contains the eyes. In addition to the second row, the classification rates of the $2^{nd}$ patch and the $8^{th}$ patch are 2.5-3.5\% higher than those of the other patches. The reason may be that the $2^{nd}$ patch contains the inner corners of the two eyes and the $8^{th}$ patch contains the mouth. \subsection{Age classification for men/women} We conduct age-group classification for images of men and women separately using the nine-patch method and entire images. Results are shown in Table \ref{table:mnfAge}. In order to combine gender and age classification, the neural network (B) in Figure~\ref{fig:CombineAgeGender} is trained using 5,740 images of men only while the neural network (C) is trained using 6,410 images of women only. \bigskip \begin{figure}[h] \centering \includegraphics[width = 1\hsize]{./figures/adience3D/agenGender.jpeg} \caption{Combination of age/gender classification} \label{fig:CombineAgeGender} \end{figure} \begin{table}[h] \centering \caption{Results of age-group classification for men and women} \label{table:mnfAge} \begin{tabular}{|c|c|c|c|c|} \hline & \multicolumn{2}{c|}{\begin{tabular}[c]{@{}c@{}}Neural network (B):\\ age-group classification for men\end{tabular}} & \multicolumn{2}{c|}{\begin{tabular}[c]{@{}c@{}}Neural network (C):\\ age-group classification for women\end{tabular}} \\ \hline Classification rate & Exact & One-off & Exact & One-off \\ \hline Entire images & 38.69\% & 77.63\% & 36.48\% & 74.83\% \\ \hline The nine-patch method & 39.90\% & 80.32\% & 41.27\% & 77.14\% \\ \hline \end{tabular} \bigskip \centering \caption{Age classification rates of the nine patches of men} \label{cr_DifferentPatches_AdienceAligned_AgeMen} \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|} \hline & $1^{st}$ & $2^{nd}$ & $3^{rd}$ & $4^{th}$ & $5^{th}$ & $6^{th}$ & $7^{th}$ & $8^{th}$ & $9^{th}$ \\ \hline Cr & 30.84\% & 32.22\% & 31.07\% & 32.53\% & 34.42\% & 31.80\% & 32.01\% & 32.64\% & 31.08\% \\ \hline \end{tabular} \bigskip \centering \caption{Age classification rates of the nine patches of women} \label{cr_DifferentPatches_AdienceAligned_AgeWomen} \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|} \hline & $1^{st}$ & $2^{nd}$ & $3^{rd}$ & $4^{th}$ & $5^{th}$ & $6^{th}$ & $7^{th}$ & $8^{th}$ & $9^{th}$ \\ \hline Cr & 33.03\% & 34.37\% & 32.38\% & 34.49\% & 37.00\% & 34.37\% & 31.13\% & 34.01\% & 31.78\% \\ \hline \end{tabular} \end{table} The classification rate of each patch is shown in Tables \ref{cr_DifferentPatches_AdienceAligned_AgeMen} and \ref{cr_DifferentPatches_AdienceAligned_AgeWomen}. For images of men, the classification rates of the $1^{st}$ and the $3^{rd}$ patch are almost the same as those of the $7^{th}$ and the $9^{th}$. However, for images of women, the classification rates of the $1^{st}$ and the $3^{rd}$ patch are about 2\% higher than those of the $7^{th}$ and the $9^{th}$. This indicates that the $1^{st}$ and the $3^{rd}$ patches, which contain the inner corners of the eyes, are more important to estimate women's age groups. \bigskip \begin{table}[h] \centering \caption{Testing age-group classification on other gender using the nine-patch method} \label{table:wrongMFtesting} \begin{tabular}{|c|c|c|} \hline & \begin{tabular}[c]{@{}c@{}}Neural network (B) (Male):\\ tested on images of women \end{tabular} & \begin{tabular}[c]{@{}c@{}}Neural network (C) (Female):\\ tested on images of men \end{tabular} \\ \hline Exact & 36.30\% & 36.15\% \\ \hline One-off & 66.82\% & 73.07\% \\ \hline \end{tabular} \end{table} \subsection{Combination of age/gender classification} We run a series of experiments to combine gender and age-group classification. Results are shown in Table \ref{table:age/genderCombined} and the process is shown in Figure~\ref{fig:CombineAgeGender}. Three sets of neural networks already trained in the previous experiments are used. The neural network (A) is responsible for gender classification and the neural networks (B) and (C) are responsible for age-group classification for men and women, respectively. Initially, every single patch is classified by gender. If the patch is recognised as a patch of men, it would be fed and classified by the neural network (B). If the patch is recognised as a patch of women, it would be fed and classified by the neural network (C). Combining age/gender classification increases the classification rates by 1.5\% and increases the one-off classification rate by 1\% approximately. \bigskip \begin{table}[h] \centering \caption{Results of combining age/gender classification} \label{table:age/genderCombined} \begin{tabular}{|c|c|c|} \hline & The nine-patch method & The combination \\ \hline Exact & 40.25\% & 41.82\% \\ \hline One off & 77.05\% & 77.98\% \\ \hline \end{tabular} \end{table} If images/patches are classified incorrectly by the neural network (A) that is responsible for gender, they would be fed into the wrong neural network to do age-group classification. To investigate the effect on the performance of this issue, we fed images of men into the neural network (C) that is responsible for female age-group classification and vice-versa. Results are shown in Table \ref{table:wrongMFtesting}. In the former case, the classification rate decreases to 36.15\%/73.07\%(one-off) and in the latter case the age-group classification rate decreases to 36.30\%/66.82\%(one-off). \bigskip To summarise, using the nine-patch method, the gender and age-group classification rates on the Adience database 3D version are 78.63\% and 40.25\% respectively, which are approximately 1\% higher than using entire images. The combination of gender/age classification increases the age-group classification rates to 41.82\% and increases the one-off classification rate to 77.98\%. The results are similar to those established without using CNN \cite{CNN}. \section{Conclusion} We have presented a modified version of local deep neural networks which significantly reduces the training time and achieves classification rates which are around 0.5-1\% lower than the original version. Additionally, the proposed method outperforms other existing methods on the LFW database, e.g. Gabor+PCA+SVM \cite{Gabor+PCA+SVM} and BoostedLBP+SVM \cite{BoostedLBP+SVM}, and achieves similar results to other methods on the Adience database without using CNNs. We have also analysed the performance of different face regions and found that the eyes region is important for gender and age classification. In addition, the mouth region is also important for age estimation. \bibliographystyle{plain}
{'timestamp': '2017-03-27T02:09:17', 'yymm': '1703', 'arxiv_id': '1703.08497', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08497'}
arxiv
\section{Introduction} A metric space is a nonempty set $M$ endowed with a metric, i.e., a function $d\colon M\times M\to[\,0,\infty\,)$ such that \begin{itemize} \item $d(x,y)=0$ if and only if $x=y$ (identity of indiscernibles), \item $d(x,y)=d(y,x)$ (symmetry), and \item $d(x,y)+d(y,z)\ge d(x,z)$ (triangle inequality) \end{itemize} for all $x$, $y$, $z\in M$~\cite{Rud76}. For all $n\in\mathbb{Z}^+$, define $[n]\equiv\{1,2,\ldots,n\}$. Given $n\in\mathbb{Z}^+$ and oracle access to a metric $d\colon [n]\times[n]\to[\,0,\infty\,)$, {\sc metric $1$-median} asks for $\mathop{\mathrm{argmin}}_{y\in[n]}\,\sum_{x\in[n]}\,d(y,x)$, breaking ties arbitrarily. It generalizes the classical median selection on the real line and has a brute-force $\Theta(n^2)$-time algorithm. More generally, {\sc metric $k$-median} asks for $c_1$, $c_2$, $\ldots$, $c_k\in[n]$ minimizing $\sum_{x\in[n]}\,\min_{i=1}^k\,d(x,c_i)$. Because $d(\cdot,\cdot)$ defines $\binom{n}{2}=\Theta(n^2)$ nonzero distances, only $o(n^2)$-time algorithms are said to run in sublinear time~\cite{Ind99}. For all $\alpha\ge1$, an $\alpha$-approximate $1$-median is a point $p\in[n]$ satisfying $$\sum_{x\in[n]}\,d\left(p,x\right)\le\alpha\cdot \min_{y\in[n]}\,\sum_{x\in[n]}\,d\left(y,x\right).$$ For all $\epsilon>0$, {\sc metric $1$-median} has a Monte Carlo $(1+\epsilon)$-approximation $O(n/\epsilon^2)$-time algorithm~\cite{Ind99, Ind00}. Guha et al.~\cite{GMMMO03} show that {\sc metric $k$-median} has a Monte Carlo, $O(\exp(O(1/\epsilon)))$-approximation, $O(nk\log n)$-time, $O(n^{\epsilon})$-space and one-pass algorithm for all small $k$ as well as a deterministic, $O(\exp(O(1/\epsilon)))$-approximation, $O(n^{1+\epsilon})$-time, $O(n^{\epsilon})$-space and one-pass algorithm. Given $n$ points in $\mathbb{R}^D$ with $D\ge 1$, the Monte Carlo algorithms of Kumar et al.~\cite{KSS10} find a $(1+\epsilon)$-approximate $1$-median in $O(D\cdot\exp(1/\epsilon^{O(1)}))$ time and a $(1+\epsilon)$-approximate solution to {\sc metric $k$-median} in $O(Dn\cdot\exp((k/\epsilon)^{O(1)}))$ time. All randomized $O(1)$-approximation algorithms for {\sc metric $k$-median} take $\Omega(nk)$ time~\cite{MP04, GMMMO03}. Chang~\cite{Cha15} shows that {\sc metric $1$-median} has a deterministic, $(2h)$-approximation, $O(hn^{1+1/h})$-time and nonadaptive algorithm for all constants $h\in\mathbb{Z}^+\setminus\{1\}$, generalizing the results of Chang~\cite{Cha13} and Wu~\cite{Wu14}. On the other hand, he disproves the existence of deterministic $(2h-\epsilon)$-approximation $O(n^{1+1/(h-1)}/h)$-time algorithms for all constants $h\in\mathbb{Z}^+\setminus\{1\}$ and $\epsilon>0$~\cite{Cha16COCOON, Cha17}. In social network analysis, the closeness centrality of a point $v$ is the reciprocal of the average distance from $v$ to all points~\cite{WF94}. So {\sc metric $1$-median} asks for a point with the maximum closeness centrality. Given oracle access to a graph metric, the Monte-Carlo algorithms of Goldreich and Ron~\cite{GR08} and Eppstein and Wang~\cite{EW04} estimate the closeness centrality of a given point and those of all points, respectively. All known sublinear-time algorithms for {\sc metric $1$-median} are either deterministic or Monte Carlo, the latter having a positive probability of failure. For example, Indyk's Monte Carlo $(1+\epsilon)$-approximation algorithm outputs with a positive probability a solution without approximation guarantees. In contrast, we show that {\sc metric $1$-median} has a randomized algorithm that {\em always} outputs a $(2+\epsilon)$-approximate solution in expected $O(n/\epsilon^2)$ time for all $\epsilon\in(0,1)$. So, excluding the known deterministic algorithms (which are Las Vegas only in the degenerate sense), this paper gives the {\em first} Las Vegas approximation algorithm for {\sc metric $1$-median} with an expected sublinear running time. Note that deterministic sublinear-time algorithms for {\sc metric $1$-median} can be $4$-approximate but not $(4-\epsilon)$-approximate for any constant $\epsilon>0$~\cite{Cha13, Cha17}. So our approximation ratio of $2+\epsilon$ beats that of any deterministic sublinear-time algorithm. Inheriting Indyk's algorithm, our algorithm outputs a $(1+\epsilon)$-approximate $1$-median in $O(n/\epsilon^2)$ time with probability $\Omega(1)$ for all $\epsilon\in(0,1)$. \comment{ In case our algorithm fails to output a $(1+\epsilon)$-approximate $1$-median, it nonetheless outputs a $(2+\epsilon)$-approximate $1$-median. \comment{ As a by-product of our derivations, we present a Monte Carlo $O(n/\epsilon^2)$-time algorithm for estimating $\sum_{u,v\in [n]}\,d(u,v)$ to within an additive error of $\epsilon\cdot\sum_{u,v\in [n]}\,d(u,v)$ with an $\Omega(1)$ probability of success, for each constant $\epsilon>0$. Previously, the best algorithm for such estimation needs $O(n/\epsilon^{7/2})$ time~\cite[Sec.~8]{Ind99}. \comment{ So we have the first Las Vegas approximation algorithm for {\sc metric $1$-median} with an expected sublinear running time. Because the best approximation ratio achievable by deterministic sublinear-time algorithms for {\sc metric $1$-median} is $4$~\cite{Cha13, Cha15}, Las Vegas approximation algorithms have a better approximation ratio. Indyk~\cite{Ind99, Ind00} gives a Monte-Carlo $O(n/\epsilon^{3.5})$-time algorithm that approximates the average distance in any metric space $([n],d)$ to within a multiplicative factor in $[\,1-\epsilon,1+\epsilon\,]$, for all $\epsilon>0$. Barhum, Goldreich and Shraibman~\cite{BGS07} improve Indyk's time complexity of $O(n/\epsilon^{3.5})$ to $O(n/\epsilon^2)$. This paper gives a Monte-Carlo $O(n/\epsilon)$-time algorithm that approximates the average distance in $([n],d)$ to within a multiplicative factor in $[\,1/2-\epsilon,1\,]$, for all $\epsilon>0$. For all $\epsilon=\omega(1/n^{1/4})$, we present a Monte-Carlo $O(n)$-time algorithm approximating the average distance of any graph metric to within a multiplicative factor in $[\,1-\epsilon,1+\epsilon\,]$. But for general metrics, we do not know whether the $O(n/\epsilon^2)$ running time of Barhum, Goldreich and Shraibman can be improved to $O(n/\epsilon^{2-\Omega(1)})$. \section{Definitions and preliminaries} For a metric space $([n],d)$, \begin{eqnarray} \bar{r}&\equiv& \frac{1}{n^2}\cdot\sum_{x,y\in[n]}\,d\left(x,y\right), \label{averagedistance}\\ p^* &\equiv& \mathop{\mathrm{argmin}}_{p\in[n]}\,\sum_{x\in [n]}\, d\left(p,x\right),\label{optimalpoint} \end{eqnarray} breaking ties arbitrarily in equation~(\ref{optimalpoint}). So $\bar{r}$ is the average distance in $([n],d)$, and $p^*$ is a $1$-median. \comment{ For brevity, $$ B^2\left(x,R\right)\equiv B\left(x,R\right)\times B\left(x,R\right). $$ The pairs in $B^2(x,R)$ are ordered. An algorithm $A$ with oracle access to $d\colon [n]\times[n]\to[\,0,\infty\,)$ is denoted by $A^d$ and may query $d$ on any $(x,y)\in[n]\times[n]$ for $d(x,y)$. In this paper, all Landau symbols (such as $O(\cdot)$, $o(\cdot)$, $\Omega(\cdot)$ and $\omega(\cdot)$) are w.r.t.\ $n$. The following result is due to Indyk. \begin{fact}[\cite{Ind99, Ind00}]\label{Indykfact} For all $\epsilon>0$, {\sc metric $1$-median} has a Monte Carlo $(1+\epsilon)$-approximation $O(n/\epsilon^2)$-time algorithm with a failure probability of at most $1/e$. \end{fact} Henceforth, denote Indyk's algorithm in Fact~\ref{Indykfact} by {\sf Indyk median}. It is given $n\in\mathbb{Z}^+$, $\epsilon>0$ and oracle access to a metric $d\colon [n]\times[n]\to[\,0,\infty\,)$. The following fact on estimating the average distance is due to Barhum, Goldreich and Shraibman. \begin{fact}[\cite{BGS07}]\label{averagedistancepriorresult} Given $n\in\mathbb{Z}^+$, $\epsilon>0$ and oracle access to a metric $d\colon[n]\times[n] \to[\,0,\infty\,)$, a real number in $\left[\,(1-\epsilon)\bar{r},(1+\epsilon)\bar{r}\,\right]$ can be found in $O(n/\epsilon^2)$ time with probability at least $1/2+\Omega(1)$. \end{fact} \comment{ \begin{fact}[Implicit in~{\cite[Theorem~22]{Cha12}}]\label{uniformlyrandompointisgood} A uniformly random point of $[n]$ is a $4$-approximate $1$-median with probability at least $1/2$. \end{fact} \comment{ \begin{markov} [\cite{MR95}] For a non-negative random variable $X$ and $a>0$, $$ \Pr \left|\, X\ge a \,\right]\le \frac{\mathop{\mathrm{E}}[X]}{a}. $$ \end{markov} \begin{chebyshev} [\cite{MR95}] Let $X$ be a random variable with a finite expected value and a finite nonzero variance. Then for all $k\ge1$, $$ \Pr\left[\, \left|\, X-\mathop{\mathrm E}[X]\,\right|\ge k\sqrt{\mathop{\mathrm{var}}(X)} \,\right]\le \frac{1}{k^2}. $$ \end{chebyshev} \section{Las Vegas approximation for metric $1$-median selection}\label{mainresultsection} \comment{ Clearly, \begin{eqnarray} \sum_{x\in[n]}\,d\left(p^*,x\right) \stackrel{\text{(\ref{optimalpoint})}}{\le} \frac{1}{n}\cdot\sum_{p\in[n]}\,\sum_{x\in[n]}\,d\left(p,x\right) \stackrel{\text{(\ref{averagedistance})}}{=} nr. \end{eqnarray} This section presents a randomized algorithm that {\em always} outputs a $(2+\epsilon)$-approximate $1$-median, where $\epsilon\in(0,1)$. Clearly, \begin{eqnarray} \sum_{x\in[n]}\,d\left(p^*,x\right) \stackrel{\text{(\ref{optimalpoint})}}{=} \min_{p\in[n]}\,\sum_{x\in[n]}\,d\left(p,x\right) \le \frac{1}{n}\cdot \sum_{p\in[n]}\,\sum_{x\in[n]}\,d\left(p,x\right) \stackrel{\text{(\ref{averagedistance})}}{=} n\bar{r}.\label{bestisnoworsethanaverage} \end{eqnarray} For each permutation $\pi\colon[n]\to[n]$, \begin{eqnarray} \sum_{i=1}^{\lfloor n/2\rfloor}\, d\left(\pi\left(2i-1\right),\pi\left(2i\right)\right) \le \sum_{i=1}^{\lfloor n/2\rfloor}\, d\left(p^*,\pi\left(2i-1\right)\right)+d\left(p^*,\pi\left(2i\right)\right) \le \sum_{x\in[n]}\,d\left(p^*,x\right), \label{matchingsizeandoptimalsumofdistances} \end{eqnarray} where the first and the second inequalities follow from the triangle inequality and the injectivity of $\pi$. \begin{lemma}\label{lemmaforapproximationratio} When line~5 of {\sf Las Vegas median} in Fig.~\ref{lasvegasalgorithm} is run, $z$ is a $(2+\epsilon)$-approximate $1$-median. \comment{ For all $y\in[n]$ and permutations $\pi$, if $$ \sum_{x\in[n]}\,d\left(y,x\right) \le \left(2+\epsilon\right) \sum_{i=1}^{\lfloor n/2\rfloor}\, d\left(\pi\left(2i-1\right),\pi\left(2i\right)\right), $$ then $y$ is a $(2+\epsilon)$-approximate $1$-median. \end{lemma} \begin{proof} The condition in line~4 of {\sf Las Vegas median} implies $$ \sum_{x\in[n]}\, d\left(z,x\right) \stackrel{\text{(\ref{matchingsizeandoptimalsumofdistances})}}{\leq} \left(2+\epsilon\right) \sum_{x\in[n]}\, d\left(p^*,x\right) \stackrel{\text{(\ref{optimalpoint})}}{=} \left(2+\epsilon\right) \min_{p\in[n]}\,\sum_{x\in[n]}\, d\left(p,x\right). $$ So when line~5 is run, it returns a $(2+\epsilon)$-approximate $1$-median. \end{proof} \begin{figure} \begin{algorithmic}[1] \WHILE{\text{\sf true}} \STATE $z\leftarrow\text{\sf Indyk median}^d(n,\epsilon/8)$; \STATE Pick independent and uniformly random permutations $\bs{\pi}_1$, $\bs{\pi}_2$, $\ldots$, $\bs{\pi}_{80\lceil 1/\epsilon\rceil}\colon[n]\to[n]$; \IF{there exists $j\in[\lceil 1/\epsilon\rceil]$ satisfying $\sum_{x\in[n]}\,d(z,x)\le (2+\epsilon)\sum_{i=1}^{\lfloor n/2\rfloor}\,d(\bs{\pi}_j(2i-1),\bs{\pi}_j(2i))$} \RETURN $z$; \ENDIF \ENDWHILE \end{algorithmic} \caption{Algorithm {\sf Las Vegas median} with oracle access to a metric $d\colon [n]\times[n]\to[\,0,\infty\,)$ and with inputs $n\in\mathbb{Z}^+$ and $\epsilon\in(0,1)$} \label{lasvegasalgorithm} \end{figure} Inequalities~(\ref{bestisnoworsethanaverage})--(\ref{matchingsizeandoptimalsumofdistances}) yield the following. \begin{lemma}\label{maximummatchingsize} For each permutation $\pi\colon[n]\to[n]$, $$ \sum_{i=1}^{\lfloor n/2\rfloor}\, d\left(\pi\left(2i-1\right),\pi\left(2i\right)\right) \le n\bar{r}. $$ \end{lemma} \comment{ \begin{proof} We have \begin{eqnarray*} \sum_{i=1}^{\lfloor n/2\rfloor}\, d\left(\pi\left(2i-1\right),\pi\left(2i\right)\right) \stackrel{\text{(\ref{optimalpoint})--(\ref{matchingsizeandoptimalsumofdistances})}}{\le} \frac{1}{n}\cdot\sum_{p\in[n]}\,\sum_{x\in[n]}\,d\left(p,x\right) \stackrel{\text{(\ref{averagedistance})}}{=} nr. \end{eqnarray*} \end{proof} \begin{lemma}\label{expectedmatchingsize} For a uniformly random permutation $\bs{\pi}\colon [n]\to[n]$, $$ \mathop{\mathrm{E}}_{\bs{\pi}} \left[\,\sum_{i=1}^{\lfloor n/2\rfloor}\, d\left(\bs{\pi}\left(2i-1\right),\bs{\pi}\left(2i\right)\right) \right] =\left\lfloor\frac{n}{2}\right\rfloor\cdot\frac{n\bar{r}}{n-1}. $$ \end{lemma} \begin{proof} For each $i\in[\lfloor n/2\rfloor]$, $\{\bs{\pi}(2i-1),\bs{\pi}(2i)\}$ is a uniformly random size-$2$ subset of $[n]$, implying \begin{eqnarray*} \mathop{\mathrm{E}}_{\bs{\pi}} \left[\, d\left(\bs{\pi}\left(2i-1\right),\bs{\pi}\left(2i\right)\right) \right] &=&\frac{1}{n\cdot(n-1)}\cdot\sum_{\text{distinct $x$, $y\in[n]$}}\, d\left(x,y\right)\\ &=&\frac{1}{n\cdot(n-1)}\cdot\sum_{x,y\in[n]}\,d\left(x,y\right)\\ &\stackrel{\text{(\ref{averagedistance})}}{=}& \frac{n\bar{r}}{n-1}, \end{eqnarray*} where the second equality follows from the identity of indiscernibles. Finally, use the linearity of expectation. \end{proof} \comment{ \begin{lemma}\label{probabilitythatarandommatchingislarge} For a uniformly random permutation $\bs{\pi}\colon [n]\to[n]$ and all sufficiently large $n$, \begin{eqnarray} \Pr_{\bs{\pi}} \left[\,\sum_{i=1}^{\lfloor n/2\rfloor}\, d\left(\bs{\pi}\left(2i-1\right),\bs{\pi}\left(2i\right)\right) \ge\left(\frac{1}{2}-\frac{\epsilon}{8}\right)nr \right] \ge \frac{\epsilon}{8}. \label{probabilityofasmallmatching} \end{eqnarray} \end{lemma} \begin{proof} Denote the left-hand side of inequality~(\ref{probabilityofasmallmatching}) by $p$. Then by Lemma~\ref{maximummatchingsize}, $$ \mathop{\mathrm{E}}_{\bs{\pi}} \left[\, \sum_{i=1}^{\lfloor n/2\rfloor}\, d\left(\bs{\pi}\left(2i-1\right),\bs{\pi}\left(2i\right)\right) \,\right] \le p nr + \left(1-p\right)\left(\frac{1}{2}-\frac{\epsilon}{8}\right)nr. $$ This and Lemma~\ref{expectedmatchingsize} complete the proof. \end{proof} \begin{lemma}\label{probabilitythatoneoftherandommatchingsislarge} For all $\epsilon\in(0,1)$ and in each iteration of the {\bf while} loop of {\sf Las Vegas median}, \begin{eqnarray} \Pr \left[\, \exists j\in\left[80\cdot\left\lceil\frac{1}{\epsilon}\right\rceil\right],\, \sum_{i=1}^{\lfloor n/2\rfloor}\, d\left(\bs{\pi}_j\left(2i-1\right),\bs{\pi}_j\left(2i\right)\right) \ge\left(\frac{1}{2}-\frac{\epsilon}{8}\right)n\bar{r} \right] \ge0.9, \label{probabilityofalargematching} \end{eqnarray} where the probability is taken over $\bs{\pi}_1$, $\bs{\pi}_2$, $\ldots$, $\bs{\pi}_{80\lceil 1/\epsilon\rceil}$ in line~3 of {\sf Las Vegas median}. \end{lemma} \begin{proof} Let $\bs{\pi}\colon[n]\to[n]$ be a uniformly random permutation and \begin{eqnarray} \alpha=\Pr_{\bs{\pi}} \left[\,\sum_{i=1}^{\lfloor n/2\rfloor}\, d\left(\bs{\pi}\left(2i-1\right),\bs{\pi}\left(2i\right)\right) \ge\left(\frac{1}{2}-\frac{\epsilon}{8}\right)n\bar{r} \right]. \end{eqnarray} So by Lemma~\ref{maximummatchingsize}, $$ \mathop{\mathrm{E}}_{\bs{\pi}} \left[\, \sum_{i=1}^{\lfloor n/2\rfloor}\, d\left(\bs{\pi}\left(2i-1\right),\bs{\pi}\left(2i\right)\right) \,\right] \le \alpha n\bar{r} + \left(1-\alpha\right)\left(\frac{1}{2}-\frac{\epsilon}{8}\right) n\bar{r}. $$ This and Lemma~\ref{expectedmatchingsize} imply $\alpha\ge \epsilon/8$. So the left-hand side of inequality~(\ref{probabilityofalargematching}) is at least $1-(1-\epsilon/8)^{80\lceil 1/\epsilon\rceil}\ge0.9$. \end{proof} \comment{ \begin{lemma} For each $y\in[n]$ and a uniformly random permutation $\bs{\pi}$, if $$ \sum_{x\in[n]}\,d\left(y,x\right) \le \left(2+\epsilon\right) \sum_{i=1}^{\lfloor n/2\rfloor}\, d\left(\bs{\pi}\left(2i-1\right),\bs{\pi}\left(2i\right)\right), $$ then $y$ is a $(2+\epsilon)$-approximate $1$-median. \end{lemma} \comment{ For all $y\in[n]$, $$\sum_{x\in[n]}\,d\left(y,x\right) \ge \sum_{i=1}^{\lfloor n/2\rfloor}\, d\left(y,\bs{\pi}\left(2i-1\right)\right) +d\left(y,\bs{\pi}\left(2i\right)\right) \ge \sum_{i=1}^{\lfloor n/2\rfloor}\, d\left(\bs{\pi}\left(2i-1\right), \bs{\pi}\left(2i\right)\right), $$ where the first and the second inequalities follow from the injectivity of $\bs{\pi}$ and the triangle inequality. So inequalities~(\ref{qualityofanearoptimalsolution})--(\ref{lowerboundofarandommatchingsize}) imply the approximation ratio of $z$ to be at most $$ \frac{1+\epsilon/8}{} $$ \comment{ \begin{lemma}\label{probabilitythatIndykalgorithmgivesagoodsolution} In each execution of line~2 of {\sf Las Vegas median}, $$ \Pr\left[\, \sum_{x\in[n]}\,d\left(z,x\right) \le \left(1+\frac{\epsilon}{8}\right) nr \,\right] =\Omega(1), $$ where the probability is taken over the random coin tosses of {\sf Indyk median}. \end{lemma} \begin{proof} By Fact~\ref{Indykfact}, $$ \Pr\left[\, \sum_{x\in[n]}\,d\left(z,x\right) \le \left(1+\frac{\epsilon}{8}\right) \sum_{x\in[n]}\,d\left(p^*,x\right) \,\right] =\Omega(1). $$ This and inequality~(\ref{bestisnoworsethanaverage}) complete the proof. \end{proof} \begin{lemma}\label{probabilitythatIndykalgorithmisgoodandmatchingislarge} For all $\epsilon\in(0,1)$ and in each iteration of the {\bf while} loop of {\sf Las Vegas median}, \begin{eqnarray} &&\Pr\left[\, \left( \sum_{x\in[n]}\,d\left(z,x\right) \le \left(1+\frac{\epsilon}{8}\right) \min_{p\in[n]}\,\sum_{x\in[n]}\,d\left(p,x\right) \right)\right.\nonumber\\ &&\left. \land\left( \exists j\in\left[80\cdot\left\lceil\frac{1}{\epsilon}\right\rceil\right],\, \sum_{i=1}^{\lfloor n/2\rfloor}\, d\left(\bs{\pi}_j\left(2i-1\right),\bs{\pi}_j\left(2i\right)\right) \ge \left(\frac{1}{2}-\frac{\epsilon}{8}\right)n\bar{r} \right) \right.\nonumber\\ &&\left. \land \left(\exists j\in\left[80\cdot\left\lceil\frac{1}{\epsilon}\right\rceil\right],\, \sum_{x\in[n]}\,d\left(z,x\right) \le \left(2+\epsilon\right)\sum_{i=1}^{\lfloor n/2\rfloor}\, d\left(\bs{\pi}_j\left(2i-1\right),\bs{\pi}_j\left(2i\right)\right) \right) \,\right]\nonumber\\ &=&\frac{1}{2}+\Omega(1),\label{ultimateequation} \end{eqnarray} where the probability is taken over $\bs{\pi}_1$, $\bs{\pi}_2$, $\ldots$, $\bs{\pi}_{80\lceil 1/\epsilon\rceil}$ and the random coin tosses of {\sf Indyk median}. \end{lemma} \begin{proof} By Fact~\ref{Indykfact} and line~2 of {\sf Las Vegas median}, the first condition within $\Pr[\cdot]$ in equation~(\ref{ultimateequation}) holds with probability at least $1-1/e$ over the random coin tosses of {\sf Indyk median}. By Lemma~\ref{probabilitythatoneoftherandommatchingsislarge}, \comment{ \begin{eqnarray*} \sum_{x\in[n]}\,d\left(z,x\right) &\le& \left(1+\frac{\epsilon}{8}\right) nr,\\ \exists j\in\left[\frac{1}{\epsilon}\right],\, \sum_{i=1}^{\lfloor n/2\rfloor}\, d\left(\bs{\pi}_j\left(2i-1\right),\bs{\pi}_j\left(2i\right)\right) &\ge& \left(\frac{1}{2}-\frac{\epsilon}{8}\right)nr \end{eqnarray*} the second condition holds with probability at least $0.9$ over $\bs{\pi}_1$, $\bs{\pi}_2$, $\ldots$, $\bs{\pi}_{80\lceil 1/\epsilon\rceil}$. In summary, the first two conditions hold simultaneously with probability at least $(1-1/e)\cdot 0.9=1/2+\Omega(1)$ (note that the random coin tosses of {\sf Indyk median} are independent of $\bs{\pi}_1$, $\bs{\pi}_2$, $\ldots$, $\bs{\pi}_{80\lceil 1/\epsilon\rceil}$). Finally, the first two conditions together imply the third by inequality~(\ref{bestisnoworsethanaverage}) and the easy fact that $$ \left(1+\frac{\epsilon}{8}\right)\le\left(2+\epsilon\right) \left(\frac{1}{2}-\frac{\epsilon}{8}\right). $$ \end{proof} \comment{ \begin{proof} By Fact~\ref{Indykfact}, $$ \Pr\left[\, \sum_{x\in[n]}\,d\left(z,x\right) \le \left(1+\frac{\epsilon}{8}\right) \sum_{x\in[n]}\,d\left(p^*,x\right) \,\right] =\Omega(1), $$ where the probability is taken over the random coin tosses of {\sf Indyk median}. This and inequality~(\ref{bestisnoworsethanaverage}) give $$ \Pr\left[\, \sum_{x\in[n]}\,d\left(z,x\right) \le \left(1+\frac{\epsilon}{8}\right) nr \,\right] =\Omega(1), $$ which together with Lemma~\ref{probabilitythatarandommatchingislarge} completes the proof (note that $\bs{\pi}$ is independent of the random coin tosses of {\sf Indyk median}). \end{proof} \begin{theorem}\label{maintheorem} For all $\epsilon\in(0,1)$, {\sc metric $1$-median} has a randomized algorithm that (1)~{\em always} outputs a $(2+\epsilon)$-approximate solution in expected $O(n/\epsilon^2)$ time and (2)~outputs a $(1+\epsilon)$-approximate solution in $O(n/\epsilon^2)$ time with probability $\Omega(1)$. \end{theorem} \begin{proof} By Lemma~\ref{probabilitythatIndykalgorithmisgoodandmatchingislarge}, each execution of lines~4--5 of {\sf Las Vegas median} returns with probability $1/2+\Omega(1)$. So the expected number of iterations is $O(1)$. By Fact~\ref{Indykfact}, line~2 takes $O(n/\epsilon^2)$ time. Line~3 takes $80\lceil 1/\epsilon\rceil\cdot O(n)$ time by the Knuth shuffle. Clearly, lines~4--5 take $O(n/\epsilon)$ time. In summary, the expected running time of {\sf Las Vegas median} is $O(1)\cdot O(n/\epsilon^2)=O(n/\epsilon^2)$. To prevent {\sf Las Vegas median} from running forever, find a $1$-median by brute force (which obviously takes $O(n^2)$ time) after $n^2$ steps of computation. By Lemma~\ref{lemmaforapproximationratio}, {\sf Las Vegas median} is $(2+\epsilon)$-approximate. By Lemma~\ref{probabilitythatIndykalgorithmisgoodandmatchingislarge}, $z$ is $(1+\epsilon/8)$-approximate and is also returned in line~5 with probability $\Omega(1)$ in the first (in fact, any) iteration. Finally, the previous paragraph has shown each iteration to take $O(n/\epsilon^2)$ time. \end{proof} \comment{ \begin{eqnarray} \sum_{x\in[n]}\,d\left(z,x\right) &\le& \left(1+\frac{\epsilon}{8}\right) nr,\label{qualityofanearoptimalsolution}\\ \sum_{i=1}^{\lfloor n/2\rfloor}\, d\left(\bs{\pi}\left(2i-1\right),\bs{\pi}\left(2i\right)\right) &\ge& \left(\frac{1}{2}-\frac{\epsilon}{8}\right)nr, \label{lowerboundofarandommatchingsize} \end{eqnarray} By Fact~\ref{Indykfact}, {\sf Indyk median} satisfies condition~(2) in Theorem~\ref{maintheorem}. But it does not satisfy condition~(1). We now justify the optimality of the ratio of $2+\epsilon$ in Theorem~\ref{maintheorem}. Let $A$ be a randomized algorithm that always outputs a $(2-\epsilon)$-approximate $1$-median. Furthermore, denote by $p\in [n]$ (resp., $Q\subseteq [n]\times [n]$) the output (resp., the set of queries as unordered pairs) of $A^{d_1}(n)$, where $d_1$ is the discrete metric (i.e., $d_1(x,y)=1$ and $d_1(x,x)=0$ for all distinct $x$, $y\in [n]$). Without loss of generality, assume $(p,y)\in Q$ for all $y\in [n]\setminus\{p\}$ by adding dummy queries. So the queries in $Q$ witness that \begin{eqnarray} \sum_{y\in [n]\setminus\{p\}}\,d_1\left(p,y\right)=n-1. \label{outputunderthediscretemetric} \end{eqnarray} Assume without loss of generality that $A$ never queries for the distance from a point to itself. In the sequel, consider the case that $|Q|<\epsilon\cdot(n-1)^2/8$. By the averaging argument, there exists a point $\hat{p}\in [n]\setminus \{p\}$ involved in at most $2\cdot|Q|/(n-1)$ queries in $Q$ (note that each query involves two points). Because every function $f\colon [n]\times[n]\to[\,0,\infty\,)$ with $$\left\{f\left(x,y\right)\mid \left(x,y\in[n]\right)\land\left( x\neq y\right)\right\}\subseteq\left\{\frac{1}{2},1\right\}$$ satisfies the triangle inequality, $A$ cannot exclude the possibility that $d_1(\hat{p},y)=1/2$ for all $y\in[n]\setminus\{\hat{p}\}$ satisfying $(\hat{p},y)\notin Q$. In summary, $A$ cannot rule out the case that \begin{eqnarray} \sum_{y\in[n]}\,d_1\left(\hat{p},y\right)&\le& \frac{2\cdot |Q|}{n-1}\cdot 1 +\left(n-1-\frac{2\cdot |Q|}{n-1}\right)\cdot \frac{1}{2} < \left(\frac{1}{2}+\frac{\epsilon}{8}\right)\cdot(n-1).\,\,\,\,\, \label{acasethatcannotberuledout} \end{eqnarray} Equations~(\ref{outputunderthediscretemetric})--(\ref{acasethatcannotberuledout}) contradict the guarantee that $p$ is $(2-\epsilon)$-approximate. Consequently, the case that $|Q|<\epsilon\cdot(n-1)^2/8$ should {\em never} happen. The next theorem summarizes the above. \begin{theorem} {\sc Metric $1$-median} has no randomized algorithm that always outputs a $(2-\epsilon)$-approximate solution and that makes fewer than $\epsilon\cdot (n-1)^2/8$ queries with a positive probability given oracle access to the discrete metric, for any constant $\epsilon\in(0,1)$. \end{theorem} Lemmas~\ref{maximummatchingsize}~and~\ref{probabilitythatoneoftherandommatchingsislarge} yield the following estimation of the average distance. \begin{theorem}\label{theoremforaveragedistance} Given $n\in\mathbb{Z}^+$, $\epsilon>0$ and oracle access to a metric $d\colon[n]\times[n]\to[\,0,\infty\,)$, a real number in $[\,(1/2-\epsilon)\bar{r},\bar{r}\,]$ can be found in $O(n/\epsilon)$ time with probability $1/2+\Omega(1)$. \end{theorem} \begin{proof} By Lemmas~\ref{maximummatchingsize}~and~\ref{probabilitythatoneoftherandommatchingsislarge}, \begin{eqnarray} \frac{1}{n}\cdot \max_{j\in[80\cdot\lceil 1/\epsilon\rceil]}\, \sum_{i=1}^{\lfloor n/2\rfloor}\,d\left(\bs{\pi}_j\left(2i-1\right), \bs{\pi}_j\left(2i\right)\right) \in\left[\,\left(\frac{1}{2}-\frac{\epsilon}{8}\right)\bar{r}, \bar{r}\,\right] \label{rangeofestimationofaveragedistance} \end{eqnarray} with probability $1/2+\Omega(1)$. The Knuth shuffle picks $\bs{\pi}_1$, $\bs{\pi}_2$, $\ldots$, $\bs{\pi}_{80\lceil 1/\epsilon\rceil}$ in $80\lceil 1/\epsilon\rceil\cdot O(n)$ time. Then the left-hand side of relation~(\ref{rangeofestimationofaveragedistance}) can be calculated in $O(n/\epsilon)$ time. \end{proof} Note that the estimation of the average distance in Theorem~\ref{theoremforaveragedistance} has only one-sided error. The time complexity (resp., approximation ratio) in Theorem~\ref{theoremforaveragedistance} is better (resp., worse) than that in Fact~\ref{averagedistancepriorresult}. \comment{ But we do not know whether the time complexity in Theorem~\ref{theoremforaveragedistance} and the approximation ratio in Fact~\ref{averagedistancepriorresult} can be achieved simultaneously. \section{Estimating the average distance of a graph metric}\label{approximationratiosection} Throughout this section, take any $\epsilon=\omega(1/n^{1/4})$ less than a small constant, e.g., $\epsilon=10^{-100}$. Define \begin{eqnarray} \delta&\equiv& \frac{\epsilon^2}{10^{10}},\label{thedeltavalue}\\ r&\equiv&\frac{1}{n}\cdot\sum_{x\in[n]}\,d\left(p^*,x\right), \label{theaveragedistancefromanoptimalpoint} \end{eqnarray} where $p^*$ is as in equation~(\ref{optimalpoint}). As $\epsilon=\omega(1/n^{1/4})$, $\delta=\omega(1/\sqrt{n})$ by equation~(\ref{thedeltavalue}). \comment{ By line~1 of {\sf average distance} in Fig.~\ref{mainalgorithm}, $\delta>0$ is likewise small, and $\delta=1/n^{o(1)}$. Furthermore, take $\bs{u}$, $r$ and $\bs{\pi}$ as in lines~2--4 of {\sf average distance}. \comment{ The following lemma implies that $z$ in line~3 of {\sf Las Vegas median} is a solution (to {\sc metric $1$-median}) no worse than those in $[n]\setminus B(z,8r)$, where $r$ is as in line~4. \comment{ This section analyzes the probability of running line~7 in any particular iteration of the {\bf while} loop of {\sf Las Vegas median}. The following lemma uses an easy averaging argument. \comment{ Assume $n$ to be sufficiently large so that $|B(z,\delta nr)|\ge 4$ by Lemma~\ref{thesmallradiusballislarge}. \comment{ Define \begin{eqnarray} r' \equiv \frac{1}{|B(z,\delta nr)|^2} \cdot \sum_{u, v\in B(z,\delta nr)}\, d\left(u,v\right) \label{smallerballaveragedefinition} \end{eqnarray} to be the average distance in $B(z,\delta nr)$. \comment{ As $z\in B(z,\delta nr)$, the denominator in the right-hand side of equation~(\ref{smallerballaveragedefinition}) is nonzero. \begin{lemma}\label{inneraverageandoverallaverage} $\bar{r}\leq 2r$. \end{lemma} \begin{proof} By equation~(\ref{averagedistance}) and the triangle inequality, \begin{eqnarray} \bar{r} &\le& \frac{1}{n^2} \cdot \sum_{x, y\in [n]}\, \left(d\left(p^*,x\right)+d\left(p^*,y\right)\right) \nonumber\\ &=& \frac{1}{n^2} \cdot n\cdot\left( \sum_{x\in [n]}\, d\left(p^*,x\right) +\sum_{y\in [n]}\, d\left(p^*,y\right) \right)\nonumber\\ &=& \frac{2}{n} \cdot \sum_{x\in [n]}\, d\left(p^*,x\right). \label{needanumberhere} \end{eqnarray} Equations~(\ref{theaveragedistancefromanoptimalpoint})--(\ref{needanumberhere}) complete the proof. \end{proof} \begin{figure} \begin{algorithmic}[1] \STATE Pick a uniformly random permutation $\bs{\pi}\colon [n]\to [n]$; \RETURN $\sum_{i=1}^{\lfloor n/2\rfloor}\,d(\bs{\pi}(2i-1),\bs{\pi}(2i))\cdot 2/n$; \end{algorithmic} \caption{Algorithm {\sf average distance} with oracle access to a metric $d\colon [n]\times[n]\to[\,0,\infty\,)$ and with inputs $n\in\mathbb{Z}^+$ and $\epsilon=\omega(1/n^{1/4})$.} \label{mainalgorithm} \end{figure} As in line~1 of {\sf average distance} in Fig.~\ref{mainalgorithm}, let $\bs{\pi}\colon[n]\to[n]$ be a uniformly random permutation. Clearly, \begin{eqnarray} &&\mathop{\mathrm E}_{\bs{\pi}}\left[\, \left(\sum_{i=1}^{\lfloor n/2\rfloor}\, d\left(\bs{\pi}\left(2i-1\right),\bs{\pi}\left(2i\right)\right)\right)^2 \,\right] \label{startofthemeanofsquare}\\ &=& \mathop{\mathrm E}_{\bs{\pi}}\left[\, \sum_{i=1}^{\lfloor n/2\rfloor}\, d\left(\bs{\pi}\left(2i-1\right),\bs{\pi}\left(2i\right)\right) \cdot \sum_{j=1}^{\lfloor n/2\rfloor}\, d\left(\bs{\pi}\left(2j-1\right),\bs{\pi}\left(2j\right)\right) \,\right]\nonumber\\ &=& \sum_{\text{distinct $i,j=1$}}^{\lfloor n/2\rfloor}\, \mathop{\mathrm E}_{\bs{\pi}}\left[\, d\left(\bs{\pi}\left(2i-1\right),\bs{\pi}\left(2i\right)\right) \cdot d\left(\bs{\pi}\left(2j-1\right),\bs{\pi}\left(2j\right)\right) \,\right]\nonumber\\ &+& \sum_{i=1}^{\lfloor n/2\rfloor}\, \mathop{\mathrm E}_{\bs{\pi}}\left[\, d^2\left(\bs{\pi}\left(2i-1\right),\bs{\pi}\left(2i\right)\right) \,\right],\label{endofthemeanofsquare} \end{eqnarray} where the last equality follows from the linearity of expectation and the separation of pairs $(i,j)$ according to whether $i=j$. The next three lemmas analyze the variance of $$ \sum_{i=1}^{\lfloor n/2\rfloor}\, d\left(\bs{\pi}\left(2i-1\right),\bs{\pi}\left(2i\right)\right). $$ \begin{lemma}\label{distinctdistancesproduct} {\small \begin{eqnarray*} \sum_{\text{\rm distinct $i,j=1$}}^{\lfloor n/2\rfloor}\, \mathop{\mathrm E}_{\bs{\pi}}\left[\, d\left(\bs{\pi}\left(2i-1\right),\bs{\pi}\left(2i\right)\right) \cdot d\left(\bs{\pi}\left(2j-1\right),\bs{\pi}\left(2j\right)\right) \,\right] \le\frac{1}{4}\cdot \left(1 + O\left(\frac{1}{n}\right) \right)n^2 \bar{r}^2. \end{eqnarray*} \end{lemma} \begin{proof} Pick any distinct $i$, $j\in[\,\lfloor n/2\rfloor\,]$. Clearly, $$\left\{\bs{\pi}\left(2i-1\right), \bs{\pi}\left(2i\right), \bs{\pi}\left(2j-1\right), \bs{\pi}\left(2j\right)\right\}$$ is a uniformly random size-$4$ subset of $[n]$. So \begin{eqnarray*} &&\mathop{\mathrm E}_{\bs{\pi}}\left[\, d\left(\bs{\pi}(2i-1),\bs{\pi}(2i)\right) \cdot d\left(\bs{\pi}(2j-1),\bs{\pi}(2j)\right) \,\right]\\ &=& \frac{1}{n \cdot(n-1)\cdot(n-2) \cdot(n-3)} \cdot \sum_{\text{distinct $u$, $v$, $x$, $y\in [n]$}}\, d\left(u,v\right)\cdot d\left(x,y\right). \end{eqnarray*} Clearly, \begin{eqnarray*} \sum_{\text{distinct $u$, $v$, $x$, $y\in [n]$}}\, d\left(u,v\right)\cdot d\left(x,y\right) &\le& \sum_{u, v, x, y\in [n]}\, d\left(u,v\right)\cdot d\left(x,y\right)\\ &=& \sum_{u, v\in [n]}\, d\left(u,v\right) \cdot \sum_{x, y\in [n]}\, d\left(x,y\right)\\ &=& \left(\sum_{x, y\in [n]}\, d\left(x,y\right) \right)^2. \end{eqnarray*} In summary, \begin{eqnarray*} && \sum_{\text{\rm distinct $i,j=1$}}^{\lfloor n/2\rfloor}\, \mathop{\mathrm E}_{\bs{\pi}}\left[\, d\left(\bs{\pi}\left(2i-1\right),\bs{\pi}\left(2i\right)\right) \cdot d\left(\bs{\pi}\left(2j-1\right),\bs{\pi}\left(2j\right)\right) \,\right]\\ &\le& \left\lfloor\frac{n}{2}\right\rfloor \left(\left\lfloor\frac{n}{2}\right\rfloor-1\right) \cdot \frac{1}{n \cdot(n-1)\cdot(n-2) \cdot(n-3)} \cdot \left( \sum_{x, y\in [n]}\, d\left(x,y\right) \right)^2. \end{eqnarray*} This and equation~(\ref{averagedistance}) complete the proof. \end{proof} \comment{ Lemmas~\ref{thesmallradiusballislarge}~and~\ref{distinctdistancesproduct} and equation~(\ref{smallerballaveragedefinition}) yield the following. \begin{lemma} \begin{eqnarray*} \sum_{\text{\rm distinct $i,j=1$}}^{|B(z,\delta nr)|/2}\, \mathop{\mathrm E}\left[\, d\left(\pi(2i-1),\pi(2i)\right) \cdot d\left(\pi(2j-1),\pi(2j)\right) \,\right] =\frac{1}{4}\cdot n^2\left(r'\right)^2\left(1\pm o(1)\right). \end{eqnarray*} \end{lemma} Define $$ \Delta\equiv\max_{x,y\in[n]}\,d(x,y) $$ to be the diameter of $([n],d)$. \begin{lemma}\label{thehardestparttoboundlemma} If \begin{eqnarray} \delta nr \ge \Delta \label{shallhaveanequationnumberfortheballequalsuniversething} \end{eqnarray} then \begin{eqnarray} \sum_{i=1}^{\lfloor n/2\rfloor}\, \mathop{\mathrm E}_{\bs{\pi}}\left[\, d^2\left(\bs{\pi}\left(2i-1\right),\bs{\pi}\left(2i\right)\right) \,\right] \le \left(\frac{1}{2}+ O\left(\frac{1}{n}\right) \right)\left(\delta n^2r\bar{r}+\delta^2 n r^2\right). \label{boundforthedistancesquaressummed} \end{eqnarray} \end{lemma} \begin{proof} Clearly, $\{\bs{\pi}(2i-1),\bs{\pi}(2i)\}$ is a uniformly random size-$2$ subset of $[n]$ for each $i\in[\,\lfloor n/2\rfloor\,]$. Therefore, \begin{eqnarray} \sum_{i=1}^{\lfloor n/2\rfloor}\, \mathop{\mathrm E}_{\bs{\pi}}\left[\, d^2\left(\bs{\pi}\left(2i-1\right),\bs{\pi}\left(2i\right)\right) \,\right] &=&\sum_{i=1}^{\lfloor n/2\rfloor}\, \frac{1}{n\cdot(n-1)} \cdot \sum_{\text{distinct $x$, $y\in [n]$}}\,d^2\left(x,y\right) \,\,\,\,\,\,\, \label{startofobjective}\\ &\le&\sum_{i=1}^{\lfloor n/2\rfloor}\, \frac{1}{n\cdot(n-1)} \cdot \sum_{x, y\in [n]}\,d^2\left(x,y\right) \nonumber\\ &=&\left\lfloor\frac{n}{2}\right\rfloor\cdot \frac{1}{n\cdot(n-1)} \cdot \sum_{x, y\in [n]}\,d^2\left(x,y\right). \nonumber \end{eqnarray} By inequality~(\ref{shallhaveanequationnumberfortheballequalsuniversething}), \begin{eqnarray} d\left(x,y\right) \le \delta nr \label{constraint} \end{eqnarray} for all $x$, $y\in [n]$. By equations~(\ref{averagedistance})~and~(\ref{startofobjective})--(\ref{constraint}), the left-hand side of inequality~(\ref{boundforthedistancesquaressummed}) cannot exceed the optimal value of the following problem, called {\sc max square sum}:\\ \begin{quote} Find $d_{x,y}\in \mathbb{R}$ for all $x$, $y\in [n]$ to maximize \begin{eqnarray} \left\lfloor\frac{n}{2}\right\rfloor\cdot \frac{1}{n\cdot(n-1)} \cdot \sum_{x, y\in [n]}\,d_{x,y}^2 \label{objectiveofoptimization} \end{eqnarray} subject to \begin{eqnarray} \frac{1}{n^2}\cdot \sum_{x,y\in [n]}\, d_{x,y} = \bar{r},\label{averagedistanceconstraint}\\ \forall x, y\in [n],\,\, 0\le d_{x,y} \le \delta nr.\label{largestdistanceconstraint} \end{eqnarray} \end{quote} Above, constraint~(\ref{averagedistanceconstraint}) (resp., (\ref{largestdistanceconstraint})) mimics equation~(\ref{averagedistance}) (resp., inequality~(\ref{constraint}) and the non-negativeness of distances). Appendix~\ref{analyzingthemaximizationproblem} bounds the optimal value of {\sc max square sum} from above by \begin{eqnarray} \left\lfloor\frac{n}{2}\right\rfloor \frac{1}{n\cdot(n-1)} \cdot \left(\left\lfloor\frac{n \bar{r}}{\delta r}\right\rfloor+1\right) \cdot \left(\delta nr\right)^2. \nonumber \end{eqnarray} This evaluates to be at most $$\left(\frac{1}{2}+O\left(\frac{1}{n}\right)\right) \left(\delta n^2 r\bar{r}+\delta^2 n r^2\right).$$ \comment{ Finally, $$\left(1\pm o(1)\right)\delta n^2 rr'\le 2\left(1+o(1)\right)\delta n^2 r^2$$ by Lemma~\ref{inneraverageandoverallaverage}. \end{proof} Recall that the variance of any random variable $X$ equals $\mathop{\mathrm E}[X^2]-(\mathop{\mathrm E}[X])^2$. \begin{lemma}\label{boundonthevarianceofthelengthofthematching} If $\delta nr\ge \Delta$, then $$ \mathop{\mathrm{var}}_{\bs{\pi}}\left( \sum_{i=1}^{\lfloor n/2\rfloor}\, d\left(\bs{\pi}\left(2i-1\right),\bs{\pi}\left(2i\right)\right) \right) \le \left(1+ o(1) \right)\delta n^2 r^2. $$ \end{lemma} \begin{proof} By equations~(\ref{startofthemeanofsquare})--(\ref{endofthemeanofsquare}) and Lemmas~\ref{distinctdistancesproduct}--\ref{thehardestparttoboundlemma}, \begin{eqnarray*} &&\mathop{\mathrm E}_{\bs{\pi}}\left[\, \left(\sum_{i=1}^{\lfloor n/2\rfloor}\, d\left(\bs{\pi}\left(2i-1\right),\bs{\pi}\left(2i\right)\right)\right)^2 \,\right]\\ &\le& \frac{1}{4}\cdot \left(1 + O\left(\frac{1}{n}\right) \right) n^2 \bar{r}^2 +\left( \frac{1}{2} + O\left(\frac{1}{n}\right) \right)\left(\delta n^2 r\bar{r}+\delta^2 nr^2\right). \end{eqnarray*} This and Lemma~\ref{expectedmatchingsize} imply \begin{eqnarray*} &&\mathop{\mathrm{var}}_{\bs{\pi}}\left( \sum_{i=1}^{\lfloor n/2\rfloor}\, d\left(\bs{\pi}\left(2i-1\right),\bs{\pi}\left(2i\right)\right) \right)\\ &\le& O\left(\frac{1}{n}\right) \cdot n^2 \bar{r}^2 +\left( \frac{1}{2} + O\left(\frac{1}{n}\right) \right)\left(\delta n^2 r\bar{r}+\delta^2 nr^2\right). \end{eqnarray*} Finally, invoke Lemma~\ref{inneraverageandoverallaverage} and recall that $\delta=\omega(1/\sqrt{n})$. \end{proof} \begin{lemma}\label{randommatchingconcentrationlemma} If $\delta nr \ge \Delta$, then {\small \begin{eqnarray*} \Pr_{\bs{\pi}}\left[ \, \left| \, \left( \sum_{i=1}^{\lfloor n/2\rfloor} d\left(\bs{\pi}\left(2i-1\right),\bs{\pi}\left(2i\right)\right) \right) - \frac{1}{2}\cdot\left(1\pm O\left(\frac{1}{n}\right) \right)n\bar{r} \, \right| \ge k\sqrt{\left(1+ o(1) \right)\delta}\, nr \, \right] \le \frac{1}{k^2} \end{eqnarray*} for all $k>1$. \end{lemma} \begin{proof} Use Chebyshev's inequality and Lemmas~\ref{expectedmatchingsize}~and~\ref{boundonthevarianceofthelengthofthematching}. \end{proof} \comment{ \section{Estimating the average distance on a graph} This section presents an efficient estimation of \begin{eqnarray} \bar{r}\equiv \frac{1}{n^2}\cdot \sum_{x,y\in[n]}\,d\left(x,y\right) \label{averagedistanceingeneral} \end{eqnarray} when $d$ is a graph metric. As in Sec.~\ref{approximationratiosection}, take $\epsilon=1/n^{o(1)}$ less than a small constant and $\delta$ as in line~1 of {\sf Las Vegas median}. Note that the proofs of Lemmas~\ref{pointsoutofballarebad}--\ref{innerballmediantotaldistance} are independent from the choice of $z$ in line~3 of {\sf Las Vegas median}. In particular, they remain to hold when {\sf pick point} in line~3 returns a uniformly random point in $[n]$. \comment{ \begin{lemma}\label{averagedistancecannotbetoolargewhp} $$\Pr_{\bs{u}}\left[\,r\ge 9\bar{r}\,\right]\le\frac{1}{9}.$$ \end{lemma} \begin{proof} By lines~2--3 of {\sf average distance}, $$ \mathop{\mathrm{E}}_{\bs{u}}\left[\,r\,\right] =\frac{1}{n}\cdot \sum_{u\in[n]}\,\frac{1}{n}\cdot \sum_{x\in[n]}\, d\left(u,x\right) \stackrel{\text{(\ref{averagedistance})}}{=} \bar{r}. $$ Now use Markov's inequality. \end{proof} \begin{lemma}\label{thekeyconcentration} If $\delta nr\ge \Delta$, then {\footnotesize $$ \Pr_{\bs{\pi}}\left[\, \left|\, \left( \sum_{i=1}^{\lfloor n/2\rfloor}\, d\left(\bs{\pi}\left(2i-1\right),\bs{\pi}\left(2i\right)\right) \right) - \frac{1}{2}\cdot\left(1\pm O\left(\frac{1}{n}\right) \right)n\bar{r} \,\right| \ge k\sqrt{\left(1+o(1) \right)\delta}\, n\bar{r} \,\right] \le\frac{1}{k^2} $$ for all $k>1$. \end{lemma} \begin{proof} By inequalities~(\ref{bestisnoworsethanaverage})~and~(\ref{theaveragedistancefromanoptimalpoint}), $$r\le\bar{r}.$$ This and Lemma~\ref{randommatchingconcentrationlemma} complete the proof. \end{proof} We now arrive at an efficient estimation of the average distance on a graph. \begin{theorem}\label{theoremonestimatinggraphaveragedistance} Given $n\in\mathbb{Z}^+$, $\epsilon=\omega(1/n^{1/4})$ and oracle access to a graph metric $d\colon[n]\times[n]\to\mathbb{N}$, a real number in $[\,(1-\epsilon)\bar{r},(1+\epsilon)\bar{r}\,]$ can be found in $O(n)$ time with probability $1/2+\Omega(1)$. \end{theorem} \begin{proof} Let $G=([n],E)$ be an undirected unweighted graph inducing the distance function $d$. Then pick $x$, $y\in [n]$ with $d(x,y)=\Delta$, i.e., $(x,y)$ is a furthest pair of vertices of $G$. Find a simple shortest $x$-$y$ path, denoted $(v_0=x,v_1,\ldots,v_\Delta=y)$, in $G$. By equation~(\ref{theaveragedistancefromanoptimalpoint}), \begin{eqnarray} r \ge \frac{1}{n}\cdot\sum_{i=0}^\Delta\,d\left(p^*,v_i\right). \label{totaldistancetoverticesonalongestpath} \end{eqnarray} Now, {\small \begin{eqnarray} \sum_{i=0}^\Delta\,d\left(p^*,v_i\right) = \frac{1}{2}\cdot \sum_{i=0}^\Delta d\left(p^*,v_i\right)+d\left(p^*,v_{\Delta-i}\right) \ge\frac{1}{2}\cdot\sum_{i=0}^\Delta\, d\left(v_i,v_{\Delta-i}\right) =\frac{1}{2}\cdot \sum_{i=0}^\Delta\, \left|\,\Delta-2i\,\right| \ge \frac{\Delta^2}{4}, \label{totaldistancestopointsonapath} \end{eqnarray} where the first inequality (resp., the second equality) follows from the triangle inequality (resp., $(v_0,v_1,\ldots,v_\Delta)$ being a shortest $v_0$-$v_\Delta$ path).\footnote{It is easy to verify that $\sum_{i=0}^\Delta\,|\,\Delta-2i\,| =(\Delta+2)\Delta/2$ if $\Delta\equiv 0\pmod{2}$ and $\sum_{i=0}^\Delta\,|\,\Delta-2i\,| =(\Delta+1)^2/2$ otherwise.} By inequalities~(\ref{totaldistancetoverticesonalongestpath})--(\ref{totaldistancestopointsonapath}), \begin{eqnarray} nr \ge\frac{\Delta^2}{4}. \label{totaldistancetoverticesonalongpath} \end{eqnarray} Because $d$ is a graph metric, $d(x,y)\ge1$ for all distinct $x$, $y\in[n]$. So by equation~(\ref{theaveragedistancefromanoptimalpoint}), \begin{eqnarray} r \ge \frac{1}{n}\cdot \sum_{x\in[n]\setminus\{p^*\}}\,1\ge\frac{1}{2} \label{trivialaveragedistancelowerbound} \end{eqnarray} for all $n\ge2$. By inequalities~(\ref{totaldistancetoverticesonalongpath})--(\ref{trivialaveragedistancelowerbound}), $$ \delta nr \ge \delta \cdot\max\left\{\frac{\Delta^2}{4},\frac{n}{2}\right\}. $$ So \begin{eqnarray} \delta nr \ge \Delta \label{thesmallballwillbetheuniverse} \end{eqnarray} for all sufficiently large $n$.\footnote{If $\Delta\ge 4/\delta$, then $\delta\Delta^2/4\ge \Delta$. Otherwise, $\delta n/2\ge \Delta$ for all $n>8/\delta^2$. Finally, recall that $\delta=\omega(1/\sqrt{n})$.} By equation~(\ref{thedeltavalue}), \begin{eqnarray} 3\sqrt{\left(1+o(1)\right)\delta}\le 0.1\,\epsilon \label{theerrortermcalculated} \end{eqnarray} for all sufficiently large $n$. By inequalities~(\ref{thesmallballwillbetheuniverse})--(\ref{theerrortermcalculated}), Lemma~\ref{thekeyconcentration} with $k=3$ and recalling that $\epsilon=\omega(1/n^{1/4})$, \begin{eqnarray} \Pr_{\bs{\pi}}\left[\, \sum_{i=1}^{\lfloor n/2\rfloor}\,d\left(\bs{\pi}(2i-1),\bs{\pi}(2i)\right) \in \left[\,\left(\frac{1}{2}-\frac{\epsilon}{2}\right)n\bar{r}, \left(\frac{1}{2}+\frac{\epsilon}{2}\right)n\bar{r} \,\right] \,\right]\ge 1-\frac{1}{9} \label{concentrationofmatchingconcluded} \end{eqnarray} for all sufficiently large $n$. Consequently, the output of line~2 of {\sf average distance} in Fig.~\ref{mainalgorithm} is in $[\,(1-\epsilon)\bar{r},(1+\epsilon)\bar{r}\,]$ with probability $1/2+\Omega(1)$. Line~1 takes $O(n)$ time by the Knuth shuffle. Clearly, line~2 also takes $O(n)$ time. \end{proof} The time complexity of $O(n)$ in Theorem~\ref{theoremonestimatinggraphaveragedistance} is independent of $\epsilon$. But for general metrics, we do not know whether the time complexity of $O(n/\epsilon^2)$ in Fact~\ref{averagedistancepriorresult} can be improved to $O(n/\epsilon^{2-\Omega(1)})$. \comment{ Pick $\tilde{z}$ from $[n]$ uniformly at random. Analogous to line~4 of {\sf Las Vegas median}, define \begin{eqnarray} \tilde{r}\equiv \frac{1}{n}\cdot \sum_{x\in[n]}\,d\left(\tilde{z},x\right). \tilde{r}\equiv \end{eqnarray} Observe that the proofs of Lemmas~\ref{pointsoutofballarebad}--\ref{randommatchingconcentrationlemma} are independent from the picking of $z$. So Lemma~\ref{randommatchingconcentrationlemma} remains to hold with $z$ and $r$ replaced by $\tilde{z}$ and $\tilde{r}$, respectively. That is, \comment{ \section{Estimating the sum of distances} Using our results in Sec.~\ref{expectedtimesection}, we present a Monte-Carlo algorithm, called {\sf sum distances} in Fig.~\ref{averagedistancealgorithm}, for estimating $\sum_{u,v\in[n]}\,d(u,v)$. \begin{figure} \begin{algorithmic}[1] \STATE $\tilde{\delta}\leftarrow \epsilon^2/10000$; \STATE $\tilde{z}\leftarrow\text{\sf Indyk median}^d(n,\epsilon)$; \STATE $\tilde{r}\leftarrow \sum_{x\in[n]}\,d(\tilde{z},x)/n$; \STATE Pick a uniformly random bijection $\tilde{\pi}\colon [\,|B(\tilde{z},\tilde{\delta} n\tilde{r})|\,] \to B(\tilde{z},\tilde{\delta} n\tilde{r})$; \STATE $S\leftarrow (2\,|B(\tilde{z},\tilde{\delta} n\tilde{r})|^2/n) \cdot \sum_{i=1}^{\lfloor |B(\tilde{z},\tilde{\delta} n \tilde{r})|/2\rfloor}\, d(\tilde{\pi}(2i-1),\tilde{\pi}(2i))$; \STATE $T\leftarrow \sum_{\text{$u$, $v\in[n]$ s.t.\ $\{u,v\}\not\subseteq B(\tilde{z},\tilde{\delta} n\tilde{r})$}}\, d(u,v)$; \RETURN $S+T$; \end{algorithmic} \caption{Algorithm {\sf sum distances} with oracle access to a metric $d\colon [n]\times[n] \to[\,0,\infty\,)$ and with inputs $n\in\mathbb{Z}^+$, and $\epsilon\in(0,1)$} \label{averagedistancealgorithm} \end{figure} \begin{lemma}\label{generalformofestimationerror} In line~7 of {\sf sum distances}, $$ S+T-\sum_{u,v\in[n]}\,d\left(u,v\right) = \left( \frac{2\,|B(\tilde{z},\tilde{\delta} n\tilde{r})|^2}{n} \cdot \sum_{i=1}^{\lfloor |B(\tilde{z},\tilde{\delta} n \tilde{r})|/2\rfloor}\, d\left(\tilde{\pi}\left(2i-1\right),\tilde{\pi}\left(2i\right)\right) \right) -\sum_{u,v\in B(\tilde{z},\tilde{\delta}n\tilde{r})}\,d\left(u,v\right). $$ \end{lemma} \begin{proof} We have \begin{eqnarray*} \sum_{u,v\in[n]}\,d\left(u,v\right) &=&\sum_{u,v\in B(\tilde{z},\tilde{\delta}n\tilde{r})}\,d\left(u,v\right) +\sum_{\text{$u$, $v\in[n]$ s.t.\ $\{u,v\}\not\subseteq B(\tilde{z},\tilde{\delta} n\tilde{r})$}}\, d\left(u,v\right)\\ &=&\left(\sum_{u,v\in B(\tilde{z},\tilde{\delta}n\tilde{r})}\,d\left(u,v\right)\right) +T, \end{eqnarray*} where the last equality follows from line~6 of {\sf sum distances}. Now use line~5. \end{proof} Similarly to equation~(\ref{smallerballaveragedefinition}), define \begin{eqnarray} \tilde{r}' \equiv \frac{1}{|B(\tilde{z},\tilde{\delta}n\tilde{r})|^2} \cdot \sum_{u,v\in B(\tilde{z},\tilde{\delta}n\tilde{r})}\,d\left(u,v\right). \label{averagedistanceinthenewball} \end{eqnarray} Observe that the proofs of Lemmas~\ref{thesmallradiusballislarge}--\ref{randommatchingconcentrationlemma} use only the following facts: \begin{enumerate}[(i)] \item\label{originalcondition1} $$r = \frac{1}{n}\cdot \sum_{x\in[n]}\,d\left(z,x\right).$$ \item $$r' = \frac{1}{|B(z,\delta nr)|^2}\cdot \sum_{u,v\in B(z,\delta nr)}\,d\left(u,v\right).$$ \item\label{originalcondition3} $\pi\colon [\,|B(z,\delta nr)|\,]\to B(z,\delta nr)$ is a uniformly random bijection. \end{enumerate} In particular, they do not rely on the choices of $z\in[n]$ and $\delta>0$. By lines~3--4 of {\sf sum distances} and equation~(\ref{averagedistanceinthenewball}), conditions~(\ref{originalcondition1})--(\ref{originalcondition3}) hold with $z$, $r$, $r'$, $\delta$ and $\pi$ replaced by $\tilde{z}$, $\tilde{r}$, $\tilde{r}'$, $\tilde{\delta}$ and $\tilde{\pi}$, respectively. Therefore, Lemmas~\ref{thesmallradiusballislarge}--\ref{randommatchingconcentrationlemma} remain true with $z$, $r$, $r'$, $\delta$ and $\pi$ replaced by $\tilde{z}$, $\tilde{r}$, $\tilde{r}'$, $\tilde{\delta}$ and $\tilde{\pi}$, respectively. So we have the following analogies to Lemmas~\ref{thesmallradiusballislarge},~\ref{inneraverageandoverallaverage}~and~\ref{randommatchingconcentrationlemma}. \begin{lemma}\label{thesmallradiusballislargeanalogy} $$ \left|\, [n]\setminus B\left(\tilde{z},\tilde{\delta}n\tilde{r}\right)\,\right|\le\frac{1}{\tilde{\delta}} $$ and, therefore, $$ \left|\,B\left(\tilde{z},\tilde{\delta}n\tilde{r}\right)\,\right|\ge n-\frac{1}{\tilde{\delta}} =\left(1-o(1)\right)n. $$ \end{lemma} \comment{ \begin{proof} Clearly, $$ \sum_{x\in [n]}\,d\left(\tilde{z},x\right) \ge \sum_{x\in [n]\setminus B(\tilde{z},\tilde{\delta} n\tilde{r})}\,d\left(\tilde{z},x\right) \ge \sum_{x\in [n]\setminus B(\tilde{z},\tilde{\delta} n\tilde{r})}\,\tilde{\delta} n\tilde{r} =\left|\,[n]\setminus B\left(\tilde{z},\tilde{\delta} n\tilde{r}\right)\,\right|\cdot \tilde{\delta} n\tilde{r}. $$ Then use line~3 of {\sf sum distances}. \end{proof} \begin{lemma}\label{inneraverageandoverallaveragealternative} $\tilde{r}'\leq 2\tilde{r}$. \end{lemma} \comment{ \begin{proof} By equation~(\ref{averagedistanceinthenewball}) and the triangle inequality, \begin{eqnarray} \tilde{r}' &\le& \frac{1}{|B(\tilde{z},\tilde{\delta} n\tilde{r})|^2} \cdot \sum_{u, v\in B(\tilde{z},\tilde{\delta} n\tilde{r})}\, \left(d\left(\tilde{z},u\right)+d\left(\tilde{z},v\right)\right) \label{frominnerdistancetowholedistancenew}\\ &=& \frac{1}{|B(\tilde{z},\tilde{\delta} n\tilde{r})|^2} \cdot \left|B(\tilde{z},\tilde{\delta} n\tilde{r})\right|\cdot\left( \sum_{u\in B(\tilde{z},\tilde{\delta} n\tilde{r})}\, d\left(\tilde{z},u\right) +\sum_{v\in B(\tilde{z},\tilde{\delta} n\tilde{r})}\, d\left(\tilde{z},v\right) \right)\nonumber\\ &=& \frac{2}{|B(\tilde{z},\tilde{\delta} n\tilde{r})|} \cdot \sum_{u\in B(\tilde{z},\tilde{\delta} n\tilde{r})}\, d\left(\tilde{z},u\right).\nonumber \end{eqnarray} Obviously, the average distance from $\tilde{z}$ to the points in $B(\tilde{z},\tilde{\delta} n\tilde{r})$ is at most that from $\tilde{z}$ to all points, i.e., \begin{eqnarray} \frac{1}{|B(\tilde{z},\tilde{\delta} n\tilde{r})|} \cdot \sum_{u\in B(\tilde{z},\tilde{\delta} n\tilde{r})}\, d\left(\tilde{z},u\right) \le \frac{1}{n}\cdot \sum_{u\in [n]}\, d\left(\tilde{z},u\right). \label{frominnerdistancetowholedistance2new} \end{eqnarray} Inequalities~(\ref{frominnerdistancetowholedistancenew})--(\ref{frominnerdistancetowholedistance2new}) and line~3 of {\sf sum distances} complete the proof. \end{proof} \begin{lemma}\label{randommatchingconcentrationlemmaanalogy} For all $k>1$, $$ \Pr\left[\, \left|\, \left( \sum_{i=1}^{\lfloor|B(\tilde{z},\tilde{\delta} n\tilde{r})|/2\rfloor}\, d\left(\tilde{\pi}\left(2i-1\right),\tilde{\pi}\left(2i\right)\right) \right) - \frac{1}{2}\cdot\left(1\pm o(1) \right)n \tilde{r}' \,\right| \ge k\sqrt{2\left(1+o(1) \right)\tilde{\delta}}\, n\tilde{r} \,\right] \le\frac{1}{k^2}, $$ where the probability is taken over $\tilde{\pi}$. \end{lemma} By Lemma~\ref{randommatchingconcentrationlemmaanalogy}, {\small $$ \Pr\left[\, \left|\, \left( \sum_{i=1}^{\lfloor|B(\tilde{z},\tilde{\delta} n\tilde{r})|/2\rfloor}\, d\left(\tilde{\pi}\left(2i-1\right),\tilde{\pi}\left(2i\right)\right) \right) - \frac{1}{2}\cdot n \tilde{r}' \,\right| \ge k\sqrt{2\left(1+o(1) \right)\tilde{\delta}}\, n\tilde{r} +\frac{1}{2}\cdot o(1) n \tilde{r}' \,\right] \le\frac{1}{k^2} $$ for all $k>1$.\footnote{It is easy to verify that $$\Pr\left[\,\left|X-a\right|\ge c+|b|\,\right] \le\Pr\left[\,\left|X-\left(a+b\right)\right|\ge c\,\right]$$ for all $a$, $b$, $c\in\mathbb{R}$ and for each random variable $X$. Then take $X=\sum_{i=1}^{\lfloor|B(\tilde{z},\tilde{\delta}n\tilde{r})|/2\rfloor}\, d(\tilde{\pi}(2i-1),\tilde{\pi}(2i))$, $a=(1/2)\cdot n\tilde{r}'$, $b=\pm (1/2)o(1)n\tilde{r}'$ (as within $\Pr[\cdot]$ in Lemma~\ref{randommatchingconcentrationlemmaanalogy}) and $c=k\sqrt{2(1+o(1))\tilde{\delta}}\,n\tilde{r}$.} This is equivalent to {\small \begin{eqnarray} && \Pr\left[\, \left|\, \left( \frac{2\,|B(\tilde{z},\tilde{\delta}n\tilde{r})|^2}{n} \cdot\sum_{i=1}^{\lfloor|B(\tilde{z},\tilde{\delta} n\tilde{r})|/2\rfloor}\, d\left(\tilde{\pi}\left(2i-1\right),\tilde{\pi}\left(2i\right)\right) \right) - \sum_{u,v\in B(\tilde{z},\tilde{\delta} n\tilde{r})}\,d\left(u,v\right) \,\right|\right.\nonumber\\ && \left. \phantom{\left|\left(\sum_{i=1}^{\lfloor|B(\tilde{z},\tilde{\delta} n\tilde{r})|/2\rfloor}\,\right)\right| \ge \frac{2\,|B(\tilde{z},\tilde{\delta}n\tilde{r})|^2}{n}\cdot \left( k\sqrt{2\left(1+o(1) \right)\tilde{\delta}}\, n\tilde{r} +\frac{1}{2}\cdot o(1) n \tilde{r}' \right) \,\right]\nonumber\\ &\le&\frac{1}{k^2}\label{theestimationerrorforthetotaldistance} \end{eqnarray} by equation~(\ref{averagedistanceinthenewball}), for all $k>1$. Lemma~\ref{generalformofestimationerror} and inequality~(\ref{theestimationerrorforthetotaldistance}) with $k=5$ imply the following. \begin{lemma}\label{theerrorandprobabilitycomplicatedform} {\small $$\Pr\left[\, \left|\, S+T-\sum_{u,v\in[n]}\,d\left(u,v\right) \,\right| \ge \frac{2\,|B(\tilde{z},\tilde{\delta}n\tilde{r})|^2}{n}\cdot \left( 5\sqrt{2\left(1+o(1) \right)\tilde{\delta}}\, n\tilde{r} +\frac{1}{2}\cdot o(1) n \tilde{r}' \right) \,\right] \le\frac{1}{25}.$$ \end{lemma} \begin{lemma}\label{theerrortermasymptotics} For all sufficiently large $n$, {\small $$ \Pr\left[\, \frac{2\,|B(\tilde{z},\tilde{\delta}n\tilde{r})|^2}{n}\cdot \left( 5\sqrt{2\left(1+o(1) \right)\tilde{\delta}}\, n\tilde{r} +\frac{1}{2}\cdot o(1) n \tilde{r}' \right) \le 100\sqrt{\tilde{\delta}}\cdot \sum_{u,v\in[n]}\,d\left(u,v\right) \,\right]\ge1-\frac{1}{e}. $$ \end{lemma} \begin{proof} By Lemmas~\ref{thesmallradiusballislargeanalogy}--\ref{inneraverageandoverallaveragealternative}, \begin{eqnarray} &&\frac{2\,|B(\tilde{z},\tilde{\delta}n\tilde{r})|^2}{n}\cdot \left( 5\sqrt{2\left(1+o(1) \right)\tilde{\delta}}\, n\tilde{r} +\frac{1}{2}\cdot o(1) n \tilde{r}' \right)\nonumber\\ &\le& 2\left(1-o(1)\right) \left(5\sqrt{2\left(1+o(1)\right)\tilde{\delta}}+o(1) \right)n^2\tilde{r}.\label{aquickestimation} \end{eqnarray} By Fact~\ref{Indykfact} and line~2 of {\sf sum distances}, $$ \Pr\left[ \sum_{x\in[n]}\,d\left(\tilde{z},x\right) \le\left(1+\epsilon\right)\cdot\min_{y\in[n]}\,\sum_{x\in[n]}\,d\left(y,x\right) \right]\ge 1-\frac{1}{e}. $$ Equivalently, \begin{eqnarray} \Pr\left[ n\tilde{r} \le\left(1+\epsilon\right)\cdot\min_{y\in[n]}\,\sum_{x\in[n]}\,d\left(y,x\right) \right]\ge 1-\frac{1}{e}\label{theindykresultisprobablygood} \end{eqnarray} by line~3. By the averaging argument, $$ \min_{y\in[n]}\,\sum_{x\in[n]}\,d\left(y,x\right) \le \frac{1}{n}\cdot\sum_{y\in[n]}\,\sum_{x\in[n]}\,d\left(y,x\right). $$ This and inequality~(\ref{theindykresultisprobablygood}) imply \begin{eqnarray} \Pr\left[ n^2\tilde{r} \le\left(1+\epsilon\right)\cdot\sum_{y\in[n]}\,\sum_{x\in[n]}\,d\left(y,x\right) \right]\ge 1-\frac{1}{e}\label{theindykresultisprobablygoodcomparedtotheaverage} \end{eqnarray} Inequalities~(\ref{aquickestimation})~and~(\ref{theindykresultisprobablygoodcomparedtotheaverage}) complete the proof.\footnote{Note that the right-hand side of inequality~(\ref{aquickestimation}) is at most $(100\sqrt{\tilde{\delta}}/(1+\epsilon))\cdot n^2\tilde{r}$ for a small $\epsilon>0$ and all sufficiently large $n$. Also note that $\sum_{y\in[n]}\,\sum_{x\in[n]}\,d(x,y)=\sum_{u,v\in[n]}\,d(u,v)$.} \end{proof} We now show an efficient estimation of $\sum_{u,v\in[n]}\,d(u,v)$. \begin{theorem}\label{theoremonestimationofsumofdistances} Given $n\in\mathbb{Z}^+$, a constant $\epsilon>0$ and oracle access to a metric $d\colon[n]\times[n]\to[\,0,\infty\,)$, $\sum_{u,v\in[n]}\,d(u,v)$ can be estimated to within an additive error of $\epsilon\cdot\sum_{u,v\in[n]}\,d(u,v)$ in $O(n/\epsilon^2)$ time and with an $\Omega(1)$ probability of success. \end{theorem} \begin{proof} By Lemmas~\ref{theerrorandprobabilitycomplicatedform}--\ref{theerrortermasymptotics}, $$ \Pr\left[\, \left|\, S+T-\sum_{u,v\in[n]}\,d\left(u,v\right) \,\right|\le 100\sqrt{\tilde{\delta}}\cdot \sum_{u,v\in[n]}\,d\left(u,v\right) \,\right] \ge 1-\frac{1}{25}-\frac{1}{e}=\Omega(1). $$ So by line~1 of {\sf sum distances}, line~7 estimates $\sum_{u,v\in[n]}\,d(u,v)$ to within an additive error of $\epsilon\cdot\sum_{u,v\in[n]}\,d(u,v)$ with probability $\Omega(1)$. By Fact~\ref{Indykfact}, line~2 of {\sf sum distances} takes $O(n/\epsilon^2)$ time. Line~4 takes time $O(|B(\tilde{z},\tilde{\delta} n\tilde{r})|)=O(n)$ by the Knuth shuffle. Because lines~6 queries for all the distances incident to any point in $[n]\setminus B(\tilde{z},\tilde{\delta} n\tilde{r})$, it takes time $$O\left(\left|\,[n]\setminus B\left(\tilde{z},\tilde{\delta} n\tilde{r}\right)\,\right| \cdot n\right) \stackrel{\text{Lemma~\ref{thesmallradiusballislargeanalogy}}}{=}O\left(\frac{n}{\tilde{\delta}}\right).$$ By line~1, $\tilde{\delta}=\Theta(\epsilon^2)$. The other lines of {\sf sum distances} clearly take $O(n)$ time. \end{proof} Prior to this paper, the best Monte-Carlo algorithm for estimating $\sum_{u,v\in[n]}\,d(u,v)$ to within an additive error of $\epsilon\cdot \sum_{u,v\in[n]}\,d(u,v)$ takes time $O(n/\epsilon^{7/2})$ when the probability of success is set to $\Omega(1)$~\cite{Ind99}. So Theorem~\ref{theoremonestimationofsumofdistances} implies an algorithm with a better running time in terms of $\epsilon$.
{'timestamp': '2017-03-27T02:07:44', 'yymm': '1703', 'arxiv_id': '1703.08433', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08433'}
arxiv
\section*{Appendix: Proof} \begin{small} \textbf{Theorem}: \ensuremath{\mathsf{\langle\pa,\rho^\omega\rangle}}\ is not-semi-decidable \begin{proof} Let \ensuremath{\mathsf{\langle\pa,\rho^\omega\rangle}}\ denote the formal system comprised of \ensuremath{\mathsf{PA}}\ with a standard proof calculus $\rho$ augmented with the restricted \ensuremath{\omega\mhyphen \mbox{rule}}. Assume that we are only talking about Turing machines which output exactly one of $\{\ensuremath{\mathsf{yes}},\ensuremath{\mathsf{no}}\}$ on all inputs, or else go on forever without halting, e.g., \ensuremath{\mathsf{loops}}. The inputs are numerals which encode natural numbers. \textbf{Given}: \ensuremath{\mathsf{\langle\pa,\rho^\omega\rangle}}\ is negation-complete and all its theorems are true on the standard model $\langle\mathbb{N};0,\mathsf{S,+,1}\rangle$. The following three statements can be coded up as arithmetic statements in the language of \ensuremath{\mathsf{PA}}. \begin{quote} \begin{enumerate} \item Machine $m$ on input $n$ halts with \ensuremath{\mathsf{yes}} \item Machine $m$ on input $n$ halts with \ensuremath{\mathsf{no}} \item Machine $m$ on input $n$ \ensuremath{\mathsf{loops}} \end{enumerate} \end{quote} For any machine $m$ and any input $n$, exactly one of the above is true in the standard model and therefore a theorem in \ensuremath{\mathsf{\langle\pa,\rho^\omega\rangle}}. \begin{quote} \textbf{Assumption 1}:\emph{\ensuremath{\mathsf{\langle\pa,\rho^\omega\rangle}}\ is semi-decidable.} That is, we have a machine $G$ which on input $\langle p, q\rangle$ outputs \ensuremath{\mathsf{yes}}\ if $p$ represents a proof in \ensuremath{\mathsf{\langle\pa,\rho^\omega\rangle}}\ of the statement encoded by $q$; otherwise outputs $\ensuremath{\mathsf{no}}$ or \ensuremath{\mathsf{loops}}. \end{quote} If \textbf{Assumption 1} holds, then we can have a machine $H$ which on input $\langle m,n\rangle$ decides if machine $m$ halts on input $n$; i.e., $H$ solves the halting problem. The machine $H$ is specified below as an algorithm. \vspace{-0.3in} \begin{footnotesize} \begin{algorithm} \begin{mdframed}[skipabove=0.0in,skipbelow=0.02in,roundcorner=10pt,backgroundcolor=gray!15, linewidth=0pt,roundcorner=8pt,fontcolor = black!90,frametitle={ Algorithm for Machine $H$},frametitlerule=true,frametitlerulecolor=gray!80, frametitlebackgroundcolor=gray!30, frametitlerulewidth=0.5pt] \caption{Program $H$} \label{Program H(m,n)} \SetAlgoLined \SetKwInOut{Input}{Input}\SetKwInOut{Output}{Output} \Input{$\langle m,n\rangle$} \Output{Does $m$ halt on $n$?} \SetKwBlock{Init}{init}{} initialization\; \Init{$q_1$= \textsf{``Arithmetic Statement encoding that $m$ on input $n$ halts with \ensuremath{\mathsf{yes}}''}\; $q_2$= \textsf{``Arithmetic Statement encoding that $m$ on input $n$ halts with \ensuremath{\mathsf{no}}''}\; $q_3$= \textsf{``Arithmetic Statement encoding that $m$ on input $n$ does not halt or \ensuremath{\mathsf{loops}}.''}\; } \SetKwBlock{Threada}{Thread 1}{} \SetKwBlock{Threadb}{Thread 2}{} \SetKwBlock{Threadc}{Thread 3}{} $H$ is composed of three parallel threads, exactly one of which halts. If any of the threads halts, $H$ halts. \Threada{ Do a breadth-first search for a proof $p$ such that $G$ on {$\langle p,q_1\rangle$} halts with \ensuremath{\mathsf{yes}}} \Threadb{ Do a breadth-first search for a proof $p$ such that $G$ on {$\langle p,q_2\rangle$} halts with \ensuremath{\mathsf{yes}}} \Threadc{ Do a breadth-first search for a proof $p$ such that $G$ on {$\langle p,q_3\rangle$} halts with \ensuremath{\mathsf{yes}}} \end{mdframed} \end{algorithm} \vspace{-0.45in} \begin{algorithm} \begin{mdframed}[skipabove=0.0in,skipbelow=0.02in,roundcorner=10pt,backgroundcolor=gray!15, linewidth=0pt,roundcorner=8pt,fontcolor = black!90,frametitle={ Algorithm for Breadth-First Search for Finding a Proof for $q$},frametitlerule=true,frametitlerulecolor=gray!80, frametitlebackgroundcolor=gray!30, frametitlerulewidth=0.5pt] \caption{Breadth-First Search for a Proof} \SetAlgoLined Assume we have an lexicographic ordering of strings $\langle p_0,p_1,...\rangle$. In the first iteration we run $G$ on $\langle p_0,q\rangle$ for one step. In the next iteration, we run $G$ $\langle p_0,q\rangle$ for one more step and we also run $G$ on $\langle p_1,q\rangle$ for one step. We continue in this fashion until we hit a $p$ such that $G$ on $\langle p,q\rangle$ stops with \ensuremath{\mathsf{yes}}. \end{mdframed} \end{algorithm} \end{footnotesize} One of the three threads in $H$ will halt. Therefore $H$ decides the halting problem. We have arrived at a contradiction by supposing \textbf{Assumption 1}, which can be now be discarded, and our main thesis is established. \qedsymbol \end{proof} \end{small} \bibliographystyle{agsm}
{'timestamp': '2017-03-28T02:05:31', 'yymm': '1703', 'arxiv_id': '1703.08746', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08746'}
arxiv
\section{Introduction} \vspace{-2mm} Deep neural networks (DNNs) have achieved remarkable success on semantic segmentation tasks~\cite{2015-long,chen2014semantic,zheng2015conditional,liu2015matching}, arguably benefiting from available resources of pixel-level annotated masks. However, collecting a large amount of accurate pixel-level annotation for training semantic segmentation networks on new image sets is labor intensive and inevitably requires substantial financial investments. To relieve the demand for the expensive pixel-level image annotations, \emph{weakly-supervised} approaches~\cite{liu2012weakly,pathak2014fully,2015-papandreou-weakly,pinheiro2015weakly,pathak2015constrained,kolesnikov2016seed,saleh2016built,qi2016augmented,shimoda2016distinct,russakovsky2015s,lin2016scribblesup,wei2015stc,wei2016learning} provide some promising solutions. \begin{figure}[t] \centering \includegraphics[scale=0.46]{fig/illu.pdf} \caption{(a) Illustration of the proposed AE approach. With AE, a classification network first mines the most discriminative region for image category label ``dog". Then, AE erases the mined region (\emph{head}) from the image and the classification network is re-trained to discover a new object region (\emph{body}) for performing classification without performance drop. We repeat such adversarial erasing process for multiple times and merge the erased regions into an integral foreground segmentation mask. (b) Examples of the discriminative object regions mined by AE at different steps and the obtained foreground segmentation masks in the end.} \label{fig:illu} \vspace{-3mm} \end{figure} Among various levels of weak supervision information, the simplest and most efficient one that can be collected for training semantic segmentation models is the image-level annotation~\cite{wei2015hcp,zhang2016online}. However, to train a well-performing semantic segmentation model given only such image-level annotation is rather challenging -- one obstacle is how to accurately assign image-level labels to corresponding pixels of training images such that DNN-based approaches can learn to segment images end-to-end. To establish the desired label-pixel correspondence, some approaches are developed that can be categorized as proposal-based and classification-based. The proposal-based methods~\cite{wei2016learning,qi2016augmented} often exhaustedly examine each proposal to generate pixel-wise masks, which are quite time-consuming. In contrast, the classification-based methods~\cite{kolesnikov2016seed,shimoda2016distinct,pathak2014fully,pinheiro2015weakly,pathak2015constrained,2015-papandreou-weakly} provide much more efficient alternatives. Those methods employ a classification model to select the regions that are most discriminative for the classification target and employ the regions as pixel-level supervision for semantic segmentation learning. However, object classification models usually identify and rely on a small and sparse discriminative region (as highlighted in the heatmaps produced by the classification network shown in Figure~\ref{fig:illu} (a)) from the object of interest. It deviates from requirement of the segmentation task that needs to localize dense, interior and integral regions for pixel-wise inference. Such deviation makes the main obstacle to adapting classification models for solving segmentation problems and harms the segmentation results. To address this issue, we propose a novel \emph{adversarial erasing} (AE) approach that is able to drive a classification network to learn integral object regions progressively. The AE approach can be viewed as establishing a line of competitors, trying to challenge the classification networks to discover some evidence of a specific category until no supportable evidence is left. Concretely, we first train an image classification network using the image-level weak supervision information, \ie the object category annotation. The classification network is applied to localize the most discriminative region within an image for inferring the object category. We then erase the discovered region from the image to breakdown the performance of the classification network. To remedy the performance drop, the classification network needs to localize another discriminative region for classifying the image correctly. With such repetitive adversarial erasing operation, the classification network is able to mine other discriminative regions belonging to the object of interest. The process is illustrated by an example in Figure~\ref{fig:illu} (a), in which \emph{head} is the most discriminative part for classifying the ``dog" image. After erasing \emph{head} and re-training the classification network, another discriminative part \emph{body} would pop out. Repeating such adversarial erasing can localize increasingly discriminative regions diagnostic for image category until no more informative region left. Finally, the erased regions are merged to form a pixel-level semantic segmentation mask that can be used for training a segmentation model. More visualization examples are shown in Figure~\ref{fig:illu} (b). However, the AE approach may miss some object-related regions and introduce some noise due to less attention on boundaries. To exploit those ignored object-related regions as well as alleviate noise, we further propose a complementary online \emph{prohibitive segmentation learning} (PSL) approach to work with AE together to discover more complete object regions and learn better semantic segmentation models. In particular, PSL uses the predicted image-level classification confidences to modulate the corresponding category-specific response maps and form them into an auxiliary segmentation mask, which can be updated in an online manner. Those category-specific segmentation maps with low classification confidences are prohibited for contributing to the formed supervision mask, thus noise can be reduced effectively. To sum up, our main contributions are three-fold: \vspace{-2mm} \begin{itemize} \item We propose a new AE approach to effectively adapt an image classification network to continuously mining and expanding target object regions, and it eventually produces contiguous object segmentation masks that are usable for training segmentation models. \vspace{-2mm} \item We propose an online PSL method to utilize image-level classification confidences to reduce noise within the supervision mask and achieve better training of the segmentation network, collaborating with AE. \vspace{-2mm} \item Our work achieves the mIoU 55.0\% and 55.7\% on \emph{val} and \emph{test} of the PASCAL VOC segmentation benchmark respectively, which are the new state-of-the-arts. \vspace{-5mm} \end{itemize} \begin{figure*}[t] \centering \includegraphics[scale=0.500]{fig/mining.pdf} \caption{Overview of the proposed adversarial erasing approach. At the step $t$, we first train the classification network with the current processed image $I_t$; then a classification activation method (\eg CAM~\cite{zhou2015cnnlocalization}) is employed to produce the class-specific response heatmap ($H_t$). Applying hard thresholding on the heatmap $H_t$ reveals the discriminative region $F_t$. The proposed approach then erases $F_t$ from $I_t$ and produces $I_{t+1}$. This image is then fed into the classification network for learning to localize a new discriminative region. The learned heatmaps and corresponding proceeded training images with erasing are shown in the bottom. The mined regions from multiple steps together constitute the predicted object regions as output, which is used for training the segmentation network later.} \label{fig:mining} \vspace{-1.5em} \end{figure*} \section{Related Work} To reduce the burden of pixel-level annotation, various weakly-supervised methods have been proposed for learning to perform semantic segmentation with coarser annotations. For example, Papandreou \etal~\cite{2015-papandreou-weakly} and Dai \etal~\cite{2015-dai} proposed to estimate segmentation using annotated bounding boxes. More recently, Lin \etal~\cite{lin2016scribblesup} employed scribbles as supervision for semantic segmentation. In~\cite{russakovsky2015s}, the required supervised information is further relaxed to instance points. All these annotations can be considered much simpler than pixel-level annotation. Some works~\cite{pathak2014fully,2015-papandreou-weakly,pinheiro2015weakly,pathak2015constrained,vezhnevets2011weakly,xu2015learning} propose to train the segmentation models by only using image-level labels, which is the simplest supervision for training semantic segmentation models. Among those works, Pinheiro \etal~\cite{pinheiro2015weakly} and Pathak \etal~\cite{pathak2014fully} proposed to utilize multiple instance learning (MIL) to train the models for segmentation. Pathak \etal~\cite{pathak2015constrained} introduced a constrained CNN model to address this problem. Papandreou \etal~\cite{2015-papandreou-weakly} adopted an alternative training procedure based on the Expectation-Maximization algorithm to dynamically predict semantic foreground and background pixels. However, the performance of those methods is not satisfactory. Recently, some new approaches~\cite{kolesnikov2016seed,saleh2016built,qi2016augmented,shimoda2016distinct,wei2015stc,wei2016learning} are proposed to further improve the performance of this challenging task. In particular, Wei \etal~\cite{wei2015stc} presented a simple to complex learning method, in which an initial segmentation model is trained with simple images using saliency maps for supervision. Then, samples of increasing complexity are progressively included to further enhance the ability of the segmentation model. In~\cite{kolesnikov2016seed}, three kinds of loss functions, \ie seeding, expansion and constrain-to-boundary, are proposed and integrated into a unified framework to train the segmentation network. Both~\cite{kolesnikov2016seed} and our work propose to localize object cues according to classification networks. However, Kolesnikov \etal~\cite{kolesnikov2016seed} can only obtain small and sparse object-related seeds for supervision. In contrast, the proposed AE approach is able to mine dense object-related regions, which can provide richer supervised information for learning to perform semantic segmentation. In addition, Qi \etal~\cite{qi2016augmented} proposed an augmented feedback method, in which GrabCut~\cite{rother2004grabcut} and object proposals are employed to generate pixel-level annotations for supervision. To the best of our knowledge, Qi \etal~\cite{qi2016augmented} achieved the state-of-the-art mIoU scores using Selective Search~\cite{uijlings2013selective} (52.7\%) and MCG~\cite{arbelaez2014multiscale} (55.5\%) segmentation proposals on the PASCAL VOC benchmark. However, note that MCG has been trained from PASCAL \emph{train} images with pixel-level annotations, and thus the corresponding results of \cite{qi2016augmented} are obtained by using stronger supervision inherently. \vspace{-0.5em} \section {Classification to Semantic Segmentation} The proposed classification to semantic segmentation approach includes two novel components, \ie object region mining with AE and online PSL for semantic segmentation. \subsection{Object Region Mining with AE} To address the problem that classification networks are only responsive to small and sparse discriminative regions, we propose the AE approach for localizing and expanding object regions progressively. As shown in Figure~\ref{fig:mining}, the AE iteratively performs two operations: learning a classification network for localizing the object discriminative regions and adversarially erasing the discovered regions. In particular, the classification network is initialized based on the DeepLab-CRF-LargeFOV~\cite{chen2014semantic} model. Global average pooling is applied on \emph{conv7} and the generated representations pass through a fully-connected layer for predicting classification. In the first operation, we train the classification network by minimizing squared label prediction loss as suggested by~\cite{wei2015hcp}. In the second operation of performing erasing, we first produce the heatmap for each image-level label using the classification activation maps (CAM) method~\cite{zhou2015cnnlocalization}. Then, the discriminative object regions are obtained by applying a hard threshold to the heatmap. We erase the mined region from training images by replacing its internal pixels by the mean pixel values of all the training images. The processed image with erased regions is then fed into the next classification learning iteration. As the discriminative regions have been removed and no longer contribute to the classification prediction, the classification network is naturally driven to discover new object discriminative regions for maintaining its classification accuracy level. We repeat the classification learning and the AE process for several times until the network cannot well converge on the produced training images, \ie no more discriminative regions left for performing reasonably good classification. We now explain the AE process more formally. Suppose the training set $\mathcal{I}=\{(I_i, \mathcal{O}_i)\}_{i=1}^N$ includes $N$ images and $\mathcal{F}=\{F_i\}_{i=1}^N$ represents the mined object regions by AE. We iteratively produce the object regions $F_{i,t}$ for each training image $I_{i,t}$ with the classification model $M_t$ at the $t^{th}$ learning step. Denote $\mathcal{C}$ as the set of object categories and CAM$(\cdot)$ as the operation of heatmap generation. Thus, the $c^{th}$ heatmap $H_{i,t}^c$ of $I_{i,t}$, in which $c \in \mathcal{O}_i$ and $\mathcal{O}_i \subseteq \mathcal{C}$ is the image-level label set of $I_{i,t}$, can be obtained according to CAM$(I_{i,t}, M_t, c)$. To enforce the classification network to expand object regions from $I_{i,t}$, we erase the pixels whose values on $H_{i,t}^c$ are larger than $\delta$. Then, $\mathcal{F}$ is obtained through the procedure summarized in Algorithm 1. \begin{algorithm}[t] \caption{Object Regions Mining with AE} \label{algo} \begin{algorithmic}[1] \INPUT \text{Training data} $\mathcal{I}=\{(I_i, \mathcal{O}_i)\}_{i=1}^N$, \text{threshold} $\delta$. \INITIALIZE $F_i=\varnothing (i=1,\cdots,N)$, $t=1$. \WHILE {(training of classification is success)} \STATE Train the classification network $M_t$ with $\mathcal{I}$. \FOR{$I_i$ in $\mathcal{I}$} \STATE {{\bfseries Set} $F_{i,t}=\varnothing$.} \FOR{$c$ in $\mathcal{O}_i$} \STATE{Calculate $H_{i,t}^c$ by CAM$(I_{i,t}, M_t, c)$~\cite{zhou2015cnnlocalization}.} \STATE{Extract regions $R$ whose corresponding pixel \phantom .\phantom . \phantom .\phantom . \phantom . \phantom . \phantom .\phantom . \phantom . values in $H_{i,t}^c$ are larger than $\delta$.} \STATE{Update the mined regions $F_{i,t}^c= F_{i,t}^c \cup R$.} \ENDFOR \STATE{Update the mined regions $F_i= F_i \cup F_{i,t}$.} \STATE{Erase the mined regions from training image \phantom . \phantom .\phantom . \phantom .\phantom . \phantom . \phantom . \phantom .\phantom . \phantom .$I_{i,{t+1}}=I_{i,t} \backslash F_{i,t}$.} \ENDFOR \STATE{$t = t + 1 $.} \ENDWHILE \OUTPUT $\mathcal{F}=\{F_i\}_{i=1}^N$ \end{algorithmic} \end{algorithm} Beyond mining foreground object regions, finding background localization cues is also crucial for training the segmentation network. Motivated by~\cite{wei2015stc,kolesnikov2016seed}, we use the saliency detection technology~\cite{jiang2013salient} to produce the saliency maps of training images. Based on the generated saliency maps, the regions whose pixels are with low saliency values are selected as background. Suppose $B_i$ denotes the selected background regions of $I_i$. We can obtain the segmentation masks $\mathcal{S}=\{S_i\}_{i=1}^N$, where $S_i = F_i \cup B_i$. We ignore three kinds of pixels for producing $\mathcal{S}$: 1) those erased foreground regions of different categories which are in conflict; 2) those low-saliency pixels which lie within the object regions identified by AE; 3) those pixels that are not assigned semantic labels. One example of the segmentation mask generation process is demonstrated in Figure 3 (a). ``black" and ``purple" regions refer to the background and the object, respectively. \begin{figure}[t] \centering \includegraphics[scale=0.5]{fig/training.pdf} \caption{(a) The process of segmentation mask generation. (b) The proposed online PSL approach for semantic segmentation. The classification scores are used to weight ``Segmentation Score Maps" to produce ``Weighted Maps" in an online manner. Those classes with low classification confidences are prohibited for producing the segmentation mask. Then, both the mined mask and the online produced mask are used to optimize the network. } \label{fig:training} \vspace{-2em} \end{figure} \subsection{Online PSL for Semantic Segmentation} The proposed AE approach provides the initial segmentation mask for each training image that can be used for training segmentation networks. However, some object-related or background-related pixels may be missed (as those ``blue" pixels on the AE outputs shown in Figure~\ref{fig:training} (a)). In addition, semantic labels of some labeled pixels may be noisy due to the limitation of AE on capturing boundary details. To exploit those pixels unlabeled by AE for training and gain robustness to falsely labeled pixels, we propose an online Prohibitive Segmentation Learning (PSL) approach to further learn to perform semantic segmentation upon the masks provided by AE. The online PSL exploits image classification results to identify reliable category-wise segmentation maps and form them into a less noisy auxiliary supervision map, offering auxiliary information to the AE output. PSL updates the produced auxiliary segmentation map along with training of the segmentation networks in an online manner and produces increasingly more reliable auxiliary supervision. As shown in Figure~\ref{fig:training} (b), the proposed PSL builds a framework that includes two branches, one for classification and the other for semantic segmentation. In particular, PSL uses the squared loss as the optimization objective for the classification branch, whose produced classification confidences are used by PSL to weight the corresponding category-specific segmentation score maps. With the help of classification results, the online PSL is able to integrate the multi-category segmentation maps into an auxiliary segmentation mask and provides supervision in addition to the AE output. With PSL, those segmentation maps corresponding to categories with low classification confidences are prohibited from contributing to the auxiliary segmentation map. Thus, noise from those irrelevant categories can be effectively alleviated. Formally, denote the set of semantic labels for segmentation task as $\mathcal{C}^{seg}$ and the image-specific label set for a given image $I$ as $\mathcal{O}^{seg}$, in which background category is included. During each training epoch, we denote the image-level prediction from the classification branch as $\bm{v}$. Suppose $S$ is the segmentation mask produced by AE. The online PSL exploits the image prediction over $\mathcal{C}^{seg}$ to train a segmentation network $f(I;\theta)$ parameterized by $\theta$, which predicts the pixel-wise probability of each label $c \in \mathcal{C}^{seg}$ at every location $u$ of the image plane $f_{u,c}(I, \theta)$. To produce the additional segmentation mask $\hat{S}$ for training the segmentation network, PSL uses $\bm{v}$ to weight foreground category segmentation score maps as shown in Figure~\ref{fig:training} (b). With this prohibitive operation, large response values from negative score maps can be suppressed by multiplying a small classification category score. Meanwhile, the score maps of dominant categories (\ie the corresponding objects that occupy a large area of the image) can also be enhanced. Denote the weighting operator as $\otimes$, and $\hat{S}$ is then produced by \vspace{-0.8em} \[ \hat{S} = \mathop {\max } \{{[1, \bm{v}] \otimes f(I;\theta)}\}.\vspace{-0.5em} \] Here the appended element 1 is for weighting the background category. Suppose $S_c$ and $\hat{S}_c$ represent the pixels annotated with category $c$. The cross-entropy loss used for noise-prohibitive semantic segmentation is formulated as \vspace{-0.5em} \[ \min\limits_{\theta}\sum\limits_{I \in \mathcal{I}}{J(f(I;\theta), S) + J(f(I;\theta), \hat{S})} \vspace{-0.5em} \vspace{-0.5em} \] where \vspace{-0.8em} \[ \label{eq:loss_seg} J(f(I;\theta), S) = -{\frac{1}{\sum\limits_{c \in \mathcal{O}^{seg}}|S_c|} }\sum\limits_{c \in \mathcal{O}^{seg}}\sum\limits_{u \in S_{c}}\log f_{u,c}(I;\theta),\vspace{-0.5em} \] and \vspace{-0.5em} \[ \label{eq:loss_seg2} J(f(I;\theta), \hat{S}) = -{\frac{1}{\sum\limits_{c \in \mathcal{O}^{seg}}|\hat{S}_c|} }\sum\limits_{c \in \mathcal{O}^{seg}}\sum\limits_{u \in \hat{S}_{c}}\log f_{u,c}(I;\theta).\vspace{-0.5em} \] With online training, the segmentation ablity of the network is progressively improved, which can produce increasingly more accurate $\hat{S}$ for supervising the later training process. During the testing process, we take a more strict pohibitive policy for those categories with low classification confidences. In particular, we set those classification confidences that are smaller than $p$ to zero and keep others unchanged, and apply them to weight the predicted segmentation score maps and produce the final segmentation result. \vspace{-0.5em} \section{Experiments} \label{sec:exp} \subsection{Dataset and Experiment Settings} \noindent \textbf{Dataset and Evaluation Metrics} We evaluate our proposed approach on the PASCAL VOC 2012 segmentation benchmark dataset~\cite{2010-pascal}, which has 20 object categories and one background category. This dataset is split into three subsets: training (\emph{train}, 1,464 images), validation (\emph{val}, 1,449 images) and testing (\emph{test}, 1,456 images). Following the common practice~\cite{pinheiro2015weakly,chen2014semantic,hariharan2011semantic}, we increase the number of training images to 10,582 by image augmentation. In our experiments, only image-level labels are utilized for training. The performance is evaluated in terms of pixel IoU averaged on 21 categories. Experimental analysis of the proposed approach is conducted on the \emph{val} set. We compare our method with other state-of-the-arts on both \emph{val} and \emph{test} sets. The result on the \emph{test} set is obtained by submitting the predicted results to the official PASCAL VOC evaluation server. \noindent \textbf{Training/Testing Settings } We adopt DeepLab-CRF-LargeFOV from \cite{chen2014semantic} as the basic network for the classification network and segmentation network in AE and PSL, whose parameters are initialized by the VGG-16~\cite{simonyan2014very} pre-trained on ImageNet~\cite{2009-imagenet}. We use a mini-batch size of 30 images where patches of 321 $\times$ 321 pixels are randomly cropped from images for training the network. We follow the training procedure in~\cite{chen2014semantic} at this stage. The initial learning rate is 0.001 (0.01 for the last layer) and decreased by a factor of 10 after 6 epochs. Training terminates after 15 epochs. Both two networks are trained on NVIDIA GeForce TITAN X GPU with 12GB memory. We use DeepLab code~\cite{chen2014semantic} in our experiments, which is implemented based on the publicly available Caffe framework~\cite{jia2014caffe}. For each step of AE, those pixels belonging to top 20\% of the largest value (a fraction suggested by~\cite{kolesnikov2016seed,zhou2015cnnlocalization}) in the heatmap are erased, which are then considered as foreground object regions. We use saliency maps from \cite{jiang2013salient} to produce the background localization cues. For those images belonging to indoor scenes (\eg \emph{sofa} or \emph{table}), we adopt the normalized saliency value 0.06 as the threshold to obtain background localization cues (\ie pixels whose saliency values are smaller than 0.06 are considered as background) in case some objects were wrongly assigned to background. For the images from other categories, the threshold is set as 0.12. For the testing phase of semantic segmentation, the prohibited threshold $p$ is empirically set as 0.1 and CRF~\cite{koltun2011efficient} is utilized for post processing. \begin{table}[] \centering \caption{Comparison of weakly-supervised semantic segmentation methods on VOC 2012 \emph{val} set.} \small \label{tab:val-comp} \begin{tabular}{lcc} \toprule Methods & Training Set & mIoU \\ \midrule \multicolumn{2}{l}{Supervision: Scribbles} \\ Scribblesup (CVPR 2016)~\cite{lin2016scribblesup} & 10K & 63.1 \\ \midrule \multicolumn{2}{l}{Supervision: Box} \\ WSSL (ICCV 2015)~\cite{2015-papandreou-weakly} & 10K & 60.6 \\ BoxSup (ICCV 2015) & 10K & 62.0 \\ \midrule \multicolumn{2}{l}{Supervision: Spot} \\ 1 Point (ECCV 2016)~\cite{russakovsky2015s} & 10K & 46.1 \\ Scribblesup (CVPR 2016)~\cite{lin2016scribblesup} & 10K & 51.6 \\ \midrule \multicolumn{2}{l}{Supervision: Image-level Labels} \\ \multicolumn{3}{l}{(* indicates methods implicitly use pixel-level supervision)}\\ SN\_B* (PR 2016)~\cite{wei2016learning} & 10K & 41.9\\ MIL-seg* (CVPR 2015)~\cite{pinheiro2015weakly} & 700K & 42.0 \\ TransferNet* (CVPR 2016)~\cite{hong2015learning} & 70K & 52.1 \\ AF-MCG* (ECCV 2016)~\cite{qi2016augmented} & 10K & 54.3\\ \midrule \multicolumn{2}{l}{Supervision: Image-level Labels} \\ MIL-FCN (ICLR 2015)~\cite{pathak2014fully} & 10K & 25.7 \\ CCNN (ICCV 2015)~\cite{pathak2015constrained} & 10K & 35.3\\ MIL-sppxl (CVPR 2015)~\cite{pinheiro2015weakly} & 700K & 36.6 \\ MIL-bb (CVPR 2015)~\cite{pinheiro2015weakly} & 700K & 37.8 \\ EM-Adapt (ICCV 2015)~\cite{2015-papandreou-weakly} & 10K & 38.2\\ DCSM (ECCV 2016)~\cite{shimoda2016distinct} & 10K & 44.1\\ BFBP (ECCV 2016)~\cite{saleh2016built} & 10K & 46.6\\ STC (PAMI 2016)~\cite{wei2015stc} & 50K & 49.8 \\ SEC (ECCV 2016)~\cite{kolesnikov2016seed} & 10K & 50.7 \\ AF-SS (ECCV 2016)~\cite{qi2016augmented} & 10K & 52.6\\ \midrule \multicolumn{2}{l}{Supervision: Image-level Labels} \\ AE-PSL (ours) & 10K & $\bm{55.0}$ \\ \bottomrule \end{tabular} \vspace{-2em} \end{table} \begin{table}[t] \centering \caption{Comparison of weakly-supervised semantic segmentation methods on VOC 2012 \emph{test} set.} \small \label{tab:test-comp} \begin{tabular}{lcc} \toprule Methods & Training Set & mIoU \\ \midrule \multicolumn{2}{l}{Supervision: Box} \\ WSSL (ICCV 2015)~\cite{2015-papandreou-weakly} & 10K & 62.2 \\ BoxSup (ICCV 2015)~\cite{2015-dai} & 10K & 64.2 \\ \midrule \multicolumn{2}{l}{Supervision: Image-level Labels} \\ \multicolumn{3}{l}{(* indicates methods implicitly use pixel-level supervision)} \\ MIL-seg* (CVPR 2015)~\cite{pinheiro2015weakly} & 700K & 40.6 \\ SN\_B* (PR 2016)~\cite{wei2016learning} & 10K & 43.2\\ TransferNet* (CVPR 2016)~\cite{hong2015learning} & 70K & 51.2 \\ AF-MCG* (ECCV 2016)~\cite{qi2016augmented} & 10K & 55.5\\ \midrule \multicolumn{2}{l}{Supervision: Image-level Labels} \\ MIL-FCN (ICLR 2015)~\cite{pathak2014fully} & 10K & 24.9 \\ CCNN (ICCV 2015)~\cite{pathak2015constrained} & 10K & 35.6\\ MIL-sppxl (CVPR 2015)~\cite{pinheiro2015weakly} & 700K & 35.8 \\ MIL-bb (CVPR 2015)~\cite{pinheiro2015weakly} & 700K & 37.0 \\ EM-Adapt (ICCV 2015)~\cite{2015-papandreou-weakly} & 10K & 39.6\\ DCSM (ECCV 2016)~\cite{shimoda2016distinct} & 10K & 45.1\\ BFBP (ECCV 2016)~\cite{saleh2016built} & 10K & 48.0\\ STC (PAMI 2016)~\cite{wei2015stc} & 50K & 51.2 \\ SEC (ECCV 2016)~\cite{kolesnikov2016seed} & 10K & 51.7 \\ AF-SS (ECCV 2016)~\cite{qi2016augmented} & 10K & 52.7\\ \midrule \multicolumn{2}{l}{Supervision: Image-level Labels} \\ AE-PSL (ours) & 10K & $\bm{55.7}$ \\ \bottomrule \end{tabular} \vspace{-0.5em} \end{table} \subsection{Comparisons with State-of-the-arts} We make extensive comparisons with state-of-the-art weakly-supervised semantic segmentation solutions with different levels of annotations, including scribbles, bounding boxes, spots and image-level labels. Results of those methods as well as ours on PASCAL VOC \emph{val} are summarized in Table~\ref{tab:val-comp}. Among the baselines, MIL-*~\cite{pinheiro2015weakly}, STC~\cite{wei2015stc} and TransferNet~\cite{hong2015learning} use more images (700K, 50K and 70K) for training. All the other methods are based on 10K training images and built on top of the VGG16~\cite{simonyan2014very} model. From the result, we can observe that our proposed approach outperforms all the other works using image-level labels and point annotation for weak supervision. In particular, AF-MCG~\cite{qi2016augmented} achieves the second best performance among the baselines only using image-level labels. However, the MCG generator is trained in a fully-supervised way on PASCAL VOC, thus the corresponding result, \ie AF-MCG~\cite{qi2016augmented}, implicitly makes use of stronger supervision. Thus, with the Selective Search segments, the performance of AF-SS~\cite{qi2016augmented} drops by 1.7\%. Furthermore, GrabCut~\cite{rother2004grabcut} is also employed by AF-*\cite{qi2016augmented} to refine the segmentation masks for supervision, which is usually time consuming for training. In contrast, the proposed AE approach is very simple and convenient to carry out for object region mining. In addition, the online PSL is also effective and efficient for training the semantic segmentation network. Compared with those methods using image-level labels for supervision, the proposed AE-PSL improves upon the best performance by over 2.4\%. Besides, our approach also outperforms those methods that implicitly use pixel-level supervision by over 0.7\%. Additional comparison among these approaches on PASCAL VOC \emph{test} is shown in Table~\ref{tab:test-comp}. It can be seen that our method achieves the new state-of-the-art for this challenging task on a competitive benchmark. Figure~\ref{fig:example} shows some successful segmentations, indicating that our method can produce accurate results even for some complex images. One typical failure case is given in the bottom row of Figure~\ref{fig:example}. This case may be well addressed with a better erasing strategy such as using low level visual features (\eg color and texture) to refine and extend erasing regions. \begin{figure}[t] \centering \includegraphics[scale=0.60]{fig/example.pdf} \caption{Qualitative segmentation results on the VOC 2012 \emph{val} set. One failure case is shown in the last row.} \label{fig:example} \vspace{-1em} \end{figure} \begin{table*}\setlength{\tabcolsep}{2pt} \centering \caption{Comparison of segmentation mIoU scores using object regions from different AE steps on VOC 2012 \emph{val} set.} \label{tab:step} \footnotesize \begin{tabular}{C{1.5cm}|ccccccccccccccccccccc|c} \toprule AE Steps & bkg & plane & bike & bird & boat & bottle & bus & car & cat & chair & cow & table & dog & horse & motor & person & plant & sheep & sofa & train & tv & mIoU \\ \midrule AE-step1 & 82.6 & 63.0 & 27.5 & 45.9 & 38.3 & 43.6 & 61.3 & 29.2 & 60.0 & 13.6 & 52.0 & 32.6 & 52.4 & 49.8 & 47.9 & 43.7 & 32.6 & 61.4 & 29.4 & 35.1 & 41.9 & 44.9\\ AE-step2 & 82.2 & 69.3 & 29.7 & 60.9 & 40.8 & 52.4 & 59.3 & 44.2 & 65.3 & 13.0 & 58.9 & 32.2 & 60.0 & 56.6 & 49.1 & 43.0 & 34.2 & 69.7 & 32.1 & 42.8 & 43.2 & 49.5\\ AE-step3 & 78.5 & 71.8 & 29.2 & 64.1 & 39.9 & 57.8 & 58.5 & 54.5 & 63.0 & 10.3 & 60.5 & 36.0 & 61.6 & 56.1 & 62.6 & 42.9 & 36.5 & 64.5 & 31.5 & 49.5 & 38.7 & 50.9\\ \midrule AE-step4 & 74.4 & 65.5 & 28.2 & 59.7 & 38.5 & 57.8 & 57.5 & 59.0 & 57.2 & 9.6 & 54.9 & 39.2 & 56.5 & 52.6 & 65.0 & 43.2 & 34.9 & 55.9 & 30.4 & 47.9 & 36.8 & 48.8\\ \bottomrule \end{tabular} \vspace{-2em} \end{table*} \begin{figure}[t] \centering \includegraphics[scale=0.65]{fig/loss-failure.pdf} \caption{(a) Loss curves of classification network against varying numbers of training epochs, for different AE steps. (b) Failure cases of over erasing samples with four AE steps.} \label{fig:loss-failure} \vspace{-1.5em} \end{figure} \subsection{Ablation Analysis} \vspace{-0.5em} \subsubsection{Object Region Mining with AE} \vspace{-0.5em} \label{subsubsec:mdor} With the AE approach, discriminative object regions are adversarially erased step by step. Therefore, it is expected that the loss values of the classification networks at the convergence of training across different AE steps would progressively increase as more discriminative regions are absent for training the classification networks. Figure~\ref{fig:loss-failure} (a) shows the comparison of the classification training loss curves for different AE steps. It can be observed that the loss value at convergence of training with original images is around 0.05. By performing the AE for multiple steps, the converged loss value slightly increases (AE-step2: $\sim$0.08, AE-step3: $\sim$0.1) compared with that of the AE-step1. This demonstrates that AE removes regions with a descending discriminative ability. By continuing to perform the AE for more steps to remove more regions, the classification network only converges to one that provides a training loss as large as $\sim$0.15. This demonstrates no more useful regions are left for obtaining a good classification network, due to \emph{over} \emph{erasing}. \emph{over} \emph{erasing} may introduce many true negative regions into the mined foreground object regions and hampers learning segmentation. Some failure cases caused by \emph{over} \emph{erasing} are shown in Figure~\ref{fig:loss-failure} (b). In the case where most object regions are removed from the training images, the classification network has to rely on some contextual regions to recognize the categories. These regions are true negative ones and detrimental for the segmentation network training. To prevent contamination from negative regions, we only integrate those discriminative regions mined from the first three steps into the final segmentation masks. For quantitatively understanding the contribution of each AE step, Table~\ref{tab:step} shows the comparison of mIoU scores using foreground regions merged from varying $k\ (k= 1,2,3,4)$ AE steps for training the segmentation network based on DeepLab-CRF-LargeFOV. We can observe that the performance indeed increases as more foreground object regions are added since the segmentation network gets denser supervision. However, after performing four AE steps, the performance drops by 2.1\% due to the \emph{over} \emph{erasing} as explained above. Some visualization examples are shown in Figure~\ref{fig:mining_samples}, including training images (top row), heatmaps produced by different AE steps and the finally erased regions (bottom row). We can observe that the AE approach effectively drives the classification network to localize \emph{different} discriminative object regions. For example, regions covering the body of the right-most instance of ``cow" shown in the last column are first localized. By erasing this instance, another two instances on the left side are then discovered. We also conduct experiments on VOC 2012 \emph{test} set using object regions merged from the first three AE steps. The mIoU score is 52.8\%, which outperforms all those methods (as indicated in Table~\ref{tab:test-comp}) only using image-level labels for supervision. \begin{table*}\setlength{\tabcolsep}{2pt} \centering \caption{Comparison of segmentation mIoU scores in terms of different training strategies on VOC 2012 \emph{val} set.} \label{tab:lgsn} \footnotesize \begin{tabular}{l|ccccccccccccccccccccc|c} \toprule Methods & bkg & plane & bike & bird & boat & bottle & bus & car & cat & chair & cow & table & dog & horse & motor & person & plant & sheep & sofa & train & tv & mIoU \\ \midrule w/o PSL & 78.5 & 71.8 & 29.2 & 64.1 & 39.9 & 57.8 & 58.5 & 54.5 & 63.0 & 10.3 & 60.5 & 36.0 & 61.6 & 56.1 & 62.6 & 42.9 & 36.5 & 64.5 & 31.5 & 49.5 & 38.7 & 50.9\\ w/ PSL & 83.3 & 70.0 & 31.6 & 69.7 & 40.8 & 54.2 & 63.2 & 58.4 & 69.9 & 18.1 & 65.5 & 33.5 & 69.8 & 60.7 & 60.5 & 50.5 & 38.1 & 69.4 & 31.4 & 57.3 & 39.7 & 54.1 \\ w/ PSL++ & 83.4 & 71.1 & 30.5 & 72.9 & 41.6 & 55.9 & 63.1 & 60.2 & 74.0 & 18.0 & 66.5 & 32.4 & 71.7 & 56.3 & 64.8 & 52.4 & 37.4 & 69.1 & 31.4 & 58.9 & 43.9 & 55.0\\ \midrule w/ PSL+GT、 & 83.6 & 71.0 & 30.6 & 73.0 & 42.7 & 56.1 & 63.6 & 61.7 & 75.2 & 22.2 & 67.6 & 33.4 & 74.6 & 57.8 & 65.6 & 53.6 & 37.7 & 71.6 & 33.2 & 59.0 & 45.1 & 56.1\\ \bottomrule \end{tabular} \vspace{-1em} \end{table*} \begin{figure*}[t] \centering \includegraphics[scale=0.50]{fig/mining_samples.pdf} \caption{Examples of mined object regions produced by the proposed adversarial erasing approach. The second to fourth rows show the produced heatmaps, where the discriminative regions are highlighted. The images with erased regions are shown in the last row in gray.} \label{fig:mining_samples} \vspace{-1.5em} \end{figure*} \vspace{-1.2em} \subsubsection{Online PSL for Semantic Segmentation} \vspace{-0.5em} We now proceed to evaluate the online PSL and investigate how it benefits the AE approach by discovering auxiliary information. We report the performance of online PSL in Table~\ref{tab:lgsn}, where ``w/o PSL" and ``w/ PSL" denote the result of vanilla DeepLab-CRF-LargeFOV and the proposed PSL method for training, respectively. We can observe that PSL improves the performance by 3.2\% compared with ``w/o PSL", , demonstrating the significant effectiveness of PSL providing additional useful segmentation supervision. Besides, we perform one more iterative training step on PSL to improve the segmentation results. In particular, we first employ the trained segmentation model from AE and PSL to segment training images. Then, the predicted segmentation masks are used as supervision for training the segmentation network for another round. As shown in Table~\ref{tab:lgsn}, the performance provided by this extra training (denoted as w/ PSL++) is further improved from 54.1\% to 55.0\%. The improvement benefits from the operation of performing CRF on the predicted segmentation masks of training images. After one round training on top of CRF results, the segmentation network has been trained well. We do not observe further performance increase by performing additional training, as no new supervision information is fed in. Furthermore, we also examine the effectiveness of our testing strategy where the prohibited threshold is empirically set as 0.1. We utilize ground-truth image-level labels as classification confidences to weight the predicted segmentation score maps (note this is different from the prohibitive information imposed in the training stage). The result is 56.1\% (``w/ PSL + GT"), which is only 1.1\% better than ``w/ PSL ++". Note that ``w/ PSL + GT" actually provides an upper bound on the achievable performance as the score maps are filtered by the ground-truth category annotations and ``w/ PSL ++" performs very closely to this upper bound. PSL adopts the on-the-fly output of the classification network to re-weight segmentation score maps. Another choice for such classification information is the ground-truth annotation. We also consider the case of using ground-truth image-level labels for prohibiting during the training stage and evaluate the performance. However, using ground-truth information leads to performance drop of 0.6\% compared with our proposed PSL design. This is because PSL effectively exploits the information about object scale that is beneficial for generating more accurate segmentation masks (\ie categories of large objects are preferred with high classification scores compared with those of small objects). Simply using 0-1 ground-truth annotation ignores the scale and performs worse. We also investigate how PSL performs without using image-level classification confidences and find that the performance drops 1\%. This clearly validates the effectiveness of the proposed online PSL approach using image-level classification information. \vspace{-0.8em} \section{Conclusion} \vspace{-0.5em} We proposed an adversarial erasing approach to effectively adapt a classification network to progressively discovering and expanding object discriminative regions. The discovered regions are used as pixel-level supervision for training the segmentation network. This approach provides a simple and effective solution to the weakly-supervised segmentation problems. Moreover, we proposed an online prohibitive segmentation learning method, which shows to be effective for mining auxiliary information to AE. Indeed, the PSL method can aid any other weakly-supervised methods. This work paves a new direction of adversarial erasing for achieving weakly-supervised semantic segmentation. In the future, we plan to develop more effective strategies for improving adversarial erasing, such as erasing each training image with adaptive steps or integrating adversarial erasing and PSL into a more unified framework. \vspace{-0.5em} \section*{Acknowledgment} \vspace{-0.5em} The work is partially supported by the National Key Research and Development of China (No. 2016YFB0800404), National University of Singapore startup grant R-263-000-C08-133, Ministry of Education of Singapore AcRF Tier One grant R-263-000-C21-112 and the National Natural Science Foundation of China (No. 61532005). {\small \bibliographystyle{ieee}
{'timestamp': '2018-05-29T02:11:52', 'yymm': '1703', 'arxiv_id': '1703.08448', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08448'}
arxiv
\section{Introduction} The mobile games industry experienced an exponential growth in the past decade, motivated mainly by (i) an ever increasing worldwide penetration of smartphones and mobile devices, (ii) the ability of such devices to deliver quality audio and video; and (iii) the increasing capacity of network transmissions of these devices, allowing users to download larger and more complex games~\cite{Soh:2008:MG:1325555.1325563}. The largest gaming phenomenon of the smartphone age so far has been the augmented reality game {\it Pok{\'e}mon Go}. It was launched in July 2016, firstly in Australia, New Zeland, and USA. Yet, in one week after launching, it had already reached seven million users, accounting for three to six times more downloads of the most popular games in history at that time~\cite{pokemongostatistics}. The game makes use of GPS, camera, and position sensors of smartphones which allow its users to capture, battle and train virtual creatures called Pok{\'e}mons. These creatures appear on the phone screen as if they were in the real world. The set of technologies that allow this kind of experience support the so-called augmented reality, a field that has received a lot of attention after the game success. There has been a number of recent studies exploiting behavioral changes among Pok{\'e}mon Go players. Nigg et al.~\cite{nigg2017Pokemon} suggest that Pok{\'e}mon Go may increase physical activity and decrease sedentary behaviors. Other efforts~\cite{tateno2016new,dorward2016Pokemon, de2016field} argue that the game may represent a new shift in perspective: players tend to socialize more while playing as they tend to concentrate in popular areas of the game, often called Pok{\'e}Stops. Since the game requires the user to walk in the real world to see and capture the Pok{\'e}mons nearby, a new wave of supporting apps has emerged. In these apps, players can collaborate with each other, sharing where and when Pok{\'e}mons were found. They represent the emergence of a crowdsourcing effort of the game players to find rare and valuable Pok{\'e}mons. PokeCrew\footnote{https://www.pokecrew.com/}, one such app of great popularity, is a crowdsourced Pok{\'e}mon Go map. It shows reports of locations of Pok{\'e}mon posted by players in real time in a map and it became quite popular among the most active users. For example, this website was ranked among the top 15000 domains in the Web, according to Alexa.com~\cite{alexa} and its IOS and android versions had hundreds of thousands downloads. In this paper, we characterize the crowdsourcing effort of Pok{\'e}mon Players through PokeCrew. Crowdsourcing systems enlist a multitude of humans to help solve a wide variety of problems. Over the past decade, numerous such systems have appeared on the Web. Prime examples include Wikipedia, Yahoo! Answers, Mechanical Turk-based systems, and many more~\cite{howe2006rise}. Our effort consists in characterizing an emerging type of crowdsourcing system, identifying many interesting technical and social challenges. To that end, we obtained a near two-month log of reports from the game players, containing 39,895,181 reports of Pok{\'e}mon locations. Our analyses uncover a set of aspects of user behavior and system usage in an emerging crowdsourcing task. We hope our effort can inspire the design of emerging crowdsourcing systems. In the following, we first describe the data used in our study and then analyze how users collaboratively help each other within the Pokecrew platform. We finish this paper with our conclusions and possible directions for future work. \section{Dataset} With the increasing popularity of Pok{\'e}mon Go in the whole world, many applications emerged with the purpose of enhancing the players experience with the game. Among the most popular ones are Pokecrew\footnote{www.pokecrew.com}, PokeRadar\footnote{https://www.Pokemonradargo.com/}, and PokeVision\footnote{www.pokevision.com}. The idea is to share Pok{\'e}mon maps and their locations in a crowdsourced way: after finding Pok{\'e}mons in the game itself users may report them in the supporting app, making the creatures visible to other players that are not in that specific location and time. This can be very useful to players, since, in the game, it is not possible to see Pok{\'e}mons far from where the player is currently physically located. We have obtained data from Pokecrew, a popular app that offers to users a map containing the location of Pok{\'e}mons reported by other users. The application can be found in the PlayStore, AppStore, as well as on the Web. Our dataset contains 39,895,181 reports, from July 12$^{th}$ to August 24$^{th}$ 2016. Each report contains several information fields, including: a report id, reported Pok{\'e}mon id, geographic coordinates, time when the report was created and, in some registers, a username. Our results show that most reports in our dataset (98.7\%) do not include a valid username, since the app does not require the user to identify itself in order to create reports. Thus, although we report general statistics computed over the whole dataset in the next section, we focus on the subset of reports with valid usernames to study user behavior. We note that, despite the small percentage, there is still a considerable amount of identifiable reports (over 500k) on which we can perform such analysis. Finally, we also note that the spatial information in our dataset refers to geographic coordinates of the reports. \section{Reported Pok{\'e}mons and their Locations} We start our characterization by analyzing which Pok{\'e}mons are the most reported ones and where they were reported. We then discuss the application adoption on specific locations. \subsection{Most Reported Pok{\'e}mons} Table~\ref{tab:toppok} shows the top-10 most reported Pok{\'e}mons in our dataset. We note that these Pok{\'e}mons are evolutions or difficult to find in the game. An evolution of a given Pok{\'e}mon consists of a similar monster but with a higher power, which is very important to battle with other Pok{\'e}mons in the so called 'gyms', popular places across the world where a user (a Pok{\'e}mon master) battles with other users in order to take control of that gym. Besides that, having these evolutions contributes to the user's Pokedex, which is a list containing detailed stats for every creature from the Pok{\'e}mon games. The more Pok{\'e}mons a user has in her list, more experience she has on the game, which is also important to battle with other players at the gyms. Capturing an evolution is attractive to players because the only alternative way to obtain them is to use an egg, which is earned as the player progress in the game. With this egg, the Pok{\'e}mon master can put it to crash, which is achieved by walking. The distance required to crash an egg may vary (2, 5 or 10 kilometers). The higher the distance, the more valuable the Pok{\'e}mon that comes out of the egg is. Thus, it is much more convenient to catch the evolved Pok{\'e}mon right away than it is to walk waiting for the egg to crack and, luckily, be rewarded with a powerful Pok{\'e}mon. This observation shows the great contribution of Pokecrew to Pok{\'e}mon players: the interest in rare Pok{\'e}mons or evolutions is what drive players to appeal to these crowdsourced apps. These Pok{\'e}mons are more valuable than the most commonly found, which normally have less power to battle. \begin{table}[ht] \centering \begin{tabular} {l|r} \hline Pok{\'e}mon's Name & Number of Reports \\ \hline Fearow & 4,957,913 \\ Raichu & 3,910,515 \\ Slowbro & 2,395,383 \\ Golduck & 2,150,770 \\ Pidgeot & 2,051,487 \\ Nidoran & 1,507,741 \\ Tentacool & 1,199,451 \\ Nidoqueen & 1,044,395 \\ Magnemite & 938,829 \\ Clefable & 928,105 \\ \hline \end{tabular} \caption{Top 10 reported Pok{\'e}mons} \label{tab:toppok} \label{reported Pokemons} \end{table} \subsection{Pok{\'e}mon Location} We note that our dataset contains only geographic coordinates of the reports. In order to characterize the location where these reports were made, we first converted the coordinates to the cities and countries where the reports are made. Our approach to do that consisted of using a reliable Python library, namely geopy\footnote{https://pypi.python.org/pypi/geopy/}, which allows us to retrieve the nearest town/city for a given latitude/longitude coordinate. Most of the reports (almost 34\%) come from the U.S, followed by Singapore and Malyasia. We also noticed that three American cities -- New York City, San Francisco and Santa Monica -- are included in the top 10 cities. \subsection{Crowdsourcing Adoption} In this kind of application, the initial stage of its lifespan can be unattractive to the users due to the lack of data in the system. In PokeCrew and other competing apps, this aspect is even more critical, since the adoption of Pok{\'e}mon GO was fast and user engagement was very strong. In an application like Pokecrew, if the user does not encounter Pok{\'e}mon reports, it is very likely she will not be motivated to use the system and therefore won't be encouraged to create new reports. \begin{figure}[!tbh] \centering \includegraphics[scale=0.45]{NY20regions} \caption{Geographical Location of Top 20 regions from NY} \label{fig:NY20regions} \end{figure} To assess whether the previous presence of Pok{\'e}mons in the application influences the user to create new reports, we compared the amount of reports in a popular area among the days. To that end, we focused on the reports in the city of New York, which concentrates most part of reports. The city geographic area was first divided into 800 regions of approximately $500m^2$ , and for each region we counted the total number of reports created on each day. Besides that, we considered the period from August 14$^{th}$ to 26$^{th}$, which concentrates a larger number of reports. It is possible to see in Figure \ref{fig:NY20regions}, most of the reports made in New York City, were created in the Central Park area, a very popular place in the game itself. Figure~\ref{fig:heatmap} shows a heat map correlating the number of reports in each region showed in Figure~\ref{fig:NY20regions} in each date. \begin{figure}[!thb] \centering \includegraphics[scale=0.48]{heatmap} \caption{Heat Map of Top 20 regions from NY} \label{fig:heatmap} \end{figure} \section{User Behavior} Next, we provide a characterization of the crowdsourced Pokecrew data, exploring aspects of user behavior and their engagement within this crowdsourced system. The dataset collected presents 39,895,181 reports, but only 452,359 (1.3\%) are registered users (non-anonymous). We focus the next analysis on the behavior of this identified group of users. \subsection{User Engagement} Analyzing the reports made by registered users, we can notice that some of them, mostly users who contributed with the largest amounts of reports, reported a large number of sightings in just one day. For example, the top 1 user reported 184,615 times, being her reports concentrated between July 21$^{st}$ and 24$^{th}$. Specifically, reported 13,007 times on July 21$^{st}$ and 75,574 on July 22$^{nd}$, which are very expressive numbers. Similarly, 31,656 reports made by the second most active user, which corresponds to almost 99.7\% of his contribution to the Pokecrew system, were concentrated on a single day, August 12$^{th}$. The 10 most active users in the Pokecrew system, in terms of reports of Pok{\'e}mon sightings, are shown in Table \ref{tab:top10users}. We note that some users have reported far many sightings than others, especially the 4 most active ones. Given the large amount of reports associated with these users, and the short time interval during which they were made, we speculate that these reported sightings may not have been made by ``legitimate" Pokecrew users. \begin{table}[!b] \centering \begin{tabular} {p{0.4\linewidth}p{0.4\linewidth}} \hline Counting reports & User name \\ \hline 184615 & yay1199 \\ 31766 & hi \\ 609 & mongrelo \\ 413 & luchocadaingles \\ 270 & maestroPok{\'e}monbelloto \\ 261 & rooty \\ 255 & srdandrea \\ 239 & crescenttough \\ 236 & ceryatec \\ 235 & guantoresp \\ \hline \end{tabular} \caption{Top 10 users and their counting reports} \label{tab:top10users} \end{table} Based on the amount of reports that the top 5 have made, and the fact that these reports are, in general, concentrated in a few set of days, we've disregarded this data for some analysis. Just a few number of users have reported from 30 to 261 times. Most of users have reported from 1 to 20 times. We have categorized users who have reported from 1 to 5 times as less active users, representing 80\% of the database. Given that for each report we have the information about the time when it was created and its location, we can calculate for each pair of reports of a single user the speed in which he would have to dislocate in order to make both reports. Calculating the speed for each pair of user's report, we obtained a set of speeds from the identified user's reports. The chart bellow shows the speed distribution across the total identifiable users: \begin{figure}[!htb] \centering \includegraphics[scale=0.43]{cdf_speed_plot_final} \caption{Speed distribution across identified users} \end{figure} As we can see in the plot above, a considerable number of reports made by the users in the system reveal that they would have to move at abnormally high speeds for this kind of game. Even if we consider the case where a user report a Pok{\'e}mon in one place, go on an airplane trip and then report another in the destination, which although maybe uncommon, is possible, some speeds are not feasible to achieve. The problem is that, even though the PokeCrew app uses the GPS data from the smartphone and places the map in the user current location, the player has the ability to move the map to any place in the world and therefore report a sighting from anywhere. There is no validation in the app if the report being created is trustful. This opens a serious flaw in the system, because malicious users and even bots could create fake sightings to spoof the system and degrade the legit user experience. Even if the user could not change the location in the map, it would still be possible to report a Pok{\'e}mon that does not exist in the game itself at that given time and location. This kind of validation is a key problem in collaborative systems, and can be very challenging due to the lack of mechanisms to control whether the information being supplied to the database is true or not. \subsection{Temporal Analysis} The created at field represents the date when the the sighting was reported by a user. The chart below shows an analyse about how many reports were made in each day. From July 12$^{th}$, when Pokecrew was created, to August 7$^{th}$ there were not many users contributing to the system. This scenario changes after August 8$^{th}$, with a peak of reports on August 21$^{st}$. \begin{figure}[!htb] \centering \includegraphics[width=8.2cm]{reportsperdate.png} \caption{Amount of reports per date} \end{figure} \section{Concluding Discussion} This paper explores one out of a new wave of applications that rely on collaborative databases in the mobile gaming environment. Pok{\'e}mon Go was a huge phenomenon in this area and motivated the creation of innumerable initiatives to help gamers with the task of catching, training and battling Pok{\'e}mons across the city. Since the game requires the user to walk and visit places in order to succeed at being a Pok{\'e}mon master, this kind of support showed to be extremely useful to players, because they could go straight to the exact location where a desired Pok{\'e}mon is located instead of randomly walk hoping to find some valuable monster, as we could see with the most reported Pok{\'e}mons. One important aspect in this work was to show how vulnerable such systems are to spoofed data. Inconsistent locations over time for some users and the noticeably high amount of reports these users pushed to the system certainly had a negative impact over the legit final user experience, who could encounter fake reports on the map. Although the app lacks mechanisms to prevent these fake reports, the establishment of a trustful relation with the user is difficult to achieve \section{Acknowledgments} We would like to thank Pokecrew for kindly sharing its data with our research group. This work is supported by author's individual grants from Capes, Fapemig, and CNPq. F. Benevenuto is also supported by Humboldt Foundation.
{'timestamp': '2017-03-27T02:06:21', 'yymm': '1703', 'arxiv_id': '1703.08365', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08365'}
arxiv
\section{INTRODUCTION} \label{section:introduction} This paper addresses the problem of redistributing a large number of homogeneous agents among a set of states, such as tasks to be performed or spatial locations to occupy. While there exist several well established methods for control of multi-agents \cite{ren2008distributed,bullo2009distributed,mesbahi2010graph}, many of these control approaches do not scale well to very large agent populations. Hence an alternative approach for controlling multi-agent systems is by modeling the system as a fluid. This is justified by modeling each agent's dynamics by a continuous-time Markov chain (CTMC) and then the mean-field behavior of the system is determined by the {\it Kolmogorov forward equation} corresponding to the CTMC. A similar approach also exists when the agent dynamics evolves of discrete time. In this case the agents' state evolution over time is described by a discrete time Markov chain (DTMC). It is known that a discrete time Markov chain (DTMC) admits a stationary distribution under certain conditions of irreducibility, recurrency, and aperiodicity. These conditions are determined by the properties of the stochastic transition matrix of the process. If it is feasible to make a desired distribution invariant by choosing appropriate transition probabilities, then it is possible to compute {\it optimized} transition probabilities that guarantee the fastest rate of convergence to the invariant distribution. One of the first works to address this problem is \cite{boyd2004fastest}, which formulates a semidefinite program (SDP) whose solution is the set of transition probabilities that yield optimal exponential convergence. In the case of a continuous time Markov chain (CTMC), the time evolution of the system is governed by a transition rate matrix, the \textit{generator} of the stochastic process. In \cite{berman2009optimized}, the authors present methods for computing optimized transition rates of a CTMC that drive the system to any strictly positive desired distribution at a fast convergence rate. The works \cite{berman2009optimized} and \cite{boyd2004fastest} address an open-loop optimal control problem for the Kolmogorov forward equation, in which the control parameters, which are the transition probabilities or rates of the process, are constrained to be time-invariant. These approaches have been extended to the case of time-varying control parameters in several different contexts. In \cite{bandyopadhyay2013inhomogeneous,demir2015decentralized,mather2011distributed}, the authors design feedback controllers to drive a Markov chain to a target distribution. In contrast to traditional control approaches for Markov chains that use only the agent states as feedback \cite{puterman2014markov}, these works use the agent {\it densities} at different states as feedback and continuously re-compute the control parameters such that the target distribution is stabilized. Since this type of feedback generally requires global information about the densities at all states, these works have developed {\it decentralized} control approaches, in which each agent's control parameters depend only on information that the agent can obtain from its local environment. This information may be derived from activity at the agent's current state or from activity that is communicated from an adjacent state. Such approaches minimize the inter-agent communication that is needed to implement the control strategy. There has also been some recent work on mean-field games, where Hamilton-Jacobi-Bellman (HJB) based methods are used for control sysnthesis \cite{gomes2013continuous}. However, unlike HJB based methods in classical control theory, mean-field games based approaches do not result in feedback controllers. In this framework the synthesized control inputs are open-loop in nature and have the desired behavior only for a predefined fixed initial conditions of the mean-field model. In this paper, the second of a two-part series (Part I is \cite{elamvaz2016lin}), we contribute three main results to the mean-field control problem for CTMCs. First, we demonstrate that it is possible to compute density-independent transition rates of a CTMC that make any probability distribution with a strongly connected support (to be defined later) invariant and globally stable. Similar work in \cite{acikmese2012markov} has characterized the class of stabilizable stationary distributions for DTMCs with control parameters that are time and density-invariant; we characterize this class of distributions for CTMCs with the same type of control parameters (see Proposition \ref{thm:ArbDist}). Second, we have proven, that using time varying control parameters, asymptotic controllability of the system to any probability distribution is possible. Third, we show that the density-dependent generator of a CTMC can be designed to have a decentralized structure and to converge to the zero matrix at equilibrium. This convergence of the control inputs to zero stops the agents from switching between states, and thus potentially wasting energy on unnecessary transitions, once the target distribution is reached. As pointed out in \cite{bandyopadhyay2013inhomogeneous}, the controllers developed in the prior work described above have nonzero control inputs at equilibrium, resulting in continued agent switching between states. We present a proof by construction of our third main result for graphs of arbitrary size. In addition to our theoretical results, we develop an algorithm using sum-of-squares (SOS) tools to construct density-dependent control laws with our desired properties. Our nonlinear control approach in this work differs from our approach in \cite{elamvaz2016lin}, where we investigate linearization-based controllers for CTMCs with the same specifications. While linear controllers have low computational complexity, they violate positivity constraints on the control inputs. To realize linear controllers in practice for our problem, we can implement them with rational feedback laws that mimic their behavior, as we show in \cite{elamvaz2016lin}. However, this approach results in unbounded controls. In contrast, the controllers that we develop in this paper take the form of positive polynomials, and we can therefore guarantee their global boundedness. Additionally, in contrast with the approaches presented in \cite{bandyopadhyay2013inhomogeneous},\cite{demir2015decentralized} when agent dynamics are given by DTMCs, all computations for the control synthesis is done offline in our methodology. Hence, the computational burden on the agents is significantly much lower in our work in comparison. \section{NOTATION} We denote by $\mathcal{G = (V,E)}$ a directed graph with $M$ vertices, $\mathcal{V} = \lbrace 1,2,...,M \rbrace$, and a set of $N_{\mathcal{E}}$ edges, $\mathcal{E}\subset \mathcal{V} \times \mathcal{V}$. We say that $e = (i,j) \in \mathcal{E}$ if there is an edge from vertex $i \in \mathcal{V}$ to vertex $j \in \mathcal{V}$. We define a source map $S : \mathcal{E} \rightarrow \mathcal{V}$ and a target map $T: \mathcal{E} \rightarrow \mathcal{V}$ for which $S(e) = i$ and $T(e) = j$ whenever $e = (i,j) \in \mathcal{E}$. There is a {\it directed path} of length $f$ from vertex $i\in \mathcal{V}$ to vertex $j\in \mathcal{V}$ if there exists a sequence of edges $\{e_k\}^f_{k=1}$ in $\mathcal{E}$ with $S(e_1) = i$, $T(e_f) = j$, and $S(e_j)=T(e_{j-1})$ for all $j \in \lbrace 2,3,...,M \rbrace$. We assume that the graph $\mathcal{G}$ is {\it strongly connected}, which means a directed path exists from any vertex $i \in \mathcal{V}$ to any other vertex $j \in \mathcal{V}$. We assume that $(i,i) \notin \mathcal{E}$ for all $i \in \mathcal{V}$. The graph $\mathcal{G}$ is said to be {\it bidirected} if $e = (S(e),T(e)) \in \mathcal{E}$ implies that $\tilde{e} = (T(e),S(e))$ also lies in $\mathcal{E}$. We define $\mathbb{R}^M$ as the $M$-dimensional Euclidean space, $\mathbb{R}^{M \times N}$ as the space of $M \times N$ matrices, and $\mathbb{R}_+$ as the set of positive real numbers. The notation ${\rm int}(B)$ refers to the interior of the set $B \subset \mathbb{R}^M$. Given a vector $\mathbf{x} \in \mathbb{R}^M$, $\mathbf{x}_i$ denotes the $i^{th}$ coordinate value of $\mathbf{x}$. For a matrix $\mathbf{A} \in \mathbb{R}^{M \times N}$, $\mathbf{A}^{ij} $ denotes the element in the $i^{th}$ row and $j^{th}$ column of $\mathbf{A}$. Given a vector $\mathbf{y} \in \mathbb{R}^M$, for each vertex $i\in \mathcal{V}$, the set $\sigma_\mathbf{y}(i) \subset \mathcal{V}$ consists of all vertices $j$ for which there exists a directed path $\{e_i\}^f_{i=1}$ of some length $f$ from $j$ to $i$ such that $\mathbf{y}_{S(e_k)} = 0$ for each $1 \leq k \leq f-1$. We say that a vector $\mathbf{x}^d \in \mathbb{R}^M $ has a {\it strongly connected support} if the subgraph $\mathcal{G}_{sub} = (\mathcal{V}_{sub},\mathcal{E}_{sub})$, defined by $\mathcal{V}_{sub} = \lbrace v \in \mathcal{V}: \mathbf{x}^d_v >0 \rbrace$ and $\mathcal{E}_{sub} = \mathcal{V}_{sub} \times \mathcal{V}_{sub}\cap \mathcal{E}$, is strongly connected. Moreover, $\mathcal{V}_{sub}$ is called the {\it support} of the vector $\mathbf{x}^d$. The matrix $\mathcal{L}_{out}(\mathcal{G}) = \mathbf{D}_{out}(\mathcal{G}) - \mathbf{A}(\mathcal{G}) \in \mathbb{R}^{M \times M}$ denotes the {\it out-Laplacian} of the graph $\mathcal{G}$, where $\mathbf{D}_{out}(\mathcal{G})$ is the out-degree matrix of $\mathcal{G}$ and $\mathbf{A}(\mathcal{G})$ is the adjacency matrix of $\mathcal{G}$. $\mathbf{D}_{out}(\mathcal{G})$ is a diagonal matrix for which $(\mathbf{D}_{out}(\mathcal{G}))^{ii}$ is the total number of edges $e$ such that $S(e)=i$. The entries of $\mathbf{A}(\mathcal{G})$ are defined as $(\mathbf{A}(\mathcal{G}))^{ij} = 1$ if $(j,i) \in \mathcal{E}$, and 0 otherwise. When the graph $\mathcal{G}$ is bidirected, $\mathcal{L}_{out}(\mathcal{G})$ is the usual Laplacian of the graph, and we will drop the subscript and denote it by $\mathcal{L}(\mathcal{G})$. \section{PROBLEM STATEMENT} \label{section:problem statement} Consider a swarm of $N$ autonomous agents whose states evolve in continuous time according to a Markov chain with finite state space $\mathcal{V}$. As an example application of interest, $\mathcal{V}$ can represent a set of spatial locations that are obtained by partitioning the agents' environment. The graph $\mathcal{G}$ determines the pairs of vertices (states) between which the agents can transition. We define $u_{e}:[0,\infty) \rightarrow \mathbb{R}_+$ as a {\it transition rate} for each $e=(i,j) \in \mathcal{E}$. The evolution of the $N$ agents' states over time $t$ on the state space $\mathcal{V}$ is described by $N$ stochastic processes, $X_i(t) \in \mathcal{V}$, $i=1,...,N$. Each stochastic process $X_i(t)$ evolves according to the following conditional probabilities for each $e \in \mathcal{E}$: \begin{equation} \mathbb{P}(X_i(t+h) = T(e) | X_i(t) = S(e)) =~ u_{e}(t)h + o(h). \label{eq:ConditionalProb} \end{equation} Here, $o(h)$ is the little-oh symbol and $\mathbb{P}$ is the underlying probability measure defined on the space of events $\Omega$ (which will be left undefined, as is common) induced by the stochastic processes $\lbrace X_i(t) \rbrace_{i=1}^N$. Let $\mathcal{P(V)}$ be the set of probability densities on $\mathcal{V}$. Then $\mathcal{P(V)}$ can be associated with the $(M-1)$ dimensional simplex, $\lbrace \mathbf{y} \in \mathbb{R}^M_+: ~\sum_i y_i = 1 \rbrace$. Let $\mathbf{x}(t) \in \mathbb{R}^n$ be the vector of probability distributions of the random variable $X(t)$ at time $t$, that is, \begin{equation} x_i(t) = \mathbb{P}(X(t) = i), ~~~ i \in \lbrace 1,...,M \rbrace. \end{equation} In the case of continuous time and countable state space, the evolution of probability distributions is determined by the \textit{Kolmogorov forward equation}. Since the $X_i(t)$ are identically distributed random variables, the forward equation can be represented by a linear system of ordinary differential equations (ODEs), \begin{equation} \dot{\mathbf{x}}(t) =\mathbf{G}^T\mathbf{x}(t), \hspace{3mm} \mathbf{x}(0) \in \mathcal{P(V)}, \label{eq:OLsys1} \end{equation} where the matrix $\mathbf{G}$ is the $M \times M$ generator of the process. Each element $G^{ij}$, where $(i,j) = e \in \mathcal{E}$, is the probability per unit time, defined as the transition rate $u_e$ in Equation \eqref{eq:ConditionalProb}, of an agent switching from vertex $i = S(e)$ to vertex $j = T(e)$. The number of transitions between vertices $i$ and $j$ in $h$ units of time has a Poisson distribution with parameter $G^{ij} h$; see \cite{norris1998markov} for details. The elements of $\mathbf{G}$ have the following properties: \begin{equation} 0 \leq G^{ij} < \infty, \hspace{3mm} G^{ii} = -\sum\limits_{j=1,j\neq i}^M G^{ij}. \end{equation} The system (\ref{eq:OLsys1}) can be cast in an explicitly control-theoretic form, \begin{equation} \dot{\mathbf{x}}(t) =\sum\limits_{e \in \mathcal{E}} u_e \mathbf{B}_{e} \mathbf{x}(t), \hspace{3mm} \mathbf{x}(0) \in \mathcal{P(V)}, \\ \label{eq:OLsys2} \end{equation} where $\mathbf{B}_e$, $e \in \mathcal{E}$, are control matrices with entries \[ B_e^{ij} = \begin{cases} -1 & \text{if } i = j= S(e),\\ 1 & \text{if } i= T(e), \hspace{1mm} j = S(e),\\ 0 & \text{otherwise.} \end{cases} \] The focus of this paper is to solve the problem of achieving arbitrary distributions using density feedback control. For clarity, we first consider the open-loop version of our control problem, before moving on to the closed-loop version. Given a desired probability distribution $\mathbf{x}^d$, the problem of computing the transition rates (control parameters) $\lbrace u_e \rbrace_{e \in \mathcal{E}}$ to achieve the desired distribution can be framed as follows: \begin{problem} Find positive control parameters $\lbrace u_e \rbrace_{e \in \mathcal{E}}$ such that $\lim_{t \rightarrow \infty} \| \mathbf{x}(t) - \mathbf{x}^d \| = 0 $ for all $\mathbf{x}^0 \in \mathcal{P(V)}$. \label{prob:ArbDist} \end{problem} We provide a complete characterization of the stationary distributions that are stabilizable for this case. Although density- and time-independent transition rates of CTMCs have been previously computed in an optimization framework \cite{berman2009optimized}, the question of which equilibrium distributions are feasible has remained unresolved for the case where the target distribution is not strictly positive on all vertices. While only strictly positive target distributions have been considered in previous work on control of swarms governed by CTMCs \cite{berman2009optimized,halasz2007dynamic}, we address the more general case in which the target densities of some states can be zero. This question was addressed in \cite{acikmese2012markov} for swarms governed by DTMCs. The problem has also been investigated in the context of consensus protocols \cite{chapman2015advection} for strictly positive distributions, where what is referred to as ''advection on graphs'' is in fact the forward equation corresponding to a CTMC. In our controller synthesis, we will relax the assumption of strict positivity for desired target distributions. The main problem that we address in this paper is the following: \begin{problem} Given a strictly positive desired equilibrium distribution $\mathbf{x^d} \in \mathcal{P(V)}$, compute transition rates $u_e: \mathcal{P(V)} \rightarrow\mathbb{R}_+$, $e \in \mathcal{E}$, such that the closed-loop system \begin{equation} \dot{\mathbf{x}}(t) =\sum_{e\in\mathcal{E}} u_e(\mathbf{x}) \mathbf{B}_e \mathbf{x}(t) \label{eq:CLsys1} \end{equation} satisfies $\lim_{t \rightarrow \infty} \| \mathbf{x}(t) - \mathbf{x}^d \| = 0 $ for all $\mathbf{x}^0 \in \mathcal{P(V)}$, with the additional constraint that $u_e(\mathbf{x}^d)=0$ for all$e \in \mathcal{E}$. Moreover, the density feedback should have a decentralized structure, in that each $u_e$ must be a function only of densities $x_i$ for which $i = S(e)$ or $i = S(\tilde{e})$, where $T(\tilde{e}) = S(e)$. \label{prob:Control} \end{problem} We note that we were able to describe the state evolution of the agents by system \eqref{eq:OLsys2} when the transition rates were density-independent because the agents' states were independent and identically distributed (i.i.d.) random variables in that case. However, when the density feedback control law $\{u_e(\mathbf{x})\}_{e \in \mathcal{E}}$ is used, the independence of the stochastic processes $X_i(t)$ is lost. This implies that the evolution of the probability distribution cannot be described by system \eqref{eq:OLsys2}. However, if we invoke the \textit{mean-field hypothesis} and take the limit $N \rightarrow \infty$, then we can model the evolution of the probability distribution according to a nonlinear Markov chain. In this limit, the number of agents at vertex $v \in \mathcal{V}$ at time $t \in [0, T]$ where, $T>0$, denoted by $N_v(t,\omega)$ (where $\omega$ is used to emphasize that $N_v(\cdot)$ is a random variable, which denotes the number of agents in vertex $\mathcal{(V)}$), converges to $x_v(t)$ in an appropriate sense, provided that solutions of \eqref{eq:CLsys1} are defined until a given final time $T>0$. A rigorous process for taking this limit in a stochastic process setting is described in \cite{ethier2009markov,kolokoltsov2010nonlinear}. \section{ANALYSIS} In this section, we first address the controllability problem in Problem \ref{prob:Control}, and then the stabilizability problem in Problem \ref{prob:ArbDist}. \subsection{Controllability} \begin{proposition} Let $\mathcal{G}$ be a strongly connected graph. Suppose that $\mathbf{x}^0 \in \mathcal{P(V)}$ is an initial distribution and $\mathbf{x}^d \in \mathcal{P(V)}$ is a desired distribution. Additionally, assume that $\mathbf{x}^d$ has strongly connected support. Then there is a set of parameters, $a_e \in [0, \infty)$ for each $e \in \mathcal{E}$, such that if $u_e(t)= a_e$ for all $t \in [0, \infty)$ and for each $e \in \mathcal{E}$ in system \eqref{eq:CLsys1}, then the solution $\mathbf{x}(t)$ of this system satisfies $ \| \mathbf{x}(t) - \mathbf{x}^d \| \leq M e^{-\lambda t} $ for all $t \in [0, \infty)$ and for some positive parameters $M$ and $\lambda$ that are independent of $\mathbf{x}^0$. \label{thm:ArbDist} \end{proposition} \begin{proof} Let $\mathcal{V}_s \subset \mathcal{V}$ be the support of $\mathbf{x}^d$. From this vertex set, we construct a new graph $\tilde{\mathcal{G}}= (\mathcal{V},\tilde{\mathcal{E}})$, where $e=(i,j) \in \mathcal{E}$ implies that $e \in \tilde{\mathcal{E}} $ if and only if $i \in \mathcal{V}_s$ implies that $j \not\in \mathcal{V} \backslash \mathcal{V}_s$. Then it follows from \cite{chapman2015advection}[Proposition 10] that the process generated by the transition rate matrix $-\mathcal{L}_{out}(\mathcal{\tilde{G})}^T$ has a unique, globally stable invariant distribution if we can establish that $\tilde{\mathcal{G}}$ has a {\it rooted in-branching} subgraph. This implies that $\tilde{\mathcal{G}}$ must have a subgraph $\tilde{\mathcal{G}}_{sub} =(\mathcal{V},\mathcal{E}_{sub})$ which has no directed cycles and for which there exists a root node, $v_r$, such that for every $v \in \mathcal{V}$ there exists a directed path from $v$ to $v_r$. This is indeed true for the graph $\tilde{\mathcal{G}}$, which can be shown as follows. First, let $r \in \mathcal{V}$ such that $x^d_r > 0 $. From the assumption that $\mathcal{G}$ is strongly connected and the construction of $\tilde{\mathcal{G}}$, it can be concluded that there exists a directed path in $\tilde{\mathcal{E}}$ from any $v\in \mathcal{V}$ to $r$. Now, for each $n \in \mathbb{Z}_+$, let $\mathcal{N}_n(r)$ be the set of all vertices for which there exists a directed path of length $n$ to $r$. For each $n >1$, let $\tilde{\mathcal{N}}_n(r) = \mathcal{N}_n(r) \backslash \cup_{m=1}^{n-1} \mathcal{N}_m(r)$. We define $\tilde{\mathcal{E}}_{sub}$ by setting $e \in \tilde{\mathcal{E}}_{sub} $ if and only if $e \in \mathcal{E}$, $S(e) \in \tilde{\mathcal{N}}_n(r)$, and $T(e) \in \tilde{\mathcal{N}}_{n-1}(r)$ for some $n >1$. Then $\tilde{\mathcal{G}}_{sub} =(\mathcal{V},\mathcal{E}_{sub})$ is the desired rooted in-branching subgraph. The matrix $-\mathcal{L}_{out}(\mathcal{\tilde{G})}^T$ is the generator of a CTMC, since $\mathcal{L}_{out}(\mathcal{\tilde{G})}^T \mathbf{1} = \mathbf{0}$ and its off-diagonal entries are positive. Moreover, as we have shown, $\mathcal{\tilde{G}}$ has a rooted in-branching subgraph. Hence, there exists a unique vector $\mathbf{z}$ such that $-\mathcal{L(\tilde{G})}\mathbf{z} = \mathbf{0}$ and $\mathbf{z} \in \mathcal{P}(\mathcal{V})$. The vector $\mathbf{z}$ is nonzero only on $\mathcal{V}_s$, since the subgraph corresponding to $\mathcal{V}_s$ is strongly connected. Then we consider a positive definite diagonal matrix $\mathbf{D} \in \mathbb{R}^{M \times M}$ such that $D^{ii}= z_i/x^d_i$ if $i \in \mathcal{V}_s$ and an arbitrary strictly positive value for any other $i \in \mathcal{V}$. The matrix $-\mathbf{D}\mathcal{L}_{out}(\mathcal{\tilde{G})}^T$ is also the generator of a CTMC. Moreover, $\mathbf{x}^d$ is the unique stationary distribution of the process generated by $-\mathbf{D}\mathcal{L}_{out}(\mathcal{\tilde{G})}^T$, since $\mathbf{x}^d$ lies in the null space of $\mathbf{G} = -\mathcal{L}_{out}(\mathcal{\tilde{G})} \mathbf{D}$ by construction. The simplicity of the principal eigenvalue at $0$ for the matrix $-\mathbf{D}\mathcal{L}_{out}(\mathcal{\tilde{G})}^T$ is inherited by the same eigenvalue of the matrix $\mathbf{G}$. Then the result follows by setting $a_e = G^{T(e)S(e)}$ for each $e \in \mathcal{E}$ and by noting that since $\mathbf{G}^T$ is the generator of a CTMC, and its eigenvalue at zero has the aforementioned properties is simple, then the rest of the spectrum of $\mathbf{G}$ lies in the open left half of the complex plane. \end{proof} This result can be extended to the case of time-varying control parameters. In particular, any $\mathbf{x}^d \in {\rm int}(\mathcal{P})$ can be reached in finite time from a given $\mathbf{x}^0 \in \mathcal{P}$ using time-varying control parameters $\lbrace u_e(t) \rbrace_{e \in \mathcal{E}}$. We restate the following theorem from our companion paper \cite{elamvaz2016lin}. \begin{theorem} \label{ctrtheo} \cite{elamvaz2016lin} If the graph $\mathcal{G} = (\mathcal{V}, \mathcal{E})$ is strongly connected, then the system \ref{eq:OLsys2} is small-time globally controllable from every point in the interior of the simplex defined by $\mathcal{P}(\mathcal{V})$. \end{theorem} \begin{remark} In fact, we can state the following broader result. If $\mathcal{G}$ is strongly connected, then the system is also {\it path controllable}: given any trajectory $\gamma(t)$ in $ \mathcal{P}(\mathcal{V})$ that is defined over a finite time interval [0, T] and is once differentiable with respect to the time variable $t$, there exists a control law $\mathbf{u}:[0,T] \rightarrow [0,\infty)^{N_\mathcal{E}}$ such that the solution of the control system \eqref{eq:CLsys1} satisfies $\mathbf{x}(t) = \gamma(t)$ for all $t \in [0,T]$. This is true because conical combinations of the collection of vectors $\lbrace \mathbf{B}_e\mathbf{y} \rbrace_{e \in \mathcal{E}}$ span the tangent space of $\mathcal{P}(\mathcal{V})$ whenever $\mathbf{y}$ lies in the interior of $\mathcal{P}(\mathcal{V})$. For example, given a strongly connected graph $\mathcal{G}$, if $(i,j) \in \mathcal{E}$ and there exists a directed path $\mu$ from $j$ to $i$, then $-\mathbf{B}_{(i,j)} \mathbf{1} = \sum_{e \in \mu}\mathbf{B}_e \mathbf{1}$. \end{remark} As we mention in \cite{elamvaz2016lin}, this result cannot be extended to prove reachability of distributions that correspond to points on the boundary of $\mathcal{P(V)}$. On the other hand, the following theorem states that these boundary points are {\it asymptotically controllable}. A key difference between the following result and the results in Proposition \ref{thm:ArbDist} and Theorem \ref{ctrtheo} is that the target distributions need not have strongly connected supports. \begin{proposition} Let $\mathcal{G}$ be a strongly connected graph. Suppose that $\mathbf{x}^0 \in \mathcal{P(V)}$ is the initial distribution, and $\mathbf{x}^d \in \mathcal{P(V)}$ is the desired distribution. Then for each $e \in \mathcal{E}$, there exists a set of time-dependent control parameters $u_e : \mathbb{R}_+ \rightarrow \mathbb{R}_+$, $e \in \mathcal{E}$, such that the solution $\mathbf{x}(t)$ of the controlled ODE \eqref{eq:CLsys1} satisfies $\lim_{t \rightarrow \infty} \mathbf{x}(t) = \mathbf{x}^d$. \end{proposition} Before presenting the full proof of this proposition, we briefly sketch the proof for clarity. The proof is mainly based on Theorem \ref{ctrtheo} and uses an approach similar to that used in Proposition \ref{thm:ArbDist} to prove the existence of control inputs that stabilize desired distributions $\mathbf{x}^d$ with strongly connected support. The idea is to first partition the vertex set $\mathcal{V}$ into disjoint subsets $\lbrace \mathcal{V}_i \rbrace$ that each contain a single vertex $r$, called the {\it root node}, for which $x^d_r \neq 0$, and some other vertices $v$, called {\it transient nodes}, for which $x^d_v = 0$ and there is a directed path to the root node in $\mathcal{V}_i$. This partition will ensure that the subgraphs corresponding to $\lbrace \mathcal{V}_i \rbrace$ are at least weakly connected. Then using Theorem \ref{ctrtheo}, we can design control inputs that drive the solutions of the system \eqref{eq:OLsys2} exactly to an intermediate distribution $\mathbf{x}^{in}$, for which the total mass at the vertices in $\mathcal{V}_i$ is equal to the total mass required at the root node in $\mathcal{V}_i$. Such a distribution $\mathbf{x}^{in}$ necessarily exists in ${\rm int}(\mathcal{S})$. Then we invoke an argument made in Proposition \ref{thm:ArbDist} to ensure that all the mass at the transient nodes is directed toward their corresponding root nodes, which can be achieved using time-variant control inputs. This will establish asymptotic controllability of the boundary points of $\mathcal{P}\mathcal{(V)}$. \begin{proof} We define the set $\mathcal{R} = \lbrace i: \hspace{1mm} x^d_i > 0, \hspace{2mm} 1 \leq i \leq M \rbrace$ with cardinality $N_{\mathcal{R}}$. Let $\mathcal{I}:\lbrace 1,2,...,N_\mathcal{R} \rbrace \rightarrow \mathcal{R} $ be a bijective map that defines an ordering on $\mathcal{R}$. Then we recursively define a collection $\lbrace{\mathcal{V}_n} \rbrace$ of disjoint subsets of $\mathcal{V}$ as follows: \begin{align} \mathcal{V}_1 = \lbrace \mathcal{I}(1)\} \cup \lbrace i \in \mathcal{V}: \hspace{1mm} x^d_i = 0 \hspace{2mm} s.t. \hspace{2mm} i \in \sigma_{ \mathbf{x}^d}(\mathcal{I}(1)) \rbrace \nonumber \\ \mathcal{V}_n = \lbrace \mathcal{I}(n)\rbrace \cup \lbrace i \in \mathcal{V}: \hspace{1mm} x^d_i = 0 \hspace{2mm} s.t. \hspace{2mm} i \in \sigma_{ \mathbf{x}^d}(\mathcal{I}(n)) \hspace{2mm} \nonumber \\ and \hspace{2mm} i \notin \cup_{k=1}^{n-1}\mathcal{V}_k) \rbrace \nonumber \end{align} for each $n \in \lbrace 2,3,...,N_{\mathcal{R}}\rbrace$. We note that $\mathcal{V} = \cup_{n=1}^{N_{\mathcal{R}}}\mathcal{V}_{n}$. Let $\mathbf{x}^{in} \in {\rm int}(\mathcal{P(V)})$ be some element such that $\sum_{k \in \mathcal{V}_n}x^{in}_k = x^d_{\mathcal{I}(n)}$ for each $n \in \lbrace 1,2,...,N_{\mathcal{R}} \rbrace$. From Theorem \ref{ctrtheo}, we know that there exists a control $u^1_e:[0,T] \rightarrow \mathbb{R}_+$ for each $e \in \mathcal{E}$ such that the solution $\mathbf{x}(t)$ of the control system \eqref{eq:OLsys2} satisfies $\mathbf{x}(T)= \mathbf{x}^{in}$. Now we will design $\lbrace u_e\rbrace_{e \in \mathcal{E}}$ such that $u_e(t) = u^1_e(t)$ for each $t \in [0,T]$ and $u_e(t) = a_e$ for each $t \in (T,\infty]$, where $a_e$ is defined as follows: \[ a_e= \begin{cases} 0 &\text{if } S(e) \in \mathcal{V}_ n \text{ and } T(e) \notin \mathcal{V}_n \hspace{0.5mm} ~~\forall 1 \leq n \leq N_{\mathcal{R}}, \\ 0 &\text{if } S(e)=\mathcal{I}(n) ~\text{ for some } 1 \leq n \leq N_{\mathcal{R}}, \\ 1 & \text{otherwise.} \end{cases} \] Then the solution of system \eqref{eq:OLsys2} for $t>T$ can be constructed from the solution of the following decoupled set of ODEs: \begin{eqnarray} \label{eq:Asymsys} \dot{\mathbf{y}}_n(t) &=& -\mathcal{L}_{out}(\mathcal{\tilde{G}}_n)\mathbf{y}_n(t), \hspace{3mm} t \in [T, \infty) \\ \nonumber \mathbf{y}_n(T) &=& \mathbf{y}_n^0 \in \mathcal{P}(\mathcal{V}_n) \end{eqnarray} for $1 \leq n \leq N_{\mathcal{R}}$. Here, $\mathcal{G}_n=(\mathcal{V}_n,\mathcal{E}_n)$ for each $1 \leq n \leq N_{\mathcal{R}}$, where $e \in \mathcal{E}_n$ if $S(e),T(e) \in \mathcal{V}_n$, and $a_e =1$. The solution of system \eqref{eq:Asymsys} is related to the solution of system \eqref{eq:OLsys2} with $\mathbf{x}(T) = \mathbf{x}^{in}$ through a suitable permutation matrix $\mathbf{P}$: $\mathbf{P}\mathbf{x}(t) = [\mathbf{y}_1(t) ~ \mathbf{y}_2(t) ~.... ~\mathbf{y}_{N_{\mathcal{R}}}(t)]$. Since each graph $\mathcal{G}_n$ has a rooted in-branching subgraph, the process generated by $ -\mathcal{L}_{out}(\mathcal{\tilde{G}}_n)^T$ has a unique stationary distribution. Moreover, by construction, this unique, globally stable stationary distribution is the vector $[x^d_{\mathcal{I}(n)} ~ \mathbf{0}_{1 \times (|\mathcal{V}_n|-1)}]^T$, where $|\mathcal{V}_n|$ is the cardinality of the set $\mathcal{V}_n$. This implies that $\lim _{t \rightarrow \infty}\mathbf{P}^{-1}\mathbf{y}(t) =\lim _{t \rightarrow \infty} \mathbf{x}(t) = \mathbf{x}^d$. By concatenating the control inputs $\lbrace u^1_e \rbrace_{e \in \mathcal{E}}$ and $\lbrace a_e \rbrace_{e \in \mathcal{E}}$, we obtain the desired asymptotic controllability result. \end{proof} An interesting aspect of the above proof is its implication that asymptotic controllability is achievable with piecewise constant control inputs with a finite number of pieces. From the above result, it follows that any point in $\mathcal{P}(V)$ can be stabilized using a full-state feedback controller \cite{clarke1997asymptotic}. However, for a general target equilibrium distribution, a stabilizing controller with a decentralized structure might not exist. Before we present an algorithm to construct polynomial feedback control laws, it is important that we address the feasibility of Problem \ref{prob:Control}. Toward this end, we will investigate the stabilizability of the system (\ref{eq:OLsys2}). \subsection{Stabilizability} \label{section:stabilize} We will prove stabilizability by constructing an explicit control law for a graph of arbitrary size that fulfills all the conditions of Problem \ref{prob:Control}. We propose the following decentralized control law, which depends on the agent densities in different states, and prove that the resulting closed-loop system is asymptotically stable. For $i,j \in \lbrace 1,...,M\rbrace$, let $g_i(x_i(t)) = (x_i(t)-x_i^d)^2$, and let $w_{ij}=1$ if $(i,j)\in \mathcal{E}$ and $0$ otherwise. Define a transition rate (control) matrix $\mathbf{G}(\mathbf{x}(t))$ with the following entries: \begin{eqnarray} G^{ij} = \begin{cases} ~~w_{ij}(g_i+g_j), & \hspace{3mm} i\neq j \nonumber \\ -\sum\limits_{k=1}^M w_{1k}(g_i+g_k), & \hspace{3mm} i = j. \end{cases} \label{eq:control} \\ \end{eqnarray} $\mathbf{G}$ thus defined satisfies all the properties of a transition rate matrix described in Section \ref{section:problem statement}; that is, each row sums to 1 and each element is non-negative. It is clear that when $x_i(t)=x_i^d$ for all $i \in \mathcal{V}$, then all $g_i = 0$, resulting in $\mathbf{G}(\mathbf{x}^d)=\mathbf{0}$, which satisfies our requirement that the control parameters equal zero at equilibrium. The second requirement of a decentralized control structure is enforced by setting $w_{ij} = 0$ whenever $(i,j) \neq \mathcal{E}$. All that remains is to prove that, with this choice of $\mathbf{G}$, the closed-loop system is asymptotically stable. \begin{proposition} The closed-loop system \begin{equation} \dot{\mathbf{x}}(t)=\mathbf{G}(\mathbf{x}(t))^T\mathbf{D}\mathbf{x}(t) \label{eq:CLsys2} \end{equation} with $\mathbf{G}$ defined as in Equation (\ref{eq:control}) is asymptotically stable. \end{proposition} \begin{proof} For ease of representation, we will use this system description rather than the equivalent system (\ref{eq:CLsys1}). To prove the stability of this system, we propose the following candidate Lyapunov function: \begin{equation} V(\mathbf{x}) = \frac{1}{2}\left(\mathbf{x}(t)^T\mathbf{D}\mathbf{x}(t)-(\mathbf{x}^d)^T \mathbf{D} \mathbf{x}^d\right). \label{eq:V} \end{equation} We now check the conditions for this function to be a Lyapunov function for the desired equilibrium point $\mathbf{x}^d$. We clearly have that $V(\mathbf{x}^d)=0$. To prove that $V(\mathbf{x})>0$ for all $\mathbf{x}\in \mathcal{P(V)}\backslash\lbrace \mathbf{0} \rbrace$, we note the following: \begin{align} V(\mathbf{x}) &= \frac{1}{2}\left(\mathbf{x}(t)^T\mathbf{D}\mathbf{x}(t)-(\mathbf{x}^d)^T \mathbf{D} \mathbf{x}^d\right) \nonumber\\ & = \frac{1}{2}\left((\mathbf{D}^\frac{1}{2} \mathbf{x})^T (\mathbf{D}^\frac{1}{2} \mathbf{x}) -1\right) \nonumber\\ &= \frac{1}{2}\left(\langle \mathbf{D}^\frac{1}{2} \mathbf{x},\mathbf{D}^\frac{1}{2} \mathbf{x} \rangle-1\right). \label{eq:LyapPos} \end{align} We will now show that the minimum value that $\langle\mathbf{D}^\frac{1}{2} \mathbf{x},\mathbf{D}^\frac{1}{2} \mathbf{x} \rangle$ can attain on $\mathcal{P(V)}$ is $1$, which is possible only at $\mathbf{x}^d$, guaranteeing strict positivity of the expression (\ref{eq:LyapPos}) for any other $\mathbf{x} \in \mathcal{P(V)}$. We apply the following coordinate transformation to shift the simplex associated with $\mathcal{P(V)}$, so that $\mathbf{x}^d$ coincides with the origin. Let $\mathbf{y}=\mathbf{x}-\mathbf{x}^d$. Then, \begin{equation} \sum_{i=1}^M y_i = \sum_{i=1}^M (x_i-x^d) = 0 \label{(eq:ysum)}, \end{equation} and therefore, \begin{align} \langle \mathbf{D}^\frac{1}{2} \mathbf{x},\mathbf{D}^\frac{1}{2} \mathbf{x} \rangle &= \langle \mathbf{D}^\frac{1}{2} (\mathbf{y+x}^d),\mathbf{D}^\frac{1}{2} (\mathbf{y+x}^d) \rangle \nonumber \nonumber \\ &= \langle \mathbf{y},\mathbf{D} \mathbf{y} \rangle + 2\langle \mathbf{y},\mathbf{D} \mathbf{x}^d \rangle + \langle \mathbf{x}^d,\mathbf{D} \mathbf{x}^d \rangle \nonumber \\ &= \langle \mathbf{y},\mathbf{D} \mathbf{y} \rangle + 1 \end{align} Since $\mathbf{Dx}^d=\mathbf{1}$ and $\langle \mathbf{y},\mathbf{1}\rangle=0$ (this follows from Equation (\ref{(eq:ysum)})), the function (\ref{eq:LyapPos}) is positive on all $\mathbf{x}\in \mathcal{P(V)}\backslash\lbrace \mathbf{0} \rbrace$. Lastly, we compute the time derivative of the candidate Lyapunov function: \begin{align} \dot{V}(\mathbf{x}(t)) &= \frac{1}{2}\dot{\mathbf{x}}(t)^T\mathbf{Dx}(t) + \frac{1}{2}\mathbf{x}(t)^T\mathbf{D}\dot{\mathbf{x}}(t) \nonumber \\ &= \frac{1}{2}(\mathbf{G}^T\mathbf{Dx}(t))^T\mathbf{Dx}(t) + \frac{1}{2}\mathbf{x}^T(t)\mathbf{D}(\mathbf{G}^T\mathbf{D}\mathbf{x}(t)) \nonumber \\ &= \mathbf{x}(t)^T(\mathbf{DGD})\mathbf{x}(t). \label{eq:Vdot} \end{align} For the equilibrium $\mathbf{x}^d$ to be asymptotically stable, we must have $\dot{V}(\mathbf{x}(t))<0$, $\forall \mathbf{x}\in \mathcal{P(V)} \backslash \lbrace 0 \rbrace $. Negative semi-definiteness of $\dot{V}$ is guaranteed by the fact that $\mathbf{G}(\mathbf{x}(t))$ is a transition rate matrix. Strict negativity of $\dot{V}$ can be confirmed by algebraic manipulation of expression (\ref{eq:Vdot}) as follows. Setting $r(t) = x(t)/x^d$, we obtain: \begin{align} \dot{V}(\mathbf{x}(t)) &= (\mathbf{Dx}(t))^T \mathbf{G}(\mathbf{x}(t)) (\mathbf{Dx}(t)) \nonumber \\ &= \mathbf{r}(t)^T\mathbf{G}(\mathbf{x}(t))\mathbf{r}(t) \nonumber\\ &= \sum\limits_{i,j=1,i\neq j}^M -(r_i-r_j)^2 w_{ij}(g_i+g_j). \label{eq:Vdot2} \end{align} The expression (\ref{eq:Vdot2}) is a negative sum-of-squares (SOS) and thus equals zero only when $r_i=r_j$ for all $i, j$, which is possible only at $\mathbf{x}(t) = \mathbf{x}^d$. Hence, this function is strictly negative for all $\mathbf{x}\in \mathcal{P(V)}\backslash\lbrace \mathbf{0} \rbrace$. In summary, the function (\ref{eq:V}) fulfills all the criteria of a Lyapunov function, thus proving asymptotic stability of the the closed-loop system \eqref{eq:CLsys2}. \end{proof} \section{COMPUTATIONAL APPROACH} In this section, we briefly discuss how decentralized nonlinear controls can be constructed algorithmically. By describing an algorithmic procedure, we hope to demonstrate that additional constraints can be added, to improve the performance of the closed loop system. We will construct control laws that are polynomial functions of the state of the system. We will take the aid of SOSTOOLS, short for Sum-of-Squares toolbox, used for polynomial optimization. SOSTOOL has been a very popular method to provide algorithmic solution of problems that can be formulated as polynomial non-negative constraints that are otherwise difficult to solve \cite{prajna2002introducing}. In this methods non-negativity constraint is relaxed to the existence of a SOS decomposition, which is then tested using Semidefinite programming. A point to be noted here is that the procedure described below is one of the possible methods to construct such control laws. We now pose Problem \ref{prob:Control} as an optimization problem. \begin{problem} Let, \begin{equation} \mathcal{P(V)}= \lbrace(x_1,...,x_n) \in \mathbb{R}^n | x_i \geq 0, \hspace{1mm} \sum\limits_{i=1}^n x_i = 1, \forall i \rbrace. \label{eq:Simplex} \end{equation} Let $\mathbb{R}[x]$ represent the set of polynomials and $\Sigma_s$ denote the set of SoS polynomials. \\ Consider the system (\ref{eq:CLsys2}), which is of the form $\dot{x}=g(x)u(t)$, $u(t)=k(x)$ \\ Given, matrix $\mathbf{B}_i$ and Lyapunov function $V(\mathbf{x})$.\\ Find, $u(x) \in \mathbb{R}[x]$ such that, \begin{align} u (x) \geq 0 \\ u(x^d) = 0 \\ \nabla V(x)^T g(x)k(x) \leq 0 \label{eq:GradV} \end{align} for all $x \in \mathcal{P(V)}$ \end{problem} Here, we are using the same Lyapunov function (\ref{eq:V}) used in Section (\ref{section:stabilize}) to prove stabilizability. We have already established that it has zero magnitude at equilibrium $\mathbf{x}^d$ and is positive everywhere on $\mathcal{P(V)}$. Hence, we only need to test for its gradient's negative definiteness, which is being encoded here. In this construction we are fixing the candidiate Lyapunov function and constructing a control law such that the \ref{eq:V} is indeed a Lyapunov function for the closed loop system \ref{eq:CLsys1}. Alternatively, one could search for both the Lyapunov function and the control law together, but this renders the problem bilinear in the 2 variables. Iterating between the two variables is one way to get around this problem. To implement (\ref{eq:GradV}), that is, to show local negative definiteness of the gradient (on the simplex $\mathcal{P(V)}$), we use the following result well known in literature on \textit{positivestellansatz}, known as \textit{Schmudgen's} positivestellansatz, \cite{schweighofer2005optimization}. \begin{theorem} Suppose $S=\lbrace x:g_i(x) \geq 0, \hspace{1mm} h_i(x) =0\rbrace$ is compact. If $f(x) \geq 0$ for all $x \in S$, then there exist $s_i, r_{ij},...\in \Sigma_s$ and $t_i \in \mathbb{R}[x]$ such that, \begin{align} f = &1+ \sum_j t_jh_j +s_0 + \sum_i s_ig_i + \sum_{i \neq j}r_{ij}g_ig_j +\nonumber \\ &\sum_{i \neq j \neq k}r_{ijk}g_i g_j g_k + ... \end{align} \end{theorem} This theorem gives sufficient conditions for positivity of the function $f$ on a semi-algebraic set (\ref{eq:Simplex}). In our case, this translates to looking for $t_i \in \mathbb{R}[x]$ and $s_i \in \Sigma_s$ such that \begin{align} -\frac{\partial V}{\partial t} = \frac{\partial V}{\partial x}f-(th+s_0+\Sigma_i s_i g_i) \end{align} where $f$ is the vector field, $h$ is the equality constraint in (\ref{eq:Simplex}) and $g_i$ are the combinations of the inequalities in (\ref{eq:Simplex}). \section{NUMERICAL SIMULATIONS} We computed two types of feedback controllers for the closed-loop system (\ref{eq:OLsys2}) to redistribute populations of $N=100$ and $N=1000$ agents on the five-vertex chain graph in Fig. \ref{fig:graph}. The first controller ({\it Case 1}) was computed using SOSTOOLS, as described in the previous section, and the second controller ({\it Case 2}) was defined according to Equation \eqref{eq:control}. In both cases, the initial distribution was $\mathbf{x}^0 = [0.4 \hspace{2mm} 0.1 \hspace{2mm} 0.05 \hspace{2mm} 0.35 \hspace{2mm} 0.1]^T$, and the desired distribution was $\mathbf{x}^d = [0.1 \hspace{2mm} 0.2 \hspace{2mm} 0.25 \hspace{2mm} 0.4 \hspace{2mm} 0.05]^T$. The solution of the mean-field model with each of the two controllers and the trajectories of a corresponding stochastic simulation are compared in Figures (\ref{fig:ConstructControl_1000})-(\ref{fig:SOSControl_100}). To speed up the convergence rate to equilibrium, all the controller gains were multiplied by a factor of 10. Also, for ease of comparison, the ODE solutions were scaled by the number of agents. We observe that the performance of the {\it Case 1} controller is better than that of the {\it Case 2 controller}. We note that if faster convergence to the equilibrium is desired, this could be encoded as constraint in SOSTOOLS. As discussed in Section \ref{section:problem statement}, the underlying assumption of using the mean-field model \eqref{eq:OLsys2} is that the swarm behaves like a continuum. That is, the ODE \eqref{eq:OLsys2} is valid as number of agents $N \rightarrow \infty$. Hence, it is imperative to check the performance of the feedback controller for different agent populations. We observe that the the stochastic simulation follows the ODE solution quite closely in all four simulations. In addition, in all simulations, the numbers of agents in each state remain constant after some time; in the case of 100 agents, the fluctuations stop earlier than in the case of 1000 agents. This is due to the property of the feedback controllers that as the agent densities approach their desired equilibrium values, the transition rates tend to zero. This effect is shown explicitly in Fig. \ref{fig:AgentPath}, which plots the time evolution of a two agents' state (vertex number) during a stochastic simulation with both of the controllers. For both controllers, the agent's state remains constant after a certain time. \begin{figure} \centering \includegraphics[width= \linewidth]{graph.eps} \caption{Five-vertex bidirected chain graph.} \label{fig:graph} \end{figure} \begin{figure} \centering \includegraphics[width= \linewidth]{SoS_100.eps} \caption[caption]{Trajectories of the mean-field model {\it (thick lines)} and the corresponding stochastic simulation {\it (thin lines)} for the {\it Case 1} closed-loop controller with $N=100$ agents.} \label{fig:ConstructControl_1000} \end{figure} \begin{figure} \centering \includegraphics[width= \linewidth]{SoS_1000.eps} \caption[caption]{Trajectories of the mean-field model {\it (thick lines)} and the corresponding stochastic simulation {\it (thin lines)} for the {\it Case 1} closed-loop controller with $N=1000$ agents.} \label{fig:SoSControl_1000} \end{figure} \begin{figure} \centering \includegraphics[width= \linewidth]{Control_100.eps} \caption[caption]{Trajectories of the mean-field model {\it (thick lines)} and the corresponding stochastic simulation {\it (thin lines)} for the {\it Case 2} closed-loop controller with $N=100$ agents.} \label{fig:ConstructControl_100} \end{figure} \begin{figure} \centering \includegraphics[width= \linewidth]{Control_1000.eps} \caption[caption]{Trajectories of the mean-field model {\it (thick lines)} and the corresponding stochastic simulation {\it (thin lines)} for the {\it Case 2} closed-loop controller with $N=1000$ agents.} \label{fig:SOSControl_100} \end{figure} \begin{figure} \centering \includegraphics[width= \linewidth]{AgentPath.eps} \caption[caption]{State (vertex number) of two agents over time, during stochastic simulations of the closed-loop system with the {\it Case 1} and {\it Case 2} controllers in the loop.} \label{fig:AgentPath} \end{figure} \section{CONCLUSION} In this paper, we have presented a novel approach to mean-field feedback stabilization of a swarm of agents that switch stochastically among a set of states according to a continuous time Markov chain. We proved that a desired state distribution with strongly connected support can be stabilized using time-invariant control inputs. We also showed asymptotic controllability of distributions that are not strictly positive, with target densities equal to zero for some states. Lastly, for bidirected, strongly connected graphs, we proved stabilizability of the closed-loop system by explicitly constructing decentralized, density-dependent control laws that equal zero at equilibrium. Furthermore, we presented and numerically validated a procedure for designing polynomial feedback control laws algorithmically using the SOSTOOLS MATLAB toolbox. In summary, by using nonlinear feedback control laws, we obtain guarantees on global boundedness of the controls and are able to prove global asymptotic stability of the desired distribution. In future work, we plan to investigate exponential stability of the closed-loop system and design control laws that optimize the convergence rate to equilibrium. Another direction of future work is to characterize the effect of noise in estimates of the agent densities on the convergence properties of the proposed control laws. \bibliographystyle{plain}
{'timestamp': '2017-03-29T02:03:48', 'yymm': '1703', 'arxiv_id': '1703.08515', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08515'}
arxiv
\section*{Introduction} \noindent Precision oncology promises to tailor the full spectrum of cancer care to an individual patient, notably in terms of personalization of cancer prevention, screening, risk stratification, therapy and response assessment. With sufficient infrastructure support and concerted efforts from the different stakeholders, it is possible to foresee that personalized therapy would become the standard of care in oncology \autocite{meric-bernstam_building_2013}. Cancer mechanisms are increasingly elucidated as functions of different biomarkers or tumour genetic mutations, thereby changing the way we design clinical trials to achieve better cancer management efficacy in specific patient sub-populations \autocite{renfro_precision_2016}. On the other hand, \enquote{rapid learning paradigms} (i.e. knowledge-driven healthcare) consisting of reusing routine clinical data to develop knowledge in the form of models that can predict treatment outcomes for a larger portion of the population have also gained popularity in the oncology community \autocite{lambin_rapid_2013,shrager_rapid_2014}. Although most research approaches to precision oncology are centered on genomics technologies \autocite{weitzel_genetics_2011,garraway_precision_2013}, it is thought that only the integration of multiple-omics, i.e., panomics data (genomics, transcriptomics, proteomics, metabolomics, etc.) could efficiently unravel biological mechanisms \autocite{el_naqa_biomedical_2014,ebrahim_multi-omic_2016}. The importance of panomics integration for cancer risk assessment emerges from the tremendous extent of heterogeneous characteristics expressed at multiple levels of tumours. Genes, proteins, cellular microenvironments, tissues and anatomical landmarks within tumours exhibit considerable spatial and temporal variations that could potentially yield valuable information about tumour aggressiveness. Tumours are generally composed of multiple clonal sub-populations of cancer cells forming complex dynamic systems that exhibit rapid evolution as a result of their interaction with their microenvironment and therapy perturbations \autocite{fisher_cancer_2013}. Differing properties can be attributed to the different sub-populations in terms of growth rate, expression of biomarkers, ability to metastasize, and immunological characteristics \autocite{heppner_tumor_1983}. These properties could be described by differences in metabolic activity, cell proliferation, oxygenation levels, pH, blood vasculature and necrotic areas observed within the tumour. Such intratumoural differences are related to the concept of tumour heterogeneity, a characteristic that can be observed with significantly different extents even amongst tumours of the same histopathological type. Tumours exhibiting such heterogeneous characteristics are thought to be associated with high risk of resistance to treatment, progression, metastasis or recurrence \autocite{fidler_critical_1990,yokota_tumor_2000,campbell_patterns_2010}. Nowadays, medical imaging plays a central role in the investigation of intratumoural heterogeneity, as radiological images are acquired as routine practice for almost every patient with cancer. Medical images such as 2-deoxy-2-[$^{18}$F]fluoro-D-glucose (FDG) positron emission tomography (PET) and X-ray computed tomograph (CT) are minimally invasive and they carry an immense source of potential data for decoding the tumour phenotype \autocite{gillies_radiomics:_2016}. The quantitative extraction of high-dimensional mineable data from all types of medical images and whose subsequent analysis aims at supporting clinical decision-making is a process coined with the term \enquote{radiomics} \autocite{el_naqa_exploring_2009,gillies_biology_2010,lambin_radiomics:_2012,kumar_radiomics:_2012}. The demonstration that gene-expression signatures and clinical phenotypes could be inferred from tumour imaging features \autocite{segal_decoding_2007,diehn_identification_2008,aerts_decoding_2014} has led to an exponential growth of this field in the past few years \autocite{hatt_characterization_2016,yip_applications_2016}. The underlying hypothesis of radiomics is that the genomic heterogeneity of aggressive tumours could translate into heterogeneous tumour metabolism and anatomy, thereby envisioning the quantitative analysis of diagnostic medical images as an essential prognostic tool for cancer risk assessment and as an integral part of panomic tumour signature profiling. The translation of radiomics analysis into standard cancer care to support treatment decision-making involves the development of prediction models integrating clinical information that can assess the risk of specific tumour outcomes \autocite{lambin_predicting_2013}(Fig.~\ref{fig:StudyWorkflow}). In this work, our main objective is to construct prediction models using advanced machine learning to evaluate the risk of locoregional recurrences and distant metastases prior to chemo-radiation of head-and-neck (H\&N) cancers, a group of biologically similar neoplasms originating from the squamous cells that line the mucosal surfaces in the oral cavity, paranasal sinuses, pharynx or larynx. The locoregional control of H\&N cancers is usually good, but this is, however, not matched by improvements in survival, as the development of distant metastases and second primary cancers are the leading causes of treatment failure and death \autocite{ferlito_incidence_2001,baxi_causes_2014}. In order to improve patient survival and outcomes, the importance of identifying relevant prognostic factors that can better assess the aggressiveness of tumours at the moment of diagnosis is crucial. We hypothesize that radiomic features are important prognostic factors for the risk assessment of specific H\&N cancer outcomes \autocite{wong_radiomics_2016}. The machine learning strategy employed in this work involves the extraction of 1615 different radiomic features from a total of 300 patients from four different institutions. Two cohorts are used to construct the prediction models by combining radiomics (intensity, shape, textures) and clinical attributes (patient age, H\&N type, tumour stage) via random forests classifiers and imbalance-adjustments of training samples, and the remaining two cohorts are reserved to evaluate the prediction (binary assessment of outcome) and prognostic (time-to-event assessment) performance of the corresponding models (Fig.~\ref{fig:MLstrategy}). Throughout this study, results obtained for locoregional recurrences and distant metastases are also compared against prediction models constructed for the general risk assessment of overall survival in H\&N cancer. A comprehensive comparison of the prediction/prognostic performance of radiomics versus clinical models and volumetric variables is also performed. Our results suggest that the integration of radiomic features into clinical prediction models has considerable potential for assessing the risk of specific outcomes prior to treatment of H\&N cancers. Accurate stratification of locoregional recurrence and distant metastasis risks could eventually provide a rationale for adapting the radiation doses and chemotherapy regimens that the patients receive. Overall, combining quantitative imaging information with other categories of prognostic factors via advanced machine learning could have a profound impact on the characterization of tumour phenotypes and would increase the possibility of translation of outcome prediction models into the clinical environment as a means to personalize treatments. \begin{figure}[!htbp] \includegraphics[width=\textwidth]{StudyWorkflow.eps} \caption{\textbf{From radiomics analysis to treatment personalization.} \footnotesize{\textbf{(a)} Example of diagnostic FDG-PET and CT images of two head-and-neck cancer patients with tumour contours. The patient that did not respond well to treatment (right) has a more heterogeneous intratumoural intensity distribution in both FDG-PET and CT images than the patient that responded well to treatment (left). \textbf{(b)} The radiomics analysis strategy involves the extraction of features differentiating responders from non-responders to treatment. Features are extracted from the FDG-PET and CT tumour contours and quantify tumour shape, intensity, and texture. \textbf{(c)} Advanced machine learning combines radiomics features and patient clinical information via a random forest algorithm. The classifier is trained to differentiate between responders and non-responders to treatment (prediction model). \textbf{(d)} The output probability of the random forest classifier computed on new patients can be used to assess the risk of non-response to treatment via probabilities of occurrence of outcome events and time estimates. Eventually, accurate risk assessment of specific tumour outcomes via radiomics analysis could help to better personalize cancer treatments.}} \label{fig:StudyWorkflow} \end{figure} \bigskip \begin{figure}[!htbp] \centering \includegraphics[width=\textwidth]{MLstrategy.eps} \caption{\textbf{Models construction strategy and analysis workflow.} \footnotesize{Four different cohorts were used to demonstrate the utility of radiomics analysis for the pre-treatment assessment of the risk of locoregional recurrence and distant metastases in head-and-neck cancer. The H$\&$N1 and H$\&$N2 cohorts were combined and used as a single training set ($n=194$), whereas the H$\&$N3 and H$\&$N4 cohorts were combined and used as a single testing set ($n=106$). The best combinations of radiomics features were selected in the training set using imbalance-adjusted logistic regression learning and bootstrapping validations. These radiomics features were combined with selected clinical variables in the training set using imbalance-adjusted random forest learning and stratified random sub-sampling validations. Independent prediction analysis was performed in the testing set for all classifiers fully constructed in the training set. Independent prognosis analysis and Kaplan-Meier risk stratification was carried out in the testing set using the output probability of occurrence of events of random forests fully constructed in the training set.}} \label{fig:MLstrategy} \end{figure} \newpage \section*{Results} \subsection*{Summary of presentation of results} To ease reading and the understanding of this study, a summary of how results are presented in the text is provided in Supplementary Fig.~S1. \subsection*{Association of variables with tumour outcomes} In order to assess the value of quantitative pre-treatment imaging to predict specific cancer outcomes in H\&N cancer, we performed a comprehensive univariate analysis of the association of radiomic features with locoregional recurrences (\enquote{LR} or \enquote{Locoregional}), distant metastases development (\enquote{DM} or \enquote{Distant}) and overall survival (\enquote{OS} or \enquote{Survival} or \enquote{Death}). A total of 1615 radiomic features (Fig.~\ref{fig:StudyWorkflow}b and Supplementary Methods section 2.5 for complete description) were first extracted from the gross tumour volume (GTV$_{\mathrm{primary}}$ $+$ GTV$_{\mathrm{lymph\ nodes}}$) of the FDG-PET and CT images (Fig.~\ref{fig:StudyWorkflow}a), for all 300 patients from the four H\&N cancer cohorts (Fig.~\ref{fig:MLstrategy}): I) 10 first-order statistics features (intensity); II) 5 morphological features (shape); and III) 40 texture features each extracted using 40 different combinations of parameters. We also compared these results to the predictive power of the tumour volume (\enquote{\textit{Volume}}) and of the following clinical variables: \textit{Age}, \textit{T-Stage}, \textit{N-Stage}, \textit{TNM-Stage} and human papillomavirus status (\textit{HPV status}), where \textit{HPV status} was available for 120 of the 300 patients (Supplementary Tables~S5-S8). The association of the different variables with the different H\&N cancer outcomes (binary endpoints) was then analyzed using Spearman's rank correlations ($r_s$) computed on all patients, and significance was assessed by applying multiple testing corrections using the Benjamini-Hochberg procedure \autocite{benjamini_controlling_1995} with a false discovery rate of 10~\%. Overall, we found that 0~\%, 63~\% and 12~\% of the total radiomic features extracted from PET scans, and that 0~\%, 61~\% and 34~\% of the total radiomic features extracted from CT scans were significantly associated with LR, DM and OS, respectively (after multiple testing corrections). The radiomic features (PET or CT) with the highest associations with LR, DM and OS were $LZHGE_{\mathrm{GLSZM}}$ from CT scans ($r_s = -0.15$, $p = 0.007$), $ZSN_{\mathrm{GLSZM}}$ from CT scans ($r_s = -0.29$, $p = 2 \times 10^{-7}$) and $GLV_{\mathrm{GLRLM}}$ from CT scans ($r_s = 0.24$, $p = 4 \times 10^{-5}$), respectively (Supplementary Table~S1). Tumour volume was not found to be significantly associated with LR ($r_s = -0.04$, $p = 0.48$), but was significantly associated with DM ($r_s = 0.24$, $p = 3 \times 10^{-5}$) and OS ($r_s = -0.18$, $p = 2 \times 10^{-3}$). Finally, we found that \{\textit{Age}, \textit{T-Stage}, \textit{N-Stage}, \textit{HPV status}\}, \{\textit{N-Stage}\} and \{\textit{Age}, \textit{T-Stage}, \textit{HPV status}\} were significantly associated with LR, DM and OS, respectively. The clinical variables with the highest associations with LR, DM and OS were \textit{HPV}$-$ ($r_s = 0.39$, $p = 8 \times 10^{-6}$), higher \textit{N-Stage} ($r_s = 0.18$, $p = 1 \times 10^{-3}$) and higher \textit{T-Stage} ($r_s = 0.21$, $p = 3 \times 10^{-4}$), respectively (Supplementary Table~S2). \subsection*{Construction of prediction models} The construction of prediction models for LR, DM and OS was carried out using a training set consisting of the combination of 194 patients from the H\&N1 and H\&N2 cohorts (Fig.~\ref{fig:MLstrategy}). Three initial radiomic feature sets were considered: I) the 1615 radiomic features extracted from PET scans (\enquote{\textit{PET}} feature set); II) the 1615 radiomic features extracted from CT scans (\enquote{\textit{CT}} feature set); and III) a combined set containing all PET and CT radiomic features used in feature sets I and II (\enquote{\textit{PETCT}} feature set). Prediction models consisting of radiomic information only were first constructed for each of the three H\&N outcomes and the three initial radiomic feature sets. \textit{Feature set reduction}, \textit{feature selection}, \textit{prediction performance estimation}, \textit{choice of model complexity} (Supplementary Fig.~S2) and \textit{final model computation} processes were carried out using logistic regression and bootstrap resampling, similarly to the methodology developed in the study of Valli\`eres \textit{et al.} \autocite{vallieres_radiomics_2015} To account for the disproportion of occurrence of events and non-occurrence of events in the training set (15~\% LR, 13~\% DM, 16~\% deaths), an imbalance-adjustment strategy adapted from the study of Schiller \textit{et al.} \autocite{schiller_modeling_2010} was also applied during the training process. Overall for the \textit{PET}, \textit{CT} and \textit{PETCT} feature sets, the number of variables forming the final radiomic models for each outcome were, respectively: I) 8, 3 and 3 radiomic variables for the LR outcome; II) 6, 3 and 3 radiomic variables for the DM outcome; and III) 4, 3 and 6 radiomic variables for the OS outcome. The construction of prediction models combining radiomic and clinical variables was then carried out for the nine identified radiomic models (3 feature sets $\times$ 3 outcomes). By estimating prediction performance via stratified random sub-sampling in the training set, the following group of clinical variables were first selected for each outcome: I) \{\textit{Age}, \textit{H}\&\textit{N type}, \textit{T-Stage}, \textit{N-Stage}\} for LR prediction; II) \{\textit{Age}, \textit{H}\&\textit{N type}, \textit{N-Stage}\} for DM prediction; and III) \{\textit{Age}, \textit{H}\&\textit{N type}, \textit{T-Stage}, \textit{N-Stage}\} for OS prediction. Final prediction models were ultimately constructed for each radiomic feature set and H\&N outcome by combining the selected radiomic and clinical variables via random forests and imbalance adjustments. \subsection*{Performance of prediction models} The performance of the radiomic prediction models constructed using logistic regression and of the prediction models constructed by combining radiomic and clinical variables via random forests was validated in a testing set consisting of the combination of 106 patients from the H\&N3 and H\&N4 cohorts (Fig.~\ref{fig:MLstrategy}) using receiver operating characteristic (ROC) metrics (binary endpoints). Figure~\ref{fig:PredictPerf} presents the performance results (AUC: area under the ROC curve) obtained in the testing set for the \textit{radiomics} and \textit{radiomics} $+$ \textit{clinical} models, where the significance of the increase in AUC when combining clinical to radiomic variables is assessed using the method of DeLong \textit{et al.} \autocite{delong_comparing_1988}. Sensitivity, specificity and accuracy of predictions are also presented in Supplementary Fig.~S3. Overall, it can be observed that there is a general increase in prediction performance for most of the different categories of models that we constructed in this work. For LR prediction, the increase in AUC is significant for prediction models from the \textit{PET} ($p = 0.03$) and the \textit{CT} ($p = 0.01$) radiomic feature sets. For DM prediction, none of the radiomics models show a significant AUC increase when combined with clinical variables. For OS (death) prediction, the increase in AUC is significant for prediction models from the \textit{PET} ($p = 0.01$) and the \textit{PETCT} ($p = 0.006$) radiomic feature sets. Furthermore, we verified that the increase in performance is not explained by the use of a more complex and potentially more predictive learning algorithm: random forests classifiers constructed with radiomic variables alone preserved the predictive properties obtained by logistic regression models constructed with the same variables, but without improving them (Supplementary Table~S3). These results point to the potential of random forests in successfully combining the complementary value of different categories of prognostic factors such as radiomic and clinical variables. In Fig.~\ref{fig:PredictPerf}, the highest performance for LR prediction was obtained using the model combining the \textit{PETCT} radiomic and clinical variables, with an AUC of 0.69. For DM prediction, the highest performance was obtained using the \textit{CT} radiomic model, with an AUC of 0.86. These results demonstrate that different radiomic-based models could successfully be used to predict specific outcomes such as locoregional recurrences and distant metastases in H\&N cancer. Finally, the highest performance for OS (death) prediction was obtained using the model combining the \textit{PET} radiomic and clinical variables, with an AUC of 0.74. For subsequent analysis in the next section, only the prediction models (\textit{radiomics} and \textit{radiomics} $+$ \textit{clinical}) constructed from these radiomic features sets (\textit{PETCT} for LR, \textit{CT} for DM, \textit{PET} for OS) are used. The complete description of these identified radiomic models (specific features, texture extraction parameters, logistic regression coefficients) is given in Supplementary Results section 1.4.2. \begin{figure}[!htbp] \includegraphics[width=\textwidth]{PredictPerf.eps} \caption{\textbf{Prediction performance of selected models.} \footnotesize{All prediction models were selected and built using the training set (H$\&$N1 and H$\&$N2; $n=194$) for three initial radiomic feature sets: I) PET radiomic features (\textit{PET}); II) CT radiomic features (\textit{CT}); and III) PET and CT radiomic features (\textit{PETCT}). The prediction performance is evaluated here in terms of the area under the receiver operating characteristic curve (AUC) for patients of the testing set (H$\&$N3 and H$\&$N4; $n=106$), for two types of prediction models: I) Radiomic models constructed using logistic regression (\textit{Radiomics}); and II) Radiomic models combined with clinical variables via random forests (\textit{Radiomics} $+$ \textit{clinical}). Significant increase in AUC from \textit{Radiomics} to \textit{Radiomics} + \textit{clinical} models is identified with an asterisk (*), and non-significant increase is identified by \enquote{\textit{n.s.}}. The radiomic feature sets providing the prediction models with highest performance in this study are identified with an arrow for each outcome.}} \label{fig:PredictPerf} \end{figure} \subsection*{Comparison with other prognostic factors} The performance of the best radiomic prediction models and the best prediction models combining radiomic and clinical variables identified in this study (shown with arrows in Fig.~\ref{fig:PredictPerf}) were further compared against other prognostic factors: I) \textit{Volume}; II) \enquote{clinical-only} models; III) combination of \textit{Volume} and clinical variables; and IV) a validated radiomic signature developed for the prognosis assessment of overall survival \autocite{aerts_decoding_2014,leijenaar_external_2015}. In addition to the prediction performance evaluated using ROC metrics, the prognostic performance of the models was also assessed using: I) the concordance index (CI) \autocite{harrell_multivariable_1996} between the output probability of occurrence of an event (LR, DM, death) of prediction models and the time elapsed before an event occurred (\enquote{time-to-event}); and II) the \textit{p}-value obtained from Kaplan-Meier analysis using the log-rank test between two risk groups. The models consisting of only radiomic or the \textit{Volume} variables were optimized using logistic or cox regression, and all models involving clinical variables were optimized using random forest classifiers, still using the defined training set of this work (H\&N1 and H\&N2 cohorts; $n = 194$). Fully independent results are then presented in Table~\ref{tab:comparison} for models evaluated in the testing set (H\&N3 and H\&N4 cohorts; $n = 106$). For locoregional recurrences, we found that the model combining the \textit{PETCT} radiomic and clinical variables provided the best performance in terms of predictive/prognostic power and balance of classification of occurrence of events and non-occurrence of events, notably with an AUC of 0.69, a sensitivity of 0.63, a specificity of 0.68, an accuracy of 0.67, a CI of 0.67 and a Kaplan-Meier \textit{p}-value of 0.03. Using random permutation tests, each variable was calculated to be approximately of equal importance in the random forest model (Supplementary Table~S4). Similarly to univariate analysis, \textit{Volume} was not found to be a significant prognostic factor for LR. On the other hand, clinical variables alone had high performance with an AUC of 0.72 and a CI of 0.69, but this type of modeling did not provide sufficient balance between the prediction of occurrence and non-occurrence of events (sensitivity of 0.50, specificity of 0.76). For distant metastases, we found that the model combining the \textit{CT} radiomic and clinical variables provided the best overall performance, notably with an AUC of 0.86, a sensitivity of 0.86, a specificity of 0.76, an accuracy of 0.77, a CI of 0.88 and a Kaplan-Meier \textit{p}-value of $3 \times 10^{-6}$. However, radiomic variables were found to be of much higher importance than the clinical variables in the random forest model (Supplementary Table~S4). In fact, the model composed of clinical variables alone did not perform well. \textit{Volume} was again found to be a significant prognostic factor for DM, but radiomic variables outperformed it. For overall survival, we found that the model composed of clinical variables alone provided the best overall performance, notably with an AUC of 0.78, a sensitivity of 0.92, a specificity of 0.57, an accuracy of 0.65, a CI of 0.76 and a Kaplan-Meier \textit{p}-value of $3 \times 10^{-5}$. Furthermore, the \textit{H}\&\textit{N type} variable had the highest and \textit{N-Stage} the lowest importance in the model (Supplementary Table~S4). Another important finding was that \textit{Volume} alone provided similar or better prognosis assessment of OS than any of the following radiomic-based models: I) the best radiomic model for OS constructed in this work; II) the original radiomic signature using the cox regression coefficients employed in the work of Aerts \& Velazquez \textit{et al.} \autocite{aerts_decoding_2014}; and III) a revised version of the radiomic signature computation (Supplementary Section 2.6.2) using new sets of regression coefficients trained with the current training set of this work. \subsection*{Risk assessment of tumour outcomes} The work performed in this study leads to the identification of three prediction models based on three final random forest classifiers, one for each of the outcome studied here (identified with italic fonts in Table~\ref{tab:comparison}): I) \{\textit{PET-GLN}$_{\mathrm{GLSZM}}$, \textit{CT-Correlation}$_{\mathrm{GLCM}}$, \textit{CT-LGZE}$_{\mathrm{GLSZM}}$, \textit{age}, \textit{H}\&\textit{N type}, \textit{T-Stage}, \textit{N-Stage}\} for LR; II) \{\textit{CT-LRHGE}$_{\mathrm{GLRLM}}$, \textit{CT-ZSV}$_{\mathrm{GLSZM}}$, \textit{CT-ZSN}$_{\mathrm{GLSZM}}$, \textit{age}, \textit{H}\&\textit{N type}, \textit{N-Stage}\} for DM; and III) \{\textit{age}, \textit{H}\&\textit{N type}, \textit{T-Stage}, \textit{N-Stage}\} for OS. A property of a random forest is that the binary prediction of each of its decision tree can be averaged to serve as an output probability of occurrence of a given event (\textit{prob}$_{\mathrm{RF}}$). This output probability, similarly to other machine learning algorithms, can constitute one of the tools to be used for the risk assessment of specific tumour outcomes. For example, the final random forest classifiers constructed in the training set (H\&N1 and H\&N2 cohorts; $n = 194$) can be used to stratify the risk of occurrence of the outcome events for each patient of the testing set (H\&N3 and H\&N4 cohorts; $n = 106$) into three groups (Fig.~\ref{fig:RiskAssessment}a): I) low-risk group $\rightarrow 0 \leq \mathit{prob}_{\mathrm{RF}} < \frac{1}{3}$; II) medium-risk group $\rightarrow \frac{1}{3} \leq \mathit{prob}_{\mathrm{RF}} < \frac{2}{3}$; and III) high-risk group $\rightarrow \frac{2}{3} \leq \mathit{prob}_{\mathrm{RF}} < 1$. Thereafter, this stratification scheme can be used to evaluate the probability of non-occurrence of the events after a given time for the different risk groups via Kaplan-Meier analysis. Standard Kaplan-Meier analysis using two risk groups ($\mathit{prob}_{\mathrm{RF}} \leq 0.5$, $\mathit{prob}_{\mathrm{RF}} > 0.5$) is first shown in Fig.~\ref{fig:RiskAssessment}b for all patients of the testing set. These curves demonstrate the possibility of prognostic risk assessment of specific outcomes in H\&N cancer such as locoregional recurrences ($p = 0.03$) and distant metastases ($p = 3 \times 10^{-6}$) using specific prediction models combining different radiomic and clinical variables, but also of the general outcome of overall survival ($p = 3 \times 10^{-5}$) using a prediction model composed of clinical variables only. More accurate prognostic risk assessment can then be further performed using Kaplan-Meier analysis with three risk groups (as defined above: low-risk, medium-risk, high-risk) as shown in Fig.~\ref{fig:RiskAssessment}c for all patients of the testing set. For the risk assessment of LR, the developed prediction model is, however, not powerful enough to significantly separate the patients between the high/medium ($p = 0.62$) and medium/low ($p = 0.10$) risk groups. In the case of DM, the developed prediction model allows to significantly separate the patients between the high/medium ($p = 0.05$) and medium/low ($p = 0.03$) risk groups. For OS, the developed prediction model does not significantly separate the patients between the high/medium risk groups ($p = 0.07$), but it does significantly separate the patients between the medium/low risk groups ($p = 0.02$). \singlespacing \begin{table}[!htbp] \caption{\textbf{Comparison of prediction/prognostic performance of models constructed in this work with other variable combinations.} Performance is shown for models constructed in the training set (H$\&$N1 and H$\&$N2; $n=194$) and independently evaluated in the testing set (H$\&$N3 and H$\&$N4; $n=106$).} \label{tab:comparison} \noindent\makebox[\textwidth]{ \small \begin{tabular}{c | c | *{4}{c} | *{2}{c}} \hline \multirow{2}{*}{Outcome} & \multirow{2}{*}{Variables} & \multicolumn{4}{|c}{Prediction} & \multicolumn{2}{|c}{Prognosis} \\ \cline{3-8} & & AUC$^\mathrm{a}$ & Sensitivity$^\mathrm{a}$ & Specificity$^\mathrm{a}$ & Accuracy$^\mathrm{a}$ & CI$^\mathrm{b}$ & \textit{p}-value$^\mathrm{c}$ \\ \hline \hline \multirow{5}{*}{Locoregional} & $\mathrm{Radiomics_{PETCT}}$ & 0.64 & 0.56 & 0.67 & 0.65 & 0.63 & 0.28 \\ & $\mathrm{Volume}$ & 0.43 & 0.31 & 0.58 & 0.54 & 0.40 & 0.80 \\ & $\mathrm{Clinical}$ & 0.72 & 0.50 & 0.76 & 0.72 & 0.69 & 0.05 \\ & $Radiomics_{PETCT} + Clinical$ & \emph{0.69} & \emph{0.63} & \emph{0.68} & \emph{0.67} & \emph{0.67} & \emph{0.03} \\ & $\mathrm{Volume} + \mathrm{Clinical}$ & 0.71 & 0.50 & 0.76 & 0.72 & 0.68 & 0.06 \\ \hline \multirow{5}{*}{Distant} & $\mathrm{Radiomics_{CT}}$ & 0.86 & 0.79 & 0.77 & 0.77 & 0.88 & 0.0001 \\ & $\mathrm{Volume}$ & 0.80 & 0.86 & 0.65 & 0.68 & 0.83 & 0.10 \\ & $\mathrm{Clinical}$ & 0.55 & 0.64 & 0.46 & 0.48 & 0.60 & 0.61 \\ & $Radiomics_{CT} + Clinical$ & \emph{0.86} & \emph{0.86} & \emph{0.76} & \emph{0.77} & \emph{0.88} & \emph{0.000003} \\ & $\mathrm{Volume} + \mathrm{Clinical}$ & 0.78 & 1 & 0.50 & 0.57 & 0.80 & 0.0004 \\ \hline \multirow{5}{*}{Survival} & $\mathrm{Radiomics_{PET}}$ & 0.62 & 0.58 & 0.66 & 0.64 & 0.60 & 0.03 \\ & $\mathrm{Volume}$ & 0.68 & 0.67 & 0.57 & 0.59 & 0.67 & 0.29 \\ & $Clinical$ & \emph{0.78} & \emph{0.92} & \emph{0.57} & \emph{0.65} & \emph{0.76} & \emph{0.00003} \\ & $\mathrm{Radiomics_{PET}} + \mathrm{Clinical}$ & 0.74 & 0.79 & 0.57 & 0.62 & 0.71 & 0.002 \\ & $\mathrm{Volume} + \mathrm{Clinical}$ & 0.79 & 0.88 & 0.52 & 0.60 & 0.76 & 0.0006 \\ \hline \multirow{3}{*}{Survival$^{\mathrm{d}}$} & $\mathrm{{Radiomics_{CTcompleteSign}}^e}$ & -- & -- & -- & -- & 0.66 & 0.70 \\ & $\mathrm{{Radiomics_{CTsign}}^f}$ & 0.68 & 0.71 & 0.50 & 0.55 & 0.66 & 0.05 \\ & $\mathrm{{Radiomics_{CTsign}}^g} + \mathrm{Clinical}$ & 0.80 & 0.96 & 0.38 & 0.51 & 0.75 & 0.001 \\ \hline \end{tabular}} \begin{flushleft} \scriptsize \item[] $\rightarrow$ Models involving \textit{Radiomic} variables only or the \textit{Volume} variable only were optimized using logistic/cox regression. All models involving \textit{Clinical} variables were optimized using random forests. \item[] $\rightarrow$ The best predictive/prognostic and balanced models for each outcome (final models) are identified in italic and are fully described in Supplementary Table~S4. \item[] $^\mathrm{a}$ Binary prediction of outcome using logistic regression/random forest output responses. \item[] $^\mathrm{b}$ Concordance-index between cox regression/random forest output responses and time to events. \item[] $^\mathrm{c}$ Log-rank test from Kaplan-Meier curves with a risk stratification into two groups (thresholds: median hazard ratio for cox regression, output probability of 0.5 for random forests). \item[] $^\mathrm{d}$ Radiomic signature variables as defined in Aerts \& Velazquez \textit{et al.} \autocite{aerts_decoding_2014} \item[] $^\mathrm{e}$ Using the original definition of the radiomic signature variables, and the original cox regression coefficients and median hazard ratio trained from the Lung1 cohort in the study of Aerts \& Velazquez \textit{et al.} \autocite{aerts_decoding_2014} \item[] $^\mathrm{f}$ Using a revised version of the radiomic signature variables (Supplementary Methods section 2.6.2) and new cox/logistic regression coefficients trained using the current training set of this work. \item[] $^\mathrm{g}$ Using a revised version of the radiomic signature variables (Supplementary Methods section 2.6.2) and a random forest classifer trained using the current training set of this work. \end{flushleft} \end{table} \onehalfspacing \begin{figure}[!htbp] \includegraphics[width=\textwidth]{RiskAssessment.eps} \caption{\textbf{Risk assessment of tumour outcomes.} \footnotesize{\textbf{(a)} Probability of occurrence of events (locoregional recurrence, distant metastases, death) for each patient of the testing set (H$\&$N3 and H$\&$N4; $n=106$) as determined by the random forest classifiers built using the training set (H$\&$N1 and H$\&$N2; $n=194$). The output probability of occurrence of events of random forests allows for risk stratification; for example, three risk groups can be defined (low, medium, high) using probability thresholds of $\frac{1}{3}$ and $\frac{2}{3}$. \textbf{(b)} Kaplan-Meier curves of the testing set using a risk stratification into two groups as defined by a random forest output probability threshold of 0.5. All curves have significant prognostic performance, thus demonstrating the possibility of outcome-specific risk assessment in head-and-neck cancer. \textbf{(c)} Kaplan-Meier curves of the testing set using a risk stratification in three groups as defined by random forest output probability thresholds of $\frac{1}{3}$ and $\frac{2}{3}$. Some pair of curves have significant prognostic performance, thus demonstrating the possibility of risk stratification into multiple groups for treatment escalation/personalization in head- and-neck cancer.}} \label{fig:RiskAssessment} \end{figure} \newpage \section*{Discussion} Increasing evidence suggests that the genomic heterogeneity of aggressive tumours could translate into intratumoural spatial heterogeneity exhibited at the anatomical and functional scales \autocite{segal_decoding_2007,diehn_identification_2008,aerts_decoding_2014}. This constitutes the central idea of the emerging field of \enquote{radiomics}, in which large amounts of information via advanced quantitative analysis of medical images are used as non-invasive means to characterize intratumoural heterogeneity and to reveal important prognostic information about the cancer \autocite{el_naqa_exploring_2009,gillies_biology_2010,lambin_radiomics:_2012,kumar_radiomics:_2012}. Ultimately, the objective is to narrow down this extensive quantity of information into simple prediction models that can aid in the identification of specific tumour phenotypes for improved treatment management. In this study, we were able via advanced machine learning to develop two prediction models combining PET/CT radiomics and clinical information for the early assessment of the risk of locoregional recurrences and distant metastases in head-and-neck cancers. First, we extracted a total of 1615 radiomic features from PET and CT pre-treatment images of 300 patients with head-and-neck cancer from four different cohorts. These features are composed of 10 intensity features, 5 shape features and 40 textures computed using 40 different combinations of extraction parameters (five isotropic voxel sizes, two quantization algorithms and four numbers of gray levels). In general, different texture features will better represent the underlying tumour biology using different extraction parameters, and the optimal set of parameters to use is application-specific and depends on many factors such as the clinical endpoint studied and the imaging modalities employed. Texture optimization has the potential to enhance the predictive value of the extracted features as Valli\`eres \textit{et al.} \autocite{vallieres_radiomics_2015} have previously shown, and we suggest to incorporate this step in the texture extraction workflow of future similar studies. Univariate analysis showed that the majority of the features extracted from both PET and CT images are significantly associated with the development of distant metastases, suggesting that the metastatic phenotype of tumours can be captured via quantitative image analysis. On the other hand, none of the radiomic features were significantly associated with locoregional recurrences after multiple testing corrections with a FDR of 10~\%. Although combinations of these metrics still proved useful for prognostic risk assessment, it does reveal the need of using other types of metrics such as radiation dose characteristics to enhance the predictive properties of the models constructed for locoregional recurrences. In addition to radiomic features, we also investigated the association of clinical variables with the different head-and-neck cancer outcomes studied in this work. The most significant association was found between \textit{HPV status} and locoregional recurrences, a currently known result that agrees with other studies \autocite{fakhry_improved_2008,ang_human_2010}. However, this result was obtained with only 120 of the 300 patients with available \textit{HPV status}, and this variable could not be used in the subsequent multivariable analysis. Next, we constructed multivariable prediction models from radiomic information alone by using the methodology developed by Valli\`eres \textit{et al.} \autocite{vallieres_radiomics_2015} All models were entirely produced from the defined training set of this work combining two head-and-neck cancer cohorts (H\&N1 and H\&N2; $n = 194$). The best radiomic model for locoregional recurrences (Table~\ref{tab:comparison}) was found to possess good predictive properties in the defined testing set of this work combining two head-and-neck cancer cohorts (H\&N3 and H\&N4; $n = 106$). This model is composed of one metric extracted from PET images (\textit{GLN}$_{\mathrm{GLSZM}}$: \textit{gray-level nonuniformity}$_{\mathrm{GLSZM}}$) and two metrics extracted from CT images (\textit{correlation}$_{\mathrm{GLCM}}$ and \textit{LGZE}$_{\mathrm{GLSZM}}$: \textit{low gray-level zone emphasis}$_{\mathrm{GLSZM}}$). The best radiomic model for distant metastases (Table~\ref{tab:comparison}) was found to possess high predictive properties in the testing set, and is composed of three metrics extracted from CT images (\textit{LRHGE}$_{\mathrm{GLRLM}}$: \textit{long run high gray level emphasis}$_{\mathrm{GLRLM}}$, \textit{ZSV}$_{\mathrm{GLSZM}}$: \textit{zone size variance}$_{\mathrm{GLSZM}}$ and \textit{ZSN}$_{\mathrm{GLSZM}}$: \textit{zone size nonuifomity}$_{\mathrm{GLSZM}}$). These results suggest that radiomic models can be specific enough to assess the risk of different outcomes in head-and-neck cancer. The models we developed for locoregional recurrences and distant metastases are in fact overall different and they capture specific tumour phenotypes. It is also noteworthy that all the selected radiomic features of these two models are textural, attesting to the high potential of textures to characterize the complexity of spatial patterns within tumours. As mentioned earlier, aggressive tumours tend to show increased intratumoural heterogeneity \autocite{fidler_critical_1990,yokota_tumor_2000,campbell_patterns_2010}, notably in terms of the heterogeneity in size and intensity characteristics of the different tumour sub-regions in PET and CT images. This effect may be captured by the \textit{PET-GLN}$_{\mathrm{GLSZM}}$, \textit{CT-LRHGE}$_{\mathrm{GLRLM}}$, \textit{CT-ZSV}$_{\mathrm{GLSZM}}$ and \textit{CT-ZSN}$_{\mathrm{GLSZM}}$ texture features in our radiomic models, a result in agreement with a previous study describing the importance of zone-size nonuniformities for the prognostic assessment of head-and-neck tumours \autocite{cheng_zone-size_2014}. From our experience, we have observed that aggressive tumours also frequently contain large inactive or necrotic regions of uniform intensities, suggesting that these tumours could be rapidly increasing in size and that they could be more at risk to metastasize, for example \autocite{vakkila_inflammation_2004,proskuryakov_mechanisms_2010,ahn_necrotic_2016}. Here, this effect may be captured by the \textit{CT-Correlation}$_{\mathrm{GLCM}}$ and \textit{CT-LGZE}$_{\mathrm{GLSZM}}$ texture features. Overall, these results suggest that radiomic features could be useful to improve our understanding of the underlying biology of tumours. We also attempted in this study to improve the predictive power of our prediction models by combining radiomic variables with clinical data. The first step of our method is based on a fast mining of radiomic variables using logistic regression. Then, random forests \autocite{breiman_random_2001} are used as a means to combine radiomic and clinical information into a single classifier. It would also be feasible to only use random forests to mine the radiomic variables, but our method is advantageous in terms of computation speed. Our results showed that the combination of clinical variables with the optimal radiomic variables via random forests had a positive impact on the prediction and prognostic assessment of locoregional recurrences and distant metastases, although with minimal impact in the latter case (Fig.~\ref{fig:PredictPerf}, Table~\ref{tab:comparison}). As seen in Supplementary Table~S4, this can be explained from the fact that the identified radiomic features are the strong and dominant variables in the model for distant metastases predictions. Nonetheless, we believe that random forests is one effective algorithm well-suited to combine variables of different types (categorical and continuous inputs) such as clinical and panomic tumour profile information. In general, the ongoing optimization of machine learning techniques in radiomic applications \autocite{parmar_radiomic_2015-1,parmar_machine_2015,parmar_radiomic_2015} is a step forward to improve clinical predictions. In this work, we also performed a comprehensive comparison of the prediction/prognostic performance of radiomics versus clinical models and volumetric variables (Table~\ref{tab:comparison}). Metabolic tumour volume has already been shown to be an independent predictor of outcomes in head-and-neck cancer \autocite{tang_validation_2012}, but it was also suggested by Hatt et al. \autocite{hatt_18f-fdg_2015} that heterogeneity quantification via texture analysis may provide valuable complementary information to the tumour volume variable for volumes above 10~cm$^3$. In this study, 85~\% of the patients had a gross tumour volume greater than 10~cm$^3$ and we consequently found that radiomic models performed considerably better than tumour volume alone for the prediction of locoregional recurrences and distant metastases. On the other hand, clinical variables alone did not perform well on their own for distant metastases, but they had good performance for locoregional recurrences by outperforming radiomic models, thus suggesting that our radiomic models need to be improved to better model locoregional recurrences. In terms of overall survival assessment, our results indicate that the tumour volume variable matched or outperformed all radiomic models thus far we developed or tested in this work, including a previously validated radiomic signature \autocite{aerts_decoding_2014,leijenaar_external_2015}. For one, it is unsurprising that the original radiomic signature \autocite{aerts_decoding_2014} did not perform better than tumour volume, as it can be verified that all its feature components are very strongly correlated with tumour volume: the Pearson linear coefficients between tumour volume and the four features of the signature \autocite{aerts_decoding_2014} were calculated to be 0.62 (\textit{Energy}), 0.80 (\textit{Compactness}), 0.99 (\textit{GLN}$_{\mathrm{GLRLM}}$) and 0.94 (\textit{GLN}$_{\mathrm{GLRLM}}$\textit{\_HLH}) using the whole set of 300 patients of this study, all with $p \ll 0.001$. On the other hand, all the features forming the other radiomic models developed in this work showed potential complementarity value to tumour volume (but the models still did not perform better than tumour volume alone for overall survival assessment): all the features of the revised version of the radiomic signature (Supplementary Section 2.6.2) had a Pearson linear coefficient lower than 0.5 except one (\textit{Energy}), and all the variables forming the final radiomic models constructed in this work (italic fonts in Table~\ref{tab:comparison}, including those for locoregional recurrences and distant metastases) had linear coefficients lower than 0.40. This suggests that overall survival may be harder to model than specific tumour outcomes due to a larger number of confounding factors being involved, and it may thus be more prone to overfitting during training. As a consequence, tumour volume may currently be a more robust and reproducible metric than imaging features for modeling this outcome. In the end, the best global performance for overall survival was however obtained with clinical variables alone. This would emphasize that clinical data remains the important source of information to consider for the evaluation of the likelihood of occurrence of a general outcome with many confounding factors such as overall survival, and that more work is required to understand how to adequately model overall survival using radiomic features. The optimal results in terms of predictive/prognostic performance and balance of prediction between the occurrence and non-occurrence of locoregional recurrences and distant metastases were found in this work by constructing models combining radiomic and clinical variables via random forests (full description of the models in Supplementary Results). Compared to the general assessment of overall survival as in previous studies \autocite{aerts_decoding_2014,leijenaar_external_2015}, our results demonstrate the possibility of decoding specific tumour phenotypes for the risk assessment of specific outcomes in head-and-neck cancer. The final results obtained for distant metastases were considerably higher than those obtained for overall survival, but those obtained for locoregional recurrences were lower albeit clinically significant (Table~\ref{tab:comparison}). Also, as seen in Fig.~\ref{fig:RiskAssessment} with patients of the testing set, the output probability of occurrence of events of our prediction models allow to significantly separate patients into two locoregional recurrence risk groups and into three distant metastases risk groups. The clinical impact of our results and of the risk assessment of specific outcomes in head-and-neck cancer could be substantial, as it could allow for a better personalization of treatments. For example, higher radiation doses could be considered for patients at higher risks of locoregional recurrences. For distant metastases, the chemotherapy regimens could be strengthened for patients in the high risk group to reduce potential metastatic invasion, and lessened for patients in the low risk group to improve quality of life. These are hypothetical scenarios that, at the moment, are not ready to be implemented in the clinical environment, as our models first need to be constructed and validated on larger patient cohorts, and robust clinical trials are required to validate their benefits on patient survival. Furthermore, the heterogeneity of the patient cohorts used in this work including varying image acquisition parameters may undermine the power of the developed models. However, it may also improve their generalizability, and the results presented in this study could now be useful for the generation of new hypotheses driving future prospective studies. Overall, we showed in this study that radiomics provide important prognostic information for the risk assessment of locoregional recurrences and distant metastases in head-and-neck cancer. In general, the combination of panomics data into clinically-integrated prediction models should allow to more comprehensively assess cancer risks and could improve how we adapt treatments for each patient. As the standardization efforts of radiomics analysis continue to rapidly progress \autocite{nyflot_quantitative_2015,zhao_reproducibility_2016}, we can envision the clinical implementation of radiomics-based decision-support systems in the future. Full transparency on data and methods is the key for the progression of the field, and our research efforts needs to include large-scale collaborations and reproducibility practices to increase the possibility of translation of radiomics into the clinical environment \autocite{ioannidis_how_2014}. \newpage \section*{Methods} \subsection*{Data sets availability} Our analysis was conducted on imaging and clinical data of a total of 300 H\&N cancer patients from four different institutions who received radiation alone ($n = 48$, 16~\%) or chemo-radiation ($n = 252$, 84~\%) with curative intent as part of treatment management. The median follow-up period of all patients was 43 months (range: 6-112). The Institutional Review Boards of all participating institutions approved the study. Retrospective analyses were performed in accordance with the relevant guidelines and regulations as approved by the Research Ethics Committee of McGill University Health Center (Protocol Number: MM-JGH-CR15-50). \begin{itemize} \item The H\&N1 data set consists of 92 head-and-neck squamous cell carcinoma (HNSCC) patients treated at H\^opital g\'en\'eral juif (HGJ) de Montr\'eal, QC, Canada. During the follow-up period, 12 patients developed a locoregional recurrence (13~\%), 16 patients developed distant metastases (17~\%) and 14 patients died (15~\%). This data set was used as part of the \emph{training set} of this work. \item The H\&N2 data set consists of 102 head-and-neck squamous cell carcinoma (HNSCC) patients treated at Centre hospitalier universitaire de Sherbrooke (CHUS), QC, Canada. During the follow-up period, 17 patients developed a locoregional recurrence (17~\%), 10 patients developed distant metastases (10~\%) and 18 patients died (18~\%). This data set was used as part of the \emph{training set} of this work. \item The H\&N3 data set consists of 41 head-and-neck squamous cell carcinoma (HNSCC) patients treated at H\^opital Maisonneuve-Rosemont (HMR) de Montr\'eal, QC, Canada. During the follow-up period, 9 patients developed a locoregional recurrence (22~\%), 11 patients developed distant metastases (27~\%) and 19 patients died (46~\%). This data set was used as part of the \emph{testing set} of this work. \item The H\&N4 data set consists of 65 head-and-neck squamous cell carcinoma (HNSCC) patients treated at Centre hospitalier de l'Universit\'e de Montr\'eal (CHUM), QC, Canada. During the follow-up period, 7 patients developed a locoregional recurrence (11~\%), 3 patients developed distant metastases (5~\%) and 5 patients died (8~\%). This data set was used as part of the \emph{testing set} of this work. \end{itemize} All patients underwent FDG-PET/CT imaging scans within a median of 18 days (range: 6-66) before treatment. For 93 of the 300 patients (31~\%), the radiotherapy contours were directly drawn on the CT of the PET/CT scan by expert radiation oncologists and thereafter used for treatment planning. For 207 of the 300 patients (69~\%), the radiotherapy contours were drawn on a different CT scan dedicated to treatment planning and were propagated/resampled to the FDG-PET/CT scan reference frame using intensity-based free-form deformable registration with the software MIM$^{\mathrm{\textregistered}}$ (MIM software Inc., Cleveland, OH). Further information specific to each patient cohort (e.g. treatment details) is presented in Supplementary Methods section 2.4 and Supplementary Tables~S5-S8. Pre-treatment FDG-PET/CT imaging data, clinical data, radiotherapy contours (\textit{RTstruct}) and MATLAB$^{\mathrm{\textregistered}}$ routines allowing to read imaging data and their associated region-of-interest (ROI) are made available for all patients on The Cancer Imaging Archive (TCIA) \autocite{clark_cancer_2013} at: \url{http://www.cancerimagingarchive.net}. The Research Ethics Committee of McGill University Health Center approved online publishing of clinical and imaging data following patient anonymisation. \subsection*{Sample size and division of cohorts} Patients with recurrent H\&N cancer or with metastases at presentation, and patients receiving palliative treatment were excluded from the study. Patients that did not develop a locoregional recurrence or distant metastases during the follow-up period and that had a follow-up time smaller than 24 months were also excluded from the study. The four patient cohorts were then divided into two groups to create one combined training set (H\&N1 and H\&N2; $n = 194$) and one combined testing set (H\&N3 and H\&N4; $n = 106$). Bootstrap resampling and stratified random sub-sampling were always performed with patients from the training set to estimate the relevant performance metrics of interest and to construct the final prediction models, and fully independent validation results were computed with patients from the testing set. This precise type of division of patient cohorts allowed to: I) Train on a combined set of different cohorts to allow the models to take into account some institutional variability; II) Reduce the number of testing results reported; III) Create a training set size to testing set size ratio of approximately 2:1; and IV) Conduct partition sampling such that the proportion of occurrence of events (locoregional recurrences, distant metastases) are approximately the same in the training and testing sets. \subsection*{Extraction of radiomic features} Starting from the original FDG-PET/CT imaging data and associated radiotherapy contours in DICOM format, the complete set of data was read and transferred into MATLAB$^{\mathrm{\textregistered}}$ (MathWorks, Natick, MA) format using in-house routines. PET images were converted to standard uptake value (SUV) maps and CT images were kept in raw Hounsfield Unit (HU) format. In this work, we then extracted a total of 1615 radiomic features for both the PET and CT images from the tumour region defined by the \enquote{GTV$_{\mathrm{primary}}$ + GTV$_{\mathrm{lymph\ nodes}}$} contours as delineated by the radiation oncologists of each institution. These features can be divided into three different groups: I) 10 first-order statistics features (intensity); II) 5 morphological features (shape); and III) 40 texture features each computed using 40 different combinations of extraction parameters. Intensity features are computed from histograms ($n_{bins} = 100$) of the intensity distribution of the ROI. The features extracted in this work were the \textit{variance}, the \textit{skewness}, the \textit{kurtosis}, \textit{SUVmax}, \textit{SUVpeak}, \textit{SUVmean}, the \textit{area under the curve of the cumulative SUV-volume histogram} \autocite{van_velden_evaluation_2011}, the \textit{total lesion glycolysis}, the \textit{percentage of inactive volume} and the \textit{generalized effective total uptake} \autocite{rahmim_novel_2016}. Shape feature describe geometrical aspects of the ROI. The features extracted in this work were the \textit{volume}, the \textit{size} (maximum tumour diameter), the \textit{solidity}, the \textit{eccentricity} and the \textit{compactness}. Texture features measure intratumoural heterogeneity by quantitatively describing the spatial distributions of the different intensities within the ROI. In this work, 9 features from the Gray-Level Co-occurrence Matrix (GLCM) \autocite{haralick_textural_1973}, 13 features from the Gray-Level Run-Length Matrix (GLRLM) \autocite{galloway_texture_1975,chu_use_1990,dasarathy_image_1991}, 13 features from the Gray-Level Size Zone Matrix (GLSZM) \autocite{galloway_texture_1975,chu_use_1990,dasarathy_image_1991,thibault_texture_2009} and 5 features from the Neighbourhood Gray-Tone Difference Matrix (NGTDM) \autocite{amadasun_textural_1989} were computed. All texture matrices were constructed using 3D analysis/26-voxel connectivity of the tumour region resampled to a defined isotropic voxel size. For each of the four texture types, only one matrix was computed per scan by simultaneously taking into account the neighbouring properties of voxels in the 13 directions of 3D space. However, the 6 voxels at a distance of 1 voxel, the 12 voxels at a distance of $\sqrt{2}$ voxels, and the 8 voxels at a distance of $\sqrt{3}$ voxels around center voxels were treated differently in the calculation of the matrices to take into account discretization length differences. All 40 texture features from the ROI of both PET and CT volumes were extracted using all possible combinations (40) of the following parameters: \begin{itemize} \item Isotropic voxel size (5): Voxel sizes of 1~mm, 2~mm, 3~mm, 4~mm and 5~mm. \item Quantization algorithm (2): \textit{Equal-probability} (equalization of intensity histogram) and \textit{Uniform} (uniform division of intensity range) quantization algorithms with fixed number of gray levels. \item Number of gray levels (4): Fixed number of gray levels of 8, 16, 32 and 64 in the quantized ROI. \end{itemize} Detailed description with supplementary references and methodology used to extract all radiomic features is further provided in Supplementary Methods section 2.5. \subsection*{Construction of radiomic models} The construction of prediction models from the total set of radiomic features for each of the three initial feature sets (I: PET features; II: CT features; and III: PET and CT features) and three H\&N cancer outcomes was performed from the defined training set of this work (H\&N1 and H\&N2 cohorts; $n = 194$) using the methodology developed in the work of Valli\`eres \textit{et al.} \autocite{vallieres_radiomics_2015} The process of combining radiomic features into a multivariable model was achieved using the logistic regression utilities of the software DREES \autocite{el_naqa_dose_2006}. The general workflow is presented in Supplementary Fig.~S5. First, feature set reduction was performed for each of the initial feature sets via a stepwise forward feature selection scheme in order to create reduced feature sets containing 25 different features balanced between predictive power (Spearman's rank correlation) and non-redundancy (maximal information coefficient\autocite{reshef_detecting_2011}). This procedure was carried out using the \textit{Gain} equation\autocite{vallieres_radiomics_2015}, which is fully detailed in Supplementary Methods section 2.2.2. From the reduced feature sets, stepwise forward feature selection was then carried out by maximizing the 0.632+ bootstrap AUC \autocite{efron_improvements_1997,sahiner_classifier_2008}. For a given model order (number of combined variables) and a given reduced feature set, the feature selection step was divided into 25 experiments. In each of these experiments, all the different features from the reduced set were used as different \enquote{starters}. For a given starting feature, 100 logistic regression models or order 2 were first created using bootstrap resampling (100 samples) for each of the remaining features in the reduced feature set. Then, the single remaining feature that maximized the 0.632+ bootstrap AUC of the 100 models was chosen, and the process was repeated up to model order 10. Finally, for each model order of each feature set, the experiment that yielded the highest 0.632+ bootstrap AUC was identified, and combinations of features were chosen for model orders of 1 to 10. The whole feature selection process is pictured in Supplementary Fig.~S6. Once optimal combinations of features were identified for model orders of 1 to 10 for all feature sets, prediction performance was estimated using the 0.632+ bootstrap AUC (100 samples). By inspecting the prediction estimates shown in Supplementary Fig.~S2, a single combination of features (i.e. model order) potentially possessing the best parsimonious properties was then chosen for each feature set and each outcome (identified as circles in Supplementary Fig.~S2). The final logistic regression coefficients of these selected radiomic prediction models (3 feature sets $\times$ 3 outcomes) were then found by averaging all coefficients computed from another set of 100 bootstrap samples. These prediction models in their final form were thereafter directly tested in the defined testing set of this work (H\&N3 and H\&N4 cohorts; $n = 106$). \subsection*{Combination of radiomic and clinical variables} The construction of prediction models combining radiomic and clinical variables was also carried out using the training set consisting of the combination of 194 patients from the H\&N1 and H\&N2 cohorts (Fig.~\ref{fig:MLstrategy}). First, random forest classifiers \autocite{breiman_random_2001} containing only the following clinical variables were constructed for the LR, DM and OS outcomes: I) \textit{Age}; II) \textit{H}\&\textit{N type} (oropharynx, hypopharynx, nasopharynx or larynx); and III) Tumour stage. The selection of the following best groups of tumour stage variables to be incorporated into the \enquote{clinical-only} random forest classifiers was performed: I) \textit{T-Stage}; II) \textit{N-Stage}; III) \textit{T-Stage} and \textit{N-Stage}; and IV) \textit{TNM-Stage}. Estimation of prediction performance for feature selection and subsequent random forest training was performed in the training set using stratified random sub-sampling and imbalance adjustments to account for the disproportion between the occurrence and non-occurrence of events. Overall, the following staging variables were estimated to possess the highest prediction performance in the training set when combined into random forest classifiers with \textit{Age} and \textit{H}\&\textit{N type}, and were thereafter used for the rest of the work accordingly for each outcome: I) \textit{T-Stage} and \textit{N-Stage} for LR prediction; II) \textit{N-Stage} for DM prediction; and III) \textit{T-Stage} and \textit{N-Stage} for OS prediction. Finally, the variables of the previously identified radiomic prediction models (3 feature sets $\times$ 3 outcomes) were incorporated with the corresponding clinical variables identified for each outcome via the separate construction of final random forests classifiers. \subsection*{Imbalance-adjustment strategy} To obtain models with predictive power equally balanced between the prediction of occurrence of events and non-occurrence of events, an imbalance adjustment strategy adapted from the work of Schiller \textit{et al.} \autocite{schiller_modeling_2010} was used in this work (Supplementary Fig.~S4). Imbalance-adjustments become an essential part of the training process when the proportion of instances (e.g. patients) of a given class (e.g. occurrence of an event) is much lower than the proportion of instances of the other class (e.g. non-occurrence of an event). This is the case in this work for the proportion of locoregional recurrences, distant metastases and death events in the training and testing sets (Fig.~\ref{fig:MLstrategy}). In this work, every time a different bootstrap sample was drawn from the training set to construct a logistic regression or a random forest classifier, a different ensemble of multiple balanced classifiers was used in the training process instead of using only one unbalanced classifier. The ensemble classifier is composed of a number of $P = [N\mathrm{-}/N\mathrm{+}]$ partitions, where $N-$ is the number of instances from the majority class and $N+$ the number of instances from the minority class in a particular bootstrap sample. The $N+$ instances are copied and used in every partition, and the $N-$ instances are randomly sampled without replacement in the $P$ partitions such that the number of instances of the majority class is either $\lfloor N\mathrm{-}/P \rfloor$ or $\lceil N\mathrm{-}/P \rceil$ in each partition. For example, for $N\mathrm{-} = 168$ and $N\mathrm{+} = 32$, five partitions would be created: two would contain 33 instances from the majority class, three would contain 34 instances from the majority class, and all would contain the 32 instances from the minority class. For the logistic regression training process, a different classifier (i.e. different coefficients) is then trained for each of the created partitions, and the final ensemble classifier consists in the average of the corresponding coefficients from each partition. For random forest training, each partition is used to create a decision tree to be appended to a final forest instead of creating only one tree per bootstrap sample. \subsection*{Random forest training} The process of random forest training inherently uses bootstrapping in order to train the multiple decision trees of the forest. Conventionally, one different decision tree is trained for each bootstrap sample. In this work, we used 100 bootstrap samples to train each random forest constructed from the training set (H\&N1 and H\&N2 cohorts; $n = 194$). For each bootstrap sample, the imbalance-adjustment strategy detailed above was used such that each bootstrap sample produced multiple decision trees (one per partition) to be appended to a random forest. Therefore, the final number of decision trees per random forest was dependent on the actual proportion of events in each bootstrap sample for each outcome studied. The three final random forest models developed in this work (italic fonts in Table~\ref{tab:comparison}, Supplementary Table~S4) were constructed using 582, 661 and 518 decision trees for LR, DM and OS, respectively. In addition to the imbalance-adjustment strategy adopted in this work, under/oversampling of the instances in each partition of an ensemble was used to further correct for data imbalance in the random forest training process. Under/oversampling weights of the minority class of 0.5 to 2 with increments of 0.1 were tested in this work. Stratified random sub-sampling was used to estimate the optimal weight for a given training process (and also to estimate the optimal clinical staging variables to be used) in terms of the maximal average AUC, a process randomly separating the training set of this work into multiple sub-training and sub-testing sets ($n = 10$) with 2:1 size ratio and equal proportion of events. The final random forest models developed in this work (italic fonts in Table~\ref{tab:comparison}, Supplementary Table~S4) used oversampling weights of 1.4, 1.6 and 1.7 (in conjunction with the previously described imbalance-adjustment strategy) to train the decision trees of the forests for LR, DM and OS, respectively. The overall random forest training process is pictured in Supplementary Fig.~S7. \subsection*{Calculation of prediction/prognostic performance metrics} In this work, all prediction models were fully trained in the defined training set of this work (H\&N1 and H\&N2 cohorts; $n = 194$). Models were then independently tested in the defined testing set of this work (H\&N3 and H\&N4 cohorts; $n = 106$). Prediction performance was assessed using ROC metrics in terms of the AUC, sensitivity, specificity and accuracy of classification of binary clinical endpoints (locoregional recurrences, distant metastases, deaths). Prognostic performance in terms of time estimates of clinical endpoints was assessed using the concordance-index (CI) \autocite{harrell_multivariable_1996} and the \textit{p}-value obtained from Kaplan-Meier analysis using the log-rank test between risk groups. For prediction performance, the output of the linear combination of features of logistic regression models was directly used to calculate the AUC with binary outcome data. The multivariable response was then transformed into the posterior probability of occurrence of an event using a logit transform to calculate the sensitivity, specificity and accuracy of prediction using a probability threshold of 0.5. Similarly, the output probability of occurrence of an event of random forest models was directly used to calculate the AUC with binary outcome data, and an output probability of 0.5 was also used to calculate the remaining metrics. For prognostic performance, the output of the linear combination of features of cox proportional hazard regression models was directly used to calculate the CI with time-to-event data (time elapsed between the date the treatment ended and the date when an event occurred or the date of last-follow-up). The median of the output of the cox regression models found in the training set was used to separate the patients of the testing set into two risk groups for Kaplan-Meier analysis. For random forests, the output probability of occurrence of an event was directly used to calculate the CI with time-to-event data, and a probability threshold of 0.5 was used to separate the patients of the testing set into two risk groups (or $\frac{1}{3}$ and $\frac{2}{3}$ for three risk groups) for Kaplan-Meier analysis. \subsection*{Code and models availability} All software code used to produce the results presented in this work is freely shared under the GNU General Public License on the GitHub website at: \\ \url{https://github.com/mvallieres/radiomics}. Notably, a single organized script allowing to run all the experiments performed in this work is available, as well as a standalone MATLAB$^{\mathrm{\textregistered}}$ application in the form of a graphical user interface (GUI) to test the final models identified in this work on new patients. \newpage \begin{singlespacing} \printbibliography \end{singlespacing} \newpage \section*{Acknowledgements} Martin Valli\`eres acknowledges partial support from the Natural Sciences and Engineering Research Council (NSERC) of Canada (scholarship CGSD3-426742-2012), and from the CREATE Medical Physics Research Training Network of NSERC (Grant number: 432290). We would also like to thank Fran\c cois Deblois from HGJ, Vincent Hubert-Tremblay, Luc Ouellet and Isabelle Gauthier from CHUS, and Jean-Fran\c cois Carrier, Chantal Boudreau and Karim Zerouali from CHUM for their help in retrieving the data at their respective institutions. Special thanks to Aditya Kumar for his help in the initiation of the project. \section*{Author contributions} M.V., J.S. and I.E.N. conceived the project, analyzed the data and wrote the paper. E.K-R., L.J.P, X.L., C.F., N.K., F.N., C.-S.W. and K.S. collected and curated the data. H.J.W.L.A. provided expert knowledge and helped in the computation of the radiomic signature. All authors edited the manuscript. \section*{Competing financial interests} The authors declare no competing financial interests. \newpage \end{document}
{'timestamp': '2017-03-27T02:09:35', 'yymm': '1703', 'arxiv_id': '1703.08516', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08516'}
arxiv
\section{Introduction} \vspace{-.1in} Model-based clustering has become a very popular means for unsupervised learning \citep{Fraley02,Basu03,Quintana03,Tadesse2005}. This is due in part to the ability to use the model likelihood to inform, not only the cluster membership, but also the number of clusters $M$ which has been a heavily researched problem for many years. The most widely used model-based approach is the normal mixture model which is not suitable for mixed continuous/discrete variables. For example, this work is motivated by the need to cluster patients thought to potentially have autism spectrum disorder (ASD) on the basis of many correlated test scores. There are a modest number of patients (486) in the data set along with many (55) test score/self-report variables, many of which are discrete valued or have left or right boundaries. Figure~\ref{fig:scatter_intro} provides a look at the data across three of the variables; Beery\_standard is discrete valued and ABC\_irritability is continuous, but with significant mass at the left boundary of zero. The goals of this problem are to (i) cluster these patients into similar groups to help identify those with similar clinical presentation, and (ii) identify a sparse subset of tests that inform the clusters in an effort to eliminate redundant testing. This problem is also complicated by the fact that many patients in the data have missing test scores. The need to cluster incomplete observations on the basis of many correlated continuous/discrete variables is a common problem in the health sciences as well as in many other disciplines. When clustering in high dimensions, it becomes critically important to use some form of dimension reduction or variable selection to achieve accurate cluster formation. A common approach to deal with this is a principal components or factor approach \citep{Liu2003}. However, such a solution does not address goal (ii) above for the ASD clustering problem. The problem of variable selection in regression or conditional density estimation has been well studied from both the $L_1$ penalization \citep{Tibs96,Zou05,Lin06} and Bayesian perspectives \citep{George93,Reich09,Chung2012}. However, variable selection in clustering is more challenging than that in regression as there is no response to guide (supervise) the selection. Still, there have been several articles considering this topic; see \citet{Fop2017} for a review. For example, \citet{Raftery2006} propose a partition of the variables into {\em informative} (dependent on cluster membership even after conditioning on all of the other variables) and {\em non-informative} (conditionally independent of cluster membership given the values of the other variables). They use BIC to accomplish variable selection with a greedy search which is implemented in the R package \verb1clustvarsel1. Similar approaches are used by \citet{Maugis2009} and \citet{Fop2015}. An efficient algorithm for identifying the {\em optimal} set of informative variables is provided by \citet{Marbac2017} and implemented in the R package \verb1VarSelLCM1. Their approach also allows for mixed data types and missing data, however, it assumes both {\em local} and {\em global} independence (i.e., independence of variables within a cluster and unconditional independence of informative and non-informative variables, respectively). The popular LASSO or L1 type penalization has also been applied to shrink cluster means together for variable selection \citep{Pan2007,Wang2008,Xie2008}. There have also been several approaches developed for sparse K-means and distance based clustering \citep{Friedman2004,Hoff2006,Witten2012}. \begin{figure} \vspace{-.05in} \begin{center} \caption{About Here.} \vspace{-.3in} \end{center} \end{figure} In the Bayesian literature \citet{Tadesse2005} consider variable selection in the finite normal mixture model using reversible jump (RJ) Markov chain Monte Carlo (MCMC) \citep{Richardson1997}. \citet{Kim2006} extend that work to the nonparametric Bayesian mixture model via the Dirichlet process model (DPM) \citep{Ferguson73,Neal2000,Teh06,LidHjort10}. The DPM has the advantage of allowing for a countably infinite number of possible components (thus making it nonparametric), while providing a posterior distribution for how many components have been {\em observed} in the data set at hand. Both \citet{Tadesse2005} and \citet{Kim2006} use a point mass prior to achieve sparse representation of the informative variables. However, for simplicity they assume all non-informative variables are (unconditionally) independent of the informative variables. This assumption is frequently violated in practice and it is particularly problematic in the case of the ASD analysis as it would force far too many variables to be included into the informative set as is demonstrated later in this paper. There is not a generally accepted best practice to clustering with mixed discrete and continuous variables. \citet{Hunt2003}, \citet{Biernacki2015}, and \citet{Murray2015} meld mixtures of {\em independent} multinomials for the categorical variables and mixtures of Gaussian for the continuous variables. However, it may not be desirable for the dependency between the discrete variables to be entirely represented by mixture components when clustering is the primary objective. As pointed out in \citet{Hennig2013}, mixture models can approximate any distribution arbitrarily well so care must be taken to ensure the mixtures fall in line with the goals of clustering. When using mixtures of Gaussian combined with independent multinomials, a data set with many correlated discrete variables will tend to result in more clusters than a comparable dataset with mostly continuous variables. A discrete variable measure of some quantity instead of the continuous version could therefore result in very different clusters. Thus, a Gaussian latent variable approach \citep{Muthen83,Everitt88,Dunson2000,Ranalli2017,McParland2016} would seem more appropriate for treating discrete variables when clustering is the goal. An observed ordinal variable $x_j$, for example, is assumed to be the result of thresholding a latent Gaussian variable $z_j$. For binary variables, this reduces to the multivariate probit model \citep{Lesaffre1991,Chib1998}. There are also extensions of this approach to allow for unordered categorical variables. In this paper, we propose a Bayesian nonparametric approach to perform simultaneous estimation of the number of clusters, cluster membership, and variable selection while explicitly accounting for discrete variables and partially observed data. The discrete variables as well as continuous variables with boundaries are treated with a Gaussian latent variable approach. The informative variable construct of \citet{Raftery2006} for normal mixtures is then adopted. However, in order to effectively handle the missing values and account for uncertainty in the variable selection and number of clusters, the proposed model is cast in a fully Bayesian framework via the Dirichlet process. This is then similar to the work of \citet{Kim2006}, however, they did not consider discrete variables or missing data. Further, a key result of this paper is a solution to allow for dependence between informative and non-informative variables in the nonparametric Bayesian mixture model. Thus, this work overcomes the assumption of (global) independence between informative and non-informative variables. Furthermore, by using the latent variable approach it also overcomes the (local) independence assumption among the informative/clustering variables often assumed when clustering data of mixed type \citep{Fop2017}. The solution takes a particularly simple form and also provides an intuitive means with which to define the prior distribution in a manner that decreases prior sensitivity. The component parameters are marginalized out to facilitate more efficient MCMC sampling via a modified version of the split-merge algorithm of \citet{Jain04}. Finally, missing data is then handled in a principled manner by treating missing values as unknown parameters in the Bayesian framework \citep{Storlie2015calibration,Storlie17a}. This approach implicitly assumes a missing at random (MAR) mechanism \citep{Rubin1976}, which implies that the likelihood of a missing value {\em can} depend on the value of the unobserved variable(s), marginally, just not after conditioning on the observed variables. The rest of the paper is laid out as follows. Section~\ref{sec:model} describes the proposed nonparametric Bayesian approach to clustering observations of mixed discrete and continuous variables with variable selection. Section~\ref{sec:sims} evaluates the performance of this approach when compared to other methods on several simulation cases. The approach is then applied to the problem for which it was designed in Section~\ref{sec:ASD} where a comprehensive analysis of the ASD problem is presented. Section~\ref{sec:conclusions} concludes the paper. This paper also has supplementary material which contains derivations, full exposition of the proposed MCMC algorithm, and MCMC trace plots. \vspace{-.2in} \section{Methodology} \label{sec:model} \vspace{-.1in} \vspace{-.12in} \subsection{Dirichlet Process Mixture Models} \vspace{-.1in} \label{sec:model_descr} As discussed above, the proposed model for clustering uses mixture distributions with a countably infinite number of components via the Dirichlet process prior \citep{Ferguson73,Escobar1995,Maceachern1998}. Let $\mbox{\boldmath $y$}=(y_{1},\dots,y_{p})$ be a $p$-variate random vector and let $\mbox{\boldmath $y$}_i$, $i=1,\dots,n$, denote the $i^{\mbox{\scriptsize th}}$ observation of $\mbox{\boldmath $y$}$. It is assumed that $\mbox{\boldmath $y$}_i$ are independent random vectors coming from distribution $F(\theta_i)$. The model parameters $\theta_i$ are assumed to come from a mixing distribution $G$ which has a Dirichlet process prior, i.e., the familiar model, \vspace{-.13in}\begin{equation} \mbox{\boldmath $y$}_i \mid \theta_i \sim F(\theta_i), \;\;\;\;\; \theta_i \sim G, \;\;\;\;\; G \sim \mbox{DP}(G_0, \alpha), \label{eq:DPM1} \vspace{-.15in}\end{equation} where DP represents a Dirichlet Process distribution, $G_0$ is the base distribution and $\alpha$ is a precision parameter, determining the concentration of the prior for $G$ about $G_0$ \citep{Escobar1995}. The prior distribution for $\theta_i$ in terms of successive conditional distributions is obtained by integrating over $G$, i.e., \vspace{-.15in}\begin{equation} \theta_i \mid \theta_1, \dots, \theta_{i-1} \sim \frac{1}{i-1+\alpha} \sum_{i'=1}^{i-1}\delta(\theta_{i'}) + \frac{\alpha}{i-1+\alpha} G_0,\label{eq:DPM2} \vspace{-.05in}\end{equation} where $\delta(\theta)$ is a point mass distribution at $\theta$. The representation in (\ref{eq:DPM2}) makes it clear that (\ref{eq:DPM1}) can be viewed as a countably infinite mixture model. Alternatively, let $\Omega=[\omega_1,\omega_2,\dots]$ denote the unique values of the $\theta_i$ and let $\phi_i$ be the index for the component to which observation $i$ belongs, i.e., so that $\omega_{\phi_i} = \theta_i$. The following model \citep{Neal2000} is equivalent to (\ref{eq:DPM2}) \vspace{-.12in}\begin{eqnarray} P(\phi_i = m \mid \phi_1, \dots, \phi_{i-1} ) = \left\{ \begin{array}{ll} 1 & \mbox{if $i=1$ and $m=1$.} \\ \frac{n_{i,m}}{i-1+\alpha} & \mbox{if $\phi_{i'} = m$ for any $i'<i$.} \\ \frac{\alpha}{i-1+\alpha} & \mbox{if $m=$max$(\phi_1, \dots, \phi_{i-1})+1$.} \\ 0 & \mbox{otherwise,} \end{array} \right.\label{eq:DPM3} \\[-.3in] \nonumber \vspace{-.0in} \end{eqnarray} with $\mbox{\boldmath $y$}_i \mid \phi_i, \Omega \sim F(\omega_{\phi_i})$, $\omega_m \sim G_0$ and $n_{i,m}$ is the number of $\phi_{i'}=m$ for $i' < i$. Thus, a new observation $i$ is allocated to an existing cluster with probability proportional to the cluster size or it is assigned to a new cluster with probability proportional to $\alpha$. This is often called the Chinese restaurant representation of the Dirichlet process. It is common to assume that $F$ is a normal distribution in which case $\omega_m \!=\! (\mbox{\boldmath $\mu$}_m, \mbox{\boldmath $\Sigma$}_m)$ describes the mean and covariance of the $m^{\mbox{\scriptsize th}}$ component. This results in a normal mixture model with a countably infinite number of components. \vspace{-.2in} \subsection{Discrete Variables and Boundaries/Censoring} \vspace{-.1in} \label{sec:discrete_vars} Normal mixture models are not effective for clustering when some of the variables are too discretized as demonstrated in Section~\ref{sec:sims}. This is also a problem when the data have left or right boundaries that can be achieved (e.g., several people score the minimum or maximum on a test). However, a Gaussian latent variable approach can be used to circumvent these issues. Suppose that variables $y_j$ for $j \in {\cal D}$ are discrete, ordinal variables taking on possible values $\mbox{\boldmath $d$}_j = \{d_{j,1}, \dots, d_{j,L_j}\}$ and that $y_j$ for $j \in {\cal C} = {\cal D}^c$ are continuous variables with lower and upper limits of $b_j$ and $c_j$, which could be infinite. Assume for some latent, $p$-variate, continuous random vector $\mbox{\boldmath $z$}$ that \vspace{-.15in}\begin{equation} y_j = \left\{ \begin{array}{ll} \sum_{l=1}^{L_j} d_{j,l} I_{\{a_{j,l-1} < z_j \leq a_{j,l}\}} & \mbox{for $j \in {\cal D}$} \\ z_jI_{\{b_j \leq z_j \leq c_j\}} + b_jI_{\{z_j < b_j\}} + c_jI_{\{z_j > c_j\}}& \mbox{for $j \in {\cal C}$} \end{array} \right. \label{eq:z2y} \vspace{-.07in}\end{equation} where $I_A$ is the indicator function equal to 1 if $A$ and 0 otherwise, $a_{j,0}= -\infty$, $a_{j,L_j}= \infty$, and $a_{j,l}=d_{j,l}$ for $l=1,\dots,L_j-1$. That is, the discrete $y_j$ are the result of thresholding the latent variable $z_j$ on the respective cut-points. The continuous $y_j$ variables are simply equal to the $z_j$ unless the $z_j$ cross the left or right boundary of what can be observed for $y_j$. That is, if there are finite limits for $y_j$, then $y_j$ is assumed to be a left and/or right censored version of $z_j$, thus producing a positive mass at the boundary values of $y_j$. A joint mixture model for mixed discrete and continuous variables is then, \vspace{-.18in}\begin{equation} \mbox{\boldmath $z$}_i \mid \phi_i, \Omega \sim N(\mbox{\boldmath $\mu$}_{\phi_i}, \mbox{\boldmath $\Sigma$}_{\phi_i}), \label{eq:mixed_dpm} \vspace{-.18in}\end{equation} with prior distributions for $\omega_m$ and $\mbox{\boldmath $\phi$}=[\phi_1,\dots,\phi_n]'$ as in (\ref{eq:DPM3}). Binary $y_j$ such as gender can be accommodated by setting $\mbox{\boldmath $d$}_j=\{0,1\}$. However, if there is only one cut-point then the model must be restricted for identifiability \citep{Chib1998}; namely, if $y_j$ is binary, then we must set $\mbox{\boldmath $\Sigma$}_m(j,j)=1$. The restriction that $\mbox{\boldmath $\Sigma$}_m(j,j)=1$ for binary $y_j$ complicates posterior inference, however, this problem has been relatively well studied in the multinomial probit setting and various proposed solutions exist \citep{Imai2005}. It is also straight-forward to use the latent Gaussian variable approach to allow for unordered categorical variables \citep{McCulloch2000,Imai2005,Zhang08,Bhattacharya12}, however, inclusion of categorical variables also complicates notation and there are no such variables in the ASD data. For brevity, attention is restricted here to continuous and ordinal discrete variables \vspace{-.2in} \subsection{Variable Selection} \vspace{-.1in} \label{sec:variable_selection} Variable selection in clustering problems is more challenging than in regression problems due to the lack of targeted information with which to guide the selection. Using model-based clustering allows a likelihood based approach to model selection, but exactly how the parameter space should be restricted when a variable is ``out of the model'' requires some care. \citet{Raftery2006} defined a variable $y_{j}$ to be {\em non-informative} if conditional on the values of the other variables, it is independent of cluster membership. This implies that a non-informative $y_j$ may still be quite dependent on cluster membership through its dependency with other variables. They assumed a Gaussian mixture distribution for the informative variables, with a conditional Gaussian distribution for the non-informative variables and used maximum likelihood to obtain the change in BIC between candidate models. Thus, they accomplished variable selection with a greedy search to minimize BIC. They further considered restricted covariance parameterizations to reduce the parameter dimensionality (e.g., diagonal, common volume, common shape, common orientation, etc.). We instead take a Bayesian approach to this problem via Stochastic Search Variable Selection (SSVS) \citep{George93,George97} as this allows for straight-forward treatment of uncertainty in the selected variables and that due to missing values. \citet{Kim2006} used such an approach with a DPM for infinite normal mixtures, however, due to the difficulty imposed they did not use the same definition as \citet{Raftery2006} for a non-informative variable. They defined a non-informative variable to be one that is (unconditionally) independent of cluster membership and {\em all} other variables. This is not reasonable in many cases, particularly in the ASD problem, and can result in negative consequences as seen in Section~\ref{sec:sims}. Below, we layout a more flexible model specification akin to that taken in \citet{Raftery2006} to allow for (global) dependence between informative and non-informative variables in a DPM. Let the informative variables be represented by the {\em model} $\mbox{\boldmath $\gamma$}$, a vector of binary values such that $\{ y_j : \gamma_j=1\}$ is the set of informative variables. A priori it is assumed that $\Pr(\gamma_j=1)=\rho_j$. Without loss of generality assume that $\mbox{\boldmath $y$}$ has elements ordered such that $\mbox{\boldmath $y$} = [\mbox{\boldmath $y$}^{(1)}, \mbox{\boldmath $y$}^{(2)} ]$, with $\mbox{\boldmath $y$}^{(1)} = \{y_j: \gamma_j=1\}$ and $\mbox{\boldmath $y$}^{(2)} = \{y_j: \gamma_j = 0\}$, and similarly for $\mbox{\boldmath $z$}^{(1)}$ and $\mbox{\boldmath $z$}^{(2)}$. The model in (\ref{eq:mixed_dpm}) becomes, \vspace{-.15in}\begin{equation} \mbox{\boldmath $z$}_i \mid \mbox{\boldmath $\gamma$}, \phi_i, \Omega \sim N(\mbox{\boldmath $\mu$}_{\phi_i}, \mbox{\boldmath $\Sigma$}_{\phi_i}), \label{eq:vs_dpm_2} \vspace{-.18in}\end{equation} with \vspace{-.23in}\begin{eqnarray} \mbox{\boldmath $\mu$}_m= \left( \begin{array}{c} \mbox{\boldmath $\mu$}_{m1}\\ \mbox{\boldmath $\mu$}_{m2} \end{array} \right), \;\; \mbox{\boldmath $\Sigma$}_m = \left( \begin{array}{cc} \mbox{\boldmath $\Sigma$}_{m11} & \mbox{\boldmath $\Sigma$}_{m12}\\ \mbox{\boldmath $\Sigma$}_{m21} & \mbox{\boldmath $\Sigma$}_{m22} \end{array} \right).\\[-.4in] \nonumber \end{eqnarray} From standard multivariate normal theory, $[\mbox{\boldmath $z$}^{(2)} \mid \mbox{\boldmath $z$}^{(1)},\phi=m] \sim N(\mbox{\boldmath $\mu$}_{2\mid 1}, \mbox{\boldmath $\Sigma$}_{2 \mid 1})$ with $\mbox{\boldmath $\mu$}_{2\mid 1} = \mbox{\boldmath $\mu$}_{m2} + \mbox{\boldmath $\Sigma$}_{m21}\mbox{\boldmath $\Sigma$}_{m11}^{-1}(\mbox{\boldmath $z$}^{(1)} - \mbox{\boldmath $\mu$}_{m1})$ and $\mbox{\boldmath $\Sigma$}_{2 \mid 1} = \mbox{\boldmath $\Sigma$}_{m22} - \mbox{\boldmath $\Sigma$}_{m21}\mbox{\boldmath $\Sigma$}_{m11}^{-1}\mbox{\boldmath $\Sigma$}_{m12}$. Now in order for the non-informative variables to follow the definition of \citet{Raftery2006}, the $\mbox{\boldmath $\mu$}_m$ and $\mbox{\boldmath $\Sigma$}_m$ must be parameterized so that $\mbox{\boldmath $\mu$}_{2\mid 1}, \mbox{\boldmath $\Sigma$}_{2 \mid 1}$ do not depend on $m$. In order to accomplish this, it is helpful to make use of the canonical parameterization of the Gaussian \citep{Rue05}, \vspace{-.175in}\begin{displaymath} \mbox{\boldmath $z$} \mid \mbox{\boldmath $\gamma$}, \Omega, \phi=m \sim {\cal N}_C(\mbox{\boldmath $b$}_m, \mbox{\boldmath $Q$}_m), \vspace{-.175in}\end{displaymath} with precision $\mbox{\boldmath $Q$}_m=\mbox{\boldmath $\Sigma$}_m^{-1}$ and $\mbox{\boldmath $b$}_m = \mbox{\boldmath $Q$}_m \mbox{\boldmath $\mu$}_m$. Partition the canonical parameters as, \vspace{-.14in}\begin{eqnarray} \mbox{\boldmath $b$}_m= \left( \begin{array}{c} \mbox{\boldmath $b$}_{m1}\\ \mbox{\boldmath $b$}_{2} \end{array} \right), \;\; \mbox{\boldmath $Q$}_m = \left( \begin{array}{cc} \mbox{\boldmath $Q$}_{m11} & \mbox{\boldmath $Q$}_{12}\\ \mbox{\boldmath $Q$}_{21} & \mbox{\boldmath $Q$}_{22} \end{array} \right). \label{eq:can_MVN} \\[-.28in] \nonumber \end{eqnarray} \noindent {\em Result 1.} {\em The parameterization in $($\ref{eq:can_MVN}$)$ results in $(\mbox{\boldmath $\mu$}_{2\mid 1}, \mbox{\boldmath $\Sigma$}_{2 \mid 1})$ that does not depend on $m$.}\\[-.19in] \noindent {\em Proof.} The inverse of a partitioned matrix directly implies that $\mbox{\boldmath $\Sigma$}_{2 \mid 1} = \mbox{\boldmath $Q$}_{22}^{-1}$, which does not depend on $m$. It also implies that $-\mbox{\boldmath $Q$}_{22}^{-1}\mbox{\boldmath $Q$}_{21} = \mbox{\boldmath $\Sigma$}_{m21}\mbox{\boldmath $\Sigma$}_{m11}^{-1}$, and substituting $\mbox{\boldmath $\Sigma$}_m\mbox{\boldmath $b$}_m$ for $\mbox{\boldmath $\mu$}_m$ in $\mbox{\boldmath $\mu$}_{2 \mid 1}$ gives $\mbox{\boldmath $\mu$}_{2 \mid 1} =\mbox{\boldmath $Q$}_{22}^{-1} \left(\mbox{\boldmath $b$}_2 - \mbox{\boldmath $Q$}_{21} \mbox{\boldmath $z$}^{(1)} \right)$, which also does not depend on $m$. $\:\Box$\\[-.17in] \noindent The $\mbox{\boldmath $Q$}_{21}$ does not depend on $m$ which implies the same dependency structure across the mixture components. This is a necessary assumption in order for $\mbox{\boldmath $z$}^{(2)}$ to be non-informative variables, i.e., so that cluster membership conditional on $\mbox{\boldmath $z$}^{(1)}$ is independent of $\mbox{\boldmath $z$}^{(2)}$. Now the problem reduces to defining a prior distribution for $\Omega$, i.e., $\omega_m = \{\mbox{\boldmath $b$}_m, \mbox{\boldmath $Q$}_m\}$, $m=1,2,\dots$, conditional on the model $\mbox{\boldmath $\gamma$}$, that maintains the form of (\ref{eq:can_MVN}). Let $\omega^{(1)}_m = \{\mbox{\boldmath $b$}_{m1}, \mbox{\boldmath $Q$}_{m11}\}$ and $\omega^{(2)}_m = \omega^{(2)} = \{\mbox{\boldmath $b$}_2, \mbox{\boldmath $Q$}_{21},\mbox{\boldmath $Q$}_{22}\}$. The prior distribution for $\Omega$ will be defined first unconditionally for $\omega^{(2)}$ and then for $\omega^{(1)}_m$, $m=1,2,\dots,$ conditional on $\omega^{(2)}$. There are several considerations in defining these distributions: (i) the resulting $\mbox{\boldmath $Q$}_m$ must be positive definite, (ii) it is desirable for the marginal distribution of $(\mu_m,\mbox{\boldmath $\Sigma$}_m)$ to remain unchanged for any model $\mbox{\boldmath $\gamma$}$ to limit the influence of the prior for $\omega_m$ on variable selection, and (iii) it is desirable for them to be conjugate to facilitate MCMC sampling \citep{Neal2000,Jain04}. Let $\mbox{\boldmath $\Psi$}$ be a $p \times p$ positive definite matrix, partitioned just as $\mbox{\boldmath $Q$}_m$, and for a given $\mbox{\boldmath $\gamma$}$ assume the following distribution for $\omega^{(2)}$, \vspace{-.25in}\begin{eqnarray} \begin{array}{c} \mbox{\boldmath $Q$}_{22} \sim {\cal W}(\!\mbox{\boldmath $\Psi$}_{22 \mid 1}^{-1}, \eta), \;\;\;\; \mbox{\boldmath $b$}_2 \! \mid \! \mbox{\boldmath $Q$}_{22} \sim {\cal N}(\mbox{\boldmath $0$}, \mbox{$\frac{1}{\lambda}$}\mbox{\boldmath $Q$}_{22}),\\[.1in] \mbox{\boldmath $Q$}_{21} \!\!\mid \! \mbox{\boldmath $Q$}_{22} \sim {\cal M}{\cal N}\!\left(-\mbox{\boldmath $Q$}_{22\:}\!\mbox{\boldmath $\Psi$}_{21}\!\mbox{\boldmath $\Psi$}_{11}^{-1} , \mbox{\boldmath $Q$}_{22} \:, \mbox{\boldmath $\Psi$}_{11}^{-1} \right), \end{array} \label{eq:comp_prior_1} \\[-.38in] \nonumber \end{eqnarray} where ${\cal W}$ denotes the Wishart distribution, and ${\cal M}{\cal N}$ denotes the matrix normal distribution. The distribution of $\omega^{(1)}_m$, conditional on $\omega^{(2)}$ is defined implicitly below. A prior distribution is {\em not} placed on $(\mbox{\boldmath $b$}_{m1}, \mbox{\boldmath $Q$}_{m11})$, directly. It is helpful to reparameterize from $(\mbox{\boldmath $b$}_2, \mbox{\boldmath $Q$}_{22}, \mbox{\boldmath $Q$}_{21}, \mbox{\boldmath $b$}_{m1}, \mbox{\boldmath $Q$}_{m11})$ to $(\mbox{\boldmath $b$}_2, \mbox{\boldmath $Q$}_{22}, \mbox{\boldmath $Q$}_{21}, \mbox{\boldmath $\mu$}_{m1}, \mbox{\boldmath $\Sigma$}_{m11})$. By doing this, independent priors can be placed on $(\mbox{\boldmath $b$}_2, \mbox{\boldmath $Q$}_{22}, \mbox{\boldmath $Q$}_{21})$ and $(\mbox{\boldmath $\mu$}_{m1}, \mbox{\boldmath $\Sigma$}_{m11})$ and still maintain all of the desired properties as will be seen in Results~2~and~3. The prior distribution of $(\mbox{\boldmath $\mu$}_{m1}, \mbox{\boldmath $\Sigma$}_{m11})$ is \vspace{-.2in}\begin{equation} \mbox{\boldmath $\Sigma$}_{m11} \stackrel{iid}{\sim} {\cal W}^{-1}\left(\mbox{\boldmath $\Psi$}_{11}, \eta - p_2\right), \;\;\;\; \mbox{\boldmath $\mu$}_{m1} \mid \mbox{\boldmath $\Sigma$}_{m11} \stackrel{ind}{\sim} {\cal N}\left(\mbox{\boldmath $0$}, \mbox{$\frac{1}{\lambda}$}\mbox{\boldmath $\Sigma$}_{m11}\right), \label{eq:comp_prior_2} \vspace{-.18in}\end{equation} where ${\cal W}^{-1}$ denotes the inverse-Wishart distribution and $(\mbox{\boldmath $\mu$}_{m1}, \mbox{\boldmath $\Sigma$}_{m11})$ are independent of $\omega^{(2)}$. The resulting distribution of $(\mbox{\boldmath $b$}_{m1}, \mbox{\boldmath $Q$}_{m11})$ conditional on $(\mbox{\boldmath $b$}_2, \mbox{\boldmath $Q$}_{22}, \mbox{\boldmath $Q$}_{21})$ is not a common or named distribution, but it is well defined via the relations, $\mbox{\boldmath $b$}_{m1} = \mbox{\boldmath $\Sigma$}_{m11}^{-1}\mbox{\boldmath $\mu$}_{m1} + \mbox{\boldmath $Q$}_{12} \mbox{\boldmath $Q$}_{22}^{-1} \mbox{\boldmath $b$}_2$, and $\mbox{\boldmath $Q$}_{m11} = \mbox{\boldmath $\Sigma$}_{m11}^{-1} + \mbox{\boldmath $Q$}_{12} \mbox{\boldmath $Q$}_{22}^{-1} \mbox{\boldmath $Q$}_{21}$.\\[-.15in] \noindent {\em Result 2.} {\em The prior distribution defined in $($\ref{eq:comp_prior_1}$)$ and $($\ref{eq:comp_prior_2}$)$ results in a marginal distribution for $(\mbox{\boldmath $\mu$}_m, \mbox{\boldmath $\Sigma$}_m)$ of ${\cal N}{\cal I}{\cal W} ( \mbox{\boldmath $0$}, \lambda, \mbox{\boldmath $\Psi$}, \eta)$, $\!$i.e.,$\!$ the same normal-inverse-Wishart regardless of $\mbox{\boldmath $\gamma$}$.$\!\!\!\!$}\\[-.15in] \noindent {\em Proof.} It follows from Theorem 3 of \citet{Bodnar2008} that $\mbox{\boldmath $\Sigma$}_m \sim {\cal I}{\cal W} (\eta, \mbox{\boldmath $\Psi$})$. It remains to show $\mbox{\boldmath $\mu$}_m \mid \mbox{\boldmath $\Sigma$}_m \sim {\cal N}(\mbox{\boldmath $0$}, (1/\lambda)\mbox{\boldmath $\Sigma$}_{m})$. However, according to (\ref{eq:comp_prior_1}) and (\ref{eq:comp_prior_2}) and the independence assumption, \vspace{-.15in}\begin{eqnarray} \left.\left( \begin{array}{c} \mbox{\boldmath $\mu$}_{m1}\\ \mbox{\boldmath $b$}_{2} \end{array} \right) \right| \mbox{\boldmath $\Sigma$}_m \sim {\cal N} \left( \left( \begin{array}{c} \mbox{\boldmath $0$}\\ \mbox{\boldmath $0$} \end{array} \right) , \frac{1}{\lambda}\left( \begin{array}{cc} \mbox{\boldmath $\Sigma$}_{m11} & \mbox{\boldmath $0$}\\ \mbox{\boldmath $0$} & \mbox{\boldmath $Q$}_{22} \end{array} \right) \right).\nonumber \\[-.375in] \nonumber \end{eqnarray} Also, $\mbox{\boldmath $b$}_m = \mbox{\boldmath $Q$}_m \mbox{\boldmath $\mu$}_m$ implies, \vspace{-.15in}\begin{displaymath} \left( \begin{array}{c} \mbox{\boldmath $\mu$}_{m1}\\ \mbox{\boldmath $\mu$}_{m2} \end{array} \right) = \left( \begin{array}{cc} \mbox{\boldmath $I$} & \mbox{\boldmath $0$}\\ -\mbox{\boldmath $Q$}_{22}^{-1} \mbox{\boldmath $Q$}_{21} & \mbox{\boldmath $Q$}_{22}^{-1} \end{array} \right) \left( \begin{array}{c} \mbox{\boldmath $\mu$}_{m1}\\ \mbox{\boldmath $b$}_{2} \end{array} \right). \vspace{-.12in}\end{displaymath} Using the relation $\mbox{\boldmath $A$}\mbox{\boldmath $x$} \sim {\cal N}(\mbox{\boldmath $A$}\mbox{\boldmath $\mu$}, \mbox{\boldmath $A$}\mbox{\boldmath $\Sigma$}\mbox{\boldmath $A$}')$ for $\mbox{\boldmath $x$} \sim {\cal N}(\mbox{\boldmath $\mu$}, \mbox{\boldmath $\Sigma$})$ gives the desired result. $\:\Box$\\[-.15in] As mentioned above, the normal-inverse-Wishart distribution is conjugate for $\omega_m$ in the unrestricted (no variable selection) setting. It turns out that the distribution defined in (\ref{eq:comp_prior_1}) and (\ref{eq:comp_prior_2}) is conjugate for the parameterization in (\ref{eq:can_MVN}) as well, so that the component parameters can be integrated out of the likelihood. Let the (latent) observations be denoted as $\mbox{\boldmath $Z$}=[\mbox{\boldmath $z$}_1',\dots,\mbox{\boldmath $z$}_n']'$, and the data likelihood as $f(\mbox{\boldmath $Z$} \mid \mbox{\boldmath $\gamma$}, \mbox{\boldmath $\phi$}, \Omega)$.\\[-.15in] \noindent {\em Result 3.} {\em The marginal likelihood of $\mbox{\boldmath $Z$}$ is given by \vspace{-.15in} \begin{displaymath} f(\mbox{\boldmath $Z$} \!\mid \!\mbox{\boldmath $\gamma$}, \mbox{\boldmath $\phi$}) = \int f(\mbox{\boldmath $Z$} \mid \mbox{\boldmath $\gamma$}, \mbox{\boldmath $\phi$}, \Omega) f(\Omega \mid \mbox{\boldmath $\gamma$}) d\Omega \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\; \vspace{-.4in} \end{displaymath} \begin{eqnarray} \;\;\;\;\;\;\;\;\;\; = \pi^{-\frac{np}{2}}\!\prod_{m=1}^M \!\left[\! \left(\frac{\lambda}{n_m\!+\!\lambda} \right)^{\!\!\frac{p_1}{2}}\! \frac{|\mbox{\boldmath $\Psi$}_{\!11}|^{\frac{\eta-p_2}{2}}\Gamma_{\!p_1}\!\!\left(\frac{n_m+\eta-p_2}{2}\right)} {|\mbox{\boldmath $V$}_{\!m11}|^{\frac{n_m+\eta-p_2}{2}}\Gamma_{\!p_1}\!\!\left(\frac{\eta-p_2}{2}\right)} \!\right]\! \left[\! \left(\frac{\lambda}{n\!+\!\lambda} \right)^{\!\!\frac{p_2}{2}}\! \frac{|\mbox{\boldmath $\Psi$}_{\!11}|^{\frac{p_2}{2}}|\mbox{\boldmath $\Psi$}_{\!2\mid 1}|^{\frac{\eta}{2}}\Gamma_{\!p_2}\!\!\left(\frac{n+\eta}{2}\right)} {|\mbox{\boldmath $V$}_{\!11}|^{\frac{p_2}{2}}|\mbox{\boldmath $V$}_{\!2\mid 1}|^{\frac{n+\eta}{2}}\Gamma_{\!p_2}\!\!\left(\frac{\eta}{2}\right)} \!\right], \nonumber \\[-.35in] \nonumber \end{eqnarray} where (i) $M=\max(\mbox{\boldmath $\phi$})$, i.e., the number of observed components, (ii) $p_1 = \sum \gamma_j$ is the number of informative variables, (iii) $p_2 = p - p_1$, (iv) $n_m$ is the number of $\phi_i = m$, (v) $\Gamma_p(\cdot)$ is the multivariate gamma function, and (vi) $\mbox{\boldmath $V$}_{\!m11}$, $\mbox{\boldmath $V$}_{\!11}$, $\mbox{\boldmath $V$}_{\!2 \mid 1}$ are defined as, \vspace{-.15in}\begin{eqnarray} \mbox{\boldmath $V$}_{\!m11} & = & \sum_{\phi_i =m} (\mbox{\boldmath $z$}^{(1)}_{i} \!- \!\bar{\mbox{\boldmath $z$}}_{m1})(\mbox{\boldmath $z$}^{(1)}_{i} \!-\! \bar{\mbox{\boldmath $z$}}_{m1})' \!+ \!\frac{n_m\lambda}{n_m\!+\!\lambda}\bar{\mbox{\boldmath $z$}}_{m1}\bar{\mbox{\boldmath $z$}}_{m1}' \!+\! \mbox{\boldmath $\Psi$}_{11}, \nonumber \\ \mbox{\boldmath $V$}_{\!11} & = & \!\sum_{i=1}^n (\mbox{\boldmath $z$}^{(1)}_{i} \!\!- \!\bar{\mbox{\boldmath $z$}}_{1})(\mbox{\boldmath $z$}^{(1)}_{i} \!\!- \!\bar{\mbox{\boldmath $z$}}_{1})' \!+ \!\frac{n\lambda}{n\!+\!\lambda}\bar{\mbox{\boldmath $z$}}_{1}\bar{\mbox{\boldmath $z$}}_{1}' \!+ \!\mbox{\boldmath $\Psi$}_{\!11}, \nonumber \\ \mbox{\boldmath $V$}_{\!2 \mid 1} & = & \mbox{\boldmath $V$}_{\!22} - \mbox{\boldmath $V$}_{\!21}\mbox{\boldmath $V$}_{\!11}^{-1}\mbox{\boldmath $V$}_{\!21}', \nonumber\\[-.44in] \nonumber \end{eqnarray} with $\bar{\mbox{\boldmath $z$}}_{m1} = \frac{1}{n_m}\sum_{\phi_i=m} \mbox{\boldmath $z$}^{(1)}_{i}$, $\;\bar{\mbox{\boldmath $z$}}_{1} = \frac{1}{n}\sum_{i=1}^n \mbox{\boldmath $z$}^{(1)}_{i}$, $\;\bar{\mbox{\boldmath $z$}}_{2} = \frac{1}{n}\sum_{i=1}^n \mbox{\boldmath $z$}^{(2)}_{i}$, \vspace{-.1in}\begin{eqnarray} \!\mbox{\boldmath $V$}_{\!\!22}\! &= & \!\!\sum_{i=1}^n (\mbox{\boldmath $z$}^{(2)}_{\!i} \!\!\!-\! \bar{\mbox{\boldmath $z$}}_{2})(\mbox{\boldmath $z$}^{(2)}_{\!i} \!\!\!-\! \bar{\mbox{\boldmath $z$}}_{2})' \!\!+\! \frac{n\lambda}{n\!+\!\lambda}\bar{\mbox{\boldmath $z$}}_{2}\bar{\mbox{\boldmath $z$}}_{2}' \!+\! \mbox{\boldmath $\Psi$}_{\!22},\;\mbox{and}\:\\[-.07in] \mbox{\boldmath $V$}_{\!\!21} \! &=& \!\! \sum_{i=1}^n (\mbox{\boldmath $z$}^{(2)}_{\!i} \!\!\!-\! \bar{\mbox{\boldmath $z$}}_{2})(\mbox{\boldmath $z$}^{(1)}_{\!i} \!\!\!-\! \bar{\mbox{\boldmath $z$}}_{1})'\!\! +\! \frac{n\lambda}{n\!+\!\lambda}\bar{\mbox{\boldmath $z$}}_{2}\bar{\mbox{\boldmath $z$}}_{1}' \!+\! \mbox{\boldmath $\Psi$}_{\!21}. \nonumber\\[-.375in] \nonumber \end{eqnarray} } \noindent The derivation of Result~3 is provided in Web Appendix~\ref{sec:like_deriv}. \vspace{-.2in} \subsection{Hyper-Prior Distributions} \vspace{-.1in} \label{sec:priors} \citet{Kim2006} found there to be a lot of prior sensitivity due to the choice of prior for the component parameters. This is in part due to the separate prior specification for the parameters corresponding to informative and non-informative variables, respectively. The specification above treats all component parameters collectively, in a single prior, so that the choice will not be sensitive to the interplay between the priors chosen for informative and non-informative variables. A further stabilization can be obtained by rationale similar to that used in \citet{Raftery2006} for restricted forms of the covariance (such as equal shape, orientation, etc.). We do not enforce such restrictions exactly, but one might expect the components to have similar covariances or similar means for some of the components. Thus it makes sense to put hierarchical priors on $\lambda$, $\mbox{\boldmath $\Psi$}$, and $\eta$, to encourage such similarity if warranted by the data. A Gamma prior is also placed on the concentration parameter $\alpha$, i.e., \vspace{-.12in}\begin{equation} \begin{array}{ll} \;\;\;\;\;\;\;\lambda \sim \mbox{Gamma}(A_\lambda, B_\lambda), \;\;\;\;\;\;& \mbox{\boldmath $\Psi$} \sim {\cal W}(\mbox{\boldmath $P$},N), \\ \!\!\!\!\!\!\!\!\!\eta \!-\!(p \!+ \!1) \sim \mbox{Gamma}(A_\eta, B_\eta), & \:\alpha \sim \mbox{Gamma}(A_\alpha, B_\alpha). \end{array}\label{eq:hyper_priors} \vspace{-.1in}\end{equation} In the analyses below, relatively vague priors were used with $A_\lambda\!=\!B_\lambda\!=\!A_\eta\!=\!B_\eta\!=\!2$. The prior for $\alpha$ was set to $A_\alpha\!=\!2$, $B_\alpha\!=\!2$, to encourage anywhere from 1 to 15 clusters from 100 observations. The results still have some sensitivity to the choice of $\mbox{\boldmath $P$}$. In addition, there are some drawbacks to Wishart priors which can be exaggerated when applied to variables of differing scale \citep{Gelman2006,Huang2013}. In order to alleviate these issues, we recommend first standardizing the columns of the data to mean zero and unit variance, then using $N\!=\!p+2$, $\mbox{\boldmath $P$}\!=\!(1/N)\mbox{\boldmath $I$}$. Finally, the prior probability for variable inclusion was set to $\rho_j\!=\!0.5$ for all $j$. The data model in (\ref{eq:z2y}) and (\ref{eq:vs_dpm_2}), the component prior distribution in (\ref{eq:comp_prior_1}) and (\ref{eq:comp_prior_2}), along with the hyper-priors in (\ref{eq:hyper_priors}), completes the model specification. \vspace{-.2in} \subsection{MCMC Algorithm} \vspace{-.1in} \label{sec:MCMC_summary} Complete MCMC details are provided in the Web Appendix~\ref{sec:MCMC}. However, an overview is provided here to illustrate the main idea. The complete list of parameters to be sampled in the MCMC are $\Theta = \{ \mbox{\boldmath $\gamma$}, \mbox{\boldmath $\phi$}, \lambda, \eta, \mbox{\boldmath $\Psi$}, \alpha, \tilde{\mbox{\boldmath $Z$}} \}$, where $\tilde{\mbox{\boldmath $Z$}}$ contains any latent element of $\mbox{\boldmath $Z$}$ (i.e., either corresponding to missing data, discrete variable, or boundary/censored observation). The only update that depends on the raw observed data $\mbox{\boldmath $Y$}=[\mbox{\boldmath $y$}_1',\dots,\mbox{\boldmath $y$}_n']'$ is the update of $\tilde{\mbox{\boldmath $Z$}}$. All other parameters, when conditioned on $\mbox{\boldmath $Y$}$ and $\mbox{\boldmath $Z$}$, only depend on $\mbox{\boldmath $Z$}$. The $\tilde{\mbox{\boldmath $Z$}}$ are block updated, each with a MH step, but with a proposal that looks almost conjugate, and is therefore accepted with high probability; the block size can be adjusted to trade-off between acceptance and speed (e.g., acceptance $\sim 40$\%). A similar strategy is taken with the $\mbox{\boldmath $\Psi$}$ update, i.e., a nearly conjugate update is proposed and accepted/rejected via an MH step. Because the component parameters are integrated out, the $\phi_i$ can be updated with simple Gibbs sampling \citep{Neal2000}, however, this approach has known mixing issues \citep{Jain04,Ishwaran2001}. Thus, a modified split-merge algorithm \citep{Jain04} similar to that used in \citep{Kim2006} was developed to sample from the posterior distribution of $\mbox{\boldmath $\phi$}$. The remaining parameters are updated in a hybrid Gibbs, Metropolis Hastings (MH) fashion. The $\mbox{\boldmath $\gamma$}$ vector is updated with MH by proposing an add, delete, or swap move \citep{George97}. The $\lambda, \eta, \alpha$ parameters have standard MH random walk updates on log-scale. The MCMC routine then consists of applying each of the above updates in turn to complete a single MCMC iteration, with the exception that the $\mbox{\boldmath $\gamma$}$ update be applied $L_g$ times each iteration. Two modifications were also made to the above strategy to improve mixing. The algorithm above would at times have trouble breaking away from local modes when proposing $\mbox{\boldmath $\phi$}$ and $\mbox{\boldmath $\gamma$}$ updates separately. Thus, an additional joint update is proposed for $\mbox{\boldmath $\phi$}$ and $\mbox{\boldmath $\gamma$}$ each iteration which substantially improved the chance of a move each iteration. Also, as described in more detail in Web Appendix~\ref{sec:MCMC}, the traditional split merge algorithm proposes an update by first selecting two points, $i$ and $i'$, at random. If they are from the same cluster (according to the current $\mbox{\boldmath $\phi$}$) it then assigns them to separate clusters and assigns the remaining points from that cluster to each of the two new clusters at random. It then conducts several ($L$) restricted (to one of the two clusters) Gibbs sampling updates to the remaining $\phi_h$ from the original cluster. The resulting $\mbox{\boldmath $\phi$}^*$ then becomes the proposal for a split move. We found that the following adjustment resulted in better acceptance of split/merge moves. Instead of assigning the remaining points to the two clusters at random, simply assign them to the closest of the two observations $i$ or $i'$. Then conduct $L$ restricted Gibbs sample updates to produce the proposal. We found little performance gain beyond $L=3$. Lastly, it would be possible to instead use a finite mixture approximation via the kernel stick breaking representation of a DPM \citep{Sethuraman94,Ishwaran2001}. However, this approach would be complicated by the dependency between $\mbox{\boldmath $\gamma$}$ and the structure and dimensionality of the component parameters. This issue is entirely avoided with the proposed approach as the component parameters are integrated out. The code to perform the MCMC for this model has been made available in a GitHub repository at \verb1https://github.com/cbstorlie/DPM-vs.git1. \vspace{-.2in} \subsection{Inference for $\mbox{\boldmath $\phi$}$ and $\mbox{\boldmath $\gamma$}$} \vspace{-.1in} \label{sec:inference} The estimated cluster membership $\hat{\phi}$ for all of the methods was taken to be the respective mode of the estimated cluster membership probabilities. For the DPM methods, the cluster membership probability matrix $P$ (which is an $n \times \infty$ matrix in principle) is not sampled in the MCMC, and is not identified due to many symmetric modes (thus their can be label switching in the posterior samples). However, the information theoretic approach of \citet{Stephens2000} (applied to the DPM in \citet{Fu2013}) can be used to address this issue and relabel the posterior samples of $\mbox{\boldmath $\phi$}$ to provide an estimate of $P$. The resulting estimate $\hat{P}$ has $i^{\mbox{\scriptsize th}}$ row, $m^{\mbox{\scriptsize th}}$ column that can be thought of as the proportion of the relabeled posterior samples of $\phi_i$ that have the value $m$. While technically $P$ is an $n \times \infty$ matrix, all columns after $M^*$ have zero entries in $\hat{P}$, where $M^*$ is the maximum number of clusters observed in the posterior. For the results below, the point estimate of $\mbox{\boldmath $\hgamma$}$ is determined by $\hat{\gamma}_j = 1$ if $\Pr(\gamma_j = 1) > \rho_j = 0.5$, and $\hat{\gamma}_j = 0$ otherwise. \vspace{-.2in} \section{Simulation Results} \vspace{-.1in} \label{sec:sims} In this section the performance of the proposed approach for clustering is evaluated on two simulation cases similar in nature to the ASD clustering problem. Each of the cases is examined (i) without missing data or discrete variables/censoring, (ii) with missing data, but no discrete variables/censoring, (iii) with missing data and several discrete and/or censored variables. The approaches to be compared are listed below. \begin{itemize}[leftmargin=1.0in] \singlespacing \item[{\bf DPM-vs} $-$] the proposed method. \item[{\bf DPM-cont} $-$] the proposed method without accounting for discrete variables/censoring (i.e., assuming all continuous variables). \item[{\bf DPM} $-$] the proposed method with variable selection turned off (i.e., a prior probability $\rho_j=1$). \item[{\bf DPM-ind} $-$] the approach of \citet{Kim2006} when all variables are continuous (i.e., assuming non-informative variables are independent of the rest), but modified to treat discrete variables/censoring and missing data when applicable just as the proposed approach. \item[{\bf Mclust-vs} $-$] the approach of \citet{Raftery2006} implemented with the \verb1clustvarsel1 package in R. When there are missing data, Random Forest Imputation \citep{Stekhoven2012} implemented with the \verb1missForest1 package in R is used prior to application of \verb1clustvarsel1. However, the Mclust-vs approach does not treat discrete variables differently and thus treats all variables as continuous and uncensored. \item[{\bf VarSelLCM} $-$] the approach of \citet{Marbac2017} implemented in the R package \verb1VarSelLCM1. It allows for mixed data types and missing data, however, it assumes both {\em local} independence of variables within cluster and {\em global} independence between informative and non-informative variables.\\[-.29in] \end{itemize} Each simulation case is described below. Figure~\ref{fig:sim_2c} provides a graphical depiction of the problem for the first eight variables from the first of the 100 realizations of Case 2(c). Case 1 simulations resulted in very similar data patterns as well. \begin{itemize}[leftmargin=.9in] \singlespacing \item[{\bf Case 1(a)} $-$] $n=150$, $p=10$. The true model has $M=3$ components with mixing proportions 0.5, 0.25, 0.25, respectively, and $\mbox{\boldmath $y$} \!\mid\! \phi$ is a multivariate normal with no censoring nor missing data. Only two variables $\mbox{\boldmath $y$}^{(1)}=[y_1, y_2]'$ are informative, with means of $(2,0)$, $(0,2)$, $(-1.5,-1.5)$, unit variances, and correlations of 0.5, 0.5, -0.5 in each component, respectively. The non-informative variables $\mbox{\boldmath $y$}^{(2)}=[y_3,\dots,y_{10}]'$ are generated as {\em iid} ${\cal N}(0,1)$. \item[{\bf Case 1(b)} $-$] Same as the setup in 1(a) only the non-informative variables $\mbox{\boldmath $y$}^{(2)}$ are correlated with $\mbox{\boldmath $y$}^{(1)}$ through the relation $\mbox{\boldmath $y$}^{(2)} = \mbox{\boldmath $B$} \mbox{\boldmath $y$}^{(1)} + \mbox{\boldmath $\varepsilon$}$, where $\mbox{\boldmath $B$}$ is a $8 \times 2$ matrix whose elements are distributed as {\em iid} ${\cal N}(0,0.3)$, and $\mbox{\boldmath $\varepsilon$} \sim {\cal N}(0,Q^{-1}_{22})$, with $\mbox{\boldmath $Q$}_{22} \sim {\cal W}(\mbox{\boldmath $I$},10)$. \item[{\bf Case 1(c)} $-$] Same as in 1(b), but variables $y_1, y_6$ are discretized to the closest integer, variables $y_2,y_9$ are left censored at -1.4 ($\sim$8\% of the observations), and $y_3, y_{10}$ are right censored at 1.4. \item[{\bf Case 1(d)} $-$] Same as 1(c), but the even numbered $y_j$ have $\sim 30$\% of the observations MAR. \item[{\bf Case 2(a)} $-$] $n=300$, $p=30$. The true model has $M\!=\!3$ components with mixing proportions 0.5, 0.25, 0.25, respectively, $\mbox{\boldmath $y$} \!\mid\! \phi$ is a multivariate normal with no censoring nor missing data. Only four variables $(y_1, y_2, y_3, y_4)$ are informative, with means of $(0.6,0,1.2,0)$, $(0,1.5,-0.6,1.9)$, $(-2,-2,0,0.6)$ and all variables with unit variance for each of the three components, respectively. All correlations among informative variables are equal to 0.5 in components 1 and 2, while component 3 has correlation matrix, $\mbox{\boldmath $\Sigma$}_{311}(i,j) \!=\! 0.5(-1)^{\|i+j\|}I_{\{i\neq j\}} \!+\! I_{\{i=j\}}$. The non-informative variables $\mbox{\boldmath $y$}^{(2)}=[y_5,\dots,y_{30}]'$ are generated as {\em iid} ${\cal N}(0,1)$. \item[{\bf Case 2(b)} $-$] Same as the setup in Case 2(a) only the non-informative variables $\mbox{\boldmath $y$}^{(2)}$ are correlated with $\mbox{\boldmath $y$}^{(1)}$ through the relation $\mbox{\boldmath $y$}^{(2)} = \mbox{\boldmath $B$} \mbox{\boldmath $y$}^{(1)} + \mbox{\boldmath $\varepsilon$}$, where $\mbox{\boldmath $B$}$ is a $26 \times 4$ matrix whose elements are distributed as {\em iid} ${\cal N}(0,0.3)$, and $\mbox{\boldmath $\varepsilon$} \sim {\cal N}(0,Q^{-1}_{22})$, with $\mbox{\boldmath $Q$}_{22} \sim {\cal W}(\mbox{\boldmath $I$},30)$. \item[{\bf Case 2(c)} $-$] Same setup as in Case 2(b), but now variables $y_1,y_6,y_{11}$ are discretized to the closest integer, variables $y_2, y_9, y_{10},y_{11}$ are left censored at -1.4 ($\sim$8\% of the observations), and variables $y_3, y_{12}, y_{13},y_{14}$ are right censored at 1.4. \item[{\bf Case 2(d)} $-$] Same as Case 2(c), but the even numbered $y_j$ have $\sim 30$\% MAR.\\[-.32in] \end{itemize} \begin{figure}[t!] \vspace{-.1in} \centering \caption{About Here.} \vspace{-.2in} \end{figure} For each of the eight simulation cases, 100 data sets were randomly generated and each of the five methods above was fit to each data set. The methods are compared on the basis of the following statistics. \begin{itemize}[leftmargin=.75in] \singlespacing \item[{\em Acc $-$}] Accuracy calculated as the proportion of observations in the estimated clusters that are in the same group as they are in the true clusters, when put in the arrangement (relabeling) that best matches the true clusters. \item[{\em FI} $-$] Fowlkes-Mallows index of $\mbox{\boldmath $\hphi$}$ relative to the true clusters. \item[{\em ARI} $-$] Adjusted Rand index. \item[{\em M} $-$] The number of estimated clusters. The estimated number of clusters for the Mclust-vs and VarSelLCM methods was chosen as the best of the possible $M=1,\dots8$ cluster models via BIC. The number of clusters for the Bayesian methods is chosen as the posterior mode and is inherently allowed to be as large as $n$. \item[$p_1$ $-$] The model size, $p_1 = \sum_j \hat{\gamma}_j$. \item[{\em PVC} $-$] The proportion of variables correctly included/excluded from the model, \\{\em PVC}$\:$$=(1/p)\sum_j I_{\{\hat{\gamma}_j=\gamma_j\}}$. \item[{\em CompT} $-$] The computation time in minutes (using 20,000 MCMC iterations for the Bayesian methods).\\[-.32in] \end{itemize} These measures are summarized in the columns of the tables below by their mean (and standard deviation) over the 100 data sets. It appeared that 20,000 iterations (10,000 burn in and 10,000 posterior samples) was sufficient for the Bayesian methods to summarize the posterior in the simulation cases via several trial runs, however not every simulation result was inspected for convergence. The simulation results from Cases 1(a)-(d) are summarized in Table~\ref{tab:case1}. The summary score for the {\em best} method for each summary is in bold along with that for any other method that was not statistically different from the {\em best} method on the basis of the 100 trials (via an uncorrected paired $t$-test with $\alpha=0.05$). As would be expected, DPM-ind is one of the best methods on Case 1(a), however, it is not significantly better than DPM-vs or Mclust-vs on any of the metrics. VarSelLCM performs slightly worse than the top three methods in this case since the local independence assumption is being violated. All of the other methods solidly outperform DPM though, which had a difficult time finding more than a single cluster since it had to include all 10 variables. In Case 1(b) the assumptions of DPM-ind are now being violated and it is unable to perform adequate variable selection. It must include far too many non-informative variables due to the correlation within $\mbox{\boldmath $y$}^{(2)}$ and between $\mbox{\boldmath $y$}^{(1)}$ and $\mbox{\boldmath $y$}^{(2)}$. The clustering performance suffers as a result and like DPM, it has difficulty finding more than a single cluster. VarSelLCM also struggles in this case for the same reason; the global independence assumption is being violated. Mclust-vs still performs well in this case, but DPM-vs (and DPM-cont) is significantly better on two of the metrics. In case 1(c) DPM-vs is now explicitly accounting for the discrete and left/right censored variables, while DPM-cont does not. When the discrete variables are incorrectly assumed to be continuous it tends to create separate clusters at some of the unique values of the discrete variables. This is because a very high likelihood can be obtained by normal distributions that are almost singular along the direction of the discrete variables. Thus, DPM-vs substantially outperforms DPM-cont and Mclust-vs, demonstrating the importance of explicitly treating the discrete nature of the data when clustering. Finally, Case 1(d) shows that the loss of 30\% of the data for half of the variables (including an informative variable) does not degrade the performance of DPM-vs by much. In this case Mclust-vs uses Random Forest Imputation to first impute the data, then cluster. The imputation procedure does not explicitly take into account of the cluster structure of the data, rather it could mask this structure. This is another reason that the performance is worse than the proposed approach which incorporates the missingness directly into the clustering model. Mclust-vs and VarSelLCM both have {\em much} faster run-times than the Bayesian methods, however, when there are local or global correlations and discrete variables and/or missing data, they did not perform nearly as well as DPM-vs. \begin{table}[t!] \vspace{-.1in} \centering \caption{About Here.} \vspace{-.2in} \end{table} \begin{table}[t!] \vspace{-.0in} \centering \caption{About Here.} \vspace{-.2in} \end{table} The simulation results from Cases 2(a)-(d) are summarized in Table~\ref{tab:case2}. A similar story line carries over into Case 2 where there are now $p=30$ (four informative) variables and $n=300$ observations. Namely, DPM-vs is not significantly different from DPM-ind or Mclust-vs on any of the summary measures for Case 2(a), with the exception of computation time. DPM-vs is the best method on all summary statistics (except {\em CompT}) by a sizeable margin on the remaining cases. While Mclust is much faster than DPM-vs, the cases of the most interest in this paper are those with discrete variables, censoring and/or missing data (i.e., Cases 1(c), 1(d), 2(c), and 2(d)). In these cases, the additional computation time of DPM-vs might seem inconsequential relative to the enormous gain in accuracy. It is interesting that DPM-vs suffers far less from the missing values when moving from Case 2(c) to 2(d) than it did from Case 1(c) to 1(d). This is likely due to the fact that there are a larger number of observations to offset the additional complexity of a larger $p$. However, it is also likely that the additional (correlated) variables may help to reduce the posterior variance of the {\em imputed} values. \vspace{-.2in} \section{Application to Autism and Related Disorders} \vspace{-.1in} \label{sec:ASD} The cohort for this study consists of subjects falling in the criteria for ``potential ASD'' (PASD) on the basis of various combinations of developmental and psychiatric diagnoses obtained from comprehensive medical and educational records as described in \citet{Katusic16}. The population of individuals with PASD is important because this group represents the pool of patients with developmental/behavioral symptoms from which clinicians have to determine who has ASD and/or other disorders. Subjects 18 years of age or older were invited to participate in a face-to-face session to complete psychometrist-administered assessments of autism symptoms, cognition/intelligence, memory/learning, speech and language, adaptive functions, and maladaptive behavior. In addition, guardians were asked to complete several self-reported, validated questionnaires. The goal is to describe how the patients' test scores separate them in terms of clinical presentation and which test scores are the most useful for this purpose. This falls in line with the new Research Domain Criteria (RDoC) philosophy that has gained traction in the field of mental health research. RDoC is a new research framework for studying mental disorders. It aims to integrate many levels of information (cognitive/self-report tests, imaging, genetics) to understand how all of these might be related to similar clinical presentations. A total of 87 test scores measuring cognitive and/or behavioral characteristics were considered from a broad list of commonly used tests for assessing such disorders. A complete list of the individual tests considered is provided in Web Appendix~\ref{sec:definitions}. Using expert judgment to include several commonly used aggregates in place of individual subtest scores, this list was reduced to 55 test score variables to be considered in the clustering procedure. Five of the 55 variables have fewer than 15 possible values and are treated here as discrete, ordinal variables. A majority (46) of the 55 variables also have a lower bound, which is attained by a significant portion of the individuals, and are treated as left censored. Five of the variables have an upper bound that is attained by many of the individuals and are thus treated as right censored. There are 486 observations (individuals) in the dataset, however, only 67 individuals have complete data, i.e., a complete case analysis would throw out 86\% of the observations. DPM-vs was applied to these data; four chains with random starting points were run in parallel for 85,000 iterations each, which took $\sim40$ hours on a 2.2GHz processor. The first 10,000 iterations were discarded as burn-in. More iterations were used here than in the simulation cases due to the fact that this analysis is slightly more complicated (e.g., more variables and observations) and it only needed to be performed once. MCMC trace plots are provided in Web Appendix~\ref{sec:MCMCtrace}. All chains converged to the same distribution (aside from relabeling) and were thus combined Four of the tests (Beery standard, CompTsc\_ol, WJ\_Pass\_Comprehen, and Adaptive Composite) had a high ($>0.88$) posterior probability of being informative (Table~\ref{tab:inform_vars}). There is also evidence that Ach\_abc\_Attention and Ach\_abc\_AnxDep are informative. The posterior samples were split on which of these two should be included in the model (they were only informative together for 0.1\% of the MCMC samples). The next highest posterior inclusion probability for any of the remaining variables was 0.17 and the sum of the inclusion probabilities for all remaining variables was only 0.28. Thus, there is strong evidence to suggest that only five of the 55 variables are sufficient to inform the cluster membership. \begin{table}[t!] \vspace{-.1in} \centering \caption{About Here.} \vspace{-.2in} \end{table} \begin{figure}[t!] \vspace{-.0in} \centering \caption{About Here.} \vspace{-.2in} \end{figure} A majority (54\%) of the posterior samples identified three components/clusters, with 0.12 and 0.25 posterior probability of two and four clusters, respectively. The calculation of $\hat{\phi}$ also resulted in three components. Figure~\ref{fig:scatter_ASD} displays the estimated cluster membership via pairwise scatterplots of the five most informative variables on a standardized scale. Ach\_abc\_Attention has also been multiplied by minus one so that higher values imply better functioning for {\em all} tests. The corresponding mean vectors of the three main components are also provided in Table~\ref{tab:inform_vars}. There are two groups that are very distinct (i.e., Clusters~1~and~2 are the ``high'' and ``low'' groups, respectively), but there is also a ``middle'' group (Cluster 3). Cluster 3 subjects generally have medium-to-high Adaptive\_Composite, WJ\_Pass\_Comprehen, and Ach\_abc\_Attention scores, but low-to-medium Beery\_standard and WJ\_Pass\_Comprehen. Figure~\ref{fig:ASD_3D}(a) provides a 3D scatter plot on the three most informative variables, highlighting separation between Cluster 1 and Clusters 2 and 3. However, Clusters 2 and 3 are not well differentiated in this plot. Figure~\ref{fig:ASD_3D}(b) shows a 3D scatter plot on the variables CompTsc\_ol, WJ\_Pass\_Comprehen, and Ach\_Attention, illustrating differentiation between Clusters 2 and 3. The goal of this work is not necessarily to identify clusters that align with clinical diagnosis of ASD, i.e., it is not a classification problem. The Research Domain Criteria (RDoC) philosophy is to get away from subjective based diagnosis of disease. The hope is that these clusters provide groups of similar patients that may have similar underlying physiological causes and can be treated similarly (whether the clinical diagnosis was ASD or not). That being said, the ``high'' cluster aligned with {\em no} clinical diagnosis of ASD for 92\% of its subjects, while the ``low'' cluster aligned with positive clinical ASD diagnosis for 50\% of its subjects. As these clusters result from a bottom-up, data-driven method, they may prove useful to determine imaging biomarkers that correspond better with cluster assignment than a more subjective diagnosis provided by a physician. This will be the subject of future work. \begin{figure}[t!] \vspace{-.12in} \centering \caption{About Here.} \vspace{-.23in} \end{figure} \vspace{-.24in} \section{Conclusions \& Further Work} \vspace{-.12in} \label{sec:conclusions} In this paper we developed a general approach to clustering via a Dirichlet process model that explicitly allows for discrete and censored variables via a latent variable approach, and missing data. This approach overcomes the assumption of (global) independence between informative and non-informative variables and the assumption of (local) independence of variables within cluster often assumed when clustering data of mixed type. The MCMC computation proceeds via a split/merge algorithm by integrating out the component parameters. This approach was shown to perform markedly better than other approaches on several simulated test cases. The approach was developed for moderate $p$ in the range of $\sim\!10 \!- \!300$. The computation is ${\cal O}(p^3)$, which makes it ill-suited for extremely large dimensions. However, it may be possible to use a graphical model \citep{Giudici1999,Wong2003} within the proposed framework to alleviate this burden for large $p$. The approach was used to analyze test scores of individuals with potential ASD and identified three clusters. Further, it was determined that only five of the 55 variables were informative to assess the cluster membership of an observation. This could have a large impact for diagnosis of ASD as there are currently $\sim \! 100$ tests/subtest scores that could be used, and there is no universal standard. Further, the clustering results have served to generate hypotheses about what might show up in brain imaging to explain some of the differences between potential ASD patients. A follow-up study has been planned to investigate these possible connections.\\[-.43in] \vspace{-.2in} {\small \begin{spacing}{1.69} \section{Cognitive/Behavioral Tests Descriptions} \label{sec:definitions} {\scriptsize \singlespacing \renewcommand{\arraystretch}{1.5} \vspace{-.15in}\begin{longtable}{|lll|} \caption{Test and self-report form descriptions for the 55 tests used in the analysis in the main paper.}\\ \hline $\!\!$Variable Name & Test/Form & Description \\ \hline \hline && \\[-.1in] $\!\!$General\_Adaptive\_Composite$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{Adaptive Behavior Assessment System (ABAS-II) overall adaptive functioning composite score} & \parbox{.45\textwidth}{Includes all 9 skill areas in the 3 rows below plus Work (when applicable).}\\[0.1in] \hline && \\[-.1in] $\!\!$Conceptual\_Composite\_Score$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{ABAS-II Conceptual Composite domain } & \parbox{.45\textwidth}{Includes Communication, Functional Academics, and Self-Direction skill areas. }\\[0.2in] \hline && \\[-.1in] $\!\!$Social\_Composite\_Score$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{ABAS-II Social Composite domain } & \parbox{.45\textwidth}{Includes Leisure and Social skill areas. }\\[0.1in] \hline && \\[-.1in] $\!\!$Practical\_Composite\_Score$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{ABAS-II Practical Composite domain } & \parbox{.45\textwidth}{Includes Community Use, Home Living, Health and Safety, and Self-Care skill areas. }\\[0.2in] \hline && \\[-.1in] $\!\!$ABC\_Irritability\_raw$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{Aberrant Behavior Checklist, Irritability scale} & \parbox{.45\textwidth}{ABC is a maladaptive behavior rating scale. Higher scores are worse on all of the ABC subscales. Normed for individuals with significant developmental disabilities requiring special education, so does not capture mild issues in the general population.}\\[0.4in] \hline && \\[-.1in] $\!\!$ABC\_Lethargy\_raw$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{ABC Lethargy/Social Withdrawal scale. } & \parbox{.45\textwidth}{Items reflect underactivity or listlessness, social withdrawal (seeking isolation, unresponsiveness to social interactions, etc.).}\\[0.2in] \hline && \\[-.1in] $\!\!$ABC\_Stereotype\_raw$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{ABC Stereotype scale.} & \parbox{.45\textwidth}{Stereotype scale measures compulsions and repetitive stereotyped behaviors. }\\[0.2in] \hline && \\[-.1in] $\!\!$ABC\_Hyperactivity\_raw$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{ABC Hyperactivity scale} & \parbox{.45\textwidth}{Includes ADHD symptoms (inattention, distractibility, impulsivity, hyperactivity) and also noncompliance/oppositional behavior.}\\[0.2in] \hline && \\[-.1in] $\!\!$ABC\_Inappropriate\_Speech\_raw$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{ABC Inappropriate Speech scale} & \parbox{.45\textwidth}{Only 4 items, which capture the following aspects of speech: excessive, repetitive (2 items), self-directed and loud. }\\[0.2in] \hline && \\[-.1in] $\!\!$COM\_RSI\_Total$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{Autism Diagnostic Observation Schedule (ADOS), Communication + Reciprocal Social Interaction score} & \parbox{.45\textwidth}{The Communication + Reciprocal Social Interaction total score is used to determine ADOS-2 classification (autism, autism spectrum, or non-spectrum) based on cutoff scores. This score corresponds with the DSM-5 Social Communication criteria (and does not include the restricted and repetitive behavior aspect).}\\[0.5in] \hline && \\[-.1in] $\!\!$SBRI\_Total$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{Autism Diagnostic Observation Schedule (ADOS), Stereotyped Behaviors and Restricted Interests score} & \parbox{.45\textwidth}{This score includes unusual sensory interests/behaviors, stereotyped mannerisms, circumscribed or unusual interests, and compulsions/rituals. The SBRI score is not used in the ADOS-2 diagnostic algorithm but informs determination of whether DSM-5 restricted interests/activities and repetitive behavior criteria are met. Note: Sometimes these behaviors are not exhibited during testing yet are prominent at home and in the community - only observed behaviors can be scored. So, it may underestimate RRB. }\\[0.7in] \hline && \\[-.1in] $\!\!$Beery\_standard$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{Beery-Buktenica Developmental Test of Visual-Motor Integration (Beery VMI)} & \parbox{.45\textwidth}{Assesses the extent to which individuals can integrate their visual and motor abilities (degree to which visual perception and finger-hand movements are well coordinated). Important role in the development of handwriting and other skills. }\\[0.4in] \hline && \\[-.1in] $\!\!$ Inhibit\_T$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{BRIEF Inhibition} & \parbox{.45\textwidth}{Ability to inhibit impulsive responses (resist impulses, stop one's own behavior at the appropriate time).}\\[0.2in] \hline && \\[-.1in] $\!\!$Shift\_T$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{BRIEF Task Shift} & \parbox{.45\textwidth}{Ability to adjust to changes in routine or task demands. Key aspects of shifting include the ability to make transitions, tolerate change, problem-solve flexibly, switch or alternate attention, and change focus from one mindset or topic to another.}\\[0.4in] \hline && \\[-.1in] $\!\!$Emotional\_Control\_T$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{BRIEF Emotional Control} & \parbox{.45\textwidth}{Measures the impact of executive function problems on emotional expression and assesses a child's ability to modulate or control his or her emotional responses.}\\[0.3in] \hline && \\[-.1in] $\!\!$Self\_Monitor\_T$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{BRIEF Self-monitoring} & \parbox{.45\textwidth}{Self-monitoring or interpersonal awareness (whether a child keeps track of the effect that his or her behavior has on others). }\\[0.2in] \hline && \\[-.1in] $\!\!$Initiate\_T$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{BRIEF Task Initiation} & \parbox{.45\textwidth}{Ability to begin a task or activity and to independently generate ideas, responses, or problem-solving strategies. }\\[0.2in] \hline && \\[-.1in] $\!\!$Working\_Memory\_T$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{BRIEF Working Memory} & \parbox{.45\textwidth}{Ability to hold information in mind for the purpose of completing a task, encoding information, or generating goals, plans, and sequential steps to achieving goals.}\\[0.3in] \hline && \\[-.1in] $\!\!$Plan\_Organize\_T$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{BRIEF Task Organization} & \parbox{.45\textwidth}{Ability to manage current and future-oriented task demands (plan and organize problem solving approaches).}\\[0.2in] \hline && \\[-.1in] $\!\!$Task\_Monitor\_T$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{BRIEF Task Monitoring} & \parbox{.45\textwidth}{Task-oriented monitoring or work-checking habits (whether a child assesses his or her own performance during or shortly after finishing a task to ensure accuracy or appropriate attainment of a goal).}\\[0.3in] \hline && \\[-.1in] $\!\!$Org\_of\_Materials\_T$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{BRIEF Organization of Materials} & \parbox{.45\textwidth}{Ability to organize environment and materials - orderliness of work, play, and storage spaces (e.g., desks, lockers, backpacks, and bedrooms).}\\[0.2in] \hline && \\[-.1in] $\!\!$BRI\_T$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{BRIEF Behavioral Regulation Index (BRI)} & \parbox{.45\textwidth}{Summary capturing ability to shift cognitive set and modulate emotions and behavior via appropriate inhibitory control. Includes Inhibit, Shift, and Emotional Control subscales. }\\[0.3in] \hline && \\[-.1in] $\!\!$MI\_T$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{BRIEF Metacognition Index (MI)} & \parbox{.45\textwidth}{Summary capturing ability to initiate, plan, organize, self-monitor, and sustain working memory - relates directly to a child's ability to actively problem solve in a variety of contexts. Includes Initiate, Working Memory, Plan/Organize, Organization of Materials, and Monitor subscales. }\\[0.4in] \hline && \\[-.1in] $\!\!$GEC\_T$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{BRIEF Global Executive Composite (GEC)} & \parbox{.45\textwidth}{Overall index of executive function; incorporates all of the BRIEF clinical scales. }\\[0.2in] \hline && \\[-.1in] $\!\!$Cars\_Total$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{Childhood Autism Rating Scales (CARS2-ST and CARS2-HF)} & \parbox{.45\textwidth}{Structured interview and observation tool. Scores are raw scores (T-scores and percentiles among population of individuals with ASD are available). A measure of overall severity of ASD-related symptoms based on 15 items. Ratings are based not only on frequency of the behavior in question, but also on its intensity, atypicality, and duration.}\\[0.5in] \hline && \\[-.1in] $\!\!$Tsc\_lc$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{Oral and Written Language Scales (OWLS-II), Listening Comprehension (LC) subtest} & \parbox{.45\textwidth}{Measures oral language reception, or understanding of spoken language. Examiner orally presents increasingly difficult words, phrases, and sentences; patient responds by pointing to or stating which of four picture choices is correct. }\\[0.4in] \hline && \\[-.1in] $\!\!$Tsc\_oe$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{Oral and Written Language Scales (OWLS-II), Oral Expression (OE) subtest} & \parbox{.45\textwidth}{Measures oral language expression, or use of spoken language. Examiner presents a verbal prompt along with a picture and patient must respond orally to the prompt with increasingly difficult language.}\\[0.3in] \hline && \\[-.1in] $\!\!$CompTsc\_ol$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{Oral and Written Language Scales (OWLS-II), Oral Language Composite} & \parbox{.45\textwidth}{Represents an overall level of oral language functioning. Derived from the Listening Comprehension and Oral Expression scales. }\\[0.2in] \hline && \\[-.1in] $\!\!$scq\_raw\_total$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{Social Communication Questionnaire (Lifetime Version)} & \parbox{.45\textwidth}{40-item yes/no questionnaire; many items focus on the presence of symptoms during the period between the individual's 4th and 5th birthdays. Scores are raw scores (no standardized scores available). Designed to assess for qualitative impairments in reciprocal social interaction and communication, as well as restricted, repetitive, and stereotyped behavior}\\[0.5in] \hline && \\[-.1in] $\!\!$T\_RRB$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{Social Responsiveness Scale (SRS) Restricted Interests and Repetitive Behavior T-score} & \parbox{.45\textwidth}{Items assess restricted range of interests and activities, inflexibility, unusual sensory interests, perseveration on topics, atypicality (bizarre behavior, being regarded as odd by peers) as well as motor stereotypy. }\\[0.3in] \hline && \\[-.1in] $\!\!$T\_Score$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{Social Responsiveness Scale (SRS) Total T-score} & \parbox{.45\textwidth}{Reflects the sum of responses to all 65 SRS questions (including the SCI and RRB subscales). Serves as an index of reciprocal social behavior across typical development, ASD, and other disorders. A good single number rating of severity of ASD symptoms. }\\[0.4in] \hline && \\[-.1in] $\!\!$T\_SCI$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{Social Responsiveness Scale (SRS) Social Communication and Interaction (SCI) T-score} & \parbox{.45\textwidth}{Reflects 4 subscales: Social Awareness, Social Cognition, Social Communication, Social Motivation}\\[0.2in] \hline && \\[-.1in] $\!\!$wasi\_iq\_composite$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{Wechsler Abbreviated Scale of Intelligence (WASI-II)} & \parbox{.45\textwidth}{IQ composite score based on Vocabulary, Similarities, Block Design, Matrix Reasoning subtests. }\\[0.2in] \hline && \\[-.1in] $\!\!$WJ\_Basic\_Read\_Skills\_z\_Score$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{Woodcock-Johnson Test of Achievement, Basic Reading cluster.} & \parbox{.45\textwidth}{Measures sight vocabulary and the ability to apply phonic and structural analysis skills. Combination of Letter-Word Identification and Word Attack. }\\[0.3in] \hline && \\[-.1in] $\!\!$WJ\_Pass\_Comprehen\_z\_Score$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{Woodcock-Johnson Test of Achievement, } & \parbox{.45\textwidth}{Reading comprehension. Measures understanding of written text. The majority of items require a student to supply a missing word to sentences and then paragraphs of increasing complexity.}\\[0.3in] \hline && \\[-.1in] $\!\!$WJ\_Word\_Attack\_z\_Score$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{Woodcock-Johnson Test of Achievement, Word Attack subtest} & \parbox{.45\textwidth}{Measures ability to apply phonic/decoding skills to unfamiliar words. The majority of items require students to pronounce nonsense words of increasing complexity. }\\[0.3in] \hline && \\[-.1in] $\!\!$wraml\_Verbal\_Memory\_Index\_Sum$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{Wide Range Assessment of Memory and Learning (WRAML-2)} & \parbox{.45\textwidth}{Measures ability to learn and recall both meaningful verbal information and relatively rote verbal information. Derived from the sum of the Story Memory and Verbal Learning subtests.}\\[0.3in] \hline && \\[-.1in] $\!\!$wrat\_spelling\_standard$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{Wide Range Achievement Test (WRAT4), Spelling subtest} & \parbox{.45\textwidth}{Measures ability to identify sounds and transfer them into written form from dictated words. Standard spelling test - word is stated, used in a sentence, and repeated and patient writes it.}\\[0.3in] \hline && \\[-.1in] $\!\!$wrat\_math\_standard$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{Wide Range Achievement Test (WRAT4), Math Computation subtest} & \parbox{.45\textwidth}{Measures ability to count, identify numbers, solve simple oral math problems, and calculate written math problems. Problems are presented in a range of domains, including arithmetic, algebra, geometry, and advanced operations. }\\[0.4in] \hline && \\[-.1in] $\!\!$ach\_abc\_AnxDep$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{Achenbach Assessment of Empirically Based Assessment (ASEBA) - Adult Behavior Checklist (ABCL) or Adult Self-Report (ASR) - Anxious/Depressed scale } & \parbox{.45\textwidth}{Measures behaviors such as nervousness, worrying, fearfulness, loneliness, sadness, feeling worthless, feeling too guilty, feeling persecuted, lacking self-confidence.}\\[0.3in] \hline && \\[-.1in] $\!\!$ach\_abc\_Withdrawn$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{ASEBA - Adult Behavior Checklist (ABCL) or Adult Self-Report (ASR) - Withdrawn scale} & \parbox{.45\textwidth}{Measures behaviors such as poor relationships, not getting along with others, preferring to be alone, anhedonia, being secretive. }\\[0.2in] \hline && \\[-.1in] $\!\!$ach\_abc\_Somatic$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{ASEBA - Adult Behavior Checklist (ABCL) or Adult Self-Report (ASR) - Somatic Complaints scale} & \parbox{.45\textwidth}{Measures complaints of discomfort or illness. }\\[0.1in] \hline && \\[-.1in] $\!\!$ach\_abc\_Thought$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{ASEBA - Adult Behavior Checklist (ABCL) or Adult Self-Report (ASR) - Thought Problems scale} & \parbox{.45\textwidth}{Measures symptoms such as hallucinations, obsessions, compulsions, strange thoughts and behaviors, self-harm, and suicide attempts.}\\[0.2in] \hline && \\[-.1in] $\!\!$ach\_abc\_Attention$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{ASEBA - Adult Behavior Checklist (ABCL) or Adult Self-Report (ASR) - Attention Problems scale} & \parbox{.45\textwidth}{Measures attention problems, forgetfulness, daydreaming, failing to finish things, avoiding work, disorganization, lateness, difficulty planning and prioritizing. }\\[0.3in] \hline && \\[-.1in] $\!\!$ach\_abc\_Agressive$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{ASEBA - Adult Behavior Checklist (ABCL) or Adult Self-Report (ASR) - Aggressive Behavior scale} & \parbox{.45\textwidth}{Measures behaviors such as meanness, arguing, threatening, blaming others, fighting, temper outbursts, screaming, sulking.}\\[0.2in] \hline && \\[-.1in] $\!\!$ach\_abc\_RuleBreak$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{ASEBA - Adult Behavior Checklist (ABCL) or Adult Self-Report (ASR) - Rule-Breaking Behavior scale} & \parbox{.45\textwidth}{Measures behaviors such as irresponsibility, substance abuse, lacking feelings of guilt, lying or cheating, stealing, difficulty keeping a job. }\\[0.2in] \hline && \\[-.1in] $\!\!$ach\_abc\_Intrusive$\!\!\!\!\!\!$ & \parbox{.275\textwidth}{ASEBA - Adult Behavior Checklist (ABCL) or Adult Self-Report (ASR) - Intrusive scale} & \parbox{.45\textwidth}{Measures behaviors such as bragging, showing off, attention-seeking, being boisterous, teasing.}\\[0.2in] \hline \end{longtable} } \renewcommand{\arraystretch}{.7} \vspace{.0in}\section{Marginalized Likelihood} \vspace{.0in} \label{sec:like_deriv} The derivation of Result~3 in the main paper is provided below. Let the component parameters be denoted as $\theta = \{\mbox{\boldmath $\mu$}_{11}, \dots, \mbox{\boldmath $\mu$}_{M1}, \mbox{\boldmath $\Sigma$}_{111}, \dots, \mbox{\boldmath $\Sigma$}_{M11}, \mbox{\boldmath $b$}_2, \mbox{\boldmath $Q$}_{21}, \mbox{\boldmath $Q$}_{22} \} $. We wish to obtain a closed form result for, \vspace{-.15in}\begin{displaymath} f(\mbox{\boldmath $Z$} \mid \mbox{\boldmath $\gamma$}, \mbox{\boldmath $\phi$}) = \int f(\mbox{\boldmath $Z$} \mid \mbox{\boldmath $\gamma$}, \mbox{\boldmath $\phi$}, \theta) f(\theta \mid \mbox{\boldmath $\gamma$}) d\theta. \vspace{-.05in}\end{displaymath} However, after a little bit of algebra we have, \vspace{-.15in}\begin{eqnarray} f(\mbox{\boldmath $Z$} \mid \mbox{\boldmath $\gamma$}, \mbox{\boldmath $\phi$}, \theta) &=& \prod_{m=1}^M \prod_{\{i:\phi_i=m\}} \frac{1}{(2\pi)^{p/2}} \left| \mbox{\boldmath $\Sigma$}_m \right|^{-1/2} \exp\left\{ -\frac{1}{2} (\mbox{\boldmath $z$}_i - \mbox{\boldmath $\mu$}_m)' \mbox{\boldmath $\Sigma$}_m^{-1}(\mbox{\boldmath $z$}_i - \mbox{\boldmath $\mu$}_m) \right\} \nonumber \\ &=& \left[ \prod_{m=1}^M A_m \right] B, \nonumber \\[-.38in] \nonumber \end{eqnarray} where $M=\max_i \{\phi_i\}$, and \vspace{-.1in}\begin{displaymath} \small A_m = (2\pi)^{-\frac{n_mp_1}{2}} \left| \mbox{\boldmath $\Sigma$}_{m11} \right|^{-\frac{n_m}{2}} \exp\left\{ \!-\frac{1}{2} \sum_{i:\phi_i=m}(\mbox{\boldmath $z$}^{(1)}_{i} \!-\! \mbox{\boldmath $\mu$}_{m1})' \mbox{\boldmath $\Sigma$}_{m11}^{-1}(\mbox{\boldmath $z$}^{(1)}_{i} \!-\! \mbox{\boldmath $\mu$}_{m1}) \right\} \mbox{, and}\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\; \end{displaymath} \vspace{-.2in}\begin{displaymath} \small \!B = (2\pi)^{-\frac{np_2}{2}} \!\left| \mbox{\boldmath $Q$}_{22} \right|^{\frac{n}{2}} \!\exp\!\left\{ \! -\frac{1}{2} \sum_{i=1}^n\!\left[ {\mbox{\boldmath $z$}^{(2)}_{i}}'\mbox{\boldmath $Q$}_{22}\mbox{\boldmath $z$}^{(2)}_{i} \!-\! 2{\mbox{\boldmath $z$}^{(2)}_{i}}'(\mbox{\boldmath $b$}_2 \!-\! \mbox{\boldmath $Q$}_{21}\mbox{\boldmath $z$}^{(1)}_{i}) \!+\! (\mbox{\boldmath $b$}_2 - \mbox{\boldmath $Q$}_{21}\mbox{\boldmath $z$}^{(1)}_{i})'\mbox{\boldmath $Q$}_{22} (\mbox{\boldmath $b$}_2 \!-\! \mbox{\boldmath $Q$}_{21}\mbox{\boldmath $z$}^{(1)}_{i})\right] \!\right\}\!. \nonumber \end{displaymath} Combining this with the prior independence of $(\mbox{\boldmath $\mu$}_{m1}, \mbox{\boldmath $\Sigma$}_{m11})$, $m=1,\dots...$ and $(\mbox{\boldmath $b$}_{2}, \mbox{\boldmath $Q$}_{21}, \mbox{\boldmath $Q$}_{22})$ we have, \vspace{-.1in}\begin{displaymath} \int f(\mbox{\boldmath $Z$} \mid \mbox{\boldmath $\gamma$}, \mbox{\boldmath $\phi$}, \theta) f(\theta \mid \mbox{\boldmath $\gamma$}) d\theta\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\; \end{displaymath} \vspace{-.35in}\begin{equation} \;\;\;\;\;\;\;\;= \left[\prod_{m=1}^M \int A_m f(\mbox{\boldmath $\mu$}_{m1}, \mbox{\boldmath $\Sigma$}_{m11}) d(\mbox{\boldmath $\mu$}_{m1}, \mbox{\boldmath $\Sigma$}_{m11}) \right]\! \int \!B f(\mbox{\boldmath $b$}_{2}, \mbox{\boldmath $Q$}_{21}, \mbox{\boldmath $Q$}_{22}) d(\mbox{\boldmath $b$}_{2}, \mbox{\boldmath $Q$}_{21}, \mbox{\boldmath $Q$}_{22}).\! \label{eq:marg_like_1} \vspace{.0in}\end{equation} Now \begin{displaymath} f(\mbox{\boldmath $\mu$}_{m1}, \mbox{\boldmath $\Sigma$}_{m11}) = f(\mbox{\boldmath $\mu$}_{m1} \mid \mbox{\boldmath $\Sigma$}_{m11}) f(\mbox{\boldmath $\Sigma$}_{m11}), \end{displaymath} with \vspace{-.2in}\begin{eqnarray} f(\mbox{\boldmath $\mu$}_{m1} \mid \mbox{\boldmath $\Sigma$}_{m11}) &\!=\! & (2\pi)^{-\frac{p_1}{2}} \left| \frac{1}{\lambda}\mbox{\boldmath $\Sigma$}_{m11} \right|^{-\frac{1}{2}} \exp \left\{ -\frac{\lambda}{2} \mbox{\boldmath $\mu$}_{m1}'\mbox{\boldmath $\Sigma$}_{m11}^{-1}\mbox{\boldmath $\mu$}_{m1}\right\} \nonumber \\ f(\mbox{\boldmath $\Sigma$}_{m11}) &\!=\! & \frac{\left| \mbox{\boldmath $\Psi$}_{11} \right|^{-\frac{\eta-p_2}{2}} \left| \mbox{\boldmath $\Sigma$}_{m11} \right|^{-\frac{\eta-p_2+p_1+1}{2}} } {2^\frac{(\eta-p_2)p_1}{2} \Gamma_{p_1}(\frac{\eta-p_2}{2})} \exp \left\{ -\frac{1}{2} \mbox{tr}\left(\mbox{\boldmath $\Psi$}_{11} \mbox{\boldmath $\Sigma$}_{m11}^{-1}\right) \right\}. \nonumber \end{eqnarray} After some tedious algebra, \vspace{-.2in}\begin{displaymath} A_m f(\mbox{\boldmath $\mu$}_{m1}, \mbox{\boldmath $\Sigma$}_{m11}) = A_m^{(1)} A_m^{(2)} A_m^{(3)}, \vspace{-.3in}\end{displaymath} with \vspace{-.15in}\begin{eqnarray} A_m^{(1)} &\!\! = \!\!& (2\pi)^{-\frac{n_mp_1}{2}} \left( \frac{\lambda}{n_m+\lambda}\right)^{\frac{p_1}{2}} \frac{\left| \mbox{\boldmath $\Psi$}_{11} \right|^{\frac{\eta-p_2}{2}} \Gamma_{p_1}(\frac{n_m+\eta-p_2}{2})} {\left| \mbox{\boldmath $V$}_{m11} \right|^{\frac{n_m+\eta-p_2}{2}} \Gamma_{p_1}(\frac{\eta-p_2}{2})}, \nonumber \\ A_m^{(2)} & \!\!= \!\!& (2\pi)^{-\frac{p_1}{2}} \!\left| \frac{1}{n_m\!+\!\lambda}\mbox{\boldmath $\Sigma$}_{m11} \right|^{-\frac{1}{2}}\!\! \exp \left\{-\frac{n_m\!+\!\lambda}{2} \left(\mbox{\boldmath $\mu$}_{m1}\!-\!\frac{n_m}{n_m\!+\!\lambda}\bar{\mbox{\boldmath $z$}}_{m1} \right)' \!\!\mbox{\boldmath $\Sigma$}_{m11}^{-1}\!\!\left(\mbox{\boldmath $\mu$}_{m1}\!-\!\frac{n_m}{n_m\!+\!\lambda}\bar{\mbox{\boldmath $z$}}_{m1} \right) \right\}\nonumber \\ A_m^{(3)} & \!\!= \!\!& \frac{\left| \mbox{\boldmath $V$}_{m11} \right|^{\frac{n_m+\eta-p_2}{2}} \left| \mbox{\boldmath $\Sigma$}_{m11} \right|^{-\frac{n_m+\eta-p_2+p_1+1}{2}}} {2^{\frac{(n_m+\eta-p_2)p_1}{2}} \Gamma_{p_1}(\frac{n_m+\eta-p_2}{2})} \exp\left\{ -\frac{1}{2} \mbox{tr}\left( \mbox{\boldmath $V$}_{m11} \mbox{\boldmath $\Sigma$}_{m11}^{-1}\right) \right\}, \nonumber \nonumber \end{eqnarray} where $\mbox{\boldmath $V$}_{m11}$ and $\bar{\mbox{\boldmath $z$}}_{m1}$ are as defined in Result~3 of the main paper. As a function of $\mbox{\boldmath $\mu$}_{m1}$, we recognize $A_m^{(2)}$ to be the multivariate normal density with mean $\frac{n_m}{n_m\!+\!\lambda}\bar{\mbox{\boldmath $z$}}_{m1}$ and covariance $\frac{1}{n_m+\lambda}\mbox{\boldmath $\Sigma$}_{m11}$. Also, as a function of $\mbox{\boldmath $\Sigma$}_{m11}$ we recognize $A_m^{(3)}$ to be the density of an inverse-Wishart distribution with parameters $\eta^* = n_m+\eta-p_2$ and $\mbox{\boldmath $\Psi$}^* = \mbox{\boldmath $V$}_{m11}$. Thus, \begin{equation} \mbox{\white .}\!\!\!\!\!\!\!\!\!\!\!\!\int \!\!A_m f(\mbox{\boldmath $\mu$}_{m1}, \mbox{\boldmath $\Sigma$}_{m11}) d(\mbox{\boldmath $\mu$}_{m1}, \mbox{\boldmath $\Sigma$}_{m11}) = (\;\!\!2\pi\;\!\!)^{-\frac{n_m p_1}{2}} \left( \!\frac{\lambda}{n_m\!+\!\lambda}\!\right)^{\!\!\!\frac{p_1}{2}}\!\! \frac{\left| \mbox{\boldmath $\Psi$}_{11} \right|^{\frac{\eta-p_2}{2}} \Gamma_{\!p_1\!}(\frac{n_m\!+\eta-p_2}{2})} {\!\left| \mbox{\boldmath $V$}_{\!m11} \right|^{\frac{n_m+\eta-p_2}{2}} \Gamma_{\!p_1\!}(\frac{\eta-p_2}{2})}. \label{eq:marg_like_2}\!\! \end{equation} Now the prior distribution corresponding to the second term in (\ref{eq:marg_like_1}) is \vspace{-.1in}\begin{displaymath} f(\mbox{\boldmath $b$}_{2}, \mbox{\boldmath $Q$}_{21}, \mbox{\boldmath $Q$}_{22}) = f(\mbox{\boldmath $b$}_{2} \mid \mbox{\boldmath $Q$}_{22})f(\mbox{\boldmath $Q$}_{21} \mid \mbox{\boldmath $Q$}_{22})f(\mbox{\boldmath $Q$}_{22}), \vspace{-.15in}\end{displaymath} where {\small \vspace{-.1in} \begin{eqnarray} f(\mbox{\boldmath $b$}_{2} \mid \mbox{\boldmath $Q$}_{22}) &\!\!\!\!=\!\!\!\!& (2\pi)^{-\frac{p_2}{2}} \left| \frac{1}{\lambda}\mbox{\boldmath $Q$}_{22} \right|^{-\frac{1}{2}} \exp \left\{ -\frac{\lambda}{2} \mbox{\boldmath $b$}_2'\mbox{\boldmath $Q$}_{2}^{-1}\mbox{\boldmath $b$}_{2}\right\} \nonumber \\ \mbox{\white{.}}\!\!\!\!\!\!\!f(\mbox{\boldmath $Q$}_{21} \!\mid\! \mbox{\boldmath $Q$}_{22}) &\!\!\!\!=\!\!\!\!& (2\pi)^{-\frac{p_1p_2}{2}} \!\left| \mbox{\boldmath $\Psi$}_{\!11} \right|^{\frac{p_2}{2}} \!\left| \mbox{\boldmath $Q$}_{22} \right|^{-\frac{p_1}{2}}\! \exp \!\left\{ \!-\frac{1}{2} \mbox{tr}\!\left[ \mbox{\boldmath $\Psi$}_{\!11} \!\left( \mbox{\boldmath $Q$}_{21} \!+\! \mbox{\boldmath $Q$}_{22}\mbox{\boldmath $\Psi$}_{\!21} \mbox{\boldmath $\Psi$}_{11}^{-1} \right)'\!\! \mbox{\boldmath $Q$}_{22}^{-1}\!\! \left( \mbox{\boldmath $Q$}_{21} \!+\! \mbox{\boldmath $Q$}_{22}\mbox{\boldmath $\Psi$}_{21} \mbox{\boldmath $\Psi$}_{11}^{-1} \right) \right]\!\right\} \nonumber \\ f(\mbox{\boldmath $Q$}_{22}) &\!\!\!\!=\!\!\!\!& \frac{\left| \mbox{\boldmath $\Psi$}_{22 \mid 1} \right|^{\frac{\eta}{2}} \left| \mbox{\boldmath $Q$}_{22} \right|^{\frac{\eta+p_2+1}{2}} } {2^\frac{\eta p_2}{2} \Gamma_{p_2}(\frac{\eta}{2})} \exp \left\{ -\frac{1}{2} \mbox{tr}\left(\mbox{\boldmath $\Psi$}_{22 \mid 1} \mbox{\boldmath $Q$}_{22}\right) \right\}, \nonumber \\[-.37in] \nonumber \end{eqnarray} } where $\mbox{\boldmath $\Psi$}_{22 \mid 1} = \mbox{\boldmath $\Psi$}_{22} - \mbox{\boldmath $\Psi$}_{21}\mbox{\boldmath $\Psi$}_{11}\mbox{\boldmath $\Psi$}_{12}$. After some more tedious algebra, \vspace{-.1in}\begin{displaymath} B f(\mbox{\boldmath $b$}_{2}, \mbox{\boldmath $Q$}_{21}, \mbox{\boldmath $Q$}_{22}) = B^{(1)} B^{(2)} B^{(3)} B^{(4)}, \end{displaymath} with \begin{eqnarray} B^{(1)} &\!\!\! \!\!=\!\!\!\!& (2\pi)^{-\frac{np_2}{2}} \left( \frac{\lambda}{n+\lambda}\right)^{\frac{p_2}{2}} \frac{\left| \mbox{\boldmath $\Psi$}_{11} \right|^{\frac{\eta-p_2}{2}} \left| \mbox{\boldmath $\Psi$}_{22 \mid 1} \right|^{\frac{\eta}{2}} \Gamma_{p_2}(\frac{n+\eta}{2})} {\left| \mbox{\boldmath $V$}_{\!11} \right|^{\frac{p_2}{2}} \left| \mbox{\boldmath $V$}_{\!22 \mid 1} \right|^{\frac{n+\eta}{2}} \Gamma_{p_2}(\frac{\eta}{2})}, \nonumber \\ B^{(2)} & \!\!\!\!\!=\!\! \!\!& (2\pi)^{-\frac{p_2}{2}} \!\left| \frac{1}{n\!+\!\lambda}\mbox{\boldmath $Q$}_{22} \right|^{-\frac{1}{2}}\!\! \exp \left\{-\frac{1}{2} \left[\mbox{\boldmath $b$}_{2}'\mbox{\boldmath $Q$}_{22}^*\mbox{\boldmath $b$}_2 - 2\mbox{\boldmath $b$}_2'\mbox{\boldmath $b$}^* + {\mbox{\boldmath $b$}^*}'{\mbox{\boldmath $Q$}^*}^{-1}\mbox{\boldmath $b$}^* \right] \right\} \nonumber \\ B^{(3)} & \!\!\!\!=\! \!\!& (2\pi)^{-\frac{p_1p_2}{2}}\! \left| \mbox{\boldmath $V$}_{\!\!11} \right|^{-\frac{p_2}{2}} \!\left| \mbox{\boldmath $Q$}_{22} \right|^{-\frac{p_1}{2}} \!\exp \!\left\{ \!-\frac{1}{2} \mbox{tr}\!\left[ \mbox{\boldmath $V$}_{\!\!11} \!\left( \mbox{\boldmath $Q$}_{21} \!\!+\! \mbox{\boldmath $Q$}_{22}\mbox{\boldmath $V$}_{\!\!21} \mbox{\boldmath $V$}_{\!11}^{-1} \right)' \!\!\mbox{\boldmath $Q$}_{22}^{-1} \!\!\left( \mbox{\boldmath $Q$}_{21} \!\!+\! \mbox{\boldmath $Q$}_{22}\mbox{\boldmath $V$}_{\!\!21} \mbox{\boldmath $V$}_{\!11}^{-1} \right)\right]\!\right\} \nonumber \\ B^{(4)} & \!\!\!\!\!=\!\! \!\!& \frac{\left| \mbox{\boldmath $V$}_{\!\!22 \mid 1} \right|^{-\frac{n+\eta}{2}} \left| \mbox{\boldmath $Q$}_{22} \right|^{-\frac{n+\eta+p_2+1}{2}}} {2^{\frac{(n+\eta)p_2}{2}} \Gamma_{p_2}(\frac{n+\eta}{2})} \exp\left\{ -\frac{1}{2} \mbox{tr}\left( \mbox{\boldmath $V$}_{\!\!22\mid 1} \mbox{\boldmath $Q$}_{22}\right) \right\}, \nonumber \end{eqnarray} where $\mbox{\boldmath $b$}^* = n(\bar{\mbox{\boldmath $y$}}_2 + \mbox{\boldmath $Q$}_{22}^{-1} \mbox{\boldmath $Q$}_{21} \bar{y}_1)$ and $\mbox{\boldmath $Q$}^* =(n\!+\!\lambda)\mbox{\boldmath $Q$}_{22}^{-1}$, and $\mbox{\boldmath $V$}_{11}$, $\mbox{\boldmath $V$}_{22 \mid 1}$ are as defined in Result~3 of the main paper. As a function of $\mbox{\boldmath $b$}_2$, we recognize $B^{(2)}$ to be the multivariate normal density in canonical form with precision $\mbox{\boldmath $Q$}^*$ and mean ${\mbox{\boldmath $Q$}^*}^{-1}\mbox{\boldmath $b$}^*$. Also, as a function of $\mbox{\boldmath $Q$}_{21}$ we recognize $B^{(3)}$ to be the density of a ${\cal M}{\cal N}(\mbox{\boldmath $M$}^*, \mbox{\boldmath $U$}^*, \mbox{\boldmath $V$}^*)$ with parameters $\mbox{\boldmath $M$}^* = -\mbox{\boldmath $Q$}_{22}\mbox{\boldmath $V$}_{\!\!21} \mbox{\boldmath $V$}_{\!11}^{-1}$, $\mbox{\boldmath $U$}^*=\mbox{\boldmath $Q$}_{22}$, and $\mbox{\boldmath $V$}^* = \mbox{\boldmath $V$}_{\!\!11}^{-1}$. Finally, we can recognize $B^{(4)}$ to be the density of $\mbox{\boldmath $Q$}_{22}$: a Wishart distribution with parameters $\eta^* = n+\eta$ and $\mbox{\boldmath $\Psi$}^* = \mbox{\boldmath $V$}_{\!22 \mid 1}$. Thus, \begin{equation} \!\!\!\int \!B f(\mbox{\boldmath $b$}_{2}, \mbox{\boldmath $Q$}_{21}, \mbox{\boldmath $Q$}_{22}) d(\mbox{\boldmath $b$}_{2}, \mbox{\boldmath $Q$}_{21}, \mbox{\boldmath $Q$}_{22})= (2\pi)^{-\frac{np_2}{2}}\! \left( \!\frac{\lambda}{n+\lambda}\!\right)^{\!\!\frac{p_2}{2}} \frac{\left| \mbox{\boldmath $\Psi$}_{\!11} \right|^{\!\!\frac{\eta-p_2}{2}} \!\left| \mbox{\boldmath $\Psi$}_{\!22 \mid 1} \right|^{\frac{\eta}{2}} \Gamma_{\!p_2}(\frac{n+\eta}{2})} {\left| \mbox{\boldmath $V$}_{\!11} \right|^{\frac{p_2}{2}} \left| \mbox{\boldmath $V$}_{\!22 \mid 1} \right|^{\frac{n+\eta}{2}} \Gamma_{\!p_2}(\frac{\eta}{2})}.\!\! \label{eq:marg_like_3} \end{equation} Combining (\ref{eq:marg_like_1}), (\ref{eq:marg_like_2}), and (\ref{eq:marg_like_3}) gives the desired result. \section{MCMC Algorithm} \vspace{-.0in} \label{sec:MCMC} This section describes the MCMC sampling scheme for the full model described in Section~\ref{sec:model_descr} of the main paper. Since the component parameters are integrated out, the entire collection of parameters to be sampled in the MCMC is \begin{equation} \Theta = \left\{ \mbox{\boldmath $\gamma$}, \mbox{\boldmath $\phi$}, \lambda, \eta, \mbox{\boldmath $\Psi$}, \alpha, \tilde{\mbox{\boldmath $Z$}} \right\}, \label{eq:param_set} \end{equation} where $\tilde{\mbox{\boldmath $Z$}}$ contains any latent element of $\mbox{\boldmath $Z$}$ (i.e., are either missing data, or correspond to a discrete variable or censored observation). The MCMC algorithm proceeds by performing Metropolis Hastings (MH) updates for each of the elements listed in $\Theta$ in a Gibbs fashion. The only update that depends on the raw observed data $\mbox{\boldmath $Y$}=[\mbox{\boldmath $y$}_1',\dots,\mbox{\boldmath $y$}_n']'$ is the update of $\tilde{\mbox{\boldmath $Z$}}$. All other parameters, conditional on $\mbox{\boldmath $Y$}$ and $\mbox{\boldmath $Z$}$, only depend on $\mbox{\boldmath $Z$}$. Therefore, $\mbox{\boldmath $Y$}$ does not appear in the notation of any of the updates below, except that for $\tilde{\mbox{\boldmath $Z$}}$. The $\mbox{\boldmath $\gamma$}$ vector is updated with add/delete/swap proposals. The $\tilde{\mbox{\boldmath $Z$}}$ and $\mbox{\boldmath $\Psi$}$ are high dimensional and thus some creativity is needed to ensure good proposals. To accomplish this we first sample some component parameters from their conjugate distribution given the other parameters (for a fixed $\gamma$ this is not difficult), and then use these component parameters to obtain good proposals for $\tilde{\mbox{\boldmath $Z$}}$ and $\mbox{\boldmath $\Psi$}$, respectively. As mentioned in the main paper the $\phi_i$ can be updated individually with simple Gibbs sampling. However, this approach has known mixing issues and, thus, a modified split-merge algorithm \citep{Jain04} will be described below. The remaining updates for $\lambda, \eta, \alpha$ are more straight-forward random walk MH updates.\\[-.1in] \noindent {\underline{MH update for $\mbox{\boldmath $\gamma$}$}} \noindent The $\mbox{\boldmath $\gamma$}$ vector is updated with MH by proposing an add, delete, or swap move. That is, the proposal $\mbox{\boldmath $\gamma$}^*$ is generated as follows. \begin{itemize} \item[(i)] Set the proposal $\mbox{\boldmath $\gamma$}^*=\mbox{\boldmath $\gamma$}$ \item[(ii)] Randomly choose an integer $j^*$ from $1,\dots,p$. \item[(iii)] Flip the value of $\gamma_{j^*}$, i.e., $\gamma_{j^*}^*=1-\gamma_{j^*}$. \item[(iv)] If the set $\{j:\gamma_j \neq \gamma_{j^*}\}$ is not empty, draw a Bernoulli $B^*$ with probability $\pi$. \item[(v)] If $B^*=1$ randomly choose another $j^{**}$ from the set $\{j:\gamma_j \neq \gamma_{j^*}\}$ and also set $\gamma^*_{j^{**}}=1-\gamma_{j^{**}}$, i.e., a swap proposal. If $B^*=0$, leave $\mbox{\boldmath $\gamma$}^*$ as a single variable add/delete proposal. \end{itemize} Let $d(\mbox{\boldmath $\gamma$}^* \mid \mbox{\boldmath $\gamma$})$ represent the density of this proposal. The MH ratio is then \begin{displaymath} MH = \frac{f(\mbox{\boldmath $Z$} \mid \mbox{\boldmath $\gamma$}^*, \mbox{\boldmath $\phi$}, \lambda, \eta, \mbox{\boldmath $\Psi$}, \alpha) f(\mbox{\boldmath $\gamma$}^*) d(\mbox{\boldmath $\gamma$} \mid \mbox{\boldmath $\gamma$}^*)} {f(\mbox{\boldmath $Z$} \mid \mbox{\boldmath $\gamma$}, \mbox{\boldmath $\phi$}, \lambda, \eta, \mbox{\boldmath $\Psi$}, \alpha) f(\mbox{\boldmath $\gamma$}) d(\mbox{\boldmath $\gamma$}^* \mid \mbox{\boldmath $\gamma$})}, \end{displaymath} where $f(\mbox{\boldmath $Z$} \mid \mbox{\boldmath $\gamma$}, \mbox{\boldmath $\phi$}, \lambda, \eta, \mbox{\boldmath $\Psi$}, \alpha)$ is the marginal likelihood provided in Result~3 and $f(\mbox{\boldmath $\gamma$})$ is the prior distribution for $\mbox{\boldmath $\gamma$}$, i.e., independent Bernoulli$(\rho)$. In the results of the main paper, $\rho$ was set to 0.5. \\[-.1in] \noindent {\underline{MH update for $\alpha$}} \noindent The update for $\alpha$ was conducted via a MH random walk proposal on log scale. Draw a proposal $\mbox{log}(\alpha^*) = \mbox{log}(\alpha)+\epsilon$ for a deviate $\epsilon {\sim} N(0,s^2)$. The tuning parameter was set to $s=1$ to achieve an acceptance rate $\approx$ 40\%, and resulted in good mixing. Let the density of the proposal, given the current value of $\alpha$ be denoted $d(\alpha^* \mid \alpha)$. The only portion of the posterior that differs between the current value and the proposal is in the term \begin{displaymath} f(\mbox{\boldmath $\phi$} \mid \alpha) = \prod_{i=2}^n \frac{n_{i,\phi_i} I_{\{n_{i,\phi_i} >0\}} + \alpha I_{\{n_{i,\phi_i} =0\}}}{i-1+\alpha} \propto \frac{\alpha^M \Gamma(\alpha)}{\Gamma(\alpha+n)}. \end{displaymath} The MH ratio is then \begin{displaymath} MH = \frac{f(\mbox{\boldmath $\phi$} \mid \alpha^*) f(\alpha^*) d(\alpha \mid \alpha^*)} {f(\mbox{\boldmath $\phi$} \mid \alpha) f(\alpha) d(\alpha^* \mid \alpha)}, \end{displaymath} where $d(\alpha)$ is the density for a Gamma$(A_\alpha, B_\alpha)$ random variable. \\[-.1in] \noindent {\underline{MH update for $\lambda$}} \noindent The update for $\lambda$ was conducted via a MH random walk proposal on log scale. Draw a proposal $\mbox{log}(\lambda^*) = \mbox{log}(\lambda)+\epsilon$ for a deviate $\epsilon {\sim} N(0,s^2)$. The tuning parameter was set to $s=0.5$ to achieve an acceptance rate $\approx$ 40\%. Let the density of the proposal, given the current value of $\lambda$ be denoted $d(\lambda^* \mid \lambda)$. The MH ratio is then \begin{displaymath} MH = \frac{f(\mbox{\boldmath $Z$} \mid \mbox{\boldmath $\gamma$}, \mbox{\boldmath $\phi$}, \lambda^*, \eta, \mbox{\boldmath $\Psi$}, \alpha) f(\lambda^*) d(\lambda \mid \lambda^*)} {f(\mbox{\boldmath $Z$} \mid \mbox{\boldmath $\gamma$}, \mbox{\boldmath $\phi$}, \lambda, \eta, \mbox{\boldmath $\Psi$}, \alpha) f(\lambda) d(\lambda^* \mid \lambda)}, \end{displaymath} where $f(\lambda)$ is the density for a Gamma$(A_\lambda, B_\lambda)$ random variable. \\[-.1in] \noindent {\underline{MH update for $\eta$}} \noindent The update for $\eta$ is entirely analogous to that for $\lambda$. A tuning parameter of $s=1$ was used for $\eta$ updates to encourage $\approx$ 40\% acceptance. \\[-.1in] \noindent {\underline{MH update for $\mbox{\boldmath $\Psi$}$}} \noindent The prior distribution is $\mbox{\boldmath $\Psi$} \sim {\cal W}(\mbox{\boldmath $P$},N)$. If the component parameters $\theta = \{\mbox{\boldmath $\mu$}_{11}, \dots, \mbox{\boldmath $\mu$}_{M1}$, $\mbox{\boldmath $\Sigma$}_{111}$, $\dots$, $\mbox{\boldmath $\Sigma$}_{M11}$, $\mbox{\boldmath $b$}_2$, $\mbox{\boldmath $Q$}_{21}$,$\mbox{\boldmath $Q$}_{22} \}$, were given then $\mbox{\boldmath $\Psi$}$ would have a conjugate update of the form, \begin{eqnarray} \mbox{\boldmath $\Psi$}_{22 \mid 1} \mid \theta &\sim& {\cal W}(\mbox{\boldmath $Q$}_{22}+\mbox{\boldmath $P$}_{22}, N+\eta), \nonumber \\ \mbox{\boldmath $\Psi$}_{11} \mid \theta &\sim& {\cal W}(\mbox{\boldmath $P$}^*,M\eta+N+p_2), \label{eq:Psi_conj} \\ \mbox{\boldmath $\Psi$}_{21} \mid \theta, \mbox{\boldmath $\Psi$}_{11} &\sim& {\cal M}{\cal N}(-(\mbox{\boldmath $P$}_{22}+\mbox{\boldmath $Q$}_{22})(\mbox{\boldmath $P$}_{21}+\mbox{\boldmath $Q$}_{21})\mbox{\boldmath $\Psi$}_{11}\;,\; (\mbox{\boldmath $P$}_{22}+\mbox{\boldmath $Q$}_{22})^{-1}, \mbox{\boldmath $\Psi$}_{11}), \nonumber \end{eqnarray} where \begin{displaymath} \!\mbox{\boldmath $P$}^* \!= \!\left[\mbox{\boldmath $P$}_{11}^{-1}\!\! +\! (\mbox{\boldmath $P$}_{\!21} \!+\! \mbox{\boldmath $Q$}_{\!21})'(\mbox{\boldmath $P$}_{\!22}\!+\!\mbox{\boldmath $Q$}_{\!22})^{-1}(\mbox{\boldmath $P$}_{\!21} \!+\! \mbox{\boldmath $Q$}_{\!21}) \!+\! \mbox{\boldmath $P$}_{\!21}'\mbox{\boldmath $P$}_{\!22}^{-1}\mbox{\boldmath $P$}_{\!21} \!+\! \mbox{\boldmath $Q$}_{\!21}'\mbox{\boldmath $Q$}_{\!22}^{-1}\mbox{\boldmath $Q$}_{\!21} \!+\! \sum_{m=1}^M \mbox{\boldmath $\Sigma$}_{m11}^{-1} \!\right]^{-1}\!\!, \end{displaymath} and $\mbox{\boldmath $\Psi$}_{22 \mid 1}$ is independent of $\mbox{\boldmath $\Psi$}_{11}, \mbox{\boldmath $\Psi$}_{21}$ given $\theta$. We do not sample $\theta$, so $\mbox{\boldmath $\Psi$}$ does not have such a conjugate update in the MCMC routine. However, we can generate a very good proposal $\Psi^*$ in the following manner. Conditional on the current values of $\mbox{\boldmath $\gamma$}, \mbox{\boldmath $\phi$}, \lambda, \eta, \alpha, \tilde{\mbox{\boldmath $Z$}}$, and $\mbox{\boldmath $\Psi$}$, one could draw component parameters $\theta = \{\mbox{\boldmath $\mu$}_{11}, \dots, \mbox{\boldmath $\mu$}_{M1}, \mbox{\boldmath $\Sigma$}_{111}, \dots, \mbox{\boldmath $\Sigma$}_{M11}, \mbox{\boldmath $b$}_2, \mbox{\boldmath $Q$}_{21}, \mbox{\boldmath $Q$}_{22} \}$, from their conjugate distribution provided in Section~\ref{sec:like_deriv}. Conditional on the value of $\theta$ we could then draw from the distribution of $\mbox{\boldmath $\Psi$} \mid \theta$ provided above. However, we do not want to have the current $\Psi$ value involved in the update as this complicates the proposal density calculation. A simple fix is to draw component parameters $\theta^*$ conditional on the current values of $\mbox{\boldmath $\gamma$}, \mbox{\boldmath $\phi$}, \lambda, \eta, \alpha, \tilde{\mbox{\boldmath $Z$}}$, but with $\mbox{\boldmath $\Psi$}$ fixed at some value $\tilde{\mbox{\boldmath $\Psi$}}$, independent of the current (or previous) values in the chain. This way, the proposal density for $\mbox{\boldmath $\Psi$}^*$ is selected at random from a set of possible proposal distributions. The proposal density $d(\mbox{\boldmath $\Psi$}^* \mid \mbox{\boldmath $\Psi$})=d(\mbox{\boldmath $\Psi$}^*)$ is then conditional on $\theta^*$ and is simply the product of the densities in (\ref{eq:Psi_conj}). This is allowable under the same principle used by \cite{Jain04} for the split-merge algorithm. Thus the MH ratio is then \begin{displaymath} MH = \frac{f(\mbox{\boldmath $Z$} \mid \mbox{\boldmath $\gamma$}, \mbox{\boldmath $\phi$}, \lambda, \eta, \mbox{\boldmath $\Psi$}^*, \alpha) f(\mbox{\boldmath $\Psi$}^*) d(\mbox{\boldmath $\Psi$})} {f(\mbox{\boldmath $Z$} \mid \mbox{\boldmath $\gamma$}, \mbox{\boldmath $\phi$}, \lambda, \eta, \mbox{\boldmath $\Psi$}, \alpha) f(\mbox{\boldmath $\Psi$}) d(\mbox{\boldmath $\Psi$}^*)}, \end{displaymath} where $f(\mbox{\boldmath $\Psi$})$ is the density for a ${\cal W}(P, N)$ random variable. Note that this update would be made much easier if $\theta$ were just sampled in the MCMC as well. However, this makes it very difficult to update $\mbox{\boldmath $\gamma$}$ since the dimension of $\theta$ will be changing with $\mbox{\boldmath $\gamma$}$. Reversible jump (RJ) MCMC could be used to overcome this issue by updating $\mbox{\boldmath $\gamma$}, \theta$ jointly, but this comes with its own challenges. For a given $\mbox{\boldmath $\gamma$}$ and $\mbox{\boldmath $\phi$}$, however, drawing a $\theta$ to determine the proposal distribution as above poses no issues. \\[-.1in] \noindent {\underline{MH update for $\tilde{\mbox{\boldmath $Z$}}$}} \noindent The same logic used in the update of $\mbox{\boldmath $\Psi$}$ is used here as well. Conditional on the component parameters $\theta$, the elements of $\tilde{\mbox{\boldmath $Z$}}$ have simple Gibbs updates. Namely, for a given observation $i$ with missing values, the update for the elements of $\mbox{\boldmath $z$}_i$ that correspond to missing data elements in $\mbox{\boldmath $y$}_i$ would be to draw from the normal distribution specified by $\phi_i$ and $\theta$, conditional on the observed variables in $\mbox{\boldmath $z$}_i$. If a value $y_{ij}$ is discrete or censored, then the update for $z_{ij}$ would be to draw from the normal distribution specified by $\phi_i$ and $\theta$, conditional on the other variables in $\mbox{\boldmath $z$}_i$ {\bf and the conditional limits imposed by $y_{ij}$}. Thus, a very similar trick as above is used. First divide $\tilde{\mbox{\boldmath $Z$}}$ up into $K$ partitions and denote them $\tilde{\mbox{\boldmath $Z$}}_1,\dots,\tilde{\mbox{\boldmath $Z$}}_K$. We draw a separate $\theta_k^*$ for each partition by conditioning on the current values of $\mbox{\boldmath $\gamma$}, \mbox{\boldmath $\phi$}, \lambda, \eta, \alpha, \mbox{\boldmath $\Psi$}$, and all $\tilde{\mbox{\boldmath $Z$}}$ values {\bf except} $\tilde{\mbox{\boldmath $Z$}}_k$. Update each of the elements of $\tilde{\mbox{\boldmath $Z$}}_k$ conditional on $\theta_k^*$ as described above to produce a proposal $\tilde{\mbox{\boldmath $Z$}}_k^*$. Denote the density of this proposal as $d(\tilde{\mbox{\boldmath $Z$}}_k^* \mid \tilde{\mbox{\boldmath $Z$}}_k)= d(\tilde{\mbox{\boldmath $Z$}}_k^*)$. The MH ratio is then, \begin{displaymath} MH = \frac{f(\mbox{\boldmath $Y$} \mid \mbox{\boldmath $Z$}^*) f(\mbox{\boldmath $Z$}^* \mid \mbox{\boldmath $\gamma$}, \mbox{\boldmath $\phi$}, \lambda, \eta, \mbox{\boldmath $\Psi$}, \alpha) d(\tilde{\mbox{\boldmath $Z$}}_k)} {f(\mbox{\boldmath $Y$} \mid \mbox{\boldmath $Z$}) f(\mbox{\boldmath $Z$} \mid \mbox{\boldmath $\gamma$}, \mbox{\boldmath $\phi$}, \lambda, \eta, \mbox{\boldmath $\Psi$}, \alpha, \mbox{\boldmath $Y$}) d(\tilde{\mbox{\boldmath $Z$}}_k^*)}. \end{displaymath} The likelihood of the raw observed data conditional on the latent variables $f(\mbox{\boldmath $Y$} \mid \mbox{\boldmath $Z$})$ is either 1 or 0, depending on whether or not the $z_{ij}$ corresponding to discrete or censored $y_{ij}$ is consistent with the conditional limits imposed by $y_{ij}$, or not. With the proposal strategy discussed above this will always be the case, but it is still denoted in the $MH$ above for completeness. \\[-.1in] \noindent {\underline{MH update for $\mbox{\boldmath $\phi$}$}} \noindent This is the most complex of the parameter updates as it uses a less standard split-merge MH approach \citep{Jain04} as this improves mixing dramatically over one-at-a-time Gibbs updates for the $\mbox{\boldmath $\phi$}_i$. However, the split-merge update does make use of the individual Gibbs update for the $\phi_i$. This is provided as \vspace{-.1in}\begin{displaymath} \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\Pr (\phi_i \!=\! m \!\mid \!\mbox{\em rest}) \; \propto \; f(\mbox{\boldmath $Z$} \mid \mbox{\boldmath $\gamma$}, \mbox{\boldmath $\phi$}, \lambda, \eta, \mbox{\boldmath $\Psi$}, \alpha) f(\phi_i \mid \mbox{\boldmath $\phi$}_{-i})\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\; \end{displaymath} \vspace{-.4in}\begin{equation} \;\;\;\;\;\;\;\;\;\;\propto \: \left\{ \begin{array}{ll} \!\frac{\mbox{\small $n_{m(\mbox{\scriptsize{-}}i)}\!-\!1$}}{\mbox{\small $n\!-\!1\!+\!\alpha$}}\!\!\left(\!\frac{\mbox{\small $n_{m(\mbox{\scriptsize{-}}i)}\!+\!\lambda$}}{\mbox{\small $n_m\!+\!\lambda$}} \!\right)^{\!\!\!\frac{p_1}{2}} \!\!\!\frac{\mbox{$\left| \mbox{\boldmath $\Psi$}_{11} \right|^{\frac{n_{m(\mbox{\scriptsize{-}}i)}+\eta-p_2}{2}}\Gamma_{\!p_1}\!\!\left(\frac{n_m+\eta-p_2}{2}\right)$}}{\mbox{$\left| \mbox{\boldmath $V$}_{m11} \right|^{\frac{n_m+\eta-p_2}{2}}\Gamma_{\!p_1}\!\!\left(\frac{n_{m(-i)+\eta-p_2}}{2}\right)$}} & \begin{array}{l} \mbox{\!if $m=\phi_l$ for some} \\ \mbox{\!$\phi_l \in \mbox{\boldmath $\phi$}_{-i}$}, \end{array} \\ \!\frac{\mbox{\small $\alpha$}}{\mbox{\small $n\!-\!1\!+\!\alpha$}}\!\left(\!\frac{\mbox{\small $\lambda$}}{\mbox{\small $\lambda\!+\!1$}} \!\right)^{\!\!\frac{p_1}{2}} \!\!\!\frac{\mbox{$\left| \mbox{\boldmath $\Psi$}_{11} \right|^{\frac{\eta-p_2}{2}}\Gamma_{\!p_1}\!\!\left(\frac{\eta+1-p_2}{2}\right)$}}{\mbox{$\left| \mbox{\boldmath $V$}_{m11} \right|^{\frac{1+\eta-p_2}{2}}\Gamma_{\!p_1}\!\!\left(\frac{\eta-p_2}{2}\right)$}} & \!\mbox{for $m\!=\!M\!+\!1$}, \\ \!0 & \!\mbox{otherwise}, \end{array} \right.\!\!\!\!\!\!\!\!\!\! \label{eq:phi_gibbs} \end{equation} where $\mbox{\boldmath $\phi$}_{-i}$ is the $\mbox{\boldmath $\phi$}$ vector with out the $i^{\mbox{\scriptsize th}}$ element and $\mbox{\boldmath $\phi$}_{-i}$ has been relabeled if necessary so that it has at least one $\phi_l = m$ for $m=1,\dots,M$. The split-merge MH update then works as follows. \begin{itemize} \item[1.] Set $\mbox{\boldmath $\phi$}^*=\mbox{\boldmath $\phi$}$. Select two points $i$ and $i'$ at random. Let ${\cal C} = \{l : \phi_l = \phi_{i} \mbox{ or } \phi_l = \phi_{i'}$\}. \item[2.] \begin{itemize} \item[(a)] If $\phi_i = \phi_{i'}$, then propose a split move to divide ${\cal C}$ into two groups in $\mbox{\boldmath $\phi$}^*$.\\[-.05in] \begin{itemize} \item[(i)] \white{.} \vspace{-.64in}\begin{displaymath} \!\!\mbox{For $l \in {\cal C}$, set } \phi_l^{{\mbox{\scriptsize launch}}} = \left\{ \begin{array}{ll} \phi_i & \mbox{if }\|\mbox{\boldmath $z$}^{(1)}_l - \mbox{\boldmath $z$}^{(1)}_{i}\| \leq \|\mbox{\boldmath $z$}^{(1)}_{l} - \mbox{\boldmath $z$}^{(1)}_{i'}\|,\;\;\;\;\;\;\;\;\;\;\;\;\\[.05in] M+1 & \mbox{otherwise} \end{array} \right. \end{displaymath} \item[(ii)] Conduct a Gibbs update sweep (\ref{eq:phi_gibbs}) to all $\phi_l : l \in {\cal C}$, restricted to $\phi_l = \phi_i$ or $\phi_l=M+1$. \item[(iii)] Repeat step (iii) for a total of $L$ passes through ${\cal C}$. This determines $\mbox{\boldmath $\phi$}^{\mbox{\scriptsize launch}}$ and the randomly chosen proposal distribution to be used next in step 2(a)(iv). \item[(iv)] Set $\mbox{\boldmath $\phi$}^* = \mbox{\boldmath $\phi$}^{\mbox{\scriptsize launch}}$ and conduct one further restricted Gibbs sweep to the $\phi^{\mbox{\scriptsize launch}}_l : l \in {\cal C}$. The proposal density $d(\mbox{\boldmath $\phi$}^* \mid \mbox{\boldmath $\phi$})$ is the product of the restricted Gibbs sampling probabilities in this final sweep, whereas $d(\mbox{\boldmath $\phi$} \mid \mbox{\boldmath $\phi$}^*) = 1$. \end{itemize} \item[(b)] If $\phi_i \neq \phi_{i'}$, then propose a merge move to combine the observations in ${\cal C}$ into one group $\mbox{\boldmath $\phi$}^*$. \begin{itemize} \item[(i)] Set $\phi^*_l = \phi_i$ for all $l \in {\cal C}$. The proposal density is $d(\mbox{\boldmath $\phi$}^* \mid \mbox{\boldmath $\phi$})=1$. \item[(ii)] Conduct steps 2(a)(i) - 2(a)(iv) in order to evaluate the reverse proposal density $d(\mbox{\boldmath $\phi$} \mid \mbox{\boldmath $\phi$}^*)$. \item[(iii)] The reverse proposal density $d(\mbox{\boldmath $\phi$} \mid \mbox{\boldmath $\phi$}^*)$ is the product of restricted Gibbs sampling probabilities for moving from $\mbox{\boldmath $\phi$}^{\mbox{\scriptsize launch}}$ to $\mbox{\boldmath $\phi$}$. \end{itemize} \end{itemize} \item[3.] The MH ratio is then, \begin{eqnarray} MH & \!\!=\!\! & \frac{f(\mbox{\boldmath $Z$} \mid \mbox{\boldmath $\gamma$}, \mbox{\boldmath $\phi$}^*, \lambda, \eta, \mbox{\boldmath $\Psi$}, \alpha) f(\mbox{\boldmath $\phi$}^*) d(\mbox{\boldmath $\phi$} \mid \mbox{\boldmath $\phi$}^*)} {f(\mbox{\boldmath $Z$} \mid \mbox{\boldmath $\gamma$}, \mbox{\boldmath $\phi$}, \lambda, \eta, \mbox{\boldmath $\Psi$}, \alpha) f(\mbox{\boldmath $\phi$}) d(\mbox{\boldmath $\phi$}^* \mid \mbox{\boldmath $\phi$})}\nonumber \\ &\!\!=\!\! & \frac{\!\prod_{m \in \{\phi^*_l:l\in {\cal C}\}} \left[ \alpha(n^*_m-1)! \left( \!\frac{\lambda}{n^*_m\!+\!\lambda}\!\right)^{\!\!\frac{p_1}{2}} \!\!\frac{\left| \mbox{\small \boldmath $\Psi$}_{11} \right|^{\frac{\eta-p_2}{2}} \Gamma_{\!p_1\!}(\frac{n_m\!+\!\eta-p_2}{2})} {\left| \mbox{\small \boldmath $V$}^*_{\!m11} \right|^{\frac{n^*_m+\eta-p_2}{2}} \Gamma_{\!p_1\!}(\frac{\eta-p_2}{2})} \right]d(\mbox{\boldmath $\phi$} \!\mid\! \mbox{\boldmath $\phi$}^*)} {\!\prod_{m \in \{\phi_l:l\in {\cal C}\}} \left[ \alpha (n_m-1)! \left( \!\frac{\lambda}{n_m\!+\!\lambda}\!\right)^{\!\!\frac{p_1}{2}} \!\!\frac{\left| \mbox{\small \boldmath $\Psi$}_{11} \right|^{\frac{\eta-p_2}{2}} \Gamma_{\!p_1\!}(\frac{n_m\!+\!\eta-p_2}{2})} {\left| \mbox{\small \boldmath $V$}_{\!m11} \right|^{\frac{n_m+\eta-p_2}{2}} \Gamma_{\!p_1\!}(\frac{\eta-p_2}{2})} \right]d(\mbox{\boldmath $\phi$}^* \!\mid\! \mbox{\boldmath $\phi$})}, \nonumber \end{eqnarray} where $n_m$ is the number of $\phi_l=m$ and $n_m^*$ is the number of $\phi^*_l=m$. Draw a Uniform(0,1) and accept or reject in the usual manner on the basis of the MH ratio. \item[4.] Perform one final (unrestricted) Gibbs update over {\em all} observations, i.e., for each $\phi_l$, $l=1,\dots,n$. As discussed in \cite{Jain04}, alternating between split-merge and Gibbs updates produces an ergodic Markov chain. \end{itemize} \white{.}\\[-.1in] \noindent {\underline{Joint MH update for $\gamma$ and $\mbox{\boldmath $\phi$}$}} \noindent The MCMC routine then consists of applying each of the above updates in turn to complete a single MCMC iteration, with the exception that the $\mbox{\boldmath $\gamma$}$ update be applied $L_g$ times each iteration. Also, as discussed in the main paper, to improve mixing we recommend using the following joint update for $\mbox{\boldmath $\gamma$}$ and $\mbox{\boldmath $\phi$}$ in place of the individual updates for $\mbox{\boldmath $\gamma$}$ and $\mbox{\boldmath $\phi$}$ every other iteration (or simply in addition to them every iteration). This is fairly straight-forward as the proposals are generated by simply generating a $\mbox{\boldmath $\gamma$}^*$ as above, then a $\mbox{\boldmath $\phi$}^*$ conditional on $\mbox{\boldmath $\gamma$}^*$ as above. The MH ratio for such an update is then, \begin{displaymath} MH = \frac{f(\mbox{\boldmath $Z$} \mid \mbox{\boldmath $\gamma$}^*, \mbox{\boldmath $\phi$}^*, \lambda, \eta, \mbox{\boldmath $\Psi$}, \alpha) f(\mbox{\boldmath $\gamma$}^*) f(\mbox{\boldmath $\phi$}^*) d(\mbox{\boldmath $\gamma$} \mid \mbox{\boldmath $\gamma$}^*)d(\mbox{\boldmath $\phi$} \mid \mbox{\boldmath $\phi$}^*, \mbox{\boldmath $\gamma$})} {f(\mbox{\boldmath $Z$} \mid \mbox{\boldmath $\gamma$}, \mbox{\boldmath $\phi$}, \lambda, \eta, \mbox{\boldmath $\Psi$}, \alpha) f(\mbox{\boldmath $\gamma$}) f(\mbox{\boldmath $\phi$}) d(\mbox{\boldmath $\gamma$}^* \mid \mbox{\boldmath $\gamma$})d(\mbox{\boldmath $\phi$}^* \mid \mbox{\boldmath $\phi$}, \mbox{\boldmath $\gamma$}^*)}, \end{displaymath} By the same rational as that used in \cite{Jain04}, both the individual updates and the joint update leave the possibility for the states to remain unchanged, therefore applying each of these transitions in turn will produce an ergodic Markov chain. \vspace{-.2in} \section{MCMC Trace Plots} \label{sec:MCMCtrace} In order to get a big picture view of the mixing of the MCMC algorithm, the MCMC trace plots for the number of informative variables $p_1$ and the number of clusters $M$ are provided below in Figure~\ref{fig:S1} for two separate MCMC chains (in blue and red respectively) of 75,000 iterations each. The discrete nature of the variables makes it slightly more difficult to assess steady state than for continuous variables. However, this assessment can be conducted via the following questions. For parameters that spend a lot of time at multiple values, are they changing values frequently (i.e., good mixing)? Also, are they spending the same amount of relative time in a particular value through the life of the chain (i.e., a good indication that steady state has been reached). When looking at these plots, the answer to both questions appears to “yes”. It is apparent the the mixing is slower for the variable selection than for the cluster membership, however, over 75,000 iterations, if a chain spends a non-negligible number of iterations at a value for $p_1$ (i.e., 4, 5, or 6), then their are dozens of switches to that model size that occur all throughout the life of the chains. A more granular view of the mixing is also provided by the MCMC trace plots for the individual $\gamma_j$ (for $j=1,\dots,46$) in Figure~\ref{fig:S2} and each of the $\phi_i$ (for $i=1,\dots,96$; the exhaustive list of all 487 subjects trace plots all looked similar to these) in Figure~\ref{fig:S3}. Once again results are provided for two chains. Mixing is slow for $\gamma_j$, thus the need for so many MCMC iterations. Over 75,000 iterations, if a chain spends a non-negligible number of iterations at either 0 or 1 for a given variable, then their are generally many switches that occur all throughout the life of the chains. Mixing for the $\phi_i$ on the other hand is quite good in comparison; all observations that spend a non-negligible number of iterations with more than one cluster switch back and forth between cluster memberships quite regularly. While there were a maximum of 12 clusters observed over all MCMC iterations from both chains, labels 7 - 12 only accounted for a total of 0.0036 of the posterior probability, so only labels 1-6 are displayed for clearer presentation. The $\phi_i$ displayed in these plots are {\bf not} the raw $\phi_i$ that are subject to label switching. Rather, they have been relabeled for clearer interpretation according to the information theoretic approach discussed in Section~\ref{sec:inference} so that, for instance, a label of 1 can be interpreted as ``belonging to the same cluster 1'' regardless of the MCMC iteration number. \vspace{-.0in}\begin{figure}[h!] \begin{center} \caption{MCMC Trace plots for $p_1$ and $m$} \label{fig:S1} \vspace{-.07in} \includegraphics[width=.49\textwidth]{./p_trace.png} \includegraphics[width=.49\textwidth]{./M_trace.png} \end{center} \vspace{-.5in} \end{figure} \begin{figure}[h!] \caption{MCMC Trace plots for $\gamma_j$} \label{fig:S2} \includegraphics[width=.99\textwidth]{./gamma_trace_plots_1.png} \end{figure} \setcounter{figure}{1} \begin{figure}[h!] \caption{MCMC Trace plots for $\gamma_j$} \includegraphics[width=.99\textwidth]{./gamma_trace_plots_2.png} \end{figure} \begin{figure}[h!] \caption{MCMC Trace plots for $\phi_i$} \label{fig:S3} \includegraphics[width=.99\textwidth]{./phi2_trace_plots_1.png} \end{figure} \setcounter{figure}{1} \begin{figure}[h!] \caption{MCMC Trace plots for $\phi_i$} \includegraphics[width=.99\textwidth]{./phi2_trace_plots_2.png} \end{figure} \setcounter{figure}{1} \begin{figure}[h!] \caption{MCMC Trace plots for $\phi_i$} \includegraphics[width=.99\textwidth]{./phi2_trace_plots_3.png} \end{figure} \setcounter{figure}{1} \begin{figure}[h!] \caption{MCMC Trace plots for $\phi_i$} \includegraphics[width=.99\textwidth]{./phi2_trace_plots_4.png} \end{figure} \end{appendix}
{'timestamp': '2018-03-13T01:14:14', 'yymm': '1703', 'arxiv_id': '1703.08741', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08741'}
arxiv
\section{Introduction} The nearest neighbor (NN) classifier endowed with the dynamic time warping (DTW) distance is one of the most popular methods in time series classification \cite{Fu2011,Xing2010}. Application examples include electrocardiogram frame classification \cite{Huang2002}, gesture recognition \cite{Alon2009,Reyes2011}, speech recognition \cite{Myers1981}, and voice recognition \cite{Muda2010}. Two disadvantages of the naive NN method are high storage and computation requirements. Storage requirements are high, because the entire training set needs to be retained for being able to execute its classification rule. Computation requirements are high, because classifying a test example demands calculation of DTW distances between the test and all training examples. One solution to both limitations are data reduction methods that infer a small set of prototypes from the training examples \cite{Wilson2000}. These methods aim at scaling down storage and computational complexity, while maintaining high classification accuracy. Two common reduction approaches are prototype selection \cite{Garcia2012} and prototype generation \cite{Triguero2012}. Prototype selection methods choose a suitable subset of the original training set. Examples of prototype selection algorithms that have been applied in DTW spaces are min-max centroids \cite{Rabiner1978}, k-Medoids \cite{Kaufman1987,Petitjean2014,Petitjean2016} and the DROP-family \cite{Wilson2000,Xi2006}. Prototype generation methods infer new artificial prototypes from the training examples. We distinguish between three directions to prototype generation methods for NN classification in DTW spaces: \begin{enumerate} \itemsep0em \item \emph{Unsupervised prototype generation} \cite{Abdulla2003,Ongwattanakul2009,Petitjean2016,Rabiner1978,Rabiner1979,Sathianwiriyakhun2016,Srisai2009,Wilpon1985}: Unsupervised methods cluster the training examples of every class separately. Centroids of the clusters are computed by averaging warped time series, which is non-trivial as compared to averaging vectors \cite{Petitjean2011,Schultz2017}. The resulting centroids form a reduced set of prototypes for NN classification. \item \emph{Symmetric LVQ1} \cite{Somervuo1999}: Symmetric LVQ1 is a supervised prototype generation method that extends the LVQ1 algorithm \cite{Kohonen2001} from Euclidean to DTW spaces by using a symmetric update rule. Starting with an initial set of prototypes, LVQ1 repeatedly applies the following steps: (i) select the next training example $x$; (ii) identify the prototype $p$ closest to $x$; and (iii) attract $p$ to $x$ if the class labels of both agree, otherwise repel $p$ from $x$. \item \emph{Relational LVQ} \cite{Gisbrecht2012,Hammer2011,Hammer2014,Mokbel2015}: Relational LVQ methods extend state-of-the-art LVQ methods from Euclidean spaces to pseudo-Euclidean spaces via pairwise dissimilarity data. An important example that has been extended to relational learning is generalized LVQ (GLVQ) \cite{Sato1996} \end{enumerate} An empirical comparison of different methods across the three directions is missing. Consequently, it is unclear which direction is best suited for which situation. Relational methods are theoretically best developed and the most general approach, because they can be applied to any distance space. Unsupervised methods are currently the most popular direction in DTW spaces. Their usefulness has been first demonstrated in the 1970ies for speech recognition \cite{Rabiner1978,Rabiner1979} and recently confirmed for general time series classification tasks \cite{Petitjean2016,Sathianwiriyakhun2016}. Moreover, empirical result showed that k-means together with the DBA algorithm for time series averaging exhibited the best generalization performance over different prototype selection and unsupervised prototype generation methods \cite{Petitjean2014,Petitjean2016}. A limitation of unsupervised methods is that they learn prototypes of every class separately without considering the decision boundaries to the respective neighboring classes. In contrast to unsupervised methods, supervised approaches aim at directly approximating the true but unknown decision boundaries. As far as we know, symmetric LVQ1 \cite{Somervuo1999} is the only existing supervised prototype generation method that operates in DTW spaces. However, there are two major issues related to symmetric LVQ1: \begin{enumerate} \itemsep0em \item The update rule of the Euclidean LVQ1 method can be formulated as a weighted average of two points. Averages in Euclidean spaces are unique minimizers of a sum of squared Euclidean distances. In DTW spaces there are two forms of averages: a symmetric and an asymmetric form \cite{Kruskal1983,Schultz2017}. The symmetric form computes the arithmetic mean of warped time series, whereas the asymmetric form is a minimizer of a sum of squared DTW distance criterion \cite{Jain2016,Schultz2017}. Symmetric LVQ1 uses a symmetric form of weighted average as update rule, which has the semblance of the Euclidean LVQ1 update rule but resists a theoretical justification. \item Symmetric LVQ1 has been proposed as a heuristic without explicit link to a cost function. It extends the first and simplest LVQ variant formulated in Euclidean spaces \cite{Kohonen2001}. The Euclidean LVQ1 showed unsatisfactory generalization performance, slow convergence, and numerical instabilities. Improved methods such as GLVQ define explicit cost functions that are minimized by stochastic gradient descent. In principle, it is possible to extend cost-based LVQ methods to DTW spaces using symmetric update rules. However, these update rules will fail to minimize the respective extended cost functions in an analytically justified way (cf.~Section \ref{subsec:symmetric-asymmetric}). \end{enumerate} Given both issues, it seems natural to ask whether asymmetric extensions of cost-based LVQ methods are beneficial for supervised prototype generation in DTW spaces. In this contribution, we propose an asymmetric LVQ scheme for DTW spaces. The proposed asymmetric scheme is generic and theoretically better grounded than its symmetric counterpart. It is generic in the sense that Euclidean LVQ algorithms can be directly extended to DTW spaces under mild assumptions. As examples, we derive asymmetric versions of LVQ1 and GLVQ. The proposed scheme is theoretically justified in the sense that asymmetric update rules are weighted averages that minimize a sum of squared distance criterion. In addition, asymmetric cost-based LVQ are stochastic gradient descent method almost surely. In experiments, we compared the performance of the proposed asymmetric LVQ methods against prototype generation methods from the above three directions. The results suggest that asymmetric GLVQ best trades classification accuracy against computation time by a large margin. The implications of this contribution are twofold: First, asymmetric GLVQ is well suited for online settings and in situations where storage and computation requirements are an issue. Second, the generic asymmetric LVQ scheme can serve as a blueprint for directly extending unsupervised prototype learning methods to DTW spaces, such as vector quantization, self-organizing maps, and neural gas. The rest of this paper is structured as follows: Section 2 introduces LVQ in Eucldean space. Section 3 proposes asymmetric LVQ for DTW spaces. Section 4 presents and discusses experiments. Finally, Section 5 concludes with a summary of the main results and an outlook to further research. \section{Learning Vector Quantization} This section introduces learning vector quantization in Euclidean spaces in such a way that most concepts can be directly extended to other distance spaces. \subsection{Nearest Neighbor Classification} Let $\args{\S{X}, \delta}$ be a distance space with distance function $\delta:\S{X} \times \S{X} \rightarrow {\mathbb R}_{\geq 0}$. Furthermore, let $\S{Y} = \cbrace{1, \ldots, C}$ be a set consisting of $C$ class labels. We assume that there is an unknown function \[ y : \S{X} \rightarrow \S{Y}, \quad x \mapsto y(x) \] that assigns every element $x \in \S{X}$ to a class label $y(x) \in \S{Y}$. A nearest neighbor classifier approximates the unknown function $y$ by using a set $\S{C} = \cbrace{\args{p_1, z_1}, \ldots, \args{p_K, z_K)}}$ of $K$ reference elements $p_k \in \S{X}$ with class labels $z_k = y(p_k)$. The set $\S{C}$ is called \emph{codebook} and its elements $p_k$ are the \emph{prototypes}. We demand that $y(\S{C}) = \S{Y}$, that is there is at least one prototype for every class. For the sake of convenience, we occasionally write $p \in \S{C}$ instead of $(p,z) \in \S{C}$. Consider the function \[ p_*(x) = \argmin_{p \in \S{C}} \delta(p, x) \] that associates element $x \in \S{X}$ with its nearest (best-matching) prototype $p_*(x) \in \S{C}$. Then the nearest neighbor classifier with respect to codebook $\S{C}$ is a function $h_{\S{C}}: \S{X} \rightarrow \S{Y}$ of the form $h_{\S{C}}(x) = y\args{p_*(x)}$. The function $h_{\S{C}}(x)$ assigns element $x$ to the class of its nearest prototype $p_*(x)$. \subsection{Learning Vector Quantization} Let $\S{X} = {\mathbb R}^d$ be the $d$-dimensional Euclidean space endowed with the Euclidean metric $\delta(x, y) = \norm{x - y}$. Suppose that $\S{D} = \cbrace{\args{x_1, y_1}, \ldots, \args{x_N, y_N}} \subseteq \S{X} \times \S{Y}$ is a training set. The goal of LVQ is to learn a codebook $\S{C}$ of size $K \ll N$ on the basis of the training set $\S{D}$ such that the expected misclassification error of the nearest neighbor classifier $h_{\S{C}}$ is as small as possible. Learning can be performed in batch or incremental (stochastic) mode. Here, we focus on incremental learning. During learning, prototypes $p$ are adjusted in accordance with the distortion \[ D_x(p) = \delta^2(p, x), \] where $x$ is the current input example. The distortion $D_x(p)$ is differentiable as a function of $p$ and its gradient is given by $\nabla D_x(p) = 2(p-x)$. Then the generic LVQ scheme is of the following form: \bigskip \hrule \begin{enumerate} \itemsep0em \item Initialize codebook $\S{C}$. \item Repeat until termination: \begin{enumerate} \itemsep0em \item Randomly select a training example $(x, y) \in \S{D}$. \item For all prototypes $(p, z) \in \S{C}$ do \begin{align}\label{eq:generic-Euclidean-update-rule} p \;\leftarrow\; p - \eta \cdot f(p, x)\cdot(p-x), \end{align} where $\eta$ is an adaptive learning rate and $f$ is a class-compatible force function. \item Optionally adjust hyper-parameters. \end{enumerate} \end{enumerate} \hrule \bigskip The learning rate $\eta$ in Eq.~\eqref{eq:generic-Euclidean-update-rule} absorbs the constant factor $2$ of the gradient $\nabla D_x(p)$. Variants of LVQ algorithms differ in the particular form of the force function. Note that the notation of the force function is incomplete for the sake of simplicity. A force function $f(p,x)$ depends on the class labels of both arguments as well as on the entire codebook $\S{C}$. The force function $f(p,x)$ is a real-valued function that determines the direction and relative strength with which prototype $p$ is updated. A positive force $f(p,x)$ moves $p$ closer to the input $x$. A negative force $f(p,x)$ repels $p$ from $x$. Finally, prototype $p$ remains unchanged if the force $f(p,x)$ is zero. We demand that the force function $f(p,x)$ is class-compatible in the sense that $f(p,x) \geq 0$ if $y(x) = y(p)$ and $f(p,x) \leq 0$ if $y(x) \neq y(p)$. Hyper-parameters need to be initialized and can be optionally adjusted during learning. Two common hyper-parameters are the number $K$ of prototypes and the learning rate $\eta$. Some force functions include additional hyper-parameters. \subsection{Examples of LVQ Algorithms This section presents two examples of LVQ algorithms, the LVQ1 and the generalized LVQ algorithm. \subsubsection*{Example 1: LVQ1} The LVQ1 algorithm proposed by Kohonen \cite{Kohonen2001} is historically the first LVQ method. Its heuristically motivated update rule is of the form \begin{align* p \;\leftarrow\; \begin{cases} p - \eta \args{p - x} & p = p_*(x) \text{ and } y(x) = y(p)\\[0.5ex] p + \eta \args{p - x} & p = p_*(x) \text{ and } y(x) \neq y(p)\\[0.5ex] p & p \neq p_*(x) \end{cases}. \end{align*} The update rule adjusts the best matching prototype $p = p_*(x)$ of the current input $x$ and leaves all other prototypes unchanged. Prototype $p$ is attracted to $x$ if their class labels agree and repelled otherwise. To express the update rule of LVQ1 in terms of Eq.~\eqref{eq:generic-Euclidean-update-rule}, we define the force function $f$ of LVQ1 as \[ f(p,x) = \begin{cases} +1 & p = p_*(x) \text{ and } y(x) = y(p)\\[0.5ex] -1 & p = p_*(x) \text{ and } y(x) \neq y(p)\\[0.5ex] 0 & p \neq p_*(x) \end{cases}. \] \subsubsection*{Example 2: Generalized LVQ} The early LVQ1 algorithm suffered from sensitivity to initialization, instabilities during learning, and slow convergence \cite{Nova2014}. Therefore, several modifications of LVQ1 have been suggested \cite{Biehl2016,Nova2014}. One example is generalized learning vector quantization (GLVQ) proposed by Sato and Yamada \cite{Sato1996}. During learning, GLVQ maximizes the hypothesis margin \cite{Crammer2002,Hammer2005} by minimizing the cost function \[ E = \sum_{i=1}^N h(\kappa(x_i)), \] where $h: {\mathbb R} \rightarrow {\mathbb R}$ is a monotonously increasing function and $\kappa: \S{X} \rightarrow {\mathbb R}$ is the relative distance difference. Here, we assume that $h$ is the sigmoid function $h(u) = 1 / (1 + \exp(-\sigma u))$, where $\sigma$ is an adjustable hyper-parameter that controls the slope. To describe the relative distance difference, we consider a training example $(x, y) \in \S{D}$. Suppose that $p^+$ is the closest prototype of $x$ with $y(p^+) = y$ and $p^-$ is the closest prototype of $x$ with $y(p^-) \neq y$. Then the relative distance difference of $x$ is defined by \[ \kappa(x) = \frac{d^+ - d^-}{d^+ + d^-}, \] where $d^{\pm} = \delta(p^{\pm}, x)$ are the squared distances of $x$ from the prototypes $p^{\pm}$. The relative difference $\kappa(x)$ as a function of the prototypes $p^{\pm}$ has the following analytical properties: \begin{enumerate}[(i)] \itemsep0em \item $\kappa(x)$ is undefined if $x = p^+ = p^-$. \item $\kappa(x)$ is locally Lipschitz continuous if $d^+ + d^- \neq 0$. \item $\kappa(x)$ is non-differentiable if one of the prototypes $p^{\pm}$ is not uniquely determined for $x$. \end{enumerate} The function $\kappa(x)$ is not continuously extendable at its discontinuity, which is a singleton. Otherwise, from case (ii) follows that $\kappa(x)$ is differentiable almost everywhere by Rademacher's Theorem \cite{Evans1992}. In other words, we have zero probability that non-differentiability occurs. The same analytical properties hold for the loss $h(\kappa(x))$ and the cost function $E$. The GLVQ algorithm minimizes the cost function $E$ incrementally according to the following update rule for every prototype $p \in \S{C}$: \begin{align*} p \;\leftarrow\; \begin{cases} p - \eta \, \phi^+\args{p - x} & p = p^+ \\[0.5ex] p + \eta \, \phi^-\args{p - x} & p = p^- \\[0.5ex] p & \text{otherwise} \end{cases}, \end{align*} where \begin{align*} \phi^+ = h'(\kappa(x))\frac{d^-}{\argsS{d^+ + d^-}{^2}} \qquad \text{and} \qquad \phi^- = h'(\kappa(x))\frac{d^+}{\argsS{d^+ + d^-}{^2}} \end{align*} The derivative of the sigmoid function is given by $h'(u) = h(u)\args{1 - h(u)}$. The update rule of GLVQ performs stochastic gradient descent if $h(\kappa(x))$ is differentiable as a function of $p$, which is almost surely the case. If the exceptional case (i) occurs, we find that $p-x = 0$. In this case, updating leaves the prototype $p$ unchanged. Thus, the singularity of $\kappa$ has no adverse effects. Critical are continuous but non-differentiable points $p$ corresponding to case (iii). There are two straightforward strategies to cope with non-differentiability: The first strategy ignores the current input $x$ and draws the next training example. The second strategy breaks all ties if the closest prototypes $p^{\pm}$ of input $x$ are not uniquely determined and then proceeds as usual. Either of both strategies can be implemented into the force function of GLVQ. The force function of GLVQ following the first strategy for case (iii) is of the form \[ f(p,x) = \begin{cases} +\phi^+(x) & p = p^+ \text{ and } p^+ \text{ is unique} \\[0.5ex] -\phi^-(x) & p = p^- \text{ and } p^- \text{ is unique}\\[0.5ex] 0 & \text{otherwise} \end{cases}. \] Substituting the force function $f(p,x)$ into the generic Euclidean update rule \eqref{eq:generic-Euclidean-update-rule} gives the update rule of GLVQ. \section{LVQ in DTW Spaces} This section presents a generic asymmetric update rule for LVQ in DTW spaces and discusses its relationship to the symmetric LVQ1 update rule proposed by Somervuo and Kohonen \cite{Somervuo1999}. \subsection{The Dynamic Time Warping Distance}\label{subsec:DTW} We begin with introducing the DTW distance. We refer to Figure \ref{fig:wpath} for explanatory illustrations of the concepts. \medskip \begin{figure} \centering \includegraphics[width=0.98\textwidth]{./ex_wpath.png} \caption{\textbf{(a)} Two time series $x$ and $y$ of length $n = 4$. The red and blue numbers are the elements of the respective time series. \textbf{(b)} Warping path $w = (w_1, \ldots, w_5)$ of length $L = 5$. The points $w_l = (i_l, j_l)$ of warping path $w$ align elements $x_{i_l}$ of $x$ to elements $y_{j_l} $ of $y$ as illustrated in (a) by black lines. \textbf{(c)} The $4 \times 4$ grid showing how warping path $w$ moves from the upper left to the lower right corner as indicated by the orange balls. The numbers attached to the orange balls are the squared-error costs of the corresponding aligned elements. \textbf{(d)} The cost $C_w(x, y)$ of aligning $x$ and $y$ along warping path $w$.} \label{fig:wpath} \end{figure} A time series $x$ of length $m$ is a sequence $x = (x_1, \ldots, x_m)$ consisting of feature vectors $x_i \in {\mathbb R}^d$ for every time point $i \in [m] = \cbrace{1, \ldots, m}$. By $\S{T}$ we denote the set of all time series of finite length with features from ${\mathbb R}^d$. To define the DTW-distance, we first need to introduce warping paths. \begin{definition Let $m, n \in {\mathbb N}$. A \emph{warping path} of order $m \times n$ is a sequence $w = (w_1 , \dots, w_L)$ of $L$ points $w_l = (i_l,j_l) \in [m] \times [n]$ such that \begin{enumerate} \item $w_1 = (1,1)$ and $w_L = (m,n)$ \hfill\emph{(\emph{boundary conditions})} \item $w_{l+1} - w_{l} \in \cbrace{(1,0), (0,1), (1,1)}$ for all $l \in [L-1]$ \hfill\emph{(\emph{step condition})} \end{enumerate} \end{definition} The set of all warping paths of order $m \times n$ is denoted by $\S{W}_{m,n}$. A warping path of order $m \times n$ can be thought of as a path in a $[m] \times [n]$ grid, where rows are ordered top-down and columns are ordered left-right. The boundary conditions demand that the path starts at the upper left corner and ends in the lower right corner of the grid. The step condition demands that a transition from one point to the next point moves a unit in exactly one of the following directions: down, right, and diagonal. A warping path $w = (w_1, \ldots, w_L)\in \S{W}_{m,n}$ defines an alignment (or warping) between time series $x = (x_1, \ldots, x_m)$ and $y = (y_1, \ldots, y_n)$. Every point $w_l = (i_l,j_l)$ of warping path $w$ aligns feature vector $x_{i_l}$ to feature vector $y_{j_l}$. Occasionally, we write $\S{W}(x, y)$ instead of $\S{W}_{m,n}$ to denote the set of all warping paths aligning time series $x$ and $y$. The \emph{cost} of aligning time series $x$ and $y$ along warping path $w$ is defined by \begin{equation* C_w(x, y) = \sum_{l=1}^L \normS{x_{i_l}-y_{j_l}}{^2}, \end{equation*} where $\norm{\cdot}$ denotes the Euclidean norm. Then the DTW-distance between two time series minimizes the cost of aligning both time series over all possible warping paths. \begin{definition} The \emph{DTW-distance} between time series $x, y \in \S{T}$ is defined by \begin{equation* \dtw(x, y) = \min \cbrace{\sqrt{C_w(x, y)} \,:\, w \in \S{W}(x,y)}. \end{equation*} An \emph{optimal warping path} is any warping path $w \in \S{W}(x, y)$ that satisfies $\dtw(x, y) = \sqrt{C_w(x, y)}$. \end{definition} The DTW-distance is not a metric, because it violates the identity of indiscernibles and the triangle inequality.\footnote{The identity of indiscernibles demands that $\delta(x, y) = 0 \Leftrightarrow x = y$ for all $x, y \in \S{T}$.} Instead, the DTW-distance satisfies the following properties for all $x, y \in \S{T}$: (i) $\dtw(x, y) \geq 0$, (ii) $\dtw(x, x) = 0$, and (iii) $d(x, y) = d(y, x)$. Computing the DTW distance and deriving an optimal warping path is usually solved by applying techniques from dynamic programming \cite{Sakoe1978}. \subsection{A Generic Asymmetric LVQ Update Rule} This section extends LVQ update rules from Euclidean spaces to DTW spaces using asymmetric averaging. \medskip The basic idea for extending LVQ to DTW spaces is as follows: Replace the gradient of the squared Euclidean distance by a suitable surrogate time series $g_{p,x}$ such that the corresponding update rule takes the form \begin{align}\label{eq:proposed-update-rule} p' = p - \eta \cdot f(p,x)\cdot g_{p,x}, \end{align} where $x$ is the current input, $p$ is the prototype to be updated, and $p'$ is the updated prototype. We demand that $g$ has the same length as $p$. In this case, the right hand side of update rule \eqref{eq:proposed-update-rule} can be regarded as a valid algebraic expression of two vectors. To construct the surrogate time series $g_{p,x}$, we consider the squared DTW distortion \[ D_x: {\mathbb R}^m \rightarrow {\mathbb R}, \quad p \mapsto \dtw^2(p, x), \] where $x \in \S{T}$ is a time series of arbitrary length. Restricting the domain of $D_x$ to time series of fixed length $m$ is owed to the principle of asymmetric averaging, which will be discussed later in Section \ref{subsec:symmetric-asymmetric}. Note that different prototypes $p_j$ may have different lengths $m_j$, but the update $p'_j$ of a prototype $p_j$ has the same length $m_j$ as $p_j$. The distortion $D_x$ is a locally Lipschitz continuous function on ${\mathbb R}^m$ \cite{Schultz2017} and therefore differentiable almost everywhere by Rademacher's Theorem \cite{Evans1992}. Every locally Lipschitz continuous function $F: {\mathbb R}^m \rightarrow {\mathbb R}$ admits a concept of generalized gradient $\partial F(p)$ at point $p$, called subdifferential henceforth \cite{Clarke1990}. The subdifferential $\partial F(p) \subseteq {\mathbb R}^m$ of function $F$ is a convex closed subset, whose elements are called subgradients. At differentiable points $p$, the subdifferential $\partial F(p) = \cbrace{\nabla F(p)}$ coincides with the gradient of $F$. To update prototype $p$, we pick a subgradient $g_{p,x} \in \partial D_x(p)$ as surrogate time series. The subgradients we use for updating prototypes can be expressed by warping and valence matrices \cite{Schultz2017}. \begin{definition} Let $w \in \S{W}_{m,n}$ be a warping path. \begin{enumerate} \item The \emph{warping matrix} of $w$ is a matrix $W \in \{0,1\}^{m \times n}$ with elements \begin{equation*} W_{ij} = \begin{cases} 1 & (i,j) \in w \\ 0 & \text{otherwise} \end{cases}. \end{equation*} \item The \emph{valence matrix} of $w$ is the diagonal matrix $V \in {\mathbb N}^{m \times m}$ with elements \begin{align*} V_{ii} = \sum_{j=1}^n W_{ij}. \end{align*} \end{enumerate} \end{definition} Figure \ref{fig:valence} provides an example of a warping and valence matrix. The warping matrix is a matrix representation of the corresponding warping path. The valence matrix is a diagonal matrix, whose elements count how often an element of the first time series is aligned to an element of the second one. The next definition introduces subgradients of squared DTW distortions. \begin{figure}[t] \centering \includegraphics[width=0.9\textwidth]{./ex_valence.png} \caption{Illustration of warping and valence matrix. Box (a) shows the warping path $w$ of Figure \ref{fig:wpath}. Box (b) shows the warping matrix $W$ of warping path $w$. The points $w_l = (i_l, j_l)$ of warping path $w$ determine the positions of the ones in the warping matrix $W$. Box (c) shows the valence matrix $V = (v_{ij})$ of warping path $w$. The matrix $V$ is a diagonal matrix, whose diagonal elements $v_{ii}$ are the row sums of $W$. Box (d) interprets the valence matrix $V$. The valence $v_{ii}$ of element $x_i$ is the number of elements in time series $y$ that are aligned to $x_i$ by warping path $w$. In other words, the valence $v_{ii}$ is the number of black lines emanating from element $x_i$.} \label{fig:valence} \end{figure} \begin{proposition}[\cite{Schultz2017}] Let $x \in \S{T}$ be a time series and $D_x: {\mathbb R}^m \rightarrow {\mathbb R}$ be a squared DTW distortion. Then the subdifferential $\partial D_x(p)$ contains a subgradient of the form \begin{align*} 2 (Vp - Wx) \in \partial D_x(p), \end{align*} where $W$ and $V$ are the warping and valence matrix of an optimal warping path $w \in \S{W}(p,x)$. \end{proposition} Using the concept of subgradients as surrogate for gradients, the generic scheme of LVQ in DTW spaces is as follows: \bigskip \begin{samepage} \hrule \begin{enumerate} \itemsep0em \item Initialize codebook $\S{C}$. \item Repeat until termination: \begin{enumerate} \itemsep0em \item Randomly select a training example $(x, y) \in \S{D}$. \item For all prototypes $(p, z) \in \S{C}$ do \begin{enumerate} \item Compute an optimal warping path $w$ between $p$ and $x$. \item Derive warping matrix $W$ and valence matrix $V$ of path $w$. \item Update prototype $p$ according to the rule \begin{align}\label{eq:generic-DTW-update-rule} p \;\leftarrow\; p - \eta \cdot f(p, x)\cdot(Vp - Wx), \end{align} where $\eta$ is an adaptive learning rate and $f$ is a class-compatible force function. \end{enumerate} \item Optionally adjust hyper-parameters. \end{enumerate} \end{enumerate} \hrule \end{samepage} \bigskip Update rule \eqref{eq:generic-DTW-update-rule} is generic in the following sense: Every LVQ algorithm in Euclidean spaces whose update rule fits into the form of \eqref{eq:generic-Euclidean-update-rule} can be generalized to its corresponding counterpart in DTW spaces. In particular, LVQ1 and GLVQ are examples that can be directly generalized to DTW spaces. In addition, the update rule \eqref{eq:generic-DTW-update-rule} in DTW spaces generalizes the update rule \eqref{eq:generic-Euclidean-update-rule} in Euclidean spaces in the following sense: Squared Euclidean distances between time series $p$ and $x$ of the same length $m$ correspond to the cost of aligning $p$ and $x$ along a warping path $w = (w_1, \ldots, w_m)$ with points $w_l = (l,l)$. Then the valence and warping matrix of $w$ are identity matrices and the subgradient of the squared DTW distortion reduces to the gradient of the squared Euclidean distortion. \subsection{Stochastic Subgradient Update Rules} This section illustrates that stochastic gradient descent rules for minimizing differentiable LVQ cost functions in Euclidean spaces extend to stochastic subgradient methods for minimizing their counterparts in DTW spaces. The following analysis is restricted to the cost function of GLVQ, but can be easily applied to other sufficiently well-behaved cost functions. By \[ E_{\dtw} = \sum_{i=1}^N h(\kappa_{\dtw}(x_i)), \] we denote the cost function of asymmetric GLVQ in DTW spaces, where \[ \kappa_{\dtw}(x) = \frac{\delta^+ - \delta^-}{\delta^+ + \delta^-} \] is the relative DTW distance difference at current input $x$. The distances $\delta^+$ and $\delta^-$ in $\kappa_{\dtw}(x)$ are the DTW distortions \begin{align*} \delta^+ = \delta^2\args{p^+ - x} \qquad \text{and} \qquad \delta^- = \delta^2\args{p^- - x}, \end{align*} The DTW distortion can be expressed as \[ D_x(p) = \min_{p} C_p(p, x), \] where $C_p(p,x)$ is the cost of aligning $p$ and $x$ along warping path $p$. The relative difference $\kappa_{\dtw}(x)$ as a function of the prototypes $p^{\pm}$ has almost the same analytical properties as the relative difference $\kappa$ in Euclidean spaces: \begin{enumerate}[(i)] \itemsep0em \item $\kappa_{\dtw}(x)$ is undefined if $\delta^+ = \delta^- = 0$. \item $\kappa_{\dtw}(x)$ is locally Lipschitz continuous if $d^+ + d^- \neq 0$. \item $\kappa_{\dtw}(x)$ is non-differentiable if one of the prototypes $p^{\pm}$ is not uniquely determined for $x$. \item $\kappa_{\dtw}(x)$ can be non-differentiable if an optimal warping path between $x$ and $p^{\pm}$ is not unique. \end{enumerate} Case (i)--(iii) are as in the Euclidean space with a slight difference in case (i). The relative difference $\kappa$ in Euclidean spaces has a unique singularity for a given input $x$ due to the identity of indiscernibles satisfied by any metric (cf.~Section \ref{subsec:DTW}). Since the DTW distance does not satisfy the identity of indiscernibles, there are time series $p^+$, $p^-$ and $x$ that are pairwise distinct but nevertheless give $\delta^+ = \delta^- = 0$. To show case (ii), observe that the cost function $C_p(p,x)$ is differentiable and therefore locally Lipschitz continuous \cite{Schultz2017}. Since local Lipschitz continuity is closed under the min-operation and rules of calculus, we find that $\kappa_{\dtw}(x)$ is also locally Lipschitz continuous, whenever $d^+ + d^- \neq 0$. Consequently and when well-defined, the function $\kappa_{\dtw}(x)$ is differentiable almost everywhere by Rademacher's Theorem \cite{Evans1992}. As in Euclidean spaces, we again have zero probability that non-differentiability occurs. The difference is that $\kappa_{\dtw}(x)$ has 'more' non-differentiable points than its counterpart in Euclidean spaces due to case (iv). For minimizing the cost function $E_{\dtw}$, the strategy to cope with singularities of case (i) and non-differentiabilities of case (iii) is as in the Euclidean space. We resolve non-differentiabilities of case (iv) by breaking ties and choosing one optimal warping path between $x$ and its closest prototypes $p^+$ and $p^-$. Apart from the singularities, the GLVQ algorithm in DTW spaces has the form of a stochastic subgradient method \cite{Bagirov2014,Schultz2017}. \subsection{Relationship to The Symmetric LVQ1 Algorithm}\label{subsec:symmetric-asymmetric} In 1998, Kohonen and Somervuo \cite{Kohonen1998} laid the foundation for extending (un)supervised prototype learning to arbitrary distance spaces. In a follow-up paper, Somervuo and Kohonen \cite{Somervuo1999} generalized the LVQ1 algorithm to DTW spaces. The technical difference between the Somervuo-Kohonen method and the proposed generic update rule \eqref{eq:generic-DTW-update-rule} is that the former implements symmetric and the latter asymmetric averaging. To describe asymmetric and symmetric averaging, we first note that the generic Euclidean update rule can be written as a weighted average of the form \[ p' = p - \alpha(p-x) = (1-\alpha)p - \alpha x, \] where $x$ is the current input, $p$ is a prototype to be updated, $p'$ is the updated prototype, and $\alpha = \eta f(p,x)$ is a short-cut notation for the step size. The weighted average as update rule can be directly implemented in DTW spaces in an asymmetric and in a symmetric form. To describe both forms of an average, we assume that $w= (w_1, \ldots, w_L)$ is an optimal warping path between prototype $p$ and input $x$ with points $w_l =(i_l, j_l)$. \medskip \noindent \emph{Asymmetric averaging.} The warping path $w$ aligns every element $p_i$ of prototype $p$ with elements $x_{j+1} \ldots, x_{j+v}$ of input $x$, where $v \geq 1$ is the valency of $p_i$. Then the weighted asymmetric average $p'$ is given by \[ p'_i = (1-\alpha) \cdot v \cdot p_i + \alpha \cdot \args{x_{j_1} + \cdots + x_{j_q}} \] for all time points $i$ of prototype $p$. By construction, the length of $p'$ coincides with the length of $p$. The asymmetric weighted average corresponds to the generic update rule \eqref{eq:generic-DTW-update-rule} in element-wise rather than matrix notation. Asymmetric averages are asymmetric, because the length of a prototype is determined by choosing a reference time axis of predetermined and fixed length. \medskip \noindent \emph{Symmetric averaging.} To average time series independent of the choice of a reference time axis, Kruskal and Liberman \cite{Kruskal1983} proposed symmetric averages. The weighted symmetric average $p'$ is of the form \[ p'_l = (1-\alpha)p_{i_l} + \alpha x_{j_l} \] for all points $w_l = (i_l, j_l)$ of the optimal warping path $w$. The resulting prototype $p'$ has the same length $L$ as the warping path $w$. Repeated updating in symmetric form results in increasingly long prototypes. Somervuo and Kohonen applied an interpolation technique to adjust the length of the prototype $p'$. In doing so, the complete Somervuo-Kohonen update rule is defined by \begin{align*} p'_l = \Pi_m\Big((1-\alpha)p_{i_l} + \alpha x_{j_l}\Big) \end{align*} where $\Pi_m:\S{T} \rightarrow \S{T}_m$ denotes a (possibly non-linear) projection to the subset $\S{T}_m$. The symmetric update rule is generally not based on a subgradient of the distortion. In this sense, symmetric LVQ1 lacks a theoretical underpinning. \section{Experiments} The goal of these experiments is to assess the performance of asymmetric LVQ1 and GLVQ. \subsection{Data} We used $30$ datasets from the UCR time series classification and clustering repository \cite{Chen2015}. The datasets were chosen to cover various characteristics such as application domain, length of time series, number of classes, and sample size (see Table \ref{tab:results}). \subsection{Algorithms} \newcommand{\texttt{1-nn}~}{\texttt{1-nn}~} \newcommand{\texttt{rglvq}~}{\texttt{rglvq}~} \newcommand{\texttt{kmeans}~}{\texttt{kmeans}~} \newcommand{\texttt{slvq}~}{\texttt{slvq}~} \newcommand{\texttt{alvq}~}{\texttt{alvq}~} \newcommand{\texttt{glvq}~}{\texttt{glvq}~} We considered the following nearest neighbor classifiers: \begin{center} \begin{tabular}{l@{\qquad}l@{\qquad}c} \hline Notation & Algorithm & Reference\\ \hline \\[-2ex] \texttt{1-nn}~ & nearest neighbor classifier & traditional\\ \texttt{rglvq}~ & relational generalized LVQ & \cite{Gisbrecht2012}\\ \texttt{kmeans}~ & k-means classifier & \cite{Petitjean2014,Petitjean2016}\\ \texttt{slvq}~ & symmetric LVQ1 & \cite{Somervuo1999} \\ \texttt{alvq}~ & asymmetric LVQ1 & proposed\\ \texttt{glvq}~ & asymmetric generalized LVQ & proposed\\ \hline \end{tabular} \end{center} The codebook of the \texttt{1-nn}~ classifier consists of the entire training set. All other algorithms use one prototype per class to obtain fast NN classifiers. The \texttt{rglvq}~ classifier assumes as input a matrix of pairwise DTW dissimilarities. Then \texttt{rglvq}~ learns prototypes in the dissimilarity space (without Nystr\"om approximation) \cite{Gisbrecht2012}. The \texttt{kmeans}~ classifier refers to the nearest neighbor classifier whose prototypes were learned by using the unsupervised k-means algorithm together with the DBA algorithm for recomputing the centroids \cite{Petitjean2014,Petitjean2016}. The \texttt{slvq}~ method is the symmetric Somervuo-Kohonen extension of LVQ1 to DTW spaces \cite{Somervuo1999}. \subsection{Experimental Protocol} To assess the performance of the nearest prototype classifiers, we conducted ten-fold cross validation and reported the average classification accuracy, briefly called accuracy, henceforth. We preferred cross-validation over hold-out validation via the supplied train-test splits for two reasons: first, to obtain better estimates of the generalization performance; and second, to make sense of data reduction by increasing the size of the training set to $90\%$ of all data. For the \texttt{rglvq}~ classifier, we used the default setting as provided by the publicly available matlab-implementation.\footnote{\url{https://www.techfak.uni-bielefeld.de/~fschleif/software.xhtml} (January 2017).} The default-setting has also been used in experiments and is justified, because \texttt{rglvq}~ is not sensitive to its hyper-parameters \cite{Mokbel2015}. The \texttt{kmeans}~ classifier applied the k-means clustering method to every class separately. Since the codebook of \texttt{kmeans}~ consists of one prototype per class, k-means clustering reduced to averaging warped time series of the same class. For time series averaging, we applied the DBA algorithm \cite{Petitjean2011}. The DBA algorithm terminated latest after $50$ iterations. All non-relational LVQ variants were intialized by the centroids of the \texttt{kmeans}~ classifier and terminated latest after $1,000$ iterations. The hyper-parameters of the LVQ algorithms were selected from \begin{align*} \sigma &\in \cbrace{0.1, 0.5, 1, 5, 10, 25, 50} \\ \eta &\in \cbrace{0.001, 0.0025, 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5}, \end{align*} where $\sigma$ is the initial slope parameter of \texttt{glvq}~ and $\eta$ is the learning-rate of \texttt{slvq}~ and \texttt{alvq}. The learning rate of \texttt{glvq}~ was set to one. The slope parameter was adjusted by $\sigma \cdot t$, where $t$ is the number of epochs. The respective hyper-parameter of a given LVQ algorithm \texttt{A} was selected for the $i$-th fold $\overline{\S{D}}_i$ according to the following procedure: (1) Train \texttt{A} with every hyper-parameter value on the $i$-th training set $\S{D}_i$. (2) Select the trained model with the lowest error rate on training set $\S{D}_i$. (3) Test the chosen model on the $i$-th fold $\overline{\S{D}}_i$. \subsection{Results} \definecolor{crk01}{rgb}{0.25, 1.0, 0} \definecolor{crk02}{rgb}{1.0, 1.0, 0} \definecolor{crk03}{rgb}{1.0, 0.75, 0} \definecolor{crk04}{rgb}{1.0, 0.1, 0} \newcommand{\cellcolor{crk01}}{\cellcolor{crk01}} \newcommand{\cellcolor{crk02}}{\cellcolor{crk02}} \newcommand{\cellcolor{crk03}}{\cellcolor{crk03}} \newcommand{\cellcolor{crk04}}{\cellcolor{crk04}} \begin{table} \centering \begin{tabular}{lr@{\qquad}rrrrrr} \hline \hline Dataset & $N/K$ & \texttt{1-nn}~ & \texttt{rglvq}~ & \texttt{kmeans}~ & \texttt{slvq}~ & \texttt{alvq}~ & \texttt{glvq}~ \\ \hline \\[-2ex] Beef & 12.0 & \cellcolor{crk02} 53.3 & \cellcolor{crk03} 41.7 & \cellcolor{crk03} 43.3 & \cellcolor{crk04} 40.0 & \cellcolor{crk03} 51.7 & \cellcolor{crk01} 63.3\\ CBF & 310.0 & \cellcolor{crk01} 99.9 & \cellcolor{crk03} 93.9 & \cellcolor{crk03} 96.6 & \cellcolor{crk04} 93.6 & \cellcolor{crk03} 96.1 & \cellcolor{crk02} 99.6\\ ChlorineConcentration & 1435.7 & \cellcolor{crk01} 99.6 & \cellcolor{crk03} 45.5 & \cellcolor{crk04} 34.9 & \cellcolor{crk03} 55.0 & \cellcolor{crk03} 56.2 & \cellcolor{crk02} 71.6\\ Coffee & 28.0 & \cellcolor{crk01} 100.0 & \cellcolor{crk03} 96.7 & \cellcolor{crk03} 96.4 & \cellcolor{crk03} 96.4 & \cellcolor{crk03} 96.4 & \cellcolor{crk02} 98.2\\ ECG200 & 100.0 & \cellcolor{crk01} 83.5 & \cellcolor{crk03} 72.0 & \cellcolor{crk03} 71.0 & \cellcolor{crk03} 71.0 & \cellcolor{crk03} 74.5 & \cellcolor{crk02} 80.5\\ ECG5000 & 1000.0 & \cellcolor{crk02} 93.3 & \cellcolor{crk04} 80.8 & \cellcolor{crk03} 83.1 & \cellcolor{crk03} 89.4 & \cellcolor{crk03} 91.1 & \cellcolor{crk01} 94.3\\ ECGFiveDays & 442.0 & \cellcolor{crk01} 99.2 & \cellcolor{crk03} 63.9 & \cellcolor{crk04} 63.0 & \cellcolor{crk03} 72.7 & \cellcolor{crk03} 71.0 & \cellcolor{crk02} 99.1\\ ElectricDevices & 2376.7 & \cellcolor{crk01} 79.2 & \cellcolor{crk03} 63.5 & \cellcolor{crk04} 56.5 & \cellcolor{crk03} 57.4 & \cellcolor{crk03} 64.8 & \cellcolor{crk02} 78.2\\ FaceFour & 28.0 & \cellcolor{crk01} 92.9 & \cellcolor{crk03} 88.4 & \cellcolor{crk04} 86.6 & \cellcolor{crk03} 87.5 & \cellcolor{crk03} 87.5 & \cellcolor{crk02} 92.0\\ FacesUCR & 160.7 & \cellcolor{crk01} 97.8 & \cellcolor{crk04} 82.2 & \cellcolor{crk03} 85.6 & \cellcolor{crk03} 83.3 & \cellcolor{crk03} 85.3 & \cellcolor{crk02} 97.2\\ Fish & 50.0 & \cellcolor{crk02} 80.3 & \cellcolor{crk03} 63.4 & \cellcolor{crk03} 65.1 & \cellcolor{crk04} 63.1 & \cellcolor{crk03} 64.9 & \cellcolor{crk01} 90.9\\ Gun Point & 100.0 & \cellcolor{crk02} 91.5 & \cellcolor{crk04} 46.0 & \cellcolor{crk03} 66.0 & \cellcolor{crk03} 66.5 & \cellcolor{crk03} 69.0 & \cellcolor{crk01} 97.0\\ Ham & 107.0 & \cellcolor{crk02} 72.4 & \cellcolor{crk03} 61.0 & \cellcolor{crk03} 65.0 & \cellcolor{crk04} 60.3 & \cellcolor{crk03} 65.0 & \cellcolor{crk01} 74.8\\ ItalyPowerDemand & 548.0 & \cellcolor{crk01} 95.8 & \cellcolor{crk03} 82.6 & \cellcolor{crk03} 85.0 & \cellcolor{crk04} 77.0 & \cellcolor{crk03} 86.4 & \cellcolor{crk02} 95.3\\ Lighting2 & 60.5 & \cellcolor{crk01} 89.3 & \cellcolor{crk04} 57.1 & \cellcolor{crk03} 64.5 & \cellcolor{crk02} 76.9 & \cellcolor{crk03} 62.0 & \cellcolor{crk03} 76.0\\ Lighting7 & 20.4 & \cellcolor{crk03} 71.3 & \cellcolor{crk02} 79.1 & \cellcolor{crk03} 76.2 & \cellcolor{crk04} 59.4 & \cellcolor{crk03} 79.0 & \cellcolor{crk01} 82.5\\ MedicalImages & 114.1 & \cellcolor{crk01} 80.7 & \cellcolor{crk03} 43.5 & \cellcolor{crk04} 42.8 & \cellcolor{crk03} 53.5 & \cellcolor{crk03} 60.6 & \cellcolor{crk02} 71.7\\ OliveOil & 15.0 & \cellcolor{crk01} 85.0 & \cellcolor{crk04} 81.7 & \cellcolor{crk03} 83.3 & \cellcolor{crk01} 85.0 & \cellcolor{crk03} 83.3 & \cellcolor{crk01} 85.0\\ ProximalPhalanxOutlineAgeGroup & 201.7 & \cellcolor{crk04} 75.5 & \cellcolor{crk01} 85.6 & \cellcolor{crk03} 81.3 & \cellcolor{crk03} 82.2 & \cellcolor{crk03} 82.6 & \cellcolor{crk02} 83.6\\ ProximalPhalanxOutlineCorrect & 445.5 & \cellcolor{crk02} 82.0 & \cellcolor{crk04} 61.1 & \cellcolor{crk03} 63.2 & \cellcolor{crk03} 71.9 & \cellcolor{crk03} 72.3 & \cellcolor{crk01} 85.1\\ ProximalPhalanxTW & 100.8 & \cellcolor{crk02} 77.5 & \cellcolor{crk03} 76.7 & \cellcolor{crk04} 72.2 & \cellcolor{crk03} 76.4 & \cellcolor{crk03} 75.9 & \cellcolor{crk01} 81.2\\ RefrigerationDevices & 250.0 & \cellcolor{crk02} 60.7 & \cellcolor{crk03} 56.7 & \cellcolor{crk04} 54.4 & \cellcolor{crk03} 55.3 & \cellcolor{crk03} 56.7 & \cellcolor{crk01} 62.9\\ Strawberry & 491.5 & \cellcolor{crk01} 96.5 & \cellcolor{crk03} 60.3 & \cellcolor{crk04} 58.8 & \cellcolor{crk03} 74.7 & \cellcolor{crk03} 78.8 & \cellcolor{crk02} 94.1\\ SwedishLeaf & 75.0 & \cellcolor{crk02} 82.0 & \cellcolor{crk03} 68.5 & \cellcolor{crk03} 69.2 & \cellcolor{crk03} 69.6 & \cellcolor{crk04} 68.4 & \cellcolor{crk01} 87.6\\ synthetic control & 100.0 & \cellcolor{crk03} 99.2 & \cellcolor{crk04} 93.5 & \cellcolor{crk02} 99.3 & \cellcolor{crk03} 98.5 & \cellcolor{crk03} 99.2 & \cellcolor{crk01} 99.5\\ ToeSegmentation1 & 134.0 & \cellcolor{crk02} 85.8 & \cellcolor{crk03} 68.7 & \cellcolor{crk03} 73.1 & \cellcolor{crk04} 65.7 & \cellcolor{crk03} 75.8 & \cellcolor{crk01} 92.5\\ Trace & 50.0 & \cellcolor{crk01} 100.0 & \cellcolor{crk04} 95.5 & \cellcolor{crk03} 99.0 & \cellcolor{crk01} 100.0 & \cellcolor{crk03} 99.5 & \cellcolor{crk01} 100.0\\ Two Patterns & 1250.0 & \cellcolor{crk01} 100.0 & \cellcolor{crk03} 99.8 & \cellcolor{crk03} 97.9 & \cellcolor{crk04} 96.9 & \cellcolor{crk03} 98.1 & \cellcolor{crk02} 99.9\\ Wafer & 3582.0 & \cellcolor{crk01} 99.4 & \cellcolor{crk03} 63.2 & \cellcolor{crk04} 45.0 & \cellcolor{crk03} 89.6 & \cellcolor{crk03} 91.7 & \cellcolor{crk02} 96.5\\ Yoga & 1650.0 & \cellcolor{crk01} 93.9 & \cellcolor{crk03} 56.0 & \cellcolor{crk03} 58.5 & \cellcolor{crk04} 55.0 & \cellcolor{crk03} 66.0 & \cellcolor{crk02} 73.2\\ \hline \hline \multicolumn{7}{r}{\footnotesize green: rank 1 --- yellow: rank 2 --- orange: rank 3, 4, 5 --- red: rank 6 } \end{tabular} \caption{Average accuracies of six nearest neighbor classifiers on $30$ datasets using $10$-fold cross validation. The second column $N/K$ roughly shows the average number of elements per class.} \label{tab:results} \end{table} \begin{table} \centering \begin{tabular}{l@{\qquad}rrrrrr@{\qquad}cc} \hline \hline Classifier & \cellcolor{crk01} rank 1 & \cellcolor{crk02} rank 2 & \cellcolor{crk03} rank 3 & \cellcolor{crk03} rank 4 & \cellcolor{crk03} rank 5 & \cellcolor{crk04} rank 6 & avg & std\\ \hline \\[-2ex] \texttt{1-nn}~ & \cellcolor{crk01} 17 & \cellcolor{crk02} 10 & \cellcolor{crk03} 1 & \cellcolor{crk03} 0 & \cellcolor{crk03} 1 & \cellcolor{crk04} 1 & 1.70 & 1.18\\ \texttt{rglvq}~ & \cellcolor{crk01} 1 & \cellcolor{crk02} 1 & \cellcolor{crk03} 5 & \cellcolor{crk03} 2 & \cellcolor{crk03} 13 & \cellcolor{crk04} 8 & 4.63 & 1.33\\ \texttt{kmeans}~ & \cellcolor{crk01} 0 & \cellcolor{crk02} 1 & \cellcolor{crk03} 4 & \cellcolor{crk03} 9 & \cellcolor{crk03} 7 & \cellcolor{crk04} 9 & 4.63 & 1.16\\ \texttt{slvq}~ & \cellcolor{crk01} 2 & \cellcolor{crk02} 1 & \cellcolor{crk03} 2 & \cellcolor{crk03} 11 & \cellcolor{crk03} 5 & \cellcolor{crk04} 9 & 4.43 & 1.43\\ \texttt{alvq}~ & \cellcolor{crk01} 0 & \cellcolor{crk02} 0 & \cellcolor{crk03} 18 & \cellcolor{crk03} 9 & \cellcolor{crk03} 2 & \cellcolor{crk04} 1 & 3.53 & 0.78\\ \texttt{glvq}~ & \cellcolor{crk01} 14 & \cellcolor{crk02} 15 & \cellcolor{crk03} 1 & \cellcolor{crk03} 0 & \cellcolor{crk03} 0 & \cellcolor{crk04} 0 & 1.57 & 0.57\\ \hline \hline \end{tabular} \caption{Rank distribution, average ranks, and standard deviation. The average accuracy of every classifier on a given dataset was ranked, where ranks go from $1$ (highest accuracy) to $6$ (lowest accuracy).} \label{tab:ranks} \end{table} This section presents and discusses the results. Table \ref{tab:results} summarizes the $10$-fold cross validation results of the six classifiers on $30$ datasets. \subsubsection*{General Performance Comparison} To assess the generalization performance of the six classifiers, we compared their average classification accuracies. In an overall comparison, \texttt{glvq}~ was ranked first with average rank $1.57$ closely followed by $\texttt{1-nn}~$ with average rank $1.70$. The other four classifiers were left behind with nearly two- to three-rank gaps (Table \ref{tab:ranks}). The asymmetric LVQ variants \texttt{glvq}~ and \texttt{alvq}~ exhibited the most stable rankings with standard deviation of $0.57$ and $0.78$, resp., whereas the symmetric Somervuo-Kohonen method \texttt{slvq}~ was most unstable with standard deviation $1.43$. To assess the differences in accuracy between the six classifiers, we compared the results of Table \ref{tab:results} in a pairwise manner. The mean percentage difference in accuracy between the two best performing classifiers (\texttt{1-nn}, \texttt{glvq}) and the other four classifiers (\texttt{rglvq}, \texttt{kmeans}, \texttt{slvq}, \texttt{alvq}) ranged from $12.7 \%$ to $22.0 \%$ (Figure \ref{fig:rnk}, right panel). These results show that the accuracies of the two best performing classifiers were substantially higher than the accuracies of the other four classifiers by a large margin. A pairwise comparison of \texttt{1-nn}~ and \texttt{glvq}~ exhibited slight advantages for the \texttt{1-nn}~ classifier. The \texttt{1-nn}~ classifier won more often than the \texttt{glvq}~ classifier ($50 \%$ vs.~$43.4 \%$) but differences in classification accuracy were marginal ($0.3 \%$) on average (Figure \ref{fig:rnk}). The \texttt{1-nn}~ and \texttt{glvq}~ classifier complement each other in the sense that each of both classifiers substantially outperformed the other one on six datasets by more than $10$ percentage points (Table \ref{tab:results}): \begin{enumerate} \itemsep0em \item \texttt{1-nn}~ outperformed \texttt{glvq}~ on \texttt{ChlorineConcentration}, \texttt{Lighting2}, and \texttt{Yoga}. \item \texttt{glvq}~ outperformed \texttt{1-nn}~ on \texttt{Beef}, \texttt{Fish}, and \texttt{Lighting7}. \end{enumerate} The first item suggests that one prototype per class is insufficient for separating the classes of \texttt{Chlorine\-Con\-centration}, \texttt{Lighting2}, and \texttt{Yoga}. The second item indicates that the \texttt{1-nn}~ classifier suffers from noisy training examples that degrade its generalization performance on \texttt{Beef}, \texttt{Fish}, and \texttt{Lighting7}. With regard to computation time, the four prototype generation methods \texttt{kmeans}, \texttt{slvq}, \texttt{alvq}, and \texttt{glvq} are substantially faster than the \texttt{1-nn}~ and \texttt{rglvq}~ classifier. When classifying a test example, computation time is dominated by the number of DTW distance calculations. By construction, the four prototype generation methods computed $K$ distances, where $K$ is the number of classes. In contrast, the \texttt{1-nn}~ and the \texttt{rglvq}~ classifier required $N$ distance computations, where $N$ is the number of training examples. In this study, the average speed-up factor $N/K$ of the four prototype generation methods over \texttt{1-nn}~ and \texttt{rglvq}~ ranged from one to three orders of magnitude (see Table \ref{tab:results} and compute $0.9\cdot N/K$ due to 10-fold cross-validation). The results indicate that \texttt{glvq}~ best traded solution quality against computation time. The solution quality of \texttt{glvq}~ and \texttt{1-nn}~ were comparable, whereas the solution quality of \texttt{rglvq}, \texttt{kmeans}, \texttt{slvq}, and \texttt{alvq} were not competitive. These findings suggest that \texttt{glvq}~ is a suitable alternative in online settings and situations, where storage is limited and short classification times are required. \begin{figure}[t] \centering \begin{tabular}{cc} \textbf{Winning Percentage} & \textbf{Mean Percentage Difference}\\[1ex] \includegraphics[width=0.47\textwidth]{./res_wins.png} & \includegraphics[width=0.47\textwidth]{./res_changes.png} \end{tabular} \caption{Pairwise comparison of results. Left: Pairwise winning percentages $w_{ij}$, where classifier in row $i$ wins $w_{ij}$ percentages of all competitions against the classifier in column $j$. Right: Pairwise mean percentage difference $a_{ij}$ in accuracy, where the accuracy of classifier in row $i$ is $a_{ij}$ percentages better on average than the accuracy of the classifier in column $j$. A definition of both measures is given in Appendix \ref{sec:performance-measures}.} \label{fig:rnk} \end{figure} \subsubsection*{Unsupvervised vs.~Supervised} Compared to other prototype selection and generation methods, the \texttt{kmeans}~ classifier showed convincing results in time series classification \cite{Petitjean2014,Petitjean2016} using a pre-specified train-test split supplied by the contributors of the datasets. To assess the effect of supervised prototype adaption, we compared the classification accuracies of the \texttt{kmeans}~ classifier and the three LVQ classifiers in DTW space (\texttt{slvq}, \texttt{alvq}, \texttt{glvq}). The \texttt{glvq}~ classifier won all competitions against \texttt{kmeans}~ with $21.8$ mean percentage difference in classification accuracy. The other two LVQ methods (\texttt{slvq}, \texttt{alvq}) won more competitions than the \texttt{kmeans}~ classifier with $4.9$ and $9.4$ mean percentage differences in accuracy, respectively (Figure \ref{fig:rnk}). These results suggest that LVQ methods are -- on average -- more suitable prototype generation methods for constructing memory- and time-efficient nearest neighbor classifiers than the \texttt{kmeans}~ classifier. This finding is in line with similar results in Euclidean spaces \cite{Hastie2009}. \subsubsection*{Relational vs.~Non-Relational} To assess the effects of relational vs.~non-relational prototype learning, we compared the results of \texttt{rglvq}~ against the prototype generation methods \texttt{kmeans}, \texttt{slvq}, \texttt{alvq}, and \texttt{glvq}. We made the following observations (Table \ref{tab:ranks} and Figure \ref{fig:rnk}): (i) the \texttt{rglvq}~ classifier was ranked last together with \texttt{kmeans}~ and both classifiers have comparable generalization performance; (ii) all non-relational LVQ performed better than \texttt{rglvq}; (iii) the non-relational \texttt{glvq}~ classifier has substantially higher accuracy than its relational counterpart \texttt{rglvq}~ with mean percentage difference of almost $22 \%$; (iv) all non-relational classifiers were one to three orders of magnitude faster than \texttt{rglvq}~ (cf.~disscussion on general performance comparison). The \texttt{rglvq}~ classifier is neither competitive with \texttt{1-nn}~ and also seems to be less suited for improving storage and computational requirements of the naive NN method. In all cases, \texttt{rglvq}~ retained the entire training set in order to embed a new test example into the pseudo-Euclidean space. Techniques such as the Nystr\"om approximation can considerably improve storage and computation requirement but may compromise solution quality \cite{Gisbrecht2012,Mokbel2015}. These findings suggest that prototype learning in DTW spaces should be preferred over relational prototype learning in a pseudo-Euclidean space. \subsubsection*{Symmetric LVQ1 vs.~Asymmetric LVQ1} To assess the effects of the different types of update rules on the generalization performance, we compared the classification accuracies of \texttt{slvq}~ against \texttt{alvq}. In an overall comparison, the average rank of \texttt{alvq}~ was almost one rank better than the average rank of \texttt{slvq}~ ($3.53$ vs.~$4.43$, Table \ref{tab:ranks}). The rankings of \texttt{alvq}~ were more stable than the rankings of \texttt{slvq}, which was the most unstable classifier (std $0.78$ vs.~std $1.43$, Table \ref{tab:ranks}). Consequently, \texttt{alvq}~ was ranked last only once, whereas \texttt{slvq}~ was ranked last $9$ times. Finally, in a pairwise comparison, \texttt{alvq}~ won $73.3 \%$ of all competitions against \texttt{slvq} with $4.5$ mean percentage differences in accuracy (Figure \ref{fig:rnk}). These results indicate that the asymmetric update rule of LVQ1 gives better and more stable results on average than its symmetric counterpart. These findings are in line with similar results on estimating the sample variance of a set of time series using symmetric and asymmetric averaging of time series in DTW spaces \cite{Petitjean2011,Soheily-Khah2015}. As pointed out in \cite{Schultz2017}, the reason for unstable and less accurate results of \texttt{slvq}~ can be due to the projection step that may displace centroids in an uncontrolled manner. Nevertheless symmetric averaging can but need not have negative effects as shown by the results of \texttt{slvq}~ obtained on \texttt{Lighting2}, \texttt{OliveOil}, and \texttt{Trace}. \subsubsection*{Varying the Number of Prototypes} \begin{figure}[t] \centering \begin{tabular}{cc} \includegraphics[width=0.45\textwidth]{./res_k_chlorine.png} & \includegraphics[width=0.45\textwidth]{./res_k_ecg200.png}\\ \includegraphics[width=0.45\textwidth]{./res_k_ham.png} & \includegraphics[width=0.45\textwidth]{./res_k_lighting2.png}\\ \includegraphics[width=0.45\textwidth]{./res_k_medical.png} & \includegraphics[width=0.45\textwidth]{./res_k_proximal.png}\\ \includegraphics[width=0.45\textwidth]{./res_k_yoga.png} & \raisebox{0.6cm}[1mm][1mm]{\includegraphics[width=0.3\textwidth]{./res_k_legend.png}}\\ \end{tabular} \caption{Accuracy of $10$-fold cross validation as a function of the number $k$ of prototypes per class.} \label{fig:res_k} \end{figure} To compare the dependence of the classification accuracy of \texttt{glvq}~ and \texttt{kmeans}~ on the number $k$ of prototypes per class, we considered seven difficult datasets for which the error rate of \texttt{glvq}~ was higher than $10\%$ for $k = 1$. We used the same experimental protocol as before. Figure \ref{fig:res_k} summarizes the results. The main observation is that a careful selection of a small number $k$ of prototypes per class was sufficient for \texttt{glvq}~ to approach or even outperform the classification accuracy of the \texttt{1-nn}~ classifier. We could not confirm this finding for the \texttt{kmeans}~ classifier. The second observation is that \texttt{glvq}~ performed consistently better than \texttt{kmeans}~ for all $k$ and all seven datasets. These findings suggest that \texttt{glvq}~ is a substantially more efficient alternative to the \texttt{1-nn}~ classifier and is capable to maintain or even surpass the high classification accuracy often achieved by \texttt{1-nn}. \section{Conclusion} In this article, we presented a generic scheme to extend LVQ methods to DTW spaces. The generic update rule applies asymmetric averaging of warped time series. The asymmetric rule implements stochastic subgradient updating, which places the proposed LVQ scheme on an analytical foundation. Empirical results show that asymmetric GLVQ performed best compared to other state-of-the-art prototype generation methods by a large margin. In addition, we found that asymmetric LVQ1 is more stable and has higher generalization performance than its symmetric counterpart. As in Euclidean spaces, the non-relational supervised prototype generation methods outperformed the unsupervised k-means algorithm. The generalization performance of relational GLVQ is comparable with k-means. The results suggest that asymmetric GLVQ is a strong candidate for nearest neighbor classification in online settings and in situations where computation time and storage demands are an issue. The generic LVQ update rule can serve as a blueprint for directly extending unsupervised prototype learning methods to DTW spaces in a principled way, such as vector quantization, self-organizing maps, and neural gas. Finally, future work aims at studying the theoretical properties of asymmetric LVQ in DTW spaces. \paragraph*{\textbf{Acknowledgements}.} B.~Jain was funded by the DFG Sachbeihilfe \texttt{JA 2109/4-1}. \begin{small}
{'timestamp': '2017-03-27T02:07:12', 'yymm': '1703', 'arxiv_id': '1703.08403', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08403'}
arxiv
\section{Introduction} The quality of identified models depends to a large extent on the experimental conditions under which the measurement data for these models are obtained. Therefore, experiment design is an important step in the identification process. This was recognized in the early days of the development of system identification theory, where significant attention was paid to the design of optimal experiments for the parametric identification of linear time-invariant systems. The focus was on the design of optimal inputs that maximize some scalar function of the Fisher information matrix under a constraint on the power of the input signal \cite{Federov1972,Goodwin&Payne1977}. The motivation is that if the parameter estimator is asymptotically efficient, then its covariance matrix converges to the inverse of the Fisher information matrix. \\ For linear stationary systems operating in open loop, the Fisher Information matrix is an affine function of the input spectrum. Therefore, the optimization is performed by first computing the optimal input spectrum, and then constructing an input signal for the experiment that realizes this optimal input spectrum \cite{Federov1972,Goodwin&Payne1977}. \\ The development of identification for control, and more generally of application-oriented identification \cite{Hjalmarsson:09}, together with the advent of powerful semi-definite programming tools, gave rise to novel optimal experiment design techniques for linear time-invariant systems. Experiment design methods were developed for closed-loop identification with a fixed controller \cite{Jansson&Hjalmarsson:05} as well as for closed-loop identification with a ``to be designed controller'' \cite{Hildebrand&Gevers&Solari:15}, and for an ever wider range of possible design criteria and constraints. In addition, the dual problem of least costly identification was addressed, where the design aims at minimizing the cost of the identification experiment (say, in terms of the input signal energy used) subject to a constraint on the achieved model quality \cite{Bombois&Scorletti&Gevers&Vandenhof&Hildebrand:06}. A survey of these results can be found in \cite{Gevers&Bombois&Hildebrand&Solari:11}. \\ For linear time-invariant systems, the solution of these optimal experiment design problems consists of first expressing the criterion and the constraints in terms of a finite parametrization of the input spectrum (in the case of open loop design) or of the joint input-output spectrum (in the case of closed loop design), and reducing the problem into a convex optimization problem under Linear Matrix Inequality (LMI) constraints over these parameters. This yields an optimal spectrum. The second step then consists of constructing a stationary signal that has this desired spectrum. A few results have also been developed where the optimization is performed directly with respect to the input samples of the signal in time-domain; see e.g. \cite{Cooley&Lee:01}. \\ Optimal experiment design for nonlinear systems is considerably more difficult, because the criterion is typically non-convex, making global optimization more difficult, if not impossible. The main difficulty is that the Fisher information matrix of the experiment is not only dependent on the second order moments of the input but also on higher order moments \cite{Hjalmarsson2007}. Thus, optimal input design (OID) results for nonlinear systems have so far been obtained only for simple design criteria in the form of scalar functions of the information matrix, and by restricting both the class of systems and the class of input signals. \\ One subclass of nonlinear systems for which a number of OID results have been obtained is the class of nonlinear finite-impulse-response-type (FIR-type) systems. Constructing an OID for an example system out of this class was performed for Gaussian signals in \cite{MichelGevers2012} and for deterministic signals taking only a finite number of possible values in \cite{DeCock2013}. The restriction to such multilevel excitation signals is actually common to almost all recent results on OID for classes of nonlinear systems. In \cite{Larsson2010} a solution is proposed for nonlinear FIR systems using a probabilistic parametrization of the multilevel input signals, while in \cite{Forgione2014} these results are extended to systems with fading memory using deterministic multilevel input signals which are then characterized by the relative frequency of each possible subsequence. A common feature of these results is the adoption of a linear parametrization of the probability distributions, respectively the relative frequencies, of the input signals, leading to a convex formulation of the optimization criterion. \\ The difficult step in all OID methods for classes of nonlinear systems proposed so far is to go from the optimal distributions (or optimal relative frequencies) to the generation of a realizable input sequence. A solution based on graph-theoretical properties has recently been proposed in \cite{Patricio_Automatica}: realizable input sequences are obtained by first computing the elementary cycles of the associated graph, which define a convex polyhedron. As we shall see, a significant part of the present paper is devoted to this problem of signal generation; it is also based on properties of the associated graph. By imposing additional symmetry constraints on the admissible subsequences, we propose a suboptimal solution that is computationally cheaper than the solution based on elementary cycles described in \cite{Patricio_Automatica}. Additionally, we show that the optimization time for our solution compares favorably with that of a general purpose convex optimizer cvx. \\ Methods considering a wider class of nonlinear systems also exist. For example in \cite{Gopaluni2011} a particle filter approach for the general class of nonlinear systems is presented, while \cite{Vincent2010} presents an OID for a block structured nonlinear model consisting of linear dynamic and nonlinear static blocks. However, unlike the design methods for nonlinear FIR-type systems, these methods do not result in a convex optimization problem and can therefore not guarantee convergence to a global optimum. \\ To conclude this general introduction, let us mention that OID for nonlinear systems is particular interesting in fields where the cost of single experiment is very high. Examples of practically applied OID for nonlinear systems can be found in the field of (bio)chemistry \cite{Telen2014}, cellular biology \cite{Dinh2014} and medicine \cite{Galvanin2009}. An extensive overview of the current state-of-the-art can be found in \cite{Franceschini2008}. \emph{Contribution and relation with other work}\\ This work is restricted to nonlinear FIR-type systems of memory length $n$, whose inputs are \emph{deterministic} input sequences of length $n$, of which the sample values $u(t)$ can only take a finite set of possible values: $\{ u_1 , . . . , u_A \}$. Therefore each output sample of the system depends on a subsequence $(u(t),u(t-1),...u(t-n+1))$ of the input sequence, and the total number of different subsequences that can be presented to the system is limited to a finite set of $A^n$ possible sequences. The Fisher information produced by a given input sequence is therefore completely determined by the subsequences it contains. For each input sequence of length $N$ we can define a corresponding \emph{frequency vector} that indicates how many times each subsequence is present in the sequence. It will then be shown that the Fisher information matrix can be written as a convex combination of $A^n$ elementary Fisher information matrices, where the coefficients are the relative frequencies that indicate how many times each subsequence appears in the input. \\ Different scalar functions can now be used as measure of information. As long as it is a matrix nondecreasing function \cite{Boyd2004} the problem remains convex and the global optimum can be computed. In this paper we consider D-optimal designs, meaning that the determinant of the Fisher Information matrix is maximized. In addition we have opted for a dispersion-based method, which was already successfully applied in the linear case \cite{Schoukens&Pintelon1991}. Advantages of this method are its intuitive interpretation, straightforward implementation and monotonic convergence to the global minimum. In addition we will illustrate with a short numerical example that the dispersion algorithm can compete with general purpose convex optimizers like cvx \cite{cvx} in terms of computation time. \\ The minimization of the maximum of the dispersion function yields an \emph{optimal relative frequency vector}. As already explained, this optimal frequency vector may not correspond to a realizable time sequence. To alleviate this problem, constraints need to be incorporated into the optimization problem. The space of frequency vectors which satisfies these constraints forms a polyhedron \cite{Patricio_Automatica}. This allows one to represent every frequency vector in the search space as a convex combination of a set of corner points. Unfortunately, computing this set of corner points is numerically expensive. Therefore, an alternative way that approximates this set is proposed in this paper. It is based on restricting the search space to a constrained set of non-overlapping symmetric frequency vectors. \\ Once a realizable and optimal frequency vector is found, a time sequence satisfying this design needs to be derived. To this end a graph-based method was suggested in \cite{Larsson2010} and later elaborated in \cite{Patricio_Automatica} for stochastic input sequences. In this work a similar graph-based method is presented for deterministic input sequences. The problems addressed in this paper have close connections with those addressed in \cite{Larsson2010,Patricio_Automatica} and \cite{Forgione2014}. The main difference with \cite{Larsson2010,Patricio_Automatica} lies in the fact that in these papers stochastic inputs are considered and that the problem is parametrized with respect to the probability density of the subsequences, instead of their relative frequency. While this makes little difference when it comes to the numerical computation of the designs, the interpretation of the results is quite different. Moreover, in \cite{Patricio_Automatica} no relation was made between the memory of the system and the length of the subsequences used in the input generation method. We study this relation in Section \ref{app}, where we show that the designed input is only optimal if both memories are equal. If the memory of the generation method is shorter than the memory of the system, the search space becomes too restrictive. If the memory of the generation is chosen longer, the same results are obtained but at a higher computational cost. \\ In \cite{Forgione2014} an optimal deterministic input is computed for the class of fading memory nonlinear systems. However, unlike this paper, no sequence generation method was presented in \cite{Forgione2014}. \\ In addition to the use of a simple dispersion-based criterion, the use of an alternative search space spanned by a non-overlapping symmetric set that considerably reduces the computation time, another novel contribution of this paper is the discussion of the interaction between the system memory and the subsequence length. \emph{Overview}\\ The paper is structured as follows. Section \ref{sec:Problem} formalizes the optimal input design problem for the considered class of systems. Section \ref{sec:Solution} shows how the associated optimization problem can be solved based on the dispersion function. In Section \ref{sec:Signal} the problem of signal generation is considered, and a graph-based method is proposed. Section \ref{sec:Constraint} discusses how the constraints needed for signal generation can be incorporated into the optimization. Section \ref{sec:Example} illustrates our method on a numerical example. In Section \ref{sec:complexity} the computation time of the dispersion-based method is compared with cvx. In Section \ref{app} we motivate why the subsequence length should be chosen equal to the memory length of the system. Section \ref{sec:Conclusion} summarizes the obtained results. \section{Problem Statement} \label{sec:Problem} The goal of this paper is to find the most informative input of given length $N$ for a nonlinear FIR-type system (as defined in Assumption 1 below) with a known model structure, and disturbed with independent Gaussian output noise. As a measure of information the determinant of the Fisher information matrix is considered. Therefore the design is called D-optimal. When the parameters are identified with such an input sequence, and the estimator is assumed efficient, the volume of the uncertainty ellipse in the parameter space is minimal \cite{Federov1972}. The following assumptions describe this problem formally. \begin{assumption} \label{ass:systemclass} The considered system is a member of the class of nonlinear FIR-type systems with memory length $n$ and which are differentiable with respect to the parameters of the system. This model class was first studied in \cite{Larsson2010} in the context of optimal input design. \begin{equation} \label{modelclass} y_0(t,\theta)=G_{NL}(u_0(t),u_0(t-1),..,u_0(t-n+1),\theta) \end{equation} where $u_0(t)$ is the noiseless input, $y_0(t,\theta)$ is the noiseless output, $\theta \in \mathbb{R}^{N_{\theta}}$ are the parameters of the model. Notice that the output at time $t$ only depends on the current input sample and $n-1$ previous input samples. \\Additionally it is assumed that the system is identifiable with respect to the parameters, meaning that there exists an input sequence $u(1),\ldots, u(N)$ such that the outputs $\{y_0(t,\theta), t=1,\ldots,N\}$ and $\{y_0(t,\theta_1), t=1,\ldots,N\}$ of the corresponding models (\ref{modelclass}) are identical only if ~$\theta_1=\theta$. \end{assumption} \begin{assumption} The class of inputs will be restricted to deterministic time sequences with a length of $N$ samples, whose amplitude can only take values from a finite, predefined set of $A$ values: \vspace{-2mm} \begin{eqnarray} \forall t:~ u(t)\in \{u_1,...,u_A\} \end{eqnarray} \end{assumption} \begin{assumption} \label{ass:noise} The output $y(t)$ of the true system is obtained as the sum of a noise-free output $y_0(t,\theta_0)$ defined by (\ref{modelclass}) with a ``true'' parameter vector $\theta_0$ and some additive independent identically distributed (i.i.d) Gaussian noise $e(t)$. The noise is also independent of the input signal $u_0$. \vspace{-2mm} \begin{eqnarray} \nonumber u(t)&=&u_0(t) \\ \nonumber y(t)&=&y_0(t,\theta_0)+e(t)\\ \nonumber e(t) &\sim& N(0,\sigma^2) \nonumber \end{eqnarray} \end{assumption} {\bf Criterion} \label{ass:criterion} The D-optimality criterion is used, which means that the optimal input sequence $u_{opt}$ of length $N$ corresponds to the sequence for which the determinant of the information matrix $M$ is maximal: \vspace{-2mm} \begin{eqnarray*} u_{opt}&=&\arg\limits_{u}\max(\mathrm{det}(M)) \end{eqnarray*} \begin{remark} Since the noise variance $\sigma^2$ only scales the Fisher information matrix, it will not alter the optimal input design. \end{remark} Given the noise assumption, $M$ can be computed based on the time domain data as (see \cite{SIFDA}): \begin{eqnarray} \label{eq:Fisher} M&=& \frac{1}{\sigma^2} \left( \frac{\partial y_0}{ \partial \theta} \right)^T \left( \frac{\partial y_0}{ \partial \theta} \right) \end{eqnarray} where $\frac{\partial y_0}{\partial\theta}$ is a $N \times N_{\theta}$ matrix containing the partial derivatives of $y_0$, and $V^T$ stands for the transpose of $V$. \begin{remark} For the computation of the optimal input, it will be assumed that the true parameters of the system, $\theta_0$, are known. While this may seem in contradiction with the final goal of system identification it is a standard assumption in the field of optimal input design \cite{Federov1972}. \end{remark} \section{Problem Solution} \label{sec:Solution} In order to solve the D-optimal input design problem, as presented in the previous section, three important steps will be made. First, the concept of the $n$-length subsequences is formally introduced. Second, it will be shown that the Fisher information matrix can be expressed as a weighted sum of the Fisher matrices associated to each subsequence. This property is the key to solve the optimization problem efficiently. Third, it will be shown how the problem can be solved with a dispersion-based method similar to the one used in the linear case, as described in \cite{Goodwin&Payne1977,Schoukens&Pintelon1991}. \subsection{Subsequences} Considering the system model, it is clear that each output sample of the system depends only on a subsequence $(u(t),u(t-1),...u(t-n+1))$ of the input sequence. \begin{definition} A subsequence is an ordered set of $n$ values each, of which is drawn out of the predefined set $\left\{u_1,u_2,...u_A\right\}$. In total $A^n$ different subsequences can be defined. The space that contains all possible subsequences will be called $C \in \left\{ \mathbb{R}^n \right\}^{A^n}$. \end{definition} \begin{notation} \label{notation1} Each index set $(i_1,...,i_n)$ with $i_1,i_2,...i_n \in \left\{1,2,..,A\right\}$ can be made to correspond to a unique integer index $k$ defined as follows: \vspace{-2mm} \begin{eqnarray} k \stackrel{\Delta}{=} i_{1}+\sum_{k=2}^{n}(i_{k}-1) \cdot A^{(k-1)} \label{eq:c} \end{eqnarray} Notice that $(i_n,i_{n-1}, ...,i_1)$ is the representation of $k$ in base $A$, that $k$ ranges from $1$ to $A^n$, and that (\ref{eq:c}) defines a one-to-one mapping between $k$ and the index set $(i_1,i_2,...,i_n)$. Thus, the mapping (\ref{eq:c}) establishes the equivalence: \begin{equation} k \Longleftrightarrow (i_1,i_2,...,i_n) \label{equivalence} \end{equation} In the remainder of the paper we use indistinctly the notation $f(i_1,i_2,...,i_n)$ or $f(k)$ for a function $f(.)$ of the index set, where $k$ and $(i_1,i_2,...,i_n)$ are related by (\ref{eq:c}). \end{notation} \begin{notation} \label{notation2} In order to be able to refer to a specific subsequence from $C$, the following notation is introduced: \begin{eqnarray}\label{Cnsubsequence} c(i_1,i_2,...,i_n)&=&(u_{i_{1}},u_{i_{2}},...,u_{i_{n}}) \nonumber \\ \forall i_1,i_2,...i_n &\in& \left\{1,2,..,A\right\} \nonumber \end{eqnarray} Applying the mapping introduced in Notation \ref{notation1}, leads to the following shorthand notation $ c(k) \stackrel{\Delta}{=} c(i_1,i_2,...,i_n)$. \end{notation} \subsection{Fisher information and frequency vector} From (\ref{eq:Fisher}) it is clear that the $ij^{th}$ element of the Fisher information matrix can be written as a sum over the time samples: \begin{eqnarray} \label{eq:timesum} ~M(i,j)=\frac{1}{\sigma^2}\sum_{t=1}^{N}{f_{i,j}(t,u,\theta)} \end{eqnarray} where the function $f_{i,j}(t,u,\theta)$ corresponds to the product of the partial derivatives of $y_0$ with respect to the $i^{th}$ and $j^{th}$ parameter, evaluated at time instant $t$ for a given input sequence $u$. \\Because the model class was restricted to FIR-type systems the functions $f_{i,j}$ depend at most on $n$ successive input values. \begin{eqnarray} f_{i,j}(t,u,\theta)=f_{i,j}(u(t),u(t-1),...u(t-n+1)),\theta) \end{eqnarray} In other words, the function $f_{i,j}(t,u,\theta)$ depends on the subsequence that ended at time t. \begin{remark} \label{re:periodicity} Notice that the first $n-1$ terms depend upon samples which are not measured. Their value is set by the initial conditions. It will be assumed that the signal is periodic with period $N$. This allows us to determine the values of these unknown samples. \end{remark} Since the number of possible subsequences is fixed, the number of different terms in (\ref{eq:timesum}) is also fixed. If we compute the values of $f_{ij}$ for each possible subsequence we can reorder the sum over time such that we obtain a weighted sum over all possible subsequences: \begin{eqnarray} \label{eq:Fi_rearranged} M(i,j)&=&\frac{1}{\sigma^2}\sum_{k=1}^{A^n}{\xi_N(k) \cdot f_{i,j}(c(k),\theta)} \nonumber\\ &=& ~\sum_{k=1}^{A^n}{\xi_N(k)M_k(i,j)} \label{eq:sumOversubsequences} \end{eqnarray} The weight $\xi_N(k)$ indicates how often the subsequence $c(k)$ occurs in the sequence $u(t)$ and is therefore called the frequency of the sequence $c(k)$. From (\ref{eq:Fi_rearranged}) it is clear that the Fisher information matrix for a given input sequence $u$ is completely determined by the subsequences that $u$ contains. \begin{definition} The Fisher information matrix $M_k$ corresponding to the $k^{th}$ subsequence will be called the $k^{th}$ elementary Fisher matrix: \begin{eqnarray} \label{definfom} M_k(i,j)=\frac{1}{\sigma^2}\left( \frac{\partial y_0}{ \partial \theta_i} \right)^T\left( \frac{\partial y_0}{ \partial \theta_j} \right)|_{c(k)} \end{eqnarray} where the partial derivatives are evaluated for the subsequence $c(k)$. \end{definition} \begin{definition} The vector $\xi_{N}(\cdot)\in\mathbb{N}^{A^n}$, containing the number of times each subsequence occurs in the input design, is called the frequency vector of the design. \end{definition} \begin{remark} Given a time sequence $u(t)$, the corresponding frequency vector can be obtained by counting the number of times each subsequence occurs in the signal $u(t)$. The subsequences are counted as depicted in Fig.\ref{fig:tupcount}. Notice that a signal with N samples contains N subsequences, due to the assumed periodicity of the signal (see Remark \ref{re:periodicity}). \end{remark} \begin{figure} [thpb] \centering{ \includegraphics[scale=1.0]{\string"Figures/tuple_counting\string".pdf} } \caption{Example of how the subsequences are counted in the case of a FIR-type system with $n=3$ and two amplitude values $\{u_1,u_2\}$. x represents an unknown sample which should be resolved by the chosen initial conditions.} \label{fig:tupcount} \end{figure} Normalizing (\ref{eq:sumOversubsequences}) by the number of subsequences allows us to rewrite the normalized Fisher information matrix as a convex combination of the elementary matrices with the relative frequencies as convex coefficients: \begin{eqnarray} \label{Mdecomp} \frac{M(\xi_N)}{N}&=&\sum_{k=1}^{A^n}{\xi(k).M_k} \end{eqnarray} Notice that only the coefficients $\xi(k)$ depend upon the particular design used in the input $u(t), t=1,\ldots, N$. The elementary information matrices $M_k$ are independent of the design and can be computed a priori given the amplitude set $A$ and the memory $n$ of the FIR type nonlinear system. \begin{definition} The frequency vector divided by the total number $N$ of subsequences in the design is called the relative frequency vector $\xi(\cdot)\in\mathbb{R}_+^{A^n}$. By construction the normalized frequencies have the properties of convex coefficients, meaning that their values range from 0 to 1 and that their sum is exactly one: \begin{eqnarray} \label{eq:convexCoeff} &&~~~~~\forall k: ~~~~ \xi(k)=\xi_N(k)/N \nonumber \\ &&~~~~\xi(k) \in [0,1] ~~~ \mbox{and} ~~~ \sum^{A^n}_{k=1} \xi(k)=1 \end{eqnarray} \end{definition} \begin{remark} By performing the optimization for the relative frequency vector $\xi$, we relax the problem by making the search space continuous. However, the frequency vector $\xi_N$ can only contain natural numbers. So, after denormalizing the frequency vector, the values will be rounded to the nearest natural number. This may cause a slight decrease in information. \end{remark} Computing an optimal experiment consists of finding the vector $\xi$ that maximizes the determinant of the normalized information matrix: \begin{eqnarray*} \xi_{opt}&=& \arg\limits max_{\xi}(det(\frac{M(\xi)}{N})) \end{eqnarray*} \subsection{Dispersion function} In the previous subsection it was shown that the normalized Fisher information matrix can be rewritten as a convex combination of known elementary information matrices. We now show that this allows us to use a dispersion-based method in order to perform the optimization. Instead of solving the optimization problem directly, an equivalent problem is solved where the maximum of an auxiliary function, called the {\it dispersion function}, is minimized. The dispersion function, also called {\it response dispersion}, was introduced in the experiment design for identification arena in \cite{Goodwin&Payne1977}. \begin{definition} With the notations introduced above, the dispersion function $v(.,.)$ is defined as: \vspace{-2mm} \begin{eqnarray} v(\xi,k)=\mathrm{trace}(M(\xi)^{-1}\cdot M_k) \label{eq:Dispersion} \end{eqnarray} where $M(\xi)$ is the information matrix computed for the given design $\xi$, and $M_k$ is the information matrix corresponding to the $k^{th}$ subsequence. \end{definition} Some useful properties of the dispersion function are \cite{Goodwin&Payne1977}: \vspace{-2mm} \begin{itemize} \item The maximal value of the dispersion can never be smaller than the number of independent parameters in the model $N_\theta$. \item For any design $\xi$, the inner product $\sum_{k=1}^{A^n}{v(\xi,k) \cdot \xi(k)}$ equals the number of free parameters in the model. \item The dispersion function can also be interpreted as a normalized variance of the estimated model. \end{itemize} \begin{theorem} \label{theo:dispersion} The following characterizations of an optimal design are equivalent: \vspace{-2mm} \begin{enumerate} \item $\xi_{opt}~$ maximizes $~\mathrm{det}(M)$ \item $\xi_{opt}~$ minimizes $~~\mathrm{max_{k}} v(\xi,k)$ \item $~\mathrm{max_{k} }v(\xi_{opt},k)=N_{\theta}$ \end{enumerate} where $N_{\theta}$ is the number of independent parameters in the model.\\ {\bf Proof:} see \cite{Goodwin&Payne1977} Chapter 6, page 147. \end{theorem} Theorem \ref{theo:dispersion} states that the design that maximizes the determinant of the Fisher information matrix is the same design that minimizes the maximum of the dispersion function. Since a simple and efficient algorithm exists that solves the latter problem, we shall adopt it for the computation of our optimal experiment. \subsection{Optimization Algorithm} \label{subsec:optimization} In \cite{Schoukens&Pintelon1991} a simple and stable, monotonically converging algorithm is presented, which finds the design that minimizes the maximum of the dispersion function. This algorithm can be summarized in four steps: \vspace{-2mm} \begin{enumerate} \item Initialize with a uniform design: $\xi(k)=1/A^n$ \item Compute the dispersion function $v(\xi,k)$ for the current design using (\ref{eq:Dispersion}) \item Update the design in accordance with the dispersion function as follows $\xi_{new}(k)=\frac{v(\xi, k)}{A^n}.\xi_{old}(k)$ \item Stopping criterion: if $(\mathrm{max_k}v(\xi_{new},k)-N_{\theta})$ is smaller than a predefined threshold, the optimal solution is assumed to be found; else go to step 2. \end{enumerate} \vspace{-2mm} The stopping criterion is based on the third expression of Theorem 1. The monotonic convergence of the algorithm is proven in \cite{Yaming2010}. In Section~\ref{sec:complexity} the performance of this dispersion-based algorithm will be compared to the general purpose convex optimizer cvx. \begin{remark} Notice that once a particular frequency $\xi(k)$ becomes zero for some $k$, this frequency remains zero for all subsequent iterations. Therefore, the computational speed of the algorithm can be improved by only updating the nonzero frequencies. This avoids unneeded evaluations of the dispersion function. \end{remark} \section{Signal Generation} \label{sec:Signal} The optimal frequency vector $\xi_{N,opt}$ can be interpreted as an experiment of $N$ measurements, where each measurement consists of applying a single subsequence to the system and measuring the corresponding output sample. \\A naive way to perform the optimal design is to concatenate all the subsequences contained in $\xi_{N,opt}$ (i.e. all the subsequences $c(k)$ for which $\xi_{N,opt}(k) \neq 0$), and only measure the output samples which correspond to these subsequences. This means that a signal with $nN$ samples is used at the input, in order to collect $N$ samples at the output. Clearly this is not an efficient approach, since only $N$ out of the $nN$ output samples are used for parameter estimation. \\It would be better to generate a periodic input sequence with a period length of $N$ samples, containing the $N$ needed subsequences. However, not every frequency vector has a corresponding input sequence of length $N$ because the $n-1$ last inputs of subsequence $c(k)$ for which $\xi_{opt}(k)\neq 0$ may not correspond to the $n-1$ first inputs of another subsequence $c(j)$ for which $\xi_{opt}(j)\neq 0$. In order to derive conditions on the frequency vector which guarantee the existence of at least one realizable time sequence, a sequence generation method will be introduced. This generation method will correspond with a path through the associated graph of the frequency vector. \begin{definition} Given a subsequence of length n, the right subsubsequence is defined as the subsequence of length n-1 obtained by removing the first element of the original subsequence. Similarly, the left subsubsequence is defined as the subsequence of length n-1 obtained by removing the last element of the original subsequence. \end{definition} \begin{definition} The graph associated with a frequency vector $\xi_N$ (see Notation \ref{notation1}) is defined as follows: \begin{itemize} \item The graph contains $A^{n-1}$ nodes, each containing a different subsubsequence of length n-1 \item Each subsequence of length n corresponds to a directed edge connecting its left and right subsubsequence. The edge starts in the left subsubsequence and ends in the right one. \item Each edge has a multiplicity which corresponds to the subsequence frequency $\xi_N(i_1,\ldots,i_n)$ of its corresponding subsequence. \end{itemize} \end{definition} \begin{example} Consider a FIR-type system with $n=3$ and two amplitude levels $\{u_1,u_2\}$. In total $2^{(3-1)}$ different subsubsequences of length n-1 can be defined. So the associated graph contains four nodes. Additionally $2^{3}$ different subsequences of length n can be defined. This means that the graph contains eight edges. For example, the edge corresponding to the subsequence $u_1u_1u_2$ connects its left subsubsequence $u_1u_1$ with its right subsubsequence $u_1u_2$. The multiplicity of the edge connecting $u_1u_1$ with $u_1u_2$ equals its frequency $\xi_N(1,1,2)$. If this reasoning is repeated for every subsequence, the graph in Fig.\ref{fig:graph} is obtained. \begin{figure} [thpb] \begin{center} \includegraphics[scale=1.0]{\string"Figures/graph_3tap_2levels\string".pdf} \caption{Associated graph in the case of $n=3$ and two amplitude values} \label{fig:graph} \end{center} \end{figure} \end{example} If there exists a time sequence corresponding to the frequency vector $\xi_N$, then this sequence can be obtained by the following steps: \vspace{-2mm} \begin{enumerate} \item Construct the graph associated with the frequency vector $\xi_N$ \item Find a path, starting from an arbitrary node, that uses each edge exactly as many times as its multiplicity indicates. \item For every edge in the path, add the last amplitude value of the corresponding subsequence to the end of the input sequence. \end{enumerate} From the above, it can be concluded that a time sequence exists if there exists a path, starting from an arbitrary node, that uses each edge exactly as many times as its multiplicity indicates. In graph theory such a path is called an Euler cycle. Some well known algorithms for finding the Euler cycle (if it exists) are the algorithm of Fleury \cite{Fleury1883} and the algorithm of Hierholzer. More recent versions of these algorithms can be found in any textbook on graph theory \cite{GraphRef}. \\In order for an Euler cycle to exist, the associated graph can not be disjoint and all vertices need to have a zero degree, which means the sum of multiplicities for all outgoing edges minus the sum of multiplicities for all incoming edges needs to be zero. \begin{theorem} A periodic time sequence exists that realizes a prescribed frequency vector $\xi_N$ only if its associated graph is not disjoint and the frequency vector satisfies the following conditions: \begin{eqnarray} \label{eq:Constraint} \forall i_{1},i_{2},...,i_{n-1} &\in& \{1,...,A\} \nonumber \\ \sum_{j=1}^{A}\xi_N(j,i_{1},...,i_{n-1})&=&\sum_{j=1}^{A}\xi_N(i_{1},...,i_{n-1},j) \end{eqnarray} or equivalently, using the scalar index $k$ rather than the vector index $(i_1, \ldots, i_n)$, as defined in Notation 1: \begin{eqnarray} \forall m \in [1, \ldots, A^{n-1}]:&& \nonumber\\ \sum_{j=1}^{A}\xi_N(j+(m-1)A)&=&\sum_{j=1}^{A}\xi_N(m+(j-1)A^{n-1}) \label{equivconstraint} \end{eqnarray} \noindent {\bf Proof:} A time sequence has the correct frequency vector $\xi_N$ if a path can be constructed from the associated graph whereby each edge is used exactly as many times as its multiplicity indicates. In order for such a path to exist, the sum of the multiplicities of the outgoing and incoming edges need to be equal in every node, where each node is defined by a $(n-1)$ vector index $(i_1, \ldots, i_{n-1})$. This is precisely the constraint (\ref{eq:Constraint}). Now fix a $(n-1)$ subsequence $(i_1, \ldots, i_{n-1})$, and let $m$ denote the scalar index for this $(n-1)$ subsequence, i.e. \begin{eqnarray*} m = i_1 + (i_2-1)A + (i_3-1)A^2 + \ldots + (i_{n-1}-1)A^{n-2} \end{eqnarray*} We now express the two indices of length n appearing in (\ref{eq:Constraint}) as a function of $m$: \begin{eqnarray*} (j,i_1, \ldots, i_{n-1}) &=& j + (i_1 - 1)A + (i_2-1)A^2\\ &&+ \ldots + (i_{n-1}-1)A^{n-1} \\ &=& mA- A + j= j+ (m-1)A \end{eqnarray*} With exactly the same procedure one gets \begin{eqnarray*} (i_1, \ldots, i_{n-1}, j) = m +(j-1)A^{n-1} \end{eqnarray*} \end{theorem}\begin{remark} In order to illustrate that the equations in (\ref{eq:Constraint}) are not sufficient conditions for the existence of a realizable time sequence for a given a frequency vector, consider a disconnected graph which satisfies the constraints. In such a graph there is no single path connecting all the nodes, meaning there is also no corresponding time sequence. \end{remark} \begin{remark} In a stochastic framework, the frequency matrix can be considered as mutual discrete probability distribution functions of the n stochastic variables. Imposing that the signal is stationary, will lead to the same constraint as given in (\ref{eq:Constraint}) \cite{Larsson2010}. The graph described above can then be seen as a Markov chain used to generate a realization of the frequency matrix. \end{remark} \section{Constrained Optimization} \label{sec:Constraint} In the previous section it was shown that a frequency vector can only be realized as a time sequence if it meets the conditions (\ref{eq:Constraint}). Therefore, these conditions will be imposed during the optimization. Unfortunately the dispersion-based algorithm cannot handle constraints directly. Instead, the realizable search space will be represented as a convex set and the optimization will be performed with respect to the new convex coefficients. \\We now show that the set of relative frequency vectors meeting the condition (\ref{eq:Constraint}) are a convex set. First, it should be noted that the relative frequencies are convex coefficients (see (\ref{eq:convexCoeff})). Therefore the full search space is contained in a convex polyhedron \cite{Boyd2004}. Second, the constraints presented in (\ref{eq:Constraint}) correspond to a set of linear equality constraints, meaning they describe a subspace centered at the origin. Combining these two observations shows that the space of realizable relative frequency vectors consists of the intersection between a polyhedron and a subspace, which in turn is again a polyhedron \cite{Boyd2004} and therefore a convex set. \\Knowing that the search space is a convex polyhedron allows us to express every realizable relative frequency vector as a convex combination of the corner points: \begin{eqnarray}\label{gammadecomp} &&\forall k \in \{1,2,\ldots, A^n\}: ~\xi_{\gamma}(k)=\sum_{j=1}^{N_{b}}\gamma(j).\xi_{b_{j}}(k) \\ && \mathrm{with} ~ \gamma(j)\in[0,1] \mathrm{~and~} \sum_{j=1}^{N_b}\gamma(j)=1 \nonumber \end{eqnarray} where $\xi_{b_{j}}(k)$ are the mentioned corner points, $N_b$ is the number of corner points, $\gamma(j)$ are the new convex coefficients with respect to which the optimization will be performed, and $\xi_{\gamma}$ is the frequency vector corresponding to the coefficient vector $\gamma$. \\In \cite{Patricio_Automatica} the same reasoning was followed. Additionally, it was shown how the corner points that span the polyhedron could be constructed from the elementary cycles present in the graph associated to the unity frequency vector. However finding these elementary cycles is a computationally heavy task and becomes infeasible for medium sized graphs \cite{Hawick2008}. \subsection{Non-overlapping Symmetric Set} As an alternative, we present a more restrictive convex set that has the advantages that its corner points can easily be computed. However, it can not be guaranteed that this set contains the global optimum of the polyhedron of realizable frequency vectors. \begin{definition} \label{def:nonoverlappingsymmetric} A set of vectors $[\xi_{b_1},\xi_{b_2},...,\xi_{b_{N_b}}]$ in $\mathbb{R}^{A^n}$is called non-overlapping symmetric if they have the following four properties: \begin{enumerate} \item positivity constraint: \\ $\forall k,~\forall j: \xi_{b_{j}}(k)\geq0$ \item non-overlapping constraint: \\ $\forall k,\,\exists!j:\, \xi_{b_{j}}(k)>0$ \item unity sum constraint: \\$\forall j:\, \sum_{k=1}^{A^n}{\xi_{b_{j}}(k)}=1$ \item symmetry constraint: \\$\forall j, ~ \forall i_1,...,i_n, ~\forall p\in\ \mathrm{Perm}_{1,2,...,n}:$ \\$\xi_{b_{j}}(i_{1},i_{2},...,i_{n})=\xi_{b_{j}}(i_{p_1},i_{p_2},...,i_{p_n})$ \end{enumerate} where $N_b$ indicates the number of vectors in the set, $\mathrm{Perm}_{1,2,...,n}$ stands for the set of all possible permutations of the symbols $\{1,2,...,n\}$, and $\exists!j$ means 'there exists only one'. \end{definition} \begin{remark} The first property guarantees that the frequencies are nonnegative. The second property guarantees that the vectors don't have the same nonzero element positions, thereby making these vectors linearly independent. The third property ensures that the sum of the frequencies is one. The first three properties are needed in order to impose (\ref{eq:convexCoeff}) on $\xi_\gamma$. The fourth property imposes symmetry on the frequency vector. This symmetry constraint implies that the constraint (\ref{eq:Constraint}) is satisfied. \end{remark} \begin{remark} The number of non-overlapping symmetric vectors $N_b$ equals the number of degrees of freedom in a symmetric tensor of order $n$ and dimensionality $A$. For example if $n=2$, $N_b= \frac{A(A+1)}{2}$, which correponds to the degrees of freedom in a symmetric $A\mathrm{x}A$ matrix. \end{remark} \begin{example} In the case of $n=2$ and two possible amplitude values (i.e. $A=2$), the number of vectors in the non-overlapping symmetric set is $N_b=3$. The non-overlapping symmetric set is given by the three frequency vectors below: \begin{eqnarray*} \xi_{b_{1}}=\left[\begin{array}{c} 1 \\ 0 \\ 0\\ 0 \end{array}\right],\, \xi_{b_{2}}=\left[\begin{array}{c} 0 \\ 0.5\\ 0.5 \\ 0 \end{array}\right],\, \xi_{b_{3}}=\left[\begin{array}{c} 0 \\ 0\\ 0 \\ 1 \end{array}\right] \end{eqnarray*} It is easy to check that the four constraints are satisfied. Note that the fourth constraint reduces here to $\xi_{b_j}(1,2) = \xi_{b_j}(2,1)$ for $j=1,2,3$ or, equivalently $\xi_{b_j}(2) = \xi_{b_j}(3)$ when the unique index $k$ of (\ref{eq:c}) is used in lieu of $(i_1, i_2)$. \end{example} \subsection{Symmetric Designs} Assuming the use of a non-overlapping symmetric set, the expression of the normalized information matrix can be rewritten as a function of the weighting coefficients $\gamma(j)$ by substituting (\ref{gammadecomp}) into (\ref{Mdecomp}): \begin{eqnarray} &&\frac{M}{N}=\sum_{j=1}^{N_b}{\gamma(j) \sum_{k=1}^{A^n}{\xi_{b_j}(k) \cdot M_k}} =\sum_{j=1}^{N_b}{\gamma(j) \cdot M_{\gamma(j)}} \label{eq:changeDesigns} \end{eqnarray} where $M_{\gamma(j)}=\sum_{k=1}^{A^n}{\xi_{b_j}(k) \cdot M_k}$ are the new elementary information matrices. \\During the constrained optimization, the dispersion function will be computed based on these $M_{\gamma(j)}$. We define: \begin{eqnarray} \label{eq:NewDispersion} v_{\gamma}(\xi_{\gamma},j)\stackrel{\Delta}{=} \mathrm{trace}(M(\xi_{\gamma}(k))^{-1} \cdot M_{\gamma(j)}) \end{eqnarray} where the subscript ${\gamma}$ indicates that $v_{\gamma}$ is computed from the elementary information matrices $M_{\gamma(j)}$. Notice that the values and dimensions of the dispersion functions $v_{\gamma}(\xi_{\gamma},j)$ and $v(\xi_{\gamma},k)$ are different. This is because the dispersion function evaluates the quality of the input design relative to the considered search space. \subsection{Optimization Algorithm Revisited} By introducing the new elementary information matrices $M_{\gamma(j)}$ and the dispersion function $v_{\gamma}$, and as a result of the convex properties of the coefficients $\gamma(j)$, the dispersion-based algorithm described in Subsection \ref{subsec:optimization} can be reused to find the $\gamma_{opt}(j)$ for which the determinant is maximal. Revisiting the 4-step algorithm leads to: \begin{enumerate} \item Initialize with a uniform design: $\gamma(j)=1/N_{b}$ \item Compute the dispersion function $v_\gamma(\xi_{\gamma},j)$ for the current design using (\ref{eq:NewDispersion}) \item Update the design in accordance with the dispersion function as follows $\gamma_{new}(j)=\frac{{v_{\gamma}}(\xi_{\gamma}, j)}{N_b}.\gamma_{old}(j)$ \item Stopping criterion: if $(\mathrm{max_j}v_{\gamma}(\xi_{\gamma_{new}},j)-N_{\theta})$ is smaller than a predefined threshold, the optimal solution is assumed to be found; else go to step 2. \end{enumerate} \section{Numerical Example} \label{sec:Example} The methods above will now be illustrated on the following numerical example which consists of a finite impulse response filter, followed by a polynomial nonlinearity: \begin{eqnarray*} y(t)&=&c_1w(t)^{3}+c_2w(t)+e(t) \\w(t)&=&b_1 u(t)+b_2 u(t-1) \\ u(t)&\in&[-1:2/9:1]~~~\mbox{and}~~~ e(t)\sim N(0,1) \end{eqnarray*} with $b= (3; 1)$ and $c=(1; -0.25)$. The value of $c_2$ will be fixed in order to make the problem identifiable. The noise is zero mean Gaussian distributed with unity variance. The amplitude set contains 10 uniformly spaced values between -1 and 1 (A=10). Because the system has a memory length of two (n=2), 100 different subsequences should be considered.\\ Notice that this numerical problem leads to a complete graph with 10 nodes and 100 edges. For such graph it is proven that the number of elementary cycles is 1112073 and that computing all these cycles has a complexity of 122328140 \cite{Johnson}. An implementation of Johnson's algorithm \cite{Johnson} in Matlab takes multiple days in order to compute all these elementary cycles. Additionally the optimization problem would need to consider 1112073 variables which is not feasible. In contrast the symmetric design space contains only 55 frequency vectors that can be compute in a couple of seconds. \subsection{Unconstrained optimization} First, the unconstrained optimization is performed. This means that the relative frequencies $\xi(k)$ are optimized with the dispersion-based optimization method described in subsection \ref{subsec:optimization}. The results for 1000 iterations are plotted in Fig.\ref{fig:unconstrained}. In each iteration step the dispersion function, relative frequency vector and determinant of the normalized information matrix are computed and stored. \begin{figure} \centering{ \resizebox{1.0\hsize}{!}{ \includegraphics[scale=1]{\string"Figures/plots_unconstrained\string".pdf} }} \caption{Results without constraints. Top, left: maximal dispersion as function of the iteration index Top, right: determinant of the normalized information matrix function of the iteration index. Bottom,left: relative frequencies. Bottom,right: dispersion function of the optimal design.} \label{fig:unconstrained} \end{figure} \\The top plots represent the evolution of the maximum dispersion and of the determinant of the Fisher information matrix as a function of the iterations. They show that the method successfully lowers the maximal value of the dispersion and at the same time increases the determinant of the information matrix. Note that in the end the maximal dispersion reaches the value of 3, which corresponds to the number of free parameters. This indicates that the obtained solution is optimal (see Theorem \ref{theo:dispersion}). \\ The optimal relative frequency vector {at the end of the iterations} is depicted in the bottom left plot; it only contains 6 entries that are different from zero. This means that the optimal design is such that only 6 out of the 100 possible subsequences are used to excite the system. Each of them has the same frequency value. The bottom right plot represents the value of the dispersion function for each of the 100 subsequences. \\ Table 1 shows the subsequences of the optimal unconstrained design and their corresponding relative frequencies, while Fig. \ref{Fig:uncongraph} represents the associated graph. Two observations should be made. First, the design does not obey the constraints (\ref{eq:Constraint}). As a result, the frequency vector cannot be realized as a time sequence. Second, the graph is disconnected, which means that not every node can be reached from any other node. \subsection{Evolution of the Determinant} Now let us have a closer look at the evolution of the determinant in Fig.\ref{fig:unconstrained}. For the first 10 to 20 iterations there is a rapid increase in the determinant value. During these iterations, the number of different subsequences is reduced drastically. After this rapid change, the evolution of the determinant value becomes stable. Only the frequencies of the remaining subsequences are changed but the selection of subsequences stays the same. From this observation it can be concluded that selecting the optimal subset of subsequences is more important for the quality of the design than finding the optimal frequencies of the selected subsequences. \begin{table} \label{tab:unconstraint} \begin{center} \begin{tabular}{|c|c|c|} \hline index & subsequence & frequency\tabularnewline \hline \hline 1 & {[}-1;-1{]} & 1/6\tabularnewline \hline 3 & {[}-1;-10/18{]} & 1/6\tabularnewline \hline 40 & {[}-1/3,1{]} & 1/6\tabularnewline \hline 61 & {[}1/3;-1{]} & 1/6\tabularnewline \hline 98 & {[}1;10/18{]} & 1/6\tabularnewline \hline 100 & {[}1;1{]} & 1/6\tabularnewline \hline \end{tabular} \end{center} \label{tab:Unconstraint} \caption{Table containing the index, subsequences and relative frequencies of the optimal unconstrained design $\xi_{opt}$.} \end{table} \begin{figure} \centering{ \resizebox{1.0\hsize}{!}{ \includegraphics[scale=1]{\string"Figures/graph_unconstrained\string".pdf} }} \caption{Associated graph of the optimal unconstrained design.} \label{Fig:uncongraph} \end{figure} \subsection{Constrained optimization} Next, the optimization is performed using the non-overlapping symmetric basis vectors obeying the constraints of Definition~\ref{def:nonoverlappingsymmetric}. This means that the optimization is performed with respect to the coefficients $\gamma(j)$ of (\ref{eq:changeDesigns}) using the elementary information matrices $M_{\gamma(j)}$. Again 1000 iterations are taken which leads to the plots in Fig.\ref{fig:constrained}. Due to the symmetry constraint, only $N_b=55$ coefficients need to be considered; hence $\gamma(j)$ in the bottom right plot ranges from 1 to 55. The determinant increases monotonically while the maximal value of the dispersion $\max(v_\gamma(\gamma_{opt}, j))$ is driven to its minimal value of 3. This indicates that the final design is optimal in its subspace of constrained designs. \\Table 2 shows the relative frequencies of the optimal constrained design which contains eight different subsequences with different frequencies. As expected, the design is symmetric, meaning that the subsequences $[u_1,u_2]$ and $[u_2,u_1]$ have the same frequency. This allows us to concatenate the subsequences without the need of unwanted transition subsequences, leading to a realizable design that is optimal in the constrained space. The same conclusion can be made from the associated graph in Fig. \ref{Fig:congraph}. \begin{figure} \centering{ \resizebox{1.0\hsize}{!}{ \includegraphics[scale=1]{\string"Figures/plots_constrained\string".pdf} }} \caption{Results with constraints. Top, left: maximal dispersion. Top, right: determinant of the normalized information matrix. Bottom,left: relative frequencies of the optimal design. Bottom,right: dispersion function at the end of the iterations for each of the 55 subsequences.} \label{fig:constrained} \end{figure}\\ \begin{table} \begin{center} \begin{tabular}{|c|c|c|} \hline index & subsequence & frequency\tabularnewline \hline \hline 1 & {[}-1;-1{]} & 0.15\tabularnewline \hline 4 & {[}-1;-1/3{]} & 0.13\tabularnewline \hline 10 & {[}-1,1{]} & 0.09\tabularnewline \hline 31 & {[}-1/3;-1{]} & 0.13\tabularnewline \hline 70 & {[}1/3;1{]} & 0.13\tabularnewline \hline 91 & {[}1;-1{]} & 0.09\tabularnewline \hline 97 & {[}1;1/3{]} & 0.13\tabularnewline \hline 100 & {[}1;1{]} & 0.15\tabularnewline \hline \end{tabular} \end{center} \label{tab:Constraint} \caption{Table containing the index, subsequences and realtive frequencies of the optimal constrained design $\xi_{\gamma_{opt}}$.} \end{table} \begin{figure} \centering{ \resizebox{1.0\hsize}{!}{ \includegraphics[scale=1]{\string"Figures/graph_constrained\string".pdf} }} \caption{Associated graph of the optimal constrained design.} \label{Fig:congraph} \end{figure} \subsection{Computing the Dispersion} At first glance it seems contradictory that the optimal unconstrained and constrained design have the same maximum dispersion but different determinant values. However, the dispersion of the constrained design $v_{\gamma}(\xi_{\gamma},j)$ and the dispersion of the unconstrained design $v(\xi,k)$ can not be compared directly, because they are based on different elementary information matrices. In order to make a comparison possible, the dispersion of the constrained solution $\xi_{\gamma,opt}$ is computed with respect to the elementary Fisher matrices $M_{k}$. \\The results are plotted in Fig.\ref{fig:corrected}. From the left plot it is clear that the dispersion function $v(\xi_{\gamma})$ is larger than $v_{\gamma}(\xi_{\gamma})$ and $v(\xi)$. This indicates that the constrained solution is not optimal in the full frequency space. This is in accordance with the observation that the determinant of the constrained design $\xi_{\gamma_{opt}}$ is smaller than the determinant of the unconstrained design $\xi_{opt}$. See Table~\ref{tab:Grid} for the exact determinant values. \begin{figure} \centering{ \resizebox{0.5\hsize}{!}{ \includegraphics[scale=1]{\string"Figures/plots_dispersions\string".pdf} }} \caption{Maximal dispersion of the normalized information matrix in the constrained case, computed for different elementary designs.} \label{fig:corrected} \end{figure} \subsection{Signal Generation} Both designs will be translated into a time sequence containing 100 subsequences. During this process three approximations are considered. \begin{itemize} \item After denormalization, the values of $\xi_N$ are rounded to the nearest natural number. \item The unconstrained design needs additional transient subsequences because condition (\ref{eq:Constraint}) is violated. \item The constrained design needs additional transient subsequences when the graph is disconnected. \end{itemize} All these approximations lead to a decrease in the determinant of $M$ and alter the total subsequence count, making the resulting time sequences suboptimal. \begin{figure} \centering{ \resizebox{0.9\hsize}{!}{ \includegraphics[scale=1]{\string"Figures/input_constrained\string".pdf} }} \caption{Input sequence with constraints. Top: time domain signal; Bottom: difference in frequency between optimal design and time sequence.} \label{Fig:consignal} \end{figure} \\First, the time sequence for the constrained design is generated. The resulting input sequence can be found in the top plot of Fig \ref{Fig:consignal}. The bottom plot depicts the difference in frequency between the optimal relative frequency vector $\xi_{opt}$ and the generated time sequence. All errors are smaller than $10^{-2}$, meaning only rounding errors are present. \\ The unconstrained design does not satisfy the constraints (\ref{eq:Constraint}). Therefore, the design will be slightly altered in order to find a time sequence which realizes the unconstrained design as well as possible. The graph of the altered design can be found in Fig. \ref{Fig:modgraph}. Notice that the graph is no longer disconnected and satisfies the conditions in (\ref{eq:Constraint}). \\After altering the design a time sequence can be generated. The results can be found in Fig.\ref{Fig:unconsignal}. The generated sequence contains 104 samples due to roundoff errors. If a sequence of exactly 100 samples is needed some $[1,1]$ and $[-1,-1]$ subsequences could be removed. The positive frequency errors reflect the change in frequency compared to the original subsequences. The negative errors reflect the addition of the dotted arrows to the design (see Fig.\ref{Fig:modgraph}). \begin{figure} \centering{ \resizebox{1.0\hsize}{!}{ \includegraphics[scale=1]{\string"Figures/graph_modified\string".pdf} }} \caption{Modified graph from the unconstrained design. Dotted arrows were added and the relative frequencies were renormalized.} \label{Fig:modgraph} \end{figure} \begin{figure} \centering{ \resizebox{1.0\hsize}{!}{ \includegraphics[scale=1]{\string"Figures/input_unconstrained\string".pdf} }} \caption{Input sequence obtained from altered unconstrained design. Top: time domain signal; Bottom: difference in frequency between optimal design and time sequence for the frequency vector.} \label{Fig:unconsignal} \end{figure} \subsection{Comparing Designs} Table 3 summarizes the performance of all previous designs. In order to remove the influence of the signal length, the Fisher matrix is computed based on the relative frequencies. As a reference for comparison, the maximum determinant out of 1000 randomly generated signals is also added. \\ Both the constrained and unconstrained designs perform two orders of magnitude better than the best randomly generated design. Out of the optimized designs, the unconstrained design has the highest determinant value. When this design is altered and realized as a time sequence, a decrease in the determinant can be observed, but the resulting sequence still outperforms the constrained design. Notice that there is no difference in determinant value between the constrained design and its corresponding time sequence. \\ From these observations it can be concluded that it is meaningful to compute both the constrained and unconstrained design. If the unconstrained design can easily be altered to a realizable design, without too much loss in performance, it should be preferred. If not, the constrained design presents a valuable alternative, because it can always be realized. \begin{table} \begin{center} \begin{tabular}{|c|c|} \hline solution type & det(Fi)\tabularnewline \hline \hline max random signal & 9.51e+01 \tabularnewline \hline unconstrained design & 1.83e+03 \tabularnewline \hline unconstrained sequence & 1.37e+03 \tabularnewline \hline constrained design & 1.17e+03 \tabularnewline \hline constrained sequence & 1.17e+03 \tabularnewline \hline \end{tabular} \end{center} \caption{Normalized determinants of all considered designs and their corresponding time sequences} \label{tab:Grid} \end{table} \section{Computation time} \label{sec:complexity} To evaluate the computational complexity of the dispersion-based algorithm, we compared it with the general purpose convex optimizer cvx (we choose the SeDuMi as internal solver \cite{Sturm1999,cvx}). Both algorithms are used to compute the optimal input for a given set of problems. For each problem the computation of the optimal input is performed ten times and the median of the computation time is used as measure of computing speed. \subsection{Stopping Condition} In order to guarantee that the quality of the solution computed by both solvers is equal, the determinant of the Fisher information matrix of the cvx solution is used as an absolute stopping criterion for the dispersion-based algorithm. This means that the dispersion-based algorithm keeps iterating until a solution with the same or higher determinant value is found. \subsection{Problem Parameters} For all problems, the system consists of an FIR filter followed by a polynomial nonlinearity. The filter coefficients correspond to the natural numbers between 1 and $n$. The nonlinearity consists of a cubic and linear term and has the same coefficients as in the numerical example. It is assumed that the cubic parameter $c_1$ is fixed during the estimation. The optimization is performed over the search space spanned by the non-overlapping symmetric set. \\Two distinct sets of problems will be solved. For the first set of problems, we increase the number of amplitude levels between -1 and 1 while keeping the system memory constant to 2. For the second set of problems, the input set is fixed to $[-1,0,1]$ but the length of the system memory is increased. \\ The results of these simulations are depicted in Fig. \ref{Fig:computation}. Notice that only the time for the optimization is considered. The time needed to compute the non-overlapping symmetric set, which is the same for both solvers, is depicted in Fig. \ref{Fig:computation2}. \subsection{Effect of the Amplitude Levels} The computation times for the first set of problems are depicted in the left subplots. We see that the computation time increases with the number of amplitude levels, regardless of the solver. This should be expected, as more amplitude levels lead to a bigger search space. For less than 20 amplitude levels the dispersion-based algorithm computes faster than cvx. Past the 20 amplitude levels the performance of the solution of cvx cannot be perfectly matched by the solution provided by dispersion-based algorithm, which leads to higher computation times. When we relax the stopping condition by allowing the dispersion-based algorithm to stop when it reaches 99\% of the determinant value found with cvx, we see that the computation times of the dispersion-based method are lower (see left, lower subplot in Fig. \ref{Fig:computation}). However, the difference between the two methods becomes smaller with increasing number of amplitude levels. \subsection{Effect of the Memory Length} In the second set of problems, the input set is fixed but the length of the system memory is increased. The computation times for the second set of problems are depicted in the right subplots. We can see that the computation time increases with the length of the memory of the system. This is normal because the memory length is exponentially proportional with the dimension of the search space. More importantly, we see that the dispersion-based algorithm reaches the same performance as cvx in shorter computation times. The difference is around two orders of magnitude. \subsection{Computing the Non-Overlapping Symmetric Set} Untill now, we only considered the time needed to perform the optimization. However, before we can perform the optimization, we need to construct the non-overlapping set and compute the Fisher information matrix for each vector in this set. In Fig. \ref{Fig:computation2} the computation time for this step is depicted for increasing problem sizes. In the top plot we see the evolution for a fixed system memory and an increasing number of amplitude levels. In the bottom plot we see the evolution for a fixed number of amplitude levels and an increasing memory length. Especially from the bottom subplot it becomes clear that computing the non-overlapping set is the most time expensive step of the OID. For a memory length of 10, computing the set takes already more than 6 minutes, while the optimization takes 2 to 3 seconds. \subsection{Summary of the Results} From the above results we can conclude that the dispersion-based algorithm has a similar, if not better, performance compared to general purpose convex optimization algorithms for the presented optimal input problem. However, it turns out that the highest computational cost is not in the optimization of the design, but in the computation of the set describing the search space. As long as this bottle neck is not removed the choice of optimization algorithm is not critical. For performance comparison for large scale random optimal problems we refer to \cite{Lu2013}, where it is shown that for problems with 1000 variables or more, interior point methods have the best performance. \begin{figure} \centering{ \resizebox{1.0\hsize}{!}{ \includegraphics[scale=1]{\string"Figures/cTimeGrid1\string".pdf} }} \caption{Median computation times obtained after 10 runs for the two problem sets. In blue the results for dispersion-based method (dba). In red the results for cvx. Only the time for the optimization process is considered.} \label{Fig:computation} \end{figure} \begin{figure} \centering{ \resizebox{1.0\hsize}{!}{ \includegraphics[scale=1]{\string"Figures/cTimeGrid2\string".pdf} }} \caption{Median computation time for the non-overlapping symmetric set, obtained after 10 runs.} \label{Fig:computation2} \end{figure} \section{System Memory vs Subsequence Length} \label{app} Until now we have assumed that the length of the subsequences and the memory of the system are equal. In [28] the connection between length of the subsequences and memory length has not been examined. In this section we will illustrate why it is optimal to choose the length of the subsequences and the memory of the system equal.\\ The subsequence length determines the search space of input sequences in which we try to find the optimal sequence. Remember that this search space corresponds to a polyhedron of which the corner points can be found through the elementary cycles of the associated graph. The longer the subsequence length the more complex the graph and the more corner points the polyhedron has.\\ The memory length of the system determines how any sequence from search space of input sequences is mapped onto a frequency vector. The longer the memory length, the larger the frequency vector search space becomes. As a result less sequences will be mapped on the same frequency vector.\\ If we chose the subsequence length and memory length equal, the corner points are mapped on a set of convex independent frequency vectors. However, when the memory length is smaller than the subsequence length, this is no longer the case. Some of the frequency vectors can now be written as a convex combination of the others. In other words the effort made to compute the additional corner points is wasted since the mapping to the frequency vector space makes some corner points redundant.\\ When the memory length of the subsystem is larger than the subsequence length. All corner points will be uniquely mapped to frequency vectors. However, compared to the case of equal lengths, the search space is now smaller. This reduction may exclude more informative designs that are still realizable. \section{Conclusion} \label{sec:Conclusion} In this work a solution to the problem of D-optimal input design for nonlinear FIR-type systems with an input taking a finite set of possible values has been presented. \\By expressing the optimization problem with respect to the relative frequency vector, instead of the time sequence, the problem became convex. This convex problem was solved with an unconstrained optimization scheme based on the dispersion function. \\However, it turned out that additional constraints are needed in order to guarantee that the optimal design can be realized as a time sequence. By imposing that the solution should lie in the subspace described by a symmetric and non-overlapping basis, a realizable solution was obtained that is optimal in its subspace of constrained solutions and remains numerically tractable. \\In order to find a time sequence that realizes this optimal constrained design, the associated graph was introduced. It was shown that a path, using all edges in the graph as many times as their multiplicity indicates, corresponds to a time sequence that realizes the design. \\ Comparing the realization of the constrained design with the realizations of a random and unconstrained design showed that the determinant was highest for the unconstrained design. However, it can not be guaranteed that this design is realizable without a significant loss in determinant value. Therefore, the constrained design is proposed as an attractive alternative, because it can always be realized. \\The methods presented in this paper were applied on a simple numerical example. Additionally the computational cost of the method was compared with the general purpose convex optimizer cvx. From this comparison it turned out that the dispersion based method has similar or better performance for medium sized problems. \begin{ack} This work was supported in part by the Fund for Scientific Research (FWO-Vlaanderen), by the Flemish Government (Methusalem), by the Belgian Government through the Inter university Poles of Attraction (IAP VII) Program, and the ERC Advanced Grant SNLSID. \end{ack} \bibliographystyle{plain}
{'timestamp': '2017-03-27T02:07:11', 'yymm': '1703', 'arxiv_id': '1703.08401', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08401'}
arxiv
\section{Introduction}\label{sec:introduction} \IEEEPARstart{E}{vent} sequences are becoming increasingly available in a variety of applications. Such event sequences, which are asynchronously generated with random timestamps, are ubiquitous in areas such as e-commerce, social networks, electronic health data, and equipment failures. The event data can carry rich information not only about the event attribute (\emph{e.g.}, type, participator) but also the timestamp $\{z_i,t_i\}_{i=1}^N$ indicating when the event takes place. A major line of research~\cite{AalenPP2008} has been devoted to studying event sequence, especially exploring the timestamp information to model the underlying dynamics of the system, whereby point process has been a powerful and elegant framework in this direction. Being treated as a random variable when the event is stochastically generated in an asynchronous manner, the timestamp makes the event sequence of point processes fundamentally different from the time series~\cite{MontgomeryTSBook15} evenly-sampled from continuous signals because the asynchronous timestamps reflect the network dynamic while the time for time-series is deterministic.. However these time series data, when available, provide timely updates of background environment where events occur in the temporal point process, such as temperature for computing servers or blood pressure for patients. Many complex systems posses such time series data regularly recorded along with the point processes data. While there have been many recent works on modeling continuous-time point processes~\cite{kdd2014Liangda,YuICDM15,farajtabar2015coevolve,DuKDD16,farajtabar2014shaping} and time series~\cite{box2015time,chatfield2016analysis, guralnik1999event}, most of them treat these two processes independently and separately, ignoring the influence one may have on the other over time. To better understand the dynamics of point processes, there is an urgent need for joint models of the two processes, which are largely inexistent to date. There are related efforts in linking the time series and event sequence to each other. In fact, one popular way to convert a time series to an event sequence is by detecting multiple events (\emph{e.g.}, based on thresholding the stock price series~\cite{bacry2015hawkes}) from the series data. On the other hand, statistical aggregation (\emph{e.g.}, total number of counts) is often performed on each time interval with equal length to extract aligned time series data from the event sequences. However such a coarse treatment can lead to the key information loss about the actual behavior of the process, or at least in a too early stage. Recent progresses on modeling point process includes mathematical reformulations and optimization techniques~\cite{LewisJNS2011,ZhouICML13,ZhouAISTATS13,farajtabar2015coevolve} and novel parametric forms~\cite{shen2014modeling,ErtekinRPP2015,choi2015constructing,XuTKDE16} as carefully designed by human prior knowledge to capture the characters of the dataset in their study. One major limitation of those model is that the specified form of point process limits its capability to capture the dynamic of data. Moreover, it may suffer from misspecification, for which the model is not suitable for the data. Recent works \emph{e.g.},~\cite{ZhouICML13} start to turn to non-parametric form to fit the structure of a point process, but their method is under the Hawkes process formulation, which runs the risk of unknown model complexity and can be inappropriate for point processes that disobey the self or mutual-exciting rule assumed by the Hawkes model~\cite{HawkesBiometrika71}. In another recent work \cite{DuKDD16}, the authors proposed a semi-parametric pesudo point process model, which assumes a time-decaying influence between events and the background of intensity is constant. Besides, the event type is regarded as the mark associated with a univariate process. In this paper, we view the conditional intensity of a point process as a nonlinear mapping from the joint embedding of time series and past event data to the predicted transient occurrence intensity of future events with different types. Such a nonlinear mapping is expected to be complex and flexible enough to model various characters of real event data for its application utility, \emph{e.g.}, failure prediction, social network analysis, and disease network mining as will be empirically studied in the experiment part of this paper. To overcome the disadvantages associated with the explicit parametric form of intensity function we bypass direct modeling of the intensity function and directly model the next event time and dimension. Neural networks are our choice to model this nonparametric mapping. We utilize the state-of-the-art deep learning techniques to efficiently and flexibly model the intensity function of the point processes. Instead of predefining the form of point process, we turn to the synergic multi-RNNs (specifically twin-RNNs in this paper) as a natural way to encode such nonlinear and dynamic mapping, in an effort for modeling an end-to-end nonlinear intensity mapping without any prior knowledge. To further improve its interpretability, we infuse the attention model to improve its capability for both prediction and relational mining among event dimensions. \begin{figure}[tb!] \centering \subfigure{\includegraphics[width=0.48\textwidth]{pic/PPTS.pdf} \caption{Time series and event sequence can be synergically modeled. The former can be used to timely capture the recent window for the time-varying features, while the latter can capture the long-range dependency over time.} \label{fig:ppts} \end{figure} \textbf{Key idea and highlights.} Our model interprets the conditional intensity function of a point process as a nonlinear mapping, which is synergetically established by a composite neural network with two RNNs as its building blocks. As illustrated in Fig.~\ref{fig:ppts}, time series (top row) and event sequence (bottom row) are distinct to each other. The underlying rationale is that time series is more suitable to carry the synchronously and regularly updated (\emph{i.e.} in a fixed pace) or constant profile features. In contrast, the event sequence can compactly catch event driven, more abrupt information, which can affect the conditional intensity function over longer period of time. More specifically, We first argue that many conditional intensity functions can be viewed as an integration of two effects: i) spontaneous background component inherently affected by the internal (time-varying) attributes of the individual; ii) effects from history events. Meanwhile, most information in the real world can also be covered by continuously updated features like age, temperature, and asynchronous event data such as clinical records, failures. This motivates us to devise a general approach. Then, we use one RNN whose units are aligned with the time points of a time series, and another RNN whose units are aligned with events. The time series RNN can timely update the intensity function while the event sequence RNN is used to efficiently capture the long-range dependency over history. They can interact with each other through synergic non-linear mapping. This allows fitting arbitrary dynamics of point process which otherwise will be difficult or often impossible to be specified by a parameterized model restricted to certain assumptions. As an extension to the conference version~\cite{XiaoAAAI17}\footnote{The main extensions include: i) in contrast to \cite{XiaoAAAI17} where the so-called \emph{pseudo} multi-dimensional point process~\cite{LinigerPhD2009} is adopted which involves only a single intensity function for all types of event sequence, here we separately model the intensity functions for each event type leading to the so-called \emph{genuine} multi-dimensional point process via recurrent neural networks; ii) based on the resulting multi-dimensional point process model, we incorporate a new attention mechanism to improve the interpretability of the prediction model. This expands the dependency model in RNN from the recent hidden variable $\mathbf{h}_j$ to a set of recent ones which further improves its modeling capability; iii) a more thorough analysis and verification via devised simulation experiments; iv) performing more experiments from both social network data and healthcare data. Note that the added attention model enables the relation discovery capability as also verified in both simulation based and real-world data. While the conference paper~\cite{XiaoAAAI17} only deals with event prediction rather than relation mining.}, the overall highlights of this paper are: i) To the best of our knowledge, this is the first work to \emph{jointly} interpret and instantiate the conditional intensity function with fused \emph{time series} and \emph{event sequence} RNNs. This opens up the room for connecting the neural network techniques to traditional point process that emphasizes more on specific model driven by domain knowledge. The introduction of a full RNN treatment lessen the efforts for the design of (semi-)parametric point process model and its complex learning algorithms which often call for special tricks \emph{e.g.}~\cite{YanIJCAI13} that prohibiting the wide use for practitioners. In contrast, neural networks and specifically RNNs, are becoming off-the-shelf tools and getting widely used recently. ii) We model the \emph{genuine} multi-dimensional point process through recurrent neural networks. Previous work~\cite{DuKDD16} use the RNN to model so-called \emph{pseudo} multi-dimensional point process~\cite{LinigerPhD2009}. Actually, they regard the event sequence as a univariate point process and treat the dimension as the mark associated with events. Consequently, there exists only one intensity function for all the processes instead of one per each dimension. On the contrary, in our work the process is the result of the superposition of sub-processes for each dimension. In this way, we can separate the parameters of each dimension as well as capture their interactions. This leads to more effective simulation and learning algorithm. iii) To improve the interpretability, it is also perhaps the first time, to our knowledge, an attention based RNN model for point process is proposed. For multi-dimensional point process, our proposed attention mechanism allows each dimensional has its own attention parameters. One typical resulting utility involves decision support and causality analysis~\cite{XuICML16}. iv) Our model is simple and general and can be end-to-end trained. We target three empirical application domains to demonstrate the superiority of the proposed method, namely, predictive maintenance, social network analysis and disease relation mining. The state-of-the-art performance on relational mining, event type and timestamp prediction corroborates its suitability to real-world applications. The organization of this paper is as follows: related work is reviewed in Section \ref{sec:related}. Section \ref{sec:method} presents the main approach, and Section \ref{sec:experiment} describes the empirical studies involving three different application scenarios related to both prediction and mining. Section \ref{sec:conclusion} concludes this paper. \section{Related Work and Motivation}\label{sec:related} We review the related concepts and work in this section, which is mainly focused on Recurrent Neural Networks (RNNs) and their applications in time series and sequence data, respectively. Then we discuss existing point process methods and their connection to RNNs. All these observations motivate the work of this paper. \textbf{Recurrent neural network.} The building block of our model is the Recurrent Neural Networks (RNNs)~\cite{ElmanCS90,PascanuICML13} and its modern variants \emph{e.g.}, Long Short-Term Memory (LSTM) units~\cite{HochreiterNC97,GravesArxiv13} and Gated Recurrent Units (GRU)~\cite{ChungArxiv14}. RNNs are dynamical systems whose next state and output depend on the present network state and input, which are more general models than the feed-forward networks. RNNs have long been explored in perceptual applications for many decades, however it can be very difficult for training RNNs to learn long-range dynamics in part due to the vanishing and exploding gradients problem. LSTMs provide a solution by incorporating memory units that allow the network to learn when to forget previous hidden states and when to update hidden states given new information. Recently, RNNs and LSTMs have been successfully applied in large-scale vision~\cite{GregorDraw15}, speech~\cite{GravesICML14} and language~\cite{SutskeverNIPS14} problems. \textbf{RNNs for series and event data.} From application perspective, we consider two main scenarios in this paper: i) RNNs for synchronized series with evenly spaced interval \emph{e.g.}, time series or indexed sequence with pure order information \emph{e.g.}, language; ii) asynchronous sequence with timestamp \emph{e.g.}, event data. \emph{i) Synchronized series}: RNNs have been a long time a natural tool for standard time series modeling and prediction~\cite{ConnorTNN94,ChandraNC12}, whereby the indexed series data point is fed as input to an (unfold) RNN. In a broader sense, video frames can also be treated as time series and RNN are widely used in recent visual analytics works~\cite{JainICRA16} and so for speech~\cite{GravesICML14}. RNNs are also intensively adopted for sequence modeling tasks~\cite{ChungArxiv14} when only order information is considered. \emph{ii) Asynchronous event}: In contrast, event sequence with timestamp about their occurrence, which are asynchronously and randomly distributed over the continuous time space, is another typical input type for RNNs~\cite{DuKDD16,choi2016retain} (despite its title for 'time series'). One key differentiation against the first scenario is that the timestamp or time duration between events (together with other features) is taken as input to the RNNs. By doing so, (long-range) event dependency can be effectively encoded. \textbf{Interpretability and attention model.} Prediction accuracy and model interpretability are two goals of many successful predictive methods. Existing works often have to suffer the tradeoff between the two by either picking complex black box models such as deep neural network or relying on traditional models with better interpretation such as Logistic Regression often with less accuracy compared with state-of-the-art deep neural network models. Despite the promising gain in accuracy, RNNs are relatively difficult to interpret. There have been several attempts to interpret RNNs~\cite{choi2016retain,XuICML15,cho2015describing}. However, they either compute the attention score by the same function regardless of the affected point's dimension~\cite{choi2016retain}, or only consider the hidden state of the decoder for sequence prediction~\cite{XuICML15,cho2015describing}. As for multi-dimensional point process, past events shall influence the intensity function differently for each dimension. As a result, we explicitly assign different attention function for each dimension which is modeled by respective intensity functions, thus leading to an infectivity matrix based attention mechanism which will be detailed later in this paper. \textbf{Point processes.} Point process is a mathematically rich and principled framework for modeling event data~\cite{AalenPP2008}. It is a random process whose realization consists of a list of discrete events localized in time. The dynamics of the point process can be well captured by its conditional intensity function whose definition is briefly reviewed here: for a short time window $[t,t+dt)$, $\lambda(t)$ represents the rate for the occurrence of a new event conditioned on the history $\mathcal{H}_t = \{z_i,t_i|t_i < t\}$: \begin{equation}\notag \lambda(t)=\lim_{\Delta t\rightarrow 0}\frac{\mathbb{E}(N(t+\Delta t)-N(t)|\mathcal{H}_t)}{\Delta t}=\frac{\mathbb{E}(dN(t)|\mathcal{H}_t)}{dt}, \end{equation} where $\mathbb{E}(dN(t)|\mathcal{H}_t)$ is the expectation of the number of events happened in the interval $(t, t + dt]$ given the historical observations $\mathcal{H}_t$. The conditional intensity function has played a central role in point processes and many popular processes vary on how it is parameterized. Some typical examples include: 1) \emph{Poisson process}~\cite{KingmanPP92}: the homogeneous Poisson process has a very simple form for its intensity function: $\lambda_{d}(t)=\lambda_{d}$. Poisson process and its time-varying generalization are both assumed to be independent of the history. 2) \emph{Reinforced Poisson processes}~\cite{PemantlePS07,shen2014modeling}: the model captures the `rich-get-richer' mechanism characterized by a compact intensity function, which is recently used for popularity prediction~\cite{shen2014modeling}. 3) \emph{Hawkes process}~\cite{HawkesBiometrika71}: Recently, Hawkes process has received a wide attention in network cascades modeling~ \cite{ZhouAISTATS13,farajtabar2015coevolve}, community structure~\cite{tran2015netcodec}, viral diffusion and activity shaping\cite{farajtabar2014shaping}, criminology~\cite{lewis2010self}, optimization and intervention in social networks~\cite{farajtabar2016multistage}, recommendation systems~\cite{hosseini2017recurrent}, and verification of crowd generated data~\cite{tabibian2016distilling}. As an illustration example intensively used in this paper, we particularly write out its intensity function is: \begin{align}\notag \lambda_{d} &= \mu_{d}(t) + \sum_{i:t_{i}<t}\gamma_{d_{i}d}(t-t_i) \\\notag &= \mu_{d}(t) + \sum_{i:t_{i}<t}a_{d_{i}d}\text{exp}(-w(t-t_i)), \end{align} where $\mathbf{A}_{d_{i}d}=\{a_{d_{i}d}\}$ is the infectivity matrix, indicating the directional influence strength from dimension $d_i$ to $d$. It explicitly uses a triggering term to model the excitation effect from history events where the parameter $w$ denotes the decaying bandwidth. The model is originally motivated to analyze the earthquake and its aftershocks\cite{OgataJASA88}. 4) \emph{Reactive point process}~\cite{ErtekinRPP2015}: it can be regarded as a generalization of the Hawkes process by adding a self-inhibiting term to account for the inhibiting effects from history events. 5) \emph{Self-correcting process}~\cite{IshamSPP79}: its background part increases steadily, while it is decreased by a constant $e^{-\alpha}<1$ every time a new event appears. We summarize the above forms in Table~\ref{tab:intensity}. It tries to separate the spontaneous background component and history event effect explicitly. This also motivates us to design an RNN model that can flexibly model various point process forms without model specification. \begin{table}[tb!] \centering \caption{Conditional intensity functions of point processes.} \resizebox{0.48\textwidth}{!}{ \begin{tabular}{lrr} \addlinespace \toprule Model&Background&History event effect\\ \midrule Poisson process&$\mu(t)$&$0$\\ Reinforced poisson process&$0$&$\gamma(t)\sum_{t_i<t}\delta(t_i<t)$\\ Hawkes process&$\mu(t)$&$\sum_{t_i<t}\gamma(t,t_i)$\\ Reactive point process&$\mu(t)$&$\sum_{t_i<t}\gamma_1(t,t_i)-\sum_{t_i<t}\gamma_2(t,t_i)$\\ Self-correcting process&$0$&$\exp(\mu t-\sum_{t_i<t}\gamma(t,t_i))$\\ \bottomrule \vspace{0.5mm} \end{tabular}} \small{Note:$\delta(t)$ is Dirac function, $\gamma(t,t_i)$ is the time-decaying kernel and $\mu(t)$ can be constant or time-varying function.} \label{tab:intensity} \end{table} \section{Network Structure and Learning} \label{sec:method} In this section, we will present the proposed network structure along with the learning algorithm for modeling the behavior of dynamic events. \subsection{Brief on RNN as building block}\label{subsec:brief} Taking a sequence $\{\mathbf{x}\}_{t=1}^T$ as input, the RNN generates the hidden states $\{\mathbf{h}\}_{t=1}^T$, also known high-level representation of inputs~\cite{ElmanCS90,PascanuICML13}: \begin{align}\notag \mathbf{h}_t&= f(\mathbf{W}\mathbf{x}_t+\mathbf{H}\mathbf{h}_{t-1}+\mathbf{b}), \end{align where $\mathbf{x}_t$ is the profile associated with each event, and $f$ is a non-linear function, and $\mathbf{W},\mathbf{H}, \mathbf{b}$ are parameters to be learned. One common choice for non-linear function $f$ is \emph{Sigmoid} or \emph{tanh}, who suffers from vanishing-gradients problem~\cite{pascanu2013difficulty} and poor long-range dependency modeling capability. In contrast, we implement our RNN with Long Short Term Memory (LSTM)~\cite{HochreiterNC97,GravesArxiv13} for its popularity and capability for capturing long-range dependency. In fact, other RNN variants \emph{e.g.} Gated Recurrent Units (GRU)~\cite{ChungArxiv14} can also be alternative choices, while the analysis of the consequence of this particular choice is not the focus of our paper. To make the presented paper self-contained, we reiterate the formulation of LSTM as follows: \begin{align}\notag \mathbf{i}_t&= \sigma(\mathbf{W}_i\mathbf{x}_t+\mathbf{U}_i\mathbf{h}_{t-1}+\mathbf{V}_i\mathbf{c}_{t-1}+\mathbf{b}_{i}),\\\notag \mathbf{f}_t&= \sigma(\mathbf{W}_f\mathbf{x}_t+\mathbf{U}_f\mathbf{h}_{t-1}+\mathbf{V}_f\mathbf{c}_{t-1}+\mathbf{b}_{f}),\\\notag \mathbf{c}_t&= \mathbf{f}_t\mathbf{c}_{t-1}+\mathbf{i}_t\odot\text{tanh}(\mathbf{W}_c\mathbf{x}_t+\mathbf{U}_c\mathbf{h}_{t-1}+\mathbf{b}_c),\\\notag \mathbf{o}_t&= \sigma(\mathbf{W}_o\mathbf{x}_t+\mathbf{U}_o\mathbf{h}_{t-1}+\mathbf{V}_o\mathbf{c}_{t}+\mathbf{b}_{o}),\\\notag \mathbf{h}_t&=\mathbf{o}_t\odot\text{tanh}(\mathbf{c}_t), \end{align where $\odot$ denotes element-wise multiplication and the recurrent activation $\sigma$ is the Logistic Sigmoid function. Unlike standard RNNs, the Long Short Term Memory (LSTM) architecture uses memory cells to store and output information, allowing it to better discover long-range temporal relationships. Specifically, $\mathbf{i}$, $\mathbf{f}$, $\mathbf{c}$, and $\mathbf{c}$ are respectively the input gate, forget gate, output gate, and cell activation vectors\footnote{In subsection \ref{subsec:brief} we slightly abuse the notations and in fact their effects are only valid in this subsection and have no relation to other notations used in the other parts of this paper.}. By default, the value stored in the LSTM cell $\mathbf{c}$ is maintained unless it is added to by the input gate $\mathbf{i}$ or diminished by the forget gate $\mathbf{f}$. The output gate $\mathbf{o}$ controls the emission of the memory from the LSTM cell. Compactly, we represent the LSTM system via the following equation: \begin{equation}\notag \mathbf{h}_t= \text{LSTM}(\mathbf{x}_t,\mathbf{h}_{t-1}) \end{equation \begin{figure}[tb!] \centering \subfigure{\includegraphics[width=0.35\textwidth]{pic/attention.pdf} \caption{For a sequence of events from $1$ to $j$ (in a recent time window), $\mathbf{v}_z$ is the learned feature vector for dimension $z$, $\alpha_{z_i}^z$ is the influence strength from dimension $z_i$ to $z$, and $c_j^z$ is the new representation vector of $\mathcal{H}_{t_j}$ for $z$.} \label{fig:attention} \end{figure} \begin{figure}[tb!] \centering \subfigure{\includegraphics[width=0.48\textwidth]{pic/network.pdf} \caption{Our network can be trained end-to-end. Event is embedded in low-dimensional space and then pass through attention module. Time series and event sequence are connected to an synergic mapping layer that fuses the information from two LSTMs. Then output layer consists of dimension and timestamp.} \label{fig:overview} \end{figure} \subsection{Infectivity matrix based attention mechanism} Now we give further formal notational definitions used in this paper. Time series data is denoted by $\{\mathbf{y}_t\}_{t=1}^T$, \emph{e.g.} a patient's temperature and blood pressure recorded in different dimensions of the vector $\mathbf{y}_t$. Event data is represented as $\{z_i,t_i\}_{i=1}^N$, where $z_i\in \mathbb{Z}$ is the dimension representing a categorical information (\emph{e.g} a mark or type or an agent), where $\mathbb{Z}$ is the finite set of all event types, and $t_i$ is occurrence time. The former can timely affect the transient occurrence intensity of events and the latter can often abruptly cause jump and transition of states of agents and capture long-range event dependency~\cite{HawkesJAP74}. As shown in Fig.~\ref{fig:overview}, for our proposed network, these two sources of data are fed separately to two RNNs (we call it a twin RNN structure in this paper) whose outputs are further combined to serve as the inputs of subsequent layers. For event sequence $\{z_i,t_i\}_{i=1}^N$ with length $N$, we can generate a hidden variable sequence $\{\mathbf{h}_i\}_{i=1}^N$ as the high-level representation of input sequence in RNN. To predict the dimension (\emph{e.g.} event type) $z_{j+1}$ and time $t_{j+1}$ for the $(j+1)$-th event, the history $\mathcal{H}_{t_j}= \{z_i,t_i\}_{i=1}^j$, prior to that event should be utilized. The most recent $\mathbf{h}_j$ is often regarded as a compressed representation of $\mathcal{H}_{t_j}$. One may argue the necessity for involving a twin RNN structure, since the instantaneous time series data can be sampled and fed into a single RNN along with the event data when an event occurs. However, there are particular advantages for adopting such a twin-RNN structure. Empirically, it has been shown in some recent study~\cite{JainICRA16} that using separate RNN for each time series data \emph{e.g.}, video and time series sensors can lead to better prediction accuracy than a single RNN fed with the combination of the multiple time series data. More importantly, the events can occur in arbitrary timestamp \emph{i.e.}, they are asynchronous while the time series data is often sampled with equal time interval being a synchronous sequence. This inherent difference inspires us to model these two different sequence data via separate RNN as their dynamics can be rather varying. However, there are still two limitations for the above approach: i) The prediction capability or model expressiveness is limited: in fact only the recently updated hidden variable $\mathbf{h}_j$ is used for prediction regardless of the length of input sequence. ii) The interpretability is limited. As we compress all information into a fixed vector $\mathbf{h}_j$, it is hard to infer which event contributes most to the prediction. For example in the problem of multi-dimensional Hawkes process learning, one important goal is to uncover the hidden network structure, infectivity matrix $A$, from real-world event sequences, such as the influence strength between users in social network~\cite{ZhouAISTATS13,farajtabar2015coevolve}, or progression relationship between event types~\cite{choi2015constructing}. Uncovering the hidden structure is also stressed in causal analysis~\cite{XuICML16}, which gives much evidence for prediction result. This calls for particular mechanisms to improve its flexibility and interpretability. In this work, we devise a temporal attention mechanism to enable interpretable prediction models for point processes. Events from a certain dimension may have higher influence on some dimensions. We exploit this observation to make the trained neural network model more interpretable and expressive. To achieve this, we first expand the representation of $\mathcal{H}_{t_j}$ to be a set of vectors $\{\mathbf{h}_i\}_{i=1}^j$ instead of only the most recent $\mathbf{h}_j$, referred as context vectors. Each of them is localized to its respective preceding event of interest from inputs $\{z_i,t_i\}_{i=1}^j$. Inspired by the Hawkes process, the influence strength $ \alpha_{z_i}^z$ from $z_i$ to $z$ is introduced and it is modeled by: \begin{equation}\label{eq:context_score} \alpha_{z_i}^z = f_{att}(\mathbf{h}_i,\mathbf{v}_z) \end{equation} where $\mathbf{v}_z$ is the feature vector to be learned for the particular prediction dimension $z$ and $f_{att}$ is the score function which gives the influence strength from $z_i$ to $z$. Once the influence strength $\alpha_{z_i}^z$ are computed, we can generate the representation vector $\mathbf{c}_j^z$ for the next layer: \begin{equation} \mathbf{c}_j^z = \phi(\{\mathbf{h}_i\}_{i=1}^j,\{\alpha_{z_i}^z\}_{i=1}^j), \end{equation}\label{eq:generate_context} where $\phi$ is the attention function, which computes the final representation of $\mathcal{H}_{t_j}$. Here we choose the widely used soft attention mechanism~\cite{XuICML15}, whose influence from former events is in an additive form~\cite{farajtabar2015coevolve}: \begin{equation}\label{eq:context_vector} \mathbf{c}_j^z = \sum_{i=1}^S \alpha_{z_i}^z \mathbf{h}_i \end{equation} Note that hard attention~\cite{cho2015describing} only assigns 0 or 1 to the influence strength $ \alpha_{z_i}^z$, which is too rough to capture fine-grained influence. Since the cost is differentiable with respect to the parameters, we can easily train the network end-to-end using backpropagation. After the model is trained \emph{i.e.} the parameter $\mathbf{v}_z$ is fixed, for each testing event sequence $k$ and its computed $\{\{\alpha_{z_i}^z\}_{i=1}^j\}_k$ by Eq.\ref{eq:context_score}, we define the infectivity matrix to reflect the mutual influence among dimensions as $\mathbf{A}_{z_i,z}=\langle \alpha_{z_i}^{z} \rangle, z_i,z\in \mathbb{Z}$, where $\langle \cdot \rangle$ represents the average of all $\{\alpha_{z_i}^{z}\}_k$ divided by $k$. The attention mechanism is depicted in Fig.~\ref{fig:attention}. This attention mechanism can allow the network to refer back to the preceding hidden variables $\{\mathbf{h}_j\}_{i=1}^j$, instead of forcing it to encode all information into the recent $\mathbf{h}_j$. It can retrieve from internal memory and choose what to attend to. Finally we point out that in the context of point process, our attention mechanism is different from the existing work~\cite{choi2016retain,XuICML15,cho2015describing} in that they only consider one-way effect over the sequence. In another word, their approaches are current state agnostic. This leads to a vector representation (similar to the role of the vector $\mathbf{v}_z$ used in Eq.\ref{eq:context_score}) for the weight variables $\mathbf{\alpha}$ instead of a two-way infectivity matrix $\mathbf{A}$. Moreover, to make the model tractable, we use a parameterized form by Eq.\ref{eq:context_score} to represent the two-way weights. \subsection{Network structure} Now we give the full description of our network whose overview is depicted in Fig.~\ref{fig:overview}. The dashed part in the right of figure is illustrated in detail in Fig.~\ref{fig:attention}. For time series data \emph{e.g.}, temperature, blood pressure, they are sampled evenly over time. We use $\{\mathbf{y}_t\}_{t=1}^T$ to indicate the dense feature vector sampled at different timestamps. Those signals are expected to reflect the states of each dimension and drive the occurrence intensity of events. Hence we have: \begin{equation} \label{eq:continuous_lstm} \notag \mathbf{h}^y_t= \text{LSTM}_{y}(\mathbf{y}_t,\mathbf{h}^y_{t-1}) \end{equation} For event sequence $\{z_i,t_i\}_{i=1}^N$, we can generate hidden states through LSTM, which can capture long-range dependency of events. First we project the dimension $z_i$ to a low-dimensional embedding vector space. Then the embedding vector combined with timestamps is fed to LSTM. We use the following equation to represent the process: \begin{align}\notag \label{eq:event_lstm} &\mathbf{e}_i = \mathbf{W}_{em}\mathbf{z}_i,\\ &\mathbf{h}_i^e = \text{LSTM}_{z}(\{\mathbf{e}_i,\mathbf{t}_i\},\mathbf{h}_{i-1}^e), \notag \end{align} where $\mathbf{e}_i$ denotes the embedding vector of input $\mathbf{z}_i$ and $\mathbf{W}_{em}$ the embedding matrix to learn. For dimension $z$, its final representation of $\mathcal{H}_{t_j}$ is $\mathbf{c}_j^z$, which is obtained through the attention mechanism introduced in Eq.~\ref{eq:context_vector}. For the score function of Eq.~\ref{eq:context_score}, we specify it by: \begin{equation} \label{eq:score_fun} f_{att}(\mathbf{h}_i^e,\mathbf{v}_z)= \begin{cases} 0, & \text{if}\ |\text{tanh}(\mathbf{h}_i^e*\mathbf{v}_z)| < \epsilon \\ |\text{tanh}(\mathbf{h}^e_i*\mathbf{v}_z)|, & \text{otherwise} \end{cases} \end{equation} When the context vector $\mathbf{h}_i^e$ is similar to $\mathbf{v}_z$, the attention function $f_{att}$ produces a large score. Otherwise a small one. In an extreme case, the score is zero when the context vector is orthogonal to feature vector $\mathbf{v}_z$ of dimension $z$. To promote sparsity of infectivity matrix, we threshold the score with a minus $\epsilon$ operation. The threshold $\epsilon$ can control the degree of sparsity which is set to $0.01$ throughout this paper. Note the form of Eq.~\ref{eq:score_fun} is also used in~\cite{XuICML15,cho2015describing} to model the one-way attention weight $\alpha_i=f_{att}(\mathbf{h}_i,\mathbf{v})$. From this, it is clear that our model for the attention is two-way between dimension $i$ to $z$ as shown in Eq.~\ref{eq:context_score}. To jointly model event sequence and time series, we combine them into one synergic layer as illustrated in Fig.~\ref{fig:overview}: \begin{equation} \mathbf{s}^z_{j} = \text{f}_{syn}(\mathbf{W}_f[\mathbf{h}^y_{t_j},\mathbf{c}_j^z]+\mathbf{b}_f), \end{equation where $[\mathbf{h}^y_{t_j},\mathbf{c}_j^d]$ is the concatenation of the two vectors. The synergic layer can be any function, coupling two data sources together. Here we use the Sigmoid function. As a result, we obtain a representation $\mathbf{s}^z_j$ for the output dimension $z$. We can use this representation to compute the intensity for each dimension and then simulate its next occurrence time and its dimension jointly. Here we take a more efficient approach by firstly predicting the next event's dimension and then further predicting the occurrence timestamp based on the predicted event dimension. Note that the intensity function is modeled implicitly within the neural network architecture and we directly model the timing and dimension of the events. In this way, we overcome the expensive computation cost from explicit parametric form of intensity function. To predict the next event's dimension $\mathbf{u}_{j+1}$, we apply the Softmax operation to those representations $\{\mathbf{s}^z_j\}_{z=1}^{Z}$ where $Z$ is the number of event dimensions. \begin{equation} \mathbf{u}_{j+1} =\text{softMax}(\mathbf{w}_u\mathbf{s}_j^1,\ldots,\mathbf{w}_u\mathbf{s}_j^Z) \end{equation} where $\mathbf{w}_u$ are model parameters to learn. The optimal dimension $z_{j+1}^*$ (as the prediction result) is computed by selecting the corresponding maximum element in $\mathbf{u}_{j+1}$: \begin{equation} z_{j+1}^* = \underset{d}{\operatorname{argmax}} \quad \mathbf{u}_{j+1} \end{equation} After we obtain the optimal dimension $z_{j+1}^*$, we use the representation $\mathbf{s}^{z_{j+1}^*}_{j}$ to derive occurrence time following: \begin{equation} {t}_{j+1}^* = \mathbf{w}_s\mathbf{s}_j^{ z_{j+1}^*}+{b}_s, \end{equation} where $\mathbf{w}_s$ are model parameters for learning. \subsection{End-to-end learning} The likelihood of observing a sequence $\{z_i,t_i\}_{i=1}^N$ along with time series signals $\{\mathbf{y}_t\}_{t=1}^T$ can be expressed as follows: \begin{small} \begin{equation} \mathcal{L}\big(\{z_i,t_i\}_{i=1}^N\big) = \sum_{j=1}^{N-1}\{\mathbf{b}_{z_{j+1}}\log(\mathbf{u}^{z_{j+1}}_{j+1})+\log\left(f(t_{j+1}|\mathcal{H}_{t_j})\right)\} \label{eq:loss} \end{equation} \end{small} where the weight parameters $\mathbf{b}$ are set as the inverse of the sample count in that dimension against the total size of samples, to weight more on those dimensions with fewer training samples. This is in line with the importance weighting policy for skewed data in machine learning~\cite{rosenberg2012classifying}. For the second term, the underlying rationale is that we not only encourage correct prediction of the coming event dimension, but also require the corresponding timestamp of the event to be close to the ground truth. We adopt a Gaussian penalty function: \begin{equation}\notag f(t_{j+1}|\mathcal{H}_{t_j})=\frac{1}{\sqrt{2\pi\sigma}}\exp\left(\frac{-(t_{j+1}-t^*_{j+1})^2}{2\sigma^2}\right) \end{equation} As shown in Fig.~\ref{fig:overview}, the output $t^*_{j+1}$ from the timestamp prediction layer is fed to the classification loss layer to compute the above penalty given the actual timestamp $t_{j+1}$. We adopt RMSprop gradients~\cite{RmspropArxiv15} which have been shown to work well on training deep networks to learn these parameters. By directly optimizing the loss function, we learn the prediction model in an end-to-end manner without the need for sophisticated or carefully designed algorithms (\emph{e.g.}, Majorization-Minimization techniques~\cite{YanIJCAI2013,farajtabar2015coevolve}) used in generative Point process models. Moreover, as pointed out by recent work~\cite{XuTKDE16}, another limitation for the generative point process model is that they are aimed to maximize the joint probability of all observed events via a maximum likelihood estimator, which is not tailored to the prediction task. \section{Experiments and Discussion}\label{sec:experiment} We evaluate the proposed approach on both synthetic and real-world datasets, from which three popular application scenarios are covered: social network analysis, electronic health records (EHR) mining, and proactive machine maintenance. The first two scenarios involve public available benchmark dataset: MemeTracker and MIMIC, while the latter involves a private ATM maintenance dataset from a commercial bank headquartered in North America. The code is based on Theano running on a Linux server with 32G memory, 2 CPUs with 6 cores for each: Intel(R) Xeon(R) CPU E5-2603 [email protected]. We also use 4 GPU:GeForce GTX TITAN X with 12G memory backed by CUDA and MKL for acceleration. \subsection{Baselines and evaluation metrics} We compare the proposed method to the following algorithms and state-of-the-art methods: 1) \textbf{Logistic model}: We use Logistic regression for event timestamp prediction and an independent Logistic classification model for event type prediction. To make sure the proposed method and the logistic model use the same amount of information, the predictor features in the regression are comprised of the concatenation of feature vectors for sub-windows of all active time series RNN. 2) \textbf{Hawkes Process}: To enable multi-type event prediction, we use a Multi-dimensional Hawkes process~\cite{ZhouAISTATS13,farajtabar2014shaping}. The Full, Sparse, LowRankSparse indicate the different types of Hawkes Process model. The full model has no regularization on infectivity matrix while the Sparse and LowRankSparse ones have sparse and lowrank-sparse regularization, respectively. In the following, Hawkes process indicates LowRankSparse model if not explicitly mentioned. The inputs are comprised of event sequences with dimensions and timestamps. 3) \textbf{Recurrent Marked Temporal Point Processes (RMTPP)}:~\cite{DuKDD16} uses a neural network to model the event dependency flexibly. The inputs are event sequences with continuous signals sampled when they happen. The method can only sample features of transient time series when the events happen and use partially parametric form for the base intensity and a time-decaying influence from former event to the current one. Another difference is that it assumes an independent distribution between time and marks and predicts the dimension and time independently given the learned representation of the history. 4) \textbf{TRPP}: This method uses time series and event sequences to collaboratively model the intensity function of point process. The model uses RNN to model the non-linear mapping from history to the predicted marker and time, and treats RNN as a block box without much interpretability. Here we rename it as \textbf{Twin Recurrent Point Processes (TRPP)}. This method is the one presented in the conference version of this paper~\cite{XiaoAAAI17}. 5) \textbf{ERPP}: We also include \textbf{TRPP}'s degraded version by only keeping the event sequence as input and removing the time series RNN, which is termed by \textbf{Event Recurrent Point Processes (ERPP)}. Including the term `event' also helps distinguish it from the existing term RPP: Reinforced Poisson Processes~\cite{PemantlePS07,shen2014modeling}. 6) \textbf{Markov Chain (MC)}: The Markov chain refers to the sequence of random variables, with the Markov property that future state only depends on the current state and is conditionally independent of the history. The order of Markov chain indicates how many recent states on which the future state depends. As this model can only learn the transition probability of dimensions, we use it to predict the dimensions without taking the time into account. The optimal order of Markov chain is determined by the performance on separate validation dataset. 7) \textbf{Continuous Time Markov Chain (CTMC)}: The CTMC is a special type of semi-Markov model, which models the continuous transition among dimensions as a Markov process. It predicts the next dimension with the earliest transition time, therefore, it can jointly predict time and dimension. 8) \textbf{Homogeneous Poisson Process}: This method implements the most basic point process model in which the intensity function is constant and events occur independently. It can estimate interval-event gaps. 9) \textbf{Self-correcting Process}: When the occurrence of an event decrease the probability of other events, we are facing a variant of point process called self-correcting processes. Its intensity function is shown in Table~\ref{tab:intensity} and it can estimate the inter-event time. Inline with the above TRPP and ERPP methods, we term our model \textbf{Attentional Twin Recurrent Point Processes (ATRPP)}. To further study the effect of the time series RNN, we also evaluate the baseline version without using this channel, which is termed as \textbf{Attentional Event Recurrent Point Processes (AERPP)}. \textbf{Evaluation metrics}. We use several common metrics for performance evaluation. For the next event dimension prediction, we adopt \emph{Precision}, \emph{Recall}, \emph{F1 Score} and \emph{Confusion matrix}. For event time prediction, we use the \emph{Mean Absolute Error (MAE)} which measures the absolute difference between the predicted time point and the actual one. For the infectivity matrix, we use \emph{RankCorr}~\cite{ZhouAISTATS13} to measure whether the relative order of the estimated influence strength is correctly recovered, when the true infectivity matrix is available. The \emph{RankCorr} is defined as the averaged Kendall rank correlation coefficient\footnote{https://en.wikipedia.org/wiki/Kendall\_rank\_correlation\_coefficient} between each row of ground-truth and estimated infectivity matrix. \emph{RelErr} measures the relative deviation between estimated $a_{ij}^*$ and and ground-truth $a_{ij}$, which is defined as the average of $\frac{|a_{ij}^*-a_{ij}|}{a_{ij}}, i,j\in \mathbb{Z}$. \begin{figure*}[tb!] \centering \subfigure{\label{fig:syn_mae} \includegraphics[width=0.24\textwidth]{pic/syn_mae}} \subfigure{\label{fig:syn_accracy} \includegraphics[width=0.24\textwidth]{pic/syn_accuracy}} \subfigure{\label{fig:syn_RelErr} \includegraphics[width=0.24\textwidth]{pic/syn_RelErr}} \subfigure{\label{fig:syn_rankcorr} \includegraphics[width=0.24\textwidth]{pic/syn_RankCorr}} \caption{Performance for MAE, Accuracy, RelErr, RankCorr over the synthetic data.} \label{fig:synthetic_performance} \end{figure*} \subsection{Experiments on synthetic data} The test on synthetic data provides a quantitative way for evaluating the performance of compared methods. \textbf{Synthetic data generation}. We use simulated data with known ground-truth to quantitatively verify our model by aforementioned metrics. Specifically, we generate cascades from multi-dimensional hawkes process via the Thinning algorithm~\cite{ogata1981lewis}. We choose $Z=20$ for the number of event dimensions. The background intensity term is set uniformly at random: $\mu_d \sim U(0,0.01)$. Mutual influence is set similarly to $a_{ij}\sim U(0,0.1)$. Half of the elements in the infectivity matrix are set to 0 by random in order to mimic the sparsity of influence between dimensions in many real-world problems. For the stability of the simulation process, the matrix is scaled such that its spectral radius is no larger than one. The decaying parameter in the Hawkes process is set to $w=0.01$. The detailed description of these parameters can be found in Sec.~\ref{sec:introduction} for the Hawkes process. We simulate 5000 independent cascades, 3000 for training, 1000 for validating, and 1000 for testing, respectively. To generate time series signals, $y$, with some explanation capability to the background intensity, we sample from $y=\mu_d+n_d$ for all dimensions $d$, where, $n_d$ is a Gaussian noise, $n_d \sim U(0,0.001)$. \textbf{Experimental results}. The performance on synthetic data is shown in Fig.~\ref{fig:synthetic_performance}. The relative error of infectivity matrix, RankCorr is demonstrated to verify the capability of uncovering hidden network structure among those dimensions \emph{i.e.}, the nodes in the network. The accuracy of time and dimension prediction is shown in order to compare the predictive performance. Our model achieves a better prediction performance, and meanwhile uncovers the infectivity matrix better than the alternatives. The self-correcting process suffers from model misspecification and performs worse than other point process models as the events are self-exciting not self-correcting. Our non-parametric model can learn from data and generalize well without prior knowledge of data. \subsection{Predictive machine maintenance} Predictive maintenance is a sound testbed for our model. It involves equipment risk prediction to allow for proactive scheduling of corrective maintenance. Such an early identification of potential concerns helps deploy limited resources more efficiently and cost effectively, reduce operations costs and maximize equipment uptime. Predictive maintenance is adopted in a wide variety of applications such as fire inspection, data center and electrical grid management e.g. \cite{ErtekinRPP2015}. For its practical importance in different scenarios and relative rich event data for modeling, we target our model to a real-world dataset of more than 1,000 automated teller machines (ATMs) from a global bank headquartered in North America. We have no prior knowledge on the dynamics of the complex system and the task can involve arbitrarily working schedules and heterogeneous mix of conditions. It takes much cost or even impractical to devise specialized models. The studied dataset is comprised of the event logs involving error reporting and failure tickets, which is originally collected from 1,554 ATMs. The event log of error records includes device identity, timestamp, message content, priority, code, and action. A ticket (TIKT) means that maintenance will be conducted. Statistics of the data is presented in Table~\ref{tab:type_statistics}. The error type indicates which component encounters an error: 1) printer (PRT), 2) cash dispenser module (CNG), 3) Internet data center (IDC), 4) communication part (COMM), 5) printer monitor (LMTP), 6) miscellaneous \emph{e.g.}, hip card module, usb (MISC). The time series here consists of features: i) the inventory information: ATM type, age, operations, temperatures; ii) event frequency for each event in the recent an hour interval. The event types and their occurrence time from the ATMs are an event sequences. Therefore, there are 1554 sequences in total, which are randomly divided into training (50\%), validating (20\%) and testing (30\%) portions. \begin{table}[t] \centering \caption{Statistics of event count per ATM, and timestamp interval in days for all ATMs (in brackets).}% \resizebox{0.48\textwidth}{!}{ \begin{tabular}{lrrrrr} \toprule type&total&max&min&mean&std\\ \midrule TIKT&2226(--)&10(137.04)&0(1.21)&2.09(31.70)&1.85(25.14)\\ PRT&9204(--)&88(210.13)&0(0.10)&8.64(12.12)&11.37(21.41)\\ CNG&7767(--)&50(200.07)&0(0.10)&7.29(15.49)&6.59(23.87)\\ IDC&4082(--)&116(206.61)&0(0.10)&3.83(23.85)&5.84(30.71)\\ COMM&3371(--)&47(202.79)&0(0.10)&3.16(22.35)&3.90(29.36)\\ LMTP&2525(--)&81(207.93)&0(0.10)&2.37(22.86)&4.41(34.56)\\ MISC&1485(--)&32(204.41)&0(0.10)&1.39(24.27)&2.54(34.38)\\ \bottomrule \end{tabular}} \label{tab:type_statistics} \end{table} \begin{table}[t] \centering \caption{Prediction performance evaluation on the ATM maintenance dataset.} \resizebox{0.48\textwidth}{!}{ \begin{tabular}{lrrrr} \toprule model &precision &recall &F1 score & MAE\\ \midrule Poisson & ----- & ----- & ----- & 4.76\\ SelfCorrecting & ----- & ----- & ----- & 4.65 \\ Markov Chain & 0.530 &0.591 & 0.545 & -----\\ CTMC & 0.516&0.554& 0.503& 5.16\\ Logistic & 0.428 & 0.375 & 0.367 & 4.51\\ Hawkes & 0.459 & 0.514 & 0.495 & 5.43\\ RMTPP & 0.587& 0.640 & 0.607& 4.31\\ TRPP & 0.607& 0.661& 0.626& 4.18\\ ERPP & 0.559& 0.639& 0.599& 4.37\\ ATRPP & $\mathbf{0.615}$&$\mathbf{0.688}$& $\mathbf{0.634}$& $\mathbf{3.92}$ \\ AERPP & 0.599& 0.672& 0.617& 3.98\\ \bottomrule \end{tabular}} \label{tab:performance} \end{table} \begin{figure*}[t] \centering \subfigure[\scriptsize ATRPP]{\label{fig:atm_isrpp} \includegraphics[width=0.26\textwidth]{pic/atm_isrpp}} \subfigure[\scriptsize AERPP]{\label{fig:srnn} \includegraphics[width=0.26\textwidth]{pic/atm_srnn}} \subfigure[\scriptsize Hawkes]{\label{fig:atm_hawkes} \includegraphics[width=0.26\textwidth]{pic/atm_hawkes}}\\ \subfigure[\scriptsize TRPP]{\label{fig:atm_irpp} \includegraphics[width=0.26\textwidth]{pic/atm_irpp}} \subfigure[\scriptsize ERPP]{\label{fig:atm_ernn} \includegraphics[width=0.26\textwidth]{pic/atm_ernn} \subfigure[\scriptsize RMTPP]{\label{fig:atm_rmtpp} \includegraphics[width=0.26\textwidth]{pic/atm_rmtpp}}\\%\vspace{-8pt} \subfigure[\scriptsize CTMC]{\label{fig:atm_cmtc} \includegraphics[width=0.26\textwidth]{pic/atm_cmtc} \subfigure[\scriptsize Markov Chain]{\label{fig:atm_mc} \includegraphics[width=0.26\textwidth]{pic/atm_mc} \subfigure[\scriptsize Logistic]{\label{fig:atm_logistic} \includegraphics[width=0.26\textwidth]{pic/atm_logistic}}\\%\hspace{-2pt} \caption{Confusion matrices over different event dimensions on the ATM maintenance dataset.} \label{fig:confusion} \end{figure*} \begin{figure}[t] \centering \subfigure{\includegraphics[width=0.32\textwidth]{pic/atm_infect} \caption{Visualization of infectivity matrix for ATM events. Each node denotes different event type. The edge direction indicates the influence direction and its width denotes the effect, the wider the stronger.} \label{fig:atm_infect} \end{figure} Table \ref{tab:performance} shows the averaged performance of the proposed method compared to the alternatives. The confusion matrix for the seven event types are shown in Fig.~\ref{fig:confusion} by all methods. Not surprisingly, for both event type and timestamp prediction, our main approach, \emph{i.e.}, \textbf{ATRPP} outperforms by a notable margin. \textbf{ATRPP} report 0.634 F1 score and 3.92 MAE while \textbf{AERPP} reaches 0.617 F1 score and 3.98 MAE. Obviously, this verifies that synergically modeling event sequence and time series can boost the performance of predicting future events and time.Interestingly, all point process based models obtain better results on this task which suggests they are more promising compared to classical classification models. Indeed, our methodology provides an end-to-end learning mechanism without any pre-assumption in modeling point process. All these empirical results on real-world tasks suggest the efficacy of our approach, especially in capturing the temporal dynamics of events data. \textbf{Visualization of influence pattern}. We visualize the infectivity matrix of \textbf{ATRPP} as in Fig.~\ref{fig:atm_infect}. Each node denotes one dimension which here represents one type of events. The directed edge means the influence strength from source node to destination node. The size of nodes and depth of color is proportional to the weighted degree of nodes, which indicate the total influence of the node has on others. The width of edges is is proportional to the strength of influence. Self-loop edges are located at the right of nodes without an arrow. Note this setting applies to the subsequent two experiments. As is shown, it's obvious that TIKT (maintenance) have a strong influence over all types of errors (breakdown) as maintenance can greatly decrease the probability of breakdown of machines. Also, self-loop edge of TIKT node is too small to see which indicates that maintenance has low correlation itself. All types of errors have self-loop, indicating a recurrent pattern of errors. The breakdown of communication module (COMM) often leads to disfunction of cash dispenser module (CNG), printer (PRT) and internet data center (IDC). Besides, internet data center (IDC) problems influence cash dispenser module (CNG) and printer (PRT) weakly. \subsection{Social network analysis} In line with the previous works for information diffusion tracking~\cite{farajtabar2016multistage,ZhouAISTATS13,rodriguez2014uncovering}, the public dataset MemeTracker\footnote{http://memetracker.org} is used in this paper, which contains more than 172 million news articles or blog posts from various online media. The information, such as ideas, products and user behaviors, propagates over sites in a subtle way. For example, when Mark Zuckerberg posted "I just killed a pig and a goat", the meme appeared on the \emph{theguardian}, \emph{Fortune}, \emph{Business Insider} one after the other and it became viral. This cascade can be regarded as a realization of an information diffusion over the network. By looking at the observed diffusion history, we want to know through which site and when a particular meme is likely to spread. Besides, we want to uncover the hidden diffusion structure from those meme cascades, which is useful in other social network analysis applications, \emph{e.g.}, marketing by information maximization \cite{ZhuangICDM13}. From online articles, we collect more than 1 million meme cascades over different websites. For each meme cascade, we have the timestamp when sites mention a specific meme. For the experiments here, we use the top 500 media sites with the largest number of documents and select the meme cascades diffuse over them as done in previous works~\cite{farajtabar2016multistage,ZhouAISTATS13}. As a result, we obtain around 31 million meme cascades, which are randomly split into training (50\%), validating (\%20) and testing (\%30) parts. The event sequences are the meme cascades, which contain the website (dimension) and the timestamp. We count the times that a meme is mentioned during an hour over all the websites and use it as the time-series to reflect the hotness of the meme and the activity of websites.. The time interval of meme is shown in Fig.~\ref{fig:meme_time}. As the ground truth of network is unknown, we proceed by following the protocol as designed and adopted in ~\cite{gomez2010inferring,gomez2011uncovering,ZhouAISTATS13}. We create a graph $G$, for which each node is a website. If a post on site $u$ has a hyperlink pointed to site $v$, then we create a directed edge $(u,v)$ with weight 1. If multiple hyperlinks exist between two sites, then the weight is accumulated. We use the graph as the ground truth and compare it with the inferred infectivity matrix from meme cascades. The prediction performance is evaluated by \emph{Accuracy@k}, which evaluates whether the true label is within the top $k$ predicted dimensions. \begin{table}[tb!] \centering \caption{Prediction evaluation by accuracy and MAE (mean absolute error) on MemeTracker dataset.} \resizebox{0.48\textwidth}{!}{ \begin{tabular}{lrrr} \toprule model &accuracy@10 &accuracy@5 & MAE\\ \midrule Poisson & ----- & ----- & 1.63\\ SelfCorrecting & ----- & ----- & 1.70 \\ Markov Chain & 0.563 &0.472 & ----- \\ CTMC & 0.513 & 0.453& 1.69 \\ Logistic & 0.463 &0.416& 1.72 \\ Hawkes & 0.623 &0.563& 1.68 \\ RMTPP & 0.679 & 0.589&1.55 \\ TRPP & 0.681 & 0.592&1.52 \\ ERPP & 0.673 & 0.586&1.56\\ ATRPP & $\mathbf{0.694}$ & $\mathbf{0.598}$& $\mathbf{1.43}$\\ AERPP & 0.678 & 0.589&1.45 \\ \bottomrule \end{tabular}} \label{tab:meme_performance} \end{table} \begin{figure}[htb!] \centering \label{fig:meme_cluster4} \includegraphics[width=0.49\textwidth]{pic/meme_cluster4}\\%\hspace{-2pt} \label{fig:meme_cluster11} \includegraphics[width=0.49\textwidth]{pic/meme_cluster11 \caption{Examples of detected media communities over the inferred diffusion network by our method ATRPP.} \label{fig:meme_graph} \end{figure} \begin{figure}[tb!] \centering \subfigure{\includegraphics[width=0.4\textwidth]{pic/RankCorr} \caption{Performance measured by RankCorr on the MemeTracker dataset.} \label{fig:meme_rank} \end{figure} The prediction performance is shown in Table~\ref{tab:meme_performance} from which one can observe our model outperforms the alternatives. The rank correlation is shown in Fig.~\ref{fig:meme_rank}. Our models \textbf{ATRPP}, \textbf{AERPP} can better uncover the infectivity matrix than the competitive methods in terms of the correlation rank metric. In order to visualize the learned network, we use community detection algorithm~\cite{blondel2008fast} with resolution 0.9~\cite{lambiotte2008laplacian} over learned directed network of \textbf{ATRPP}, which renders 18 communities. The resolution parameter controls the resolution of detected communities. It is set to lower values to get more communities (smaller ones), and is set higher to get fewer communities (bigger ones). Therefore, the communities can vary from the macroscale in which all nodes belong to the same community, to the microscale in which every node forms its own community. Fig.~\ref{fig:meme_graph} shows some examples of those communities. Some media domains, like \emph{liverpooldailypost.com} dominate in the cluster and what they publish usually spread to others and get viral. \begin{figure}[htb!] \centering \subfigure[\scriptsize MemeTracker]{\label{fig:meme_time} \includegraphics[width=0.23\textwidth]{pic/meme_time}} \subfigure[\scriptsize MIMIC]{\label{fig:mimic_time} \includegraphics[width=0.23\textwidth]{pic/mimic_time}} \caption{Distribution of time interval between two events.} \label{fig:time_dis} \end{figure} \subsection{Electronic health records mining} Uncovering the disease progression relation is important in healthcare analytics, which helps take preventive measures before fatal diseases happen. MIMIC-III (Medical Information Mart for Intensive Care III) is a large, publicly available dataset\footnote{https://mimic.physionet.org}, which contains de-identified health-related data during 2001 to 2012 for more than 40,000 patients. It includes information such as demographics, vital sign measurements, diagnoses and procedures. For each visit, a patient receives multiple diagnoses, with one as the primary one. We filter out 937 patients and 75 diseases. The age, weight, heart rate and blood pressure are used as time series signals of patients. The distribution of time intervals between every two visits is shown in Fig.~\ref{fig:mimic_time}. We have used the sequences of 600 patients to train, 100 to evaluate and the rest for test. \begin{table}[tb!] \centering \caption{Prediction evaluation on the MIMIC dataset.} \resizebox{0.35\textwidth}{!}{ \begin{tabular}{lrr} \toprule model &accuracy & MAE\\ \midrule Poisson & ------ & 0.562\\ SelfCorrecting & ------ & 0.579 \\ Markov Chain & 77.53\% & ------ \\ CTMC & 73.62\% & 0.583 \\ Logistic & 69.36\% & 0.643 \\ Hawkes & 78.37\% & 0.517 \\ RMTPP & 82.52\% & 0.546 \\ TRPP & 82.26\% & 0.513 \\ ERPP & 78.23\% & 0.521\\ ATRPP & $\mathbf{85.23\%}$ & $\mathbf{0.497}$\\ AERPP & 83.96\% & 0.503 \\ \bottomrule \end{tabular}} \label{tab:mimic_performance} \end{table} \begin{figure*}[htb!] \centering \subfigure[\scriptsize Liver Diseases]{\label{fig:mimic_cluster8} \includegraphics[width=0.32\textwidth]{pic/mimic_cluster8} \subfigure[\scriptsize Respiratory diseases]{\label{fig:mimic_cluster3} \includegraphics[width=0.32\textwidth]{pic/mimic_cluster3} \subfigure[\scriptsize Alcohol-related diseases]{\label{fig:mimic_cluster6} \includegraphics[width=0.32\textwidth]{pic/mimic_cluster6}}\\%\vspace{-8pt} \subfigure[\scriptsize Heart and blood related diseases]{\label{fig:mimic_cluster2} \includegraphics[width=0.32\textwidth]{pic/mimic_cluster2} \subfigure[\scriptsize Blood metabolic diseases]{\label{fig:mimic_cluster7} \includegraphics[width=0.32\textwidth]{pic/mimic_cluster7} \caption{Communities detected from the learned directed diseases network (these results have been qualitatively checked by the clinical experts based on their knowledge and exeprience). In Fig.~\ref{fig:mimic_cluster8}, AMI: Acute myocardial infarction of other anterior wall; postop: postoperative; Compl: Complications. In Fig.~\ref{fig:mimic_cluster3}, Ch obst asth w (ac) exac: Chronic obstructive asthma with (acute) exacerbation; bronc: bronchitis; adhes: adhesions; mech comp:mechanical complication; chronc resp fail: chronic respiratory failure. In Fig.~\ref{fig:mimic_cluster6}, React-indwell urin cath: reaction to indwelling urinary catheter; React-cardiac dev/graft: reaction to cardiac device and graft; E coli septicemia: Septicemia due to escherichia coli; hemorr: Hemorrhage; Crbl art ocl: Cerebral artery occlusion. In Fig.~\ref{fig:mimic_cluster2}, parox ventric tachycard: paroxysmal ventricular tachycardia; Ac vasc insuff intestine: Acute vascular insufficiency of intestine; Trachea \& bronch dis NEC: Other diseases of trachea and bronchus. In Fig.~\ref{fig:mimic_cluster7}, DMI: Diabetes with ketoacidosis type I; Hyp kid NOS w cr: hypertensive chronic kidney disease; dialys dev/grft: renal dialysis device \& graft; Pulm embol/infarct: pulmonary embolism and infarction.} \label{fig:mimic_graph} \end{figure*} Similar to MemeTracker, community detection algorithm~\cite{blondel2008fast} with resolution 0.9 is applied on the learned directed network from \textbf{ATRPP}. The results show cohesion within communities, which demonstrates the effectiveness of our attention mechanism. Note that some edges are too small to be visible. Specifically, Fig.~\ref{fig:mimic_cluster8} is about liver diseases. The node of \emph{alcohol cirrhosis} has a large self-loop edge, which means this disease generally repeats many times. Besides, it has a large edge towards \emph{complications of transplanted kidney} and \emph{hepatic encephalopathy}, which means \emph{alcohol cirrhosis} has a high probability of developing into the these two diseases. Fig.~\ref{fig:mimic_cluster3} is about respiratory diseases. Similarly, \emph{mechanical complication of tracheostomy} and \emph{pseudomonal pneumonia} have large self-loop edges, indicating they often relapse. \emph{Mechanical complication of tracheostomy} has an edge towards \emph{pseudomonal pneumonia} while the reverse, interestingly, does not exist. Fig.~\ref{fig:mimic_cluster6} shows the graph for alcohol-related diseases. Obsessed in alcohol has impact on \emph{reaction to indwelling urinary catheter} regarding urinary system and \emph{hemorrhage of gastrointestinal tract} regarding gastrointestinal system. Fig.~\ref{fig:mimic_cluster2} is about heart and blood related diseases. Three different parts of body form a progression line, consisting of \emph{diseases of trachea and bronchus} (respiratory disease), \emph{paroxysmal ventricular tachycardia} (heart rate disturbance) and \emph{acute vascular insufficiency of intestine} (intestinal disease). The other line is \emph{septicemia} leads to \emph{acute myocardial infarction of other anterior wall} (heart attack), which results in \emph{paroxysmal ventricular tachycardia} (heart rate disturbance). Fig.~\ref{fig:mimic_cluster7} is about blood metabolic diseases. \emph{Hemorrhage complicating a procedure} leads to \emph{pulmonary embolism and infarction} and \emph{complications due to renal dialysis device, implant, and graft}. \emph{Diabetes with ketoacidosis} results in \emph{urinary tract infection}. For the observed strong association as stated above, we conjecture it might be due to either causal or correlation relationship, which can provide supporting evidence and implication for clinical staff and is subject to further analysis by health practitioners. Table \ref{tab:mimic_performance} reports the predictive performance of various models. \textbf{ATRPP} outperforms alternatives in both disease types and time prediction. Here first-order Markov Chain outperforms higher-order models, the reason might be due to the fact that visits of patients are sparse and there is not enough data to train the higher order Markov chains. \begin{figure}[tb!] \centering \includegraphics[width=0.49\textwidth]{pic/evolve.pdf \caption{The evolving of point process modeling. The embodiments of the first two blocks can be referred to \cite{ZhouAISTATS13} and \cite{DuKDD16} respectively. While the third and forth blocks are our conference version \cite{XiaoAAAI17} and this extended journal paper (from left to right).} \label{fig:evolve} \end{figure} \section{Conclusion}\label{sec:conclusion} We conclude this paper with Fig.~\ref{fig:evolve} and identify our proposed method as a recurrent point process model. To elaborate, Hawkes process uses a full explicit parametric model and RMTPP misses the dense time series features to model time-varying base intensity, assumes a partially parametric form for it and model the pseudo multi-dimensional point process. We make a further step by proposing an interpretable model which is simple and general and can be trained end-to-end. Most importantly, our model can uncover the subtle network structure and provide interpretable evidence for predicting result. The extensive experiments in this paper have clearly suggested its superior performance in synthetic and real-world data, even when we have no domain knowledge on the problem at hand. This is in contrast to existing point process models where an assumption about the dynamics is often needed to be specified beforehand. \ifCLASSOPTIONcompsoc \section*{Acknowledgments} The authors thank Robert Chen with Emory University School of Medicine, and for helpful discussions and suggestions on the study of the computational experimental results on the MIMIC dataset. We are also thankful to Changsheng Li who shared us the ATM log data from IBM to allow us to perform the predictive maintenance study on real-world data. \else \fi \ifCLASSOPTIONcaptionsoff \newpage \fi \bibliographystyle{IEEEtran}
{'timestamp': '2017-03-27T02:09:44', 'yymm': '1703', 'arxiv_id': '1703.08524', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08524'}
arxiv
\section{Introduction} \begin{figure}[!t] \begin{center} \includegraphics[width=0.48\textwidth]{framework.pdf} \end{center} \caption{Basic acceleration block. The orange panel in the figure shows two different kinds of low-cost collaborative kernels. One uses $1 \times 1$ convolution, and the other uses shared kernels~($W_i^{'} = W_j^{'}$ for $i,j \in [1, T]$). The black response map represents the output of the original convolutional layer with the kernel $W$, and the orange response map is generated by the low-cost collaborative layer. The purple cells represent the zero elements, of which the calculation of corresponding positions can be skipped in the original convolutional layer. We apply element-wise multiplication on the activated response maps from the original convolutional layer and low-cost layer to generate the final results of this basic acceleration block.} \label{fig:basic_framework} \end{figure} Despite the continuously improved performance of convolutional neural networks (CNNs)~ \cite{chatfield2014return,han2015deep,krizhevsky2012imagenet,lin2013network,simonyan2014very,szegedy2015going}, their computation costs are still tremendous. Without the support of high-efficiency servers, it is hard to establish CNN models on real-world applications. For example, to process a $224 \times 224$ image, AlexNet~\cite{krizhevsky2012imagenet} requires 725M FLOPs with 61M parameters, VGG-S~\cite{chatfield2014return} involves 2640M FLOPs with 103M parameters, and GoogleNet~\cite{szegedy2015going} needs 1566M FLOPs with 6.9M parameters. Therefore, to leverage the success of deep neural networks on mobile devices with limited computational capacity, accelerating network inference has become imperative. In this paper, we investigate the acceleration of CNN models based on the observation that the response maps of many convolutional layers are usually sparse after ReLU~\cite{montufar2014number} activation. Therefore, instead of fully calculating the layer response, we can skip calculating the zero cells in the ReLU output and only compute the values of non-zero cells in each response map. Theoretically, the locations of zero cells can be predicted by a lower cost layer. The values of non-zero cells from this lower-cost layer can be collaboratively updated by the responses of the original filters. Eventually, the low-cost collaborative layer (LCCL) accompanied by the original layer constitute the basic element of our proposed low-cost collaborative network (LCCN). To equip each original convolutional layer with a LCCL, we apply an element-wise multiplication on the response maps from the LCCL and the original convolutional layer, as illustrated in Fig.~\ref{fig:basic_framework}. In the training phase, this architecture can be naturally trained by the existing stochastic gradient descent (SGD) algorithm with backpropagation. First we calculate the response map $V^{'}$ of the LCCL after the activation layer, and use $V^{'}$ to guide the calculation of the final response maps. Despite the considerable amount of research where a sparse-based framework is used to accelerate the network inference, \eg~\cite{figurnov2015perforatedcnns,graham2014spatially,lebedev2015fast,li2016pruning,liu2015sparse}, we claim that LCCN is unique. Generally, most of these sparsity-based methods~\cite{lebedev2015fast,liu2015sparse,soulie2015compression} integrate the sparsity property as a regularizer into the learning of parameters, which usually harms the performance of network. Moreover, to further accelerate performance, some methods even arbitrarily zeroize the values of the response maps according to a pre-defined threshold. Compared with these methods, our LCCN automatically sets the negatives as zero, and precisely calculates the positive values in the response map with the help of the LCCL. This two-stream strategy reaches a remarkable acceleration rate while maintaining a comparable performance level to the original network. The main contributions are summarized as follows: \begin{itemize} \item We propose a general architecture to accelerate CNNs, which leverages low-cost collaborative layers to accelerate each convolutional layer. \item To the best of our knowledge, this is the first work to leverage a low-cost layer to accelerate the network. Equipping each convolutional layer with a collaborative layer is quite different from the existing acceleration algorithms. \item Experimental studies show significant improvements by the LCCN on many deep neural networks when compared with existing methods (\eg, a 34\% speedup on ResNet-110). \end{itemize} \section{Related Work} {\bf Low Rank}. Tensor decomposition with low-rank approximation-based methods are commonly used to accelerate deep convolutional networks. For example, in~\cite{denton2014exploiting,jaderberg2014speeding}, the authors exploited the redundancy between convolutional filters and used low-rank approximation to compress convolutional weight tensors and fully connected weight matrices. Yang \etal \cite{yang2015deep} use an adaptive fastfood transform was used to replace a fully connected layer with a series of simple matrix multiplications, rather than the original dense and large ones. Liu \etal \cite{liu2015sparse} propose a sparse decomposition to reduce the redundancy in convolutional parameters. In~\cite{zhang2015accelerating,zhang2015efficient}, the authors used generalized singular vector decomposition~(GSVD) to decompose an original layer to two approximated layers with reduced computation complexity. {\bf Fixed Point}. Some popular approaches to accelerate test phase computation are based on ``fixed point''. In~\cite{courbariaux2014training}, the authors trained deep neural networks with a dynamic fixed point format, which achieves success on a set of state-of-the-art neural networks. Gupta \etal \cite{gupta2015deep} use stochastic rounding to train deep networks with 16-bit wide fixed-point number representation. In~\cite{courbariaux2016binarynet,courbariaux2015binaryconnect}, a standard network with binary weights represented by 1-bit was trained to speed up networks. Then, Rastegari \etal \cite{rastegari2016xnor} further explored binary networks and expanded it to binarize the data tensor of each layer, increasing the speed by 57 times. {\bf Product Quantization}. Some other researchers focus on product quantization to compress and accelerate CNN models. The authors of \cite{wu2015quantized} proposed a framework to accelerate the test phase computation process with the network parameters quantized and learn better quantization with error correction. Han \etal \cite{han2015deep} proposed to use a pruning stage to reduce the connections between neurons, and then fine tuned networks with weight sharing to quantify the number of bits of the convolutional parameters from 32 to 5. In another work~\cite{hubara2016quantized}, the authors trained neural networks with extremely low precision, and extended success to quantized recurrent neural networks. Zhou \etal \cite{zhou2016dorefa} generalized the method of binary neural networks to allow networks with arbitrary bit-width in weights, activations, and gradients. {\bf Sparsity}. Some algorithms exploit the sparsity property of convolutional kernels or response maps in CNN architecture. In~\cite{zhou2016less}, many neurons were decimated by incorporating sparse constraints into the objective function. In~\cite{graham2014spatially}, a CNN model was proposed to process spatially-sparse inputs, which can be exploited to increase the speed of the evaluation process. In~\cite{lebedev2015fast}, the authors used the group-sparsity regularizer to prune the convolutional kernel tensor in a group-wise fashion. In~\cite{figurnov2015perforatedcnns}, they increased the speed of convolutional layers by skipping their evaluation at some fixed spatial positions. In~\cite{li2016pruning}, the authors presented a compression technique to prune the filters with minor effects on the output accuracy. {\bf Architecture}. Some researchers improve the efficiency of networks by carefully designing the structure of neural networks. In~\cite{hinton2015distilling}, a simple model was trained by distilling the knowledge from multiple cumbersome models, which helps to reduce the computation cost while preserving the accuracy. Romero \etal \cite{romero2014fitnets} extended the knowledge distillation approach to train a student network, which is deeper but thinner than the teacher network, by extracting the knowledge of teacher network. In this way, the student network uses less parameters and running time to gain considerable speedup compared with the teacher network. Iandola \etal \cite{iandola2016squeezenet} proposed a small DNN architecture to achieve similar performance as AlexNet by only using 50x fewer parameters and much less computation time via the same strategy. \section{Low-Cost Collaborative Network} In this section, we present our proposed architecture for the acceleration of deep convolutional neural networks. First, we introduce the basic notations used in the following sections. Then, we demonstrate the detailed formulation of the acceleration block and extend our framework to general convolutional neural networks. Finally, we discuss the computation complexity of our acceleration architecture. \subsection{Preliminary} \begin{figure*}[htp] \begin{center} \includegraphics[width=0.7\textwidth]{position_connect.pdf} \end{center} \caption{Connection strategy of collaborating LCCL with the original convolutional layer. The top figure shows the pre-activation residual block~\cite{he2016identity}; the bottom figure shows a ``Bef-Aft" connection strategy to speed up the residual block. ``Activ" represents that the collaborative layer is followed by BN and ReLU activation. The first LCCL receives the input tensor before being activated by BN and ReLU, and the second one receives the input tensor after BN and ReLU. (Best viewed in the original pdf file.)} \label{fig:position_connect} \end{figure*} Let's recall the convolutional operator. For simplicity, we discuss the problem without the bias term. Given one convolution layer, we assume the shapes of input tensor~$U$ and output tensor~$V$ are $X \times Y \times C$ and $X \times Y \times T$, where $X$ and $Y$ are the width and height of the response map, respectively. $C$ and $T$ represent the channel number of response map $U$ and $V$. A tensor~$W$ with size $k \times k \times C \times T$ is used as the weight filter of this convolutional layer. $V_t(x,y)$ represents the element of $V(x,y,t)$. Then, the convolutional operator can be written as: \vspace{-2mm} {\small \begin{align} V_t(x,y) = \sum_{i,j=1}^{k}\sum_{c=1}^{C}W_t(i,j,c)U(x+i-1,y+i-1,c) \end{align} } \vspace{-1mm} \noindent where $W_t(x,y)$ is the element of $W(x,y,t)$. In the LCCN, the output map of each LCCL should have the same size as the corresponding convolutional layer, which means that the shape of tensor~$V^{'}$ is $X \times Y \times T$. Similarly, we assume the weight kernel of $V^{'}$ is $W^{'}$. Therefore, the formula of the LCCN can be written as: {\small \begin{align} V^{'}_t(x,y) = \sum_{i,j=1}^{k^{'}}\sum_{c=1}^{C}W^{'}_{t}(i,j,c)U(x+i-1,y+i-1,c) \end{align} } \vspace{-2mm} \subsection{Overall Structure} Our acceleration block is illustrated in Fig.~\ref{fig:basic_framework}. The green block $V^{*}$ represents the final response map collaboratively calculated by the original convolutional layer and the LCCL. Generally, it can be formulated as: \vspace{-1mm} {\small \begin{align} V^{*}_t(x,y) = \begin{cases} 0 & \text{if } V^{'}_t(x,y) = 0 \\ V^{'}_t(x,y) \times V_t(x,y) & \text{if } V^{'}_t(x,y) \neq 0 \end{cases} \end{align} } \vspace{-1mm} \noindent where $V$ is the output response map from the original convolutional layer and $V^{'}$ is from LCCL. In this formula, the element-wise product is applied to $V$ and $V^{'}$ to calculate the final response map. Due to the small size of LCCL, the computation cost of $V^{'}$ can be ignored. Meanwhile, since the zero cells in $V^{'}$ will stay zero after the element-wise multiplication, the computation cost of $V$ is further reduced by skipping the calculation of zero cells according to the positions of zero cells in $V^{'}$. Obviously, this strategy leads to increasing speed in a single convolutional layer. To further accelerate the whole network, we can equip most convolutional layers with LCCLs. \subsection{Kernel Selection} As illustrated in the orange box in Fig.~\ref{fig:basic_framework}, the first form exploits a $1 \times 1 \times C \times T$ kernel ($k^{'} = 1$) for each original kernel to collaboratively estimate the final response map. The second structure uses a $k^{'} \times k^{'} \times C \times 1$ filter (we carefully tune the parameter k' and set k' = k) shared across all the original filters to calculate the final result. Both these collaborative layers use less time during inference when compared with the original convolutional layer, thus they are theoretically able to obtain acceleration. In many efficient deep learning frameworks such as Caffe~\cite{jia2014caffe}, the convolution operation is reformulated as matrix multiplication by flattening certain dimensions of tensors, such as: \vspace{-1mm} {\small \begin{align} V = U^{*} \times W^{*}~~~{\text{s.t.}} ~&~ U^{*} \in R^{XY \times k^{2}C}~,~W^{*} \in R^{k^{2}C \times T} \end{align} } \vspace{-3mm} \noindent Each row of the matrix $U^{*}$ is related to the spatial position of the output tensor transformed from the tensor $U$, and $W^{*}$ is a reshaped tensor from weight filters $W$. These efficient implementations take advantage of the high-efficiency of BLAS libraries, \eg, GEMM\footnote{matrix-matrix multiplication function} and GEMV\footnote{matrix-vector multiplication function}. Since each position of the skipped cell in $V^{*}$ corresponds to one row of the matrix $U^{*}$, we can achieve a realistic speedup in BLAS libraries by reducing the matrix size in the multiplication function. Different structures of the LCCL need different implementations. For a $k \times k \times C \times 1$ kernel, the positions of the skipped cells in the original convolutional layer are the same in different channels. In this situation, we can reduce the size of $U^{*}$ to $S^{'} \times k^{2}C$, where $S^{'}$ is the number of non-zero elements in $V^{'}$. For a $1 \times 1 \times C \times T$ kernel, the positions of zero cells are different in different channels, so it is infeasible to directly use the matrix-matrix multiplication function to calculate the result of LCCL, \ie $V^{'}$. In this case, we have to separate the matrix-matrix multiplication into multiple matrix-vector multiplications. However, this approach is difficult to achieve the desired acceleration effect. The unsatisfying acceleration performance of $1 \times 1 \times C \times T$ filters is caused by the inferior efficiency of multiple GEMV, and some extra operations also cost more time~(\eg, data reconstruction). Therefore, we choose the $k \times k \times C \times 1$ structure for our LCCL in our experiments, and leave the acceleration of $1 \times 1 \times C \times T$ filters as our future work. \subsection{Sparsity Improvement} According to the previous discussion, the simplest way for model acceleration is directly multiplying the tensor $V^{'}$ and tensor $V$. However, this approach cannot achieve favourable acceleration performance due to the low sparsity rate of $V^{'}$. To improve the sparsity of $V^{'}$, ReLU~\cite{montufar2014number} activation is a simple and effective way by setting the negative values as zeros. Moreover, due to the redundancy of positive activations, we can also append $L_1$ loss in the LCCL to further improve the sparsity rate. In this way, we achieve a smooth $L_{1}L_{2}({\bf X}) = \mu\|{\bf X}\| + \rho|{\bf X}|$ regularizer penalty for each $V^{'}$: \vspace{-2mm} {\small \begin{align} \|{\bf X}\| = \sqrt{ \sum_{i = 1}^{n} {\bf X}_{i}^2 }~~,~~|{\bf X}| = \sum_{i = 1}^{n} |{\bf X}| \end{align} } \vspace{-2mm} \noindent However, there are thousands of free parameters in the regularizer term and the additional loss always degrades the classification performance, as it's difficult to achieve the balance between the classification performance and the acceleration rate. \begin{table}[ht] \footnotesize \begin{center} \begin{tabular}{ c | c | c | c | c } \hline \multirow{2}{*}{Layer} & \multicolumn{2}{| c |}{With BN} & \multicolumn{2}{| c }{Without BN} \\ & conv1 & conv2 & conv1 & conv2 \\ \hline res-block-1.2 & 38.8\% & 28.8\% & 0.0\% & 0.0\% \\ res-block-2.2 & 37.9\% & 23.4\% & 0.0\% & 0.2\% \\ res-block-2.2 & 17.8\% & 40.4\% & 0.0\% & 40.7\% \\ \hline \end{tabular} \end{center} \caption{Sparsity of the LCCL for different activations with the same training setting. ``With BN'' means we activate the response map of the LCCL by BN and ReLU; ``Without BN'' means we only use ReLU activation. ``x.y'' means the y-th block at x-th stage of ResNet. We equip six convolutional layers with LCCL on ResNet-20 model.} \label{table:BN_Sparsity} \end{table} Recently, the Batch Normalization (BN)~\cite{ioffe2015batch} is proposed to improve the network performance and increase the convergence speed during training by stabilizing the distribution and reducing the internal covariate shift of input data. During this process, we observe that the sparsity rate of each LCCL is also increased. As shown in Table~\ref{table:BN_Sparsity}, we can find that the BN layer advances the sparsity of LCCL followed by ReLU activation, and thus can further improve the acceleration rate of our LCCN. We conjecture that the BN layer balances the distribution of $V^{'}$ and reduces the redundancy of positive values in $V^{'}$ by discarding some redundant activations. Therefore, to increase the acceleration rate, we carefully integrate the BN layer into our LCCL. Inspired by the pre-activation residual networks~\cite{he2016identity}, we exploit different strategies for activation and integration of the LCCL. Generally, the input of this collaborative layer can be either before activation or after activation. Taking pre-activation residual networks~\cite{he2016identity} as an example, we illustrate the ``Bef-Aft" connection strategy at the bottom of Fig.~\ref{fig:position_connect}. ``Bef" represents the case that the input tensor is from the flow before BN and ReLU activation. ``Aft" represents the case that the input tensor is the same to the original convolutional layer after BN and ReLU activation. According to the ``Bef-Aft" strategy in Fig.~\ref{fig:position_connect}. the ``Bef-Bef", ``Aft-Bef" and ``Aft-Aft" strategies can be easily derived. During our experiments, we find that input tensors with the ``Bef" strategy are quite diverse when compared with the corresponding convolutional layer due to different activations. In this strategy, the LCCL cannot accurately predict the zero cells for the original convolutional layer. So it is better to use the same input tensor as the original convolutional layer, \ie the ``Aft" strategy. \subsection{Computation Complexity} Now we analyze the test-phase numerical calculation with our acceleration architecture. For each convolutional layer, the forward procedure mainly consists of two components, \ie the low cost collaborative layer and the skip-calculation convolutional layer. Suppose the sparsity~(ratio of zero elements) of the response map $V^{'}$ is $r$. We formulate the detailed computation cost of the convolutional layer and compare it with the one equipped with our LCCL. \begin{table}[ht] \footnotesize \begin{center} \centering \begin{tabular}{c|c|c} \hline Architecture & FLOPs & Speed-Up Ratio \\\hline CNN & $XYTk^2C$ & 0 \\\hline basic & $XYTC(k{'}^2 + k^2r)$ & $1 - (k{'}^2/k^2 + r)$\\ ($1 \times 1$ kernel) & $XYTC(1 + k^2r)$ & $1 - (1/k^2 + r)$ \\ (weight sharing) & $XYTk^2(1 + Cr)$ & $1 - (1/C + r)$\\ \hline \end{tabular} \end{center} \caption{Theoretical numerical calculation acceleration for convolutional layers.} \label{table:theroretical_speedup} \end{table} As shown in Table~\ref{table:theroretical_speedup}, the speedup ratio is highly dependent on $r$. The term $1/C$ costs little time since the channel of the input tensor is always wide in most CNN models and it barely affects the acceleration performance. According to the experiments, the sparsity $r$ reaches a high ratio in certain layers. These two facts indicate that we can obtain a considerable speedup ratio. Detailed statistical results are described in the experiments section. In residual-based networks, if the output of one layer in the residual block is all zero, we can skip the calculation of descendant convolutional layers and directly predict the results of this block. This property helps further accelerate the residual networks. \section{Experiments} In this section, we conduct experiments on three benchmark datasets to validate the effectiveness of our acceleration method. \begin{figure*}[!t] \begin{center} \includegraphics[width=0.90\textwidth]{cifar10_sparse-eps-converted-to.pdf} \end{center} \caption{Sparsity for the response maps from each collaborative convolutional layer in ResNet-20. We use LCCL to modify 18 convolutional layers to speed up ResNet-20. ``x.y" represents the y-th residual block in the x-th generalized convolutional block. ``conv1" and ``conv2" represent the first and the second collaboration convolutional in the corresponding residual block. } \label{fig:cifar10_sparse} \end{figure*} \subsection{Benchmark Datasets and Experimental Setting} We mainly evaluate our LCCN on three benchmarks: CIFAR-10, CIFAR-100~\cite{krizhevsky2009learning} and ILSVRC-12~\cite{russakovsky2015imagenet}. The CIFAR-10 dataset contains 60,000 $32 \times 32$ images, which are categorized into 10 classes and each class contains 6,000 images. The dataset is split into 50,000 training images and 10,000 testing images. The CIFAR-100~\cite{krizhevsky2009learning} dataset is similar to CIFAR-10, except that it has 100 classes and 600 images per class. Each class contains 500 training images and 100 testing images. For CIFAR-10 and CIFAR-100, we split the 50k training dataset into 45k/5k for validation. ImageNet 2012 dataset~\cite{russakovsky2015imagenet} is a famous benchmark which contains 1.28 million training images of 1,000 classes. We evaluate on the 50k validation images using both the top-1 and top-5 error rates. Deep residual networks~\cite{he2015deep} have shown impressive performance with good convergence behaviors. Their significance has increased, as shown by the amount of research~\cite{he2016identity,zagoruyko2016wide} being undertaken. We mainly apply our LCCN to increase the speed of these improved deep residual networks. In the CIFAR experiments, we use the default parameter setting as~\cite{he2016identity,zagoruyko2016wide}. However, it is obvious that our LCCN is more complicated than the original CNN model, which leads to a requirement for more training epochs to converge into a stable situation. So we increase the training epochs and perform a different learning rate strategies to train our LCCN. We start the learning rate at 0.01 to warm up the network and then increase it to 0.1 after 3\% of the total iterations. Then it is divided by 10 at 45\%, 70\% and 90\% iterations where the errors plateau. We tune the training epoch numbers from \{200, 400, 600, 800, 1000\} according to the validation data On ILSVRC-12, we follow the same parameter settings as~\cite{he2015deep,he2016identity} but use different data argumentation strategies. (1) Scale augmentation: we use the scale and aspect ratio augmentation~\cite{szegedy2015going} instead of the scale augmentation~\cite{simonyan2014very} used in~\cite{he2015deep,he2016identity}. (2) Color augmentation: we use the photometric distortions from~\cite{howard2013some} to improve the standard color augmentation~\cite{krizhevsky2012imagenet} used in~\cite{he2015deep,he2016identity}. (3) Weight decay: we apply weight decay to all weights and biases. These three differences should slightly improve performance (refer to Facebook implementation\footnote{\url{https://github.com/facebook/fb.resnet.torch}}). According to our experiences with CIFAR, we extend the training epoch to 200, and use a learning rate starting at 0.1 and then is divided by 10 every 66 epochs. For the CIFAR experiments, we report the acceleration performance and the top-1 error to compare with the results provided in the original paper~\cite{he2016identity,zagoruyko2016wide}. On ILSVRC-12, since we use different data argumentation strategies, we report the top-1 error of the original CNN models trained in the same way as ours, and we mainly compare the accuracy drop with other state-of-the-art acceleration algorithms including: (1) Binary-Weight-Networks~(BWN)~\cite{rastegari2016xnor} that binarizes the convolutional weights; (2) XNOR-Networks~(XNOR)~\cite{rastegari2016xnor} that binarizes both the convolutional weights and the data tensor; (3) Pruning Filters for Efficient ConvNets~(PFEC)~\cite{li2016pruning} which prunes the filters with small effect on the output accuracy from CNNs. \subsection{Experiments on CIFAR-10 and CIFAR-100} First, we study the influence on performance of using different connection strategies proposed in the Kernel Selection and Sparsity Improvement sections. We use the pre-activation ResNet-20 as our base model, and apply the LCCL to all convolutional layers within the residual blocks. Using the same training strategy, the results of four different connection strategies are shown in Table~\ref{table:res20_connect}. Both collaborative layers with the after-activation method show the best performance with a considerable speedup ratio. Because the Aft strategy receives the same distribution of input to that of the corresponding convolution layer. We also try to use the $L_1L_2$ loss to restrict the output maps of each LCCL. But this will add thousands of extra values that need to be optimized in the $L_1L_2$ loss function. In this case, the networks are difficult to converge and the performance is too bad to be compared. \begin{table}[ht] \footnotesize \begin{center} \begin{tabular}{c|c|c} \hline Structure & Top-1 Err. & Speed-Up \\ \hline Aft-Aft & \textbf{8.32} & 34.9\% \\ Aft-Bef & 8.71 & 24.1\% \\ Bef-Bef & 11.62 & 39.8\% \\ Bef-Aft & 12.85 & \textbf{55.4\%} \\ \hline \end{tabular} \end{center} \caption{Before-activation and after-activation for connection strategy on ResNet-20. Each LCCL uses $3 \times 3 \times k$ kernel.} \label{table:res20_connect} \end{table} Furthermore, we analyze the performance influenced by using different kernels in the LCCL. There are two forms of LCCL that collaborate with the corresponding convolutional layer. One is a tensor of size $1 \times 1 \times C \times T$ (denoted as $1\times1$), and the other is a tensor of size $k \times k \times C \times 1$ (denoted as $k \times k$). As shown in Table~\ref{table:comparison_kernel}, the $k \times k$ kernel shows significant performance improvement with a similar speedup ratio compared with a $1\times1$ kernel. It can be caused by that the $k \times k$ kernel has a larger reception field than $1 \times 1$. \begin{table}[t] \footnotesize \begin{center} \begin{tabular}{ c | c | c | c | c | c | c} \hline \multirow{2}{*}{Model} & \multicolumn{3}{| c |}{$1 \times 1 \times C \times T$} & \multicolumn{3}{| c }{$k \times k \times C \times 1$} \\ & FLOPs & Ratio & Error & FLOPs & Ratio & Error \\ \hline ResNet-20 & 3.2E7 & 20.3\% & 8.57 & 2.6E7 & \textbf{34.9\%} & \textbf{8.32} \\ ResNet-32 & 4.7E7 & \textbf{31.2\%} & 9.26 & 4.9E7 & 28.1\% & \textbf{7.44} \\ ResNet-44 & 6.3E7 & \textbf{34.8\%} & 8.57 & 6.5E7 & 32.5\% & \textbf{7.29} \\ \hline \end{tabular} \end{center} \caption{Comparison of top-1 error rate on two different collaborative layers.~(The `Ratio' represents the speedup ratio) } \label{table:comparison_kernel} \end{table} Statistics on the sparsity of each response map generated from the LCCL are illustrated in Fig.~\ref{fig:cifar10_sparse}. This LCCN is based on ResNet-20 with each residual block equipped with a LCCL configured by a $1 \times 1 \times C \times T$ kernel. To get stable and robust results, we increase the training epochs as many as possible, and the sparsity variations for all 400 epochs are provided. The first few collaborative layers show a great speedup ratio, saving more than 50\% of the computation cost. Even if the last few collaboration layers behave less than the first few, the $k \times k \times C \times 1$ based method is capable of achieving more than 30\% increase in speed. Hitherto, we have demonstrated the feasibility of training CNN models equipped with our LCCL using different low-cost collaborative kernels and strategies. Considering the performance and realistic implementation, we select the weight sharing kernel for our LCCL. This will be used in all following experiments as default. Furthermore, we experiment with more CNN models\cite{he2016identity,zagoruyko2016wide} accelerated by our LCCN on CIFAR-10 and CIFAR-100. Except for ResNet-164~\cite{he2016identity} which uses a bottleneck residual block {\tiny $\left\{ \begin{array}{ccc} 1 \times 1 \\ 3 \times 3 \\ 1 \times 1 \end{array} \right\} $ }, all other models use a basic residual block {\tiny $\left\{ \begin{array}{ccc} 3 \times 3 \\ 3 \times 3 \end{array} \right\} $ }. We use LCCL to accelerate all convolutional layers except for the first layer, which takes the original image as the input tensor. The first convolutional layer operates on the original image, and it costs a little time due to the small input channels~(RGB 3 channels). In a bottleneck structure, it is hard to reach a good convergence with all the convolutional layers accelerated. The convolutional layer with $1 \times 1$ kernel is mainly used to reduce dimension to remove computational bottlenecks, which overlaps with the acceleration effect of our LCCL. This property makes layers with $1 \times 1$ kernel more sensitive to collaboration with our LCCL. Thus, we apply our LCCL to modify the first and second convolutional layer in the bottleneck residual block on CIFAR-10. And for CIFAR-100, we only modify the second convolutional layer with $3 \times 3$ kernel in the bottleneck residual block. The details of theoretical numerical calculation acceleration and accuracy performance are presented in Table~\ref{table:cifar10_acc} and Table~\ref{table:cifar100_acc}. \begin{table}[t] \footnotesize \begin{center} \begin{tabular}{ c | c | c | c | c} \hline & Depth & Ori. Err & LCCN & Speed-up \\\hline \multirow{2}{*}{ResNet~\cite{he2016identity}} & 110 & 6.37 & 6.56 & 34.21\% \\ & 164* & 5.46 & 5.91 & 27.40\% \\ \hline \multirow{6}{*}{WRN~\cite{zagoruyko2016wide}} & 22-8 & 4.38 & 4.90 & 51.32\% \\ & 28-2 & 5.73 & 5.81 & 21.40\% \\ & 40-1 & 6.85 & 7.65 & 39.36\% \\ & 40-2 & 5.33 & 5.98 & 31.01\% \\ & 40-4 & 4.97 & 5.95 & 54.06\% \\ & 52-1 & 6.83 & 6.99 & 41.90\% \\ \hline \end{tabular} \end{center} \caption{Top-1 Error and Speed-Up of eight different CNN models on CIFAR-10~(symbol ``*" means the bottleneck structure). Ori. Err represents the top-1 error of the original convolution network.} \label{table:cifar10_acc} \end{table} \begin{table}[ht] \footnotesize \begin{center} \begin{tabular}{ c | c | c | c | c} \hline & Depth & Ori. Err & LCCN & Speed-up \\\hline \multirow{1}{*}{ResNet~\cite{he2016identity}} & 164* & 24.33 & 24.74 & 21.30\% \\\hline \multirow{6}{*}{WRN~\cite{zagoruyko2016wide}} & 16-4 & 24.53 & 24.83 & 15.19\% \\ & 22-8 & 21.22 & 21.30 & 14.42\% \\ & 40-1 & 30.89 & 31.32 & 36.28\% \\ & 40-2 & 26.04 & 26.91 & 45.61\% \\ & 40-4 & 22.89 & 24.10 & 34.27\% \\ & 52-1 & 29.88 & 29.55 & 22.96\% \\ \hline \end{tabular} \end{center} \caption{Top-1 error and speed-up of seven different CNN models on CIFAR-100~(symbol ``*" means the bottleneck structure). Ori. Err represents the top-1 error of the original convolution network.} \label{table:cifar100_acc} \end{table} Experiments show our LCCL works well on much deeper convolutional networks, such as pre-activation ResNet-164~\cite{he2016identity} or WRN-40-4~\cite{zagoruyko2016wide}. Convolutional operators dominate the computation cost of the whole network, which hold more than 90\% of the FLOPs in residual based networks. Therefore, it is beneficial for our LCCN to accelerate such convolutionally-dominated networks, rather than the networks with high-cost fully connected layers. In practice, we are always able to achieve more than a 30\% calculation reduction for deep residual based networks. With a similar calculation quantity, our LCCL is capable of outperforming original deep residual networks. For example, on the CIFAR-100 dataset, LCCN on WRN-52-1 obtains higher accuracy than the original WRN-40-1 with only about 2\% more cost in FLOPs. Note that our acceleration is data-driven, and can achieve a much higher speedup ratio on ``easy" data. In cases where high accuracy is not achievable, it predicts many zeros which harms the network structure. Theoretically, the LCCN will achieve the same accuracy as the original one if we set LCCL as an identity (dense) network. To improve efficiency, the outputs of LCCL need to be sparse, which may marginally sacrifice accuracy for some cases. We also observe accuracy gain for some other cases (WRN-52-1 in Table~\ref{table:cifar100_acc}), because the sparse structure can reduce the risk of overfitting. \subsection{Experiments on ILSVRC-12} We test our LCCN on ResNet-18, 34 with some structural adjustments. On ResNet-18, we accelerate all convolutional layers in the residual block. However, ResNet-34 is hard to optimize with all the convolutional layers accelerated. So, we skip the first residual block at each stage (layer 2, 3, 8, 9, 16, 17, 28, 29) to make it more sensitive to collaboration. The performance of the original model and our LCCN with the same setting are shown in Table~\ref{table:imagenet_acc}. \begin{table}[ht] \footnotesize \begin{center} \begin{tabular}{ c | c | c | c | c | c} \hline \multirow{2}{*}{Depth} & \multicolumn{2}{| c |}{Top-1 Error} & \multicolumn{2}{| c |}{Top-5 Error} & \multirow{2}{*}{Speed-up}\\ & ResNet & LCCN & ResNet & LCCN & \\\hline 18 & 30.02 & 33.67 & 10.76 & 13.06 & 34.6\% \\\hline 34 & 26.58 & 27.01 & 8.64 & 8.81 & 24.8\% \\\hline \end{tabular} \end{center} \caption{Top-1 and Top-5 Error of LCCN on ImageNet classification task.} \label{table:imagenet_acc} \end{table} We demonstrate the success of LCCN on ResNet-18,~34~\cite{he2016identity}, and all of them obtain a meaningful speedup with a slight performance drop. \begin{table}[ht] \footnotesize \begin{center} \begin{tabular}{ c | c | c | c | c} \hline Depth & Approach & Speed-Up & Top-1 Acc. Drop & Top-5 Acc. Drop \\\hline \multirow{3}{*}{18} & LCCL & 34.6\% & 3.65 & 2.30 \\ & BWN & $\approx 50.0\%$ & 8.50 & 6.20 \\ & XNOR & $\approx 98.3\%$ & 18.10 & 16.00 \\\hline \multirow{2}{*}{34} & LCCL & 24.8\% & 0.43 & 0.17 \\ & PFEC & 24.2\% & 1.06 & - \\\hline \end{tabular} \end{center} \caption{Comparison with other acceleration methods on ResNet. Acc. Drop represents the accuracy drop.} \label{table:compare_acc_18} \end{table} We compare our method with other state-of-the-art methods, shown in Table~\ref{table:compare_acc_18}. As we can see, similar to other acceleration methods, there is some performance drop. However, our method achieves better accuracy than other acceleration methods. \subsection{Theoretical vs. Realistic Speedup} There is often a wide gap between theoretical and realistic speedup ratio. It is caused by the limitation of efficiency of BLAS libraries, IO delay, buffer switch or some others. So we compare the theoretical and realistic speedup with our LCCN. We test the realistic speed based on Caffe~\cite{jia2014caffe}, an open source deep learning framework. OpenBLAS is used as the BLAS library in Caffe for our experiments. We set CPU only mode and use a single thread to make a fair comparison. The results are shown in Table~\ref{table:Comparison_Speed}. \begin{table}[ht] \footnotesize \begin{center} \begin{tabular}{ c | c | c | c | c | c | c } \hline \multirow{2}{*}{Model} & \multicolumn{2}{| c |}{FLOPs} & \multicolumn{2}{| c |}{Time (ms)} & \multicolumn{2}{| c }{Speed-up} \\ & CNN & LCCL & CNN & LCCL & Theo & Real \\ \hline ResNet-18 & 1.8E9 & 1.2E9 & 97.1 & 77.1 & 34.6\% & 20.5\% \\ \hline ResNet-34 & 3.6E9 & 2.7E9 & 169.3 & 138.6 & 24.8\% & 18.1\% \\ \hline \end{tabular} \end{center} \caption{Comparison on the theoretical and realistic speedup.} \label{table:Comparison_Speed} \end{table} \textbf{Discussion.} As shown in Table~\ref{table:Comparison_Speed}, our realistic speedup ratio is less than the theoretical one, which is caused mainly by two reasons. First, we use data reconstruction and matrix-matrix multiplication to achieve the convolution operator as Caffe~\cite{jia2014caffe}. The data reconstruction operation costs too much time, making the cost of our LCCL much higher than its theoretical speed. Second, the frontal convolution layers usually take more time but contain less sparsity than the rear ones, which reduces the overall acceleration effect of the whole convolution neural network. These two defects can be solved in theory, and we will focus on the realistic speedup in future. \textbf{Platform.} The idea of reducing matrix size in convolutional networks can be applied to GPUs as well in principle, even though some modifications on our LCCN should be made to better leverage the existing GPU libraries. Further, our method is independent from platform, and should work on the FPGA platform with customization. \subsection{Visualization of LCCL} \begin{figure}[ht] \begin{center} \includegraphics[width=0.45\textwidth]{response_map.pdf} \end{center} \caption{ The feature maps (after ReLU) generated from the last LCCL of our LCCN and the corresponding convolutional layer of ResNet-50 are visualized for testing samples of PASCAL VOC2007 dataset. Each triplet represents one picture and its corresponding feature maps. The activated area of LCCL seems highlight more foreground objects than that of ResNet-50. In the meantime, LCCL is possible to depress the background area. } \label{fig:response_map} \end{figure} Here is an interesting observation about our LCCL. We visualize the results of LCCN on PASCAL VOC2007~\cite{pascal-voc-2007} training dataset. We choose ResNet-50 as the competitor, and add an additional 20 channels' convolutional layer with an average pooling layer as the classifier. For our LCCN, we equip the last 6 layers of this competitor model with our LCCL. After fine tuning, the feature maps generated from the last LCCL and the corresponding convolutional layer of the competitor model are visualized in Fig.~\ref{fig:response_map}. As we can observe, our LCCL might have the ability to highlight the fields of foreground objects, and eliminates the impact of the background via the collaboration property. For example, in the second triplet, car and person are activated simultaneously in the same response map by the LCCL. At the first glance, these highlighted areas look similar with the locations obtained by attention model. But they are intrinsically different in many ways, \eg, motivations, computation operations, response meaning and structures. \section{Conclusion} In this paper, we propose a more complicated network structure yet with less inference complexity to accelerate the deep convolutional neural networks. We equip a low-cost collaborative layer to the original convolution layer. This collaboration structure speeds up the test-phase computation by skipping the calculation of zero cells predicted by the LCCL. In order to solve the the difficulty of achieving acceleration on basic LCCN structures, we introduce ReLU and BN to enhance sparsity and maintain performance. The acceleration of our LCCN is data-dependent, which is more reasonable than hard acceleration structures. In the experiments, we accelerate various models on CIFAR and ILSVRC-12, and our approach achieves significant speed-up, with only slight loss in the classification accuracy. Furthermore, our LCCN can be applied on most tasks based on convolutional networks (\eg, detection, segmentation and identification). Meanwhile, our LCCN is capable of plugging in some other acceleration algorithms (\eg, fix-point or pruning-based methods), which will further enhance the acceleration performance. {\small \bibliographystyle{ieee}
{'timestamp': '2017-05-16T02:09:36', 'yymm': '1703', 'arxiv_id': '1703.08651', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08651'}
arxiv
\section{Introduction} \label{Introduction} \begin{figure}[t!] \centering \subfloat{\includegraphics[width=0.48\columnwidth]{ExampleImageOrig.pdf}} \hfill \subfloat{\includegraphics[width=0.48\columnwidth]{ExampleImagePert.pdf}} \hfill \subfloat{\includegraphics[width=0.48\columnwidth]{ExampleSegOrig.pdf}} \hfill \subfloat{\includegraphics[width=0.48\columnwidth]{ExampleSegAdvr.pdf}} \hfill \subfloat{\includegraphics[width=0.48\columnwidth]{ExampleDetOrig.pdf}} \hfill \subfloat{\includegraphics[width=0.48\columnwidth]{ExampleDetAdvr.pdf}} \hfill \caption{ An Adversarial example for semantic segmentation and object detection. FCN~\cite{long2015fully} is used for segmentation, and Faster-RCNN~\cite{ren2015faster} is used for detection. Left column: the original image (top row) with the normal segmentation (the purple region is predicted as {\em dog}) and detection results. Right column: after the adversarial perturbation (top row, {\bf magnified by $\mathbf{10}$}) is added to the original image, both segmentation (the light green region as {\em train} and the pink region as {\em person}) and detection results are completely wrong. Note that, though the added perturbation can confuse both networks, it is visually imperceptible (the maximal absolute intensity in each channel is less than $10$). } \vspace{-0.5cm} \label{Fig:AdversarialExamples} \end{figure} Convolutional Neural Networks (CNN)~\cite{krizhevsky2012imagenet}\cite{simonyan2015very}\cite{szegedy2015going}\cite{he2016deep} have become the state-of-the-art solution for a wide range of visual recognition problems. Based on a large-scale labeled dataset such as {\bf ImageNet}~\cite{deng2009imagenet} and powerful computational resources like modern GPUs, it is possible to train a hierarchical deep network to capture different levels of visual patterns. A deep network is also capable of generating transferrable features for different tasks such as image classification~\cite{donahue2014decaf} and instance retrieval~\cite{sharif2014cnn}, or being fine-tuned to deal with a wide range of vision tasks, including object detection~\cite{girshick2014rich}\cite{girshick2015fast}, visual concept discovery~\cite{wang2015discovering}, semantic segmentation~\cite{long2015fully}\cite{chen2016deeplab}\cite{zheng2015conditional}, boundary detection~\cite{xie2015holistically}\cite{shen2015deepcontour}, etc. Despite their success in visual recognition and feature representation, deep networks are often sensitive to small perturbations to the input image. In~\cite{szegedy2013intriguing}, it was shown that adding visually imperceptible perturbations can result in failures for image classification. These perturbed images, often called {\em adversarial examples}, are considered to fall on some areas in the large, high-dimensional feature space which are not explored in the training process. Thus, investigating this not only helps understand the working mechanism of deep networks, but also provides opportunities to improve the robustness of network training. In this paper, we go one step further by generating adversarial examples for semantic segmentation and object detection, and showing the transferability of them. To the best of our knowledge, this topic has not been systematically studied ({\em e.g.}, on a large dataset) before. Note that these tasks are much more difficult, as we need to consider orders of magnitude more targets ({\em e.g.}, pixels or proposals). Motivated by the fact that each target undergoes a separate classification process, we propose the Dense Adversary Generation ({\bf DAG}) algorithm, which considers all the targets simultaneously and optimizes the overall loss function. The implementation of DAG is simple, as it only involves specifying an adversarial label for each target and performing iterative gradient back-propagation. In practice, the algorithm often comes to an end after a reasonable number of, say, $150$ to $200$, iterations. Figure~\ref{Fig:AdversarialExamples} shows an adversarial example which can confuse both deep segmentation and detection networks. We point out that generating an adversarial example is more difficult in detection than in segmentation, as the number of targets is orders of magnitude larger in the former case, {\em e.g.}, for an image with $K$ pixels, the number of possible proposals is $O\!\left(K^2\right)$ while the number of pixels is only $O\!\left(K\right)$, where $O\!\left(\cdot\right)$ is the big-O notation. In addition, if only a subset of proposals are considered, the perturbed image may still be correctly recognized after a new set of proposals are extracted (note that DAG aims at generating recognition failures on the original proposals). To increase the robustness of adversarial attack, we change the intersection-over-union (IOU) rate to preserve an increased but still reasonable number of proposals in optimization. In experiments, we verify that when the proposals are dense enough on the original image, it is highly likely that incorrect recognition results are also produced on the new proposals generated on the perturbed image. We also study the effectiveness and efficiency of the algorithm with respect to the {\em denseness} of the considered proposals. Following~\cite{szegedy2013intriguing}, we investigate the transferability of the generated perturbations. To this end, we use the adversarial perturbation computed on one network to attack another network. Three situations are considered: (1) networks with the same architecture but trained with different data; (2) networks with different architectures but trained for the same task; and (3) networks for different tasks. Although the difficulty increases as the difference goes more significant, the perturbations generated by DAG is able to transfer to some extent. Interestingly, adding two or more heterogeneous perturbations significantly increases the transferability, which provides an effective way of performing black-box adversarial attack~\cite{papernot2016practical} to some networks with unknown structures and/or properties. The remainder of this paper is organized as follows. Section~\ref{RelatedWork} briefly introduces prior work related to our research. Section~\ref{Generating} describes our algorithm for generating adversarial perturbations, and Section~\ref{Transferring} investigates the transferability of the perturbations. Conclusions are drawn in Section~\ref{Conclusions}. \section{Related Work} \label{RelatedWork} \subsection{Deep Learning for Detection and Segmentation} \label{RelatedWork:DeepLearning} Deep learning approaches, especially deep convolutional neural networks, have been very successful in object detection~\cite{ren2015faster}\cite{li2016r}\cite{lin2016feature} and semantic segmentation~\cite{long2015fully}\cite{chen2016deeplab} tasks. Currently, one of the most popular object detection pipeline~\cite{ren2015faster}\cite{li2016r}\cite{lin2016feature} involves first generating a number of proposals of different scales and positions, classifying each of them, and performing post-processing such as non-maximal suppression (NMS). On the other hand, the dominating segmentation pipeline~\cite{long2015fully} works by first predicting a class-dependent score map at a reduced resolution, and performing up-sampling to obtain high-resolution segmentation. ~\cite{chen2016deeplab} incorporates the ``atrous'' algorithm and the conditional random field (CRF) to this pipeline to improve the segmentation performance further. \subsection{Adversarial Attack and Defense} \label{RelatedWork:Adversarial} Generating adversarial examples for classification has been extensively studied in many different ways recently. \cite{szegedy2013intriguing} first showed that adversarial examples, computed by adding visually imperceptible perturbations to the original images, make CNNs predict a wrong label with high confidence. \cite{goodfellow2014explaining} proposed a simple and fast gradient sign method to generate adversarial examples based on the linear nature of CNNs. \cite{moosavi2015deepfool} proposed a simple algorithm to compute the minimal adversarial perturbation by assuming that the loss function can be linearized around the current data point at each iteration. \cite{moosavi2016universal} showed the existence of universal (image-agnostic) adversarial perturbations. \cite{baluja2017adversarial} trained a network to generate adversarial examples for a particular target model (without using gradients). \cite{kurakin2016adversarial} showed the adversarial examples for machine learning systems also exist in the physical world. \cite{liu2016delving} studied the transferability of both non-targeted and targeted adversarial examples, and proposed an ensemble-based approaches to generate adversarial examples with stronger transferability. \cite{nguyen2015deep} generated images using evolutionary algorithms that are unrecognizable to humans, but cause CNNs to output very confident (incorrect) predictions. This can be thought of as in the opposite direction of above works. In contrast to generating adversarial examples, there are some works trying to reduce the effect of adversarial examples. \cite{lou2016foveation} proposed a forveation-based mechanism to alleviate adversarial examples. \cite{papernot2016distillation} showed networks trained using defensive distillation can effectively against adversarial examples, while \cite{carlini2016towards} developed stronger attacks which are unable to defend by defensive distillation. \cite{kurakin2016scale} trained the network on adversarial examples using the large-scale ImageNet, and showed that this brings robustness to adversarial attack. This is imporved by \cite{tramer2017ensemble}, which proposed an ensemble adversarial training method to increase the network robustness to black-box attacks. \cite{metzen2017detecting} trained a detector on the inner layer of the classifier to detect adversarial examples. There are two concurrent works \cite{fischer2017adversarial} and \cite{metzen2017universal} that studied adversarial examples in semantic segmentation on the Cityscapes dataset~\cite{cordts2016cityscapes}, where \cite{fischer2017adversarial} showed the existence of adversarial examples, and \cite{metzen2017universal} showed the existence of universal perturbations. We refer interested readers to their papers for details. \section{Generating Adversarial Examples} \label{Generating} In this section, we introduce DAG algorithm. Given an image and the recognition targets (proposals and/or pixels), DAG generates an adversarial perturbation which is aimed at confusing as many targets as possible. \subsection{Dense Adversary Generation} \label{Generating:Algorithm} Let $\mathbf{X}$ be an image which contains $N$ recognition {\em targets} ${\mathcal{T}}={\left\{t_1,t_2,\ldots,t_N\right\}}$. Each target $t_n$, ${n}={1,2,\ldots,N}$, is assigned a ground-truth class label ${l_n}\in{\left\{1,2,\ldots,C\right\}}$, where $C$ is the number of classes, {\em e.g.}, ${C}={21}$ (including the {\em background} class) in the {\bf PascalVOC} dataset~\cite{everingham2007pascal}. Denote ${\mathcal{L}}={\left\{l_1,l_2,\ldots,l_n\right\}}$. The detailed form of $\mathcal{T}$ varies among different tasks. In image classification, $\mathcal{T}$ only contains one element, {\em i.e.}, the entire image. Conversely, $\mathcal{T}$ is composed of all pixels (or the corresponding receptive fields) in semantic segmentation, and all proposals in object detection. We will discuss how to construct $\mathcal{T}$ in Section~\ref{Generating:Selection}. Given a deep network for a specific task, we use ${\mathbf{f}\!\left(\mathbf{X},t_n\right)}\in{\mathbb{R}^C}$ to denote the classification score vector (before softmax normalization) on the $n$-th recognition target of $\mathbf{X}$. To generate an adversarial example, the goal is to make the predictions of all targets go wrong, {\em i.e.}, $\forall n$, ${\arg\max_c\left\{f_c\!\left(\mathbf{X}+\mathbf{r},t_n\right)\right\}}\neq{l_n}$. Here $\mathbf{r}$ denotes an adversarial perturbation added to $\mathbf{X}$. To this end, we specify an adversarial label $l'_n$ for each target, in which $l'_n$ is randomly sampled from other incorrect classes, {\em i.e.}, ${l'_n}\in{\left\{1,2,\ldots,C\right\}\setminus\left\{l_n\right\}}$. Denote ${\mathcal{L}'}={\left\{l'_1,l'_2,\ldots,l'_n\right\}}$. In practice, we define a random permutation function ${\pi}:{\left\{1,2,\ldots,C\right\}\rightarrow\left\{1,2,\ldots,C\right\}}$ for every image independently, in which ${\pi\!\left(c\right)}\neq{c}$ for ${c}={1,2,\ldots,C}$, and generate $\mathcal{L}'$ by setting ${l'_n}={\pi\!\left(l_n\right)}$ for all $n$. Under this setting, the loss function covering all targets can be written as: \begin{equation} \label{Eqn:LossFunction} {L\!\left(\mathbf{X},\mathcal{T},\mathcal{L},\mathcal{L}'\right)}= {{\sum_{n=1}^N}\left[{f}_{l_n}\!\left(\mathbf{X},t_n\right)-{f}_{l_n'}\!\left(\mathbf{X},t_n\right)\right]} \end{equation} Minimizing $L$ can be achieved via making every target to be incorrectly predicted, {\em i.e.}, suppressing the confidence of the original correct class $f_{l_n}\!\left(\mathbf{X}+\mathrm{r},t_n\right)$, while increasing that of the desired (adversarial) incorrect class $f_{l'_n}\!\left(\mathbf{X}+\mathrm{r},t_n\right)$. \setlength{\algomargin}{0.7em} \SetNlSkip{0.4em} \SetNlSty{text}{}{} \begin{algorithm}[t!] \SetKwInOut{Input}{Input} \SetKwInOut{Output}{Output} \SetKwInOut{Return}{Return} \Input{ input image $\mathbf{X}$;\\ \ the classifier ${\mathbf{f}\!\left(\cdot,\cdot\right)}\in{\mathbb{R}^C}$;\\ \ the target set ${\mathcal{T}}={\left\{t_1,t_2,\ldots,t_N\right\}}$;\\ \ the original label set ${\mathcal{L}}={\left\{l_1,l_2,\ldots,l_N\right\}}$;\\ \ the adversarial label set ${\mathcal{L}'}={\left\{l'_1,l'_2,\ldots,l'_N\right\}}$;\\ \ the maximal iterations $M_0$; } \Output{ the adversarial perturbation $\mathbf{r}$; } ${\mathbf{X}_0}\leftarrow{\mathbf{X}}$, ${\mathbf{r}}\leftarrow{\mathbf{0}}$, ${m}\leftarrow{0}$, ${\mathcal{T}_0}\leftarrow\mathcal{T}$;\\ \While{${m}<{M_0}$ {\bf and} ${\mathcal{T}_m}\neq{\varnothing}$}{ ${\mathcal{T}_m}={\left\{t_n\mid\arg\max_c\left\{f_c\!\left(\mathbf{X}_m,t_n\right)\right\} = l_n\right\}}$;\\ ${\mathbf{r}_m}\leftarrow{{\sum_{t_n\in\mathcal{T}_m}} \left[\nabla_{\mathbf{X}_m}f_{l'_n}\!\left(\mathbf{X}_m,t_n\right)- \nabla_{\mathbf{X}_m}f_{l_n}\!\left(\mathbf{X}_m,t_n\right)\right]}$;\\ ${\mathbf{r}'_m}\leftarrow{\frac{\gamma}{\left\|\mathbf{r}_m\right\|_\infty}\mathbf{r}_m}$;\\ ${\mathbf{r}}\leftarrow{\mathbf{r}+\mathbf{r}'_m}$;\\ ${\mathbf{X}_{m+1}}\leftarrow{\mathbf{X}_m+\mathbf{r}'_m}$;\\ ${m}\leftarrow{m+1}$; } \Return{ $\mathbf{r}$ } \caption{ Dense Adversary Generation (DAG) } \label{Alg:DAG} \end{algorithm} We apply a gradient descent algorithm for optimization. At the $m$-th iteration, denote the current image (possibly after adding several perturbations) as $\mathbf{X}_m$. We find the set of correctly predicted targets, named the {\em active target set}: ${\mathcal{T}_m}={\left\{t_n\mid\arg\max_c\left\{f_c\!\left(\mathbf{X}_m,t_n\right)\right\} = l_n\right\}}$. Then we compute the gradient with respect to the input data and then accumulate all these perturbations: \begin{equation} \label{Eqn:Gradient} \hspace*{-0.08cm} {\mathbf{r}_m}={{\sum_{t_n\in\mathcal{T}_m}}\left[\nabla_{\mathbf{X}_m}f_{l'_n}\!\left(\mathbf{X}_m,t_n\right)- \nabla_{\mathbf{X}_m}f_{l_n}\!\left(\mathbf{X}_m,t_n\right)\right]} \end{equation} Note that ${\left|\mathcal{T}_m\right|}\ll{\left|\mathcal{T}\right|}$ when $m$ gets large, thus this strategy considerably reduces the computational overhead. To avoid numerical instability, we normalize $\mathbf{r}_m$ as \begin{equation} \label{Eqn:LearningRate} {\mathbf{r}'_m}={\frac{\gamma}{\left\|\mathbf{r}_m\right\|_\infty}\cdot\mathbf{r}_m} \end{equation} where $\gamma=0.5$ is a fixed hyper-parameter. We then add $\mathbf{r}'_m$ to the current image $\mathbf{X}_m$ and proceed to the next iteration. The algorithm terminates if either all the targets are predicted as desired, {\em i.e.}, ${\mathcal{T}_m}={\varnothing}$, or it reaches the maximum iteration number, which is set to be $200$ in segmentation and $150$ in detection. The final adversarial perturbation is computed as ${\mathbf{r}}={{\sum_m}\mathbf{r}'_m}$. Note that, in practice, we often obtain the input image $\mathbf{X}$ after subtracting the mean image $\widehat{\mathbf{X}}$. In this case, the adversarial image is $\text{Trunc}\!\left(\mathbf{X}+\mathbf{r}+\widehat{\mathbf{X}}\right)$, where $\text{Trunc}\!\left(\cdot\right)$ denotes the function that truncates every pixel value by $\left[0,255\right]$. Although truncation may harm the adversarial perturbation, we observed little effect in experiments, mainly because the magnitude of perturbation $\mathbf{r}$ is very small (see Section~\ref{Generating:Diagnosis:Perceptibility}). The overall pipeline of DAG algorithm is illustrated in Algorithm~\ref{Alg:DAG}. \subsection{Selecting Input Proposals for Detection} \label{Generating:Selection} A critical issue in DAG is to select a proper set $\mathcal{T}$ of targets. This is relatively easy in the semantic segmentation task, because the goal is to produce incorrect classification on all pixels, and thus we can set each of them as a separate target, {\em i.e.}, performing dense sampling on the image lattice. This is tractable, {\em i.e.}, the computational complexity is proportional to the total number of pixels. In the scenario of object detection, target selection becomes a lot more difficult, as the total number of possible targets (bounding box proposals) is orders of magnitudes larger than that in semantic segmentation. A straightforward choice is to only consider the proposals generated by a sideway network, {\em e.g.}, the regional proposal network (RPN)~\cite{ren2015faster}, but we find that when the adversarial perturbation $\mathbf{r}$ is added to the original image $\mathbf{X}$, a different set of proposals may be generated according to the new input $\mathbf{X}+\mathbf{r}$, and the network may still be able to correctly classify these new proposals~\cite{lou2016foveation}. To overcome this problem, we make the proposals very dense by increasing the threshold of NMS in RPN. In practice, when the intersection-over-union (IOU) goes up from $0.70$ to $0.90$, the average number of proposals on each image increases from around $300$ to around $3000$. Using this denser target set $\mathcal{T}$, most probable object bounding boxes are only pixels away from at least one of the selected input proposals, and we can expect the classification error transfers among neighboring bounding boxes. As shown in experiments, this heuristic idea works very well, and the effect of adversarial perturbations is positively correlated to the number of proposals considered in DAG. Technically, given the proposals generated by RPN, we preserve all {\em positive} proposals and discard the remaining. Here, a positive proposal satisfies the following two conditions: 1) the IOU with the closest ground-truth object is greater than $0.1$, and 2) the confidence score for the corresponding ground-truth class is greater than $0.1$. If both conditions hold on multiple ground-truth objects, we select the one with the maximal IOU. The label of the proposal is defined as the corresponding confident class. This strategy aims at selecting high-quality targets for Algorithm~\ref{Alg:DAG}. \renewcommand{1.0cm}{1.0cm} \begin{table} \centering \begin{tabular}{|c||C{1.0cm}|C{1.0cm}|C{1.0cm}|} \hline Network & ORIG & ADVR & PERM \\ \hline\hline {\bf FCN-Alex} & $48.04$ & $ 3.98$ & $48.04$ \\ \hline {\bf FCN-Alex*} & $48.92$ & $ 3.98$ & $48.91$ \\ \hline {\bf FCN-VGG} & $65.49$ & $ 4.09$ & $65.47$ \\ \hline {\bf FCN-VGG*} & $67.09$ & $ 4.18$ & $67.08$ \\ \hline\hline {\bf FR-ZF-07} & $58.70$ & $ 3.61$ & $58.33$ \\ \hline {\bf FR-ZF-0712} & $61.07$ & $ 1.95$ & $60.94$ \\ \hline {\bf FR-VGG-07} & $69.14$ & $ 5.92$ & $68.68$ \\ \hline {\bf FR-VGG-0712} & $72.07$ & $ 3.36$ & $71.97$ \\ \hline \end{tabular} \vspace{-0.3cm} \caption{ Semantic segmentation (measured by mIOU, $\%$) and object detection (measured by mAP, $\%$) results of different networks. Here, ORIG represents the accuracy obtained on the original image set, ADVR is obtained on the set after the adversarial perturbations are added, and PERM is obtained after the randomly permuted perturbations are added. Please see Section~\ref{Generating:Quantitative} for details. } \vspace{-0.5cm} \label{Tab:Quantitative} \end{table} \subsection{Quantitative Evaluation} \label{Generating:Quantitative} Following some previous work~\cite{szegedy2013intriguing}\cite{moosavi2015deepfool}, we evaluate our approach by measuring the drop in recognition accuracy, {\em i.e.}, mean intersection-over-union (mIOU) for semantic segmentation and mean average precision (mAP) for object detection, using the original test images and the ones after adding adversarial perturbations\footnote{For implementation simplicity, we keep targets with ground-truth class label {\em background} unchanged when generating adversarial examples.}. \begin{itemize} \item For semantic segmentation, we study two network architectures based on the FCN~\cite{long2015fully} framework. One of them is based on the {\bf AlexNet}~\cite{krizhevsky2012imagenet} and the other one is based on the $16$-layer {\bf VGGNet}~\cite{simonyan2015very}. Both networks have two variants. We use {\bf FCN-Alex} and {\bf FCN-VGG}, which are publicly available, to denote the networks that are trained on the original FCN~\cite{long2015fully} training set which has $9610$ images, and use {\bf FCN-Alex*} and {\bf FCN-VGG*} to denote the networks that are trained on the DeepLab~\cite{chen2016deeplab} training set which has $10582$ images. We use the validation set in~\cite{long2015fully} which has 736 images as our semantic segmentation test set. \item For object detection, based on the Faster-RCNN~\cite{ren2015faster} framework, we study two network architectures, {\em i.e.}, the {\bf ZFNet}~\cite{zeiler2014visualizing} and the $16$-layer {\bf VGGNet}~\cite{simonyan2015very}. Both networks have two variants, which are either trained on the {\bf PascalVOC-2007} trainval set, or the combined {\bf PascalVOC-2007} and {\bf PascalVOC-2012} trainval sets. These four models are publicly available, and are denoted as {\bf FR-ZF-07}, {\bf FR-ZF-0712}, {\bf FR-VGG-07} and {\bf FR-VGG-0712}, respectively. We use the {\bf PascalVOC-2007} test set which has 4952 images as our object detection test set. \end{itemize} Results are summarized in Table~\ref{Tab:Quantitative}. We can observe that the accuracy (mIOU for segmentation and mAP for detection) drops significantly after the adversarial perturbations are added, demonstrating the effectiveness of DAG algorithm. Moreover, for detection, the networks with more training data are often more sensitive to the adversarial perturbation. This is verified by the fact that {\bf FR-ZF-07} (from $58.70\%$ to $3.61\%$) has a smaller performance drop than {\bf FR-ZF-0712} (from $61.07\%$ to $1.95\%$), and that {\bf FR-VGG-07} (from $69.14\%$ to $5.92\%$) has a smaller performance drop than {\bf FR-VGG-0712} (from $72.04\%$ to $3.36\%$). To verify the importance of the spatial structure of adversarial perturbations, we evaluate the accuracy after randomly permuting the rows and/or columns of $\mathbf{r}$. In Table~\ref{Tab:Quantitative}, we find that permuted perturbations cause negligible accuracy drop, indicating that it is the spatial structure of $\mathbf{r}$, instead of its magnitude, that indeed contributes in generating adversarial examples. For permutation results, we randomly permute $\mathbf{r}$ for three times and take the average. \subsection{Adversarial Examples} \label{Generating:Examples} \begin{figure} \centering \subfloat{\includegraphics[width=0.48\columnwidth]{FancySegOrig1.pdf}} \hfill \subfloat{\includegraphics[width=0.48\columnwidth]{FancySegOrig2.pdf}} \hfill \subfloat{\includegraphics[width=0.48\columnwidth]{FancySegPert1.pdf}} \hfill \subfloat{\includegraphics[width=0.48\columnwidth]{FancySegPert2.pdf}} \hfill \subfloat{\includegraphics[width=0.48\columnwidth]{FancySegAdvr1.pdf}} \hfill \subfloat{\includegraphics[width=0.48\columnwidth]{FancySegAdvr2.pdf}} \hfill \subfloat{\includegraphics[width=0.48\columnwidth]{FancySegResult1.pdf}} \hfill \subfloat{\includegraphics[width=0.48\columnwidth]{FancySegResult2.pdf}} \caption{ Fancy examples generated by DAG for semantic segmentation. The {\em adversarial} image is on the left and the {\em fooling} image is on the right. From top to bottom: the original image, the perturbation ({\bf magnified by $\mathbf{10}$}), the adversarial image after adding perturbation, and the segmentation results. The red, blue and black regions are predicted as {\em airplane}, {\em bus} and {\em background}, respectively. } \label{Fig:FancyExamples} \vspace{-0.3cm} \end{figure} Figure~\ref{Fig:AdversarialExamples} shows an adversarial example that fails in both detection and segmentation networks. In addition, we show that DAG is able to control the output of adversarial images very well. In Figure~\ref{Fig:FancyExamples}, we apply DAG to generating one {\em adversarial} image (which humans can recognize but deep networks cannot) and one {\em fooling} image~\cite{nguyen2015deep} (which is completely unrecognizable to humans but deep networks produce false positives). This suggests that deep networks only cover a limited area in the high-dimensional feature space, and that we can easily find adversarial and/or fooling examples that fall in the unexplored parts. \subsection{Diagnostics} \label{Generating:Diagnosis} \renewcommand{8.0cm}{5.5cm} \renewcommand{8.0cm}{6.0cm} \renewcommand{8.0cm}{11.1cm} \begin{figure*} \begin{minipage}{8.0cm} \centering \includegraphics[width=8.0cm]{nms.pdf} \caption{ The mAP of using adversarial perturbations on {\bf FR-ZF-07} to attack {\bf FR-ZF-07} and {\bf FR-ZF-0712}, with respect to the IOU rate. A larger IOU rate leads to a denser set of proposals. } \label{Fig:Denseness} \end{minipage} \hfill \begin{minipage}{8.0cm} \centering \includegraphics[width=8.0cm]{pixel_conv.pdf} \includegraphics[width=8.0cm]{box_conv.pdf} \caption{ The convergence of DAG measured by the number of active targets, {\em i.e.}, $\left|\mathcal{T}_m\right|$, with respect to the number of iterations. Over the entire dataset, the average numbers of iterations are $31.78$ and $54.02$ for {\bf FCN-Alex} and {\bf FCN-VGG}, and these numbers are $47.05$ and $41.42$ for {\bf FR-ZF-07} and {\bf FR-VGG-07}, respectively. } \label{Fig:Convergence} \end{minipage} \vspace{-0.2cm} \end{figure*} \subsubsection{The Denseness of Proposals} \label{Generating:Diagnosis:Denseness} We first observe the impact on adversarial generation of the denseness of the proposals. To this end, we use different IOU rates in the NMS process after the RPN. This directly affects the number of proposals preserved in Algorithm~\ref{Alg:DAG}. As we can see in Figure~\ref{Fig:Denseness}, the mAP value goes down ({\em i.e.}, stronger adversarial perturbations are generated) as the IOU rate increases, which means that fewer proposals are filtered out and thus the set of targets $\mathcal{T}$ becomes larger. This is in line of our expectation, since DAG only guarantees misclassification on the targets in $\mathcal{T}$. The denser sampling on proposals allows the recognition error to propagate to other possible object positions better. Therefore, we choose a large IOU value ($0.90$) which produces good results. \subsubsection{Convergence} \label{Generating:Diagnosis:Convergence} We then investigate the convergence of DAG, {\em i.e.}, how many iterations are needed to find the desired adversarial perturbation. Figure~\ref{Fig:Convergence} shows the number of active targets, {\em i.e.}, $\left|\mathcal{T}_m\right|$, with respect to the number of iterations $m$. In general, the training process goes smoothly in the early rounds, in which we find that the number of active proposals is significantly reduced. After the algorithm reaches the maximal number of iterations, {\em i.e.}, $200$ in segmentation and $150$ in detection, only few (less than $1\%$) image fail to converge. Even on these cases, DAG is able to produce reasonable adversarial perturbations. Another interesting observation is the difficulty in generating adversarial examples. In general, the detection networks are more difficult to attack than the segmentation networks, which is arguably caused by the much larger number of potential targets (recall that the total number of possible bounding boxes is one or two orders of magnitudes larger). Meanwhile, as the IOU rate increases, {\em i.e.}, a larger set $\mathcal{T}$ of proposals is considered, convergence also becomes slower, implying that more iterations are required to generate stronger adversarial perturbations. \subsubsection{Perceptibility} \label{Generating:Diagnosis:Perceptibility} Following~\cite{szegedy2013intriguing}\cite{moosavi2015deepfool}, we compute the perceptibility of the adversarial perturbation $\mathbf{r}$ defined by ${p}={\left(\frac{1}{K}{\sum_k}\left\|\mathbf{r}_k\right\|_2^2\right)^{1/2}}$, where $K$ is the number of pixels, and $\mathbf{r}_k$ is the intensity vector ($3$-dimensional in the RGB color space, $k=1,2,3$) normalized in $\left[0,1\right]$. We average the perceptibility value over the entire test set. In semantic segmentation, these values are $2.6\times10^{-3}$, $2.5\times10^{-3}$, $2.9\times10^{-3}$ and $3.0\times10^{-3}$ on {\bf FCN-Alex}, {\bf FCN-Alex*}, {\bf FCN-VGG} and {\bf FCN-VGG*}, respectively. In object detection, these values are $2.4\times10^{-3}$, $2.7\times10^{-3}$, $1.5\times10^{-3}$ and $1.7\times10^{-3}$ on {\bf FR-ZF-07}, {\bf FR-ZF-0712}, {\bf FR-VGG-07} and {\bf FR-VGG-0712}, respectively. One can see that these numbers are very small, which guarantees the imperceptibility of the generated adversarial perturbations. The visualized examples (Figures~\ref{Fig:AdversarialExamples} and~\ref{Fig:FancyExamples}) also verify this point. \section{Transferring Adversarial Perturbations} \label{Transferring} In this section, we investigate the transferability of the generated adversarial perturbations. For this respect, we add the adversarial perturbation computed on one model to attack other models. The attacked model may be trained based on a different (sometimes unknown) network architecture, or even targeted at a different vision task. Quantitative results are summarized in Tables~\ref{Tab:TransferDet} -~\ref{Tab:TransferDetSeg}, and typical examples are illustrated in Figure~\ref{Fig:TransferrableExamples}. In the following parts, we analyze these results by organizing them into three categories, namely {\em cross-training} transfer, {\em cross-network} transfer and {\em cross-task} transfer. \renewcommand{1.0cm}{1.89cm \begin{table*} \centering \begin{tabular}{|C{3cm}||C{1.0cm}|C{1.0cm}|C{1.0cm}|C{1.0cm}|C{1.0cm}|C{1.0cm}|} \hline Adversarial Perturbations from & {{\bf FR-ZF-07}} & {{\bf FR-ZF-0712}} & {{\bf FR-VGG-07}} & {{\bf FR-VGG-0712}} & {{\bf R-FCN-RN50}} & {{\bf R-FCN-RN101}} \\ \hline {\bf None} & {$58.70$} & {$61.07$} & {$69.14$} & {$72.07$} & {$76.40$} & {$78.06$} \\ \hline {{\bf FR-ZF-07} ($\mathbf{r}_1$)} & {$ \mathbf{3.61}$} & {$22.15$} & {$66.01$} & {$69.47$} & {$74.01$} & {$75.87$} \\ \hline {{\bf FR-ZF-0712} ($\mathbf{r}_2$)} & {$13.14$} & {$ \mathbf{1.95}$} & {$64.61$} & {$68.17$} & {$72.29$} & {$74.68$} \\ \hline {{\bf FR-VGG-07} ($\mathbf{r}_3$)} & {$56.41$} & {$59.31$} & {$ \mathbf{5.92}$} & {$48.05$} & {$72.84$} & {$74.79$} \\ \hline {{\bf FR-VGG-0712} ($\mathbf{r}_4$)} & {$56.09$} & {$58.58$} & {$31.84$} & {$ \mathbf{3.36}$} & {$70.55$} & {$72.78$} \\ \hline {$\mathbf{r}_1+\mathbf{r}_3$} & {$ \mathbf{3.98}$} & {$21.63$} & {$ \mathbf{7.00}$} & {$44.14$} & {$68.89$} & {$71.56$} \\ \hline {$\mathbf{r}_1+\mathbf{r}_3 \ \text{(permute)}$} & {$58.30$} & {$61.08$ & {$68.63$} & {$71.82$ & {$76.34$} & {$77.71$ \\ \hline {$\mathbf{r}_2+\mathbf{r}_4$} & {$13.15$} & {$ \mathbf{2.13}$} & {$28.92$} & {$ \mathbf{4.28}$} & {$63.93$} & {$67.25$} \\ \hline {$\mathbf{r}_2+\mathbf{r}_4 \ \text{(permute)}$} & {$58.51$} & {$ 61.09$ & {$68.68$} & {$ 71.78$ & {$76.23$} & {$77.71$ \\ \hline \end{tabular} \vspace{-0.3cm} \caption{ Transfer results for detection networks. {\bf FR-ZF-07}, {\bf FR-ZF-0712}, {\bf FR-VGG-07} and {\bf FR-VGG-0712} are used as four basic models to generate adversarial perturbations, and {\bf R-FCN-RN50} and {\bf R-FCN-RN101} are used as black-box models. All models are evaluated on the {\bf PascalVOC-2007} test set and its adversarial version, which both has $4952$ images. } \label{Tab:TransferDet} \vspace{-0.15cm} \end{table*} \renewcommand{1.0cm}{1.89cm \begin{table*} \centering \begin{tabular}{|C{3cm}||C{1.0cm}|C{1.0cm}|C{1.0cm}|C{1.0cm}|C{1.0cm}|C{1.0cm}|} \hline Adversarial Perturbations from & {{\bf FCN-Alex}} & {{\bf FCN-Alex*}} & {{\bf FCN-VGG}} & {{\bf FCN-VGG*}} & {{\bf DL-VGG}} & {{\bf DL-RN101}} \\ \hline {\bf None} & {$48.04$} & {$48.92$} & {$65.49$} & {$67.09$} & {$70.72$} & {$76.11$} \\ \hline {{\bf FCN-Alex} ($\mathbf{r}_5$)} & {$ \mathbf{3.98}$} & {$7.94$} & {$64.82$} & {$66.54$} & {$70.18$} & {$75.45$} \\ \hline {{\bf FCN-Alex*} ($\mathbf{r}_6$)} & {$ 5.10$} & {$ \mathbf{3.98}$} & {$64.60$} & {$66.36$} & {$69.98$} & {$75.52$} \\ \hline {{\bf FCN-VGG} ($\mathbf{r}_7$)} & {$46.21$} & {$47.38$} & {$ \mathbf{4.09}$} & {$16.36$} & {$45.16$} & {$73.98$} \\ \hline {{\bf FCN-VGG*} ($\mathbf{r}_8$)} & {$46.10$} & {$47.21$} & {$12.72$} & {$ \mathbf{4.18}$} & {$46.33$} & {$73.76$} \\ \hline {$\mathbf{r}_5+\mathbf{r}_7$} & {$ \mathbf{4.83}$} & {$ 8.55$} & {$ \mathbf{4.23}$} & {$17.59$} & {$43.95$} & {$73.26$} \\ \hline {$\mathbf{r}_5+\mathbf{r}_7 \ \text{(permute)}$} & {$48.03$} & {$48.90$} & {$65.47$} & {$67.09$} & {$70.69$} & {$76.04$} \\ \hline {$\mathbf{r}_6+\mathbf{r}_8$} & {$ 5.52$} & {$ \mathbf{4.23}$} & {$13.89$} & {$ \mathbf{4.98}$} & {$44.18$} & {$73.01$} \\ \hline {$\mathbf{r}_6+\mathbf{r}_8 \ \text{(permute)}$} & {$48.03$} & {$48.90$} & {$65.47$} & {$67.05$} & {$70.69$} & {$76.05$} \\ \hline \end{tabular} \vspace{-0.3cm} \caption{ Transfer results for segmentation networks. {\bf FCN-Alex}, {\bf FCN-Alex*}, {\bf FCN-VGG} and {\bf FCN-VGG*} are used as four basic models to generate adversarial perturbations, and {\bf DL-VGG} and {\bf DL-RN101} are used as black-box models. All models are evaluated on validation set in \cite{long2015fully} and its adversarial version, which both has $736$ images. } \label{Tab:TransferSeg} \vspace{-0.15cm} \end{table*} \renewcommand{1.0cm}{2.354cm \begin{table*}[htpb!] \centering \begin{tabular}{|C{3cm}||C{1.0cm}|C{1.0cm}|C{1.0cm}|C{1.0cm}|C{1.0cm}|} \hline Adversarial Perturbations from & {{\bf FR-ZF-07}} & {{\bf FR-VGG-07}} & {{\bf FCN-Alex}} & {{\bf FCN-VGG}} & {{\bf R-FCN-RN101}} \\ \hline {\bf None} & {$56.83$} & {$68.88$} & {$35.73$} & {$54.87$} & {$80.20$} \\ \hline {{\bf FR-ZF-07} ($\mathbf{r}_1$)} & {$\mathbf{5.14}$} & {$ 66.63$} & {$31.74$} & {$51.94$} & {$76.00$} \\ \hline {{\bf FR-VGG-07} ($\mathbf{r}_3$)} & {$54.96$} & {$ \mathbf{7.17}$} & {$34.53$} & {$43.06$} & {$74.50$} \\ \hline {{\bf FCN-Alex} ($\mathbf{r}_5$)} & {$55.61$} & {$ 68.62$} & {$\mathbf{4.04}$} & {$54.08$} & {$77.09$} \\ \hline {{\bf FCN-VGG} ($\mathbf{r}_7$)} & {$55.24$} & {$56.33$} & {$33.99$} & {$\mathbf{4.10}$} & {$73.86$} \\ \hline {$\mathbf{r}_1+\mathbf{r}_3+\mathbf{r}_5$} & {$ \mathbf{5.02}$} & {$ \mathbf{8.75}$} & {$ \mathbf{4.32}$} & {$ 37.90$} & {$69.07$} \\ \hline {$\mathbf{r}_1+\mathbf{r}_3+\mathbf{r}_7$} & {$ \mathbf{5.15}$} & {$ \mathbf{5.63}$} & {$28.48$} & {$\mathbf{4.81}$} & {$ 65.23$} \\ \hline {$\mathbf{r}_1+\mathbf{r}_5+\mathbf{r}_7$} & {$ \mathbf{5.14}$} & {$47.52$} & {$\mathbf{4.37}$} & {$ \mathbf{5.20}$} & {$ 68.51$} \\ \hline {$\mathbf{r}_3+\mathbf{r}_5+\mathbf{r}_7$} & {$53.34$} & {$ \mathbf{5.94}$} & {$\mathbf{4.41}$} & {$ \mathbf{4.68}$} & {$ 67.57$} \\ \hline {$\mathbf{r}_1+\mathbf{r}_3+\mathbf{r}_5+\mathbf{r}_7$} & {$ \mathbf{5.05}$} & {$ \mathbf{5.89}$} & {$ \mathbf{4.51}$} & {$ \mathbf{5.09}$} & {$ 64.52$} \\ \hline \end{tabular} \vspace{-0.3cm} \caption{ Transfer results between detection networks and segmentation networks. {\bf FR-ZF-07}, {\bf FR-VGG-07}, {\bf FCN-Alex} and {\bf FCN-VGG} are used as four basic models to generate adversarial perturbations, and {\bf R-FCN-RN101} are used as black-box model. When attacking the first four basic networks, we use a subset of the {\bf PascalVOC-2012} segmentation validation set which contains $687$ images. In the black-box attack, we evaluate our method on the non-intersecting subset of $110$ images. } \label{Tab:TransferDetSeg} \vspace{-0.3cm} \end{table*} \subsection{Cross-Training Transfer} \label{Transferring:CrossTraining} By {\em cross-training} transfer, we mean to apply the perturbations learned from one network to another network with the same architecture but trained on a different dataset. We observe that the transferability {\em largely} exists within the same network structure\footnote{We also studied training on strictly non-overlapping datasets, e.g., the model {\bf FR-ZF-07} trained on {\bf PascalVOC-2007} trainval set and the model {\bf FR-ZF-12val} trained on {\bf PascalVOC-2012} val set. The experiments deliver similar conclusions. For example, using {\bf FR-ZF-07} to attack {\bf FR-ZF-12val} results in a mAP drop from $56.03\%$ to $25.40\%$, and using {\bf FR-ZF-12val} to attack {\bf FR-ZF-07} results in a mAP drop from $58.70\%$ to $30.41\%$.}. For example, using the adversarial perturbations generated by {\bf FR-ZF-07} to attack {\bf FR-ZF-0712} obtains a $22.15\%$ mAP. This is a dramatic drop from the performance ($61.07\%$) reported on the original images, although the drop is less than that observed in attacking {\bf FR-ZF-07} itself (from $58.70\%$ to $3.61\%$). Meanwhile, using the adversarial perturbations generated by {\bf FR-ZF-0712} to attack {\bf FR-ZF-07} causes the mAP drop from $58.70\%$ to $13.14\%$, We observe similar phenomena when {\bf FR-VGG-07} and {\bf FR-VGG-0712}, or {\bf FCN-Alex} and {\bf FCN-Alex*}, or {\bf FCN-VGG} and {\bf FCN-VGG*} are used to attack each other. Detailed results are shown in Tables~\ref{Tab:TransferDet} and \ref{Tab:TransferSeg}. \subsection{Cross-Network Transfer} \label{Transferring:CrossNetwork} We extend the previous case to consider the transferability through different network structures. We introduce two models which are more powerful than what we used to generate adversarial perturbations, namely DeepLab~\cite{chen2016deeplab} for semantic segmentation and R-FCN~\cite{li2016r} for object detection. For DeepLab~\cite{chen2016deeplab}, we use {\bf DL-VGG} to denote the network based on 16-layer {\bf VGGNet}\cite{simonyan2015very}, and use {\bf DL-RN101} to denote the network based on 101-layer {\bf ResNet}\cite{he2016deep}. Both networks are trained on original DeepLab~\cite{chen2016deeplab} training set which has $10582$ images. For R-FCN~\cite{li2016r}, we use {\bf R-FCN-RN50} to denote the network based on 50-layer {\bf ResNet}\cite{he2016deep}, and use {\bf R-FCN-RN101} to denote the network based on 101-layer {\bf ResNet}\cite{he2016deep}. Both networks are trained on the combined trainval sets of {\bf PascalVOC-2007} and {\bf PascalVOC-2012}. The perturbations applied to these four models are considered as black-box attacks~\cite{papernot2016practical}, since DAG does not know the structure of these networks beforehand. Detailed results are shown in Tables~\ref{Tab:TransferDet} and~\ref{Tab:TransferSeg}. Experiments reveal that transferability between different network structures becomes weaker. For example, applying the perturbations generated by {\bf FR-ZF-07} leads to slight accuracy drop on {\bf FR-VGG-07} (from $69.14\%$ to $66.01\%$), {\bf FR-VGG-0712} (from $72.07\%$ to $69.74\%$), {\bf R-FCN-RN50} (from $76.40\%$ to $74.01\%$) and {\bf R-FCN-RN101} (from $78.06\%$ to $75.87\%$), respectively. Similar phenomena are observed in using different segmentation models to attack each other. One exception is using {\bf FCN-VGG} or {\bf FCN-VGG*} to attack {\bf DL-VGG} (from $70.72\%$ to $45.16\%$ for {\bf FCN-VGG} attack, or from $70.72\%$ to $46.33\%$ by {\bf FCN-VGG*} attack), which results in a significant accuracy drop of {\bf DL-VGG}. Considering the cues obtained from previous experiments, we conclude that adversarial perturbations are closely related to the architecture of the network. \subsection{Cross-Task Transfer} \label{Transferring:CrossTask} Finally, we investigate {\em cross-task} transfer, {\em i.e.}, using the perturbations generated by a detection network to attack a segmentation network or in the opposite direction. We use a subset of {\bf PascalVOC-2012} segmentation validation set as our test set \footnote{There are training images of {\bf FR-ZF-07}, {\bf FR-VGG-07}, {\bf FCN-Alex} and {\bf FCN-VGG} included in the {\bf PascalVOC-2012} segmentation validation set, so we validate on the non-intersecting set of $687$ images.}. Results are summarized in Table~\ref{Tab:TransferDetSeg}. We note that if the same network structure is used, {\em e.g.}, using {\bf FCN-VGG} (segmentation) and {\bf FR-VGG-07} (detection) to attack each other, the accuracy drop is significant (the mIOU of {\bf FCN-VGG} drops from $54.87\%$ to $43.06\%$, and the mAP of {\bf FR-VGG-07} drops from $68.88\%$ to $56.33\%$). Note that this drop is even more significant than {\em cross-network} transfer on the same task, which verifies our hypothesis again that the adversarial perturbations are related to the network architecture. \subsection{Combining Heterogeneous Perturbations} \label{Transferring:Combination} From the above experiments, we assume that different network structures generate roughly {\em orthogonal} perturbations, which means that if $\mathbf{r}_\mathbb{A}$ is generated by one structure $\mathbb{A}$, then adding it to another structure $\mathbb{B}$ merely changes the recognition results, {\em i.e.}, ${\mathbf{f}^\mathbb{B}\!\left(\mathbf{X},t_n\right)}\approx {\mathbf{f}^\mathbb{B}\!\left(\mathbf{X}+\mathbf{r}_\mathbb{A},t_n\right)}$. This motivates us to combine heterogeneous perturbations towards better adversarial performance. For example, if both $\mathbf{r}_\mathbb{A}$ and $\mathbf{r}_\mathbb{B}$ are added, we have ${\mathbf{f}^\mathbb{A}\!\left(\mathbf{X}+\mathbf{r}_\mathbb{A}+\mathbf{r}_\mathbb{B},t_n\right)}\approx {\mathbf{f}^\mathbb{A}\!\left(\mathbf{X}+\mathbf{r}_\mathbb{A},t_n\right)}$ and ${\mathbf{f}^\mathbb{B}\!\left(\mathbf{X}+\mathbf{r}_\mathbb{A}+\mathbf{r}_\mathbb{B},t_n\right)}\approx {\mathbf{f}^\mathbb{B}\!\left(\mathbf{X}+\mathbf{r}_\mathbb{B},t_n\right)}$. Thus, the combined perturbation $\mathbf{r}_\mathbb{A}+\mathbf{r}_\mathbb{B}$ is able to confuse both network structures. In Tables~\ref{Tab:TransferDet}--~\ref{Tab:TransferDetSeg}, we list some results by adding multiple adversarial perturbations. Also, in order to verify that the spatial structure of combined adversarial perturbations is the key point that leads to statistically significant accuracy drop, we randomly generate three permutations of the combined adversarial perturbations and report the average accuracy. From the results listed in Tables~\ref{Tab:TransferDet}--~\ref{Tab:TransferDetSeg}, we can observe that adding multiple adversarial perturbations often works better than adding a single source of perturbations. Indeed, the accuracy drop caused by the combined perturbation approximately equals to the sum of drops by each perturbation. For example, the adversarial perturbation $\mathbf{r}_2+\mathbf{r}_4$ (combining {\bf FR-ZF-0712} and {\bf FR-VGG-0712}) causes significant mAP drop on all {\bf ZFNet}-based and {\bf VGGNet}-based detection networks, and the adversarial perturbation $\mathbf{r}_5+\mathbf{r}_7$ (combining {\bf FCN-Alex*} and {\bf FCN-VGG*}) causes significant mIOU drop on all {\bf AlexNet}-based and {\bf VGGNet}-based segmentation networks. However, permutation destroys the spatial structure of the adversarial perturbations, leading to negligible accuracy drops. The same conclusion holds when the perturbations from different tasks are combined. Table~\ref{Tab:TransferDetSeg} shows some quantitative results of such combination and Figure~\ref{Fig:FoolAll} shows an example. Note that, the perceptibility value defined in Section~\ref{Generating:Diagnosis:Perceptibility} remains very small even when multiple adversarial perturbations are combine (e.g., $4.0\times10^{-3}$ by $\mathbf{r}_1+\mathbf{r}_3+\mathbf{r}_5+\mathbf{r}_7$). \begin{figure}[!htb] \centering \includegraphics[width=\columnwidth]{Figure_6.pdf} \vspace{-0.7cm} \caption{ Adding one adversarial perturbation computed by $\mathbf{r}_1+\mathbf{r}_3+\mathbf{r}_5+\mathbf{r}_7$ (see Table~\ref{Tab:TransferDetSeg}) confuses four different networks. The top row shows {\bf FR-VGG-07} and {\bf FR-ZF-07} detection results, and the bottom row shows {\bf FCN-Alex} and {\bf FCN-VGG} segmentation results. The blue in segmentation results corresponds to boat. } \vspace{-0.3cm} \label{Fig:FoolAll} \end{figure} \begin{figure*} \centering \includegraphics[width=0.95\linewidth]{Figure_5.pdf} \vspace{-0.3cm} \caption{ Transferrable examples for semantic segmentation and object detection. These four rows, from top to bottom, shows the adversarial attack examples within two detection networks, within two segmentation networks, using a segmentation network to attack a detection network and in the opposite direction, respectively. The segmentation legend borrows from~\cite{zheng2015conditional}. } \label{Fig:TransferrableExamples} \vspace{-0.3cm} \end{figure*} \subsection{Black-Box Attack} \label{Transferring:BlackBox} Combining heterogeneous perturbations allows us to perform better on the so-called {\em black-box attack}~\cite{papernot2016practical}, in which we do not need to know the detailed properties (architecture, purpose, {\em etc.}) about the defender network. According to the above experiments, a simple and effective way is to compute the sum of perturbations from several of known networks, such as {\bf FR-ZF-07}, {\bf FR-VGG-07} and {\bf FCN-Alex}, and use it to attack an unknown network. This strategy even works well when the structure of the defender is not investigated before. As an example shown in Table~\ref{Tab:TransferDetSeg}, the perturbation $\mathbf{r}_1+\mathbf{r}_3+\mathbf{r}_5+\mathbf{r}_7$ leads to significant accuracy drop (from $80.20\%$ to $64.52\%$) on {\bf R-FCN-RN101}\cite{li2016r}, a powerful network based on the deep {\bf ResNet}~\cite{he2016deep}. \section{Conclusions} \label{Conclusions} In this paper, we investigate the problem of generating adversarial examples, and extend it from image classification to semantic segmentation and object detection. We propose DAG algorithm for this purpose. The basic idea is to define a dense set of targets as well as a different set of desired labels, and optimize a loss function in order to produce incorrect recognition results on all the targets simultaneously. Extensive experimental results verify that DAG is able to generate visually imperceptible perturbation, so that we can confuse the originally high-confidence recognition results in a well controllable manner. An intriguing property of the perturbation generated by DAG lies in the transferability. The perturbation can be transferred across different training sets, different network architectures and even different tasks. Combining heterogeneous perturbations often leads to more effective adversarial perturbations in black-box attacks. The transferability also suggests that deep networks, though started with different initialization and trained in different ways, share some basic principles such as local linearity, which make them sensitive to a similar source of perturbations. This reveals an interesting topic for future research. \section*{Acknowledgements} \label{Acknowledgements} We thank Dr. Vittal Premachandran, Chenxu Luo, Weichao Qiu, Chenxi Liu, Zhuotun Zhu and Siyuan Qiao for instructive discussions. \clearpage {\small \bibliographystyle{ieee}
{'timestamp': '2017-07-24T02:09:36', 'yymm': '1703', 'arxiv_id': '1703.08603', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08603'}
arxiv
\section{Introduction}\label{sec:introduction} Recent years have witnessed tremendous advances in the field of facial performance capture in videos, which serves as a vital foundation for other computer graphics applications~\cite{han2017deepsketch2face, thies2016face2face, yang2012facial}. Especially, impressive results have been achieved in state-of-the-art face editing frameworks, and they are widely used in creating funny facial effects for video games, movies and even mobile applications. In order to express user's editing intention, this kind of frameworks always involves complex inputs (e.g., other images or videos within the same domain~\cite{yang2012facial, yang2011expression}) or additional capture devices (e.g., RGB or RGB-D cameras~\cite{thies2016face2face, chen2013accurate, hsieh2015unconstrained}). However, it is quite inconvenient for artists or amateur editors to reach these resources in our daily life. Moreover, current state-of-the-art methods always aim to enable users to modify the facial expression of the actor in a video, since this kind of editing intention can be easily detected with fixed facial identities. While changing the identity, i.e., the original appearance of a face without the influence from the pose and facial expression, is quite difficult, since it is a form of modification which is hard to be computed straightforward from reference inputs or several parameters. We address these two shortcomings by making use of sketch, which offers more efficiency and flexibility to editors as demonstrated in the recent research~\cite{lau2009face, miranda2012sketch, wang2015sketch, liang2014sketch}. Consider the problem of transferring facial characters in a cartoon image to an actor in the video as shown in Fig.~\ref{fig:teaser}. In this paper, we propose a novel and robust interactive sketch-based face editing framework for both professional and amateur editors to finish this task very conveniently on a standard PC. \emph{We note that our framework is not a caricature system: the cartoon image we introduced here is not an input which will be processed by our framework; we are simply using it as an inspiration or guideline for users to edit the source video.} In fact, users are free to modify any facial appearance of an actor in the given video with the help of our framework. Compared to previous work, we focus on allowing users to edit the facial identity of the actor in the whole video, but not the expressions. \begin{figure*}[!t] \centering \includegraphics[width=\linewidth]{fig1} \caption{Given a video, consider the problem of modifying the actor's facial appearance, e.g. enlarging his mouth, to match facial characters in a reference image (top-left). Our framework enables users to perform such editing operations by hand-drawn sketch. Then these modifications are propagated throughout the whole video. Top: a cartoon image for reference and key frames in a video. Bottom: the input sketches and edited frames. \emph{Note that our framework is not a caricature system. It does not transfer texture styles from cartoon images to videos, since we only focus on sketch-based identity deformation.}} \label{fig:teaser} \end{figure*} There are three challenges towards this goal. (1) There is an inherent tradeoff between flexibility of sketch-based specification and robustness. Specifically, unconstrained hand-drawn strokes may produce ambiguous inputs~\cite{lau2009face,chang2006sketching}. For example, a stroke drawn between the eyebrow and upper eyelid might indicate editing either of them. And it is quite difficult for the framework to determine the user's true editing intention by dealing with this stroke alone. (2) Since the face appearance depends on the pose of the actor as well as the identity, the influence of facial expression should be taken into account when applying changes to the identity. (3) Compared with previous sketch-based methods designed for static 2D images or 3D models~\cite{lau2009face,miranda2012sketch,chang2006sketching,nataneli2011bringing}, our framework has to further propagate the modifications from one frame to the whole video. In this process, we need to predict the modified face appearance in each frame while ensuring consistency and fidelity. In this paper, we introduce a 3D face model fitting and identity deformation transfer formulation. Our core idea is to first transfer modifications from the input sketch to the corresponding 3D face model fitted by the facial identity and expression, which is then used for propagating changes to the whole video. To the best of our knowledge, we are the first framework which allows users to edit the facial identity of an actor in a video using hand-drawn sketches. This is made possible with the following key contributions: (1) a sketch-based facial identity editing framework for videos, (2) a novel 2D to 3D sketch-based identity deformation transfer algorithm, (3) and a contour-based interface for 3D model refinement. \begin{figure*}[!t] \centering \includegraphics[width=\linewidth]{fig2} \caption{Workflow of our sketching framework. The detailed algorithm of each part is presented in the corresponding sections. Red dashed arrows indicate a sequence of inputs while blue solid arrows stand for model fitting or updating operations, and a dashed box means an optional step.} \label{fig:overview} \end{figure*} \section{Related work}\label{sec:relatedwork} In this section, we review the previous work in the filed of sketch-based editing and deformation transfer which motivate the design of our sketching system. \subsection{Sketch-based shape editing} Hand-drawn sketches are widely used in modeling static facial inputs, such as images or 3D shapes~\cite{han2017deepsketch2face,olsen2009sketch}. The main challenge of these systems is to handle ambiguous user inputs, i.e., strokes which are difficult to match. Previous work~\cite{lau2009face,chang2006sketching,sucontphunt2008interactive} limits the use of only pre-recorded data (curves or points) to mitigate ambiguity. The following two sketch-based facial animation editing systems proposed recently are most related to our work. Nataneli et al.~\cite{nataneli2011bringing} introduced an internal representation of sketch's semantics, while users have to draw sketch in some predefined regions. Miranda et al.~\cite{miranda2012sketch} built a sketching interface control system, which only allows users to draw strokes on a predefined set of areas corresponding to different face landmarks to avoid ambiguous conditions. In this paper, we introduce a sketch-based editing framework which differs from previous work in the following two aspects: (1) our method is the first framework that allows users to edit the face by sketch in a video sequence other than a static image or 3D shape; (2) we utilize the sequence information of strokes to deal with ambiguous user inputs without predefined constraints. \subsection{Deformation transfer} Deformation transfer~\cite{sumner2004deformation, botsch2006deformation} firstly addressed the problem of transferring local deformations between two different meshes, where the deformation gradient of meshes is directly transferred by solving an optimization problem. Semantic deformation transfer~\cite{baran2009semantic} inferred a correspondence between the shape spaces of the two characters from given example mesh pairs by using standard linear algebra. Zhou et al.~\cite{zhou2016cartoon} further utilized these methods to automatically generate a 3D cartoon of a real 3D face. Thies et al.~\cite{thies2016face2face} developed a system that transfers expression changes from the source to the target actor based on~\cite{sumner2004deformation} and achieves real-time performance. Xu et al.~\cite{xu2014controllable} designed a facial expression transfer and editing technique for high-fidelity facial performance data. Moreover, other flow-based approaches~\cite{yang2012facial, yang2011expression} are also proposed to transfer facial expression to different face meshes. However, these traditional methods aim to transfer deformations, especially facial expressions, between 3D meshes. Differing from them, we propose a transfer pipeline which can be used to directly transfer local identity changes in 2D space to a 3D face model. Huang et al.~\cite{huang2006subspace} presented an approach to project changes of a mesh in 2D to 3D as the projection constraint. Compared with it, the main novelty of our algorithm is that we combine a sketch-based interface to enable users to perform the editing with hand-drawn sketches from 2D to 3D. We first map sketch into a set of modifications corresponding to 3D space, and then transfer it to the target 3D mesh. \section{Framework overview}\label{sec:overview} \begin{table*}[t!] \renewcommand{\arraystretch}{1.2} \caption{\label{tbl:symbol}The main symbols and their meanings we employed in this paper.} \centering \begin{tabular}{@{}ll@{}} \toprule Symbol & Meaning \\ \midrule $V = \{\mathbf{v}_k \mid 1 \leq k \leq N_V\}$ & a set of vertices to represent the shape of a 3D face mesh \\ $\mathbf{u} = [u_1, \dots, u_n]$ & the coefficient vector of the facial identity \\ $\mathbf{e} = [e_1, \dots, e_n]$ & the coefficient vector of the facial expression \\ $B = \{\mathbf{b}_k \mid 0 \leq k < N_B\}$ & a set of expression blendshapes of a certain actor ($\mathbf{b}_0$ is the shape of neutral expression)\\ $L = \{\mathbf{l}_k \mid 1 \leq k \leq N_L\}$ & a set of 2D landmarks of the face in a video frame \\ $F$ & a 3D face mesh generated after the global rotation $\mathbf{R}$ and translation $\mathbf{t}$ \\ $I$ & the identity component of a 3D face mesh $F$ \\ $E$ & the expression component of a 3D face mesh $F$ \\ $M$ & the isomap of a 3D face mesh $F$ \\ $\{G_k \mid 1 \leq k \leq N_G \}$ & a set of 2D landmark groups (each $G_k$ is a subset of $L$) \\ $\{S_k \mid 1 \leq k \leq N_S \}$ & a set of hand-drawn strokes \\ \bottomrule \end{tabular} \end{table*} The input of our framework is a monocular video consisting of continuous frames of a person's face, together with a frame $t_0$ in this video containing a corresponding hand-drawn sketch. This sketch may be a complete facial sketch or partial strokes representing changes that the user wants to be made to the appearance of the face, e.g., to enlarge the mouth or modify the position of the eyebrows. Our goal is to recognize all these changes from the sketch and apply them to the whole video. Inspired by Thies et al.~\cite{thies2016face2face, yang2012facial}, we formulate this task as a parametric face model fitting and deformation transfer problem. The whole pipeline of our framework is outlined in Fig.~\ref{fig:overview}. Our core idea is to first reconstruct a 3D face model $F_t$ for each frame $t$ in the input video, where $F_t$ can be disentangled into a unique component $I$ to represent the facial identity and a sequence of $E_t$ to describe the facial expression changes over time. Meanwhile, the face deformation encoded in the input sketch is approximated by a set of local deformations in 2D space. Then we transfer these deformations from 2D space to the target 3D facial identity $I$, while the influence of expression $E_t$ is removed by solving an energy minimization problem. After computing the modified identity shape $\hat{I}$, we can get the updated full 3D face model $\hat{F}_t$ for each frame $t$. Finally, these modifications are propagated throughout the whole video by rendering $\hat{F}_t$ to frame $t$ with the isomap $M_t$. In the following, we discuss the individual steps in detail. First, in Section~\ref{sec:approach:fitting}, we show how the 3D face model is reconstructed and disentangled into the identity as well as expression for each frame in the video by a robust 3D face morphable model fitting algorithm~\cite{cao2014displaced}. In Section~\ref{sec:approach:sketch}, a robust sketch mapping and fitting schema is introduced to recognize user's editing intentions and apply them to the face in 2D space. Specifically, we utilize the order information carried by a series of strokes to mitigate ambiguity. Then an energy function is minimized to deform the face appearance and handle stroke noises at the same time. In Section~\ref{sec:approach:transfer}, we further present an approach to transfer deformations from 2D space to the 3D facial identity with depth estimation, while get rid of the influence from expression. We also implement a contour-based interface for users to refine the 3D identity optionally in Section~\ref{sec:approach:refinement}. Finally, Section~\ref{sec:approach:optimization} presents the optimization algorithms for rendering the deformed face texture back to the whole video, which removes artifacts generated from the previous steps. The user study as well as experiment results shown in Section~\ref{sec:results} indicate that our sketching framework is simple to use even for amateurs, while high-fidelity results are guaranteed as well. For clarity, we list the main symbols we used throughout this paper in Table~\ref{tbl:symbol}. \section{Face model fitting}\label{sec:approach:fitting} We utilize FaceWarehouse~\cite{cao2014facewarehouse} to construct the blendshape face meshes for each frame in the input video. Specifically, a fully transformed 3D face model $F$ can be represented as: \begin{equation} \label{eq:fullfacemodel} F = \mathbf{R} \cdot V + \mathbf{t} = \mathbf{R} \cdot \big(C \times_2 \mathbf{u}^T \times_3 \mathbf{e}^T\big) + \mathbf{t}, \end{equation} where $V$ is a set of vertices describing the shape of the face mesh. We utilize $\mathbf{R}$ and $\mathbf{t}$ to represent the global rotation and translation of $V$, respectively. $C$ is the rank-3 core tensor from the FaceWarehouse database~\cite{cao2014facewarehouse}, which corresponds to vertices of the face mesh, identity and expression. $\mathbf{u}$ is the identity vector and $\mathbf{e}$ is the expression vector. Let $L = \{\mathbf{l}_k\}$ denote a set of 2D facial landmarks of the face in a frame and $\{\mathbf{v}_k\}$ denote their corresponding vertices of the 3D face mesh $V$. Let $F^{(\mathbf{v}_k)}$ be the 3D position of $\mathbf{v}_k$ after the global rotation and translation according to Eq.~\ref{eq:fullfacemodel}. To compute $\mathbf{l}_k$, we define a set of 2D displacement $D = \{\mathbf{d}_k\}$ and each of them is added to the projection of $F^{(\mathbf{v}_k)}$: \begin{equation} \label{eq:projfacemodel} \mathbf{l}_k = \Pi_\mathbf{P}\big(F^{(\mathbf{v}_k)}\big) + \mathbf{d}_k, \end{equation} where $\Pi_\mathbf{P}(\cdot)$ denotes a perspective projection operation which is parameterized by a projection matrix $\mathbf{P}$. To recover these unknown face parameters from the video, we employ DDE~\cite{cao2014displaced}, a state-of-the-art real-time regression algorithm for facial tracking. DDE predicts a sextuple $\langle \mathbf{P}, \mathbf{u}; \mathbf{e}_t, \mathbf{R}_t, \mathbf{t}_t, D_t \rangle$ for each frame $t$ in the video. Note that $\mathbf{P}$ and $\mathbf{u}$ are invariant across all frames for the same actor and the same video camera during tracking, while the other unknowns change in different frames. The expression blendshapes $B = \{\mathbf{b}_k\}$ of the certain actor in the input video is constructed as: \begin{equation} \label{eq:expfacemodel} B = C \times_2 \mathbf{u}^T. \end{equation} As commonly assumed in blendshape models, $\mathbf{b}_0$ is 3D shape of the neutral face. We can further represent the face shape $V_t$ of the actor in the frame $t$ by: \begin{equation} \label{eq:shapefacemodel} V_t = \mathbf{b}_0 + \sum_{n=1}^{N_B - 1}(\mathbf{b}_n - \mathbf{b}_0) \cdot \hat{e}_t^{(n)} = \mathbf{b}_0 + E_t = I + E_t, \end{equation} where $\hat{\mathbf{e}}_t = [\hat{e}_t^{(1)},\dots,\hat{e}_t^{(n)}]$ is computed from the initially fitted expression coefficient vector $\mathbf{e}_t$ estimated by DDE. Intuitively, Eq.~\ref{eq:shapefacemodel} disentangles the actor's 3D face shape $V_t$ into the identity $I$ and expression $E_t$. For each frame $t$, we also extract $M_t$, the isomap~\cite{tenenbaum2000global} which contains pixel textures for the face model, and compute 2D landmarks $L_t$ according to Eq.~\ref{eq:projfacemodel}. At last, we get the final per-frame face performances which consist of six parameters $\langle I; E_t, \mathbf{R}_t, \mathbf{t}_t, L_t, M_t \rangle$. In the following steps, $I$, $E_t$ and $L_t$ are used for computing the deformed 3D face mesh; while $\mathbf{R}_t$, $\mathbf{t}_t$ and $M_t$ are employed to propagate the modifications throughout the entire video to generate the final result. \section{Sketch-based deformation transfer}\label{sec:approach:sketch} We present a robust sketch-based face editing framework to enable users to edit all possible face details once they have been marked with the corresponding vertices on the 3D face mesh. In this paper, we allow users to edit 68 face landmarks predefined by Cao et al.~\cite{cao2014displaced,huber2016multiresolution} for illustration as shown in Fig.~\ref{fig:sketch}(b). In order to apply user's editing intention from the input sketch, we need first map each stroke to a suitable part of the face, e.g., the contour of eyes or mouth, and then deform this part according to the hand-drawn stroke. \subsection{Sketch mapping}\label{sec:approach:sketch:mapping} Our target is to map each stroke to a landmark group in the 2D space (a collection of landmarks which represents a meaningful part of the face, e.g., the left eyebrow or the upper eyelid), and to remove unreasonable strokes from the result at the same time. The main challenge in this task is how to deal with ambiguous user inputs, and Fig.~\ref{fig:sketch}(d) shows an example. Previous methods solve this problem by only allowing users to edit the face with pre-defined curves~\cite{lau2009face,chang2006sketching,sucontphunt2008interactive} or draw strokes in pre-ordered regions~\cite{miranda2012sketch, nataneli2011bringing}. Instead, we introduce a robust mapping schema which enables users to draw strokes without certain constraints, while the only assumption we made here is that the stroke should be ``clean'', i.e., each stroke aims to edit just one target landmark group. \begin{figure}[!t] \centering \includegraphics[width=\linewidth]{fig3} \caption{Illustration of the face landmarks. (a) the original frame; (b) the 68 landmarks predefined by Huber et al.~\cite{huber2016multiresolution}; (c) the original landmarks to be edited; (d) the sketch input (the second stroke is ambiguous since it can be mapped to either the eyebrow or the upper eyelid); (e) key points extracted from the strokes; (f) the final modified landmarks.} \label{fig:sketch} \end{figure} We notice users always draw a sketch in a meaningful order encoding their editing intention. Landmark groups having a strong relation with each other, e.g., the upper and bottom eyelids of the same eye, trend to be drawn at the same time. Based on this observation, the input sketch is regarded as an ordered sequence of strokes and Hidden Markov Model~(HMM) is employed to formulate this problem. \emph{Note that our HMM-based algorithm leverages the order in which users draw strokes, for efficient matching with landmark groups. Prior works, e.g.,~\cite{kraevoy2009modeling} have not combined this order information with HMM.} It uses HMM to model the shape of this stroke to match mesh templates. Let $\{G_1, \dots, G_t\}$ be a set of landmark groups on the 2D image, and $\{S_1, \dots, S_t\}$ be the stroke sequence of the input sketch. We treat each landmark group $G$ as the hidden state while a stroke $S$ is the observation of HMM, and our target is to find the most probable sequence of hidden states (landmark groups) for a given observation sequence (strokes): \begin{equation} \label{eq:sketch:mapping:seq} \mathop{\arg\max}_{G_{1:t}}P(G_{1:t}|S_{1:t}). \end{equation} The initial probabilities $P(G_0)$ for each hidden state is set to $1/N_G$. And $P(S_t|G_t)$ is the emission probability which measures the probability of each stroke belonging to a certain landmark group. We define $P(S_t|G_t)$ as: \begin{equation} P(S_t|G_t) = \left\{\begin{array}{l@{\qquad}l} \exp(-\frac{d(S_t, G_t)^2}{2\sigma^2}), & \textrm{if } d(S_t, G_t) \leq 3\sigma \\[\jot] 0, & \textrm{otherwise} \end{array}\right. \label{eq:sketch:mapping:emission} \end{equation} where $d(S_t, G_t)$ measures the difference between $S_t$ and $G_t$, which is the average Euclidean distance of their corresponding key points. Note that if $S_t$ has a high distance with all landmark groups (which means that this stroke is invalid), $S_t$ will not be matched with any $G_t$ and excluded from the result. $P(G_t|G_{t - 1})$ is the transition matrix which expresses the probability of moving from one hidden state to another. Transition probabilities between two landmark groups with a strong relation are assigned a higher value, i.e., twice as large as the other values, which makes it easier for corresponding strokes to be mapped together and helps when strokes are ambiguous. Given these parameters, the most probable sequence problem can be solved by the Viterbi Algorithm~\cite{viterbi1967error}. \subsection{Landmark deformation}\label{sec:approach:sketch:fitting} For each input stroke $S$ and its mapped landmark group $G$, we need to deform $G$ into $\hat{G}$ according to $S$, where $\hat{G}$ is the final modified landmark group. This is achieved by solving an energy minimization function that leverages the position of the input stroke (editing intention of the user) and the original shape of the landmark group. Let $\mathbf{g}_i$ and $\hat{\mathbf{g}}_i$ be the coordinates of the $i$-th landmark in $G$ and $\hat{G}$, respectively, and $\mathbf{s}_i$ be the corresponding $i$-th key point in $S$. The energy function is formulated as: \begin{equation} \label{eq:sketch:fitting:target} \mathcal{E} = \sum_{i = 1}^{N_G}||\hat{\mathbf{g}}_i - \mathbf{s}_i||^2 + \sum_{i = 1}^{N_G - 1}(1 - \cos(\hat{\gamma}_i - \gamma_i)), \end{equation} where $\gamma_i$ is the included angle of $\mathbf{g}_i$ and $\mathbf{g}_{i + 1}$; $\hat{\gamma}_i$ is that of $\hat{\mathbf{g}}_i$ and $\hat{\mathbf{g}}_{i + 1}$. To minimize this target function, we use the value of $||\mathbf{g}_{i + 1} - \mathbf{g}_{i}||$ to approximate $||\hat{\mathbf{g}}_{i + 1} - \hat{\mathbf{g}}_{i}||$, and we solve it with gradient descent algorithm. Intuitively, the first term of Eq.~\ref{eq:sketch:fitting:target} is the position constrain. It measures the distance between the modified landmark group and the input stroke, which moves the landmarks of this landmark group to their expected positions. Meanwhile, the second term of Eq.~\ref{eq:sketch:fitting:target} represents the shape prior. It is employed to maintain the original shape information of this landmark group after the modification, which helps to prevent generating unrealistic results due to noises carried by the input sketch. \section{Facial identity deformation transfer}\label{sec:approach:transfer} The final modified facial identity $\hat{I}$ is calculated from the target identity $I$ by transferring 2D deformations (a set of modified 2D face landmarks) to $I$ while removing the influence of expressions. Our strategy is first to estimate the 3D positions of 2D landmarks with reconstructed face model parameters as shown in Section~\ref{sec:overview}. Then a robust deformation transfer technique is proposed to determine the modified identity according to these 3D landmark positions as well as the expression. It is achieved by two steps: depth estimation for key points in 2D and solving an extended target function of~\cite{sumner2004deformation}. \emph{The main contribution of our identity deformation transfer algorithm is that we perform the deformation transfer between different feature spaces: from 2D to 3D; while prior work~\cite{sumner2004deformation, botsch2006deformation, baran2009semantic} performs the transfer in the same 3D space.} To estimate the 3D position $(\hat{x}_i, \hat{y}_i, \hat{z}_i)$ of a certain modified landmark $\hat{\mathbf{l}}_i$ whose 2D coordinate in this frame is $(\hat{x}_i, \hat{y}_i)$, we need to reconstruct $\hat{z}_i$ (the depth of this point towards the screen plane). However, the depth value is unknown since the deformation is made in 2D space. Notice that when the front face is right against the screen plane, i.e., the face plane and screen plane are parallel to each other, points on the face mesh will have similar depth value (the delta of the maximum and minimum depth value of all the points will reach its minimum), especially for the landmark whose normal vector is perpendicular to the screen plane. Based on this observation, we estimate the depth $\hat{z}_i$ of the modified landmark $\hat{\mathbf{l}}_i$ with the original depth $z_i$ of $\mathbf{l}_i$, which can be computed directly according to Eq.~\ref{eq:fullfacemodel}. This estimation can avoid generating unrealistic facial identity effectively. However, as a result, our approach is able to achieve the best performance if the editing is applied on the frame when the actor is facing the camera. Then we can get the modified facial identity by further transferring deformations (a set of modified 3D landmark coordinates computed above) to the target identity. Our approach is inspired by the correspondence system in~\cite{sumner2004deformation}, but developed in the context of our deformation framework. Let $V = \{\mathbf{v}_1, \dots, \mathbf{v}_n\}$ and $\hat{V} = \{\hat{\mathbf{v}}_1, \dots, \hat{\mathbf{v}}_n\}$ be the $n$ vertices of the original and modified facial identity. Note that here $V$ is equal to the facial identity $I$ when we remove the effect of the facial expression $E_t$ according to Eq.~\ref{eq:shapefacemodel}. We let $Q = \{\mathbf{Q}_i\}$ be a set of mesh triangles and $\mathbf{Q}_i = \hat{\mathbf{V}}_i(\mathbf{V}_i)^{-1}$ be the affine transformations that define the deformation for the $i$-th triangle, where $\hat{\mathbf{V}}_i$ and $\mathbf{V}_i$ are the corresponding vertex matrix~\cite{sumner2004deformation} calculated from $V$ and $\hat{V}$, respectively. The vertex positions of the modified identity are computed by minimize the distance between the original and modified 3D landmarks after removing the influence of facial expression. We define the landmark term as: \begin{equation} \label{eq:transfer:landmark} \mathcal{E}_{l} = \frac{1}{2}\sum_{i = 1}^{m}||\hat{\mathbf{v}}_i - \tilde{\mathbf{l}}_i||^2, \end{equation} where $m$ is the number of modified 3D landmarks, and $\tilde{\mathbf{l}}_i = \hat{\mathbf{l}}_i + E_t^{(\mathbf{v}_i)}$ is the coordinate of the $i$-th modified landmark after merging the influence of the facial expression $E_t$. Then the whole energy function is defined as: \begin{equation} \label{eq:transfer:full} \begin{array}{r@{\ }l} \mathcal{E}(\hat{\mathbf{v}}_1, \dots, \hat{\mathbf{v}}_n) &= w_s\mathcal{E}_s + w_r\mathcal{E}_r + w_l\mathcal{E}_l \\[\jot] \textrm{s.t.} \ \hat{\mathbf{v}}_i &= \mathbf{b}_k, \mathbf{b}_k \in \mathcal{F}(V), \end{array} \end{equation} where $w_*$ controls the effect of each term, and $w_r = 0.1$ while the other two are set to $1$ experimentally; $\mathbf{b}_k$ in Eq.~\ref{eq:transfer:full} is a set of points on the face boundary $\mathcal{F}(V)$. $\mathcal{E}_s$ is a smooth term to make the transformations for the set of adjacent triangles $\mathcal{A}$ be similar with each other~\cite{sumner2004deformation}: \begin{equation} \label{eq:transfer:smooth} \mathcal{E}_s(\hat{\mathbf{v}}_1, \dots, \hat{\mathbf{v}}_n) = \frac{1}{2}\sum_{i = 1}^{|Q|}\sum_{j \in \mathcal{A}(i)}||\mathbf{Q}_i - \mathbf{Q}_j||^2, \end{equation} and $\mathcal{E}_r$ maintains the original triangle shapes which are not affected by the deformation in order to prevent generating a drastic change in the shape of the target identity~\cite{sumner2004deformation}: \begin{equation} \label{eq:transfer:identity} \mathcal{E}_r(\hat{\mathbf{v}}_1, \dots, \hat{\mathbf{v}}_n) = \frac{1}{2}\sum_{i = 1}^{|Q|}||\mathbf{Q}_i - \mathbf{I}||^2, \end{equation} where $\mathbf{I}$ is the identity matrix. The whole energy function can be minimized by solving a system of linear equations. During this procedure, the boundary points of the deformed mesh will match exactly since they are specified as constraints to keep the original face contour, the local deformations are transferred by the landmark term, and the rest of the mesh will be carried along by the smoothness and identity terms. \section{Contour-based face model refinement}\label{sec:approach:refinement} Since the quality of a 3D face model computed from the identity deformation transfer highly influences our final result, we implement an interface for artists to directly edit the deformed 3D face model for refinement. To ensure fluency and simplicity of user interaction during this process, we present a contour-based editing schema. Note that this refinement step can be skipped if a favorable result has already been achieved during previous steps or users have no experience in 3D model editing. \begin{figure}[!t] \centering \includegraphics[width=\linewidth]{fig5a} \caption{We provide a contour-based mode for model refinement. Given a 3D face mesh (a), a hybrid line rendering method is utilized to render the contours from different view points (b). Users are allowed to edit these contours with sketches as shown in (c).} \label{fig:refinement} \end{figure} At the beginning of this refinement stage, selected feature contours on the deformed 3D face model are projected onto the 2D canvas to produce an initial sketch-like contour map. Then the user can drag or rotate it to observe the model from different views. If some of the projected lines are not satisfactory, the user can redraw them with new sketches. In this refinement phase, these redrawn lines are matched more closely with user inputs by adding them as new constraints for the 3D face model. Compared with traditional interactive 3D mesh editing softwares such as MAYA or 3DS-MAX, which always take a long time for a skilled artist to create a decent 3D face model, our contour-based approach is much simpler and faster. Moreover, this contour-based refinement interface also ensures a smooth user experience during the whole editing process for not involving different softwares or interactive modes other than hand-drawn sketches. \emph{Contour rendering.} Recent studies~\cite{wang2014anewsketch, zhao2015learning} present a hybrid line rendering method to generate 2D contour maps for 3D shapes and obtain good performance. In this paper, we adopt this approach which combines predefined exterior silhouettes, occluding contours, suggestive contours~\cite{decarlo2003suggestive} and shape boundaries to generate the final contour map from a given view point for further editing. Examples are shown in Fig.~\ref{fig:refinement}. Note that the preprocess steps in~\cite{zitnick2014edge} are also applied to reduce the noise in the initial map. \emph{3D model refinement.} Users are allowed to rotate the input 3D model to edit its 2D contour map from different view points. Once an unsatisfactory line in the map is found, users can modify it by marking a certain region around to erase it first, and draw a new relevant sketch. After sampling the key points from them, the edited line is then calculated by the same algorithm as described in Section~\ref{sec:approach:sketch:fitting}. We treat the key points in the edited line as new landmark constraints, and the identity deformation transfer in Section~\ref{sec:approach:transfer} is employed to update the face model. Users are able to repeat these steps until a favorable 3D facial identity $\hat{I}$ is achieved. Note that since more constraints are added, we increase the weights of $w_s$ and $w_r$ in Eq.~\ref{eq:transfer:full} at this stage so as to prevent drastic deformations in the final 3D shape $\hat{I}$. \section{Texture re-rendering and smoothing}\label{sec:approach:optimization} Propagating deformations to the whole video is achieved by computing modified $\hat{F}_t$ with $\hat{I}$ for each frame $t$ according to Eq.~\ref{eq:fullfacemodel} and~\ref{eq:shapefacemodel}, and then re-rendering the extracted face texture isomap $M_t$ back to the frame with $\hat{F}_t$. For a high-fidelity result, the background should be warped as well, so that both sides of the face boundary deform coherently. We also apply the median filter on the boundary to blur the difference between the face and its surrounding background. \begin{figure}[!t] \centering \includegraphics[width=\linewidth]{fig5} \caption{We use the refined isomap (the second row) to remove artifacts. From left to right: the original frame and the sketch input, texture isomap, the modified output, detailed view of the output.} \label{fig:isomap} \end{figure} Note that there might be some ``holes'' (invisible pixels) on the isomap $M_t$ due to the occlusion. However, if modifications are applied on the boundary of the 3D facial identity, these ``holes'' will lead to artifacts after smoothing since they might be visible as a result of the deformation. We notice that these missing pixels may be seen from other frames (since the actor always have different poses in different frames), which can be employed to fill ``holes'' in one certain frame. Therefore, we utilize a refined isomap $\hat{M}_t$ to synthesize the modified face in each frame. To obtain the refined isomap $\hat{M}_t$, we first compute a mean isomap $\bar{M}$ from all frames in the given video. And then for the isomap $M_t$ of each frame $t$, we use this mean isomap to fill the ``holes'' in it. We obtain the final refined isomap $\hat{M}_t$ for each frame after applying a Gaussian filter on it to smooth the boundaries. Finally, the artifacts on the boundary can be removed by re-rendering the face with $\hat{M}_t$ as shown in Fig.~\ref{fig:isomap}. To handle missing background due to the facial deformation, one simple strategy is building a background model (background as in non-face and non-body) over successive frames and then replacing missing background pixels with newly revealed ones. However, this approach depends on an accurate background segmentation algorithm. In this paper, we solve it in a more robust warping-based manner. Firstly, we employ SIFT~\cite{lowe2004distinctive} to detect the static key points from the starting frame; optical flow is calculated throughout the whole video in order to track the dynamic key points of the background. Then we construct a set of control points for each frame by combining the static and dynamic points. Finally, we use Moving Least Square~\cite{schaefer2006image} algorithm to warp the background pixels based on detected control points. This optimization strategy can effectively avoid shaking for static objects in the background, while maintain the consistency of the face boundary concurrently. \section{Results}\label{sec:results} We evaluate the performance of our approach on different Youtube videos at a resolution of $1280 \times 720$. The videos show different actors with different scenes captured from varying camera angles; we choose one frame for each video and provide a corresponding sketch of the actor's face as the input. In our experiments, users are allowed to edit 68 face landmarks marked by Huber et al.~\cite{huber2016multiresolution} by sketch for demonstration. Example results created by amateurs using our sketching interface are shown in Figs.~\ref{fig:teaser} and \ref{fig:result}. \begin{figure*}[!t] \centering \includegraphics[width=\linewidth]{fig9b} \caption{More examples of our sketching system. In each example, the first column includes the cartoon image for reference (top) and the sketch input (bottom). Starting from the second column, the original (top) and edited frames (bottom) in different videos are shown.} \label{fig:result} \end{figure*} \subsection{Runtime performance}\label{sec:results:runtime} We evaluate the runtime performance of our methods by computing the average runtime of each step with respect to different video resolutions. Within the step of texture re-rendering, an isomap with $256 \times 256$ resolution is computed for 360P and 480P videos; $512 \times 512$ resolution is configured for HD videos. Our approach runs on a desktop computer with an Intel 4.00GHz Core i7-6700K CPU. Table~\ref{tbl:runtime} shows the result. The texture re-rendering and background optimization is the slowest components, while others run in a matter of milliseconds. Note that our framework can achieve real-time performance ($\geq 25$ FPS) for standard resolution videos without background optimization, which is compatible with streaming inputs. Moreover, our method does not rely on a power GPU and can be extended to light-weight devices. \begin{table}[!t] \renewcommand{\arraystretch}{1.2} \caption{\label{tbl:runtime}Average runtime of our framework. The average runtime for one frame of each step in our method is computed with respect to different video resolutions. The program runs with parallel optimization.} \centering \begin{tabular}{@{}lcccc@{}} \toprule Video Quality & 360P & 480P & 720P & 1080P \\ \midrule Model Fitting & 11.9ms & 12.1ms & 13.6ms & 14.3ms \\ Sketch Matching & 1.4ms & 1.4ms & 1.8ms & 2.1ms \\ Deform Transfer & 3.1ms & 3.1ms & 3.4ms & 3.5ms \\ Rendering & 16.6ms & 20.5ms & 82.6ms & 98.6ms \\ BG Opt. & 18.8ms & 21.6ms & 28.1ms & 34.2ms \\ FPS & \textbf{29.3Hz} & \textbf{26.9Hz} & 9.7Hz & 8.4Hz \\ FPS w/ BG Opt. & 19.2Hz & 16.8Hz & 7.6Hz & 6.2Hz \\ \bottomrule \end{tabular} \end{table} \subsection{User study}\label{sec:results:userstudy} In this section, the user study is conducted to evaluate the user experience as well as the video results achieved by our framework. We invited 20 people, 10 men and 10 women. All participants are graduate students aged from 23 to 25, and 3 of them major in arts while the others come from statistics and computer science departments. In addition, 4 of them have background in arts and 3D animation modeling (with 3-year experiences in MAYA and 3DS-MAX as well), while the others are amateur users that have limited or no knowledge about drawing and 3D editing. Before the following sessions, a 10-minute tutorial as well as 20 minutes for practice were given to guarantee that every participant knows how to use our interface. Another 40 minutes are employed to introduce MAYA to amateur users. In our evaluation, we use cartoon images as reference to compare our results with users' true editing intention in an effective way. Users are asked to edit the face to match a cartoon image using our system. However, they are free to make additional modifications as they wish. Therefore, the results may contain some unrelated user inputs. \subsubsection{User experience of interfaces} The goal of the first session is evaluating the user experience of our sketched-based interface. To guide users' editing intention, each participant was given a Youtube video together with a 2D cartoon face image as reference, and asked to edit the facial appearance of the actor in this video to match at least one prominent facial character in the cartoon image using our system. Note that the created facial identity was not required to strictly follow the reference image and differences were allowed. All participants should complete 5 tasks in this session with different pairs of videos and reference images as illustrated in Figs.~\ref{fig:teaser} and \ref{fig:result}. We also implemented another deformation-based user interface, where 3D face models were first calculated according to Section~\ref{sec:overview}; then MAYA was utilized as the editing tool instead of sketches, and final results were directly generated by the modified models as Section~\ref{sec:approach:optimization}. In this deformation-based interface, users are only allowed to edit/modify the positions of mesh vertices with MAYA. This constraint is made for fair comparison, since our system deforms the mesh in the same way. All participants were asked to repeat the same tasks with this interface. For amateur users, they could stop anytime if it was too difficult for them to continue while the artists were required to finish all tasks. To verify the effectiveness of our contour-based refinement mode in Section~\ref{sec:approach:refinement}, the amateur users were recommended to try it after the initial sketching, and the artists should use it for all tasks. At the end of this session, we asked the participants which system is easier to use. Among all the 16 amateur users, 12 of them finished editing tasks with the deformation-based interface while the others gave up halfway. Instead, all participants completed the same tasks with our sketch-based interface. Moreover, 10 of the amateurs used our contour-based refinement mode; the others chose to skip it for favorable results had already been achieved in the previous steps. In terms of user experience, all participants agree that our system is simpler to use and yields decent results. Those who tried our refinement mode agree that it was very helpful, and the four professional artists agree that it is more efficient than traditional deformation-based software. \subsubsection{Comparison on mesh deformation} \begin{figure}[!t] \centering \includegraphics[width=\linewidth]{fig10d} \caption{A gallery of results created using three different editing interface settings. From top to bottom, each row shows the fitted 3D face model and the deformed models corresponding to the cases as shown in Fig.~\ref{fig:teaser} and Fig.~\ref{fig:result}, respectively. Note that each 3D face model is fitted from the actor in the first frame of the video.} \label{fig:deformation} \end{figure} Fig.~\ref{fig:deformation} shows a gallery of deformed 3D face models, which are corresponding to the actors of the cases as shown in Figs.~\ref{fig:teaser} and \ref{fig:result}, with three different editing interface settings. They were created using our sketch-based interface by amateurs~(Ours), by artists with the deformation-based interface~(MAYA*) and our sketch-based interface with the refinement mode~(Ours*+RF), respectively. Detailed timings are shown in Table~\ref{tbl:usertime}. In addition, we also report the timing for editing using the deformation-based interface by amateurs~(MAYA). As shown in Table~\ref{tbl:usertime}, an amateur on average only spent 3.6 minutes to complete the task via our system, which is 3 times faster than using the interface based on MAYA. Meanwhile, our sketching interface also doubled the editing efficiency for artists. In Fig.~\ref{fig:deformation}, our system is able to achieve results comparable with the ones created using MAYA by artists, while amateurs managed to perform reasonable mesh deformations with our interface. \begin{table}[t] \renewcommand{\arraystretch}{1.2} \caption{\label{tbl:usertime}Average timings for editing with different interfaces.} \centering \begin{tabular}{@{}lllll@{}} \toprule Interface & MAYA & Ours & MAYA* & Ours*+RF \\ \midrule Time (m) & $12.5 \pm 1.8$ & $3.6 \pm 0.3$ & $9.5 \pm 1.4$ & $4.1 \pm 0.8$ \\ \bottomrule \end{tabular} \end{table} \subsubsection{Evaluation on visual results} To further evaluate the visual results generated by our sketch-based face editing system, we also designed the second session following the editing session. In this session, results in the previous session were selected into 4 groups: videos edited by amateurs using the deformation-based interface or our sketch-based interface, and ones generated by artists using the deformation-based interface or our sketch-based interface with the refinement mode. For fair comparison, we manually chose the best result in each group for every task in the editing session. After that, all these videos (5 tasks done by 4 groups, respectively) together with their corresponding reference cartoon images were presented to additional 30 students who did not participated in the editing session. Given a reference image (displayed in random order), every participant was asked to look at the corresponding videos from the 4 different groups, and then rank them by choosing the one that better matches the cartoon. The final results are shown in Fig.~\ref{fig:userstudy}. \begin{figure}[!t] \centering \includegraphics[width=\linewidth]{fig8b} \caption{Voting results from the 1st to 4th rank of videos created with 4 different interface settings. We also report the average ranking of each group following the group name.} \label{fig:userstudy} \end{figure} We can find that videos created by amateurs using our sketching interface obtain higher average rank than ones using deformation-based interface. A T-Test was also conducted to compare rankings obtained with these two different settings. There was a significant difference in the rankings using the deformation-based interface ($M = 3.00$, $SD = 1.17$) and sketch-based interface ($M = 2.40$, $SD = 1.08$); $t(58) = 2.19$, $p = 0.03$. It demonstrates that our framework does improve the results for amateurs. Notice that different results created by artists and amateurs with our sketching interface have similar average ranks (2.33 and 2.40, respectively). It suggests that, with the help of our sketch-based interface, amateurs manage to create comparable results to a certain extent compared with artists. Another observation is that results have similar ranks when artists use our interface and MAYA, which agrees that artists can produce competitive results with our interface compared with MAYA. \subsection{Evaluation of 3D-based editing} We argue that the 3D face model and deformation transfer algorithms are the keys to ensure the consistency as well as fidelity of the editing results. To evaluate the effectiveness of our 3D-based editing system, we implemented a 2D-warping baseline for comparison. We use the results of deformed 2D face landmarks in Section~\ref{sec:approach:sketch:fitting} as the inputs for this baseline. Then the face is deformed by Moving Least Square~\cite{schaefer2006image} in the 2D space. All participants of the user study are invited to try this 2D-warping baseline, and 85\% of them prefer our system over the baseline. For quantitative comparison, we measure the content consistency of an editing video using the Content Distance metric introduced in~\cite{tulyakov2017mocogan,zhao2018learning}. We employed OpenFace~\cite{amos2016openface}, which outperforms human performance in the face recognition task, for measuring video content consistency. A feature vector is produced by OpenFace for each frame in a given video. The distance is then calculated by the pairwise L2 distance of the feature vectors. To measure the quality of an edited video, we compute the distances between each frame and the first frame. A method that owns a lower distance curve handles changes in rotations or expressions better. \begin{figure}[!t] \centering \includegraphics[width=\linewidth]{fig9} \caption{The Content Distance curves of our 3D-based editing system and the 2D-warping baseline. Our system has a lower curve and a smaller gap when handling changes in head rotations and facial expressions.} \label{fig:3dediting} \end{figure} We collected all the edited results in the user study for evaluation. To highlight the performance, the videos are manually aligned so that a noticeable change in head rotation or expression occurs around the 25th frame. Using the deformed 2D landmarks as the inputs, we compute the distance curves for the edited videos generated by our 3D-editing system and the 2D-warping baseline for comparison. The results are given in Fig.~\ref{fig:3dediting}. From the figure, we find that the content of the videos generated by our system is more consistent: ours achieves a lower distance curve. More importantly, our system is able to handle rotation or expression changes better than the 2D-warping baseline, since there is a smaller gap in our distance curve. Therefore, our system offers a 3D solution which substantially outperforms the 2D-warping approach. \subsection{Evaluation of sketch matching} To evaluate the performance of sketch matching, we compare our method with a geometry-based algorithm described in~\cite{miranda2012sketch} and another learning-based approach~\cite{nataneli2011bringing} which both achieve state-of-the-art performance. We use the stroke similarity measurement described in them to match strokes with landmarks, respectively as their corresponding approximate implementation. Detailed results are shown in Fig.~\ref{fig:results:sketch}. We can find that all the methods produce competitive results with clear user inputs. However, as shown in the second case of Fig.~\ref{fig:results:sketch}, \cite{miranda2012sketch} is sensitive to noises since it fits landmarks to strokes via only geometry features; Nataneli et al.~\cite{nataneli2011bringing} is able to handle this case due to pre-learned prior knowledge; our method can remove noises by taking the original appearance of the landmark group (the shape prior term in Eq.~\ref{eq:sketch:fitting:target}) into consideration. For ambiguous inputs as shown in the third case of Fig.~\ref{fig:results:sketch}, both~\cite{miranda2012sketch} and~\cite{nataneli2011bringing} map the second stroke to eyebrow incorrectly; we can successfully match it with the upper eyelid since the HMM we employed trends to match the upper and bottom eyelids at the same time during optimization. \begin{figure}[!t] \centering \includegraphics[width=\linewidth]{fig6} \caption{Comparison of our sketch matching to the approximate implementation of Miranda et al.~\cite{miranda2012sketch} and Nataneli et al.~\cite{nataneli2011bringing}. From top to bottom: two individual strokes, one stroke with noises, and a group of strokes with ambiguity (different colors represent different matched landmark group pairs). Our method is able to achieve reasonable results for all these cases.} \label{fig:results:sketch} \end{figure} \section{Conclusions and discussion}\label{sec:conclusion} This paper presents the first sketch-based face editing framework for monocular videos. In an attempt to recognize the user's editing intentions from hand-drawn sketch, a robust sketch matching schema is introduced to convert them to a set of face landmark deformations. Furthermore, a novel facial identity deformation transfer algorithm is employed to propagate these changes throughout the whole video, while consistency and fidelity are maintained. Without background optimization, our framework is able to achieve real-time performance for streaming inputs with standard definition. Overall, we believe our framework will contribute to many new and exciting applications in the field of face editing on light-weight devices, e.g., a tablet PC and mobile phone. \emph{Limitations.} There are some notable limitations to our work. One limitation of our sketch-mapping algorithm is that amateur users may not produce correctly ordered sketches in their first try. We make use of HMM to model the relation of different strokes, and users have to redraw a part of strokes with the incorrect order. However, this is mitigated by the fact that on average, the complexity and number of sketches is small (less than 6 strokes in most cases), and our interactive system supports rapid iteration and refinement of strokes. Another limitation is that we only allow users to edit a few landmarks on a face. This is due to the limitation of the morphable models we employed to construct the 3D face: local geometric details such as wrinkles cannot be represented. Moreover, since our method relies on a fixed z-value for more accurate depth estimation, users have to draw sketches on a front face to achieve the best performance. \emph{Future work.} In the future, we will consider implementing a stereo editing interface to enhance the user experience and enable users to edit faces from different view points as well. To alleviate the problem of limited editing ability, we propose to utilize Generative Adversarial Network~(GAN)~\cite{ian2014generative} to make pixel-to-pixel prediction~\cite{zhao2018learning,isola2017image,tian2018cr} directly from sketches instead of using morphable models. Moreover, allowing users to edit more facial details from sketches is another future direction. We expect other interesting applications for the framework we have shown here. One can imagine coupling this work with an artist to create a cartoon talking avatar starting from a video. \section*{Acknowledgments} The authors would like to thank the reviewers for their constructive comments and the participants of our user study for their precious time. This work was funded in part by grant BAAAFOSR-2013-0001 to Dimitris Metaxas. This work is also partly supported by NSF 1763523, 1747778, 1733843 and 1703883 Awards. Mubbasir Kapadia has been funded in part by NSF IIS-1703883, NSF S\&AS-1723869, and DARPA SocialSim-W911NF-17-C-0098. \bibliographystyle{cag-num-names}
{'timestamp': '2019-01-29T02:04:47', 'yymm': '1703', 'arxiv_id': '1703.08738', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08738'}
arxiv
\section*{Notations and Symbols} \addcontentsline{toc}{section}{Notations and Symbols} \textbf{General notations} \begin{longtable}{lp{13cm}} $\mathds{C}$ & {field of complex numbers} \\ $\mathds{R}$ & {field of real numbers} \\ $\mathds{C}_s$ & {stability domain (i.e., open left complex half-plane in continuous-time or open unit disk centered in the origin in discrete-time)}\\ $\partial\mathds{C}_s$ & {boundary of stability domain (i.e., extended imaginary axis with infinity included in continuous-time, or unit circle centered in the origin in discrete-time)} \\ $\overline{\mathds{C}}_s$ & {closure of $\mathds{C}_s$: $\overline{\mathds{C}}_s = \mathds{C}_s \cup \partial\mathds{C}_s$} \\ ${\mathds{C}}_u$ & {open instability domain: $\mathds{C}_u := \mathds{C} \setminus \overline{\mathds{C}}_s$} \\ $\overline{\mathds{C}}_u$ & {closure of ${\mathds{C}}_u$: $\overline{\mathds{C}}_u := \mathds{C}_u \cup \partial\mathds{C}_s$} \\ $\mathds{C}_g$ & {``good'' domain of $\mathds{C}$} \\ $\mathds{C}_b$ & {``bad'' domain of $\mathds{C}$: $\mathds{C}_b = \mathds{C} \setminus \mathds{C}_g$} \\ $s$ & {complex frequency variable in the Laplace transform: $s = \sigma+\mathrm{i}\omega$} \\ $z$ & {complex frequency variable in the Z-transform: $z = \mathrm{e}^{\,sT}$, $T$ -- sampling time} \\ $\lambda$ & {complex frequency variable: $\lambda = s$ in continuous-time or $\lambda = z$ in discrete-time} \\ $\bar\lambda$ & {complex conjugate of the complex number $\lambda$ } \\ $\mathds{R}(\lambda)$ & {set of rational matrices in indeterminate $\lambda$ with real coefficients } \\ $\mathds{R}(\lambda)^{p\times m}$ & {set of $p\times m$ rational matrices in indeterminate $\lambda$ with real coefficients} \\ $\delta(G(\lambda))$ & {McMillan degree of the rational matrix $G(\lambda)$} \\ $G^\sim(\lambda)$ & {Conjugate of $G(\lambda) \in \mathds{R}(\lambda)$: $G^\sim(s) = G^T(-s)$ in continuous-time and $G^\sim(z) = G^T(1/z)$ in discrete-time} \\ $\ell_2$ & {Banach-space of square-summable sequences} \\ $\mathcal{L}_2$ & {Lebesgue-space of square-integrable functions} \\ $\mathcal{L}_\infty$ & {Space of complex-valued functions bounded and analytic in ${\partial\mathds{C}}_s$} \\ $\mathcal{H}_\infty$ & {Hardy-space of complex-valued functions bounded and analytic in ${\mathds{C}}_u$} \\ $\|G\|_{2}$ & {$\mathcal{H}_2$- or $\mathcal{L}_2$-norm of the transfer function matrix $G(\lambda)$ or 2-norm of a matrix $G$} \\ $\|G\|_{\infty}$ & {$\mathcal{H}_\infty$- or $\mathcal{L}_\infty$-norm of the transfer function matrix $G(\lambda)$} \\ $\|G\|_{\infty/2}$ & {either the $\mathcal{H}_\infty$- or $\mathcal{H}_2$-norm of the transfer function matrix $G(\lambda)$} \\ $\|G\|_{\infty-}$ & {$\mathcal{H}_{\infty-}$-index of the transfer function matrix $G(\lambda)$} \\ $\|G\|_{\Omega -}$ & $\mathcal{H}_-$-index over a frequency domain $\Omega$ of the transfer function matrix $G(\lambda)$ \\ $\delta_\nu(G_1,G_2)$ & $\nu$-gap distance between the transfer function matrices $G_1(\lambda)$ and $G_2(\lambda)$ \\ $M^T$ & {transpose of the matrix $M$} \\ $M^{-1}$ & {inverse of the matrix $M$} \\ $M^{-L}$ & {left inverse of the matrix $M$} \\ $\overline\sigma(M)$ & {largest singular value of the matrix $M$} \\ $\underline\sigma(M)$ & {least singular value of the matrix $M$} \\ $\ker(M)$ & {kernel (or right nullspace) of the matrix $M$} \\ $\ker_L(G(\lambda))$ & {left kernel (or left nullspace) of $G(\lambda) \in \mathds{R}(\lambda)$} \\ $\ker_R(G(\lambda))$ & {right kernel (or right nullspace) of $G(\lambda) \in \mathds{R}(\lambda)$} \\ $\mathcal{R}(M)$ & {range (or image space) of the matrix $M$} \\ $I_n$ or $I$ & {identity matrix of order $n$ or of an order resulting from context} \\ $e_i$ & {the $i$-th column of the (known size) identity matrix } \\ $0_{m\times n}$ or $0$ & {zero matrix of size ${m\times n}$ or of a size resulting from context} \end{longtable} \newpage \noindent\textbf{Fault diagnosis related notations} \begin{longtable}{lp{13cm}} $y(t)$ & {measured output vector: $y(t) \in \mathds{R}^{p}$ } \\$\mathbf{y}(\lambda)$ & {Laplace- or $\mathcal{Z}$-transformed measured output vector} \\$u(t)$ & {control input vector: $u(t) \in \mathds{R}^{m_u}$ } \\$\mathbf{u}(\lambda)$ & {Laplace- or $\mathcal{Z}$-transformed control input vector} \\$d(t)$ & {disturbance input vector: $d(t) \in \mathds{R}^{m_d}$ } \\$\mathbf{d}(\lambda)$ & {Laplace- or $\mathcal{Z}$-transformed disturbance input vector} \\$w(t)$ & {noise input vector: $w(t) \in \mathds{R}^{m_w}$ } \\$\mathbf{w}(\lambda)$ & {Laplace- or $\mathcal{Z}$-transformed noise input vector} \\$f(t)$ & {fault input vector: $f(t) \in \mathds{R}^{m_f}$ } \\$\mathbf{f}(\lambda)$ & {Laplace- or $\mathcal{Z}$-transformed fault input vector} \\$x(t)$ & {state vector: $x(t) \in \mathds{R}^n$} \\$G_u(\lambda)$ & {transfer function matrix from $u$ to $y$} \\$G_d(\lambda)$ & {transfer function matrix from $d$ to $y$} \\$G_w(\lambda)$ & {transfer function matrix from $w$ to $y$} \\$G_f(\lambda)$ & {transfer function matrix from $f$ to $y$} \\$G_{f_j}(\lambda)$ & {transfer function matrix from the $j$-th fault input $f_j$ to $y$} \\$A$ & {system state matrix} \\$E$ & {system descriptor matrix} \\$B_u$, $B_d$, $B_w$, $B_f$ & {system input matrices from $u$, $d$, $w$, $f$} \\$C$ & {system output matrix} \\$D_u$, $D_d$, $D_w$, $D_f$ & {system feedthrough matrices from $u$, $d$, $w$, $f$} \\$r(t)$ & {residual vector: $r(t) \in \mathds{R}^{q}$} \\$\mathbf{r}(\lambda)$ & {Laplace- or $\mathcal{Z}$-transformed residual vector} \\$n_b$ & {number of components of residual vector $r$} \\$r^{(i)}(t)$ & {$i$-th residual vector component: $r^{(i)}(t) \in \mathds{R}^{q_i}$} \\$\mathbf{r}^{(i)}(\lambda)$ & {Laplace- or $\mathcal{Z}$-transformed $i$-th residual vector component} \\$Q(\lambda)$ & {transfer function matrix of the implementation form of the residual generator from $y$ and $u$ to $r$} \\$Q_y(\lambda)$ & {transfer function matrix of residual generator from $y$ to $r$} \\$Q_u(\lambda)$ & {transfer function matrix of residual generator from $u$ to $r$} \\$Q^{(i)}(\lambda)$ & {transfer function matrix of the implementation form of the $i$-th residual generator from $y$ and $u$ to $r^{(i)}$} \\$R(\lambda)$ & {transfer function matrix of the internal form of the residual generator from $u$, $d$, $w$ and $f$ to $r$} \\$R_u(\lambda)$ & {transfer function matrix from $u$ to $r$} \\$R_d(\lambda)$ & {transfer function matrix from $d$ to $r$} \\$R_w(\lambda)$ & {transfer function matrix from $w$ to $r$} \\$R_f(\lambda)$ & {transfer function matrix from $f$ to $r$} \\$R_{f_j}(\lambda)$ & {transfer function matrix from the $j$-th fault input $f_j$ to $r$} \\$R^{(i)}_{f_j}(\lambda)$ & {transfer function matrix from the $j$-th fault input $f_j$ to $r^{(i)}$} \\$S$ & {binary structure matrix} \\$S_{R_f}$ & {binary structure matrix corresponding to $R_f(\lambda)$} \\$M_r(\lambda)$ & {transfer function matrix of a reference model from $f$ to $r$} \\$\theta(t)$ & {residual evaluation vector} \\$\iota(t)$ & {binary decision vector} \\$\tau$, $\tau_i$ & {decision thresholds} \end{longtable} \noindent\textbf{Model detection related notations} \begin{longtable}{lp{13cm}} $N$ & {number of component models of the multiple model} \\$y(t)$ & {measured output vector: $y(t) \in \mathds{R}^{p}$ } \\$\mathbf{y}(\lambda)$ & {Laplace- or $\mathcal{Z}$-transformed measured output vector} \\$u(t)$ & {control input vector: $u(t) \in \mathds{R}^{m_u}$ } \\$\mathbf{u}(\lambda)$ & {Laplace- or $\mathcal{Z}$-transformed control input vector} \\$u^{(j)}(t)$ & {control input vector of $j$-th model: $u^{(j)}(t) := u(t) \in \mathds{R}^{m_u}$} \\$\mathbf{u}^{(j)}(\lambda)$ & {Laplace- or $\mathcal{Z}$-transformed control input vector of $j$-th model} \\$d^{(j)}(t)$ & {disturbance input vector of $j$-th model: $d^{(j)}(t) \in \mathds{R}^{m_d^{(j)}}$ } \\$\mathbf{d}^{(j)}(\lambda)$ & {Laplace- or $\mathcal{Z}$-transformed disturbance input vector of $j$-th model} \\$w^{(j)}(t)$ & {noise input vector of $j$-th model: $w^{(j)}(t) \in \mathds{R}^{m_w^{(j)}}$ } \\$\mathbf{w}^{(j)}(\lambda)$ & {Laplace- or $\mathcal{Z}$-transformed noise input vector of $j$-th model} \\$y^{(j)}(t)$ & {output vector of $j$-th model: $y^{(j)}(t) \in \mathds{R}^{p}$ } \\$\mathbf{y}^{(j)}(\lambda)$ & {Laplace- or $\mathcal{Z}$-transformed output vector of $j$-th model} \\$x^{(j)}(t)$ & {state vector of $j$-th model: $x^{(j)}(t) \in \mathds{R}^{n_i}$} \\$G_u^{(j)}(\lambda)$ & {transfer function matrix of $j$-th model from $u^{(j)}$ to $y^{(j)}$} \\$G_d^{(j)}(\lambda)$ & {transfer function matrix of $j$-th model from $d^{(j)}$ to $y^{(j)}$} \\$G_w^{(j)}(\lambda)$ & {transfer function matrix of $j$-th model from $w^{(j)}$ to $y^{(j)}$} \\$A^{(j)}$ & {system state matrix of $j$-th model } \\$E^{(j)}$ & {system descriptor matrix of $j$-th model } \\$B_u^{(j)}$, $B_d^{(j)}$, $B_w^{(j)}$ & {system input matrices of $j$-th model from $u^{(j)}\!$, $d^{(j)}\!$, $w^{(j)}$} \\$C^{(j)}$ & {system output matrix of $j$-th model } \\$D_u^{(j)}$, $D_d^{(j)}$, $D_w^{(j)}$ & {system feedthrough matrices of $j$-th model from $u^{(j)}\!$, $d^{(j)}\!$, $w^{(j)}$} \\$r^{(i)}(t)$ & {$i$-th residual vector component: $r^{(i)}(t) \in \mathds{R}^{q_i}$} \\$\mathbf{r}^{(i)}(\lambda)$ & {Laplace- or $\mathcal{Z}$-transformed $i$-th residual vector component} \\$r(t)$ & {overall residual vector: $r(t) \in \mathds{R}^{q}$, $q = \sum_{i=1}^N q_i$} \\$\mathbf{r}(\lambda)$ & {Laplace- or $\mathcal{Z}$-transformed overall residual vector} \\$Q^{(i)}(\lambda)$ & {transfer function matrix of the implementation form of the $i$-th residual generator from $y$ and $u$ to $r^{(i)}$} \\$Q_y^{(i)}(\lambda)$ & {transfer function matrix of residual generator from $y$ to $r^{(i)}$} \\$Q_u^{(i)}(\lambda)$ & {transfer function matrix of residual generator from $u$ to $r^{(i)}$} \\$Q(\lambda)$ & {transfer function matrix of the implementation form of the overall residual generator from $y$ and $u$ to $r$} \\$R^{(i,j)}(\lambda)$ & {the transfer function matrix of the internal form of the overall residual generator from $(u^{(j)}\!, d^{(j)}\!, w^{(j)})$ to $r^{(i)}$} \\$R_u^{(i,j)}(\lambda)$ & {the transfer function matrix of the internal form of the overall residual generator from $u^{(j)}$ to $r^{(i)}$} \\$R_d^{(i,j)}(\lambda)$ & {the transfer function matrix of the internal form of the overall residual generator from $d^{(j)}$ to $r^{(i)}$} \\$R_w^{(i,j)}(\lambda)$ & {the transfer function matrix of the internal form of the overall residual generator from $w^{(j)}$ to $r^{(i)}$} \\$\theta(t)$ & {$N$-dimensional residual evaluation vector} \\$\iota(t)$ & {$N$-dimensional binary decision vector} \\$\tau_i$ & {decision threshold for $i$-th component of the residual vector} \end{longtable} \newpage \section*{Acronyms} \addcontentsline{toc}{section}{Acronyms} \begin{tabular}{lp{13cm}} AFDP & Approximate fault detection problem\\ AFDIP & Approximate fault detection and isolation problem\\ AMDP & Approximate model detection problem\\ AMMP & Approximate model matching problem\\ EFDP & Exact fault detection problem\\ EFEP & Exact fault estimation problem\\ EFDIP & Exact fault detection and isolation problem\\ EMDP & Exact model detection problem\\ EMMP & Exact model matching problem\\ FDD & Fault detection and diagnosis\\ FDI & Fault detection and isolation\\ LTI & Linear time-invariant\\ LFT & Linear fractional transformation\\ LPV & Linear parameter-varying\\ MIMO & Multiple-input multiple-output\\ MMP & Model-matching problem\\ TFM & Transfer function matrix \end{tabular} \newpage \section{Introduction}\label{sec:intro} The {\sc Fault Detection and Isolation Tools} (\textbf{FDITOOLS}) is a collection of {MATLAB} functions for the analysis and solution of fault detection problems. \textbf{FDITOOLS} supports various synthesis approaches of linear residual generation filters for continuous- or discrete-time linear systems. The underlying synthesis techniques rely on reliable numerical algorithms developed by the author and described in the Chapters 5, 6 and 7 of the author's book \cite{Varg17}: \\ \begin{tabular}{l}Andreas Varga, \emph{Solving Fault Diagnosis Problems - Linear Synthesis Techniques}, \\ vol. 84 of Studies in Systems, Decision and Control, Springer International Publishing, \\ xxviii+394, 2017. \end{tabular}\\ The functions of the \textbf{FDITOOLS} collection rely on the \emph{Control System Toolbox} \cite{MLCO15} and the \emph{Descriptor System Tools} (\textbf{DSTOOLS}) V0.71 \cite{Varg17a}. The current release of \textbf{FDITOOLS} is version V1.0, dated November 30, 2018. \textbf{FDITOOLS} is distributed as a free software via the Bitbucket repository.\footnote{\url{https://bitbucket.org/DSVarga/fditools}} The codes have been developed under MATLAB 2015b and have been also tested with MATLAB 2016a through 2018b. To use the functions of \textbf{FDITOOLS}, the \emph{Control System Toolbox} and the \textbf{DSTOOLS} collection must be installed in MATLAB running under 64-bit Windows 7, 8, 8.1 or 10. This document describes version V1.0 of the \textbf{FDITOOLS} collection. This version covers all synthesis procedures described in the book \cite{Varg17} and, additionally, includes a comprehensive collection of analysis functions, as well as functions for an easy setup of synthesis models. The book \cite{Varg17} represents an important complementary documentation for the \textbf{FDITOOLS} collection: it describes the mathematical background of solving synthesis problems of fault detection and model detection filters and gives detailed descriptions of the underlying synthesis procedures. Additionally, the M-files of the functions are self-documenting and a detailed documentation can be obtained online by typing help with the M-file name. Please cite \textbf{FDITOOLS} as follows: \\ \begin{tabular}{l} A. Varga. FDITOOLS -- The Fault Detection and Isolation Tools for MATLAB, 2018. \\ \url{https://sites.google.com/site/andreasvargacontact/home/software/fditools}. \end{tabular}\\ The implementation of the functions included in the \textbf{FDITOOLS} collection follows several principles, which have been consequently enforced when implementing these functions. These principles are listed below and partly consists of the requirements for robust software implementation, but also include several requirements which are specific to the field of fault detection: \begin{itemize} \item \emph{Using general, numerically reliable and computationally efficient numerical approaches as basis for the implementation of all computational functions, to guarantee the solvability of problems under the most general existence conditions of the solutions.} Consequently, the implemented methods provide a solution whenever a solution exists. These methods are extensively described in the book \cite{Varg17}, which forms the methodological and computational basis of all implemented analysis and synthesis functions. \item \emph{Support for the most general model representation of linear time-invariant systems in form of generalized state-space representation, also known as descriptor systems.} All analysis and synthesis functions are applicable to both continuous- and discrete-time systems. The basis for implementation of all functions is the \emph{Descriptor System Tools} (\textbf{DSTOOLS}) \cite{Varg17a}, a collection of functions to handle rational transfer function matrices (proper or improper), via their equivalent descriptor system representations. The initial version of this collection has been implemented in conjunction with the book \cite{Varg17}. \item \emph{Providing simple user interface to all synthesis functions. } All functions rely on default settings of problem parameters and synthesis options, which allow to easily obtain preliminary synthesis results. Also, all functions to solve a class of problems (e.g., fault detection), are applicable to the same input models. Therefore, the synthesis functions to solve approximate synthesis problems are applicable to solve the exact synthesis problems as well. On the other side, the solution of an exact problem for a system with noise inputs, represents a first approximation to the solution of the approximate synthesis problem. \item \emph{Providing an exhaustive set of options to ensure the complete freedom in choosing problem specific parameter and synthesis options.} Among the frequently used synthesis options are: the number of residual signal outputs or the numbers of outputs of the components of structured residual signals; stability degree for the poles of the resulting filters or the location of their poles; frequency values to enforce strong fault detectability; type of the employed nullspace basis (e.g., proper, proper and simple, full-order observer); performing least-order synthesis, etc. \item \emph{Guaranteeing the reproducibility of results. }This feature is enforced by employing the so-called \emph{design matrices}. These matrices are internally used to build linear combinations of left nullspace basis vectors and are frequently randomly generated (if not explicitly provided). The values of the employed design matrices are returned as additional information by all synthesis functions. The use of design matrices also represents a convenient mean to perform an optimization-based tuning of these matrices to achieve specific performance characteristics for the resulting filters. \end{itemize} \newpage \section{Fault Detection Basics}\label{sec:Basics} In this section we describe first the basic fault monitoring tasks, such as fault detection and fault isolation, and then introduce and characterize the concepts of fault detectability and fault isolability. Six ``canonical'' fault detection problems are formulated in the book \cite{Varg17} for the class of \emph{linear time-invariant} (LTI) systems with additive faults. Of the formulated six problems, three involve the exact synthesis and three involve the approximate synthesis of fault detection filters. The current release of \textbf{FDITOOLS} covers all synthesis techniques described in \cite{Varg17}. Jointly with the formulation of the fault detection problems, general solvability conditions are given for each problem in terms of ranks of certain transfer function matrices. More details and the proofs of the results are available in Chapters 2 and 3 of \cite{Varg17}. \subsection{Basic Fault Monitoring Tasks} \index{f@FDD|see{fault detection and diagnosis}} \index{f@FDI|see{fault detection and isolation}} A fault represents a deviation from the normal behaviour of a system due to an unexpected event (e.g., physical component failure or supply breakdown). The occurrence of faults must be detected as early as possible to prevent any serious consequence. For this purpose, {fault diagnosis} techniques are used to allow the {detection} of occurrence of faults (fault detection) and the localization of detected faults (fault isolation). The term \emph{fault detection and diagnosis} (FDD) includes the requirements for \emph{fault detection and isolation }(FDI). \index{fault detection and isolation (FDI)} A FDD system is a device (usually based on a collection of real-time processing algorithms) suitably set-up to fulfill the above tasks. The minimal functionality of any FDD system is illustrated in Fig.~\ref{Fig_FDDSystem}. \begin{figure}[thpb] \begin{center} \includegraphics[height=4.8cm]{{varga_Fig_FDDSystem}.pdf} \vspace*{-2mm} \caption{Basic fault diagnosis setup.} \label{Fig_FDDSystem} \end{center} \end{figure} The main plant variables are the control inputs $u$, the unknown disturbance inputs $d$, the noise inputs $w$, and the output measurements $y$. The output $y$ and control input $u$ are the only measurable signals which can be used for fault monitoring purposes. The disturbance inputs $d$ and noise inputs $w$ are non-measurable ``unknown'' input signals, which act adversely on the system performance. For example, the unknown disturbance inputs $d$ may represent physical disturbance inputs, as for example, wind turbulence acting on an aircraft or external loads acting on a plant. Typical noise inputs are sensor noise signals as well as process input noise. However, fictive noise inputs can also account for the cumulative effects of unmodelled system dynamics or for the effects of parametric uncertainties. In general, there is no clear-cut separation between disturbances and noise, and therefore, the appropriate definition of the disturbance and noise inputs is a challenging aspect when modelling systems for solving fault detection problems. A \emph{fault} is any unexpected variation of some physical parameters or variables of a plant causing an unacceptable violation of certain specification limits for normal operation. Frequently, a fault input $f$ is defined to account for any anomalous behaviour of the plant. The main component of any FDD system (as that in Fig.~\ref{Fig_FDDSystem}) is the \emph{residual generator} (or \emph{fault detection filter}, or simply \emph{fault detector}), which produces residual signals grouped in a $q$-dimensional vector $r$ by processing the available measurements $y$ and the known values of control inputs $u$. The role of the residual signals is to indicate the presence or absence of faults, and therefore the residual $r$ must be equal (or close) to zero in the absence of faults and significantly different from zero after a fault occurs. For decision-making, suitable measures of the residual magnitudes (e.g., signal norms) are generated in a vector $\theta$, which is then used to produce the corresponding decision vector $\iota$. In what follows, two basic fault monitoring tasks are formulated and discussed. \index{fault detection and diagnosis (FDD)!fault detection} \emph{Fault detection} is simply a binary decision on the presence of any fault ($f\not = 0$) or the absence of all faults ($f = 0$). Typically, $\theta(t)$ is scalar evaluation signal, which approximates $\|r\|_2$, the $\mathcal{L}_2$- or $\ell_2$-norms of signal $r$, while $\iota(t)$ is a scalar decision making signal defined as $\iota(t) = 1$ if $\theta(t) > \tau$ (fault occurrence) or $\iota(t) = 0$ if $\theta(t) \leq \tau$ (no fault), where $\tau$ is a suitable threshold quantifying the gap between the ``small'' and ``large'' magnitudes of the residual. The decision on the occurrence or absence of faults must be done in the presence of arbitrary control inputs $u$, disturbance inputs $d$, and noise inputs $w$ acting simultaneously on the system. The effects of the control inputs on the residual can be always decoupled by a suitable choice of the residual generation filter. In the ideal case, when no noise inputs are present ($w \equiv 0$), the residual generation filter must additionally be able to \emph{exactly} decouple the effects of the disturbances inputs in the residual and ensure, simultaneously, the sensitivity of the residual to all faults (i.e., \emph{complete fault detectability}, see Section~\ref{sec:fdetectability}). \index{fault detectability} In this case, $\tau = 0$ can be (ideally) used. However, in the general case when $w \not\equiv 0$, only an \emph{approximate} decoupling of $w$ can be achieved (at best) and a sufficient gap must exist between the magnitudes of residuals in fault-free and faulty situations. Therefore, an appropriate choice of $\tau > 0$ must avoid false alarms and missed detections. \index{fault detection and diagnosis (FDD)!fault isolation} \emph{Fault isolation} concerns with the exact localization of occurred faults and involves for each component $f_j$ of the fault vector $f$ the decision on the presence of $j$-th fault ($f_j\not = 0$) or its absence ($f_j = 0$). Ideally, this must be achieved regardless the faults occur one at a time or several faults occur simultaneously. Therefore, the fault isolation task is significantly more difficult than the simpler fault detection. For fault isolation purposes, we will assume a partitioning of the $q$-dimensional residual vector $r$ in $n_b$ stacked $q_i$-dimensional subvectors $r^{(i)}$, $i = 1, \ldots, n_b$, in the form \begin{equation}\label{rstruct} r = \left [ \begin{array}{c} r^{(1)}\\ \vdots \\ r^{(n_b)} \end{array} \right ] \, ,\end{equation} where $q = \sum_{i=1}^{n_b}q_i$. A typical fault evaluation setup used for fault isolation is to define $\theta_i(t)$, the $i$-th component of $\theta(t)$, as a real-time computable approximation of $\|r^{(i)}\|_2$. The $i$-th component of $\iota(t)$ is set to $\iota_i(t) = 1$ if $\theta_i(t) > \tau_i$ ($i$-th residual fired) or $\iota_i(t) = 0$ if $\theta_i(t) \leq \tau_i$ ($i$-th residual not fired), where $\tau_i$ is a suitable threshold for the $i$-th subvector $r^{(i)}(t)$. If a sufficiently large number of measurements are available, then it can be aimed that $r^{(i)}$ is influenced only by the $i$-th fault signal $f_i$. This setting, with $n_b$ chosen equal to the actual number of fault components, allows \emph{strong fault isolation},\index{fault detection and diagnosis (FDD)!strong fault isolation} where an arbitrary number of simultaneous faults can be isolated. The isolation of the $i$-th fault is achieved if $\iota_i(t) = 1$, while for $\iota_i(t) = 0$ the $i$-th fault is not present. In many practical applications, the lack of a sufficiently large number of measurements impedes strong isolation of simultaneous faults. Therefore, often only \emph{weak fault isolation}\index{fault detection and diagnosis (FDD)!weak fault isolation} can be performed under simplifying assumptions as, for example, that the faults occur one at a time or no more than two faults may occur simultaneously. The fault isolation schemes providing weak fault isolation compare the resulting $n_b$-dimensional binary decision vector $\iota(t)$, with a predefined set of binary fault signatures. If each individual fault $f_j$ has associated a distinct signature $s_j$, then the $j$-th fault can be isolated by simply checking that $\iota(t)$ matches the associated signature $s_j$. Similarly to fault detection, besides the decoupling of the control inputs $u$ from the residual $r$ (always possible), the exact decoupling of the disturbance inputs $d$ from $r$ can be strived in the case when $w\equiv 0$. However, in the general case when $w\not\equiv 0$, only approximate decoupling of $w$ can be achieved (at best) and a careful selection of tolerances $\tau_i$ is necessary to perform fault isolation without false alarms and missed detections. \subsection{Plant Models with Additive Faults}\label{sec:additive_faults} \index{faulty system model!additive} The following input-output representation is used to describe LTI systems with additive faults \begin{equation}\label{systemw} {\mathbf{y}}(\lambda) = G_u(\lambda){\mathbf{u}}(\lambda) + G_d(\lambda){\mathbf{d}}(\lambda) + G_f(\lambda){\mathbf{f}}(\lambda) + G_w(\lambda){\mathbf{w}}(\lambda) ,\end{equation} where ${\mathbf{y}}(\lambda)$, ${\mathbf{u}}(\lambda)$, ${\mathbf{d}}(\lambda)$, ${\mathbf{f}}(\lambda)$, and ${\mathbf{w}}(\lambda)$, with boldface notation, denote the Laplace-transformed (in the continuous-time case) or Z-transformed (in the discrete-time case) time-dependent vectors, namely, the $p$-dimensional system output vector $y(t)$, $m_u$-dimensional control input vector $u(t)$, $m_d$-dimensional disturbance vector $d(t)$, $m_f$-dimensional fault vector $f(t)$, and $m_w$-dimensional noise vector $w(t)$ respectively. $G_u(\lambda)$, $G_d(\lambda)$, $G_f(\lambda)$ and $G_w(\lambda)$ are the {transfer-function matrices} (TFMs) from the control inputs $u$, disturbance inputs $d$, fault inputs $f$, and noise inputs $w$ to the outputs $y$, respectively. According to the system type, $\lambda = s$, the complex variable in the Laplace-transform in the case of a continuous-time system or $\lambda = z$, the complex variable in the Z-transform in the case of a discrete-time system. For most of practical applications, the TFMs $G_u(\lambda)$, $G_d(\lambda)$, $G_f(\lambda)$, and $G_w(\lambda)$ are proper rational matrices. However, for complete generality of our problem settings, we will allow that these TFMs are general improper rational matrices for which we will not \emph{a priori} assume any further properties (e.g., stability, full rank, etc.). \index{faulty system model!additive!input-output} The main difference between the disturbance input $d(t)$ and noise input $w(t)$ arises from the formulation of the fault monitoring goals. In this respect, when synthesizing devices to serve for fault diagnosis purposes, we will generally target the \emph{exact} decoupling of the effects of disturbance inputs. Since generally the exact decoupling of effects of noise inputs is not achievable, we will simultaneously try to attenuate their effects, to achieve an \emph{approximate} decoupling. Consequently, we will try to solve synthesis problems exactly or approximately, in accordance with the absence or presence of noise inputs in the underlying plant model, respectively. An equivalent \emph{descriptor} state-space realization of the input-output model (\ref{systemw}) has the form \begin{equation}\label{ssystemw} \begin{aligned}E\lambda x(t) &= Ax(t) + B_u u(t) + B_d d(t) + B_f f(t) + B_w w(t) \, , \\ y(t) &= Cx(t) + D_u u(t) + D_d d(t) + D_f f(t) + D_w w(t)\, , \end{aligned} \end{equation} with the $n$-dimensional state vector $x(t)$, where $\lambda x(t) = \dot{x}(t)$ or $\lambda x(t) = x(t+1)$ depending on the type of the system, continuous- or discrete-time, respectively. In general, the square matrix $E$ can be singular, but we will assume that the linear pencil $A-\lambda E$ is regular. For systems with proper TFMs in (\ref{systemw}), we can always choose a \emph{standard} state-space realization where $E = I$. In general, it is advantageous to choose the representation (\ref{ssystemw}) minimal, with the pair $(A-\lambda E, C)$ \textit{observable} and the pair $(A-\lambda E, [\,B_u \; B_d \; B_f\; B_w \,])$ \textit{controllable}. The corresponding TFMs of the model in (\ref{systemw}) are \begin{equation}\label{tfms} \begin{aligned} G_u(\lambda) &= C(\lambda E-A)^{-1}B_u+D_u ,\\ G_d(\lambda) &= C(\lambda E-A)^{-1}B_d+D_d ,\\ G_f(\lambda) &= C(\lambda E-A)^{-1}B_f + D_f ,\\ G_w(\lambda) &= C(\lambda E-A)^{-1}B_w + D_w \end{aligned}\end{equation} or in an equivalent notation \[ \left [ \begin{array}{cccc} G_u(\lambda) & G_d(\lambda) & G_f(\lambda)& G_w(\lambda) \end{array} \right ] := {\arraycolsep=1mm\left [ \begin{array}{c|cccc} A-\lambda E & B_u & B_d & B_f & B_w \\ \hline C & D_u & D_d & D_f& D_w \end{array} \right ] }\, .\] \index{faulty system model!additive!state-space} \subsection{Residual Generation} \label{fdi_res} \index{residual generation!for fault detection and isolation} \index{residual generator!implementation form} A linear residual generator (or fault detection filter) processes the measurable system outputs $y(t)$ and known control inputs $u(t)$ and generates the residual signals $r(t)$ which serve for decision-making on the presence or absence of faults. The input-output form of this filter is \begin{equation}\label{detec} {\mathbf{r}}(\lambda) = Q(\lambda)\left [ \begin{array}{c} {\mathbf{y}}(\lambda)\\{\mathbf{u}}(\lambda)\end{array} \right ] = Q_y(\lambda){\mathbf{y}}(\lambda)+ Q_u(\lambda) {\mathbf{u}}(\lambda) \, , \end{equation} with $Q(\lambda) = [\, Q_y(\lambda)\; Q_u(\lambda)\,]$, and is called the \emph{implementation form}. The TFM $Q(\lambda)$ for a physically realizable filter must be \emph{proper} (i.e., only with finite poles) and \emph{stable} (i.e., only with poles having negative real parts for a continuous-time system or magnitudes less than one for a discrete-time system). The dimension $q$ of the residual vector $r(t)$ depends on the fault detection problem to be addressed. \index{residual generator!internal form} The residual signal $r(t)$ in (\ref{detec}) generally depends on all system inputs $u(t)$, $d(t)$, $f(t)$ and $w(t)$ via the system output $y(t)$. The \emph{internal form} of the filter is obtained by replacing in (\ref{detec}) ${\mathbf{y}}(\lambda)$ by its expression in (\ref{systemw}), and is given by \begin{equation}\label{resys} \hspace*{-5mm}{\mathbf{r}}(\lambda) = R(\lambda)\!{\arraycolsep=0mm \left [ \begin{array}{c}{\mathbf{u}}(\lambda)\\ {\mathbf{d}}(\lambda) \\ {\mathbf{f}}(\lambda) \\ {\mathbf{w}}(\lambda)\end{array} \right ] }\! = R_u(\lambda){\mathbf{u}}(\lambda) \!+\! R_d(\lambda){\mathbf{d}}(\lambda) \!+\! R_f(\lambda){\mathbf{f}}(\lambda) \!+\! R_w(\lambda){\mathbf{w}}(\lambda) \, , \hspace*{-4mm}\end{equation} with $R(\lambda) = [\, R_u(\lambda)\; R_d(\lambda)\; R_f(\lambda)\; R_w(\lambda\,]$ defined as \begin{equation}\label{resys1} \left [ \begin{array}{c|c|c|c} R_u(\lambda) & R_d(\lambda) & R_f(\lambda) & R_w(\lambda)\end{array} \right ] := {\arraycolsep=1mm Q(\lambda) \left [ \begin{array}{c|c|c|c} G_u(\lambda) & G_d(\lambda) & G_f(\lambda) & G_w(\lambda) \\ I_{m_u} & 0 & 0 & 0 \end{array} \right ] } \, . \end{equation} For a properly designed filter $Q(\lambda)$, the corresponding internal representation $R(\lambda)$ is also a proper and stable system, and additionally fulfills specific fault detection and isolation requirements. \subsection{Fault Detectability} \label{sec:fdetectability} \index{fault detectability} The concepts of fault detectability and complete fault detectability deal with the sensitivity of the residual to an individual fault and to all faults, respectively. For the discussion of these concepts we will assume that no noise input is present in the system model (\ref{systemw}) ($w \equiv 0$). \begin{definition}\label{fdetectability} For the system (\ref{systemw}), the $j$-th fault $f_j$ is \emph{detectable} if there exists a fault detection filter $Q(\lambda)$ such that for all control inputs $u$ and all disturbance inputs $d$, the residual $r \not=0$ if $f_j \not= 0$ and $f_k = 0$ for all $k\not = j$. \end{definition} \index{fault detectability!complete} \begin{definition}\label{cfdetectability} The system (\ref{systemw}) is \emph{completely fault detectable} if there exists a fault detection filter $Q(\lambda)$ such that for each $j$, $j = 1, \ldots, m_f$, all control inputs $u$ and all disturbance inputs $d$, the residual $r \not=0$ if $f_j \not= 0$ and $f_k = 0$ for all $k\not = j$. \end{definition} We have the following results, proven in \cite{Varg17}, which characterize the fault detectability and the complete fault detectability properties. \begin{proposition} \label{T-detectability} \index{fault detectability} For the system (\ref{systemw}) the $j$-th fault is detectable if and only if \begin{equation}\label{fdetec} \mathop{\mathrm{rank}} \big[\, G_d(\lambda) \;\; G_{f_j}(\lambda) \,\big] > \mathop{\mathrm{rank}} G_d(\lambda) ,\end{equation} where $G_{f_j}(\lambda)$ is the $j$-th column of $G_{f}(\lambda)$ and $\mathop{\mathrm{rank}} \, (\cdot)$ is the normal rank (i.e., over rational functions) of a rational matrix. \end{proposition} \begin{theorem} \label{C-detectability} \index{fault detectability!complete} The system (\ref{systemw}) is completely fault detectable if and only if \begin{equation}\label{cfdetec} \mathop{\mathrm{rank}} \big[\, G_d(\lambda) \;\; G_{f_j}(\lambda) \,\big] > \mathop{\mathrm{rank}} G_d(\lambda) , \; j = 1, \ldots, m_f \, .\end{equation} \end{theorem} \index{fault detectability!strong} {Strong fault detectability} is a concept related to the reliability and easiness of performing fault detection. The main idea behind this concept is the ability of the residual generators to produce persistent residual signals in the case of persistent fault excitation. For example, for reliable fault detection it is advantageous to have an asymptotically non-vanishing residual signal in the case of persistent faults as step or sinusoidal signals. On the contrary, the lack of strong fault detectability may make the detection of these type of faults more difficult, because their effects manifest in the residual only during possibly short transients, thus the effect disappears in the residual after an enough long time although the fault itself still persists. The definitions of strong fault detectability and complete strong fault detectability cover several classes of persistent fault signals. Let $\partial\mathds{C}_s$ denote the boundary of the stability domain, which, in the case of a continuous-time system, is the extended imaginary axis (including also the infinity), while in the case of a discrete-time system, is the unit circle centered in the origin. Let $\Omega \subset \partial\mathds{C}_s$ be a set of complex frequencies, which characterize the classes of persistent fault signals in question. Common choices in a continuous-time setting are $\Omega = \{ 0 \}$ for a step signal or $\Omega = \{ \mathrm{i}\omega \}$ for a sinusoidal signal of frequency $\omega$. However, $\Omega$ may contain several such frequency values or even a whole interval of frequency values, such as $\Omega = \{\mathrm{i}\omega \mid \omega \in [\,\omega_1, \omega_2\,]\}$. We denote by $\mathcal F_\Omega$ the class of persistent fault signals characterized by $\Omega$. \index{fault detectability!strong} \begin{definition}\label{sfdetectability} For the system (\ref{systemw}) and a given set of frequencies $\Omega \subset \partial\mathds{C}_s$, the $j$-th fault $f_j$ is \emph{strong fault detectable} with respect to $\Omega$ if there exists a stable fault detection filter $Q(\lambda)$ such that for all control inputs $u$ and all disturbance inputs $d$, the residual $r(t) \not=0$ for $t \rightarrow\infty$ if $f_j \in \mathcal F_\Omega$ and $f_k = 0$ for all $k\not = j$. \end{definition} \index{fault detectability!complete, strong} \begin{definition}\label{csfdetectability} The system (\ref{systemw}) is \emph{completely strong fault detectable} with respect to a given set of frequencies $\Omega \subset \partial\mathds{C}_s$, if there exists a stable fault detection filter $Q(\lambda)$ such that for each $j = 1, \ldots, m_f$, all control inputs $u$ and all disturbance inputs $d$, the residual $r(t) \not=0$ for $t \rightarrow\infty$ if $f_j \in \mathcal F_\Omega$ and $f_k = 0$ for all $k\not = j$. \end{definition} For a given stable filter $Q(\lambda)$ checking the strong detection property of the filter for the $j$-th fault $f_j$ involves to check that $R_{f_j}(\lambda)$ has no zeros in $\Omega$. A characterization of strong detectability as a system property is given in what follows.\index{fault detectability!strong} \begin{theorem} \label{T-Sdetectability} Let $\Omega \subset \partial\mathds{C}_s$ be a given set of frequencies. For the system (\ref{systemw}), $f_j$ is strong fault detectable with respect to $\Omega$ if and only if $f_j$ is fault detectable and the rational matrices $G_{e,j}(\lambda)$ and $\left [ \begin{array}{c} G_{e,j}(\lambda)\\ F_{e}(\lambda)\end{array} \right ]$ have the same zero structure for each $\lambda_z \in \Omega$, where \begin{equation}\label{GejFe} G_{e,j}(\lambda) := \left [ \begin{array}{ccc} G_{f_j}(\lambda) & G_u(\lambda) & G_d(\lambda) \\ 0 & I_{m_u} & 0 \end{array} \right ] , \quad F_{e}(\lambda) := [\, 1 \; \; 0_{1\times m_u} \;\; 0_{1\times m_d}\,] \, .\end{equation} \end{theorem} \begin{remark} Strong fault detectability implies fault detectability, which can be thus assimilated with a kind of \emph{weak} fault detectability property. For the characterization of the strong fault detectability, we can impose a weaker condition, involving only the existence of a filter $Q(\lambda)$ without poles in $\Omega$ (instead imposing stability). For such a filter $Q(\lambda)$, the stability can always be achieved by replacing $Q(\lambda)$ by $M(\lambda)Q(\lambda)$, where $M(\lambda)$ is a stable and invertible TFM without zeros in $\Omega$. Such an $M(\lambda)$ can be determined from a left coprime factorization with least order denominator of $[\, Q(\lambda) \; R_{f}\,(\lambda)\,]$. {\ \hfill $\Box$}\end{remark}% For complete strong fault detectability the strong fault detectability of each individual fault is necessary, however, it is not a sufficient condition. The following theorem gives a general characterization of the complete strong fault detectability as a system property.\index{fault detectability!complete, strong}% \begin{theorem} \label{T-sfdetecorig} Let $\Omega$ be the set of frequencies which characterize the persistent fault signals. The system (\ref{systemw}) with $w \equiv 0$ is completely strong fault detectable with respect to $\Omega$ if and only if each fault $f_j$, for $j = 1, \ldots, m_f$, is strong fault detectable with respect to $\Omega$ and all $G_{f_j}(\lambda)$, for $j = 1, \ldots, m_f$, have the same pole structure in $\lambda_p$ for all $\lambda_p \in \Omega$. \end{theorem} \subsection{Fault Isolability} \label{isolability} \index{fault isolability} While the detectability of a fault can be individually defined and checked, for the definition of fault isolability, we need to deal with the interactions among all fault inputs. Therefore for fault isolation, we assume a structuring of the residual vector $r$ into $n_b$ subvectors as in (\ref{rstruct}), where each individual $q_i$-dimensional subvector $r^{(i)}$ is differently sensitive to faults. We assume that each fault $f_j$ is characterized by a distinct pattern of zeros and ones in a $n_b$-dimensional vector $s_j$ called the \emph{signature} of the $j$-th fault. Then, fault isolation consists of recognizing which signature matches the resulting decision vector $\iota$ generated by the FDD system in Fig.~\ref{Fig_FDDSystem} according to the partitioning of $r$ in (\ref{rstruct}). \index{fault isolability!structure matrix} \index{fault isolability!structure matrix!fault signature} \index{fault isolability!structure matrix!specification} \index{structure matrix!fault signature} \index{structure matrix!specification} \index{structure matrix|ii} For the discussion of fault isolability, we will assume that no noise input is present in the model (\ref{systemw}) ($w \equiv 0$). The structure of the residual vector in (\ref{rstruct}) corresponds to a $q\times m_f$ TFM $Q(\lambda)$ ($q = \sum_{i=1}^{n_b}q_i$) of the residual generation filter, built by stacking a bank of $n_b$ filters $Q^{(1)}(\lambda)$, $\ldots$, $Q^{(n_b)}(\lambda)$ as \begin{equation}\label{qbank} Q(\lambda) = \left [ \begin{array}{c} Q^{(1)}(\lambda)\\ \vdots \\ Q^{(n_b)}(\lambda) \end{array} \right ] \, .\end{equation} Thus, the $i$-th subvector $r^{(i)}$ is the output of the $i$-th filter with the $q_i\times m_f$ TFM $Q^{(i)}(\lambda)$ \begin{equation}\label{ri_fdip} {\mathbf{r}}^{(i)}(\lambda) = Q^{(i)}(\lambda)\left [ \begin{array}{c} {\mathbf{y}}(\lambda)\\{\mathbf{u}}(\lambda)\end{array} \right ] \, .\end{equation} Let $R_f(\lambda)$ be the corresponding $q\times m_f$ fault-to-residual TFM in (\ref{resys}) and we denote $R^{(i)}_{f_j}(\lambda) := Q^{(i)}(\lambda) \left [ \begin{array}{c} G_{f_j}(\lambda) \\ 0 \end{array} \right ]$, the $q_i\times 1$ $(i,j)$-th block of $R_f(\lambda)$ which describes how the $j$-th fault $f_j$ influences the $i$-th residual subvector $r^{(i)}$. Thus, $R_f(\lambda)$ is an $n_b\times m_f$ block-structured TFM of the form \begin{equation}\label{Rf_struct} R_f(\lambda) = \left [ \begin{array}{ccc} R^{(1)}_{f_1}(\lambda)& \cdots &R^{(1)}_{f_{m_f}}(\lambda) \\ \vdots & \ddots & \vdots \\ R^{(n_b)}_{f_1}(\lambda)& \cdots &R^{(n_b)}_{f_{m_f}}(\lambda) \end{array} \right ] \, .\end{equation} We associate to such a structured $R_f(\lambda)$ the $n_b\times m_f$ \emph{structure matrix} $S_{R_f}$ whose $(i,j)$-th element is defined as \begin{equation}\label{structure_matrix} {\arraycolsep=1mm\begin{array}{llrll} S_{R_f}(i,j) &=& 1 & \text{ if } & R^{(i)}_{f_j}(\lambda) \not=0 \; ,\\ S_{R_f}(i,j) &=& 0 & \text{ if } & R^{(i)}_{f_j}(\lambda) =0 \, . \end{array}} \end{equation} If $S_{R_f}(i,j) = 1$ then we say that the residual component $r^{(i)}$ is sensitive to the $j$-th fault $f_j$, while if $S_{R_f}(i,j) = 0$ then the $j$-th fault $f_j$ is decoupled from $r^{(i)}$. Fault isolability is a property which involves all faults and this is reflected in the following definition, which relates the fault isolability property to a certain structure matrix $S$. For a given structure matrix $S$, we refer to the $i$-th row of $S$ as the \emph{specification} associated with the $i$-th residual component $r^{(i)}$, while the $j$-th column of $S$ is called the \emph{signature} (or \emph{code}) associated with the $j$-th fault $f_j$. \begin{definition} For a given $n_b\times m_f$ structure matrix $S$, the model (\ref{systemw}) is $S$-\emph{fault isolable} if there exists a fault detection filter $Q(\lambda)$ such that $S_{R_f} = S$. \end{definition} When solving fault isolation problems, the choice of a suitable structure matrix $S$ is an important aspect. This choice is, in general, not unique and several choices may lead to satisfactory synthesis results. In this context, the availability of the maximally achievable structure matrix is of paramount importance, because it allows to construct any $S$ by simply selecting a (minimal) number of achievable specifications (i.e., rows of this matrix). The M-function \texttt{\bfseries genspec}, allows to compute the maximally achievable structure matrix for a given system. The choice of $S$ should usually reflect the fact that complete fault detectability must be a necessary condition for the $S$-fault isolability. This requirement is fulfilled if $S$ is chosen without zero columns. Also, for the unequivocal isolation of the $j$-th fault, the corresponding $j$-th column of $S$ must be different from all other columns. Structure matrices having all columns pairwise distinct are called \emph{weakly isolating}.\index{fault isolability!weak} Fault signatures which results as (logical OR) combinations of two or more columns of the structure matrix, can be occasionally employed to isolate simultaneous faults, provided they are distinct from all columns of $S$. In this sense, a structure matrix $S$ which allows the isolation of an arbitrary number of simultaneously occurring faults is called \emph{strongly isolating}.\index{fault isolability!strong} It is important to mention in this context that a system which is not fault isolable for a given $S$ may still be fault isolable for another choice of the structure matrix. To characterize the fault isolability property, we observe that each block row $Q^{(i)}(\lambda)$ of the TFM $Q(\lambda)$ is itself a fault detection filter which must achieve the specification contained in the $i$-th row of $S$. Thus, the isolability conditions will consist of a set of $n_b$ independent conditions, each of them characterizing the complete detectability of particular subsets of faults. We have the following straightforward characterization of fault isolability. \index{fault isolability} \begin{theorem}\label{T-isolability} For a given $n_b\times m_f$ structure matrix $S$, the model (\ref{systemw}) is $S$-fault isolable if and only if for $i = 1, \ldots, n_b$ \begin{equation}\label{fdcondri} \mathop{\mathrm{rank}} \,[\, G_d(\lambda) \; \widehat G_d^{(i)}(\lambda)\; G_{f_j}(\lambda)\, ] > \mathop{\mathrm{rank}} [\, G_d(\lambda) \; \widehat G_d^{(i)}(\lambda)\, ] , \quad \forall j, \;\; S_{ij} \not = 0\, ,\end{equation} where $\widehat G_d^{(i)}(\lambda)$ is formed from the columns $G_{f_j}(\lambda)$ of $G_f(\lambda)$ for which $S_{ij} = 0$. \end{theorem} The conditions (\ref{fdcondri}) of Theorem~\ref{T-isolability} give a very general characterization of isolability of faults. An important particular case is \emph{strong fault isolability}, in which case $S = I_{m_f}$, and thus diagonal. The following result characterizes the strong isolability. \index{fault isolability!strong} \begin{theorem} \label{T-strong-isolability} The model (\ref{systemw}) is strongly fault isolable if and only if \begin{equation}\label{fdistrong} \mathop{\mathrm{rank}} \, [\, G_d(\lambda) \; G_{f}(\lambda)\, ] = \mathop{\mathrm{rank}} G_d(\lambda) + m_f \, .\end{equation} \end{theorem} \begin{remark} \label{left-invertibility} In the case $m_d = 0$, the strong fault isolability condition reduces to the left invertibility condition \begin{equation}\label{VA:sufnecfdi} \mathop{\mathrm{rank}} G_{f}(\lambda) = m_f \, .\end{equation} This condition is a necessary condition even in the case $m_d \not = 0$ (otherwise $R_f(\lambda)$ would not have full column rank). {\ \hfill $\Box$} \end{remark} \begin{remark} \label{rem:strong_structure} The definition of the structure matrix $S_{R_f}$ associated with a given TFM $R_f(\lambda)$ can be extended to cover the strong fault detectability requirement defined by $\Omega \subset \partial\mathds{C}_s$, where $\Omega$ is the set of relevant frequencies. For each $\lambda_z \in \Omega$, we can define the strong structure matrix at the complex frequency $\lambda_z$ as \begin{equation}\label{strong_structure_matrix} {\arraycolsep=1mm\begin{array}{llrll} S_{R_f}(i,j) &=& 1 & \text{ if } & R^{(i)}_{f_j}(\lambda_z) \not=0 \; ,\\ S_{R_f}(i,j) &=& 0 & \text{ if } & R^{(i)}_{f_j}(\lambda_z) =0 \, . \end{array}} \end{equation} {\ \hfill $\Box$}\end{remark} \subsection{Fault Detection and Isolation Problems} \label{fdp} \index{a1@EFDP|see{fault detection problem}} \index{a2@EFDIP|see{fault detection and isolation problem}} \index{a5@EMMP|see{model-matching problem}} \index{a6@EFEP|see{model-matching problem}} \index{a3@AFDP|see{fault detection problem}} \index{a4@AFDIP|see{fault detection and isolation problem}} \index{a7@AMMP|see{model-matching problem}} \index{a8@EMDP|see{model detection problem}} \index{a9@AMDP|see{model detection problem}} In this section we formulate several synthesis problems of fault detection and isolation filters for LTI systems. These problems can be considered as a minimal (canonical) set to cover the needs of most practical applications. For the solution of these problems we seek linear residual generators (or fault detection filters) of the form (\ref{detec}), which process the measurable system outputs $y(t)$ and known control inputs $u(t)$ and generate the residual signals $r(t)$, which serve for decision-making on the presence or absence of faults. The standard requirements on all TFMs appearing in the implementation form (\ref{detec}) and internal form (\ref{resys}) of the fault detection filter are \emph{properness} and \emph{stability}, to ensure physical realizability of the filter $Q(\lambda)$ and to guarantee a stable behaviour of the FDD system. The \textit{order} of the filter $Q(\lambda)$ is its \textit{McMillan degree}, that is, the dimension of the state vector of a minimal state-space realization of $Q(\lambda)$. For practical purposes, lower order filters are preferable to larger order ones, and therefore, determining \emph{least order residual generators} is also a desirable synthesis goal. Finally, while the dimension $q$ of the residual vector $r(t)$ depends on the fault detection problem to be solved, filters with the \emph{least number of outputs}, are always of interest for practical usage. For the solution of fault detection and isolation problems it is always possible to completely decouple the control input $u(t)$ from the residual $r(t)$ by requiring $R_u(\lambda) = 0$. Regarding the disturbance input $d(t)$ and noise input $w(t)$ we aim to impose a similar condition on the disturbance input $d(t)$ by requiring $R_d(\lambda) = 0$, while minimizing simultaneously the effect of noise input $w(t)$ on the residual (e.g., by minimizing the norm of $R_w(\lambda)$). Thus, from a practical synthesis point of view, the distinction between $d(t)$ and $w(t)$ lies solely in the way these signals are treated when solving the residual generator synthesis problem. In all fault detection problems formulated in what follows, we require that by a suitable choice of a stable fault detection filter $Q(\lambda)$, we achieve that the residual signal $r(t)$ is fully decoupled from the control input $u(t)$ and disturbance input $d(t)$. Thus, the following \emph{decoupling conditions} must be fulfilled for the filter synthesis \begin{equation}\label{ens} \begin{array}{ll} (i) & R_u(\lambda) = 0 \, ,\\ (ii) & R_d(\lambda) = 0 \, . \end{array} \end{equation} In the case when condition $(ii)$ can not be fulfilled (e.g., due to lack of sufficient number of measurements), we can redefine some (or even all) components of $d(t)$ as noise inputs and include them in $w(t)$. For each fault detection problem formulated in what follows, specific requirements have to be fulfilled, which are formulated as additional synthesis conditions. For all formulated problems we also give the existence conditions of the solutions of these problems. For the proofs of the results consult \cite{Varg17}. \subsubsection{EFDP -- Exact Fault Detection Problem} \label{sec:EFDP} \index{fault detection and e@fault detection problem!a@exact (EFDP)|ii} For the \emph{exact fault detection problem} (EFDP) the basic additional requirement is simply to achieve by a suitable choice of a stable and proper fault detection filter $Q(\lambda)$ that, in the absence of noise input (i.e., $w \equiv 0$), the residual $r(t)$ is sensitive to all fault components $f_j(t)$, $j = 1, \ldots, m_f$. If a noise input $w(t)$ is present, then we assume the TFM $G_w(s)$ is stable (thus $R_w(\lambda)$ is stable too). Thus, the following \emph{detection condition} has to be fulfilled: \begin{equation}\label{efdp} (iii) \;\; R_{f_j}(\lambda) \not = 0,\; j = 1, \ldots, m_f \;\; \textrm{with} \;\; R_f(\lambda) \;\; \textrm{stable.} \end{equation} This is precisely the complete fault detectability requirement (without the stability condition) and leads to the following solvability condition: \begin{theorem}\label{T-EFDP} \index{fault detection and e@fault detection problem!a@exact (EFDP)!solvability|ii} For the system (\ref{systemw}), the EFDP is solvable if and only if the system (\ref{systemw}) is completely fault detectable. \end{theorem} \index{fault detection and e@fault detection problem!a@exact (EFDP) with strong detectability|ii} Let $\Omega \subset \partial\mathds{C}_s$ be a given set of frequencies which characterize the relevant persistent faults. We can give a similar result in the case when the EFDP is solved with a \emph{strong detection condition}: \begin{equation}\label{efdps} (iii)' \;\; R_{f_j}(\lambda_z) \not = 0, \;\;\forall \lambda_z \in \Omega, \; j = 1, \ldots, m_f \;\; \textrm{with} \;\; R_f(\lambda) \;\; \textrm{stable.} \end{equation} \index{fault detection and e@fault detection problem!a@exact (EFDP) with strong detectability!solvability|ii} The solvability condition of the EFDP with the strong detection condition above is precisely the complete strong fault detectability requirement as stated by the following theorem. \begin{theorem}\label{T-EFDPS} Let $\Omega$ be the set of frequencies which characterize the persistent fault signals. For the system (\ref{systemw}), the EFDP with the strong detection condition (\ref{efdps}) is solvable if and only if the system (\ref{systemw}) is completely strong fault detectable with respect to $\Omega$. \end{theorem} \subsubsection{AFDP -- Approximate Fault Detection Problem}\label{sec:AFDP} \index{fault detection and e@fault detection problem!approximate (AFDP)|ii} The effects of the noise input $w(t)$ can usually not be fully decoupled from the residual $r(t)$. In this case, the basic requirements for the choice of $Q(\lambda)$ can be expressed to achieve that the residual $r(t)$ is influenced by all fault components $f_j(t)$ and the influence of the noise signal $w(t)$ is negligible. For the \emph{approximate fault detection problem} (AFDP) the following two additional conditions have to be fulfilled: \begin{equation}\label{afdp} \begin{array}{ll} (iii) & R_{f_j}(\lambda) \not = 0, \; j = 1, \ldots, m_f \;\; \textrm{with} \;\; R_f(\lambda) \;\; \textrm{stable;} \\ (iv) & R_w(\lambda) \approx 0, \;\; \textrm{with} \;\; R_w(\lambda) \;\; \textrm{stable.} \end{array} \end{equation} Here, $(iii)$ is the \emph{detection condition} of all faults employed also in the EFDP, while $(iv)$ is the \emph{attenuation condition} for the noise input. The condition $R_w(\lambda) \approx 0$ expresses the requirement that the transfer gain $\|R_w(\lambda)\|$ (measured by any suitable norm) can be made arbitrarily small. The solvability conditions of the formulated AFDP can be easily established: \begin{theorem}\label{T-AFDP} For the system (\ref{systemw}) the AFDP is solvable if and only if the EFDP is solvable. \end{theorem} \index{fault detection and e@fault detection problem!approximate (AFDP)!solvability|ii} \index{fault detection and e@fault detection problem!a@exact (EFDP)!solvability} \begin{remark} The above theorem is a pure mathematical result. The resulting filter $Q(\lambda)$, which makes $\|R_w(\lambda)\|$ ``small'', may simultaneously reduce $\|R_f(\lambda)\|$, such that while the fault detectability property is preserved, the filter has very limited practical use. In practice, the usefulness of a solution $Q(\lambda)$ of the AFDP must be judged by taking into account the maximum size of the noise signal and the desired minimum detectable sizes of faults. {\ \hfill $\Box$}\end{remark} \index{fault detection and e@fault detection problem!approximate (AFDP)} \subsubsection{EFDIP -- Exact Fault Detection and Isolation Problem} \label{sec:EFDIP} \index{fault detection and isolation problem!a@exact (EFDIP)|ii} For a row-block structured fault detection filter $Q(\lambda)$ as in (\ref{qbank}), let $R_f(\lambda)$ be the corresponding block-structured fault-to-residual TFM as defined in (\ref{Rf_struct}) with $n_b\times m_f$ blocks, and let $S_{R_f}$ be the corresponding $n_b\times m_f$ structure matrix defined in (\ref{structure_matrix}) (see Section~\ref{isolability}). Let $s_j$, $j = 1, \ldots, m_f$ be a set of $n_b$-dimensional binary signature vectors associated to the faults $f_j$, $j = 1, \ldots, m_f$, which form the desired structure matrix $S := [\, s_1 \;\; \ldots s_{m_f}\,]$. The \emph{exact fault detection and isolation problem} (EFDIP) requires to determine for a given $n_b\times m_f$ structure matrix $S$, a stable and proper filter $Q(\lambda)$ of the form (\ref{qbank}) such that the following condition is additionally fulfilled: \begin{equation}\label{efdip} (iii) \;\; S_{R_f} = S , \;\; \textrm{with} \; R_f(\lambda) \; \textrm{stable.} \end{equation} We have the following straightforward solvability condition: \index{fault detection and isolation problem!a@exact (EFDIP)!solvability|ii} \begin{theorem}\label{T-EFDIP} For the system (\ref{systemw}) with $w \equiv 0$ and a given structure matrix $S$, the EFDIP is solvable if and only if the system (\ref{systemw}) is $S$-fault isolable. \end{theorem} \index{fault detection and isolation problem!a@exact (EFDIP) with strong isolability|ii} A similar result can be established for the case when $S$ is the $m_f$-th order identity matrix $S = I_{m_f}$. We call the associated synthesis problem the \emph{strong} EFDIP. The proof is similar to that of Theorem~\ref{T-EFDIP}. \begin{theorem}\label{T-strongEFDIP} \index{fault detection and isolation problem!a@exact (EFDIP) with strong isolability!solvability|ii} For the system (\ref{systemw}) with $w \equiv 0$ and $S = I_{m_f}$, the EFDIP is solvable if and only if the system (\ref{systemw}) is strongly fault isolable. \end{theorem} \subsubsection{AFDIP -- Approximate Fault Detection and Isolation Problem }\label{sec:AFDIP} \index{fault detection and isolation problem!approximate (AFDIP)|ii} Let $S$ be a desired $n_b\times m_f$ structure matrix targeted to be achieved by using a structured fault detection filter $Q(\lambda)$ with $n_b$ row blocks as in (\ref{qbank}). The $n_b\times m_f$ block structured fault-to-residual TFM $R_f(\lambda)$, corresponding to $Q(\lambda)$ is defined in (\ref{Rf_struct}), can be additively decomposed as $R_f(\lambda) = \widetilde R_f(\lambda) + \overline R_f(\lambda)$, where $\widetilde R_f(\lambda)$ and $\overline R_f(\lambda)$ have the same block structure as $R_f(\lambda)$ and have their $(i,j)$-th blocks defined as \begin{equation}\label{afdip-rtb} \widetilde R^{(i)}_{f_j}(\lambda) = S_{ij}R^{(i)}_{f_j}(\lambda), \quad \overline R^{(i)}_{f_j}(\lambda) = (1-S_{ij})R^{(i)}_{f_j}(\lambda) \, .\end{equation} To address the approximate fault detection and isolation problem, we will target to enforce for the part $\widetilde R_f(\lambda)$ of $R_f(\lambda)$ the desired structure matrix $S$, while the part $\overline R_f(\lambda)$ must be (ideally) negligible. The \emph{soft approximate fault detection and isolation problem} (\emph{soft} AFDIP) can be formulated as follows. For a given $n_b\times m_f$ structure matrix $S$, determine a stable and proper filter $Q(\lambda)$ in the form (\ref{qbank}) such that the following conditions are additionally fulfilled: \begin{equation}\label{afdip-sr} \hspace*{-7mm}{\arraycolsep=1mm\begin{array}{ll} (iii) & S_{\widetilde R_f} = S, \; \overline R_f(\lambda) \approx 0 , \; \text{with} \; R_f(\lambda) \; \text{stable,} \; \\ (iv) & R_w(\lambda) \approx 0, \; \text{with} \; R_w(\lambda) \; \text{stable.} \end{array}} \end{equation} The necessary and sufficient condition for the solvability of the \emph{soft} AFDIP is the solvability of the EFDP. \begin{theorem}\label{T-AFDIP} For the system (\ref{systemw}) and a given structure matrix $S$ without zero columns, the \emph{soft} AFDIP is solvable if and only if the EFDP is solvable. \end{theorem} \index{fault detection and isolation problem!approximate (AFDIP)!solvability|ii} \index{fault detection and e@fault detection problem!a@exact (EFDP)!solvability} \begin{remark} \label{rem:S_full} If the given structure matrix $S$ has zero columns, then all faults corresponding to the zero columns of $S$ can be redefined as additional noise inputs. In this case, the Theorem~\ref{T-AFDIP} can be applied to a modified system with a reduced set of faults and increased set of noise inputs. {\ \hfill $\Box$}\end{remark} \index{fault detection and isolation problem!approximate (AFDIP)} The solvability of the EFDIP is clearly a sufficient condition for the solvability of the \emph{soft} AFDIP, but is not, in general, also a necessary condition, unless we impose in the formulation of the AFDIP the stronger condition $\overline R_f(\lambda) = 0$ (instead $\overline R_f(\lambda) \approx 0$). This is equivalent to require $S_{R_f} = S$. Therefore, we can alternatively formulate the \emph{strict} AFDIP to fulfill the conditions: \begin{equation}\label{afdip-sr1} \hspace*{-7mm}{\arraycolsep=1mm\begin{array}{ll} (iii)' & S_{R_f} = S, \; \text{with} \; R_f(\lambda) \; \text{stable,} \; \\ (iv)' & R_w(\lambda) \approx 0, \; \text{with} \; R_w(\lambda) \; \text{stable.} \end{array}} \end{equation} In this case we have the following result: \begin{theorem}\label{T-AFDIPE} \index{fault detection and isolation problem!approximate (AFDIP)!solvability|ii} For the system (\ref{systemw}) and a given structure matrix $S$, the \emph{strict} AFDIP is solvable with $S_{R_f} = S$ if and only if the EFDIP is solvable. \end{theorem} \subsubsection{EMMP -- Exact Model-Matching Problem} \label{sec:EMMP} \index{model-matching problem!a@exact (EMMP)|ii} Let $M_{rf}(\lambda)$ be a given $q\times m_f$ TFM of a stable and proper reference model specifying the desired input-output behaviour from the faults to residuals as ${\mathbf{r}}(\lambda) = M_{rf}(\lambda) {\mathbf{f}}(\lambda)$. Thus, we want to achieve by a suitable choice of a stable and proper $Q(\lambda)$ satisfying $(i)$ and $(ii)$ in (\ref{ens}), that we have additionally $R_f(\lambda) = M_{rf}(\lambda)$. For example, a typical choice for $M_{rf}(\lambda)$ is an $m_f \times m_f$ diagonal and invertible TFM, which ensures that each residual $r_i(t)$ is influenced only by the fault $f_i(t)$. The choice $M_{rf}(\lambda) = I_{m_f}$ targets the solution of an \emph{exact fault estimation problem} (EFEP). To determine $Q(\lambda)$, we have to solve the linear rational equation (\ref{resys1}), with the settings $R_u(\lambda) = 0$, $R_d(\lambda) = 0$, and $R_f(\lambda) = M_{rf}(\lambda)$ ($R_w(\lambda)$ and $G_w(\lambda)$ are assumed empty matrices). The choice of $M_{rf}(\lambda)$ may lead to a solution $Q(\lambda)$ which is not proper or is unstable or has both these undesirable properties. Therefore, besides determining $Q(\lambda)$, we also consider the determination of a suitable updating factor $M(\lambda)$ of $M_{rf}(\lambda)$ to ensure the stability and properness of the solution $Q(\lambda)$ for $R_f(\lambda) = M(\lambda) M_{rf}(\lambda)$. Obviously, $M(\lambda)$ must be chosen a proper, stable and invertible TFM. Additionally, by choosing $M(\lambda)$ diagonal, the zero and nonzero entries of $M_{rf}(\lambda)$ can be also preserved in $R_f(\lambda)$ (see also Section \ref{sec:EFDIP}). \index{model-matching problem!a@exact fault estimation (EFEP)|ii} The \emph{exact model-matching problem} (EMMP) can be formulated as follows: given a stable and proper $M_{rf}(\lambda)$, it is required to determine a stable and proper filter $Q(\lambda)$ and a diagonal, proper, stable and invertible TFM $M(\lambda)$ such that, additionally to (\ref{ens}), the following condition is fulfilled: \begin{equation}\label{emmp} (iii) \;\; R_f(\lambda) = M(\lambda)M_{rf}(\lambda)\, .\end{equation} The solvability condition of the EMMP is the standard solvability condition of systems of linear equations: \begin{theorem}\label{T-EMMP} \index{model-matching problem!a@exact (EMMP)!solvability|ii} For the system (\ref{systemw}) with $w \equiv 0$ and a given $M_{rf}(\lambda)$, the EMMP is solvable if and only if the following condition is fulfilled \begin{equation}\label{fdimmcond} \hspace*{-4mm} \mathop{\mathrm{rank}}\, [\, G_d(\lambda)\; G_f(\lambda)\, ] = \mathop{\mathrm{rank}} \, \left [ \begin{array}{cc} G_d(\lambda) & G_f(\lambda)\\ 0 & M_{rf}(\lambda) \end{array} \right ] \, . \end{equation} \end{theorem} \begin{remark} When $M_{rf}(\lambda)$ has full column rank $m_f$, the solvability condition (\ref{fdimmcond}) of the EMMP reduces to the strong isolability condition (\ref{fdistrong}) (see also Theorem~\ref{T-strongEFDIP}). {\ \hfill $\Box$} \end{remark} \begin{remark}\label{rem:gemm} It is possible to solve a slightly more general EMMP, to determine $Q(\lambda)$ and $M(\lambda)$ as before, such that, for given $M_r(\lambda) = [\, M_{ru}(\lambda)\; M_{rd}(\lambda)\; M_{rf}(\lambda)\; M_{rw}(\lambda\,]$, they satisfy \begin{equation}\label{emm:resys} {\arraycolsep=1mm Q(\lambda) \left [ \begin{array}{c|c|c|c} G_u(\lambda) & G_d(\lambda) & G_f(\lambda) & G_w(\lambda) \\ I_{m_u} & 0 & 0 & 0 \end{array} \right ] } = M(\lambda)\left [ \begin{array}{c|c|c|c} M_{ru}(\lambda) & M_{rd}(\lambda) & M_{rf}(\lambda) & M_{rw}(\lambda)\end{array} \right ] \, . \end{equation} This formulation may arise, for example, if $M_r(\lambda)$ is the internal form resulted from an approximate synthesis, for which $R_u(\lambda) \approx 0$, $R_d(\lambda) \approx 0$ and $R_w(\lambda) \approx 0$. The solvability condition is simply that for solving the linear system (\ref{emm:resys}) for $M(\lambda) = I$ \begin{equation}\label{gemm:fdimmcond} \hspace*{-4mm} \mathop{\mathrm{rank}}\, [\, G_d(\lambda)\; G_f(\lambda)\; G_w(\lambda)\, ] = \mathop{\mathrm{rank}} \, \left [ \begin{array}{ccc} G_d(\lambda) & G_f(\lambda) & G_w(\lambda)\\ M_{rd}(\lambda) & M_{rf}(\lambda) & M_{rw}(\lambda) \end{array} \right ] \, . \end{equation} {\ \hfill $\Box$} \end{remark} The solvability conditions (see Theorem \ref{T-EMMP}) become more involved if we strive for a stable proper solution $Q(\lambda)$ for a given reference model $M_{rf}(\lambda)$ without allowing its updating. For example, this is the case when solving the EFEP for $M_{rf}(\lambda) = I_{m_f}$. For a slightly more general case, we have the following result. \begin{theorem}\label{T-FEP} \index{model-matching problem!a@exact (EMMP)} \index{model-matching problem!a@exact fault estimation (EFEP)!solvability|ii} For the system (\ref{systemw}) with $w \equiv 0$ and a given stable and minimum-phase $M_{rf}(\lambda)$ of full column rank, the EMMP is solvable with $M(\lambda)= I$ if and only if the system is strongly fault isolable and $G_f(\lambda)$ is minimum phase. \end{theorem} \begin{remark} If $G_f(\lambda)$ has unstable or infinite zeros, the solvability of the EMMP with $M(\lambda) = I$ is possible provided $M_{rf}(\lambda)$ is chosen such that \begin{equation}\label{EMMP-stable} \left [ \begin{array}{cc} G_f(\lambda) & G_d(\lambda) \end{array} \right ] \text{ and } \left [ \begin{array}{cc} G_f(\lambda) & G_d(\lambda) \\ M_{rf}(\lambda) & 0 \end{array} \right ] \end{equation} have the same unstable zero structure. For this it is necessary that $M_{rf}(\lambda)$ has the same unstable and infinity zeros structure as $G_f(\lambda)$. {\ \hfill $\Box$}\end{remark} \subsubsection{AMMP -- Approximate Model-Matching Problem}\label{sec:AMMP} \index{model-matching problem!approximate (AMMP)|ii} \index{model-matching problem!a@exact (EMMP)} Similarly to the formulation of the EMMP, we include the determination of an updating factor of the reference model in the standard formulation of the \emph{approximate model-matching problem} (AMMP). Specifically, for a given stable and proper TFM $M_{rf}(\lambda)$, it is required to determine a stable and proper filter $Q(\lambda)$ and a diagonal, proper, stable and invertible TFM $M(\lambda)$ such that the following conditions are additionally fulfilled: \begin{equation}\label{afdip-mm} \begin{array}{ll} (iii) & R_f(\lambda) \approx M(\lambda)M_{rf}(\lambda), \;\; \textrm{with} \;\; R_f(\lambda) \;\; \textrm{stable};\\ (iv) & R_w(\lambda) \approx 0, \;\; \textrm{with} \;\; R_w(\lambda) \;\; \textrm{stable.} \end{array} \end{equation} The conditions $(iii)$ and $(iv)$ mean to simultaneously achieve that $\|R_f(\lambda) - M(\lambda)M_{rf}(\lambda)\| \approx 0$ and $\|R_w(\lambda)\| \approx 0$ (in some suitable norm). A sufficient condition for the solvability of AMMP is the solvability of the EMMP. \begin{proposition}\label{P-AMMP} \index{model-matching problem!a@exact (EMMP)!solvability} \index{model-matching problem!approximate (AMMP)!solvability|ii} For the system (\ref{systemw}) and a given $M_{rf}(\lambda)$, the AMMP is solvable if the EMMP is solvable. \end{proposition} \begin{remark}\label{rem:gamm} It is possible to formulate a more general AMMP, to determine $Q(\lambda)$ and $M(\lambda)$ as before, such that, for given $M_r(\lambda) = [\, M_{ru}(\lambda)\; M_{rd}(\lambda)\; M_{rf}(\lambda)\; M_{rw}(\lambda)\,]$, they satisfy \begin{equation}\label{amm:resys} {\arraycolsep=1mm Q(\lambda) \left [ \begin{array}{c|c|c|c} G_u(\lambda) & G_d(\lambda) & G_f(\lambda) & G_w(\lambda) \\ I_{m_u} & 0 & 0 & 0 \end{array} \right ] } \approx M(\lambda)\left [ \begin{array}{c|c|c|c} M_{ru}(\lambda) & M_{rd}(\lambda) & M_{rf}(\lambda) & M_{rw}(\lambda)\end{array} \right ] \, . \end{equation} {\ \hfill $\Box$}\end{remark} \subsection{Performance Evaluation of FDI Filters}\label{sec:FDIPerf} Let $Q(\lambda)$ be a FDI filter of the form (\ref{detec}), which solves one of the six formulated FDI problems in Section \ref{fdp}. Accordingly, in the internal form (\ref{resys}) of the filter, the transfer function matrices $R_u(\lambda)$ and $R_d(\lambda)$ are zero to fulfill the decoupling conditions (\ref{ens}), $R_f(\lambda)$ is a stable transfer function matrix with $m_f$ columns, whose zero/nonzero structure characterizes the fault detection and isolation properties, while $R_w(\lambda)$ will be generally assumed stable and nonzero. When solving fault detection and isolation problems with a targeted $n_b\times m_f$ structure matrix $S$, the filters $Q(\lambda)$, $R_f(\lambda)$ and $R_w(\lambda)$ have a row partitioned structure, resulted by stacking banks of $n_b$ filters as follows \begin{equation}\label{qbank-perfbl} Q(\lambda) = \left [ \begin{array}{c} Q^{(1)}(\lambda)\\ \vdots \\ Q^{(n_b)}(\lambda) \end{array} \right ] , \quad R_f(\lambda) = \left [ \begin{array}{c} R_f^{(1)}(\lambda)\\ \vdots \\ R_f^{(n_b)}(\lambda) \end{array} \right ], \quad R_w(\lambda) = \left [ \begin{array}{c} R_w^{(1)}(\lambda)\\ \vdots \\ R_w^{(n_b)}(\lambda) \end{array} \right ] .\end{equation} The transfer function matrix $R_f(\lambda)$ has a block structure as in (\ref{Rf_struct}), which allows to define the associated binary structure matrix $S_{R_f}$, whose $(i,j)$-th element is 1 if $R^{(i)}_{f_j}(\lambda) \not=0$ and 0 if $R^{(i)}_{f_j}(\lambda) \not=0$. If $S_{R_f}$ is the achieved structure matrix, then ideally $S_{R_f} = S$, but $S_{R_f}$ may also differ from $S$, as in the case of solving a \emph{soft} AFDIP (see Section \ref{sec:AFDIP}). \index{residual generation!for fault detection and isolation} \index{residual generator!internal form} The performance of the fault diagnosis system can be assessed using specific performance criteria, which can also serve for optimization-based tuning of various free parameters which intervene in the synthesis of FDI filters. In what follows we discuss three categories of performance criteria of which, the first one can be used to assess the fault detectability properties of the diagnosis system, the second one characterizes the noise attenuation properties and the third one characterizes the model-matching performance. In the case of block structured filters as in (\ref{qbank-perfbl}), specific performance measures are defined, taking into account the assumed ``ideal'' structure matrix associated with the zero and nonzero columns of $R_f^{(i)}(\lambda)$, which is provided in the $i$-th row of the targeted structure matrix $S$. \subsubsection{Fault Sensitivity Condition} \label{sec:fscond} \index{performance evaluation!fault detection and isolation!fault sensitivity condition} When solving fault detection problems, it is important to assess the sensitivity of the residual signal to individual fault components. The \emph{complete fault detectability} can be assessed by checking $R_{f_j}(\lambda) \neq 0$, for $j = 1, \ldots, m_f$. Alternatively, the assessment of complete fault detectability can be done by checking $\| R_{f}(\lambda) \|_{\infty -} > 0$, where \[ \| R_{f}(\lambda) \|_{\infty -} := \min_j \|R_{f_j}(\lambda)\|_\infty \] is the $\mathcal{H}_{\infty -}$-index defined in \cite{Varg17}, as a measure of the degree of complete fault detectability. If $\| R_{f}(\lambda) \|_{\infty -} = 0$, then an least one fault component is not detectable in the residual signal $r$. The assessment of the \emph{strong complete fault detectability} with respect to a set of frequencies contained in a set $\Omega$ comes down to check $R_{f_j}(\lambda_s) \neq 0$, for $\forall \lambda_s \in \Omega$ and for $j = 1, \ldots, m_f$. Alternatively, the assessment of strong complete fault detectability can be done by checking $\| R_{f}(\lambda) \|_{\Omega -} > 0$, where \[ \| R_{f}(\lambda) \|_{\Omega -} := \min_{j} \{ \inf_{\lambda_s \in \Omega} \|R_{f_j}(\lambda_s)\|_2 \} \] is the (modified) $\mathcal{H}_{\infty -}$-index defined over the frequencies contained in $\Omega$ (see \cite{Varg17}). Since nonzero values of $\| R_{f}(\lambda) \|_{\infty -}$ or $\| R_{f}(\lambda) \|_{\Omega -}$ are not invariant to scaling (e.g., when replacing $Q(\lambda)$ by $\alpha Q(\lambda)$), these quantities are less appropriate to quantitatively assess the degrees of complete detectability. A scaling independent measure of complete fault detectability is the \emph{fault sensitivity condition} defined (over all frequencies) as \[ J_{1} = \| R_{f}(\lambda) \|_{\infty -} / \max_j \|R_{f_j}(\lambda)\|_\infty. \] Similarly, scaling independent measure of the strong complete fault detectability is the \emph{fault sensitivity condition} defined (over the frequencies contained in $\Omega$) as \[ \widetilde J_{1} = \| R_{f}(\lambda) \|_{\Omega -} / \max_{j}\{ \sup_{\lambda_s \in \Omega} \|R_{f_j}(\lambda_s)\|_2 \}. \] For a completely fault detectable system $J_1$ satisfies \[ 0 < J_1 \leq 1 \] and for a strong completely fault detectable system $\widetilde J_1$ satisfies \[ 0 < \widetilde J_1 \leq 1 . \] A value of $J_1$ (or of $\widetilde J_1$) near to 1, indicates nearly equal sensitivities of residual to all fault components, and makes easier the choice of suitable thresholds for fault detection. On contrary, a small value of $J_1$ (or of $\widetilde J_1$) indicates potential difficulties in detecting some components of the fault vector, due to a very low sensitivity of the residual to these fault components. In such cases, employing fault detection filters with several outputs ($q > 1$) could be advantageous. When solving fault detection and isolation problems with a targeted structure matrix $S$, we obtain partitioned filters in the form (\ref{qbank-perfbl}) and we can define for each individual filter an associated fault condition number. Let $f^{(i)}$ be formed from the subset of faults corresponding to nonzero entries in the $i$-th row of $S$ and let $R_{f^{(i)}}^{(i)}(\lambda)$ be formed from the corresponding columns of $R_{f}^{(i)}(\lambda)$. To characterize the complete fault detectability of the subset of faults corresponding to nonzero entries in the $i$-th row of $S$ we can define the fault condition number of the $i$-th filter as \[ J_{1}^{(i)} = \big\| R_{f^{(i)}}^{(i)}(\lambda) \big\|_{\infty -} / \max_j \big\|R_{f_j}^{(i)}(\lambda)\big\|_\infty . \] Similarly, to characterize the strong complete fault detectability of the subset of faults corresponding to nonzero entries in the $i$-th row of $S$, we define the fault condition number of the $i$-th filter as \[ \widetilde J_{1}^{(i)} = \big\| R_{f^{(i)}}^{(i)}(\lambda) \big\|_{\Omega -} / \max_{j}\{ \sup_{\lambda_s \in \Omega} \big\|R_{f_j}^{(i)}(\lambda_s)\big\|_2 \} . \] \subsubsection{Fault-to-Noise Gap} \label{sec:f2ngap} \index{performance evaluation!fault detection and isolation!fault-to-noise gap} A performance criterion relevant to solve approximate fault detection problems is the \emph{fault-to-noise gap } defined as \[ J_2 = \| R_{f}(\lambda) \|_{\infty -} / \| R_{w}(\lambda) \|_{\infty} , \] which represents a measure of the noise attenuation property of the designed filter. By convention, $J_2 = 0$ if $\| R_{f}(\lambda) \|_{\infty -} = 0$ and $J_2 = \infty$ if $\| R_{f}(\lambda) \|_{\infty -} > 0$ and $\| R_{w}(\lambda) \|_{\infty} = 0$ (e.g., when solving exact synthesis problems without noise inputs). A finite frequency variant of the above criterion, which allows to address strong fault detectability aspects for a given set $\Omega$ of relevant frequencies is \[ \widetilde J_2 = \| R_{f}(\lambda) \|_{\Omega -} / \| R_{w}(\lambda) \|_{\infty} . \] The higher the value of $J_2$ (or $\widetilde J_2$), the easier is to choose suitable thresholds to be used for fault detection purposes in the presence of noise. Therefore, the maximization of the above gaps is a valuable goal in improving the fault detection capabilities of the fault diagnosis system in the presence of exogenous noise. For a partitioned filter in the form (\ref{qbank-perfbl}) and a targeted structure matrix $S$, we can define for the $i$-th filter component the associated value of the fault-to-noise gap, which characterizes the noise attenuation properties of the $i$-th filter. Let $f^{(i)}$ be formed from the subset of faults corresponding to nonzero entries in the $i$-th row of $S$ and let $\bar f^{(i)}$ be formed from the complementary subset of faults corresponding to zero entries in the $i$-th row of $S$. If $R_{f^{(i)}}^{(i)}(\lambda)$ and $R_{\bar f^{(i)}}^{(i)}(\lambda)$ are formed from the columns of $R_{f}^{(i)}(\lambda)$ corresponding to $f^{(i)}$ and $\bar f^{(i)}$, respectively, then the fault-to-noise gap of the $i$-th filter can be defined as \[ J_{2}^{(i)} = \big\| R_{f^{(i)}}^{(i)}(\lambda) \big\|_{\infty -} / \big\|\big[\, R_{\bar f^{(i)}}^{(i)}(\lambda) \; R_{w}^{(i)}(\lambda)\,\big]\big\|_\infty . \] This definition covers both the case of a \emph{soft} AFDIP as well as of a \emph{strict} AFDIP (see Section \ref{sec:AFDIP}). For a similar characterization of the strong complete fault detectability of the subset of faults corresponding to nonzero entries in the $i$-th row of $S$, we have \[ \widetilde J_{2}^{(i)} = \big\| R_{f^{(i)}}^{(i)}(\lambda) \big\|_{\Omega -} / \big\|\big[\, R_{\bar f^{(i)}}^{(i)}(\lambda) \; R_{w}^{(i)}(\lambda)\,\big]\big\|_\infty . \] \subsubsection{Model-matching performance} \label{sec:mmperf} \index{performance evaluation!fault detection and isolation!model-matching performance} A criterion suitable to characterize the solution of model-matching based syntheses is the residual error norm \[ J_3 = \big\| R(\lambda)- M(\lambda)M_r(\lambda)\big\|_{\infty/2}, \] where $R(\lambda) = [\, R_u(\lambda)\; R_d(\lambda)\; R_f(\lambda)\; R_w(\lambda) \,\,]$ is the resulting internal form (\ref{resys1}), $M_r(\lambda)$ is a desired reference model $M_r(\lambda) = [\, M_{ru}(\lambda)\; M_{rd}(\lambda)\; M_{rf}(\lambda)\; M_{rw}(\lambda)\,]$ and $M(\lambda)$ is an updating factor. When applied to the results computed by other synthesis approaches (e.g., to solve the EFDP, AFDP, EFDIP, the \emph{strict} AFDIP or EMMP), this criterion can be formulated as \[ \widetilde J_3 = \big\| R_w(\lambda)\big\|_{\infty/2}, \] which corresponds to assume that $M(\lambda) = I$ and $M_r(\lambda) = [\, R_u(\lambda)\; R_d(\lambda)\; R_f(\lambda)\; 0 \,]$ (i.e., a perfect matching of control, disturbance and fault channels is always achieved). In the case of solving an EFDIP or a \emph{strict} AFDIP, $R_w(\lambda)$ has the partitioned form in (\ref{qbank-perfbl}). For this case, we can define for the $i$-th filter component the associated model-matching performance $J_3^{(i)}$, characterizing the noise attenuation property of the $i$-th filter. $J_3^{(i)}$ is defined simply as \[ J_3^{(i)} := \big\|R_w^{(i)}(\lambda)\big\|_{\infty/2} .\] When solving a \emph{soft }AFDIP, we can use a more general definition, which also accounts for possibly no exact matching of a targeted structure matrix $S$ in the fault channel. Assuming the partitioned filter in the form (\ref{qbank-perfbl}) and a targeted structure matrix $S$, we build $\overline R_f^{(i)}(\lambda)$, with its $j$-th column defined as $\overline R_{f_j}^{(i)}(\lambda) := (1-S_{ij}) R_{f_j}^{(i)}(\lambda)$ (see also (\ref{afdip-rtb})). We can define the model matching performance criterion of the $i$-th component filter as \[ \widetilde J_3^{(i)} = \big\| \big[\, \overline R_f^{(i)}(\lambda) \, R_w^{(i)}(\lambda) \,\big] \big\|_{\infty/2}. \] In the case of solving an EFDIP or a \emph{strict} AFDIP, $\overline R_{f_j}^{(i)}(\lambda) = 0$, and therefore $\widetilde J_3^{(i)} = J_3^{(i)}$. \newpage \section{Model Detection Basics}\label{sec:MDBasics} In this section we describe first the basic model detection task and introduce and characterize the concept of model detectability. Two model detection problems are formulated in the book \cite{Varg17} relying on LTI multiple models. The formulated synthesis problems, involve the exact synthesis and the approximate synthesis of model detection filters. Jointly with the formulation of the model detection problems, general solvability conditions are given in terms of ranks of certain transfer function matrices. More details and the proofs of the results are available in Chapters 2 and 4 of \cite{Varg17}. \subsection{Basic Model Detection Task} \index{model detection} Multiple models which describe various fault situations have been frequently used for fault detection purposes. In such applications, the detection of the occurrence of a fault comes down to identifying, using the available measurements from the measurable outputs and control inputs, that model (from a collection of models) which best matches the dynamical behaviour of the faulty plant. The term \emph{model detection} describes the model identification task consisting of the selection of a model from a collection of $N$ models, which best matches the current dynamical behaviour of a plant. \index{model detection} \begin{figure}[thpb] \begin{center} \includegraphics[height=7.8cm]{varga_Fig_MDSystem.pdf} \vspace*{-2mm} \caption{Basic model detection setup.} \label{Fig_MDSystem} \end{center} \end{figure} A typical model detection setting is shown in Fig.~\ref{Fig_MDSystem}. A bank of $N$ residual generation filters (or residual generators) is used, with $r^{(i)}(t)$ being the output of the $i$-th residual generator. The $i$-th component $\theta_i$ of the $N$-dimensional evaluation vector $\theta$ usually represents an approximation of $\|r^{(i)}\|_2$, the $\mathcal{L}_2$- or $\ell_2$-norm of $r^{(i)}$. The $i$-th component of the $N$-dimensional decision vector $\iota$ is set to 0 if $\theta_i \leq \tau_i$ and 1 otherwise, where $\tau_i$ is a suitable threshold. The $j$-th model is ``detected'' if $\iota_j =0$ and $\iota_i =1$ for all $i \not = j$. It follows that model detection can be interpreted as a particular type of week fault isolation with $N$ signature vectors, where the $N$-dimensional $j$-th signature vector has all elements set to one, excepting the $j$-th entry which is set to zero. An alternative decision scheme can also be devised if $\theta_i$ can be associated with a distance function from the current model to the $i$-th model. In this case, $\iota$ is a scalar, set to $\iota = j$, where $j$ is the index for which $\theta_j = \min_{i=1:N} \theta_i$. Thus, the decision scheme selects that model $j$ which best fits with the current model characterized by the measured input and output data. The underlying synthesis techniques of model detection systems rely on multiple-model descriptions of physical fault cases. Since different degrees of performance degradations can be easily described via multiple models, model detection techniques have potentially the capability to address certain fault identification aspects too. \subsection{Multiple Physical Fault Models} \label{physfaultmodel} For physically modelled faults, each fault mode leads to a distinct model. Assume that we have $N$ LTI models describing the fault-free and faulty systems, and for $j = 1, \ldots , N$ the $j$-th model is specified in the input-output form \begin{equation}\label{systemi} {\mathbf{y}}^{(j)}(\lambda) = G_u^{(j)}(\lambda){\mathbf{u}}(\lambda) + G_d^{(j)}(\lambda){\mathbf{d}}^{(j)}(\lambda) + G_w^{(j)}(\lambda){\mathbf{w}}^{(j)}(\lambda), \end{equation}% where $y^{(j)}(t) \in \mathds{R}^{p}$ is the output vector of the $i$-th system with control input $u(t) \in \mathds{R}^{m_u}$, disturbance input $d^{(j)}(t) \in \mathds{R}^{m_d^{(j)}}$ and noise input $w^{(j)}(t) \in \mathds{R}^{m_w^{(j)}}$, and where $G_u^{(j)}(\lambda)$, $G_d^{(j)}(\lambda)$ and $G_w^{(j)}(\lambda)$ are the TFMs from the corresponding plant inputs to outputs. The significance of disturbance and noise inputs, and the basic difference between them, have already been discussed in Section~\ref{sec:additive_faults}. The state-space realizations corresponding to the multiple model (\ref{systemi}) are for $j = 1, \ldots , N$ of the form \begin{equation}\label{ssystemi-dvar} \begin{array}{rcl}E^{(j)}\lambda x^{(j)}(t) &=& A^{(j)}x^{(j)}(t) + B^{(j)}_u u(t) + B^{(j)}_d d^{(j)}(t) + B^{(j)}_w w^{(j)}(t) \, ,\\ y^{(j)}(t) &=& C^{(j)}x^{(j)}(t) + D^{(j)}_u u(t) + D^{(j)}_d d^{(j)}(t) + D^{(j)}_w w^{(j)}(t) \, , \end{array} \end{equation} where $x^{(j)}(t) \in \mathds{R}^{n^{(j)}}$ is the state vector of the $j$-th system and, generally, can have different dimensions for different systems. \index{faulty system model!physical} \index{faulty system model!multiple model} The multiple-model description represents a very general way to describe plant models with various faults. For example, {extreme} variations of parameters representing the so-called {parametric faults}, can be easily described by multiple models. \subsection{Residual Generation} \label{mdec_res} \index{residual generation!for model detection} Assume we have $N$ LTI models of the form (\ref{systemi}), for $j = 1, ..., N$, but the $N$ models originate from a common underlying system with $y(t) \in \mathds{R}^{p}$, the measurable output vector, and $u(t) \in \mathds{R}^{m_u}$, the known control input. Therefore, $y^{(j)}(t) \in \mathds{R}^p$ is the output vector of the $j$-th system with the control input $u(t) \in \mathds{R}^{m_u}$, disturbance input $d^{(j)}(t) \in \mathds{R}^{m_d^{(j)}}$ and noise input $w^{(j)}(t) \in \mathds{R}^{m_w^{(j)}}$, respectively, and $G_u^{(j)}(\lambda)$, $G_d^{(j)}(\lambda)$ and $G_w^{(j)}(\lambda)$ are the TFMs from the corresponding plant inputs to outputs. We explicitly assumed that all models are controlled with the same control inputs $u(t)$, but the disturbance and noise inputs $d^{(j)}(t)$ and $w^{(j)}(t)$, respectively, may differ for each component model. For complete generality of our problem formulations, we will allow that these TFMs are general rational matrices (proper or improper) for which we will not \emph{a priori} assume any further properties. \index{residual generator!implementation form} Residual generation for model detection is performed using $N$ linear residual generators, which process the measurable system outputs $y(t)$ and known control inputs $u(t)$ and generate $N$ residual signals $r^{(i)}(t)$, $i = 1, \ldots, N$, which serve for decision making on which model best matches the current input-output measurement data. As already mentioned, model detection can be interpreted as a week fault isolation problem with an $N\times N$ structure matrix $S$ having all its elements equal to one, excepting those on its diagonal which are zero. The task of model detection is thus to find out the model which best matches the measurements of outputs and inputs, by comparing the resulting decision vector $\iota$ with the set of signatures associated to each model and coded in the columns of $S$. The $N$ residual generation filters in their implementation form are described for $i=1, \ldots, N$, by the input-output relations \begin{equation}\label{detecmi} {\mathbf{r}}^{(i)}(\lambda) = Q^{(i)}(\lambda)\left [ \begin{array}{c} {\mathbf{y}}(\lambda)\\{\mathbf{u}}(\lambda)\end{array} \right ] \, ,\end{equation} where $y$ and $u$ is the \emph{actual} measured system output and control input, respectively. The TFMs $Q^{(i)}(\lambda)$, for $i = 1, \ldots, N$, must be proper and stable. The dimension $q_i$ of the residual vector component $r^{(i)}(t)$ can be chosen always one, but occasionally values $q_i > 1$ may provide better sensitivity to model mismatches. \index{residual generator!internal form} Assuming $y(t) = y^{(j)}(t)$, the residual signal component $r^{(i)}(t)$ in (\ref{detecmi}) generally depends on all system inputs $u(t)$, $d^{(j)}(t)$ and $w^{(j)}(t)$ via the system output $y^{(j)}(t)$. The \emph{internal form} of the $i$-th filter driven by the $j$-th model is obtained by replacing in (\ref{detecmi}) ${\mathbf{y}}(\lambda)$ with ${\mathbf{y}}^{(j)}(\lambda)$ from (\ref{systemi}). To make explicit the dependence of $r^{(i)}$ on the $j$-th model, we will use $\widetilde r^{(i,j)}$, to denote the $i$-th residual output for the $j$-th model. After replacing in (\ref{detecmi}) ${\mathbf{y}}(\lambda)$ with ${\mathbf{y}}^{(j)}(\lambda)$ from (\ref{systemi}), we obtain \begin{equation}\label{ri_internal} \begin{array}{lrl} {\widetilde{\mathbf{r}}}^{(i,j)}(\lambda) &:=& R^{(i,j)}(\lambda) \left [ \begin{array}{c}{\mathbf{u}}(\lambda) \\ {\mathbf{d}}^{(j)}(\lambda)\\ {\mathbf{w}}^{(j)}(\lambda)\end{array} \right ] \\ \\[-2mm] &=& R_u^{(i,j)}(\lambda){\mathbf{u}}(\lambda) + R_d^{(i,j)}(\lambda){\mathbf{d}}^{(j)}(\lambda) + R_w^{(i,j)}(\lambda){\mathbf{w}}^{(j)}(\lambda) \, , \end{array} \end{equation} with $R^{(i,j)}(\lambda) := \left [ \begin{array}{c|c|c} R_u^{(i,j)}(\lambda) & R_d^{(i,j)}(\lambda)&R_w^{(i,j)}(\lambda)\end{array} \right ]$ defined as \begin{equation}\label{ri_internal1} \left [ \begin{array}{c|c|c} R_u^{(i,j)}(\lambda) & R_d^{(i,j)}(\lambda)&R_w^{(i,j)}(\lambda)\end{array} \right ] := Q^{(i)}(\lambda)\left [ \begin{array}{c|c|c} G_u^{(j)}(\lambda) & G_d^{(j)}(\lambda) & G_w^{(j)}(\lambda) \\ I_{m_u} & 0 & 0 \end{array} \right ] \, .\end{equation} For a successfully designed set of filters $Q^{(i)}(\lambda)$, $i = 1, \ldots, N$, the corresponding internal representations $R^{(i,j)}(\lambda)$ in (\ref{ri_internal}) are also a proper and stable. \subsection{Model Detectability} \label{sec:mdetectability} \index{model detectability} The concept of model detectability concerns with the sensitivity of the components of the residual vector to individual models from a given collection of models. Assume that we have $N$ models, with the $j$-th model specified in the input-output form (\ref{systemi}). For the discussion of the model detectability concept we will assume that no noise inputs are present in the models (\ref{systemi}) (i.e., $w^{(j)} \equiv 0$ for $j=1,\ldots,N$). For model detection purposes, $N$ filters of the form (\ref{detecmi}) are employed. It follows from (\ref{ri_internal}) that the $i$-th component $r^{(i)}$ of the residual $r$ is sensitive to the $j$-th model provided \begin{equation}\label{mmdetec} R^{(i,j)}(\lambda) :=\left [ \begin{array}{cc} R_u^{(i,j)}(\lambda) & R_d^{(i,j)}(\lambda) \end{array} \right ] \not = 0 \, . \end{equation} This condition involves the use of both control and disturbance inputs for model detection and can be useful even in the case of absence of control inputs. For most of practical applications, it is however necessary to be able to perform model detection also in the (unlikely) case when the disturbance inputs are zero. Therefore, to achieve model detection independently of the presence or absence of disturbances, it is meaningful to impose instead (\ref{mmdetec}), the stronger condition \begin{equation}\label{mmdetecr} R_u^{(i,j)}(\lambda) \not = 0 \, . \end{equation} This condition involves the use of only control inputs for model detection purposes and is especially relevant to active methods for model detection based on employing special inputs to help the discrimination between models. Depending on which of the condition (\ref{mmdetec}) or (\ref{mmdetecr}) are relevant for a particular model detection application, we define the following two concepts of model detectability. \index{model detectability!extended} \begin{definition}\label{emdetectability} The multiple model defined by the $N$ component systems (\ref{systemi}) with $w^{(j)} \equiv 0$ for $j = 1, \ldots, N$, is \emph{extended model detectable} if there exist $N$ filters of the form (\ref{detecmi}), such that $R^{(i,j)}(\lambda)$ defined in (\ref{mmdetec}) fulfills $R^{(i,i)}(\lambda) = 0$ for $i = 1, \ldots, N$ and $R^{(i,j)}(\lambda)\not= 0$ for all $i,j = 1,\ldots,N$ such that $i\not=j$. \end{definition} \begin{definition}\label{mdetectability} The multiple model defined by the $N$ component systems (\ref{systemi}) with $w^{(j)} \equiv 0$ for $j = 1, \ldots, N$, is \emph{model detectable} if there exist $N$ filters of the form (\ref{detecmi}), such that $R^{(i,j)}(\lambda)$ defined in (\ref{mmdetec}) fulfills $R^{(i,i)}(\lambda) = 0$ for $i = 1, \ldots, N$ and $R_u^{(i,j)}(\lambda)\not= 0$ for all $i,j = 1,\ldots,N$ such that $i\not=j$. \end{definition} \noindent The Definition \ref{mdetectability} of model detectability involves the usage of only the control inputs for model detection purpose, and therefore implies the more general property of extended model detectability in Defintion \ref{emdetectability}. In the case of lack of disturbance inputs, the two definitions coincide.\\ The following result, proven in \cite{Varg17}, characterizes the extended model detectability property. \begin{theorem} \label{model_detectability} The multiple model defined by the $N$ component systems (\ref{systemi}) with $w^{(j)} \equiv 0$ for $j = 1, \ldots, N$, is \emph{extended model detectable} if and only if for $i = 1, \ldots, N$ \begin{equation}\label{mmdetectability} \mathop{\mathrm{rank}}\, [\, G_d^{(i)}(\lambda)\;\; G_d^{(j)}(\lambda)\;\; G_u^{(i)}(\lambda)\!-\!G_u^{(j)}(\lambda)\, ] > \mathop{\mathrm{rank}}\, G_d^{(i)}(\lambda) \;\; \forall j \not = i \, . \end{equation} \end{theorem} The characterization of model detectability (using only control inputs) can be simply established as a corollary of this theorem. \begin{theorem} \label{model_detectabilityr} The multiple model defined by the $N$ component systems (\ref{systemi}) with $w^{(j)} \equiv 0$ for $j = 1, \ldots, N$, is model detectable if and only if for $i = 1, \ldots, N$ \begin{equation}\label{mmrdetectability} \mathop{\mathrm{rank}}\, [\, G_d^{(i)}(\lambda)\;\; G_u^{(i)}(\lambda)\!-\!G_u^{(j)}(\lambda)\, ] > \mathop{\mathrm{rank}}\, G_d^{(i)}(\lambda) \;\; \forall j \not = i \, . \end{equation} \end{theorem} We can also define the concepts of strong model detectability and strong extended model detectability with respect to classes of persistent control inputs characterized by a set of complex frequencies $\Omega \subset \partial\mathds{C}_s$. The following definitions formalize the aim that for each model $j$, there exists at least one excitation signal class characterized by a frequency $\lambda_z \in \Omega$ for which all residual components $r^{(i)}(t)$ for $i\neq j$ are asymptotically nonzero and $r^{(j)}(t)$ asymptotically vanishes. \index{model detectability!strong} \begin{definition}\label{smdetectability} The multiple model defined by the $N$ component systems (\ref{systemi}) with $w^{(j)} \equiv 0$ for $j = 1, \ldots, N$, is \emph{strong model detectable} with respect to a set of frequencies $\Omega \subset \partial\mathds{C}_s$ if there exist $N$ stable filters of the form (\ref{detecmi}), such that $R^{(i,j)}(\lambda)$ defined in (\ref{mmdetec}) fulfills $R^{(i,i)}(\lambda) = 0$ for $i = 1, \ldots, N$ and for all $i,j = 1,\ldots,N$ with $i\not=j$, $\exists$ $\lambda_z \in \Omega$ such that $R_u^{(i,j)}(\lambda_z)\not= 0$. \end{definition} \index{model detectability!strong} \begin{definition}\label{smdetectability-ext} The multiple model defined by the $N$ component systems (\ref{systemi}) with $w^{(j)} \equiv 0$ for $j = 1, \ldots, N$, is \emph{strong extended model detectable} with respect to a set of frequencies $\Omega \subset \partial\mathds{C}_s$ if there exist $N$ stable filters of the form (\ref{detecmi}), such that $R^{(i,j)}(\lambda)$ defined in (\ref{mmdetec}) fulfills $R^{(i,i)}(\lambda) = 0$ for $i = 1, \ldots, N$ and for all $i,j = 1,\ldots,N$ with $i\not=j$, $\exists$ $\lambda_z \in \Omega$ such that $R^{(i,j)}(\lambda_z)\not= 0$. \end{definition} The following results characterize the strong model detectability property and, respectively, the strong extended model detectability property. \begin{theorem} \label{model_stmdetectability} Let $\Omega \subset \partial\mathds{C}_s$ be a given set of frequencies, such that none of $\lambda_z \in \Omega$ is a pole of any of the component system (\ref{systemi}), for $j = 1, \ldots, N$. Then, the multiple model (\ref{systemi}) with $w^{(j)} \equiv 0$ for $j = 1, \ldots, N$, is strong model detectable with respect to $\Omega$ if and only if for $i = 1, \ldots, N$ \begin{equation}\label{mmsdetectability} \forall j \not = i, \exists \lambda_z \in \Omega \text{ such that } \mathop{\mathrm{rank}}\, [\, G_d^{(i)}(\lambda_z)\;\; G_u^{(i)}(\lambda_z)\!-\!G_u^{(j)}(\lambda_z)\, ] > \mathop{\mathrm{rank}}\, G_d^{(i)}(\lambda_z) \, . \end{equation} \end{theorem} \begin{theorem} \label{model_stmdetectability-ext} Let $\Omega \subset \partial\mathds{C}_s$ be a given set of frequencies, such that none of $\lambda_z \in \Omega$ is a pole of any of the component system (\ref{systemi}), for $j = 1, \ldots, N$. Then, the multiple model (\ref{systemi}) with $w^{(j)} \equiv 0$ for $j = 1, \ldots, N$, is strong model detectable with respect to $\Omega$ if and only if for $i = 1, \ldots, N$ \begin{equation}\label{mmsdetectability-ext} \forall j \not = i, \exists \lambda_z \in \Omega \text{ such that } \mathop{\mathrm{rank}}\, \big[\, G_d^{(i)}(\lambda_z)\;\; G_d^{(j)}(\lambda_z)\;\; G_u^{(i)}(\lambda_z)\!-\!G_u^{(j)}(\lambda_z)\, \big] > \mathop{\mathrm{rank}}\, G_d^{(i)}(\lambda_z) \, . \end{equation} \end{theorem} \subsection{Model Detection Problems} \label{mdp} In this section we formulate the exact and approximate synthesis problems of model detection filters for the collection of $N$ LTI systems (\ref{systemi}). As in the case of the EFDIP or AFDIP, we seek $N$ linear residual generators (or model detection filters) of the form (\ref{detecmi}), which process the measurable system outputs $y(t)$ and known control inputs $u(t)$ and generate the $N$ residual signals $r^{(i)}(t)$ for $i = 1, \ldots, N$. These signals serve for decision-making by comparing the pattern of fired and not fired residuals with the signatures coded in the columns of the associated standard $N\times N$ structure matrix $S$ with zeros on the diagonal and ones elsewhere. The standard requirements for the TFMs of the filters $Q^{(i)}(\lambda)$ in (\ref{detecmi}) are \emph{properness} and \emph{stability}. For practical purposes, the orders of the filter $Q^{(i)}(\lambda)$ must be as small as possible. Least order filters $Q^{(i)}(\lambda)$ can be usually achieved by employing scalar output least order filters. In analogy to the formulations of the EFDIP and AFDIP, we use the internal form of the $i$-th residual generator (\ref{ri_internal}) to formulate the basic model detection requirements. Independently of the presence of the noise inputs $w^{(j)}$, we will target that the $i$-th residual is exactly decoupled from the $i$-th model if $w^{(i)} \equiv 0$ and is sensitive to the $j$-th model, for all $j \not = i$. These requirements can be easily translated into algebraic conditions using the internal form (\ref{ri_internal}) of the $i$-th residual generator. If both control and disturbance inputs are involved in the model detection then the following conditions have to be fulfilled \begin{equation}\label{EMDPe} \begin{array}{ll} (i) & [\, R_u^{(i,i)}(\lambda) \;\; R_d^{(i,i)}(\lambda)\,] = 0 , \;\; i = 1,\ldots, N \, ,\\ (ii) & [\, R_u^{(i,j)}(\lambda) \;\; R_d^{(i,j)}(\lambda)\,] \not = 0, \;\; \forall j \not = i, \text{ with } [\, R_u^{(i,j)}(\lambda) \;\; R_d^{(i,j)}(\lambda)\,] \text{ stable.} \end{array} \end{equation} while if only control inputs have to be employed for model detection, then the following conditions have to be fulfilled \begin{equation}\label{EMDP} \begin{array}{ll} (i) & [\, R_u^{(i,i)}(\lambda) \;\; R_d^{(i,i)}(\lambda)\,] = 0 , \;\; i = 1,\ldots, N \, ,\\ (ii)' & R_u^{(i,j)}(\lambda) \not = 0, \;\; \forall j \not = i, \text{ with } [\, R_u^{(i,j)}(\lambda) \;\; R_d^{(i,j)}(\lambda)\,] \text{ stable.} \end{array} \end{equation} Here, $(i)$ is the \emph{model decoupling condition} for the $i$-th model in the $i$-th residual component, while $(ii)$ and $(ii)'$ are the \emph{model sensitivity condition} of the $i$-th residual component to all models, excepting the $i$-th model. In the case when condition $(i)$ cannot be fulfilled (e.g., due to lack of sufficient measurements), some (or even all) components of $d^{(i)}(t)$ can be redefined as noise inputs and included in $w^{(i)}(t)$. In what follows, we formulate the exact and approximate model detection problems, for which we give the existence conditions of the solutions. For the proof of the results consult \cite{Varg17}. \subsubsection{EMDP -- Exact Model Detection Problem}\label{sec:EMDP} \index{model detection problem!a@exact (EMDP)|ii} The standard requirement for solving the \emph{exact model detection problem} (EMDP) is to determine for the multiple model (\ref{systemi}), in the absence of noise input (i.e., $w^{(j)}\equiv 0$ for $j=1,\ldots, N$), a set of $N$ proper and stable filters $Q^{(i)}(\lambda)$ such that, for $i = 1, \ldots, N$, the conditions (\ref{EMDPe}) or (\ref{EMDP}) are fulfilled. These conditions are similar to the model detectability requirement and lead to the following solvability condition: \begin{theorem}\label{T-EMDPe} \index{model detection problem!a@exact (EMDP)!solvability|ii} For the multiple model (\ref{systemi}) with $w^{(j)}\equiv 0$ for $j=1,\ldots, N$, the EMDP is solvable with conditions (\ref{EMDPe}) if and only if the multiple model (\ref{systemi}) is extended model detectable. \end{theorem} \begin{theorem}\label{T-EMDP} \index{model detection problem!a@exact (EMDP)!solvability|ii} For the multiple model (\ref{systemi}) with $w^{(j)}\equiv 0$ for $j=1,\ldots, N$, the EMDP is solvable with conditions (\ref{EMDP}) if and only if the multiple model (\ref{systemi}) is model detectable. \end{theorem} \index{model detection problem!a@exact (EMDP) with strong model detectability|ii} Let $\Omega \subset \partial\mathds{C}_s$ be a given set of frequencies which characterize the relevant persistent input and disturbance signals. We can give a similar result in the case when the EMDP is solved, by replacing the condition $(ii)'$ in (\ref{EMDP}), with the \emph{strong model detection condition}: \begin{equation}\label{emdps} (ii)'' \;\;\forall j \not = i, \;\; \exists \lambda_z \in \Omega \text{ such that } R_u^{(i,j)}(\lambda_z) \not = 0, \;\; \text{ with } [\, R_u^{(i,j)}(\lambda) \;\; R_d^{(i,j)}(\lambda)\,] \text{ stable.} \end{equation} \index{model detection problem!a@exact (EMDP) with strong model detectability!solvability|ii} The solvability condition of the EMDP with the strong model detection condition above is precisely the strong model detectability requirement as stated by the following theorem. \begin{theorem}\label{T-EMDPS} Let $\Omega$ be the set of frequencies which characterize the persistent control input signals. For the multiple model (\ref{systemi}) with $w^{(j)}\equiv 0$ for $j=1,\ldots, N$, the EMDP with the strong model detectability condition (\ref{emdps}) is solvable if and only if the multiple model (\ref{systemi}) is strong model detectable. \end{theorem} A similar result holds when targeting the strong extended model detectability property. \subsubsection{AMMP -- Approximate Model Detection Problem}\label{sec:AMDP} \index{model detection problem!approximate (AMDP)|ii} The effects of the noise input $w^{(i)}(t)$ can usually not be fully decoupled from the residual $r^{(i)}(t)$. In this case, the basic requirements for the choice of $Q^{(i)}(\lambda)$ can be expressed as achieving that the residual $r^{(i)}(t)$ is influenced by all models in the multiple model (\ref{systemi}), while the influence of the $i$-th model is only due to the noise signal $w^{(i)}(t)$ and is negligible. Using the internal form (\ref{ri_internal}) of the $i$-th residual generator, for the \emph{approximate model detection problem} (AMDP) the following additional conditions to (\ref{EMDPe}) or (\ref{EMDP}) have to be fulfilled: \begin{equation}\label{amdp} \begin{array}{ll} (iii) & R_{w}^{(i,i)}(\lambda) \approx 0 ,\;\; \textrm{with} \;\; R_{w}^{(i,i)}(\lambda) \;\; \textrm{stable;} \\ (iv) & R_{w}^{(i,j)}(\lambda) \;\; \textrm{stable} \; \forall j \not = i. \end{array} \end{equation} Here, $(iii)$ is the \emph{attenuation condition} of the noise input. The solvability conditions of the AMDP are precisely those of the EMDP: \index{model detection problem!a@exact (EMDP)!solvability|ii} \begin{theorem}\label{T-AMDP}\index{model detection problem!approximate (AMDP)!solvability|ii} For the multiple model (\ref{systemi}) the AMDP is solvable if and only the EMDP is solvable. \end{theorem} \subsection{Analysis and Performance Evaluation of Model Detection Filters} \label{sec:mdanalperf} \subsubsection{Distances between Models} \label{sec:mdnugap} \index{model detection!$\nu$-gap distances} For the setup of model detection applications, an important first step is the selection of a representative set of component models to serve for the design of model detection filter. A practical requirement to set up multiple models as in (\ref{systemi}) or (\ref{ssystemi-dvar}) is to choose a set of component models, such that, each component model is sufficiently far away of the rest of models. A suitable tool to measure the distance between two models is the $\nu$-gap metric introduced in \cite{Vinn93}. For two transfer function matrices $G_1(\lambda)$ and $G_2(\lambda)$ of the same dimensions, consider the normalized left coprime factorization $G_1(\lambda) = \widetilde M_1^{-1}(\lambda)\widetilde N_1(\lambda)$ (i.e., $\big [\, \widetilde N_1(\lambda) \; \widetilde M_1(\lambda)\,\big]$ is \emph{coinner}) and the normalized right coprime factorizations $G_1(\lambda) = N_1(\lambda)M_1^{-1}(\lambda)$ and $G_2(\lambda) = N_2(\lambda)M_2^{-1}(\lambda)$ (i.e., $\left[\begin{smallmatrix} N_i(\lambda) \\M_1(\lambda)\end{smallmatrix}\right]$ is \emph{inner} for $i = 1, 2$). With $\widetilde L_2(\lambda) := [\,-\widetilde M_2(\lambda) \; \widetilde N_2(\lambda)\,]$, $R_i(\lambda) := \left[ \begin{smallmatrix} N_i(\lambda) \\ M_i(\lambda) \end{smallmatrix}\right]$ for $i = 1, 2$, and $g(\lambda) := \det\big(R_2^\sim(\lambda) R_1(\lambda)\big)$, we have the following definition of the $\nu$-gap metric between the two transfer-function matrices: \begin{equation}\label{nugap} \delta_\nu(G_1(\lambda),G_2(\lambda)) := \left\{ \begin{array}{cl} \big\| \widetilde L_2(\lambda)R_1(\lambda) \big\|_\infty & \text{if } g(\lambda) \neq 0 \; \forall \lambda \in \partial\mathds{C}_s \text{ and } \mathop{\mathrm{wno}}(g) = 0 ,\\ 1 & \text{otherwise} , \end{array}\right. \end{equation} where $\mathop{\mathrm{wno}}(g)$ denotes the \emph{winding number} of $g(\lambda)$ about the appropriate critical point for $\lambda$ following the corresponding standard Nyquist contour. \index{transfer function!winding number}% The winding number of $g(\lambda)$ can be determined as the difference between the number of unstable zeros of $g(\lambda)$ and the number of unstable poles of $g(\lambda)$ \cite{Vidy11}. Generally, for any $G_1(\lambda)$ and $G_2(\lambda)$, we have $0 \leq \delta_\nu(G_1(\lambda),G_2(\lambda))\leq 1$. If $\delta_\nu\big(G_1(\lambda),G_2(\lambda)\big)$ is small, then we can say that $G_1(\lambda)$ and $G_2(\lambda)$ are close and it is likely that a model detection filter suited for $G_1(\lambda)$ will also work with $G_2(\lambda)$, and therefore, one of the two models can be probably removed from the set of component models. On the other side, if $\delta_\nu\big(G_1(\lambda),G_2(\lambda)\big)$ is nearly equal to 1, then $G_1(\lambda)$ and $G_2(\lambda)$ are sufficiently distinct, such that an easy discrimination between the two models is possible. A common criticism of the $\nu$-gap metric is that there are many transfer function matrices $G_2(\lambda)$ at a distance $\delta_\nu\big(G_1(\lambda),G_2(\lambda)\big) = 1$ to a given $G_1(\lambda)$, but the metric fails to differentiate between them. However, this aspect should not rise difficulties in model detection applications. In \cite{Vinn01}, the point-wise $\nu$-gap metric is also defined to evaluate the distance between two models in a single frequency point. If $\lambda_k$ is a fixed complex frequency, then the point-wise $\nu$-gap metric between two transfer-function matrices $G_1(\lambda)$ and $G_2(\lambda)$ at the frequency $\lambda_k$ is: \begin{equation}\label{nugap-pointwise} \delta_\nu(G_1(\lambda_k),G_2(\lambda_k)) := \left\{ \begin{array}{cl} \big\| \widetilde L_2(\lambda_k)R_1(\lambda_k) \big\|_2 & \text{if } g(\lambda) \neq 0 \; \forall \lambda \in \partial\mathds{C}_s \text{ and } \mathop{\mathrm{wno}}(g) = 0 ,\\ 1 & \text{otherwise} , \end{array}\right. \end{equation} For a set of $N$ component models with input-output forms as in (\ref{systemi}), it is useful to determine the pairwise $\nu$-gap distances between the control input channels of the component models by defining the symmetric matrix $\Delta$, whose $(i,j)$-th entry is the $\nu$-gap distance between the transfer-function matrices of the $i$-th and $j$-th model \begin{equation}\label{Delta_nu-gaps} \Delta_{ij} := \delta_\nu\big(G_u^{(i)}(\lambda),G_u^{(j)}(\lambda)\big) . \end{equation} It follows that $\Delta$ has all its diagonal elements zero. For model detection applications all off-diagonal elements of $\Delta$ must be nonzero, otherwise there are models which can not be potentially discriminated. The definition (\ref{Delta_nu-gaps}) of the distances between the $i$-th and $j$-th models focuses only on the control input channels. In most of practical applications of the model detection, this is perfectly justified by the fact that, a certain control activity is always necessary, to ensure reliable discrimination among models, independently of the presence or absence of disturbances. However, if the disturbance inputs are relevant to perform model detection (e.g., there are no control inputs), and all component models share the same disturbance inputs (i.e., $d^{(j)}(t) = d(t)$ for $j = 1, \ldots, N$), then the definition of $\Delta$ in (\ref{Delta_nu-gaps}) can be modified to include the disturbance inputs as well \begin{equation}\label{Delta_nu-gaps-ext} \Delta_{ij} := \delta_\nu\big(\big[\,G_u^{(i)}(\lambda)\;G_d^{(i)}(\lambda)\,\big], \big[\,G_u^{(j)}(\lambda)\;G_d^{(j)}(\lambda)\,\big]\big) . \end{equation} If $\lambda_k$, $k = 1, \ldots, n_f$, is a set of $n_f$ frequency values, then, instead (\ref{Delta_nu-gaps}), we can use the maximum of the point-wise distances \[ \Delta_{ij} := \max_k\delta_\nu\big(G_u^{(i)}(\lambda_k),G_u^{(j)}(\lambda_k)\big) ,\] and similarly, instead (\ref{Delta_nu-gaps-ext}), we can use the maximum of the point-wise distances \[ \Delta_{ij} := \max_k\delta_\nu\big(\big[\,G_u^{(i)}(\lambda_k)\;G_d^{(i)}(\lambda_k)\,\big], \big[\,G_u^{(j)}(\lambda_k)\;G_d^{(j)}(\lambda_k)\,\big]\big) .\] \index{model detection!$\mathcal{H}_\infty$-norm distances} \index{model detection!$\mathcal{H}_2$-norm distances} Besides the $\nu$-gap distance between two transfer function matrices, it is possible to use distances defined in terms of the $\mathcal{H}_\infty$ norm or the $\mathcal{H}_2$ norm of the difference between them. Thus we can use instead (\ref{Delta_nu-gaps}) \[ \Delta_{ij} := \big\|G_u^{(i)}(\lambda)-G_u^{(j)}(\lambda)\big\|_\infty \] or \[ \Delta_{ij} := \big\|G_u^{(i)}(\lambda)-G_u^{(j)}(\lambda)\big\|_2. \] If $\lambda_k$, $k = 1, \ldots, n_f$, is a set of $n_f$ frequency values, then, instead of the above norm-based distances, we can use the maximum of the point-wise distances \[ \Delta_{ij} := \max_k\big\|G_u^{(i)}(\lambda_k)-G_u^{(j)}(\lambda_k)\big\|_2. \] \subsubsection{Distances to a Current Model} \label{sec:mddist2c} \index{model detection!$\nu$-gap distances} An important aspect which arises in model detection applications, where the use of $\nu$-gap metric could be instrumental, is to assess the nearness of a current model, with the input-output form \begin{equation}\label{systemref} {\mathbf{y}}(\lambda) = \widetilde G_u(\lambda){\mathbf{u}}(\lambda) + \widetilde G_d(\lambda){\mathbf{d}}(\lambda) + \widetilde G_w(\lambda){\mathbf{w}}(\lambda), \end{equation}% to the component models in (\ref{systemi}). This involves evaluating, for $j = 1, \ldots, N$, the distances between the control input channels of the models (\ref{systemi}) and (\ref{systemref}) as \begin{equation}\label{dist_nu_gap} \eta_j := \delta_\nu\big(G_u^{(j)}(\lambda),\widetilde G_u(\lambda)\big) . \end{equation} It is also of interest to determine the index $\ell$ of that component model for which $\eta_\ell$ is the least distance. This allows to assign the model (\ref{systemref}) to the (open) set of nearby models to the $\ell$-th component model and can serve for checking the preservation of this property by the mapping achieved by the model detection filters via the norms of internal forms $R_u^{(i,j)}(\lambda)$ in (\ref{ri_internal}). If the disturbance inputs are also relevant to the model detection application, then a similar extension as above is possible to assess the distances between a current model and a set of component models by redefining $\eta_j$ in (\ref{dist_nu_gap}) as \begin{equation}\label{dist_nu_gap_ext} \eta_j := \delta_\nu\big(\big[\,G_u^{(j)}(\lambda)\;G_d^{(j)}(\lambda)\,\big], \big[\,\widetilde G_u(\lambda)\;\widetilde G_d(\lambda)\,\big]\big) . \end{equation} As before, we can alternatively use distances defined in terms of the $\mathcal{H}_\infty$ norm or the $\mathcal{H}_2$ norm. Thus, instead (\ref{dist_nu_gap}), we can use \[ \eta_j := \big\|G_u^{(j)}(\lambda)-\widetilde G_u(\lambda)\big\|_\infty \] or \[ \eta_j := \big\|G_u^{(j)}(\lambda)-\widetilde G_u(\lambda)\big\|_2 . \] If $\lambda_k$, $k = 1, \ldots, n_f$, is a given set of $n_f$ frequency values, then, instead of the above peak distances, we can use the maximum of the point-wise distances over the finite set of frequency values. \subsubsection{Distance Mapping Performance } \label{sec:mdperf} \index{model detection!distance mapping} \index{performance evaluation!model detection!distance mapping} One of the goals of the model detection is to achieve a special mapping of the distances between component models using $N$ model detection filters of the form (\ref{detecmi}) such that the norms of the transfer-function matrices $R_u^{(i,j)}(\lambda)$ or of $\big[\, R_u^{(i,j)}(\lambda)\; R_d^{(i,j)}(\lambda)\,\big]$ in the internal forms of the filters (\ref{ri_internal}) qualitatively reproduce the $\nu$-gap distances expressed by the $\Delta$ matrix, whose $(i,j)$-th entries are defined in (\ref{Delta_nu-gaps}) or (\ref{Delta_nu-gaps-ext}, respectively. The preservation of this distance mapping property is highly desirable, and the choice of model detection filters must be able to ensure this feature (at least partially for the nearest models). For example, the choice of the $i$-th filter $Q^{(i)}(\lambda)$ as a left annihilator of $\left[\begin{smallmatrix} G_u^{(i)}(\lambda) & G_d^{(i)}(\lambda) \\ I_{m_u} & 0 \end{smallmatrix}\right]$ ensures (see \cite[Remark 6.1]{Varg17}) that norm of $\big[\, R_u^{(i,j)}(\lambda)\; R_u^{(i,j)}(\lambda)\,\big]$ can be interpreted as a weighted distance between the $i$-th and $j$-th component models. It follows that the distance mapping performance of a set of model detection filters $Q^{(i)}(\lambda)$, $i = 1, \ldots, N$ can be assessed by computing mapped distance matrix $\Gamma$, whose $(i,j)$-th entry is \begin{equation}\label{mapdist} \Gamma_{ij} = \big\| R_u^{(i,j)}(\lambda) \big\|_\infty \end{equation} or, if the disturbance inputs are relevant, \begin{equation}\label{mapdist-ext} \Gamma_{ij} = \big\| \big[\, R_u^{(i,j)}(\lambda)\; R_d^{(i,j)}(\lambda)\,\big]\big\|_\infty .\end{equation} Using the above choice of the filter $Q^{(i)}(\lambda)$, we have that all diagonal elements of $\Gamma$ are zero. Additionally, to guarantee model detectability or extended model detectability (see Section \ref{sec:mdetectability}), any valid design of the model detection filters must guarantee that all off-diagonal elements of $\Gamma$ are nonzero. These two properties of $\Gamma$ allows to unequivocally identify the exact matching of the current model with one (and only one) of the $N$ component models. Two other properties of $\Gamma$ are desirable, when solving model detection applications. The first property is the symmetry of $\Gamma$. In contrast to $\Delta$, $\Gamma$ is generally not symmetric, excepting for some particular classes of component models and for special choices of model detection filters. For example, this property can be ensured if all component models are stable and have no disturbance inputs, by choosing $Q^{(i)}(\lambda) = \big[\, I \; -G_u^{(i)}(\lambda)\,\big]$, in which case $R_u^{(i,j)}(\lambda) = -R_u^{(j,i)}(\lambda)$. Ensuring the symmetry of $\Gamma$, although very desirable, is in general difficult to be achieved. In practice, it is often sufficient to ensure via suitable scaling that the gains of first row and first column are equal. The second desirable property of the mapping $\Delta_{ij} \rightarrow \Gamma_{ij}$ is the \emph{monotonic mapping property} of distances, which is the requirement that for all $i$ and $k$ ($i, k = 1, \ldots, N$), if $\Delta_{ij} < \Delta_{ik}$, then $\Gamma_{ij} < \Gamma_{ik}$. Ensuring this property, make easier to address model identification problems for which no exact matching between the current model and any one of the component models can be assumed. If $\lambda_k$, $k = 1, \ldots, n_f$, is a given set of $n_f$ frequency values, then, instead of the peak distances in (\ref{mapdist}) or in (\ref{mapdist-ext}), we can use the maximum of the point-wise distances over the finite set of frequency values, to assess the strong model detectability or the extended strong model detectability, respectively (see Section \ref{sec:mdetectability}). \subsubsection{Distance Matching Performance } \label{sec:mdmatch} \index{model detection!distance matching} \index{performance evaluation!model detection!distance matching} To evaluate the distance matching property of the model detection filters in the case when no exact matching between the current model (\ref{systemref}) and any one of the component models (\ref{systemi}) can be assumed, we can define the corresponding current internal forms as \begin{equation}\label{ri_internal1-cur} \left [ \begin{array}{c|c|c} \widetilde R_u^{(i)}(\lambda) & \widetilde R_d^{(i)}(\lambda)&\widetilde R_w^{(i)}(\lambda)\end{array} \right ] := Q^{(i)}(\lambda)\left [ \begin{array}{c|c|c} \widetilde G_u(\lambda) & \widetilde G_d(\lambda) & \widetilde G_w(\lambda) \\ I_{m_u} & 0 & 0 \end{array} \right ] \end{equation} and evaluate the mapped distances $\gamma_i$, for $i = 1, \ldots, N$, defined as \begin{equation}\label{mapdistcur} \gamma_i := \big\| \widetilde R_u^{(i)}(\lambda) \big\|_\infty \end{equation} or, if the disturbance inputs are relevant, \begin{equation}\label{mapdistcur-ext} \gamma_i := \big\| \big[\, \widetilde R_u^{(i)}(\lambda)\; \widetilde R_d^{(i)}(\lambda)\,\big]\big\|_\infty .\end{equation} The index $\ell$ of the smallest value $\gamma_\ell$ provides (for a well designed set of model detection filters) the index of the best matching component model of the current model. If $\lambda_k$, $k = 1, \ldots, n_f$, is a given set of $n_f$ frequency values, then, instead of the above peak distances, we can use the maximum of the point-wise distances over the finite set of frequency values. \subsubsection{Model Detection Noise Gaps } \label{sec:mdgap} \index{model detection!noise gap} \index{performance evaluation!model detection!noise gap} The noise attenuation performance of model detection filters can be characterized via the noise gaps achieved by individual filters. The noise gap for the $i$-th filter can be defined in terms of the resulting internal forms (\ref{ri_internal}) as the ratio $\eta_i := \beta_i/\gamma_i$, where \begin{equation}\label{mdbetai} \beta_i := \min_{j\neq i} \big\|R_u^{(i,j)}(\lambda)\big\|_\infty \end{equation} and \begin{equation}\label{mdgammai} \gamma_i := \big\|R_w^{(i,i)}(\lambda)\big\|_\infty .\end{equation} The values of $\beta_i > 0$, for $i = 1, \ldots, N$ characterize the model detectability property of the collection of the $N$ component models (\ref{systemi}), while $\gamma_i$ characterizes the worst-case influence of noise inputs on the $i$-th residual component. If $\gamma_i = 0$ (no noise), then $\eta_i = \infty$. If the disturbance inputs are relevant for the model detection, then instead (\ref{mdbetai}) we can use the following definition of $\beta_i$ \begin{equation}\label{mdbetaid} \beta_i := \min_{j\neq i} \big\|\big[\,R_u^{(i,j)}(\lambda)\; R_d^{(i,j)}(\lambda)\,\big]\big\|_\infty .\end{equation} In this case, $\beta_i > 0$, for $i = 1, \ldots, N$ characterize the extended model detectability property of the collection of the $N$ component models (\ref{systemi}). If $\lambda_k$, $k = 1, \ldots, n_f$, is a given set of $n_f$ frequency values, then, instead of (\ref{mdbetai}) we use the maximum of the point-wise distances over the finite set of frequency values \begin{equation}\label{mdbetai-pw} \beta_i := \min_{j\neq i} \max_k\big\|R_u^{(i,j)}(\lambda_k)\big\|_\infty \end{equation} and instead of (\ref{mdbetaid}) we use \begin{equation}\label{mdbetaid-pw} \beta_i := \min_{j\neq i} \max_k\big\|\big[\,R_u^{(i,j)}(\lambda_k)\; R_d^{(i,j)}(\lambda_k)\,\big]\big\|_\infty .\end{equation} \section{Description of FDITOOLS} \label{sec:userguide} This user's guide is intended to provide users basic information on the \textbf{FDITOOLS} collection to solve the fault detection and isolation problems formulated in Section~\ref{fdp} and the model detection problem formulated in Section~\ref{mdp}. The notations and terminology used throughout this guide have been introduced and extensively discussed in the accompanying book \cite{Varg17}, which also represents the main reference for the implemented computational methods underlying the analysis and synthesis functions of \textbf{FDITOOLS}. Information on the requirements for installing \textbf{FDITOOLS} are given in Appendix \ref{appA}. In this section, we present first a short overview of the existing functions of \textbf{FDITOOLS} and then, we illustrate a typical work flow by solving an EFDIP. In-depth information on the command syntax of the functions of the \textbf{FDITOOLS} collection is given is Sections \ref{fditools:analysis} and \ref{fditools:synthesis}. To execute the examples presented in this guide, simply paste the presented code sequences into the MATLAB command window. More involved examples are given in several case studies presented in \cite{Varg17}.\footnote{Use \url{https://sites.google.com/site/andreasvargacontact/home/book/matlab} to download the case study examples presented in \cite{Varg17}.} \subsection{Quick Reference Tables} The current release of \textbf{FDITOOLS} is version V1.0, dated November 30, 2018. The corresponding \texttt{Contents.m} file is listed in Appendix \ref{app:contents}. This section contains quick reference tables for the functions of the \textbf{FDITOOLS} collection. The M-files available in the current version of \textbf{FDITOOLS}, which are documented in this user's guide, are listed below by category, with short descriptions. \begin{longtable}{|p{2.5cm}|p{12cm}|} \hline \multicolumn{2}{|c|}{\textbf{Demonstration}} \\ \hline \texttt{\bfseries FDIToolsdemo}& Demonstration of Fault Detection and Isolation Tools\\ \hline \multicolumn{2}{c}{} \\ \hline \multicolumn{2}{|c|}{\textbf{Setup of synthesis models}} \\ \hline \texttt{\bfseries fdimodset}& Setup of models for solving FDI synthesis problems.\\ \hline \texttt{\bfseries mdmodset} &Setup of models for solving model detection synthesis problems.\\ \hline \multicolumn{2}{c}{} \\ \hline \multicolumn{2}{|c|}{\textbf{FDI Related Analysis}} \\ \hline \texttt{\bfseries fdigenspec}& Generation of achievable FDI specifications.\\ \hline \texttt{\bfseries fdichkspec}& Feasibility analysis of a set of FDI specifications.\\ \hline \multicolumn{2}{c}{} \\ \hline \multicolumn{2}{|c|}{\textbf{Model Detection Related Analysis}} \\ \hline \texttt{\bfseries mddist}& Computation of distances between component models.\\ \hline \texttt{\bfseries mddist2c}& Computation of distances to a set of component models.\\ \hline \end{longtable} \newpage \begin{longtable}{|p{2.5cm}|p{12cm}|} \multicolumn{2}{c}{} \\ \hline \multicolumn{2}{|c|}{\textbf{Performance evaluation of FDI filters}} \\ \hline \texttt{\bfseries fditspec}& Computation of the weak or strong structure matrix.\\ \hline \texttt{\bfseries fdisspec} &Computation of the strong structure matrix.\\ \hline \texttt{\bfseries fdifscond}& Fault sensitivity condition of FDI filters.\\ \hline \texttt{\bfseries fdif2ngap}& Fault-to-noise gap of FDI filters.\\ \hline \samepage \texttt{\bfseries fdimmperf}& Model-matching performance of FDI filters.\\ \hline \multicolumn{2}{c}{} \\ \hline \multicolumn{2}{|c|}{\textbf{Performance evaluation of model detection filters}} \\ \hline \texttt{\bfseries mdperf}& Model detection distance mapping performance.\\ \hline \texttt{\bfseries mdmatch}& Model detection distance matching performance.\\ \hline \texttt{\bfseries mdgap}& Noise gaps of model detection filters.\\ \hline \multicolumn{2}{c}{} \\ \hline \multicolumn{2}{|c|}{\textbf{Synthesis of fault detection filters}} \\ \hline \texttt{\bfseries efdsyn}& Exact synthesis of fault detection filters.\\ \hline \texttt{\bfseries afdsyn}& Approximate synthesis of fault detection filters.\\ \hline \texttt{\bfseries efdisyn}& Exact synthesis of fault detection and isolation filters.\\ \hline \texttt{\bfseries afdisyn}& Approximate synthesis of fault detection and isolation filters.\\ \hline \texttt{\bfseries emmsyn}& Exact model matching based synthesis of FDI filters.\\ \hline \texttt{\bfseries ammsyn}& Approximate model matching based synthesis of FDI filters.\\ \hline \multicolumn{2}{c}{} \\ \hline \multicolumn{2}{|c|}{\textbf{Synthesis of model detection filters}} \\ \hline \texttt{\bfseries emdsyn}& Exact synthesis of model detection filters.\\ \hline \texttt{\bfseries amdsyn}& Approximate synthesis of model detection filters.\\ \hline \end{longtable} \subsection{Getting Started} In this section we shortly illustrate the typical steps of solving a fault detection and isolation problem, starting with building an adequate fault model, performing preliminary analysis, selecting the suitable synthesis approach, and evaluating the computed results. \subsubsection{Building Models with Additive Faults} In-depth information on how to create and manipulate LTI system models and arrays of LTI system models are available in the online documentation of the Control System Toolbox and in its User' Guide \cite{MLCO15}. These types of models are the basis of the data objects used in the \textbf{FDITOOLS} collection. The input plant models with additive faults used by all synthesis functions of the \textbf{FDITOOLS} collection are LTI models of the form (\ref{systemw}), given via their equivalent descriptor system state-space realizations of the form (\ref{ssystemw}). The object-oriented framework employed in the Control System Toolbox has been used to define the LTI plant models, by defining several input groups corresponding to various input signal. The employed standard definitions of input groups are: \texttt{\bfseries 'controls'} for the control inputs $u(t)$, \texttt{\bfseries 'disturbances'} for the disturbance inputs $d(t)$, \texttt{\bfseries 'faults'} for the fault inputs $f(t)$, and \texttt{\bfseries 'noise'} for the noise inputs $w(t)$. For convenience, occasionally an input group \texttt{\bfseries 'aux'} can be also defined for additional inputs. For different ways to define input groups, see the documentation of the Control System Toolbox \cite{MLCO15}. Once you have a plant model for a system without faults, you can construct models with faults using simple commands in the Control System Toolbox or using the model setup function \texttt{fdimodset}. For example, consider a plant model \texttt{sys} with 3 inputs, 3 outputs and 3 state components. Assume that the first two inputs are control inputs which are susceptible to actuator faults and the third input is a disturbance input, which is not measurable and therefore is considered as an unknown input. All outputs are measurable, and assume that the first output is susceptible to sensor fault. The following commands generate a plant model with additive faults as described above: \begin{verbatim} rng(50); sys = rss(3,3,3); inputs = struct('c',1:2,'d',3,'f',1:2,'fs',1); sysf = fdimodset(sys,inputs); \end{verbatim} \subsubsection{Determining the Achievable FDI Specifications} To determine the achievable strong FDI specifications with respect to constant faults, the function \texttt{fdigenspec} can be used as follows: \begin{verbatim} S = fdigenspec(sysf,struct('FDFreq',0)); \end{verbatim} For the above example, the possible fault signatures are contained in the generic structure matrix \[ S = \left [ \begin{array}{ccc} 0 & 1 & 1\\ 1 & 0 & 1 \\ 1 & 1 & 0 \\ 1 & 1 & 1\end{array} \right ] ,\] which indicates that the EFDP is solvable (last row of $S$) and the EFDIP is also solvable using the specifications contained in the rows of \[ S_{FDI} = \left [ \begin{array}{ccc} 0 & 1 & 1\\ 1 & 0 & 1 \\ 1 & 1 & 0 \end{array} \right ] .\] \subsubsection{Designing an FDI Filter Using \texttt{efdisyn}} To solve the EFDIP, an option structure is used to specify various user options for the synthesis function \texttt{efdisyn}. Frequently used options are the desired stability degree for the poles of the fault detection filter, the requirement for performing least order synthesis, or values for the tolerances used for rank computations or fault detectability tests. The user options can be specified by setting appropriately the respective fields in a MATLAB structure \texttt{options}. For example, the desired stability degree of $-2$ of the filter, the targeted fault signature specification $S_{FDI}$, and the frequency $0$ for strong synthesis (for constant faults), can be set using \begin{verbatim} options = struct('sdeg',-2,'SFDI',S(1:3,:),'FDFreq',0); \end{verbatim} \noindent A solution of the EFDIP, for the selected structure matrix $S_{FDI}$, can be computed using the function \texttt{efdisyn} as given below \begin{verbatim} [Q,R,info] = efdisyn(sysf,options); \end{verbatim} The resulting bank of scalar output fault detection filters, in implementation form, is contained in \texttt{Q} (stored as an one-dimensional cell array of systems), while the corresponding internal forms of the bank of filters are contained in the cell array \texttt{R}. The information structure \texttt{info} contains further information on the resulting designs. \subsubsection{Assessing the Residual Generator} For assessment purposes, often simulations performed using the resulting internal form provide sufficient qualitative information to verify the obtained results. The example below illustrates how to simulate step inputs from faults using the computed cell array \texttt{R} containing the internal form of the filter. \begin{verbatim} Rf = vertcat(R{:}); Rf.OutputName = strcat(strseq('r_{',1:3),'}'); Rf.InputName = strcat(strseq('f_{',1:3),'}'); step(Rf,8); \end{verbatim} A typical output of this computation can be used to assess the achieved fault signatures as shown in Fig.\ \ref{efdipstep}. As it can be observed, the diagonal entries of the overall transfer-function matrix of \texttt{Rf} are zero, while all off-diagonal entries are nonzero. \begin{figure}[h] \begin{center} \vspace*{-4mm} \includegraphics[height=8cm]{varga_Fig_fdiwf_Step} \vspace*{-5mm} \caption{Step responses from the fault inputs.} \label{efdipstep} \end{center} \end{figure} \newpage The resulting strong structure matrix and the fault sensitivity conditions the resulting bank of internal filters can be obtained directly from the computed internal form \texttt{R}: \begin{verbatim} S_strong = fdisspec(R) fscond = fdifscond(R,0,S_strong) \end{verbatim} The resulting values of the fault sensitivity conditions $\{0.6905, 0.5918, 0.4087 \}$ indicate an acceptable sensitivity of all residual components to individual faults. \subsection{Functions for the Setup of Synthesis Models} \label{fditools:setup} The functions for the setup of synthesis models allow to easily define models in forms suitable for the use of analysis and synthesis functions.\\[-7mm] \subsubsection{\texttt{\bfseries fdimodset}} \subsubsection*{Syntax} \index{M-functions!\texttt{\bfseries fdimodset}} \begin{verbatim} SYSF = fdimodset(SYS,INPUTS) \end{verbatim} \subsubsection*{Description} \noindent \texttt{fdimodset} builds synthesis models with additive faults to be used in conjunction with the analysis and synthesis functions of FDI filters. \subsubsection*{Input data} \begin{description} \item \texttt{SYS} is a LTI system in a descriptor system state-space form \begin{equation}\label{fdimodset:sysss} \begin{aligned} E\lambda x(t) &= Ax(t)+ B\widetilde u(t) ,\\ y(t) &= C x(t)+ D \widetilde u(t) , \end{aligned} \end{equation} where $y(t) \in \mathds{R}^p$ is the system output and $\widetilde u(t) \in \mathds{R}^{m}$ is the system global input, which usually includes the control and disturbance inputs, but may also explicitly include fault inputs, noise inputs and auxiliary inputs. \item \texttt{INPUTS} is a MATLAB structure used to specify the indices of the columns of the matrices $B$ and, respectively $D$, which correspond to the control, disturbance, fault, noise and auxiliary inputs, using the following fields: {\setlength\LTleft{30pt}\begin{longtable}{|l|p{11.6cm}|} \hline \textbf{\texttt{INPUTS} fields} & \textbf{Description} \\ \hline \texttt{controls} & vector of indices of the control inputs (Default: void)\\ \hline \texttt{c} & alternative short form to specify the indices of the control inputs \newline (Default: void)\\ \hline \texttt{disturbances} & vector of indices of the disturbance inputs (Default: void)\\ \hline \texttt{d} & alternative short form to specify the indices of the disturbance inputs (Default: void)\\ \hline \texttt{faults} & vector of indices of the fault inputs (Default: void)\\ \hline \texttt{f} & alternative short form to specify the indices of the fault inputs \newline (Default: void)\\ \hline \url{faults\_sen} & vector of indices of the outputs subject to sensor faults (Default: void)\\ \hline \texttt{fs} & alternative short form to specify the indices of the outputs subject to sensor faults (Default: void)\\ \hline \texttt{noise} & vector of indices of the noise inputs (Default: void)\\ \hline \texttt{n} & alternative short form to specify the indices of the noise inputs \newline (Default: void)\\ \hline \texttt{aux} & vector of indices of the auxiliary inputs (Default: void)\\ \hline \end{longtable} } \end{description} \subsubsection*{Output data} \begin{description} \item \texttt{SYSF} is a LTI system in the state-space form \begin{equation}\label{fdimodset:sysss1} {\begin{aligned} E\lambda x(t) & = Ax(t)+ B_u u(t)+ B_d d(t) + B_f f(t)+ B_w w(t) + B_{v} v(t) , \\ y(t) & = C x(t) + D_u u(t)+ D_d d(t) + D_f f(t) + D_w w(t)+ B_{v} v(t) . \end{aligned}} \end{equation} where $u(t)\in \mathds{R}^{m_u}$ are the control inputs, $d(t)\in \mathds{R}^{m_d}$ are the disturbance inputs, $f(t)\in \mathds{R}^{m_f}$ are the fault inputs, $w(t)\in \mathds{R}^{m_w}$ are the noise inputs and $v(t)\in \mathds{R}^{m_v}$ are auxiliary inputs. Any of the inputs components $u(t)$, $d(t)$, $f(t)$, $w(t)$ or $v(t)$ can be void. The input groups for $u(t)$, $d(t)$, $f(t)$, $w(t)$ and $v(t)$ have the standard names \texttt{\bfseries 'controls'}, \texttt{\bfseries 'disturbances'}, \texttt{\bfseries 'faults'}, \texttt{\bfseries 'noise'} and \texttt{'aux'}, respectively. The resulting model \texttt{SYSF} inherits the sampling time of the original model \texttt{SYS}. \end{description} \subsubsection*{Remark on input and output data} The function \texttt{\bfseries fdimodset} can also be employed if \texttt{SYS} is an $N \times 1$ or $1 \times N$ array of LTI models, in which case the resulting \texttt{SYSF} is also an $N \times 1$ or $1 \times N$ array of LTI models, respectively. \subsubsection*{Method} The system matrices $B_u$, $B_d$, $B_f$, $B_w$, $B_v$, and $D_u$, $D_d$, $D_f$, $D_w$, $D_v$ in the resulting model (\ref{fdimodset:sysss1}) are defined by specifying the indices of the columns of the matrices $B$ and, respectively $D$, in the model (\ref{fdimodset:sysss}) which correspond to the control, disturbance, fault, noise and auxiliary inputs. If the system \texttt{SYS} in (\ref{fdimodset:sysss}) has the equivalent input-output form \begin{equation}\label{fdimodset:iosys} {\mathbf{y}}(\lambda) = G(\lambda)\widetilde{\mathbf{u}}(\lambda) \end{equation} and the resulting system \texttt{SYSF} in (\ref{fdimodset:sysss1}) has the equivalent input-output form \begin{equation}\label{fdimodset:iosys1} {\mathbf{y}}(\lambda) = G_u(\lambda){\mathbf{u}}(\lambda) + G_d(\lambda){\mathbf{d}}(\lambda) + G_f(\lambda){\mathbf{f}}(\lambda) + G_w(\lambda){\mathbf{w}}(\lambda) + G_v(\lambda){\mathbf{v}}(\lambda) , \end{equation} then the following relations exist among the above transfer function matrices \[ \begin{array}{lcl}G_u(\lambda) &=& G(\lambda)S_u, \\ G_d(\lambda) &=& G(\lambda)S_d, \\ G_f(\lambda) &=& [\, G(\lambda)S_f \; S_s \,], \\ G_w(\lambda) &=& G(\lambda)S_w, \\ G_v(\lambda) &=& G(\lambda)S_v, \end{array}\] where $S_u$, $S_d$, $S_f$, $S_w$, and $S_v$ are columns of the identity matrix $I_m$ and $S_s$ is formed from the columns of the indentity matrix $I_p$. These (selection) matrices are used to select the corresponding columns of $G(\lambda)$, and thus to obtain the input and feedthrough matrices of the model (\ref{fdimodset:sysss1}) from those of the model (\ref{fdimodset:sysss}). The indices of the selected columns are specified by the vectors of indices contained in the \texttt{INPUTS} structure. \subsubsection*{Example} \begin{example}\label{ex:fdimodset} For the setup of a LTI synthesis model with actuator and sensor faults consider the continuous-time input-output model defined with the transfer function matrices \[ G_u(s) = \left [ \begin{array}{c} \frac{s+1}{s+2} \\ \\[-2mm] \frac{s+2}{s+3} \end{array} \right ], \quad G_d(s) = \left [ \begin{array}{c} \frac{s-1}{s+2} \\ \\[-2mm]0 \end{array} \right ], \quad G_f(s) = [\, G_u(s)\; I\,] .\] As it can be observed, the fault inputs correspond to an actuator fault and two sensor faults for both output measurements. To setup the state-space synthesis model, the following MATLAB commands can be employed: \begin{verbatim} s = tf('s'); Gu = [(s+1)/(s+2); (s+2)/(s+3)]; Gd = [(s-1)/(s+2); 0]; sysf = fdimodset(ss([Gu Gd]),struct('c',1,'d',2,'f',1,'fs',1:2)); \end{verbatim} \end{example} \subsubsection{\texttt{\bfseries mdmodset}} \subsubsection*{Syntax} \index{M-functions!\texttt{\bfseries mdmodset}} \begin{verbatim} SYSM = mdmodset(SYS,INPUTS) \end{verbatim} \subsubsection*{Description} \noindent \texttt{mdmodset} builds synthesis models to be used in conjunction with the synthesis functions of model detection filters. \subsubsection*{Input data} \begin{description} \item \texttt{SYS} is a multiple model which contains $N$ LTI systems, with the $j$-th model having the state-space form \begin{equation}\label{mdmodset:sysssj} \begin{array}{rcl}E^{(j)}\lambda x^{(j)}(t) &=& A^{(j)}x^{(j)}(t) + B^{(j)} \widetilde u^{(j)}(t) \, ,\\ y^{(j)}(t) &=& C^{(j)}x^{(j)}(t) + D^{(j)} \widetilde u^{(j)}(t) \, , \end{array} \end{equation} where $y^{(j)}(t) \in \mathds{R}^p$, $x^{(j)}(t) \in \mathds{R}^{n^{(j)}}$, and $\widetilde u^{(j)}(t) \in \mathds{R}^{m^{(j)}}$ are the output, state and input vectors of the $j$-th model. The (global) input $\widetilde u^{(j)}(t)$ usually includes the control inputs and may also include disturbance and noise inputs. The multiple model \texttt{SYS} is either an one-dimensional array of $N$ LTI systems of the form (\ref{mdmodset:sysssj}), in which case $m^{(j)} = m$ $\forall j$, or is a $1\times N$ cell array, with \texttt{SYSM\{$j$\}} containing the $j$-th component system in the form (\ref{mdmodset:sysssj}). \item \texttt{INPUTS} is a MATLAB structure used to specify the indices of the columns of the matrices $B^{(j)}$ and, respectively $D^{(j)}$, which correspond to the control, disturbance, and noise inputs, using the following fields: {\setlength\LTleft{30pt}\begin{longtable}{|l|p{11.6cm}|} \hline \textbf{\texttt{INPUTS} fields} & \textbf{Description} \\ \hline \texttt{controls} & vector of indices of the control inputs (Default: void)\\ \hline \texttt{c} & alternative short form to specify the indices of the control inputs \newline (Default: void)\\ \hline \texttt{disturbances} & vector of indices of the disturbance inputs or an $N$-dimensional cell array, with \texttt{INPUTS.disturbances\{$j$\}} containing the vector of indices of the disturbance inputs of the $j$-th component model (Default: void)\\ \hline \texttt{d} & alternative short form to specify the indices of the disturbance inputs or an $N$-dimensional cell array, with \texttt{INPUTS.d\{$j$\}} containing the vector of indices of the disturbance inputs of the $j$-th component model (Default: void)\\ \hline \texttt{noise} & vector of indices of the noise inputs, or an $N$-dimensional cell array, with \texttt{INPUTS.noise\{$j$\}} containing the vector of indices of the noise inputs of the $j$-th component model (Default: void)\\ \hline \texttt{n} & alternative short form to specify the indices of the noise inputs, or an $N$-dimensional cell array, with \texttt{INPUTS.n\{$j$\}} containing the vector of indices of the noise inputs of the $j$-th component model \newline (Default: void)\\ \hline \end{longtable} } \end{description} \subsubsection*{Output data} \begin{description} \item \texttt{SYSM} is a multiple LTI system, with the $j$-th model in the state-space form \begin{equation}\label{mdmodset:sysss1j} \begin{array}{rcl}E^{(j)}\lambda x^{(j)}(t) &=& A^{(j)}x^{(j)}(t) + B^{(j)}_{u} u^{(j)}(t) + B^{(j)}_d d^{(j)}(t) + B^{(j)}_w w^{(j)}(t) \, ,\\ y^{(j)}(t) &=& C^{(j)}x^{(j)}(t) + D^{(j)}_u u^{(j)}(t) + D^{(j)}_d d^{(j)}(t) + D^{(j)}_w w^{(j)}(t) \, , \end{array} \end{equation} where $u^{(j)}(t)\in \mathds{R}^{m_u}$ are the control inputs, $d^{(j)}(t)\in \mathds{R}^{m_d^{(j)}}$ are the disturbance inputs, and $w^{(j)}(t)\in \mathds{R}^{m_w^{(j)}}$ are the noise inputs. Any of the inputs components $u^{(j)}(t)$, $d^{(j)}(t)$, or $w^{(j)}(t)$ can be void. The input groups for $u^{(j)}(t)$, $d^{(j)}(t)$, and $w^{(j)}(t)$ have the standard names \texttt{\bfseries 'controls'}, \texttt{\bfseries 'disturbances'}, and \texttt{\bfseries 'noise'}, respectively. The resulting multiple model \texttt{SYSM} has the same representation as the original model \texttt{SYS} (i.e., either an one-dimensional array of $N$ LTI systems or a $1\times N$ cell array) and inherits the sampling time of \texttt{SYS}. \end{description} \subsubsection*{Method} The system matrices $B_u^{(j)}$, $B_d^{(j)}$, $B_w^{(j)}$, and $D_u^{(j)}$, $D_d^{(j)}$, $D_w^{(j)}$, are defined by specifying the indices of the columns of the matrices $B^{(j)}$ and, respectively $D^{(j)}$, which correspond to the control, disturbance, and noise inputs. If the $j$-th component system of \texttt{SYS} in (\ref{mdmodset:sysssj}) has the equivalent input-output form \begin{equation}\label{mdmodset:iosysj} {\mathbf{y}}^{(j)}(\lambda) = G^{(j)}(\lambda)\widetilde{\mathbf{u}}^{(j)}(\lambda) \end{equation} and the resulting $j$-th component system of \texttt{SYSM} in (\ref{mdmodset:sysss1j}) has the equivalent input-output form \begin{equation}\label{mdmodset:iosys1j} {\mathbf{y}}^{(j)}(\lambda) = G_u^{(j)}(\lambda){\mathbf{u}}(\lambda) + G_d^{(j)}(\lambda){\mathbf{d}}^{(j)}(\lambda) + G_w^{(j)}(\lambda){\mathbf{w}}^{(j)}(\lambda) , \end{equation} then the following relations exist among the above transfer function matrices \[ \begin{array}{lcl}G_u^{(j)}(\lambda) &=& G^{(j)}(\lambda)S_u, \\ G_d^{(j)}(\lambda) &=& G^{(j)}(\lambda)S_d^{(j)}, \\ G_w^{(j)}(\lambda) &=& G^{(j)}(\lambda)S_w^{(j)}, \end{array}\] where $S_u$, $S_d^{(j)}$, and $S_w^{(j)}$, are columns of the identity matrix $I_{m^{(j)}}$ and are used to select the corresponding columns of $G^{(j)}(\lambda)$. The indices of the selected columns are specified by the vectors of indices contained in the \texttt{INPUTS} structure. \subsubsection*{Examples} \begin{example}\label{ex:act_faults} Consider the first-order input-output flight actuator model \[ G(s,k) = \frac{k}{s+k} \; , \] where $k$ is the actuator gain. An input-output multiple model of the form (\ref{systemi}), defined as \[ G_u^{(j)}(s) := G(s,k^{(j)}) , \quad j = 1, ..., 4, \] covers, via suitable choices of the values of the gain $k$, the normal case for $k = k^{(1)}$ as well as three main classes of parametric actuator faults $k = k^{(j)}$, for $j = 2, 3, 4$, as follows: \begin{center}\begin{tabular}{lll} $k^{(1)} = 14$ & --& normal (nominal) case \\ $k^{(2)} = 0.5k^{(1)}$ & --& loss of efficiency (LOE) fault \\ $k^{(3)} = 10k^{(1)}$ & --& surface disconnection fault \\ $k^{(4)} = 0.01k^{(1)}$ & --& stall load fault \end{tabular} \end{center} For the setup of the multiple synthesis model to be used for model detection purposes, the following MATLAB commands can be used: \begin{verbatim} s = tf('s'); k1 = 14; sysact(:,:,1) = k1/(s+k1); sysact(:,:,2) = 0.5*k1/(s+0.5*k1); sysact(:,:,3) = 10*k1/(s+10*k1); sysact(:,:,4) = 0.01*k1/(s+0.01*k1); sysmact = mdmodset(ss(sysact),struct('c',1)) \end{verbatim} \end{example} \begin{example}\label{ex:cell_md} This example illustrates the setup of a multiple synthesis model with variable numbers of disturbance and noise inputs. Let $N = 2$ be the number of models of the form (\ref{mdmodset:sysss1j}), with $p = 3$ outputs, $m_u = 2$ control inputs, $m_d^{(1)} = 1$ and $m_d^{(2)} = 2$ disturbance inputs, $m_w^{(1)} = 2$ and $m_w^{(2)} = 1$ noise inputs. For the setup of the multiple synthesis model to be used for model detection purposes, the following MATLAB commands can be used: \begin{verbatim} p = 3; mu = 2; md1 = 1; md2 = 2; mw1 = 2; mw2 = 1; sysm{1} = rss(4,p,mu+md1+mw1); sysm{2} = rss(2,p,mu+md2+mw2); sysm = mdmodset(sysm,struct('c',1,'d',{{2,2:3}},'n',{{3:4,4}})) \end{verbatim} \end{example} \subsection{Functions for FDI Related Analysis} \label{fditools:analysis} These functions cover the generation of achievable weak and strong FDI specifications to be used for solving synthesis problems of FDI filters and the analysis of the feasibility of a set of FDI specifications. For the definitions of isolability related concepts see Section \ref{isolability}. \subsubsection{\texttt{\bfseries fdigenspec}} \subsubsection*{Syntax} \index{M-functions!\texttt{\bfseries fdigenspec}} \begin{verbatim} S = fdigenspec(SYSF,OPTIONS) \end{verbatim} \subsubsection*{Description} \index{structure matrix} \texttt{\bfseries fdigenspec} determines all achievable fault detection specifications for the LTI state-space system \texttt{SYSF} with additive faults. \subsubsection*{Input data} \begin{description} \item \texttt{SYSF} is a LTI system in the state-space form \begin{equation}\label{fdigenspec:sysss1} \begin{aligned} E\lambda x(t) & = Ax(t)+ B_u u(t)+ B_d d(t) + B_f f(t) , \\ y(t) & = C x(t) + D_u u(t)+ D_d d(t) + D_f f(t) , \end{aligned} \end{equation} where any of the inputs components $u(t)$, $d(t)$, and $f(t)$ can be void. For the system \texttt{SYSF}, the input groups for $u(t)$, $d(t)$, and $f(t)$, have the standard names \texttt{\bfseries 'controls'}, \texttt{\bfseries 'disturbances'}, and \texttt{\bfseries 'faults'}, respectively. Any additionally defined input groups are ignored. If no standard input groups are explicitly defined, then \texttt{SYSF} is assumed to be a partitioned LTI system \texttt{SYSF = [SYS1 SYS2]} in a state-space form \begin{equation}\label{fdigenspec:sysss2} \begin{aligned} E\lambda x(t) &= Ax(t)+ B_d d(t) + B_f f(t) ,\\ y(t) &= C x(t)+ D_d d(t) + D_f f(t) , \end{aligned} \end{equation} where the inputs components $d(t) \in \mathds{R}^{m_1}$, and $f(t) \in \mathds{R}^{m_2}$ (both input components can be void). \texttt{SYS1} has $d(t)$ as input vector and the corresponding state-space realization is $(A-\lambda E,B_d,C,D_d)$, while \texttt{SYS2} has $f(t)$ as input vector and the corresponding realization is $(A-\lambda E,B_f,C,D_f)$. The dimension $m_1$ of the input vector $d(t)$ is specified by the \texttt{OPTIONS} field \texttt{OPTIONS.m1} (see below). For compatibility with a previous version, if \texttt{OPTIONS.m1} is specified, then the form (\ref{fdigenspec:sysss2}) is assumed, even if the standard input groups have been explicitly defined. \item \texttt{OPTIONS} is a MATLAB structure used to specify various options and has the following fields: \begin{center} \begin{longtable}{|l|p{11.7cm}|} \hline \textbf{Option fields} & \textbf{Description} \\ \hline \texttt{tol} & tolerance for rank determinations\newline (Default: internally computed)\\ \hline \texttt{FDTol} & threshold for fault detectability checks \newline (Default: 0.0001)\\ \hline \texttt{FDGainTol} & threshold for strong fault detectability checks \newline (Default: 0.01)\\ \hline \texttt{m1} & the number $m_1$ of the inputs of \texttt{SYS1} (Default: 0); if \texttt{OPTIONS.m1} is explicitly specified, then \texttt{SYSF} is assumed to be partitioned as \texttt{SYSF = [SYS1 SYS2]} with a state-space realization of the form (\ref{fdigenspec:sysss2}) and the definitions of input groups are ignored. \\ \hline \texttt{FDFreq} & vector of $n_f$ real frequency values $\omega_k$, $k = 1, \ldots, n_f$, for strong fault detectability checks. To each real frequency $\omega_k$, corresponds a complex frequency $\lambda_k = \mathrm{i}\omega_k$, in the continuous-time case, and $\lambda_k = \exp (\mathrm{i}\omega_k T)$, in the discrete-time case, where $T$ is the sampling time of the system. \newline (Default: \texttt{[ ]}) \\ \hline \pagebreak[4] \hline \texttt{sdeg} & prescribed stability degree for the poles of the internally generated filters (see \textbf{Method}): in the continuous-time case, the real parts of filters poles must be less than or equal to \texttt{OPTIONS.sdeg}, while in discrete-time case, the magnitudes of filter poles must be less than or equal to \texttt{OPTIONS.sdeg}; \\ & (Default: if \texttt{OPTIONS.FDFreq} is empty, then \texttt{OPTIONS.sdeg = [ ]}, i.e., no stabilization is performed; if \texttt{OPTIONS.FDFreq} is nonempty, then \texttt{OPTIONS.sdeg} = $-0.05$ in the continuous-time case and \texttt{OPTIONS.sdeg} = 0.9 in the discrete-time case).\\ \hline \end{longtable} \end{center} \end{description} \subsubsection*{Output data} \begin{description} \item \texttt{S} is a logical array, whose rows contains the achievable fault detection specifications. Specifically, the $i$-th row of \texttt{S} contains the $i$-th achievable specification, obtainable by using a certain (e.g., scalar output) fault detection filter $Q^{(i)}(\lambda)$, whose internal form is $R_f^{(i)}(\lambda)$, with $R_f^{(i)}(\lambda) \neq 0$ (see \textbf{Method}). Thus, the row \texttt{S}($i$,:) is the block-structure based structure matrix of $R_f^{(i)}(\lambda)$, such that \texttt{S}($i,j$) = \texttt{true} if $R_{f_j}^{(i)}(\lambda) \neq 0$ and \texttt{S}($i,j$) = \texttt{false} if $R_{f_j}^{(i)}(\lambda) = 0$. If the real frequency values $\omega_k$, $k = 1, \ldots, n_f$, are provided in \texttt{OPTIONS.FDFreq} for determining strong specifications, then \texttt{S}($i,j$) = \texttt{true} if $\big\|R_{f_j}^{(i)}(\lambda_k)\big\| \geq$ \texttt{OPTIONS.FDGainTol} for all $\lambda_k$, $k = 1, \ldots, n_f$, where $\lambda_k$ is the complex frequency corresponding to $\omega_k$, and \texttt{S}($i,j$) = \texttt{false} if there exists $\lambda_k$ such that $\big\|R_{f_j}^{(i)}(\lambda_k)\big\| <$ \texttt{OPTIONS.FDGainTol}. \end{description} \subsubsection*{Method} The implementation of \texttt{\bfseries fdigenspec} is based on the \textbf{Procedure GENSPEC} from \cite[Sect.\ 5.4]{Varg17}. The nullspace method of \cite{Varg08a} is recursively employed to generate the complete set of achievable specifications, obtainable using suitable fault detection filters. The method is also described in \cite{Varg09g}. In what follows we give some details of this approach. Assume the system \texttt{SYSF} in (\ref{fdigenspec:sysss1}) has the input-output form \begin{equation}\label{fdigenspec:sysio} {\mathbf{y}}(\lambda) = G_u(\lambda){\mathbf{u}}(\lambda) + G_d(\lambda){\mathbf{d}}(\lambda) + G_f(\lambda){\mathbf{f}}(\lambda) . \end{equation} If \texttt{SYSF} has the form (\ref{fdigenspec:sysss2}), then we simply assume that $u(t)$ is void in (\ref{fdigenspec:sysio}). To determine the $i$-th row of \texttt{S}, which contains the $i$-th achievable specification, a certain (e.g., scalar output) fault detection filter is employed, with the input-output implementation form \begin{equation}\label{fdigenspec:detio} {\mathbf{r}}^{(i)}(\lambda) = Q^{(i)}(\lambda)\left [ \begin{array}{c} {\mathbf{y}}(\lambda)\\{\mathbf{u}}(\lambda)\end{array} \right ] \, \end{equation} and its internal form \begin{equation}\label{fdigenspec:detinio} {\mathbf{r}}^{(i)}(\lambda) = R_f^{(i)}(\lambda){\mathbf{f}}(\lambda) ,\end{equation} with $R^{(i)}_f(\lambda)$ defined as \begin{equation}\label{fdigenspec:detintfm} R_f^{(i)}(\lambda) := {\arraycolsep=1mm Q^{(i)}(\lambda) \left [ \begin{array}{c} G_f(\lambda) \\ 0 \end{array} \right ] } \, . \end{equation} The resulting $i$-th row of $S$ is the structure matrix (weak or strong) of $R_f^{(i)}(\lambda)$. Recursive filter updating based on nullspace techniques is employed to systematically generate particular filters which are sensitive to certain fault inputs and insensitive to the rest of inputs. The check for nonzero elements of $R_f^{(i)}(\lambda)$ is performed by using the function \texttt{\bfseries fditspec} to evaluate the corresponding weak specifications. The corresponding threshold is specified via \texttt{OPTIONS.FDTol}. If frequency values for strong detectability tests are provided in \texttt{OPTIONS.FDFreq}, then the magnitudes of the elements of $R_f^{(i)}(\lambda)$ must be above a certain threshold for all complex frequencies corresponding to the specified real frequency values in \texttt{OPTIONS.FDFreq}. For this purpose, the function \texttt{\bfseries fdisspec} is used to evaluate the corresponding strong specifications. The corresponding threshold is specified via \texttt{OPTIONS.FDGainTol}. The call of \texttt{\bfseries fdisspec} requires that none of the complex frequencies $\lambda_k$, $k = 1, \ldots, n_f$, corresponding to the real frequencies $\omega_k$, $k = 1, \ldots, n_f$, specified in \texttt{OPTIONS.FDFreq}, belongs to the set of poles of $R_f^{(i)}(\lambda)$. This condition is fulfilled by ensuring a certain stability degree for the poles of $R_f^{(i)}(\lambda)$, specified via \texttt{OPTIONS.sdeg}. \subsubsection*{Example} \begin{example}\label{ex:Yuan} This is the example of \cite{Yuan97} of a continuous-time state-space model of the form (\ref{fdigenspec:sysss1}) with $E = I_4$, \[ A = {\arraycolsep=1mm\left [ \begin{array}{rrrr} -1 & 1 &0 &0 \\ 1 &-2 &1& 0 \\ 0 &1& -2& 1 \\ 0 &0 &1 &-2\end{array} \right ] }, \quad B_u = \left [ \begin{array}{r} 1\\ 0\\ 0\\ 0\end{array} \right ], \quad B_d = 0, \quad B_f = {\arraycolsep=1.5mm\left [ \begin{array}{rrrrrrrr} 1 &0 &0 &0 & 1& 0& 0& 0 \\ 0 &1 &0 &0 &-1& 1& 0& 0 \\ 0 &0 &1 &0 & 0& -1& 1& 0 \\ 0 &0 &0 &1 & 0& 0& -1& 1\end{array} \right ]} ,\] \[ C = \left [ \begin{array}{cccc} 1 &0 &0 &0 \\ 0 &0 &1 &0 \\ 0 &0 &0 &1 \end{array} \right ], \quad D_u = 0 , \quad D_d = 0 , \quad D_f = 0. \] The achievable 18 weak fault specifications and 12 strong fault specifications, computed with the following script, are: \[ S_{weak} = \left [ \begin{array}{cccccccc} 0& 0 & 0 & 1 & 0 & 0 & 1 & 1\\ 0& 1 & 1 & 0 & 1 & 1 & 1 & 0\\ 0& 1 & 1 & 1 & 1 & 1 & 0 & 1\\ 0& 1 & 1 & 1 & 1 & 1 & 1 & 1\\ 1& 0 & 1 & 0 & 1 & 1 & 1 & 0\\ 1& 0 & 1 & 1 & 1 & 1 & 0 & 1\\ 1& 0 & 1 & 1 & 1 & 1 & 1 & 1\\ 1& 1 & 0 & 0 & 1 & 1 & 0 & 0\\ 1& 1 & 0 & 1 & 1 & 1 & 1 & 1\\ 1& 1 & 1 & 0 & 0 & 1 & 1 & 0 \\ 1& 1 & 1 & 0 & 1 & 0 & 1 & 0 \\ 1& 1 & 1 & 0 & 1 & 1 & 1 & 0 \\ 1& 1 & 1 & 1 & 0 & 1 & 0 & 1 \\ 1& 1 & 1 & 1 & 0 & 1 & 1 & 1 \\ 1& 1 & 1 & 1 & 1 & 0 & 0 & 1 \\ 1& 1 & 1 & 1 & 1 & 0 & 1 & 1\\ 1& 1 & 1 & 1 & 1 & 1 & 0 & 1\\ 1& 1 & 1 & 1 & 1 & 1 & 1 & 1 \end{array} \right ] , \qquad S_{strong} = \left [ \begin{array}{cccccccc} 0& 0& 0& 1& 0& 0& 1& 1 \\ 0& 1& 1& 0& 1& 1& 1& 0 \\ 0& 1& 1& 1& 1& 1& 0& 1 \\ 0& 1& 1& 1& 1& 1& 1& 1 \\ 1& 0& 1& 0& 1& 1& 1& 0 \\ 1& 0& 1& 1& 1& 1& 0& 1 \\ 1& 0& 1& 1& 1& 1& 1& 1 \\ 1& 1& 0& 0& 1& 1& 0& 0 \\ 1& 1& 0& 1& 1& 1& 1& 1 \\ 1& 1& 1& 0& 1& 1& 1& 0 \\ 1& 1& 1& 1& 1& 1& 0& 1 \\ 1& 1& 1& 1& 1& 1& 1& 1 \end{array} \right ] \] Observe that there are 6 weak specifications, which are not strong specifications. \begin{verbatim} p = 3; mu = 1; mf = 8; A = [ -1 1 0 0; 1 -2 1 0; 0 1 -2 1; 0 0 1 -2 ]; Bu = [1 0 0 0]'; Bf = [ 1 0 0 0 1 0 0 0; 0 1 0 0 -1 1 0 0; 0 0 1 0 0 -1 1 0; 0 0 0 1 0 0 -1 1]; C = [ 1 0 0 0; 0 0 1 0; 0 0 0 1]; Du = zeros(p,mu); Df = zeros(p,mf); sysf = ss(A,[Bu Bf],C,[Du Df]); set(sysf,'InputGroup',struct('controls',1:mu,'faults',mu+(1:mf))); opt = struct('tol',1.e-7,'FDTol',1.e-5); S_weak = fdigenspec(sysf,opt), size(S_weak) opt = struct('tol',1.e-7,'FDTol',0.0001,'FDGainTol',.001,... 'FDFreq',0,'sdeg',-0.05); S_strong = fdigenspec(sysf,opt), size(S_strong) \end{verbatim} \end{example} \subsubsection{\texttt{\bfseries fdichkspec}} \subsubsection*{Syntax} \index{M-functions!\texttt{\bfseries fdichkspec}} \begin{verbatim} [RDIMS,ORDERS,LEASTORDERS] = fdichkspec(SYSF) [RDIMS,ORDERS,LEASTORDERS] = fdichkspec(SYSF,SFDI,OPTIONS) \end{verbatim} \subsubsection*{Description} \index{structure matrix} \texttt{\bfseries fdichkspec} checks for the LTI state-space system \texttt{SYSF} with additive faults, the feasibility of a given set of FDI specifications \texttt{SFDI} and determines information related to the synthesis of FDI filters to achieve the feasible specifications. \subsubsection*{Input data} \begin{description} \item \texttt{SYSF} is a LTI system in the state-space form \begin{equation}\label{fdichkspec:sysss1} \begin{aligned} E\lambda x(t) & = Ax(t)+ B_u u(t)+ B_d d(t) + B_f f(t) , \\ y(t) & = C x(t) + D_u u(t)+ D_d d(t) + D_f f(t) , \end{aligned} \end{equation} where any of the inputs components $u(t)$, $d(t)$, and $f(t)$ can be void. For the system \texttt{SYSF}, the input groups for $u(t)$, $d(t)$, and $f(t)$, have the standard names \texttt{\bfseries 'controls'}, \texttt{\bfseries 'disturbances'}, and \texttt{\bfseries 'faults'}, respectively. Any additionally defined input groups are ignored. \item \texttt{SFDI} is an $N\times m_f$ logical array whose rows contain the set of FDI specifications, whose feasibility has to be checked. If \texttt{SFDI} is empty or not specified, then the fault inputs are considered void and therefore ignored. \item \texttt{OPTIONS} is a MATLAB structure used to specify various synthesis options and has the following fields: \begin{center} \begin{tabular}{|l|p{11.7cm}|} \hline \textbf{Option fields} & \textbf{Description} \\ \hline \texttt{tol} & tolerance for rank determinations (Default: internally computed)\\ \hline \texttt{tolmin} & absolute tolerance for observability tests \newline (Default: internally computed)\\ \hline \texttt{FDTol} & threshold for fault detectability checks (Default: 0.0001)\\ \hline \texttt{FDGainTol} & threshold for strong fault detectability checks (Default: 0.01)\\ \hline \texttt{FDFreq} & vector of $n_f$ real frequency values $\omega_k$, $k = 1, \ldots, n_f$, for strong fault detectability checks. To each real frequency $\omega_k$, corresponds a complex frequency $\lambda_k = \mathrm{i}\omega_k$, in the continuous-time case, and $\lambda_k = \exp (\mathrm{i}\omega_k T)$, in the discrete-time case, where $T$ is the sampling time of the system. \newline (Default: \texttt{[ ]}) \\ \hline \end{tabular} \end{center} \end{description} \subsubsection*{Output data} \begin{description} \item \texttt{RDIMS} is an $N$-dimensional integer vector, whose $i$-th component \texttt{RDIMS$(i)$}, if nonzero, contains the number of residual outputs of a FDI filter based on a minimal nullspace basis, which can be used to achieve the $i$-th specification contained in \texttt{SFDI($i$,:)}. If \texttt{RDIMS$(i)$} = 0, then the $i$-th specification is not feasible. \item \texttt{ORDERS} is an $N$-dimensional integer vector, whose $i$-th component \texttt{ORDERS$(i)$} contains, for a feasible specification \texttt{SFDI($i$,:)}, the order of the minimal nullspace basis based FDI filter (see above). If the $i$-th specification is not feasible, then \texttt{ORDERS$(i)$} is set to $-1$. \item \texttt{LEASTORDERS} is an $N$-dimensional integer vector, whose $i$-th component \texttt{LEASTORDERS$(i)$} contains, for a feasible specification \texttt{SFDI($i$,:)}, the least achievable order for a scalar output FDI filter which can be used to achieve the $i$-th specification. If the $i$-th specification is not feasible, then \texttt{LEASTORDERS$(i)$} is set to $-1$. \end{description} \subsubsection*{Method} The nullspace method of \cite{Varg08a} is successively employed to determine FDI filters as minimal left nullspace bases which solve suitably formulated fault detection problems. In what follows we give some details of this approach. Assume the system \texttt{SYSF} in (\ref{fdichkspec:sysss1}) has the input-output form \begin{equation}\label{fdichkspec:sysio} {\mathbf{y}}(\lambda) = G_u(\lambda){\mathbf{u}}(\lambda) + G_d(\lambda){\mathbf{d}}(\lambda) + G_f(\lambda){\mathbf{f}}(\lambda) . \end{equation} To determine a FDI filter which achieves the $i$-th specification contained in the $i$-th row of \texttt{SFDI}, we can reformulate this FDI problem as a fault detection problem for modified sets of disturbance and fault inputs. Let $f^{(i)}$ be formed from the subset of faults corresponding to nonzero entries in the $i$-th row of \texttt{SFDI} and let $G_f^{(i)}(\lambda)$ be formed from the corresponding columns of $G_{f}(\lambda)$. Similarly, let $d^{(i)}$ be formed from the subset of faults corresponding to zero entries in the $i$-th row of \texttt{SFDI} and let $G_d^{(i)}(\lambda)$ be formed from the corresponding columns of $G_{f}(\lambda)$. The solution of the EFDIP for the $i$-th row of \texttt{SFDI} is thus equivalent to solve the EFDP for the modified system \begin{equation}\label{fdichkspec:sysiom} {\mathbf{y}}(\lambda) = G_u(\lambda){\mathbf{u}}(\lambda) + \big[\,G_d(\lambda) \; G_d^{(i)}(\lambda)\,\big] \left [ \begin{array}{c}{\mathbf{d}}(\lambda)\\ {\mathbf{d}}^{(i)}(\lambda)\end{array} \right ] + G_f^{(i)}(\lambda){\mathbf{f}}^{(i)}(\lambda) . \end{equation} A candidate fault detector filter $Q^{(i)}(\lambda)$ can be determined as a left proper nullspace basis of the transfer function matrix \[ G^{(i)}(\lambda) := \left [ \begin{array}{ccc} G_u(\lambda) & G_d(\lambda) & G_d^{(i)}(\lambda) \\ I_{m_u} & 0 & 0 \end{array} \right ] \] satisfying $Q^{(i)}(\lambda)G^{(i)}(\lambda) = 0$. The corresponding internal form is \[ {\mathbf{r}}^{(i)}(\lambda) = R_f^{(i)}(\lambda){\mathbf{f}}^{(i)}(\lambda) , \] where \[ R_f^{(i)}(\lambda) := Q^{(i)}(\lambda) \left [ \begin{array}{c}G_f^{(i)}(\lambda)\\ 0 \end{array} \right ] \] can be determined proper as well. If the nullspace basis is nonempty (i.e., $Q^{(i)}(\lambda)$ has at least one row) and all columns of the resulting $R_f^{(i)}(\lambda)$ are nonzero, then the $i$-th specification is feasible. In this case, the number of basis vectors (i.e., the number of rows of $Q^{(i)}(\lambda)$) is returned in \texttt{RDIMS$(i)$} and the order of the realization of $Q^{(i)}(\lambda)$ (and also of $R_f^{(i)}(\lambda)$) is returned in \texttt{ORDERS$(i)$}. The check for nonzero elements of $R_f^{(i)}(\lambda)$ is performed by using the function \texttt{\bfseries fditspec} to evaluate the corresponding weak specifications. The corresponding threshold is specified via \texttt{OPTIONS.FDTol}. If $n_f$ frequency values $\omega_k$, $k = 1, \ldots, n_f$, are provided in the vector \texttt{OPTIONS.FDFreq} for strong detectability tests, then the magnitudes of the elements of $R_f^{(i)}(\lambda_k)$ must be above a certain threshold for the complex frequencies $\lambda_k$, $k = 1, \ldots, n_f$, corresponding to the specified real frequency values in \texttt{OPTIONS.FDFreq}. For this purpose, the function \texttt{\bfseries fdisspec} is used to evaluate the corresponding strong specifications. The corresponding threshold is specified via \texttt{OPTIONS.FDGainTol}. The call of \texttt{\bfseries fdisspec} requires that the set of poles of $R_f^{(i)}(\lambda)$ and the complex frequencies $\lambda_k$, $k = 1, \ldots, n_f$, corresponding to the real frequencies specified in \texttt{OPTIONS.FDFreq}, are disjoint. This condition is fulfilled by ensuring a certain stability degree for the poles of $R_f^{(i)}(\lambda)$. A least order scalar output filter, which fulfills the above fault detectability conditions, can be determined using minimum dynamic cover techniques \cite{Varg17}. This computation essentially involves the determination of a linear combination of the basis vectors using a rational vector $h(\lambda)$ such that $h(\lambda)R_f^{(i)}(\lambda)$ has all columns nonzero and $h(\lambda)Q^{(i)}(\lambda)$ has the least McMillan degree. The resulting least order of the scalar output FDI filter $h(\lambda)Q^{(i)}(\lambda)$ is returned in \texttt{LEASTORDERS$(i)$}. \subsubsection*{Example} \begin{example}\label{ex:Yuan2} This is the example of \cite{Yuan97} already considered in Example \ref{ex:Yuan}. Of the 18 weak achievable fault specifications 12 are strong fault specifications for constant faults. This can be also checked using the following MATLAB script, where the strong fault detectability checks are performed on the set of 18 weak specifications. The resulting least orders of the scalar output FDI filters to achieve the 12 feasible specifications are: 1, 2, 2, 2, 1, 1, 1, 2, 2, 2, 2, 2. \begin{verbatim} p = 3; mu = 1; mf = 8; A = [ -1 1 0 0; 1 -2 1 0; 0 1 -2 1; 0 0 1 -2 ]; Bu = [1 0 0 0]'; Bf = [ 1 0 0 0 1 0 0 0; 0 1 0 0 -1 1 0 0; 0 0 1 0 0 -1 1 0; 0 0 0 1 0 0 -1 1]; C = [ 1 0 0 0; 0 0 1 0; 0 0 0 1]; Du = zeros(p,mu); Df = zeros(p,mf); sysf = ss(A,[Bu Bf],C,[Du Df]); set(sysf,'InputGroup',struct('controls',1:mu,'faults',mu+(1:mf))); opt = struct('tol',1.e-7,'FDTol',1.e-5); S_weak = fdigenspec(sysf,opt), size(S_weak) opt = struct('tol',1.e-7,'FDTol',0.0001,'FDGainTol',.001,... 'FDFreq',0); [rdims,orders,leastorders] = fdichkspec(sysf,S_weak,opt); S_strong = S_weak(rdims > 0,:), size(S_strong) leastord = leastorders(rdims>0)' \end{verbatim} \end{example} \subsection{Functions for Model Detection Related Analysis} \label{fditools:analysismd} These functions cover the evaluation of the pairwise distances between the component models of a multiple model or between the component models and a given model as defined in Section \ref{sec:mdnugap}. \subsubsection{\texttt{\bfseries mddist}} \index{M-functions!\texttt{\bfseries mddist}} \index{model detection!$\nu$-gap distances} \subsubsection*{Syntax} \begin{verbatim} [DIST,FPEAK,PERM,RELDIST] = mddist(SYSM,OPTIONS) \end{verbatim} \subsubsection*{Description} \texttt{\bfseries mddist} determines the pairwise distances between the component models of a given LTI multiple model \texttt{SYSM} containing $N$ models. \subsubsection*{Input data} \begin{description} \item \texttt{SYSM} is a multiple model which contains $N$ LTI systems in the state-space form \begin{equation}\label{mddist:sysiss} \begin{array}{rcl}E^{(j)}\lambda x^{(j)}(t) &=& A^{(j)}x^{(j)}(t) + B^{(j)}_u u(t) + B^{(j)}_d d^{(j)}(t) + B^{(j)}_w w^{(j)}(t) \, ,\\ y^{(j)}(t) &=& C^{(j)}x^{(j)}(t) + D^{(j)}_u u(t) + D^{(j)}_d d^{(j)}(t) + D^{(j)}_w w^{(j)}(t) \, , \end{array} \end{equation} where $x^{(j)}(t) \in \mathds{R}^{n^{(j)}}$ is the state vector of the $j$-th system with control input $u(t) \in \mathds{R}^{m_u}$, disturbance input $d^{(j)}(t) \in \mathds{R}^{m_d^{(j)}}$ and noise input $w^{(j)}(t) \in \mathds{R}^{m_w^{(j)}}$, and \index{faulty system model!physical}% \index{faulty system model!multiple model}% where any of the inputs components $u(t)$, $d^{(j)}(t)$, or $w^{(j)}(t)$ can be void. The multiple model \texttt{SYSM} is either an array of $N$ LTI systems of the form (\ref{mddist:sysiss}), in which case $m_d^{(j)} = m_d$ and $m_w^{(j)} = m_w$ for $j = 1, \ldots, N$, or is an$1\times N$ cell array, with \texttt{SYSM\{$j$\}} containing the $j$-th component system in the form (\ref{mddist:sysiss}). The input groups for $u(t)$, $d^{(j)}(t)$, and $w^{(j)}(t)$ have the standard names \texttt{\bfseries 'controls'}, \texttt{\bfseries 'disturbances'}, and \texttt{\bfseries 'noise'}, respectively. If \texttt{OPTIONS.cdinp = true} (see below), then the same disturbance input $d$ is assumed for all component models (i.e., $d^{(j)} = d$ and $m_d^{(j)} = m_d$). The state-space form (\ref{mddist:sysiss}) corresponds to the input-output form \begin{equation}\label{mddist:systemi} {\mathbf{y}}^{(j)}(\lambda) = G_u^{(j)}(\lambda){\mathbf{u}}^{(j)}(\lambda) + G_d^{(j)}(\lambda){\mathbf{d}}^{(j)}(\lambda) + G_w^{(j)}(\lambda){\mathbf{w}}^{(j)}(\lambda) , \end{equation} where $G_u^{(j)}(\lambda)$, $G_d^{(j)}(\lambda)$ and $G_w^{(j)}(\lambda)$ are the TFMs from the corresponding inputs to outputs. \item \texttt{OPTIONS} is a MATLAB structure used to specify various options and has the following fields: {\tabcolsep=1mm \setlength\LTleft{30pt}\begin{longtable}{|l|lcp{10cm}|} \hline \textbf{\texttt{OPTIONS} fields} & \multicolumn{3}{l|}{\textbf{Description}} \\ \hline \texttt{MDSelect} & \multicolumn{3}{p{12cm}|}{$M$-dimensional integer vector $\sigma$ with increasing elements containing the indices of the selected component models to which the distances have to be evaluated (Default: $[\,1, \ldots, N\,]$)}\\ \hline \texttt{tol} & \multicolumn{3}{l|}{relative tolerance for rank computations (Default: internally computed)} \\ \hline \texttt{distance} & \multicolumn{3}{p{11.5cm}|}{option for the selection of the distance function $\mathop{\mathrm{dist}}(G_1,G_2)$ between two transfer function matrices $G_1(\lambda)$ and $G_2(\lambda)$:}\\ & \texttt{'nugap'}&--& $\mathop{\mathrm{dist}}(G_1,G_2) = \delta_\nu(G_1,G_2)$, the $\nu$-gap distance (default) \\ & \texttt{'Inf'}&--& $\mathop{\mathrm{dist}}(G_1,G_2) = \|G_1-G_2\|_\infty$, the $\mathcal{H}_\infty$-norm based distance \\ & \texttt{'2'}&--& $\mathop{\mathrm{dist}}(G_1,G_2) = \|G_1-G_2\|_2$, the $\mathcal{H}_2$-norm based distance \\ \hline \texttt{MDFreq} & \multicolumn{3}{p{12cm}|}{real vector, which contains the frequency values $\omega_k$, $k = 1, \ldots, n_f$, for which the point-wise distances have to be computed. For each real frequency $\omega_k$, there corresponds a complex frequency $\lambda_k$ which is used to evaluate the point-wise distance. Depending on the system type, $\lambda_k = \mathrm{i}\omega_k$, in the continuous-time case, and $\lambda_k = \exp (\mathrm{i}\omega_k T)$, in the discrete-time case, where $T$ is the common sampling time of the component models. (Default: \texttt{[ ]}) } \\ \hline \texttt{offset} & \multicolumn{3}{p{12cm}|}{stability boundary offset $\beta$, to be used to assess the finite zeros which belong to $\partial\mathds{C}_s$ (the boundary of the stability domain) as follows: in the continuous-time case these are the finite zeros having real parts in the interval $[-\beta, \beta]$, while in the discrete-time case these are the finite zeros having moduli in the interval $[1-\beta, 1+\beta]$. (Default: $\beta = 1.4901\cdot 10^{-08}$). }\\ \hline \texttt{cdinp} & \multicolumn{3}{p{12cm}|}{option to use both control and disturbance input channels to evaluate the $\nu$-gap distances, as follows:}\\ & \texttt{true} &--& use both control and disturbance input channels; \\ & \texttt{false}&--& use only the control input channels (default) \\ \hline \texttt{MDIndex} & \multicolumn{3}{p{12cm}|}{index $\ell$ of the $\ell$-th smallest distances to be used to evaluate the relative distances to the second smallest distances (Default: $\ell = 3$)} \\ \hline \end{longtable}} \end{description} \subsubsection*{Output data} \begin{description} \item \texttt{DIST} is an $M\times N$ nonnegative matrix, whose $(i,j)$-th element \texttt{DIST$(i,j)$} contains the computed distance (see \texttt{OPTIONS.distance}) between the selected input channels of the $\sigma_i$-th and $j$-th component models as follows:\\ -- if \texttt{OPTIONS.MDFreq = []} and \texttt{OPTIONS.cdinp = false} then \[ \texttt{DIST}(i,j) = \mathop{\mathrm{dist}}\big(G_u^{(\sigma_i)}(\lambda),G_u^{(j)}(\lambda)\big) \] -- if \texttt{OPTIONS.MDFreq} is nonempty and \texttt{OPTIONS.cdinp = false} then \[ \texttt{DIST}(i,j) = \max_{k} \mathop{\mathrm{dist}}\big(G_u^{(\sigma_i)}(\lambda_k),G_u^{(j)}(\lambda_k)\big) \] -- if \texttt{OPTIONS.MDFreq = []} and \texttt{OPTIONS.cdinp = true} then \[ \texttt{DIST}(i,j) = \mathop{\mathrm{dist}}\big(\big[\,G_u^{(\sigma_i)}(\lambda)\;G_d^{(\sigma_i)}(\lambda)\,\big], \big[\,G_u^{(j)}(\lambda)\;G_d^{(j)}(\lambda)\,\big]\big) \] -- if \texttt{OPTIONS.MDFreq} is nonempty and \texttt{OPTIONS.cdinp = true} then \[ \texttt{DIST}(i,j) = \max_{k} \mathop{\mathrm{dist}}\big(\big[\,G_u^{(\sigma_i)}(\lambda_k)\;G_d^{(\sigma_i)}(\lambda_k)\,\big], \big[\,G_u^{(j)}(\lambda_k)\;G_d^{(j)}(\lambda_k)\,\big]\big) \] \item \texttt{FPEAK} is an $M\times N$ nonnegative matrix, whose $(i,j)$-th element \texttt{FPEAK$(i,j)$} contains the peak frequency (in rad/TimeUnit), where \texttt{DIST$(i,j)$} is achieved. \\ \item \texttt{PERM} is an $M\times N$ integer matrix, whose $i$-th row contains the permutation to be applied to increasingly reorder the i-th row of \texttt{DIST}. \\ \item \texttt{RELDIST} is an $M$-dimensional vector, whose $i$-th element \texttt{RELDIST$(i)$} contains the ratio of the second and $\ell$-th smallest distances in the $i$-th row of \texttt{DIST}, where $\ell = $ \texttt{OPTIONS.MDIndex}. \\ \end{description} \subsubsection*{Method} The definition of the distances between component models is given in Section \ref{sec:mdnugap}. The evaluation of the $\nu$-gap distances relies on the definition proposed in \cite{Vinn93}. For efficiency purposes, the intervening normalized factorizations of the components systems are performed only once and all existing symmetries are exploited. The point-wise distances $\mathop{\mathrm{dist}}\big(G_u^{(i)}(\lambda_k),G_u^{(j)}(\lambda_k)\big)$ for the $\mathcal{H}_\infty$- and $\mathcal{H}_2$ norms are simply the 2-norm of the difference of the frequency responses \( \mathop{\mathrm{dist}}\big(G_u^{(j)}(\lambda_k),G_u^{(j)}(\lambda_k)\big) = \big\|G_u^{(j)}(\lambda_k)-G_u^{(j)}(\lambda_k)\big\|_2. \) Similar formulas apply if the disturbance inputs are also selected. \subsubsection{\texttt{\bfseries mddist2c}} \index{M-functions!\texttt{\bfseries mddist2c}} \index{model detection!$\nu$-gap distances} \index{model detection!$\mathcal{H}_\infty$-norm distances} \index{model detection!$\mathcal{H}_2$-norm distances} \subsubsection*{Syntax} \begin{verbatim} [DIST,FPEAK,MIND] = mddist2c(SYSM,SYS,OPTIONS) \end{verbatim} \subsubsection*{Description} \texttt{\bfseries mddist2c} determines the distances of the component models of a LTI multiple model \texttt{SYSM} to the current model \texttt{SYS}. \subsubsection*{Input data} \begin{description} \item \texttt{SYSM} is a multiple model which contains $N$ LTI systems in the state-space form \begin{equation}\label{mddist2c:sysiss} \begin{array}{rcl}E^{(j)}\lambda x^{(j)}(t) &=& A^{(j)}x^{(j)}(t) + B^{(j)}_u u(t) + B^{(j)}_d d^{(j)}(t) + B^{(j)}_w w^{(j)}(t) \, ,\\ y^{(j)}(t) &=& C^{(j)}x^{(j)}(t) + D^{(j)}_u u(t) + D^{(j)}_d d^{(j)}(t) + D^{(j)}_w w^{(j)}(t) \, , \end{array} \end{equation} where $x^{(j)}(t) \in \mathds{R}^{n^{(j)}}$ is the state vector of the $j$-th system with control input $u(t) \in \mathds{R}^{m_u}$, disturbance input $d^{(j)}(t) \in \mathds{R}^{m_d^{(j)}}$ and noise input $w^{(j)}(t) \in \mathds{R}^{m_w^{(j)}}$, and \index{faulty system model!physical}% \index{faulty system model!multiple model}% where any of the inputs components $u(t)$, $d^{(j)}(t)$, or $w^{(j)}(t)$ can be void. The multiple model \texttt{SYSM} is either an array of $N$ LTI systems of the form (\ref{mddist2c:sysiss}), in which case $m_d^{(j)} = m_d$ and $m_w^{(j)} = m_w$ for $j = 1, \ldots, N$, or is an $1\times N$ cell array, with \texttt{SYSM\{$j$\}} containing the $j$-th component system in the form (\ref{mddist2c:sysiss}). The input groups for $u(t)$, $d^{(j)}(t)$, and $w^{(j)}(t)$ have the standard names \texttt{\bfseries 'controls'}, \texttt{\bfseries 'disturbances'}, and \texttt{\bfseries 'noise'}, respectively. If \texttt{OPTIONS.cdinp = true} (see below), then the same disturbance input $d$ is assumed for all component models (i.e., $d^{(j)} = d$ and $m_d^{(j)} = m_d$). The state-space form (\ref{mddist2c:sysiss}) corresponds to the input-output form \begin{equation}\label{mddist2c:systemi} {\mathbf{y}}^{(j)}(\lambda) = G_u^{(j)}(\lambda){\mathbf{u}}^{(j)}(\lambda) + G_d^{(j)}(\lambda){\mathbf{d}}^{(j)}(\lambda) + G_w^{(j)}(\lambda){\mathbf{w}}^{(j)}(\lambda) , \end{equation} where $G_u^{(j)}(\lambda)$, $G_d^{(j)}(\lambda)$ and $G_w^{(j)}(\lambda)$ are the TFMs from the corresponding inputs to outputs. \item \texttt{SYS} is a LTI model in the state-space form \begin{equation}\label{mddist2c:sysissref} \begin{array}{rcl}E\lambda x(t) &=& Ax(t) + B_u u(t) + B_d d(t) + B_w w(t) \, ,\\ y(t) &=& Cx(t) + D_u u(t) + D_d d(t) + D_w w(t) \, , \end{array} \end{equation} where $x(t) \in \mathds{R}^{n}$ is the state vector of the system with control input $u(t) \in \mathds{R}^{m_u}$, disturbance input $d(t) \in \mathds{R}^{m_d}$ and noise input $w(t) \in \mathds{R}^{m_w}$, and where any of the inputs components $u(t)$, $d(t)$, or $w(t)$ can be void. The input groups for $u(t)$, $d(t)$, and $w(t)$ have the standard names \texttt{\bfseries 'controls'}, \texttt{\bfseries 'disturbances'}, and \texttt{\bfseries 'noise'}, respectively. The state-space form (\ref{mddist2c:sysissref}) corresponds to the input-output form \begin{equation}\label{mddist2c:system} {\mathbf{y}}(\lambda) = G_u(\lambda){\mathbf{u}}(\lambda) + G_d(\lambda){\mathbf{d}}(\lambda) + G_w(\lambda){\mathbf{w}}(\lambda) , \end{equation} where $G_u(\lambda)$, $G_d(\lambda)$ and $G_w(\lambda)$ are the TFMs from the corresponding inputs to output. \item \texttt{OPTIONS} is a MATLAB structure used to specify various options and has the following fields: {\tabcolsep=1mm \setlength\LTleft{30pt}\begin{longtable}{|l|lcp{10cm}|} \hline \textbf{\texttt{OPTIONS} fields} & \multicolumn{3}{l|}{\textbf{Description}} \\ \hline \texttt{tol} & \multicolumn{3}{l|}{relative tolerance for rank computations (Default: internally computed)} \\ \hline \texttt{distance} & \multicolumn{3}{p{11.5cm}|}{option for the selection of the distance function $\mathop{\mathrm{dist}}(G_1,G_2)$ between two transfer function matrices $G_1(\lambda)$ and $G_2(\lambda)$:}\\ & \texttt{'nugap'}&--& $\mathop{\mathrm{dist}}(G_1,G_2) = \delta_\nu(G_1,G_2)$, the $\nu$-gap distance (default) \\ & \texttt{'Inf'}&--& $\mathop{\mathrm{dist}}(G_1,G_2) = \|G_1-G_2\|_\infty$, the $\mathcal{H}_\infty$-norm based distance \\ & \texttt{'2'}&--& $\mathop{\mathrm{dist}}(G_1,G_2) = \|G_1-G_2\|_2$, the $\mathcal{H}_2$-norm based distance \\ \hline \texttt{MDFreq} & \multicolumn{3}{p{12cm}|}{real vector, which contains the frequency values $\omega_k$, $k = 1, \ldots, n_f$, for which the point-wise distances have to be computed. For each real frequency $\omega_k$, there corresponds a complex frequency $\lambda_k$ which is used to evaluate the point-wise distance. Depending on the system type, $\lambda_k = \mathrm{i}\omega_k$, in the continuous-time case, and $\lambda_k = \exp (\mathrm{i}\omega_k T)$, in the discrete-time case, where $T$ is the common sampling time of the component models. (Default: \texttt{[ ]}) } \\ \hline \texttt{offset} & \multicolumn{3}{p{12cm}|}{stability boundary offset $\beta$, to be used to assess the finite zeros which belong to $\partial\mathds{C}_s$ (the boundary of the stability domain) as follows: in the continuous-time case these are the finite zeros having real parts in the interval $[-\beta, \beta]$, while in the discrete-time case these are the finite zeros having moduli in the interval $[1-\beta, 1+\beta]$. (Default: $\beta = 1.4901\cdot 10^{-08}$). }\\ \hline \texttt{cdinp} & \multicolumn{3}{p{12cm}|}{option to use both control and disturbance input channels to evaluate the distances, as follows:}\\ & \texttt{true} &--& use both control and disturbance input channels; \\ & \texttt{false}&--& use only the control input channels (default) \\ \hline \end{longtable}} \end{description} \subsubsection*{Output data} \begin{description} \item \texttt{DIST} is an $N$-dimensional row vector with nonnegative elements whose $j$-th element \texttt{DIST$(j)$} contains the computed distance (see \texttt{OPTIONS.distance}) between the selected input channels of \texttt{SYS} and the $j$-th component model \texttt{SYSM$(j)$} as follows:\\ -- if \texttt{OPTIONS.MDFreq = []} and \texttt{OPTIONS.cdinp = false} then \[ \texttt{DIST}(j) = \mathop{\mathrm{dist}}\big(G_u(\lambda),G_u^{(j)}(\lambda)\big) \] -- if \texttt{OPTIONS.MDFreq} is nonempty and \texttt{OPTIONS.cdinp = false} then \[ \texttt{DIST}(j) = \max_{k} \mathop{\mathrm{dist}}\big(G_u(\lambda_k),G_u^{(j)}(\lambda_k)\big) \] -- if \texttt{OPTIONS.MDFreq = []} and \texttt{OPTIONS.cdinp = true} then \[ \texttt{DIST}(j) = \mathop{\mathrm{dist}}\big(\big[\,G_u(\lambda)\;G_d(\lambda)\,\big], \big[\,G_u^{(j)}(\lambda)\;G_d^{(j)}(\lambda)\,\big]\big) \] -- if \texttt{OPTIONS.MDFreq} is nonempty and \texttt{OPTIONS.cdinp = true} then \[ \texttt{DIST}(j) = \max_{k} \mathop{\mathrm{dist}}\big(\big[\,G_u(\lambda_k)\;G_d(\lambda_k)\,\big], \big[\,G_u^{(j)}(\lambda_k)\;G_d^{(j)}(\lambda_k)\,\big]\big) \] \item \texttt{FPEAK} is an $N$-dimensional row vector, whose $j$-th element \texttt{FPEAK$(j)$} contains the peak frequency (in rad/TimeUnit), where \texttt{DIST$(j)$} is achieved. \item \texttt{MIND} is the index $\ell$ of the component model for which the minimum value of the distances in \texttt{DIST} is achieved. \end{description} \subsubsection*{Method} The definition of the distances of a set of component models to a current model is given in Section \ref{sec:mddist2c}. The evaluation of the $\nu$-gap distances relies on the definition proposed in \cite{Vinn93}. The point-wise distances $\mathop{\mathrm{dist}}\big(G_u(\lambda_k),G_u^{(j)}(\lambda_k)\big)$ for the $\mathcal{H}_\infty$- and $\mathcal{H}_2$ norms are simply the 2-norm of the difference of the frequency responses \( \mathop{\mathrm{dist}}\big(G_u(\lambda_k),G_u^{(j)}(\lambda_k)\big) = \big\|G_u(\lambda_k)-G_u^{(j)}(\lambda_k)\big\|_2. \) Similar formulas apply if the disturbance inputs are also selected. \subsubsection*{Example} \begin{example} \label{ex:Ex6.1bis} This is \emph{Example} 6.1 from the book \cite{Varg17}, which deals with a continuous-time state-space model, describing, in the fault-free case, the lateral dynamics of an F-16 aircraft with the matrices \[ A^{(1)} = \left[\begin{array}{rrrr} -0.4492& 0.046& 0.0053& -0.9926\\ 0& 0& 1.0000& 0.0067\\ -50.8436& 0& -5.2184& 0.7220\\ ~16.4148& 0& 0.0026& -0.6627 \end{array}\right] , \quad B_u^{(1)} = \left[\begin{array}{rr} 0.0004& 0.0011\\ 0& 0\\ -1.4161& 0.2621\\ -0.0633& -0.1205 \end{array}\right] ,\] \[ \;\, C^{(1)} = I_4, \;\qquad D_u^{(1)} = 0_{4\times 2} \, .\] The four state variables are the sideslip angle, roll angle, roll rate and yaw rate, and the two input variables are the aileron deflection and rudder deflection. The model detection problem addresses the synthesis of model detection filters for the detection and identification of loss of efficiency of the two flight actuators, which control the deflections of the aileron and rudder. The individual fault models correspond to different degrees of surface efficiency degradation. A multiple model with $N = 9$ component models is used, which correspond to a two-dimensional parameter grid for $N$ values of the parameter vector $\rho := [\rho_1,\rho_2]^T$. For each component of $\rho$, we employ the three grid points $\{0,0.5,1\}$. The component system matrices in (\ref{emdsyn:sysiss}) are defined for $i = 1, 2, \ldots, N$ as: $E^{(i)} = I_4$, $A^{(i)} = A^{(1)}$, $C^{(i)} = C^{(1)}$, and $B_u^{(i)} = B^{(1)}_u \Gamma^{(i)}$, where $\Gamma^{(i)} = \mathop{\mathrm{diag}} \big(1-\rho_1^{(i)},1-\rho_2^{(i)}\big)$ and $\big(\rho_1^{(i)},\rho_2^{(i)}\big)$ are the values of parameters $(\rho_1,\rho_2)$ on the chosen grid: \begin{center} {\tabcolsep=2mm\begin{tabular}{|r|rrrrrrrrr|} \hline $\rho_1:$ & 0 & 0 & 0 & 0.5 & 0.5 & 0.5 & 1 & 1 & 1 \\ $\rho_2:$ & 0 & 0.5 & 1 & 0 & 0.5 & 1 & 0 & 0.5 & 1 \\\hline \end{tabular} . } \end{center} For example, $\big(\rho_1^{(1)},\rho_2^{(1)}\big) = (0,0)$ corresponds to the fault-free situation, while $\big(\rho_1^{(9)},\rho_2^{(9)}\big) = (1,1)$ corresponds to complete failure of both control surfaces. It follows, that the TFM $G_u^{(i)}(s)$ of the $i$-th system can be expressed as \begin{equation}\label{mdnnugapdist:Gui_ex} G_u^{(i)}(s) = G_u^{(1)}(s)\Gamma^{(i)}, \end{equation} where \[ G_u^{(1)}(s) = C^{(1)}\big(sI-A^{(1)}\big)^{-1}B^{(1)}_u \] is the TFM of the fault-free system. Note that $G_u^{(N)}(s) = 0$ describes the case of complete failure. We evaluate the distances between a potential current model to the set of component models using a finer grid of the damage parameters with a length of 0.05, leading to a 441 parameter combinations. For each pair of values $(\rho_1,\rho_2)$ on this grid we determine the current transfer function matrix \[ G_u(s) := C^{(1)}\big(sI-A^{(1)}\big)^{-1}B^{(1)}\left[\begin{smallmatrix} 1-\rho_1 & 0\\ 0 & 1-\rho_2\end{smallmatrix}\right] \] and compute the distances to the component models $G_u^{(i)}(s)$ defined in (\ref{mdnnugapdist:Gui_ex}). For the evaluation of least distances, we employ four methods. The first is simply to determine the least distance between the current values of $(\rho_1,\rho_2)$ to the values defined in the above coarse grid. The second and third evaluations of the least distance are based on evaluating the minimum $\mathcal{H}_\infty$- or $\mathcal{H}_2$-norm of the difference $G_u^{(i)}(s)-G_u(s)$, respectively. The fourth evaluation computes the minimum of $\nu$-gap distances $\delta_\nu\big(G_u^{(i)}(s),G_u(s)\big)$. The resulting numbers of matches of the models defined on the finer grid with those on the original coarse grid result by counting the model indices at the least distances, which are plotted in the histogram in Fig.\ \ref{fig:hist-dist}. As it can be observed, there are differences between the least distances determined with different methods. While the direct comparison of parameters and the $\mathcal{H}_\infty$- and $\mathcal{H}_2$-norm based values agree reasonably well, the information provided by the computation of $\nu$-gap distances significantly differ, showing strong preference for the 4-th model and significantly less preferences for the 7-th, 8-th, and 9-th models. The largest number of matches occurs for the 5-th model, which corresponds to $\rho_1 = 0.5$ and $\rho_2 = 0.5$. \begin{figure}[thpb] \begin{center} \vspace*{-5mm} \includegraphics[width=15cm]{varga_Fig_MDdist.pdf} \vspace*{-10mm} \caption{Classification of 441 models using different distances: parametric distance (dark blue), $\mathcal{H}_\infty$-norm (blue), $\mathcal{H}_2$-norm (green), $\nu$-gap distance (yellow) } \label{fig:hist-dist} \end{center} \end{figure} The following MATLAB script produces the histogram in Fig.\ \ref{fig:hist-dist}. \begin{verbatim} A = [-.4492 0.046 .0053 -.9926; 0 0 1 0.0067; -50.8436 0 -5.2184 .722; 16.4148 0 .0026 -.6627]; Bu = [0.0004 0.0011; 0 0; -1.4161 .2621; -0.0633 -0.1205]; C = eye(4); p = size(C,1); mu = size(Bu,2); Gamma = 1 - [ 0 0 0 .5 .5 .5 1 1 1; 0 .5 1 0 .5 1 0 .5 1 ]'; N = size(Gamma,1); sysu = ss(zeros(p,mu,N,1)); for i=1:N sysu(:,:,i,1) = ss(A,Bu*diag(Gamma(i,:)),C,0); end sysu = mdmodset(sysu,struct('controls',1:mu)); rhogrid = 0:0.05:1; K = length(rhogrid)^2; ind = zeros(K,4); i = 0; for rho1 = rhogrid for rho2 = rhogrid i = i+1; rho = [ rho1 rho2]; sys = ss(A,Bu*diag(1-rho),C,0); set(sys,'InputGroup',struct('controls',1:mu)); temp = Gamma - repmat(1-rho,N,1); [~,ind(i,1)] = min(sqrt(temp(:,1).^2+temp(:,2).^2)); [~,~,ind(i,2)] = mddist2c(sysu,sys,struct('distance','Inf')); [~,~,ind(i,3)] = mddist2c(sysu,sys,struct('distance','2')); [~,~,ind(i,4)] = mddist2c(sysu,sys); end end hist(ind,1:N) title('Model classification histograms') xlabel('\bf Model numbers') ylabel('\bf Number of matches') legend('\bf Parametric distance','\bf H_\infty distance',... '\bf H_2 distance','\bf \nu-gap distance') \end{verbatim} \end{example} \subsection{Functions for Performance Evaluation of FDI Filters} \label{fditools:performance} These functions address the determination of the structure matrices defined in Section \ref{isolability} and the computation of the performance criteria of FDI filters defined in Section \ref{sec:FDIPerf}. All functions are fully compatible with the results computed by the synthesis functions of FDI filters described in Section \ref{fditools:synthesis}. \subsubsection{\texttt{\bfseries fditspec}} \subsubsection*{Syntax} \index{M-functions!\texttt{\bfseries fditspec}} \begin{verbatim} SMAT = fditspec(R) SMAT = fditspec(R,TOL) SMAT = fditspec(R,TOL,FDTOL) SMAT = fditspec(R,TOL,FDTOL,FREQ) SMAT = fditspec(R,TOL,FDTOL,[],BLKOPT) SMAT = fditspec(R,TOL,FDTOL,FREQ,BLKOPT) \end{verbatim} \subsubsection*{Description} \index{fault isolability!structure matrix} \index{structure matrix} \noindent \texttt{fditspec} determines the weak or strong structure matrix corresponding to the fault inputs of the internal form of a FDI filter or of a collection of internal forms of FDI filters. \subsubsection*{Input data} \begin{description} \item \texttt{R} is a LTI system or a cell array of LTI systems. If \texttt{R} is a LTI system representing the internal form of a FDI filter, then it is in a descriptor system state-space form \begin{equation}\label{fditspec:sysss} \begin{aligned} E_R\lambda x_R(t) &= A_Rx_R(t)+ B_{R_f} f(t) + B_{R_v} v(t) ,\\ r(t) &= C_R x_R(t)+ D_{R_f} f(t) + D_{R_v} v(t) , \end{aligned} \end{equation} where $r(t) \in \mathds{R}^q$ is the residual output, $f(t) \in \mathds{R}^{m_f}$ is the fault input and $v(t)$ contains all additional inputs. Any of the input components $f(t)$ and $v(t)$ can be void. For the fault input $f(t)$ the input group \texttt{'faults'} has to be defined. If there is no input group \texttt{'faults'} defined, then, by default, all system inputs are considered faults and the auxiliary input is assumed void. The input-output form of \texttt{R} corresponding to (\ref{fditspec:sysss}) is \begin{equation}\label{fditspec:sysio} {\mathbf{r}}(\lambda) = R_f(\lambda){\mathbf{f}}(\lambda)+R_v(\lambda){\mathbf{v}}(\lambda), \end{equation} where $R_f(\lambda)$ and $R_v(\lambda)$ are the transfer function matrices from the corresponding inputs, respectively. If \texttt{R} is specified in the input-output representation (\ref{fditspec:sysio}), then it is automatically converted to an equivalent minimal order state-space form as in (\ref{fditspec:sysss}). If \texttt{R} is a $N\times 1$ cell array of LTI systems representing the internal forms of $N$ FDI filters, then the $i$-th component system \texttt{R\{$i$\}} is in the state-space form \begin{equation}\label{fditspec:sysiss} {\begin{aligned} E_R^{(i)}\lambda x_R^{(i)}(t) & = A_R^{(i)}x_R^{(i)}(t)+ B_{R_f}^{(i)}f(t)+ B_{R_v}^{(i)}v(t), \\ r^{(i)}(t) & = C_R^{(i)} x_R^{(i)}(t) + D_{R_f}^{(i)}f(t)+ D_{R_v}^{(i)}v(t) , \end{aligned}} \end{equation} where $r^{(i)}(t) \in \mathds{R}^{q^{(i)}}$ is the $i$-th residual component, $f(t) \in \mathds{R}^{m_f}$ is the fault input and $v(t)$ contains the rest of inputs. Any of the input components $f(t)$ and $v(t)$ can be void. For the fault input $f(t)$ the input group \texttt{'faults'} has to be defined, while $v(t)$ includes any other (not relevant) system inputs. If there is no input group \texttt{'faults'} defined, then, by default, all system inputs are considered faults and the auxiliary input is assumed void. All component systems \texttt{R\{$i$\}}, $i = 1, \ldots, N$, must have the same number of fault inputs and the same sampling time. The input-output form of \texttt{R\{$i$\}} corresponding to (\ref{fditspec:sysiss}) is \begin{equation}\label{fditspec:sysiio} {\mathbf{r}}^{(i)}(\lambda) = R_f^{(i)}(\lambda){\mathbf{f}}(\lambda)+R_v^{(i)}(\lambda){\mathbf{v}}(\lambda), \end{equation} where $R_f^{(i)}(\lambda)$ and $R_v^{(i)}(\lambda)$ are the transfer function matrices from the corresponding inputs, respectively. If \texttt{R\{$i$\}} is specified in the input-output representation (\ref{fditspec:sysiio}), then it is automatically converted to an equivalent minimal order state-space form as in (\ref{fditspec:sysiss}). \item \texttt{TOL} is a relative tolerance used for controllability tests. A default value is internally computed if \texttt{TOL} $\leq 0$ or is not specified at input. \item \texttt{FDTOL} is an absolute threshold for the magnitudes of the zero elements in the system matrices $B_{R_f}$, $C_R$ and $D_{R_f}$, in the case of model (\ref{fditspec:sysss}), or in the matrices $B_{R_f}^{(i)}$, $C_R^{(i)}$ and $D_{R_f}^{(i)}$, in the case of models of the form (\ref{fditspec:sysiss}). Any element of these matrices whose magnitude does not exceed \texttt{FDTOL} is considered zero. Additionally, if \texttt{FREQ} is nonempty, \texttt{FDTOL} is also used for the singular-value-based rank tests performed on the system matrix $\Big[\begin{smallmatrix} A_R-\lambda E_R & B_{R_f}\\ C_R & D_{R_f} \end{smallmatrix}\Big]$, in the case of model (\ref{fditspec:sysss}), or on the system matrices $\bigg[\begin{smallmatrix} A_R^{(i)}-\lambda E_R^{(i)} & B_{R_f}^{(i)}\\ C_R^{(i)} & D_{R_f}^{(i)} \end{smallmatrix}\bigg]$ for $i = 1, \ldots, N$, in the case of models of the form (\ref{fditspec:sysiss}). If \texttt{FDTOL} $\leq 0$ or not specified at input, the default value \texttt{FDTOL} = $10^{-4}\max\big(1,\big\|B_{R_f}\big\|_1,\big\|C_R\big\|_\infty,\big\|D_{R_f}\big\|_1\big)$ is used in the case of model (\ref{fditspec:sysss}). In the case of models of the form (\ref{fditspec:sysiss}), the default value \texttt{FDTOL} = $10^{-4}\max\big(1,\big\|B_{R_f}^{(i)}\big\|_1,\big\|C_R^{(i)}\big\|_\infty,\big\|D_{R_f}^{(i)}\big\|_1\big)$ is used for handling the $i$-th model (\ref{fditspec:sysiss}). If \texttt{FDTOL} $\leq 0$ and if \texttt{FREQ} is nonempty, the default value \texttt{FDTOL} = $10^{-4} \max\Big( 1, \Big\|\left[\begin{smallmatrix} A_R & B_{R_f}\{\mbox{\rm $\scriptscriptstyle ^\mid$\hspace{-0.40em}C}}_R& D_{R_f}\end{smallmatrix}\right] \Big\|_1,\big\|E_R\big\|_1\Big)$ is used for the rank tests on the system matrix in the case of model (\ref{fditspec:sysss}). In the case of models of the form (\ref{fditspec:sysiss}), the default value \texttt{FDTOL} = $10^{-4} \max\Big( 1, \Bigg\|\left[\begin{smallmatrix} A_R^{(i)} & B_{R_f}^{(i)}\{\mbox{\rm $\scriptscriptstyle ^\mid$\hspace{-0.40em}C}}_R^{(i)}& D_{R_f}^{(i)}\end{smallmatrix}\right] \Bigg\|_1,\big\|E_R^{(i)}\big\|_1\Big)$ is used for handling the system matrix of the $i$-th model (\ref{fditspec:sysiss}). \item \texttt{FREQ} is a real vector, which contains the frequency values $\omega_k$, $k = 1, \ldots, n_f$, to be used to check for zeros of the individual (rational) elements or individual columns of the transfer function matrix $R_f(\lambda)$ in the case of model (\ref{fditspec:sysss}), or of the transfer function matrices $R_f^{(i)}(\lambda)$ in the case of models (\ref{fditspec:sysiss}). By default, \texttt{FREQ} is empty if it is not specified. For each real frequency $\omega_k$ contained in \texttt{FREQ}, there corresponds a complex frequency $\lambda_k$, which is used to check the elements or columns of the respective transfer function matrices to have $\lambda_k$ as zero. Depending on the system type, $\lambda_k = \mathrm{i}\omega_k$, in the continuous-time case, and $\lambda_k = \exp (\mathrm{i}\omega_k T)$, in the discrete-time case, where $T$ is the sampling time of the system. \item \texttt{BLKOPT} is a character variable to be set to \texttt{'block'} to specify the block-structure based evaluation option of the structure matrix. \end{description} \subsubsection*{Output data} \begin{description} \item \texttt{SMAT} is a logical array which contains the resulting structure matrix. In the case of a LTI system \texttt{R}, \texttt{SMAT} is determined depending on the selected option \texttt{BLKOPT} and the frequency values specified in \texttt{FREQ}, as follows: \begin{itemize} \item If \texttt{BLKOPT} is not specified (or empty), then \texttt{SMAT} is the structure matrix corresponding to the zero and nonzero elements of the transfer function matrix $R_f(\lambda)$: \begin{itemize} \item If \texttt{FREQ} is empty or not specified at input, then \texttt{SMAT} is a $q\times m_f$ logical array, which contains the \emph{weak} structure matrix corresponding to the zero and nonzero elements of $R_f(\lambda)$ (see (\ref{structure_matrix}) for the definition of the weak structure matrix). Accordingly, \texttt{SMAT}$(i,j)$ = \texttt{true}, if the $(i,j)$-th element of $R_f(\lambda)$ is nonzero. Otherwise, \texttt{SMAT}$(i,j)$ = \texttt{false}. \item If \texttt{FREQ} is nonempty, then \texttt{SMAT} is a $q\times m_f \times n_f$ logical array which contains in the $k$-th page $\texttt{SMAT}(:,:,k)$, the \emph{strong} structure matrix corresponding to the presence or absence of zeros of the elements of $R_f(\lambda)$ in the complex frequency $\lambda_k$ corresponding to the $k$-th real frequency $\omega_k$ contained in \texttt{FREQ} (see description of \texttt{FREQ}) (see also (\ref{strong_structure_matrix}) for the definition of the strong structure matrix at a complex frequency $\lambda_k$). Accordingly, $\texttt{SMAT}(i,j,k)$ = \texttt{true}, if the $(i,j)$-th element of $R_f(\lambda)$ has no zero in $\lambda_k$. Otherwise, $\texttt{SMAT}(i,j,k)$ = \texttt{false}. \end{itemize} \item If \texttt{BLKOPT = 'block'} is specified, then \texttt{SMAT} is the structure (row) vector corresponding to the zero and nonzero columns of the transfer function matrix $R_f(\lambda)$: \begin{itemize} \item If \texttt{FREQ} is empty or not specified at input, then \texttt{SMAT} is a $1\times m_f$ logical (row) vector, which contains the \emph{weak} structure matrix corresponding to the zero and nonzero columns of $R_f(\lambda)$ (see (\ref{structure_matrix}) for the block-structured definition of the weak structure matrix). Accordingly, \texttt{SMAT}$(1,j)$ = \texttt{true}, if the $j$-th column of $R_f(\lambda)$ is nonzero. Otherwise, \texttt{SMAT}$(1,j)$ = \texttt{false}. \item If \texttt{FREQ} is nonempty, then \texttt{SMAT} is a $1\times m_f \times n_f$ logical array which contains in the $k$-th page $\texttt{SMAT}(:,:,k)$, the \emph{strong} structure vector corresponding to the presence or absence of a zero in the columns of $R_f(\lambda)$ in the complex frequency $\lambda_k$ corresponding to the $k$-th real frequency $\omega_k$ contained in \texttt{FREQ} (see description of \texttt{FREQ}). Accordingly, $\texttt{SMAT}(1,j,k)$ = \texttt{true}, if the $j$-th column of $R_f(\lambda)$ has no zero in the complex frequency $\lambda_k$. Otherwise, $\texttt{SMAT}(1,j,k)$ = \texttt{false}. \end{itemize} \end{itemize} In the case of a cell array of LTI systems \texttt{R\{$i$\}}, $i = 1, \ldots, N$, \texttt{SMAT} is determined depending on the frequency values specified in \texttt{FREQ}, as follows: \begin{itemize} \item[$-$] If \texttt{FREQ} is empty or not specified at input, then \texttt{SMAT} is an $N\times m_f$ logical matrix, whose $i$-th row contains the \emph{weak} structure vector corresponding to the zero and nonzero columns of the transfer function matrix $R_f^{(i)}(\lambda)$ (see (\ref{structure_matrix}) for the block-structured definition of the weak structure matrix). Accordingly, \texttt{SMAT}$(i,j)$ = \texttt{true}, if the $j$-th column of $R_f^{(i)}(\lambda)$ is nonzero. Otherwise, \texttt{SMAT}$(i,j)$ = \texttt{false}. All entries of the $i$-th row of \texttt{SMAT} are set to \texttt{false} if \texttt{R\{$i$\}} is empty. \item[$-$] If \texttt{FREQ} is nonempty, then \texttt{SMAT} is a $N\times m_f \times n_f$ logical array which contains in the $i$-th row of the $k$-th page $\texttt{SMAT}(:,:,k)$, the \emph{strong} structure (row) vector corresponding to the presence or absence of a zero in the columns of $R_f^{(i)}(\lambda)$ in the complex frequency $\lambda_k$ corresponding to the $k$-th real frequency $\omega_k$ contained in \texttt{FREQ} (see description of \texttt{FREQ}) (see also (\ref{strong_structure_matrix}) for the definition of the strong structure matrix at a complex frequency $\lambda_k$). Accordingly, $\texttt{SMAT}(i,j,k)$ = \texttt{true}, if the $j$-th column of $R_f^{(i)}(\lambda)$ has no zero in $\lambda_k$. Otherwise, $\texttt{SMAT}(i,j,k)$ = \texttt{false}. All entries of the $i$-th row of \texttt{SMAT} are set to \texttt{false} if \texttt{R\{$i$\}} is empty. \end{itemize} \end{description} \subsubsection*{Method} We first describe the implemented analysis method for the case when \texttt{R} is a LTI system in a state-space form as in (\ref{fditspec:sysss}) and $R_f(\lambda)$ is the transfer function matrix from the fault inputs to the residual output as in the input-output model (\ref{fditspec:sysio}). For the definition of the weak and strong structure matrices, see Section \ref{isolability}. For the determination of the weak structure matrix, controllable realizations are determined for each column of $R_f(\lambda)$ and tests are performed to identify the nonzero elements in the respective column of $R_f(\lambda)$ by using \cite[Corollary 7.1]{Varg17} in a controllability related dual formulation. The block-structure based evaluation is based on the input observability tests of \cite[Corollary 7.1]{Varg17}, performed for the controllable realizations of each column of $R_f(\lambda)$. For the determination of the strong structure matrix, minimal realizations are determined for each element of $R_f(\lambda)$ and the absence of zeros is assessed by checking the full rank of the corresponding system matrix for all complex frequencies corresponding to the real frequencies specified in \texttt{FREQ} (see \cite[Corollary 7.2]{Varg17}). For the block-structure based evaluation, controllable realizations are determined for each column of $R_f(\lambda)$ and the test used in \cite[Corollary 7.2]{Varg17} is employed. For the case when \texttt{R} is a cell array containing $N$ LTI systems in state-space forms as in (\ref{fditspec:sysiss}) and $R_f^{(i)}(\lambda)$ is the transfer function matrix of $i$-th LTI system \texttt{R\{$i$\}} from the fault inputs to the $i$-th residual component as in the input-output models (\ref{fditspec:sysiio}), the block-structure based evaluations, described above, are employed for each $R_f^{(i)}(\lambda)$ to determine the corresponding $i$-th row of the structure matrix \texttt{SMAT}. \subsubsection{\texttt{\bfseries fdisspec}} \subsubsection*{Syntax} \index{M-functions!\texttt{\bfseries fdisspec}} \begin{verbatim} [SMAT,GAINS] = fdisspec(R) [SMAT,GAINS] = fdisspec(R,FDGAINTOL) [SMAT,GAINS] = fdisspec(R,FDGAINTOL,FREQ) [SMAT,GAINS] = fdisspec(R,FDGAINTOL,FREQ,BLKOPT) \end{verbatim} \subsubsection*{Description} \index{fault isolability!structure matrix} \index{structure matrix} \noindent \texttt{fdisspec} determines the strong structure matrix corresponding to the fault inputs of the internal form of a FDI filter or of a collection of internal forms of FDI filters. \subsubsection*{Input data} \begin{description} \item \texttt{R} is a LTI system or a cell array of LTI systems. If \texttt{R} is a LTI system representing the internal form of a FDI filter, then it is in a descriptor system state-space form \begin{equation}\label{fdisspec:sysss} \begin{aligned} E_R\lambda x_R(t) &= A_Rx_R(t)+ B_{R_f} f(t) + B_{R_v} v(t) ,\\ r(t) &= C_R x_R(t)+ D_{R_f} f(t) + D_{R_v} v(t) , \end{aligned} \end{equation} where $r(t) \in \mathds{R}^q$ is the residual output, $f(t) \in \mathds{R}^{m_f}$ is the fault input and $v(t)$ contains all additional inputs. Any of the input components $f(t)$ and $v(t)$ can be void. For the fault input $f(t)$ the input group \texttt{'faults'} has to be defined. If there is no input group \texttt{'faults'} defined, then, by default, all system inputs are considered faults and the auxiliary input is assumed void. The input-output form of \texttt{R} corresponding to (\ref{fdisspec:sysss}) is \begin{equation}\label{fdisspec:sysio} {\mathbf{r}}(\lambda) = R_f(\lambda){\mathbf{f}}(\lambda)+R_v(\lambda){\mathbf{v}}(\lambda), \end{equation} where $R_f(\lambda)$ and $R_v(\lambda)$ are the transfer function matrices from the corresponding inputs. If \texttt{R} is specified in the input-output representation (\ref{fdisspec:sysio}), then it is automatically converted to an equivalent minimal order state-space form as in (\ref{fdisspec:sysss}). If \texttt{R} is an $N\times 1$ cell array of LTI systems representing the internal forms of $N$ FDI filters, then the $i$-th component system \texttt{R\{$i$\}} is in the state-space form \begin{equation}\label{fdisspec:sysiss} {\begin{aligned} E_R^{(i)}\lambda x_R^{(i)}(t) & = A_R^{(i)}x_R^{(i)}(t)+ B_{R_f}^{(i)}f(t)+ B_{R_v}^{(i)}v(t), \\ r^{(i)}(t) & = C_R^{(i)} x_R^{(i)}(t) + D_{R_f}^{(i)}f(t)+ D_{R_v}^{(i)}v(t) , \end{aligned}} \end{equation} where $r^{(i)}(t) \in \mathds{R}^{q^{(i)}}$ is the $i$-th residual component, $f(t) \in \mathds{R}^{m_f}$ is the fault input and $v(t)$ contains the rest of inputs. Any of the input components $f(t)$ and $v(t)$ can be void. For the fault input $f(t)$ the input group \texttt{'faults'} has to be defined, while $v(t)$ includes any other (not-relevant) system inputs. If there is no input group \texttt{'faults'} defined, then, by default, all system inputs are considered faults and the auxiliary input is assumed void. All component systems \texttt{R\{$i$\}}, $i = 1, \ldots, N$, must have the same number of fault inputs and the same sampling time. The input-output form of \texttt{R\{$i$\}} corresponding to (\ref{fdisspec:sysiss}) is \begin{equation}\label{fdisspec:sysiio} {\mathbf{r}}^{(i)}(\lambda) = R_f^{(i)}(\lambda){\mathbf{f}}(\lambda)+R_v^{(i)}(\lambda){\mathbf{v}}(\lambda), \end{equation} where $R_f^{(i)}(\lambda)$ and $R_v^{(i)}(\lambda)$ are the transfer function matrices from the corresponding inputs. If \texttt{R\{$i$\}} is specified in the input-output representation (\ref{fdisspec:sysiio}), then it is automatically converted to an equivalent minimal order state-space form as in (\ref{fdisspec:sysiss}). \item \texttt{FDGAINTOL} is a threshold for the magnitudes of the frequency-response gains of the transfer function matrix $R_f(\lambda)$ in the case of model (\ref{fdisspec:sysss}), or of the transfer function matrices $R_f^{(i)}(\lambda)$ in the case of models (\ref{fdisspec:sysiss}). If \texttt{FDGAINTOL} = 0 or not specified at input, the default value \texttt{FDGAINTOL} = 0.01 is used. \item \texttt{FREQ} is a real vector, which contains the real frequency values $\omega_k$, $k = 1, \ldots, n_f$, to be used to check for the existence of zeros of the (rational) elements or columns of the transfer function matrix $R_f(\lambda)$ in the case of model (\ref{fditspec:sysss}), or of the transfer function matrices $R_f^{(i)}(\lambda)$ in the case of models (\ref{fditspec:sysiss}). By default, \texttt{FREQ} = 0, if it is empty or not specified. For each real frequency $\omega_k$ contained in \texttt{FREQ}, there corresponds a complex frequency $\lambda_k$ which is used to evaluate $R_f(\lambda_k)$, to check that the elements or columns of the respective transfer function matrices have $\lambda_k$ as a zero. Depending on the system type, $\lambda_k = \mathrm{i}\omega_k$, in the continuous-time case, and $\lambda_k = \exp (\mathrm{i}\omega_k T)$, in the discrete-time case, where $T$ is the sampling time of the system. The complex frequencies corresponding to the real frequencies specified in \texttt{FREQ} must be disjoint from the set of poles of $R_f(\lambda)$. \item \texttt{BLKOPT} is a character variable to be set to \texttt{'block'} to specify the block-structure based evaluation option of the structure matrix. \end{description} \subsubsection*{Output data} \begin{description} \item \texttt{SMAT} is a logical array which contains the resulting structure matrix. In the case \texttt{R} is a LTI system, \texttt{SMAT} is determined depending on the selected option \texttt{BLKOPT}, as follows: \begin{itemize} \item If \texttt{BLKOPT} is not specified (or empty), then \texttt{SMAT} is a $q\times m_f \times n_f$ logical array which contains in the $k$-th page $\texttt{SMAT}(:,:,k)$, the \emph{strong} structure matrix corresponding to the presence or absence of zeros of the elements of $R_f(\lambda)$ in the complex frequency $\lambda_k$ corresponding to the $k$-th real frequency $\omega_k$ contained in \texttt{FREQ} (see description of \texttt{FREQ}) (see also (\ref{strong_structure_matrix}) for the definition of the strong structure matrix at a complex frequency $\lambda_k$). Accordingly, $\texttt{SMAT}(i,j,k)$ = \texttt{true}, if the magnitude of the $(i,j)$-th element of $R_f(\lambda_k)$ is greater than or equal to \texttt{FDGAINTOL}. Otherwise, $\texttt{SMAT}(i,j,k)$ = \texttt{false}. \item If \texttt{BLKOPT = 'block'} is specified, then \texttt{SMAT} is a $1\times m_f \times n_f$ logical array which contains in the $k$-th page $\texttt{SMAT}(:,:,k)$, the \emph{strong} structure (row) vector corresponding to the presence or absence of a zero in the columns of $R_f(\lambda)$ in the complex frequency $\lambda_k$ corresponding to the $k$-th real frequency $\omega_k$ contained in \texttt{FREQ} (see description of \texttt{FREQ}). Accordingly, $\texttt{SMAT}(1,j,k)$ = \texttt{true}, if the norm of the $j$-th column of $R_f(\lambda_k)$ is greater than or equal to \texttt{FDGAINTOL} (i.e., $\big\|R_{f_j}(\lambda_k)\big\|_2 \geq$ \texttt{FDGAINTOL}). Otherwise, $\texttt{SMAT}(1,j,k)$ = \texttt{false}. \end{itemize} In the case \texttt{R} is an $N\times 1$ cell array of LTI systems, \texttt{SMAT} is an $N\times m_f \times n_f$ logical array which contains in the $i$-th row of the $k$-th page $\texttt{SMAT}(:,:,k)$, the \emph{strong} structure (row) vector corresponding to the presence or absence of a zero in the columns of $R_f^{(i)}(\lambda)$ in the complex frequency $\lambda_k$ corresponding to the $k$-th real frequency $\omega_k$ contained in \texttt{FREQ} (see description of \texttt{FREQ}) (see also (\ref{strong_structure_matrix}) for the definition of the strong structure matrix at a complex frequency $\lambda_k$). Accordingly, $\texttt{SMAT}(i,j,k)$ = \texttt{true}, if the norm of the $j$-th column of $R_f^{(i)}(\lambda_k)$ is greater than or equal to \texttt{FDGAINTOL} (i.e., $\big\|R_{f_j}^{(i)}(\lambda_k)\big\|_2 \geq$ \texttt{FDGAINTOL}). Otherwise, $\texttt{SMAT}(i,j,k)$ = \texttt{false}. If \texttt{R\{$i$\}} is empty, then all entries of the $i$-th row of \texttt{SMAT} are set to \texttt{false}. \item \texttt{GAINS} is a real nonnegative array. In the case \texttt{R} is a LTI system, \texttt{GAINS} is determined depending on the selected option \texttt{BLKOPT}, as follows: \begin{itemize} \item If \texttt{BLKOPT} is not specified (or empty), then \texttt{GAINS} is $q\times m_f$ matrix, whose $(i,j)$-th element contains the minimum value of the frequency-response gains of the $(i,j)$-th element of $R_f(\lambda)$ evaluated over all complex frequencies corresponding to \texttt{FREQ} (see description of \texttt{FREQ}). This value is a particular instance of the $\mathcal{H}_-$-index of the $(i,j)$-th element of $R_f(\lambda)$. \item If \texttt{BLKOPT = 'block'} is specified, then \texttt{GAINS} is a $m_f$-dimensional row vector, whose $j$-th element contains the minimum of the norms of the frequency responses of the $j$-th column of $R_f(\lambda)$ evaluated over all complex frequencies corresponding to \texttt{FREQ} (see description of \texttt{FREQ}). This value is a particular instance of the $\mathcal{H}_-$-index of the $j$-th column of $R_f(\lambda)$. \end{itemize} In the case \texttt{R} is an $N\times 1$ cell array of LTI systems, \texttt{GAINS} is an $N\times m_f$ matrix, whose $(i,j)$-th element contains the minimum of the norms of the frequency responses of the $j$-th column of $R_f^{(i)}(\lambda)$ evaluated over all complex frequencies corresponding to \texttt{FREQ} (see description of \texttt{FREQ}). If \texttt{R\{$i$\}} is empty, then all entries of the $i$-th row of \texttt{GAINS} are set to zero. \end{description} \subsubsection*{Method} For the definition of the strong structure matrix at a given frequency, see Remark \ref{rem:strong_structure} of Section \ref{isolability}. For the case when \texttt{R} is a LTI system in a state-space form as in (\ref{fdisspec:sysss}) and $R_f(\lambda)$ is the transfer function matrix from the fault inputs to the residual output as in the input-output model (\ref{fdisspec:sysio}), the element-wise or column-wise (if \texttt{BLKOPT = 'block'}) evaluations of the $\mathcal{H}_-$-index on a discrete set of frequency values (see \cite[Section 5.3]{Varg17}) are employed for each element or, respectively, each column of $R_f(\lambda)$, to determine the corresponding element of the structure matrix \texttt{SMAT} and associated \texttt{GAINS}. The resulting entries of \texttt{GAINS} correspond to an element-wise or column-wise evaluation of the $\mathcal{H}_-$-index on a discrete set of frequency values (see \cite[Section 5.3]{Varg17}). For the case when \texttt{R} is a cell array containing $N$ LTI systems in state-space forms as in (\ref{fdisspec:sysiss}) and $R_f^{(i)}(\lambda)$ is the transfer function matrix of $i$-th LTI system \texttt{R\{$i$\}} from the fault inputs to the $i$-th residual component as in the input-output models (\ref{fdisspec:sysiio}), the column-wise evaluations of the $\mathcal{H}_-$-index on a discrete set of frequency values (see \cite[Section 5.3]{Varg17}) are employed for each $R_f^{(i)}(\lambda)$ to determine the corresponding $i$-row of the structure matrix \texttt{SMAT} and the associated $i$-th row of \texttt{GAINS}. \subsubsection{\texttt{\bfseries fdifscond}} \index{M-functions!\texttt{\bfseries fdifscond}} \subsubsection*{Syntax} \begin{verbatim} FSCOND = fdifscond(R) FSCOND = fdifscond(R,FREQ) FSCOND = fdifscond(R,[],S) FSCOND = fdifscond(R,FREQ,S) [BETA,GAMMA] = fdifscond(...) \end{verbatim} \subsubsection*{Description} \index{performance evaluation!fault detection and isolation!fault sensitivity condition} \noindent \texttt{fdifscond} evaluates the fault sensitivity condition of the internal form of a FDI filter or the fault sensitivity conditions of the internal forms of a collection of FDI filters. \subsubsection*{Input data} \begin{description} \item \texttt{R} is a LTI system or a cell array of LTI systems. If \texttt{R} is a LTI system representing the internal form of a FDI filter, then it is in a descriptor system state-space form \begin{equation}\label{fdifscon:sysss} {\begin{aligned} E_R\lambda x_R(t) & = A_Rx_R(t)+ B_{R_f}f(t)+ B_{R_{v}}v(t) ,\\ r(t) & = C_R x_R(t) + D_{R_f}f(t)+ D_{R_{v}}v(t) , \end{aligned}} \end{equation} where $r(t) \in \mathds{R}^q$ is the residual output, $f(t) \in \mathds{R}^{m_f}$ is the fault input, and $v(t)$ contains all additional inputs. For the fault input $f(t)$ the input group \texttt{'faults'} has to be defined. The input-output form of \texttt{R} corresponding to (\ref{fdifscon:sysss}) is \begin{equation}\label{fdifscon:sysio} {\mathbf{r}}(\lambda) = R_f(\lambda){\mathbf{f}}(\lambda)+R_v(\lambda){\mathbf{v}}(\lambda), \end{equation} where $R_f(\lambda)$ and $R_v(\lambda)$ are the transfer function matrices from the corresponding inputs. If \texttt{R} is an $N\times 1$ cell array of LTI systems representing the internal forms of $N$ FDI filters, then the $i$-th component system \texttt{R\{$i$\}} is in the state-space form \begin{equation}\label{fdifscon:sysiss} {\begin{aligned} E_R^{(i)}\lambda x_R^{(i)}(t) & = A_R^{(i)}x_R^{(i)}(t)+ B_{R_f}^{(i)}f(t)+ B_{R_v}^{(i)}v(t), \\ r^{(i)}(t) & = C_R^{(i)} x_R^{(i)}(t) + D_{R_f}^{(i)}f(t)+ D_{R_v}^{(i)}v(t) , \end{aligned}} \end{equation} where $r^{(i)}(t) \in \mathds{R}^{q^{(i)}}$ is the $i$-th residual component, $f(t) \in \mathds{R}^{m_f}$ is the fault input and $v(t)$ contains the rest of inputs. For the fault input $f(t)$ the input group \texttt{'faults'} has to be defined. The input-output form of \texttt{R\{$i$\}} corresponding to (\ref{fdifscon:sysiss}) is \begin{equation}\label{fdifscon:sysiio} {\mathbf{r}}^{(i)}(\lambda) = R_f^{(i)}(\lambda){\mathbf{f}}(\lambda)+R_v^{(i)}(\lambda){\mathbf{v}}(\lambda), \end{equation} where $R_f^{(i)}(\lambda)$ and $R_v^{(i)}(\lambda)$ are the transfer function matrices from the corresponding inputs. \item \texttt{FREQ} is a real vector, which contains the frequency values $\omega_k$, $k = 1, \ldots, n_f$, to be used to evaluate the fault condition number of the transfer function matrix $R_f(\lambda)$ in (\ref{fdifscon:sysio}), or of the transfer function matrices $R_f^{(i)}(\lambda)$ in (\ref{fdifscon:sysiio}). By default, \texttt{FREQ} is empty if it is not specified. For each real frequency $\omega_k$ contained in \texttt{FREQ}, there corresponds a complex frequency $\lambda_k$, which is used to define the complex set $\Omega = \{ \lambda_1, \ldots, \lambda_{n_f}\}$. Depending on the system type, $\lambda_k = \mathrm{i}\omega_k$, in the continuous-time case, and $\lambda_k = \exp (\mathrm{i}\omega_k T)$, in the discrete-time case, where $T$ is the sampling time of the system. \item \texttt{S} is a $q\times m_f$ logical structure matrix if \texttt{R} is the internal form of a FDI filter with $q$ residual outputs or is an $N\times m_f$ logical structure matrix if \texttt{R} is a collection of $N$ internal forms of fault detection and isolation filters, where \texttt{R$\{i\}$} is the internal form of the $i$-th filter. \end{description} \subsubsection*{Output data} \begin{description} \item \texttt{FSCOND} is the computed fault sensitivity condition, which is either a scalar or a vector, depending on the input variables. In the case of calling \texttt{fdifscond} as \begin{verbatim} FSCOND = fdifscond(R) \end{verbatim} then: \begin{itemize} \item If \texttt{R} is a LTI system, then \texttt{FSCOND} is the fault sensitivity condition computed as $\beta / \gamma$, where $\beta = \| R_{\!f}(\lambda) \|_{\infty -}$ and $\gamma = \displaystyle\max_j \|R_{\!f_j}(\lambda)\|_\infty$ ; \item If \texttt{R} is a collection of $N$ LTI systems, then \texttt{FSCOND} is an $N$-dimensional vector of fault sensitivity conditions, with \texttt{FSCOND\{$i$\}}, the $i$-th fault sensitivity condition, computed as $\beta_i / \gamma_i$, where $\beta_i = \| R_{\!f}^{(i)}(\lambda) \|_{\infty -}$ and $\gamma_i = \displaystyle\max_j \|R_{\!f_j}^{(i)}(\lambda)\|_\infty$. If \texttt{R\{$i$\}} is empty, then \texttt{FSCOND\{$i$\}} is set to \texttt{NaN}. \end{itemize} In the case of calling \texttt{fdifscond} as \begin{verbatim} FSCOND = fdifscond(R,FREQ) \end{verbatim} where \texttt{FREQ} is a nonempty vector of real frequencies, which define the set of complex frequencies $\Omega$ (see description of \texttt{FREQ}), then: \begin{itemize} \item If \texttt{R} is a LTI system, then \texttt{FSCOND} is the fault sensitivity condition computed as $\beta / \gamma$, where $\beta = \big\| R_{\!f}(\lambda) \big\|_{\Omega -}$ and $\gamma = \displaystyle\max_{j}\big\{ \sup_{\lambda_s \in \Omega} \big\|R_{\!f_j}(\lambda_s)\big\|_2 \big\}$ ; \item If \texttt{R} is a collection of $N$ LTI systems, then \texttt{FSCOND} is an $N$-dimensional vector of fault sensitivity conditions, with \texttt{FSCOND\{$i$\}}, the $i$-th fault sensitivity condition, computed as $\beta_i / \gamma_i$, where $\beta_i = \big\| R_{\!f}^{(i)}(\lambda) \big\|_{\Omega -}$ and $\gamma_i = \displaystyle\max_{j}\big\{ \sup_{\lambda_s \in \Omega} \big\|R_{\!f_j}^{(i)}(\lambda_s)\big\|_2 \big\}$. If \texttt{R\{$i$\}} is empty, then \texttt{FSCOND\{$i$\}} is set to \texttt{NaN}. \end{itemize} In the case of calling \texttt{fdifscond} as \begin{verbatim} FSCOND = fdifscond(R,[],S) \end{verbatim} then: \begin{itemize} \item If \texttt{R} is a LTI system with $q$ residual outputs and \texttt{S} is a $q\times m_f$ structure matrix, then \texttt{FSCOND} is a $q$-dimensional vector of fault sensitivity conditions. \texttt{FSCOND\{$i$\}} is the fault sensitivity condition of the $i$-th row $R_{\!f}^{(i)}(\lambda)$ of $R_{\!f}(\lambda)$, computed as $\beta_i / \gamma_i$, with $\beta_i = \big\| R_{\!f^{(i)}}^{(i)}(\lambda) \big\|_{\infty -}$ and $\gamma_i = \displaystyle\max_j \big\|R_{\!f_j}^{(i)}(\lambda)\big\|_\infty$, where $R_{\!f^{(i)}}^{(i)}(\lambda)$ is formed from the elements of $R_{\!f}^{(i)}(\lambda)$ which correspond to \texttt{true} values in the $i$-th row of \texttt{S} and $R_{\!f_j}^{(i)}(\lambda)$ is the $(i,j)$-th element of $R_{\!f}(\lambda)$; \item If \texttt{R} is a collection of $N$ LTI systems and \texttt{S} is an $N\times m_f$ structure matrix, then \texttt{FSCOND} is an $N$-dimensional vector of fault sensitivity conditions, with \texttt{FSCOND\{$i$\}}, the $i$-th fault sensitivity condition, computed as $\beta_i / \gamma_i$, with $\beta_i = \big\| R_{\!f^{(i)}}^{(i)}(\lambda) \big\|_{\infty -}$ and $\gamma_i = \displaystyle\max_j \big\|R_{\!f_j}^{(i)}(\lambda)\big\|_\infty$, where $R_{\!f^{(i)}}^{(i)}(\lambda)$ is formed from the columns of $R_{\!f}^{(i)}(\lambda)$ which correspond to \texttt{true} values in the $i$-th row of \texttt{S} and $R_{\!f_j}^{(i)}(\lambda)$ is the $j$-th column of $R_{\!f}^{(i)}(\lambda)$. If \texttt{R\{$i$\}} is empty, then \texttt{FSCOND\{$i$\}} is set to \texttt{NaN}. \end{itemize} In the case of calling \texttt{fdifscond} as \begin{verbatim} FSCOND = fdifscond(R,FREQ,S) \end{verbatim} where both \texttt{FREQ} and \texttt{S} are nonempty then: \begin{itemize} \item If \texttt{R} is a LTI system with $q$ residual outputs and \texttt{S} is a $q\times m_f$ structure matrix, then \texttt{FSCOND} is a $q$-dimensional vector of fault sensitivity conditions. \texttt{FSCOND\{$i$\}} is the fault sensitivity condition of the $i$-th row $R_{\!f}^{(i)}(\lambda)$ of $R_{\!f}(\lambda)$, computed as $\beta_i / \gamma_i$, with $\beta_i = \big\| R_{\!f^{(i)}}^{(i)}(\lambda) \big\|_{\Omega -}$ and $\gamma_i = \displaystyle\max_{j}\big\{ \sup_{\lambda_s \in \Omega} \big\|R_{\!f_j}^{(i)}(\lambda_s)\big\|_2\big\}$, where $R_{\!f^{(i)}}^{(i)}(\lambda)$ is formed from the elements of $R_{\!f}^{(i)}(\lambda)$ which correspond to \texttt{true} values in the $i$-th row of \texttt{S} and $R_{\!f_j}^{(i)}(\lambda)$ is the $(i,j)$-th element of $R_{\!f}(\lambda)$; \item If \texttt{R} is a collection of $N$ LTI systems and \texttt{S} is an $N\times m_f$ structure matrix, then \texttt{FSCOND} is an $N$-dimensional vector of fault sensitivity conditions. \texttt{FSCOND\{$i$\}} is the fault sensitivity condition of the $i$-th system \texttt{R\{$i$\}}, computed as $\beta_i / \gamma_i$, with $\beta_i = \big\| R_{\!f^{(i)}}^{(i)}(\lambda) \big\|_{\Omega -}$ and $\gamma_i = \displaystyle\max_{j}\big\{ \sup_{\lambda_s \in \Omega} \big\|R_{\!f_j}^{(i)}(\lambda_s)\big\|_2 \big\}$, where $R_{\!f^{(i)}}^{(i)}(\lambda)$ is formed from the columns of $R_{\!f}^{(i)}(\lambda)$ which correspond to \texttt{true} values in the $i$-th row of \texttt{S} and $R_{\!f_j}^{(i)}(\lambda)$ is the $j$-th column of $R_{\!f}^{(i)}(\lambda)$. If \texttt{R\{$i$\}} is empty, then \texttt{FSCOND\{$i$\}} is set to \texttt{NaN}. \end{itemize} In the case of calling \texttt{fdifscond} as \begin{verbatim} [BETA,GAMMA] = fdifscond(...) \end{verbatim} then: If \texttt{BETA} and \texttt{GAMMA} are scalar values, then they contain the values of $\beta$ and $\gamma$, respectively, whose ratio represents the fault sensitivity condition. If \texttt{BETA} and \texttt{GAMMA} are vectors, then \texttt{BETA\{$i$\}} and \texttt{GAMMA\{$i$\}} contain the values of $\beta_i$ and $\gamma_i$, respectively, whose ratio represents the $i$-th fault sensitivity condition. If \texttt{R\{$i$\}} is empty, then \texttt{BETA\{$i$\}} and \texttt{GAMMA\{$i$\}} are set to zero. \end{description} \subsubsection*{Method} The definitions of the fault sensitivity condition in terms of the $\mathcal{H}_{\infty -}$-index and its finite frequency counterpart, the $\mathcal{H}_{\Omega -}$-index, are given in Section \ref{sec:fscond}. \subsubsection{\texttt{\bfseries fdif2ngap}} \index{M-functions!\texttt{\bfseries fdif2ngap}} \subsubsection*{Syntax} \begin{verbatim} GAP = fdif2ngap(R) GAP = fdif2ngap(R,FREQ) GAP = fdif2ngap(R,[],S) GAP = fdif2ngap(R,FREQ,S) [BETA,GAMMA] = fdif2ngap(...) \end{verbatim} \subsubsection*{Description} \index{performance evaluation!fault detection and isolation!fault-to-noise gap} \noindent \texttt{fdif2ngap} evaluates the fault-to-noise gap of the internal form of a FDI filter or the fault-to-noise gaps of the internal forms of a collection of FDI filters. \subsubsection*{Input data} \begin{description} \item \texttt{R} is a LTI system or a cell array of LTI systems. If \texttt{R} is a LTI system representing the internal form of a FDI filter, then it is in a descriptor system state-space form \begin{equation}\label{fdif2ngap:sysss} \begin{aligned} E_R\lambda x_R(t) & = A_Rx_R(t)+ B_{R_f}f(t)+ B_{R_w}w(t) + B_{R_{v}}v(t) ,\\ r(t) & = C_R x_R(t) + D_{R_f}f(t)+ D_{R_w}w(t) + D_{R_{v}}v(t) , \end{aligned} \end{equation} where $r(t) \in \mathds{R}^q$ is the residual output, $f(t) \in \mathds{R}^{m_f}$ is the fault input, $w(t)\in \mathds{R}^{m_w}$ is the noise input and $v(t)$ is the auxiliary input. For the fault input $f(t)$ and noise input $w(t)$ the input groups \texttt{'faults'} and \texttt{'noise'}, respectively, have to be defined. The input-output form of \texttt{R} corresponding to (\ref{fdif2ngap:sysss}) is \begin{equation}\label{fdif2ngap:sysio} {\mathbf{y}}(\lambda) = G_f(\lambda){\mathbf{f}}(\lambda)+G_w(\lambda){\mathbf{w}}(\lambda)+G_v(\lambda){\mathbf{v}}(\lambda), \end{equation} where $R_f(\lambda)$, $R_w(\lambda)$ and $R_v(\lambda)$ are the transfer function matrices from the corresponding inputs. If \texttt{R} is an $N\times 1$ cell array of LTI systems representing the internal forms of $N$ FDI filters, then the $i$-th component system \texttt{R\{$i$\}} is in the state-space form \begin{equation}\label{fdif2ngap:sysiss} {\begin{aligned} E_R^{(i)}\lambda x_R^{(i)}(t) & = A_R^{(i)}x_R^{(i)}(t)+ B_{R_f}^{(i)}f(t)+ B_{R_w}^{(i)}w(t), \\ r^{(i)}(t) & = C_R^{(i)} x_R^{(i)}(t) + D_{R_f}^{(i)}f(t)+ D_{R_w}^{(i)}w(t), \end{aligned}} \end{equation} where $r^{(i)}(t) \in \mathds{R}^{q^{(i)}}$ is the $i$-th residual component, $f(t) \in \mathds{R}^{m_f}$ is the fault input and $w(t)$ is the noise input. For the fault input $f(t)$ and noise input $w(t)$ the input groups \texttt{'faults'} and \texttt{'noise'}, respectively, have to be defined. The input-output form of \texttt{R\{$i$\}} corresponding to (\ref{fdif2ngap:sysiss}) is \begin{equation}\label{fdif2ngap:sysiio} {\mathbf{r}}^{(i)}(\lambda) = R_f^{(i)}(\lambda){\mathbf{f}}(\lambda)+R_w^{(i)}(\lambda){\mathbf{w}}(\lambda), \end{equation} where $R_f^{(i)}(\lambda)$ and $R_w^{(i)}(\lambda)$ are the transfer function matrices from the corresponding inputs. \item \texttt{FREQ} is a real vector, which contains the frequency values $\omega_k$, $k = 1, \ldots, n_f$, to be used to evaluate the gap between the transfer function matrices $R_f(\lambda)$ and $R_w(\lambda)$ in (\ref{fdif2ngap:sysio}), or between the transfer function matrices $R_f^{(i)}(\lambda)$ and $R_w^{(i)}(\lambda)$ in (\ref{fdif2ngap:sysiio}). By default, \texttt{FREQ} is empty if it is not specified. For each real frequency $\omega_k$ contained in \texttt{FREQ}, there corresponds a complex frequency $\lambda_k$, which is used to define the complex set $\Omega = \{ \lambda_1, \ldots, \lambda_{n_f}\}$. Depending on the system type, $\lambda_k = \mathrm{i}\omega_k$, in the continuous-time case, and $\lambda_k = \exp (\mathrm{i}\omega_k T)$, in the discrete-time case, where $T$ is the sampling time of the system. \item \texttt{S} is a $q\times m_f$ logical structure matrix if \texttt{R} is the internal form of fault detection filter with $q$ residual outputs or is an $N\times m_f$ logical structure matrix if \texttt{R} is a collection of $N$ internal forms of fault detection and isolation filters, where \texttt{R$\{i\}$} is the internal form of the $i$-th filter. \end{description} \subsubsection*{Output data} \begin{description} \item \texttt{GAP} is the computed fault-to-noise gap, which is either a scalar or a vector, depending on the input variables. In the case of calling \texttt{fdif2ngap} as \begin{verbatim} GAP = fdif2ngap(R) \end{verbatim} then: \begin{itemize} \item If \texttt{R} is a LTI system, then \texttt{GAP} is the fault-to-noise gap computed as $\beta / \gamma$, where $\beta = \big\| R_{\!f}(\lambda) \big\|_{\infty -}$ and $\gamma = \big\|R_w(\lambda)\big\|_\infty$ ; \item If \texttt{R} is a collection of $N$ LTI systems, then \texttt{GAP} is an $N$-dimensional vector, with \texttt{GAP\{$i$\}}, the $i$-th fault-to-noise gap, computed as $\beta_i / \gamma_i$, where $\beta_i = \big\| R_{\!f}^{(i)}(\lambda) \big\|_{\infty -}$ and $\gamma_i = \big\|R_{w}^{(i)}(\lambda)\big\|_\infty$. If \texttt{R\{$i$\}} is empty, then \texttt{GAP\{$i$\}} is set to \texttt{NaN}. \end{itemize} In the case of calling \texttt{fdif2ngap} as \begin{verbatim} GAP = fdif2ngap(R,FREQ) \end{verbatim} where \texttt{FREQ} is a nonempty vector of real frequencies, which defines the set of complex frequencies $\Omega$ (see description of \texttt{FREQ}), then: \begin{itemize} \item If \texttt{R} is a LTI system, then \texttt{GAP} is the fault-to-noise gap computed as $\beta / \gamma$, where $\beta = \big\| R_{\!f}(\lambda) \big\|_{\Omega -}$ and $\gamma = \big\|R_w(\lambda)\big\|_\infty$ ; \item If \texttt{R} is a collection of $N$ LTI systems, then \texttt{GAP} is an $N$-dimensional vector, with \texttt{GAP\{$i$\}}, the $i$-th fault-to-noise gap, computed as $\beta_i / \gamma_i$, where $\beta_i = \big\| R_{\!f}^{(i)}(\lambda) \big\|_{\Omega -}$ and $\gamma_i = \big\|R_{w}^{(i)}(\lambda)\big\|_\infty$. If \texttt{R\{$i$\}} is empty, then \texttt{GAP\{$i$\}} is set to \texttt{NaN}. \end{itemize} In the case of calling \texttt{fdif2ngap} as \begin{verbatim} GAP = fdif2ngap(R,[],S) \end{verbatim} then: \begin{itemize} \item If \texttt{R} is a LTI system with $q$ residual outputs and \texttt{S} is a $q\times m_f$ structure matrix, then \texttt{GAP} is a $q$-dimensional vector, whose $i$-th component \texttt{GAP\{$i$\}} is the fault-to-noise gap between the $i$-th rows $R_{\!f}^{(i)}(\lambda)$ and $R_{w}^{(i)}(\lambda)$ of $R_{\!f}(\lambda)$ and $R_{w}(\lambda)$, respectively, computed as $\beta_i / \gamma_i$, with $\beta_i = \big\| R_{\!f^{(i)}}^{(i)}(\lambda) \big\|_{\infty -}$ and $\gamma_i = \big\|\big[\, R_{\!\bar f^{(i)}}^{(i)}(\lambda) \; R_{w}^{(i)}(\lambda)\,\big]\big\|_\infty$, where $R_{\!f^{(i)}}^{(i)}(\lambda)$ and $R_{\!\bar f^{(i)}}^{(i)}(\lambda)$ are formed from the elements of $R_{\!f}^{(i)}(\lambda)$ which correspond to the \texttt{true} and, respectively, \texttt{false} values, in the $i$-th row of \texttt{S}; \item If \texttt{R} is a collection of $N$ LTI systems and \texttt{S} is an $N\times m_f$ structure matrix, then \texttt{GAP} is an $N$-dimensional vector, whose $i$-th component \texttt{GAP\{$i$\}} is the $i$-th fault-to-noise gap, computed as $\beta_i / \gamma_i$, with $\beta_i = \big\| R_{\!f^{(i)}}^{(i)}(\lambda) \big\|_{\infty -}$ and $\gamma_i = \big\|\big[\, R_{\!\bar f^{(i)}}^{(i)}(\lambda) \; R_{w}^{(i)}(\lambda)\,\big]\big\|_\infty$, where $R_{\!f^{(i)}}^{(i)}(\lambda)$ and $R_{\!\bar f^{(i)}}^{(i)}(\lambda)$ are formed from the columns of $R_{\!f}^{(i)}(\lambda)$ which correspond to the \texttt{true} and, respectively, \texttt{false} values, in the $i$-th row of \texttt{S}. If \texttt{R\{$i$\}} is empty, then \texttt{GAP\{$i$\}} is set to \texttt{NaN}. \end{itemize} In the case of calling \texttt{fdif2ngap} as \begin{verbatim} GAP = fdif2ngap(R,FREQ,S) \end{verbatim} where both \texttt{FREQ} and \texttt{S} are nonempty then: \begin{itemize} \item If \texttt{R} is a LTI system with $q$ residual outputs and \texttt{S} is a $q\times m_f$ structure matrix, then \texttt{GAP} is a $q$-dimensional vector, whose $i$-th component \texttt{GAP\{$i$\}} is the fault-to-noise gap between the $i$-th rows $R_{\!f}^{(i)}(\lambda)$ and $R_{w}^{(i)}(\lambda)$ of $R_{\!f}(\lambda)$ and $R_{w}(\lambda)$, respectively, computed as $\beta_i / \gamma_i$, with $\beta_i = \big\| R_{\!f^{(i)}}^{(i)}(\lambda) \big\|_{\Omega -}$ and $\gamma_i = \big\|\big[\, R_{\!\bar f^{(i)}}^{(i)}(\lambda) \; R_{w}^{(i)}(\lambda)\,\big]\big\|_\infty$, where $R_{\!f^{(i)}}^{(i)}(\lambda)$ and $R_{\!\bar f^{(i)}}^{(i)}(\lambda)$ are formed from the elements of $R_{\!f}^{(i)}(\lambda)$ which correspond to the \texttt{true} and, respectively, \texttt{false} values, in the $i$-th row of \texttt{S}; \item If \texttt{R} is a collection of $N$ LTI systems and \texttt{S} is an $N\times m_f$ structure matrix, then \texttt{GAP} is an $N$-dimensional vector, whose $i$-th component \texttt{GAP\{$i$\}} is the $i$-th fault-to-noise gap, computed as $\beta_i / \gamma_i$, with $\beta_i = \big\| R_{\!f^{(i)}}^{(i)}(\lambda) \big\|_{\Omega -}$ and $\gamma_i = \big\|\big[\, R_{\!\bar f^{(i)}}^{(i)}(\lambda) \; R_{w}^{(i)}(\lambda)\,]\big\|_\infty$, where $R_{\!f^{(i)}}^{(i)}(\lambda)$ and $R_{\!\bar f^{(i)}}^{(i)}(\lambda)$ are formed from the columns of $R_{\!f}^{(i)}(\lambda)$ which correspond to the \texttt{true} and, respectively, \texttt{false} values, in the $i$-th row of \texttt{S}. If \texttt{R\{$i$\}} is empty, then \texttt{GAP\{$i$\}} is set to \texttt{NaN}. \end{itemize} In the case of calling \texttt{fdif2ngap} as \begin{verbatim} [BETA,GAMMA] = fdif2ngap(...) \end{verbatim} then: If \texttt{BETA} and \texttt{GAMMA} are scalar values, then they contain the values of $\beta$ and $\gamma$, respectively, whose ratio represents the fault-to-noise gap. If \texttt{BETA} and \texttt{GAMMA} are vectors, then \texttt{BETA\{$i$\}} and \texttt{GAMMA\{$i$\}} contain the values of $\beta_i$ and $\gamma_i$, respectively, whose ratio represents the $i$-th fault-to-noise gap. If \texttt{R\{$i$\}} is empty, then \texttt{BETA\{$i$\}} and \texttt{GAMMA\{$i$\}} are set to zero. \end{description} \subsubsection*{Method} The definitions of the fault-to-noise gap in terms of the $\mathcal{H}_{\infty -}$-index and its finite frequency counterpart, the $\mathcal{H}_{\Omega -}$-index, are given in Section \ref{sec:f2ngap}. \subsubsection{\texttt{\bfseries fdimmperf}} \index{M-functions!\texttt{\bfseries fdimmperf}} \subsubsection*{Syntax} \begin{verbatim} GAMMA = fdimmperf(R) GAMMA = fdimmperf(R,SYSR) GAMMA = fdimmperf(R,SYSR,NRMFLAG) GAMMA = fdimmperf(R,[],NRMFLAG) GAMMA = fdimmperf(R,[],NRMFLAG,S) \end{verbatim} \subsubsection*{Description} \index{performance evaluation!fault detection and isolation!model-matching performance} \noindent \texttt{fdimmperf} evaluates the model-matching performance of the internal form of a FDI filter or the model-matching performance of the internal forms of a collection of FDI filters. \subsubsection*{Input data} \begin{description} \item \texttt{R} is a stable LTI system or a cell array of stable LTI systems. If \texttt{R} is a LTI system representing the internal form of a FDI filter, then it is in a descriptor system state-space form \begin{equation}\label{fdimmperf:sysss} {\begin{aligned} E_R\lambda x_R(t) & = A_Rx_R(t)+ B_{R_u} u(t)+ B_{R_d} d(t) + B_{R_f} f(t)+ B_{R_w} w(t) , \\ r(t) & = C_R x_R(t) + D_{R_u} u(t)+ D_{R_d} d(t) + D_{R_f} f(t) + D_{R_w} w(t) , \end{aligned}} \end{equation} where $r(t)$ is a $q$-dimensional residual output vector and any of the inputs components $u(t)$, $d(t)$, $f(t)$ or $w(t)$ can be void. For the system \texttt{R}, the input groups for $u(t)$, $d(t)$, $f(t)$, and $w(t)$ must have the standard names \texttt{\bfseries 'controls'}, \texttt{\bfseries 'disturbances'}, \texttt{\bfseries 'faults'}, and \texttt{\bfseries 'noise'}, respectively. The input-output form of \texttt{R} corresponding to (\ref{fdimmperf:sysss}) is \begin{equation}\label{fdimmperf:sysio} {\mathbf{r}}(\lambda) = R_u(\lambda){\mathbf{u}}(\lambda)+R_d(\lambda){\mathbf{d}}(\lambda)+ R_f(\lambda){\mathbf{f}}(\lambda)+R_w(\lambda){\mathbf{w}}(\lambda), \end{equation} where $R_u(\lambda)$, $R_d(\lambda)$, $R_f(\lambda)$, and $R_w(\lambda)$ are the transfer function matrices from the control, disturbance, fault, and noise inputs, respectively. In the case of void inputs, the corresponding transfer function matrices are assumed to be zero. If \texttt{R} is an $N\times 1$ cell array of LTI systems representing the internal forms of $N$ FDI filters, then the $i$-th component system \texttt{R\{$i$\}} is in the state-space form \begin{equation}\label{fdimmperf:sysiss} \begin{array}{rcl}E_R^{(i)}\lambda x_R^{(i)}(t) &=& A_R^{(i)}x_R^{(i)}(t) + B_{R_u}^{(i)}u(t) + B_{R_d}^{(i)} d(t) + B_{R_f}^{(i)} f(t) + B_{R_w}^{(i)} w(t) \, ,\\ r^{(i)}(t) &=& C_R^{(i)}x_R^{(i)}(t) + D_{R_u}^{(i)} u(t) + D_{R_d}^{(i)} d(t) + D_{R_f}^{(i)} f(t) + D_{R_w}^{(i)} w(t) \, , \end{array} \end{equation} where $r^{(i)}(t)$ is a $q_i$-dimensional output vector representing the $i$-th residual component and any of the inputs components $u(t)$, $d(t)$, $f(t)$ or $w(t)$ can be void. For each component system \texttt{R\{$i$\}}, the input groups for $u(t)$, $d(t)$, $f(t)$, and $w(t)$ must have the standard names \texttt{\bfseries 'controls'}, \texttt{\bfseries 'disturbances'}, \texttt{\bfseries 'faults'}, and \texttt{\bfseries 'noise'}, respectively. The input-output form of \texttt{R\{$i$\}} corresponding to (\ref{fdimmperf:sysiss}) is \begin{equation}\label{fdimmperf:sysiio} {\mathbf{r}}^{(i)}(\lambda) = R_u^{(i)}(\lambda){\mathbf{u}}(\lambda)+R_d^{(i)}(\lambda){\mathbf{d}}(\lambda)+ R_f^{(i)}(\lambda){\mathbf{f}}(\lambda)+R_w^{(i)}(\lambda){\mathbf{w}}(\lambda), \end{equation} where $R_u^{(i)}(\lambda)$, $R_d^{(i)}(\lambda)$, $R_f^{(i)}(\lambda)$, and $R_w^{(i)}(\lambda)$ are the transfer function matrices from the control, disturbance, fault, and noise inputs, respectively, for the $i$-th component system. \item \texttt{SYSR}, if nonempty, is a stable LTI system or a cell array of stable LTI systems. If \texttt{SYSR} is a LTI system representing a reference model for the internal form of the FDI filter \texttt{R}, then it is in the state-space form \begin{equation}\label{fdimmperf:sysrss} {\begin{aligned} \lambda x_r(t) & = A_rx_r(t)+ B_{ru} u(t)+ B_{rd} d(t) + B_{rf} f(t)+ B_{rw} w(t) , \\ y_r(t) & = C_r x_r(t) + D_{ru} u(t)+ D_{rd} d(t) + D_{rf} f(t) + D_{rw} w(t) , \end{aligned}} \end{equation} where the $y_r(t)$ is a $q$-dimensional vector and any of the inputs components $u(t)$, $d(t)$, $f(t)$, or $w(t)$ can be void. For the system \texttt{SYSR}, the input groups for $u(t)$, $d(t)$, $f(t)$, and $w(t)$ must have the standard names \texttt{\bfseries 'controls'}, \texttt{\bfseries 'disturbances'}, \texttt{\bfseries 'faults'}, and \texttt{\bfseries 'noise'}, respectively. The input-output form corresponding to (\ref{fdimmperf:sysrss}) is \begin{equation}\label{fdimmperf:sysrio} {\mathbf{y}}_r(\lambda) = M_{ru}(\lambda){\mathbf{u}}(\lambda)+M_{rd}(\lambda){\mathbf{d}}(\lambda)+ M_{rf}(\lambda){\mathbf{f}}(\lambda)+M_{rw}(\lambda){\mathbf{w}}(\lambda), \end{equation} where $M_{ru}(\lambda)$, $M_{rd}(\lambda)$, $M_{rf}(\lambda)$, and $M_{rw}(\lambda)$ are the transfer function matrices from the control, disturbance, fault, and noise inputs, respectively. In the case of void inputs, the corresponding transfer function matrices are assumed to be zero. If \texttt{SYSR} is an $N\times 1$ cell array of LTI systems representing a collection of $N$ reference models for the internal forms of $N$ FDI filters in the $N\times 1$ cell array \texttt{R}, then the $i$-th component system \texttt{SYSR\{$i$\}} is in the state-space form \begin{equation}\label{fdimmperf:sysriss} \begin{array}{rcl} \lambda x_r^{(i)}(t) & = A_r^{(i)}x_r^{(i)}(t)+ B_{ru}^{(i)} u(t)+ B_{rd}^{(i)} d(t) + B_{rf}^{(i)} f(t)+ B_{rw}^{(i)} w(t) , \\ y_r^{(i)}(t) & = C_r^{(i)} x_r^{(i)}(t) + D_{ru}^{(i)} u(t)+ D_{rd}^{(i)} d(t) + D_{rf}^{(i)} f(t) + D_{rw}^{(i)} w(t) \, , \end{array} \end{equation} where $y_r^{(i)}(t)$ is a $q_i$-dimensional vector and any of the inputs components $u(t)$, $d(t)$, $f(t)$ or $w(t)$ can be void. For each component system \texttt{SYSR\{$i$\}}, the input groups for $u(t)$, $d(t)$, $f(t)$, and $w(t)$ must have the standard names \texttt{\bfseries 'controls'}, \texttt{\bfseries 'disturbances'}, \texttt{\bfseries 'faults'}, and \texttt{\bfseries 'noise'}, respectively. The input-output form of \texttt{SYSR\{$i$\}} corresponding to (\ref{fdimmperf:sysriss}) is \begin{equation}\label{fdimmperf:sysriio} {\mathbf{y}}_r^{(i)}(\lambda) = M_{ru}^{(i)}(\lambda){\mathbf{u}}(\lambda)+M_{rd}^{(i)}(\lambda){\mathbf{d}}(\lambda)+ M_{rf}^{(i)}(\lambda){\mathbf{f}}(\lambda)+M_{rw}^{(i)}(\lambda){\mathbf{w}}(\lambda), \end{equation} where $M_{ru}^{(i)}(\lambda)$, $M_{rd}^{(i)}(\lambda)$, $M_{rf}^{(i)}(\lambda)$, and $M_{rw}^{(i)}(\lambda)$ are the transfer function matrices from the control, disturbance, fault, and noise inputs, respectively, for the $i$-th component system. \item \texttt{NRMFLAG} specifies the used system norm and, if specified, must be either 2 for using the $\mathcal{H}_2$-norm or \texttt{Inf} for using the $\mathcal{H}_\infty$-norm. By default, \texttt{NRMFLAG} = \texttt{Inf} (if not specified). \item \texttt{S} is a $q\times m_f$ logical structure matrix if \texttt{R} is a LTI system with $q$ outputs or is an $N\times m_f$ logical structure matrix if \texttt{R} is a collection of $N$ LTI systems. \end{description} \subsubsection*{Output data} \begin{description} \item \texttt{GAMMA} is the computed model-matching performance, depending on the input variables. In the case of calling \texttt{fdimmperf} as \begin{verbatim} GAMMA = fdimmperf(R,SYSR,NRMFLAG) \end{verbatim} with \texttt{NRMFLAG} = $\alpha$ ($\alpha = 2$ or $\alpha = \infty$), then: \begin{itemize} \item If \texttt{R} and \texttt{SYSR} are LTI systems having input-output descriptions of the form (\ref{fdimmperf:sysio}) and (\ref{fdimmperf:sysrio}), respectively, then the model-matching performance $\texttt{GAMMA} =\gamma$ is computed as \[ \gamma = \big\|\big[\ R_u(\lambda)\!-\!M_{ru}(\lambda) \;\; R_d(\lambda)\!-\!M_{rd}(\lambda) \;\; R_f(\lambda)\!-\!M_{rf}(\lambda) \;\; R_w(\lambda)\!-\!M_{rw}(\lambda) \, \big] \big\|_{\alpha}\, .\] \item If \texttt{R} and \texttt{SYSR} are cell arrays of $N$ LTI systems having input-output descriptions of the form (\ref{fdimmperf:sysiio}) and (\ref{fdimmperf:sysriio}), respectively, then $\texttt{GAMMA}$ is an $N$-dimensional vector, whose $i$-th component $\texttt{GAMMA}(i) = \gamma_i$ is computed as \[ \gamma_i = \big\|\big[\ R_u^{(i)}(\lambda)\!-\!M_{ru}^{(i)}(\lambda) \;\; R_d^{(i)}(\lambda)\!-\!M_{rd}^{(i)}(\lambda) \;\; R_f^{(i)}(\lambda)\!-\!M_{rf}^{(i)}(\lambda) \;\; R_w^{(i)}(\lambda)\!-\!M_{rw}^{(i)}(\lambda) \, \big] \big\|_{\alpha}\, .\] \end{itemize} The call of \texttt{fdimmperf} as \begin{verbatim} GAMMA = fdimmperf(R,SYSR) \end{verbatim} is equivalent to \begin{verbatim} GAMMA = fdimmperf(R,SYSR,Inf) . \end{verbatim} In the case of calling \texttt{fdimmperf} as \begin{verbatim} GAMMA = fdimmperf(R,[],NRMFLAG) \end{verbatim} then, for $\texttt{NRMFLAG} = \alpha$: \begin{itemize} \item If \texttt{R} is a LTI system having the input-output description of the form (\ref{fdimmperf:sysio}), then the model-matching performance $\texttt{GAMMA} =\gamma$ is computed as $\gamma = \big\|R_w(\lambda)\big\|_\alpha$; \item If \texttt{R} is a collection of $N$ LTI systems having the input-output descriptions (\ref{fdimmperf:sysiio}), then $\texttt{GAMMA}$ is an $N$-dimensional vector, whose $i$-th component $\texttt{GAMMA}(i) = \gamma_i$ is computed as $\gamma_i = \big\| R_w^{(i)}(\lambda) \big\|_\alpha$. \end{itemize} The call of \texttt{fdimmperf} as \begin{verbatim} GAMMA = fdimmperf(R) \end{verbatim} is equivalent to \begin{verbatim} GAMMA = fdimmperf(R,[],Inf) . \end{verbatim} In the case of calling \texttt{fdimmperf} as \begin{verbatim} GAMMA = fdimmperf(R,[],NRMFLAG,S) \end{verbatim} with $\texttt{NRMFLAG} = \alpha$, then: \begin{itemize} \item If \texttt{R} is a LTI system having the input-output description of the form (\ref{fdimmperf:sysio}) and \texttt{S} is a $q\times m_f$ structure matrix, then the model-matching performance $\texttt{GAMMA} =\gamma$ is computed as $\gamma = \big\| \big[\, \overline R_f(\lambda) \; R_w(\lambda) \, \big]\big\|_\alpha$, where $\overline R_f(\lambda)$ is a $q\times m_f$ transfer function matrix whose $(i,j)$-th element is 0 if $S_{ij} = \texttt{true}$ and is equal to the $(i,j)$-th element of $R_f(\lambda)$ if $S_{ij} = \texttt{false}$. \item If \texttt{R} is a collection of $N$ LTI systems having the input-output descriptions (\ref{fdimmperf:sysiio}), then $\texttt{GAMMA}$ is an $N$-dimensional vector, whose $i$-th component $\texttt{GAMMA}(i) = \gamma_i$ is computed as \[ \gamma_i = \big\| \big[\, \overline R_f^{(i)}(\lambda) \; R_w^{(i)}(\lambda)\,\big] \big\|_\alpha ,\] where $\overline R_f^{(i)}(\lambda)$ is a transfer function matrix whose $j$-th column is 0 if $S_{ij} = \texttt{true}$ and is equal to the $j$-th column of $R_f^{(i)}(\lambda)$ if $S_{ij} = \texttt{false}$. \end{itemize} \end{description} \subsubsection*{Method} The definitions of the model-matching performance are given in Section \ref{sec:mmperf}. \subsection{Functions for Performance Evaluation of Model Detection Filters} \label{fditools:performancemd} The functions for performance evaluation address the computation of the performance criteria of model detection filters defined in Section \ref{sec:mdanalperf}. All functions are fully compatible with the results computed by the synthesis functions of model detection filters described in Section \ref{fditools:mdsynthesis}. \subsubsection{\texttt{\bfseries mdperf}} \index{M-functions!\texttt{\bfseries mdperf}} \index{model detection!distance mapping} \index{performance evaluation!model detection!distance mapping} \subsubsection*{Syntax} \begin{verbatim} [MDGAIN,FPEAK,P,RELGAIN] = mdperf(R,OPTIONS) \end{verbatim} \subsubsection*{Description} \texttt{\bfseries mdperf} evaluates the distance mapping performance of a collection of model detection filters. \subsubsection*{Input data} \begin{description} \item \texttt{R} is an $N\times N$ cell array of filters, where the $(i,j)$-th filter \texttt{R\{$i,j$\}}, is the internal form of the $i$-th model detection filter acting on the $j$-th model. Each nonempty \texttt{R\{$i,j$\}} has a standard state-space representation \begin{equation}\label{mdperf:ssystemiR} {\begin{aligned} \lambda x_R^{(i,j)}(t) & = A_R^{(i,j)}x_R^{(i,j)}(t)+ B_{R_u}^{(i,j)}u(t)+ B_{R_d}^{(i,j)}d^{(j)}(t)+ B_{R_w}^{(i,j)}w^{(j)}(t), \\ r^{(i,j)}(t) & = C_R^{(i,j)} x_R^{(i,j)}(t) + D_{R_u}^{(i,j)}u(t)+ D_{R_d}^{(i,j)}d^{(j)}(t)+ D_{R_w}^{(i,j)}w^{(j)}(t) , \end{aligned}} \end{equation} where $x_R^{(i,j)}(t)$ is the state vector of the $(i,j)$-th filter with the residual output $r^{(i,j)}(t)$, control input $u(t) \in \mathds{R}^{m_u}$, disturbance input $d^{(j)}(t) \in \mathds{R}^{m_d^{(j)}}$ and noise input $w^{(j)}(t) \in \mathds{R}^{m_w^{(j)}}$, and where any of the inputs components $u(t)$, $d^{(j)}(t)$, or $w^{(j)}(t)$ can be void. The input groups for $u(t)$, $d^{(j)}(t)$, and $w^{(j)}(t)$ have the standard names \texttt{\bfseries 'controls'}, \texttt{\bfseries 'disturbances'}, and \texttt{\bfseries 'noise'}, respectively. If \texttt{OPTIONS.cdinp = true} (see below), then the same disturbance input $d$ is assumed for all filters (i.e., $d^{(j)} = d$). The state-space form (\ref{mdperf:ssystemiR}) corresponds to the input-output form \begin{equation}\label{mdperf:systemiR} {{\mathbf{r}}}^{(i,j)}(\lambda) = R_u^{(i,j)}(\lambda){\mathbf{u}}(\lambda) + R_d^{(i,j)}(\lambda){\mathbf{d}}^{(j)}(\lambda) + R_w^{(i,j)}(\lambda){\mathbf{w}}^{(j)}(\lambda) \, , \end{equation} where $R_u^{(i,j)}(\lambda)$, $R_d^{(i,j)}(\lambda)$ and $R_w^{(i,j)}(\lambda)$ are the TFMs from the corresponding inputs to the residual output. \item \texttt{OPTIONS} is a MATLAB structure used to specify various options and has the following fields: {\tabcolsep=1mm \setlength\LTleft{30pt}\begin{longtable}{|l|lcp{9cm}|} \hline \textbf{\texttt{OPTIONS} fields} & \multicolumn{3}{l|}{\textbf{Description}} \\ \hline \texttt{MDSelect} & \multicolumn{3}{p{12cm}|}{$M$-dimensional integer vector with increasing elements $\sigma_i$, $i = 1, \ldots, M$, containing the indices of the selected model detection filters for which the gains of the corresponding internal forms have to be evaluated \newline (Default: $[\,1, \ldots, N\,]$)}\\ \hline \texttt{MDFreq} & \multicolumn{3}{p{12cm}|}{real vector, which contains the frequency values $\omega_k$, $k = 1, \ldots, n_f$, for which the point-wise gains have to be computed. For each real frequency $\omega_k$, there corresponds a complex frequency $\lambda_k$ which is used to evaluate the point-wise gain. Depending on the system type, $\lambda_k = \mathrm{i}\omega_k$, in the continuous-time case, and $\lambda_k = \exp (\mathrm{i}\omega_k T)$, in the discrete-time case, where $T$ is the common sampling time of the component systems. (Default: \texttt{[ ]}) } \\ \hline \texttt{cdinp} & \multicolumn{3}{p{12cm}|}{option to use both control and disturbance input channels to evaluate the distance mapping performance, as follows:}\\ & \texttt{true} &--& use both control and disturbance input channels; \\ & \texttt{false}&--& use only the control input channels (default) \\ \hline \texttt{MDIndex} & \multicolumn{3}{p{12cm}|}{index $\ell$ of the $\ell$-th smallest gains to be used to evaluate the relative gains to the second smallest gains (Default: $\ell = 3$)} \\ \hline \end{longtable}} \end{description} \subsubsection*{Output data} \begin{description} \item \texttt{MDGAIN} is an $M\times N$ nonnegative matrix, whose $(i,j)$-th element \texttt{MDGAIN$(i,j)$} contains the computed peak gain for the selected input channels of the $(\sigma_i,j)$-th filter as follows:\\ -- if \texttt{OPTIONS.MDFreq} is empty and \texttt{OPTIONS.cdinp = false} then \[ \texttt{MDGAIN}(i,j) = \big\|R_u^{(\sigma_i,j)}(\lambda)\big\|_\infty ;\] -- if \texttt{OPTIONS.MDFreq} is nonempty and \texttt{OPTIONS.cdinp = false} then \[ \texttt{MDGAIN}(i,j) = \max_{k} \big\|R_u^{(\sigma_i,j)}(\lambda_k)\big\|_2 ; \] -- if \texttt{OPTIONS.MDFreq} is empty and \texttt{OPTIONS.cdinp = true} then \[ \texttt{MDGAIN}(i,j) = \big\| \big[\, R_u^{(\sigma_i,j)}(\lambda)\; R_d^{(\sigma_i,j)}(\lambda)\,\big]\big\|_\infty ;\] -- if \texttt{OPTIONS.MDFreq} is nonempty and \texttt{OPTIONS.cdinp = true} then \[ \texttt{MDGAIN}(i,j) = \max_{k} \big\| \big[\, R_u^{(\sigma_i,j)}(\lambda_k)\; R_d^{(\sigma_i,j)}(\lambda_k)\,\big]\big\|_2 .\] \item \texttt{FPEAK} is an $M\times N$ nonnegative matrix, whose $(i,j)$-th element \texttt{FPEAK$(i,j)$} contains the peak frequency (in rad/TimeUnit), where \texttt{MDGAIN$(i,j)$} is achieved. \\ \item \texttt{P} is an $M\times N$ integer matrix, whose $i$-th row contains the permutation to be applied to increasingly reorder the i-th row of \texttt{MDGAIN}. \\ \item \texttt{RELGAIN} is an $M$-dimensional vector, whose $i$-th element \texttt{RELGAIN$(i)$} contains the ratio of the second and $\ell$-th smallest gains in the $i$-th row of \texttt{MDGAIN}, where $\ell = $ \texttt{OPTIONS.MDIndex}. \\ \end{description} \subsubsection*{Method} The definition of the distance mapping performance of a set of model detection filters is given in Section \ref{sec:mdperf}. \subsubsection{\texttt{\bfseries mdmatch}} \index{M-functions!\texttt{\bfseries mdmatch}} \index{model detection!distance matching} \index{performance evaluation!model detection!distance matching} \subsubsection*{Syntax} \begin{verbatim} [MDGAIN,FPEAK,MIND] = mdmatch(Q,SYS,OPTIONS) \end{verbatim} \subsubsection*{Description} \texttt{\bfseries mdmatch} evaluates the distance matching performance of a collection of model detection filters acting on a given model and determines the index of the best matching component model. \subsubsection*{Input data} \begin{description} \item \texttt{Q} is an $N\times 1$ cell array of stable model detection filters, where \texttt{Q\{$i$\}} contains the $i$-th filter in a standard state-space representation \begin{equation}\label{mdmatch:ssystemiQ} {\begin{aligned} \lambda x_Q^{(i)}(t) & = A_Q^{(i)}x_Q^{(i)}(t)+ B_{Q_y}^{(i)}y(t)+ B_{Q_u}^{(i)}u(t) ,\\ r^{(i)}(t) & = C_Q^{(i)} x_Q^{(i)}(t) + D_{Q_y}^{(i)}y(t)+ D_{Q_u}^{(i)}u(t) , \end{aligned}} \end{equation} where $x_Q^{(i)}(t)$ is the state vector of the $i$-th filter with the residual signal $r^{(i)}(t)$ as output and the measured outputs $y(t)$ and control inputs $u(t)$ as inputs. The input groups for $y(t)$ and $u(t)$ have the standard names \texttt{\bfseries 'outputs'} and \texttt{\bfseries 'controls'}, respectively. The state-space form (\ref{mdmatch:ssystemiQ}) corresponds to the input-output form \begin{equation}\label{mdmatch:systemiQ} {{\mathbf{r}}}^{(i)}(\lambda) = Q^{(i)}(\lambda) \left [ \begin{array}{c}{\mathbf{y}}(\lambda) \\ {\mathbf{u}}(\lambda) \end{array} \right ] \, . \end{equation} \texttt{Q\{$i$\}} may be empty. \item \texttt{SYS} is a stable LTI model in the state-space form \begin{equation}\label{mdmatch:sysssref} \begin{array}{rcl}E\lambda x(t) &=& Ax(t) + B_u u(t) + B_d d(t) + B_w w(t) \, ,\\ y(t) &=& Cx(t) + D_u u(t) + D_d d(t) + D_w w(t) \, , \end{array} \end{equation} where $x(t) \in \mathds{R}^{n}$ is the state vector of the system with control input $u(t) \in \mathds{R}^{m_u}$, disturbance input $d(t) \in \mathds{R}^{m_d}$ and noise input $w(t) \in \mathds{R}^{m_w}$, and where any of the inputs components $u(t)$, $d(t)$, or $w(t)$ can be void. The input groups for $u(t)$, $d(t)$, and $w(t)$ have the standard names \texttt{\bfseries 'controls'}, \texttt{\bfseries 'disturbances'}, and \texttt{\bfseries 'noise'}, respectively. The state-space form (\ref{mdmatch:sysssref}) corresponds to the input-output form \begin{equation}\label{mdmatch:system} {\mathbf{y}}(\lambda) = G_u(\lambda){\mathbf{u}}(\lambda) + G_d(\lambda){\mathbf{d}}(\lambda) + G_w(\lambda){\mathbf{w}}(\lambda) , \end{equation} where $G_u(\lambda)$, $G_d(\lambda)$ and $G_w(\lambda)$ are the TFMs from the corresponding inputs to the output. \item \texttt{OPTIONS} is a MATLAB structure used to specify various options and has the following fields: {\tabcolsep=1mm \setlength\LTleft{30pt}\begin{longtable}{|l|lcp{9cm}|} \hline \textbf{\texttt{OPTIONS} fields} & \multicolumn{3}{l|}{\textbf{Description}} \\ \hline \texttt{MDFreq} & \multicolumn{3}{p{12cm}|}{real vector, which contains the frequency values $\omega_k$, $k = 1, \ldots, n_f$, for which the point-wise gains have to be computed. For each real frequency $\omega_k$, there corresponds a complex frequency $\lambda_k$ which is used to evaluate the point-wise gain. Depending on the system type, $\lambda_k = \mathrm{i}\omega_k$, in the continuous-time case, and $\lambda_k = \exp (\mathrm{i}\omega_k T)$, in the discrete-time case, where $T$ is the common sampling time of the component systems. (Default: \texttt{[ ]}) } \\ \hline \texttt{cdinp} & \multicolumn{3}{p{12cm}|}{option to use both control and disturbance input channels to evaluate the distance matching performance, as follows:}\\ & \texttt{true} &--& use both control and disturbance input channels; \\ & \texttt{false}&--& use only the control input channels (default) \\ \hline \end{longtable}} \end{description} \subsubsection*{Output data} \begin{description} \item \texttt{MDGAIN} is an $N$-dimensional column vector, whose $i$-th element \texttt{MDGAIN$(i)$} contains, for a nonempty filter \texttt{Q\{$i$\}}, the computed peak gain for the selected input channels of the $i$-th internal form as follows:\\ -- if \texttt{OPTIONS.MDFreq} is empty and \texttt{OPTIONS.cdinp = false} then \[ \texttt{MDGAIN}(i) = \left\|Q^{(i)}(\lambda)\left [ \begin{array}{c}G_u(\lambda)\\ I_{m_u} \end{array} \right ]\right\|_\infty ;\] -- if \texttt{OPTIONS.MDFreq} is nonempty and \texttt{OPTIONS.cdinp = false} then \[ \texttt{MDGAIN}(i) = \max_{k} \left\|Q^{(i)}(\lambda_k)\left [ \begin{array}{c}G_u(\lambda_k)\\ I_{m_u} \end{array} \right ]\right\|_\infty ; \] -- if \texttt{OPTIONS.MDFreq} is empty and \texttt{OPTIONS.cdinp = true} then \[ \texttt{MDGAIN}(i) = \left\|Q^{(i)}(\lambda)\left [ \begin{array}{cc}G_u(\lambda) & G_d(\lambda) \\ I_{m_u} & 0 \end{array} \right ]\right\|_\infty ;\] -- if \texttt{OPTIONS.MDFreq} is nonempty and \texttt{OPTIONS.cdinp = true} then \[ \texttt{MDGAIN}(i) = \max_{k} \left\|Q^{(i)}(\lambda_k)\left [ \begin{array}{cc}G_u(\lambda_k) & G_d(\lambda_k) \\ I_{m_u} & 0 \end{array} \right ]\right\|_\infty .\] \texttt{MDGAIN$(i) = 0$} if \texttt{Q\{$i$\}} is empty. \item \texttt{FPEAK} is an $N$-dimensional vector, whose $i$-th element \texttt{FPEAK$(i)$} contains the peak frequency (in rad/TimeUnit), where \texttt{MDGAIN$(i)$} is achieved. \\ \item \texttt{MIND} is the index $\ell$ of the component of \texttt{MDGAIN} for which the minimum value of the peak gains is achieved. For a properly designed filter \texttt{Q}, this is also the index of the best matching model to the current model \texttt{SYS}. \end{description} \subsubsection*{Method} The definitions related to the model matching performance of a set of model detection filters are given in Section \ref{sec:mdmatch}. \subsubsection{\texttt{\bfseries mdgap}} \index{M-functions!\texttt{\bfseries mdgap}} \index{model detection!noise gap} \index{performance evaluation!model detection!noise gap} \subsubsection*{Syntax} \begin{verbatim} GAP = mdgap(R,OPTIONS) [BETA,GAMMA] = mdgap(R,OPTIONS) \end{verbatim} \subsubsection*{Description} \texttt{\bfseries mdgap} computes the noise gaps of model detection filters. \subsubsection*{Input data} \begin{description} \item \texttt{R} is an $N\times N$ cell array of filters, where the $(i,j)$-th filter \texttt{R\{$i,j$\}}, is the internal form of the $i$-th model detection filter acting on the $j$-th model. Each nonempty \texttt{R\{$i,j$\}} has a standard state-space representation \begin{equation}\label{mdgap:ssystemiR} {\begin{aligned} \lambda x_R^{(i,j)}(t) & = A_R^{(i,j)}x_R^{(i,j)}(t)+ B_{R_u}^{(i,j)}u(t)+ B_{R_d}^{(i,j)}d^{(j)}(t)+ B_{R_w}^{(i,j)}w^{(j)}(t), \\ r^{(i,j)}(t) & = C_R^{(i,j)} x_R^{(i,j)}(t) + D_{R_u}^{(i,j)}u(t)+ D_{R_d}^{(i,j)}d^{(j)}(t)+ D_{R_w}^{(i,j)}w^{(j)}(t) \end{aligned}} \end{equation} where $x_R^{(i,j)}(t)$ is the state vector of the $(i,j)$-th filter with the residual output $r^{(i,j)}(t)$, control input $u(t) \in \mathds{R}^{m_u}$, disturbance input $d^{(j)}(t) \in \mathds{R}^{m_d^{(j)}}$ and noise input $w^{(j)}(t) \in \mathds{R}^{m_w^{(j)}}$, and where any of the inputs components $u(t)$, $d^{(j)}(t)$, or $w^{(j)}(t)$ can be void. The input groups for $u(t)$, $d^{(j)}(t)$, and $w^{(j)}(t)$ have the standard names \texttt{\bfseries 'controls'}, \texttt{\bfseries 'disturbances'}, and \texttt{\bfseries 'noise'}, respectively. If \texttt{OPTIONS.cdinp = true} (see below), then the same disturbance input $d$ is assumed for all filters (i.e., $d^{(j)} = d$). The state-space form (\ref{mdgap:ssystemiR}) corresponds to the input-output form \begin{equation}\label{mdgap:systemiR} {{\mathbf{r}}}^{(i,j)}(\lambda) = R_u^{(i,j)}(\lambda){\mathbf{u}}(\lambda) + R_d^{(i,j)}(\lambda){\mathbf{d}}^{(j)}(\lambda) + R_w^{(i,j)}(\lambda){\mathbf{w}}^{(j)}(\lambda) \, , \end{equation} where $R_u^{(i,j)}(\lambda)$, $R_d^{(i,j)}(\lambda)$ and $R_w^{(i,j)}(\lambda)$ are the TFMs from the corresponding inputs to the residual output. \item \texttt{OPTIONS} is a MATLAB structure used to specify various options and has the following fields: {\tabcolsep=1mm \setlength\LTleft{30pt}\begin{longtable}{|l|lcp{9cm}|} \hline \textbf{\texttt{OPTIONS} fields} & \multicolumn{3}{l|}{\textbf{Description}} \\ \hline \texttt{MDSelect} & \multicolumn{3}{p{12cm}|}{$M$-dimensional integer vector with increasing elements $\sigma_i$, $i = 1, \ldots, M$, containing the indices of the selected model detection filters for which the gaps of the corresponding internal forms have to be evaluated\newline (Default: $[\,1, \ldots, N\,]$)}\\ \hline \texttt{MDFreq} & \multicolumn{3}{p{12cm}|}{real vector, which contains the frequency values $\omega_k$, $k = 1, \ldots, n_f$, for which the point-wise gains have to be computed. For each real frequency $\omega_k$, there corresponds a complex frequency $\lambda_k$ which is used to evaluate the point-wise gain. Depending on the system type, $\lambda_k = \mathrm{i}\omega_k$, in the continuous-time case, and $\lambda_k = \exp (\mathrm{i}\omega_k T)$, in the discrete-time case, where $T$ is the common sampling time of the component systems. (Default: \texttt{[ ]}) } \\ \hline \texttt{cdinp} & \multicolumn{3}{p{12cm}|}{option to use both control and disturbance input channels to evaluate the noise gaps, as follows:}\\ & \texttt{true} &--& use both control and disturbance input channels; \\ & \texttt{false}&--& use only the control input channels (default) \\ \hline \end{longtable}} \end{description} \pagebreak[3] \subsubsection*{Output data} In the case of calling \texttt{mdgap} as \begin{verbatim} GAP = mdgap(R,OPTIONS) \end{verbatim} then \texttt{GAP} is an $M$-dimensional vector, whose $i$-th element \texttt{GAP$(i)$} contains the computed noise gap for the selected input channels of the $(\sigma_i,j)$-th filter as follows:\\ -- if \texttt{OPTIONS.MDFreq} is empty and \texttt{OPTIONS.cdinp = false} then \[ \texttt{GAP$(i)$}= \min_{j\neq \sigma_i} \big\|R_u^{(\sigma_i,j)}(\lambda)\big\|_\infty /\big\|R_w^{(\sigma_i,\sigma_i)}(\lambda)\big\|_\infty ; \] -- if \texttt{OPTIONS.MDFreq} is nonempty and \texttt{OPTIONS.cdinp = false} then \[ \texttt{GAP$(i)$} = \min_{j\neq \sigma_i}\max_{k} \big\|R_u^{(\sigma_i,j)}(\lambda_k)\big\|_\infty /\big\|R_w^{(\sigma_i,\sigma_i)}(\lambda)\big\|_\infty ; \] -- if \texttt{OPTIONS.MDFreq} is empty and \texttt{OPTIONS.cdinp = true} then \[ \texttt{GAP$(i)$} = \min_{j\neq \sigma_i}\big\| \big[\, R_u^{(\sigma_i,j)}(\lambda)\; R_d^{(\sigma_i,j)}(\lambda)\,\big]\big\|_\infty /\big\|R_w^{(\sigma_i,\sigma_i)}(\lambda)\big\|_\infty ;\] -- if \texttt{OPTIONS.MDFreq} is nonempty and \texttt{OPTIONS.cdinp = true} then \[ \texttt{GAP$(i)$} = \min_{j\neq \sigma_i}\max_{k} \big\| \big[\, R_u^{(\sigma_i,j)}(\lambda_k)\; R_d^{(\sigma_i,j)}(\lambda_k)\,\big]\big\|_\infty /\big\|R_w^{(\sigma_i,\sigma_i)}(\lambda)\big\|_\infty . \] In the case of calling \texttt{mdgap} as \begin{verbatim} [BETA,GAMMA] = mdgap(R,OPTIONS) \end{verbatim} then \texttt{BETA} and \texttt{GAMM}A are $M$-dimensional vector, whose $i$-th elements \texttt{BETA$(i)$} and \texttt{GAMMA$(i)$} contain the values whose ratio represents the noise gaps for the selected input channels of the $(\sigma_i,j)$-th filter as follows:\\ -- if \texttt{OPTIONS.MDFreq} is empty and \texttt{OPTIONS.cdinp = false} then \[ \texttt{BETA$(i)$}= \min_{j\neq \sigma_i} \big\|R_u^{(\sigma_i,j)}(\lambda)\big\|_\infty, \quad \texttt{GAMMA$(i)$} = \big\|R_w^{(\sigma_i,\sigma_i)}(\lambda)\big\|_\infty ; \] -- if \texttt{OPTIONS.MDFreq} is nonempty and \texttt{OPTIONS.cdinp = false} then \[ \texttt{BETA$(i)$} = \min_{j\neq \sigma_i}\max_{k} \big\|R_u^{(\sigma_i,j)}(\lambda_k)\big\|_2, \quad \texttt{GAMMA$(i)$} = \big\|R_w^{(\sigma_i,\sigma_i)}(\lambda)\big\|_\infty ; \] -- if \texttt{OPTIONS.MDFreq} is empty and \texttt{OPTIONS.cdinp = true} then \[ \texttt{BETA$(i)$} = \min_{j\neq \sigma_i}\big\| \big[\, R_u^{(\sigma_i,j)}(\lambda)\; R_d^{(\sigma_i,j)}(\lambda)\,\big]\big\|_\infty, \quad \texttt{GAMMA$(i)$} = \big\|R_w^{(\sigma_i,\sigma_i)}(\lambda)\big\|_\infty ;\] -- if \texttt{OPTIONS.MDFreq} is nonempty and \texttt{OPTIONS.cdinp = true} then \[ \texttt{BETA$(i)$}= \min_{j\neq \sigma_i}\max_{k} \big\| \big[\, R_u^{(\sigma_i,j)}(\lambda_k)\; R_d^{(\sigma_i,j)}(\lambda_k)\,\big]\big\|_2, \quad \texttt{GAMMA$(i)$} = \big\|R_w^{(\sigma_i,\sigma_i)}(\lambda)\big\|_\infty . \] \subsubsection*{Method} The definition of the noise gap of a set of model detection filters is given in Section \ref{sec:mdgap}. \newpage \subsection{Functions for the Synthesis of FDI Filters }\label{fditools:synthesis} \subsubsection{\texttt{\bfseries efdsyn}} \index{M-functions!\texttt{\bfseries efdsyn}} \subsubsection*{Syntax} \begin{verbatim} [Q,R,INFO] = efdsyn(SYSF,OPTIONS) \end{verbatim} \subsubsection*{Description} \index{fault detection and e@fault detection problem!a@exact (EFDP)} \texttt{\bfseries efdsyn} solves the \emph{exact fault detection problem} (EFDP) (see Section \ref{sec:EFDP}), for a given LTI system \texttt{SYSF} with additive faults. Two stable and proper filters, \texttt{Q} and \texttt{R}, are computed, where \texttt{Q} contains the fault detection filter representing the solution of the EFDP, and \texttt{R} contains its internal form. \subsubsection*{Input data} \begin{description} \item \texttt{SYSF} is a LTI system in the state-space form \begin{equation}\label{efdsyn:sysss} {\begin{aligned} E\lambda x(t) & = Ax(t)+ B_u u(t)+ B_d d(t) + B_f f(t)+ B_w w(t) + B_{v} v(t) , \\ y(t) & = C x(t) + D_u u(t)+ D_d d(t) + D_f f(t) + D_w w(t)+ B_{v} v(t) , \end{aligned}} \end{equation} where any of the inputs components $u(t)$, $d(t)$, $f(t)$, $w(t)$ or $v(t)$ can be void. The auxiliary input signal $v(t)$ can be used for convenience. For the system \texttt{SYSF}, the input groups for $u(t)$, $d(t)$, $f(t)$, and $w(t)$ have the standard names \texttt{\bfseries 'controls'}, \texttt{\bfseries 'disturbances'}, \texttt{\bfseries 'faults'}, and \texttt{\bfseries 'noise'}, respectively. For the auxiliary input $v(t)$ the standard input group \texttt{'aux'} can be used. \item \texttt{OPTIONS} is a MATLAB structure used to specify various synthesis options and has the following fields: {\setlength\LTleft{30pt}\begin{longtable}{|l|p{11.6cm}|} \hline \textbf{\texttt{OPTIONS} fields} & \textbf{Description} \\ \hline \texttt{tol} & relative tolerance for rank computations \newline (Default: internally computed)\\ \hline \texttt{tolmin} & absolute tolerance for observability tests \newline (Default: internally computed)\\ \hline \texttt{FDTol} & threshold for fault detectability checks (Default: $10^{-4}$)\\ \hline \texttt{FDGainTol} & threshold for strong fault detectability checks (Default: $10^{-2}$)\\ \hline \texttt{rdim} & desired number $q$ of residual outputs for \texttt{Q} and \texttt{R}\\ & (Default: \hspace*{-2.5mm}\begin{tabular}[t]{p{10cm}} \texttt{[ ]}, in which case: if \texttt{OPTIONS.HDesign} is empty, then \newline $q = 1$, if \texttt{OPTIONS.minimal} = \texttt{true}, or \newline $q = p-r_d$, if \texttt{OPTIONS.minimal} = \texttt{false} (see \textbf{Method}); \\if \texttt{OPTIONS.HDesign} is nonempty, then $q$ is the row dimension of the design matrix $H$ contained in \texttt{OPTIONS.HDesign})\end{tabular}\\ \hline \texttt{FDFreq} & vector of real frequency values for strong detectability checks \newline (Default: \texttt{[ ]}) \\ \hline \texttt{smarg} & stability margin for the poles of the filters \texttt{Q} and \texttt{R}\\ & (Default: \texttt{-sqrt(eps)} for a continuous-time system \texttt{SYSF}; \\ & \hspace*{4.5em}\texttt{1-sqrt(eps)} for a discrete-time system \texttt{SYSF}).\\ \hline \texttt{sdeg} & prescribed stability degree for the poles of the filters \texttt{Q} and \texttt{R}\\ & (Default: $-0.05$ for a continuous-time system \texttt{SYSF}; \\ & \hspace*{4.8em} $0.95$ for a discrete-time system \texttt{SYSF}).\\ \hline \texttt{poles} & complex vector containing a complex conjugate set of desired poles (within the stability domain) to be assigned for the filters \texttt{Q} and \texttt{R} \newline (Default: \texttt{[ ]}) \\\hline \texttt{nullspace} & option to use a specific proper nullspace basis\\ & \hspace*{-.9mm}{\tabcolsep=0.7mm\begin{tabular}[t]{lcp{10cm}} \texttt{true } &--& use a minimal proper basis (default); \\ \texttt{false} &--& use a full-order observer based basis (see \textbf{Method}). \newline \emph{Note:} This option can only be used if no disturbance inputs are present in (\ref{efdsyn:sysss}) and $E$ is invertible. \end{tabular}} \\ \hline \texttt{simple} & option to employ a simple proper basis for filter synthesis\\ & \texttt{true } -- use a simple basis; \\ & \texttt{false} -- use a non-simple basis (default)\\\hline \texttt{minimal} & option to perform a least order filter synthesis\\ & \texttt{true } -- perform least order synthesis (default); \\ & \texttt{false} -- perform full order synthesis. \\\hline \texttt{tcond} & maximum alowed condition number of the employed non-orthogonal transformations (Default: $10^4$).\\ \hline \texttt{HDesign} & full row rank design matrix $H$ to build \texttt{OPTIONS.rdim} linear combinations of the left nullspace basis vectors (see \textbf{Method}) \newline (Default: \texttt{[ ]})\\ \hline \end{longtable}} \end{description} \subsubsection*{Output data} \begin{description} \item \texttt{Q} is the resulting fault detection filter in a standard state-space form \begin{equation}\label{efdsyn:detss} {\begin{aligned} \lambda x_Q(t) & = A_Qx_Q(t)+ B_{Q_y}y(t)+ B_{Q_u}u(t) ,\\ r(t) & = C_Q x_Q(t) + D_{Q_y}y(t)+ D_{Q_u}u(t) , \end{aligned}} \end{equation} where the residual signal $r(t)$ is a $q$-dimensional vector. The resulting value of $q$ depends on the selected options \texttt{OPTIONS.rdim} and \texttt{OPTIONS.minimal} (see \textbf{Method}). For the system object \texttt{Q}, two input groups \texttt{\bfseries 'outputs'} and \texttt{\bfseries 'controls'} are defined for $y(t)$ and $u(t)$, respectively, and the output group \texttt{\bfseries 'residuals'} is defined for the residual signal $r(t)$. \item \texttt{R} is the resulting internal form of the fault detection filter and has a standard state-space representation of the form \begin{equation}\label{efdsyn:detinss} {\begin{aligned} \lambda x_R(t) & = A_Qx_R(t)+ B_{R_f}f(t)+ B_{R_w}w(t) + B_{R_{v}}v(t) ,\\ r(t) & = C_Q x_R(t) + D_{R_f}f(t)+ D_{R_w}w(t) + D_{R_{v}}v(t) . \end{aligned}} \end{equation} The input groups \texttt{\bfseries 'faults'}, \texttt{\bfseries 'noise'} and \texttt{'aux'} are defined for $f(t)$, $w(t)$, and $v(t)$, respectively, and the output group \texttt{\bfseries 'residuals'} is defined for the residual signal $r(t)$. Notice that the realizations of \texttt{Q} and \texttt{R} share the matrices $A_Q$ and $C_Q$. \item \texttt{INFO} is a MATLAB structure containing additional information as follows: \begin{center} \begin{tabular}{|l|p{12cm}|} \hline \textbf{\texttt{INFO} fields} & \textbf{Description} \\ \hline \texttt{tcond} & maximum of the condition numbers of the employed non-orthogonal transformation matrices; a warning is issued if \texttt{INFO.tcond $\geq$ OPTIONS.tcond}.\\ \hline \texttt{degs} & if \texttt{OPTIONS.simple} = \texttt{true}, the orders of the basis vectors of the employed simple nullspace basis; if \texttt{OPTIONS.simple} = \texttt{false}, the degrees of the basis vectors of an equivalent polynomial nullspace basis. \texttt{INFO.degs = [ ]} if \texttt{OPTIONS.nullspace = false} is used. \\ \hline \texttt{S} & binary structure matrix corresponding to $H\overline G_f(\lambda)$ (see \textbf{Method}) \\ \hline \texttt{HDesign} & design matrix $H$ employed for the synthesis of the fault detection filter (see \textbf{Method}) \\ \hline \end{tabular} \end{center} \end{description} \subsubsection*{Method} The function \texttt{efdsyn} implements an extension of the \textbf{Procedure EFD} from \cite[Sect.\ 5.2]{Varg17}, which relies on the nullspace-based synthesis method proposed in \cite{Varg03b}. In what follows, we succinctly present this extended procedure, in terms of the input-output descriptions. Full details of the employed state-space based computational algorithms are given in \cite{Varg17}[Chapter 7]. Let assume the system \texttt{SYSF} in (\ref{efdsyn:sysss}) has the equivalent input-output form \begin{equation}\label{efdsyn:sysio} {\mathbf{y}}(\lambda) = G_u(\lambda){\mathbf{u}}(\lambda) + G_d(\lambda){\mathbf{d}}(\lambda) + G_f(\lambda){\mathbf{f}}(\lambda) + G_w(\lambda){\mathbf{w}}(\lambda) + G_v(\lambda){\mathbf{v}}(\lambda), \end{equation} where the vectors $y$, $u$, $d$, $f$, $w$ and $v$ have dimensions $p$, $m_u$, $m_d$, $m_f$, $m_w$ and $m_v$, respectively. The resulting fault detection filter in (\ref{efdsyn:detss}) has the input-output form \begin{equation}\label{efdsyn:detio} {\mathbf{r}}(\lambda) = Q(\lambda)\left [ \begin{array}{c} {\mathbf{y}}(\lambda)\\{\mathbf{u}}(\lambda)\end{array} \right ] , \end{equation} where the residual vector $r(t)$ has $q$ components. The synthesis method which underlies \textbf{Procedure EFD}, essentially determines the filter $Q(\lambda)$ as a stable rational left annihilator of \begin{equation}\label{efdsyn:gtfm} G(\lambda) := \left [ \begin{array}{cc} G_u(\lambda) & G_d(\lambda) \\ I_{m_u} & 0 \end{array} \right ] ,\end{equation} such that $R_{f_j}(\lambda) \neq 0$, for $j = 1, \ldots, m_f$, where \begin{equation}\label{efdsyn:detintfm} R(\lambda) := \left [ \begin{array}{c|c|c} R_f(\lambda) & R_w(\lambda) & R_v(\lambda) \end{array} \right ] := {\arraycolsep=1mm Q(\lambda) \left [ \begin{array}{c|c|c} G_f(\lambda) & G_w(\lambda) & G_v(\lambda) \\ 0 & 0 & 0 \end{array} \right ] } \, . \end{equation} The resulting internal form of the fault detection filter (\ref{efdsyn:detio}) is \begin{equation}\label{efdsyn:detinio} \hspace*{-5mm}{\mathbf{r}}(\lambda) = R(\lambda)\!{\arraycolsep=0mm \left [ \begin{array}{c}{\mathbf{f}}(\lambda)\\ {\mathbf{w}}(\lambda) \\ {\mathbf{v}}(\lambda) \end{array} \right ] }\! = R_f(\lambda){\mathbf{f}}(\lambda) \!+\! R_w(\lambda){\mathbf{w}}(\lambda) \!+\! R_v(\lambda){\mathbf{v}}(\lambda) \, , \hspace*{-4mm}\end{equation} with $R(\lambda)$, defined in (\ref{efdsyn:detintfm}), stable. The filter $Q(\lambda)$ is determined in the product form \begin{equation}\label{efdsyn:Qprod} Q(\lambda) = Q_3(\lambda)Q_2(\lambda)Q_1(\lambda) , \end{equation} where the factors are determined as follows: \begin{itemize} \item[(a)] $Q_1(\lambda) = N_l(\lambda)$, with $N_l(\lambda)$ a $\big(p-r_d\big) \times (p+m_u)$ proper rational left nullspace basis satisfying $N_l(\lambda)G(\lambda) = 0$, with $r_d := \text{rank}\, G_d(\lambda)$; \item[(b)] $Q_2(\lambda)$ is an admissible factor (i.e., guaranteeing complete fault detectability) to perform least order synthesis; \item[(c)] $Q_3(\lambda)$ is a stable invertible factor determined such that $Q(\lambda)$ and the associated $R(\lambda)$ in (\ref{efdsyn:detintfm}) have a desired dynamics. \end{itemize} The computations of individual factors depend on the user's options and specific choices are discussed in what follows. \subsubsection*{Computation of $Q_1(\lambda)$} If \texttt{OPTIONS.nullspace = true} or $m_d > 0$ or $E$ is singular, then $N_l(\lambda)$ is determined as a minimal proper nullspace basis. In this case, if \texttt{OPTIONS.simple = true}, then $N_l(\lambda)$ is determined as a simple rational basis and the orders of the basis vectors are provided in \texttt{INFO.degs}. If \texttt{OPTIONS.simple = false}, then $N_l(\lambda)$ is determined as a proper rational basis and \texttt{INFO.degs} contains the degrees of the basis vectors of an equivalent polynomial nullspace basis (see \cite[Section 9.1.3]{Varg17} for definitions). A stable basis is determined if \texttt{OPTIONS.FDfreq} is not empty. If \texttt{OPTIONS.nullspace = false}, $m_d = 0$ and $E$ is invertible, then $N_l(\lambda) = [ \, I_{p} \; -G_u(\lambda)\,]$ is used, which corresponds to a full-order Luenberger observer. If \texttt{OPTIONS.FDfreq} is not empty and the system (\ref{efdsyn:sysss}) is unstable, then $\widetilde N_l(\lambda) = M(\lambda)N_l(\lambda)$ is used instead $N_l(\lambda)$, where $M(\lambda)$ and $\widetilde N_l(\lambda)$ are the stable factors of a left coprime factorization $N_l(\lambda) = M^{-1}(\lambda)\widetilde N_l(\lambda)$. To check the solvability of the EFDP, the transfer function matrix $\overline G_f(\lambda) := Q_1(\lambda) \left[\begin{smallmatrix} G_f(\lambda) \\ 0 \end{smallmatrix}\right]$ and the structure matrix $S_{H\overline G_f}$ of $H\overline G_f(\lambda)$ are determined, where $H$ is the design matrix specified in a nonempty \texttt{OPTIONS.HDesign} (otherwise $H = I_{p-r_d}$ is used). The EFDP is solvable provided $S_{H\overline G_f}$ has all its columns nonzero. The resulted $S_{H\overline G_f}$ is provided in \texttt{INFO.S}. \subsubsection*{Computation of $Q_2(\lambda)$} For a nonempty \texttt{OPTIONS.rdim}, the resulting dimension $q$ of the residual vector $r(t)$ is $q = \min(\text{\texttt{OPTIONS.rdim}},p\!-\!r_d)$, where $r_d = \mathop{\mathrm{rank}} G_d(\lambda)$. If \texttt{OPTIONS.rdim} is empty, then a default value of $q$ is used (see the description of \texttt{OPTIONS.rdim}). If \texttt{OPTIONS.minimal = false}, then $Q_2(\lambda) = H$, where $H$ is a suitable $q\times \big(p-r_d\big)$ full row rank design matrix. $H$ is set as follows. If \texttt{OPTIONS.HDesign} is nonempty, then $H = \texttt{OPTIONS.HDesign}$. If \texttt{OPTIONS.HDesign} is empty, then the matrix $H$ is chosen to build $q$ linear combinations of the $p-r_d$ left nullspace basis vectors, such that $HQ_1(\lambda)$ has full row rank. If $q = p-r_d$ then the choice $H = I_{p-r_d}$ is used, otherwise $H$ is chosen a randomly generated $q \times \big(p-r_d\big)$ real matrix. If \texttt{OPTIONS.minimal = true}, then $Q_2(\lambda)$ is a $q\times \big(p-r_d\big)$ transfer function matrix, with $q$ chosen as above. $Q_2(\lambda)$ is determined in the form \[ Q_2(\lambda) = H+Y_2(\lambda) \, , \] such that $Q_2(\lambda)Q_1(\lambda)$ $\big(\! = HN_l(\lambda)+Y_2(\lambda)N_l(\lambda)\big)$ and $Y_2(\lambda)$ are the least order solution of a left minimal cover problem \cite{Varg17g}. If \texttt{OPTIONS.HDesign} is nonempty, then $H = \texttt{OPTIONS.HDesign}$, and if \texttt{OPTIONS.HDesign} is empty, then a suitable randomly generated $H$ is employed (see above). The structure field \texttt{INFO.HDesign} contains the employed value of the design matrix $H$. \subsubsection*{Computation of $Q_3(\lambda)$} $Q_3(\lambda)$ is a stable invertible transfer function matrix determined such that $Q(\lambda)$ in (\ref{efdsyn:Qprod}) and the associated $R(\lambda)$ in (\ref{efdsyn:detintfm}) have a desired dynamics (specified via \texttt{OPTIONS.sdeg} and \texttt{OPTIONS.poles}). \subsubsection*{Example} \begin{example} This is Example 5.4 from the book \cite{Varg17} of an unstable continuous-time system with the TFMs \[ G_u(s) = \left [ \begin{array}{c} \displaystyle\frac{s+1}{s-2} \\ \\[-2mm]\displaystyle \frac{s+2}{s-3} \end{array} \right ], \;\; G_d(s) = \left [ \begin{array}{c} \displaystyle\frac{s-1}{s+2} \\ \\[-2mm] 0 \end{array} \right ] , \;\; G_f(s) = \left [ \begin{array}{cc} \displaystyle\frac{s+1}{s-2} & 0\\ \\[-2mm] \displaystyle\frac{s+2}{s-3} & 1 \end{array} \right ], \;\; G_w(s) = 0, \;\; G_v(s) = 0, \] where the fault input $f_1$ corresponds to an additive actuator fault, while the fault input $f_2$ describes an additive sensor fault in the second output $y_2$. The TFM $G_d(s)$ is non-minimum phase, having an unstable zero at 1. We want to design a least order fault detection filter $Q(s)$ with scalar output, and a stability degree of $-3$ for the poles, which fulfills: \begin{itemize} \item[--] the decoupling condition: $Q(s)\left[\begin{smallmatrix} G_u(s) & G_d(s) \\ I_{m_u} & 0 \end{smallmatrix}\right] = 0$; \item[--] the fault detectability condition: $R_{f_j}(\lambda) \neq 0, \quad j = 1, \ldots, m_f $. \end{itemize} The results computed with the following script are \[ Q(s) = \left [ \begin{array}{ccc} 0 & \displaystyle\frac{s-3}{s+3} & -\displaystyle\frac{s+2}{s+3} \end{array} \right ] , \quad R_f(s) = \left [ \begin{array}{cc} \displaystyle\frac{s+2}{s+3} & \displaystyle\frac{s-3}{s+3} \end{array} \right ] \, . \] \begin{verbatim} s = tf('s'); Gu = [(s+1)/(s-2); (s+2)/(s-3)]; Gd = [(s-1)/(s+2); 0]; p = 2; mu = 1; md = 1; mf = 2; sysf = fdimodset(ss([Gu Gd]),struct('c',1,'d',2,'f',1,'fs',2)); [Q,R] = efdsyn(sysf,struct('sdeg',-3,'rdim',1)); tf(Q), tf(R) syse = [sysf;eye(mu,mu+md+mf)]; norm_Ru_Rd = norm(Q*syse(:,{'controls','disturbances'}),inf) norm_rez = norm(Q*syse(:,'faults')-R,inf) S_weak = fditspec(R) [S_strong,abs_dcgains] = fdisspec(R) FSCOND = fdifscond(R,0) set(R,'InputName',{'f_1','f_2'},'OutputName','r'); step(R); title('Step responses from the fault inputs'), ylabel('') \end{verbatim} \end{example} \newpage \subsubsection{\texttt{\bfseries afdsyn}} \index{M-functions!\texttt{\bfseries afdsyn}} \subsubsection*{Syntax} \begin{verbatim} [Q,R,INFO] = afdsyn(SYSF,OPTIONS) \end{verbatim} \subsubsection*{Description} \index{fault detection and e@fault detection problem!approximate (AFDP)} \texttt{\bfseries afdsyn} solves the \emph{approximate fault detection problem} (AFDP) (see Section \ref{sec:AFDP}), for a given LTI system \texttt{SYSF} with additive faults. Two stable and proper filters, \texttt{Q} and \texttt{R}, are computed, where \texttt{Q} contains the fault detection filter representing the solution of the AFDP, and \texttt{R} contains its internal form. \subsubsection*{Input data} \begin{description} \item \texttt{SYSF} is a LTI system in the state-space form \begin{equation}\label{afdsyn:sysss} {\begin{aligned} E\lambda x(t) & = Ax(t)+ B_u u(t)+ B_d d(t) + B_f f(t)+ B_w w(t) + B_{v} v(t) , \\ y(t) & = C x(t) + D_u u(t)+ D_d d(t) + D_f f(t) + D_w w(t)+ B_{v} v(t) , \end{aligned}} \end{equation} where any of the inputs components $u(t)$, $d(t)$, $f(t)$, $w(t)$ or $v(t)$ can be void. The auxiliary input signal $v(t)$ can be used for convenience. For the system \texttt{SYSF}, the input groups for $u(t)$, $d(t)$, $f(t)$, and $w(t)$ have the standard names \texttt{\bfseries 'controls'}, \texttt{\bfseries 'disturbances'}, \texttt{\bfseries 'faults'}, and \texttt{\bfseries 'noise'}, respectively. For the auxiliary input $v(t)$ the standard input group \texttt{'aux'} can be used. \item \texttt{OPTIONS} is a MATLAB structure used to specify various synthesis options and has the following fields: {\setlength\LTleft{30pt}\begin{longtable}{|l|p{11.6cm}|} \hline \textbf{\texttt{OPTIONS} fields} & \textbf{Description} \\ \hline \texttt{tol} & relative tolerance for rank computations \newline (Default: internally computed)\\ \hline \texttt{tolmin} & absolute tolerance for observability tests \newline (Default: internally computed)\\ \hline \texttt{FDTol} & threshold for fault detectability checks (Default: $10^{-4}$)\\ \hline \texttt{FDGainTol} & threshold for strong fault detectability checks (Default: $10^{-2}$)\\ \hline \pagebreak[4] \hline \texttt{rdim} & desired number $q$ of residual outputs for \texttt{Q} and \texttt{R}\\ & (Default: \hspace*{-2.5mm}\begin{tabular}[t]{p{10cm}} \texttt{[ ]}, in which case $q = q_1+q_2$, with $q_1$ and $q_2$ selected as follows: \newline if \texttt{OPTIONS.HDesign} is empty, then \newline $q_1 = \min(1,r_w)$ if \texttt{OPTIONS.minimal} = \texttt{true}, or \newline $q_1 = r_w$, if \texttt{OPTIONS.minimal} = \texttt{false} (see \textbf{Method}); \\if \texttt{OPTIONS.HDesign} is nonempty, then $q_1$ is the row dimension of the design matrix $H_1$ contained in \texttt{OPTIONS.HDesign} \\ if \texttt{OPTIONS.HDesign2} is empty, then \newline $q_2 = 1-\min(1,r_w)$ if \texttt{OPTIONS.minimal} = \texttt{true}, or \newline $q_2 = p-r_d-r_w$, if \texttt{OPTIONS.minimal} = \texttt{false} (see \textbf{Method}); \\if \texttt{OPTIONS.HDesign2} is nonempty, then $q_2$ is the row dimension of the design matrix $H_2$ contained in \texttt{OPTIONS.HDesign2}) \end{tabular}\\ \hline \texttt{FDFreq} & vector of real frequency values for strong detectability checks \newline (Default: \texttt{[ ]}) \\ \hline \texttt{smarg} & stability margin for the poles of the filters \texttt{Q} and \texttt{R}\\ & (Default: \texttt{-sqrt(eps)} for a continuous-time system \texttt{SYSF}; \\ & \hspace*{4.5em}\texttt{1-sqrt(eps)} for a discrete-time system \texttt{SYSF}).\\ \hline \texttt{sdeg} & prescribed stability degree for the poles of the filters \texttt{Q} and \texttt{R}\\ & (Default: $-0.05$ for a continuous-time system \texttt{SYSF}; \\ & \hspace*{4.8em} $0.95$ for a discrete-time system \texttt{SYSF}).\\ \hline \texttt{poles} & complex vector containing a complex conjugate set of desired poles (within the stability domain) to be assigned for the filters \texttt{Q} and \texttt{R} \newline (Default: \texttt{[ ]}) \\\hline \texttt{nullspace} & option to use a specific proper nullspace basis\\ & \hspace*{-.9mm}{\tabcolsep=0.7mm\begin{tabular}[t]{lcp{10cm}} \texttt{true } &--& use a minimal proper basis (default); \\ \texttt{false} &--& use a full-order observer based basis (see \textbf{Method}). \newline \emph{Note:} This option can be only used if no disturbance inputs are present in (\ref{afdsyn:sysss}) and $E$ is invertible. \end{tabular}} \\ \hline \texttt{simple} & option to employ a simple proper basis for filter synthesis\\ & \texttt{true } -- use a simple basis; \\ & \texttt{false} -- use a non-simple basis (default)\\\hline \texttt{minimal} & option to perform a least order filter synthesis\\ & \texttt{true } -- perform least order synthesis (default); \\ & \texttt{false} -- perform full order synthesis. \\\hline \texttt{exact} & option to perform exact filter synthesis \\ & \texttt{true } -- perform exact synthesis (i.e., no optimization performed); \\ & \texttt{false} -- perform approximate synthesis (default). \\\hline \texttt{tcond} & maximum alowed condition number of the employed non-orthogonal transformations (Default: $10^4$).\\ \hline \texttt{freq} & complex frequency value to be employed to check the full row rank admissibility condition (see \textbf{Method}) \newline (Default:\texttt{[ ]}, i.e., a randomly generated frequency). \\ \hline \texttt{HDesign} & design matrix $H_1$, with full row rank $q_1$, to build $q_1$ linear combinations of the left nullspace basis vectors of $G_1(\lambda) := \left[\begin{smallmatrix} G_u(\lambda) & G_d(\lambda) \\ I & 0 \end{smallmatrix} \right]$; \newline $H_1$ is used for the synthesis of the filter components $Q^{(1)}(\lambda)$ and $R^{(1)}(\lambda)$ (see \textbf{Method}) (Default: \texttt{[ ]})\\ \hline \texttt{HDesign2} & design matrix $H_2$, with full row rank $q_2$, to build $q_2$ linear combinations of the left nullspace basis vectors of $G_2(\lambda) := \left[\begin{smallmatrix} G_u(\lambda) & G_d(\lambda) & G_w(\lambda) \\ I & 0 & 0\end{smallmatrix} \right]$; $H_2$ is used for the synthesis of the filter components $Q^{(2)}(\lambda)$ and $R^{(2)}(\lambda)$ (see \textbf{Method}) (Default: \texttt{[ ]})\\ \hline \texttt{gamma} & upper bound on the resulting $\|R_w(\lambda)\|_\infty$ (see \textbf{Method}) \newline (Default: 1) \\ \hline \texttt{epsreg} & regularization parameter (Default: 0.1) \\ \hline \texttt{sdegzer} & prescribed stability degree for zeros shifting \\ & (Default: $-0.05$ for a continuous-time system \texttt{SYSF}; \\ & \hspace*{4.8em} $0.95$ for a discrete-time system \texttt{SYSF}).\\ \hline \texttt{nonstd} & option to handle nonstandard optimization problems (see \textbf{Method})\\ & 1 -- use the quasi-co-outer--co-inner factorization (default); \\ & 2 -- use the modified co-outer--co-inner factorization with the \\ & \hspace{1.7em}regularization parameter \texttt{OPTIONS.epsreg}; \\ & 3 -- use the Wiener-Hopf type co-outer--co-inner factorization. \\ & 4 -- use the Wiener-Hopf type co-outer-co-inner factorization with\\ & \hspace{1.7em}zero shifting of the non-minimum phase factor using the\\ & \hspace{1.7em}stabilization parameter \texttt{OPTIONS.sdegzer} \\ & 5 -- use the Wiener-Hopf type co-outer-co-inner factorization with \\ & \hspace{1.7em}the regularization of the non-minimum phase factor using the \\ & \hspace{1.7em}regularization parameter \texttt{OPTIONS.epsreg} \\ \hline \end{longtable}} \end{description} \subsubsection*{Output data} \begin{description} \item \texttt{Q} is the resulting fault detection filter in a standard state-space form \begin{equation}\label{afdsyn:detss} {\begin{aligned} \lambda x_Q(t) & = A_Qx_Q(t)+ B_{Q_y}y(t)+ B_{Q_u}u(t) ,\\ r(t) & = C_Q x_Q(t) + D_{Q_y}y(t)+ D_{Q_u}u(t) , \end{aligned}} \end{equation} where the residual signal $r(t)$ is a $q$-dimensional vector. The resulting value of $q$ depends on the selected options \texttt{OPTIONS.rdim} and \texttt{OPTIONS.minimal} (see \textbf{Method}). For the system object \texttt{Q}, two input groups \texttt{\bfseries 'outputs'} and \texttt{\bfseries 'controls'} are defined for $y(t)$ and $u(t)$, respectively, and the output group \texttt{\bfseries 'residuals'} is defined for the residual signal $r(t)$. \item \texttt{R} is the resulting internal form of the fault detection filter and has a standard state-space representation of the form \begin{equation}\label{afdsyn:detinss} {\begin{aligned} \lambda x_R(t) & = A_Qx_R(t)+ B_{R_f}f(t)+ B_{R_w}w(t) + B_{R_{v}}v(t) ,\\ r(t) & = C_Q x_R(t) + D_{R_f}f(t)+ D_{R_w}w(t) + D_{R_{v}}v(t) . \end{aligned}} \end{equation} The input groups \texttt{\bfseries 'faults'}, \texttt{\bfseries 'noise'} and \texttt{'aux'} are defined for $f(t)$, $w(t)$, and $v(t)$, respectively, and the output group \texttt{\bfseries 'residuals'} is defined for the residual signal $r(t)$. Notice that the realizations of \texttt{Q} and \texttt{R} share the matrices $A_Q$ and $C_Q$. \item \texttt{INFO} is a MATLAB structure containing additional information as follows: \begin{center} \begin{tabular}{|l|p{12cm}|} \hline \textbf{\texttt{INFO} fields} & \textbf{Description} \\ \hline \texttt{tcond} & maximum of the condition numbers of the employed non-orthogonal transformation matrices; a warning is issued if \texttt{INFO.tcond $\geq$ OPTIONS.tcond}.\\ \hline \texttt{degs} & If \texttt{OPTIONS.nullspace} = \texttt{true}, then: \newline if \texttt{OPTIONS.simple} = \texttt{true}, the orders of the basis vectors of the employed simple left nullspace basis of $G_1(\lambda)$; \newline if \texttt{OPTIONS.simple} = \texttt{false}, the degrees of the basis vectors of an equivalent polynomial nullspace basis (see \textbf{Method}). \newline If \texttt{OPTIONS.nullspace = false} then \texttt{INFO.degs = [ ]}. \\ \hline \texttt{degs2} & if \texttt{OPTIONS.simple} = \texttt{true}, the orders of the basis vectors of the employed simple left nullspace basis of $\overline G_w(\lambda)$; \newline if \texttt{OPTIONS.simple} = \texttt{false}, the degrees of the basis vectors of an equivalent polynomial nullspace basis (see \textbf{Method}) \\ \hline \texttt{S} & binary structure matrix $S_1$ corresponding to $H_1\overline G_f(\lambda)$ (see \textbf{Method}) \\ \hline \texttt{S2} & binary structure matrix $S_2$ corresponding to $H_2\overline G_f^{(2)}(\lambda)$ (see \textbf{Method}) \\ \hline \texttt{HDesign} & design matrix $H_1$ employed for the synthesis of the fault detection filter (see \textbf{Method}) \\ \hline \texttt{HDesign2} & design matrix $H_2$ employed for the synthesis of the fault detection filter (see \textbf{Method}) \\ \hline \texttt{freq} & complex frequency value employed to check the full row rank admissibility condition (see \textbf{Method}) \\ \hline \texttt{gap} & achieved gap $\|R_{f}(\lambda)\|_{\infty -}/\|R_w(\lambda)\|_\infty$, where the $\mathcal{H}_-$-index is computed over the whole frequency range, if \texttt{OPTIONS.FDFreq} is empty, or over the frequency values contained in \texttt{OPTIONS.FDFreq}. (see \textbf{Method}) \\ \hline \end{tabular} \end{center} \end{description} \subsubsection*{Method} The function \texttt{afdsyn} implements an extension of the \textbf{Procedure AFD} from \cite[Sect.\ 5.3]{Varg17} as proposed in \emph{Remark 5.10} in \cite{Varg17}, which relies on the nullspace-based synthesis method proposed in \cite{Varg09b}, with extensions discussed in \cite{Glov11}. In what follows, we discuss succinctly the main steps of this extended procedure, in terms of the input-output descriptions. Full details of the employed state-space based computational algorithms are given in \cite{Varg17}[Chapter 7]. Let assume the system \texttt{SYSF} in (\ref{afdsyn:sysss}) has the equivalent input-output form \begin{equation}\label{afdsyn:sysio} {\mathbf{y}}(\lambda) = G_u(\lambda){\mathbf{u}}(\lambda) + G_d(\lambda){\mathbf{d}}(\lambda) + G_f(\lambda){\mathbf{f}}(\lambda) + G_w(\lambda){\mathbf{w}}(\lambda) + G_v(\lambda){\mathbf{v}}(\lambda), \end{equation} where the vectors $y$, $u$, $d$, $f$, $w$ and $v$ have dimensions $p$, $m_u$, $m_d$, $m_f$, $m_w$ and $m_v$, respectively. The resulting fault detection filter in (\ref{afdsyn:detss}) has the input-output form \begin{equation}\label{afdsyn:detio} {\mathbf{r}}(\lambda) = Q(\lambda)\left [ \begin{array}{c} {\mathbf{y}}(\lambda)\\{\mathbf{u}}(\lambda)\end{array} \right ] , \end{equation} where the residual vector $r(t)$ has $q$ components. The implemented synthesis method essentially determines the filter $Q(\lambda)$ as a stable rational left annihilator of \begin{equation}\label{afdsyn:gtfm} G_1(\lambda) := \left [ \begin{array}{cc} G_u(\lambda) & G_d(\lambda) \\ I_{m_u} & 0 \end{array} \right ] ,\end{equation} such that $R_{f_j}(\lambda) \neq 0$, for $j = 1, \ldots, m_f$, where \begin{equation}\label{afdsyn:detintfm} R(\lambda) := \left [ \begin{array}{c|c|c} R_f(\lambda) & R_w(\lambda) & R_v(\lambda) \end{array} \right ] := {\arraycolsep=1mm Q(\lambda) \left [ \begin{array}{c|c|c} G_f(\lambda) & G_w(\lambda) & G_v(\lambda) \\ 0 & 0 & 0 \end{array} \right ] } \, . \end{equation} The resulting internal form of the fault detection filter (\ref{afdsyn:detio}) is \begin{equation}\label{afdsyn:detinio} \hspace*{-5mm}{\mathbf{r}}(\lambda) = R(\lambda)\!{\arraycolsep=0mm \left [ \begin{array}{c}{\mathbf{f}}(\lambda)\\ {\mathbf{w}}(\lambda) \\ {\mathbf{v}}(\lambda) \end{array} \right ] }\! = R_f(\lambda){\mathbf{f}}(\lambda) \!+\! R_w(\lambda){\mathbf{w}}(\lambda) \!+\! R_v(\lambda){\mathbf{v}}(\lambda) \, , \hspace*{-4mm}\end{equation} with $R(\lambda)$, defined in (\ref{afdsyn:detintfm}), stable. An initial synthesis step implements the nullspace based synthesis approach and determines $Q(\lambda)$ in the product form $Q(\lambda) = \overline Q_1(\lambda)Q_1(\lambda)$, where $Q_1(\lambda)$ is a proper left nullspace basis of $G_1(\lambda)$ in (\ref{afdsyn:gtfm}). This step ensures the decoupling of control and disturbance inputs in the residual (as is apparent in (\ref{afdsyn:detinio})) and allows to determine of $\overline Q_1(\lambda)$ by solving an AFDP for the reduced system \begin{equation}\label{afdsyn:redsys} \overline {\mathbf{y}}(\lambda) := \overline G_f(\lambda){\mathbf{f}}(\lambda) \!+\! \overline G_w(\lambda){\mathbf{w}}(\lambda) \!+\! \overline G_v(\lambda){\mathbf{v}}(\lambda) \, , \end{equation} where \begin{equation}\label{afdsyn:redsysmat} \left [ \begin{array}{c|c|c} \overline G_f(\lambda) & \overline G_w(\lambda) & \overline G_v(\lambda) \end{array} \right ] = Q_1(\lambda) \left [ \begin{array}{c|c|c} G_f(\lambda) & G_w(\lambda) & G_v(\lambda) \\ 0 & 0 & 0 \end{array} \right ] ,\end{equation} to obtain \begin{equation}\label{afdsyn:detio1} {\mathbf{r}}(\lambda) = \overline Q_1(\lambda)\overline {\mathbf{y}}(\lambda) . \end{equation} If $r_d := \mathop{\mathrm{rank}} G_d(\lambda)$, then $Q_1(\lambda)$ has $p-r_d$ rows, which are the basis vectors of the left nullspace of $G_1(\lambda)$. Let $r_w = \mathop{\mathrm{rank}} \overline G_w(\lambda)$, which satisfies $0 \leq r_w \leq p-r_d$. If $r_w = 0$, then we have to solve an EFDP for the reduced system (\ref{afdsyn:redsys}) with $\overline G_w(\lambda) = 0$ (e.g., by using \textbf{Procedure EFD} in \cite{Varg17}), while for $r_w > 0$ and $q \leq r_w$ we have to solve an AFDP, for which \textbf{Procedure AFD} in \cite{Varg17} can be applied. In the case $0 < r_w < q \leq p-r_d$, we can apply the approach suggested in \emph{Remark 5.10} in \cite{Varg17}), to determine $\overline Q_1(\lambda)$ in the row partitioned form \[ \overline Q_1(\lambda) = \left [ \begin{array}{cc} \overline Q_1^{(1)}(\lambda) \\ \overline Q_1^{(2)}(\lambda) \end{array} \right ] , \] where $\overline Q_1^{(1)}(\lambda)$ has $q_1 = r_w$ rows and can be determined by solving an AFDP for the reduced system (\ref{afdsyn:redsys}), while $\overline Q_1^{(2)}(\lambda)$ has $q_2 = q-r_w$ rows and can be determined by solving an EFDP for the same reduced system (\ref{afdsyn:redsys}), but with the noise inputs redefined as disturbances and a part of the fault inputs (those which become undetectable due to the decoupling of noise inputs) redefined as auxiliary inputs. More precisely, let $Q_2^{(2)}(\lambda)$ be a left nullspace basis of $\overline G_w(\lambda)$ and let $\overline Q_1^{(2)}(\lambda) = \overline Q_2^{(2)}(\lambda) Q_2^{(2)}(\lambda)$. Then, a second reduced system is obtained as \begin{equation}\label{afdsyn:redsys2} \overline {\mathbf{y}}^{(2)}(\lambda) := \overline G_f^{(2)}(\lambda){\mathbf{f}}(\lambda) + \overline G_v^{(2)}(\lambda){\mathbf{v}}(\lambda) \, , \end{equation} where \[ \left [ \begin{array}{c|c} \overline G_f^{(2)}(\lambda) & \overline G_v^{(2)}(\lambda) \end{array} \right ] = Q_2^{(2)}(\lambda) \left [ \begin{array}{c|c} \overline G_f(\lambda) & \overline G_v(\lambda) \end{array} \right ] .\] To determine $\overline Q_2^{(2)}(\lambda)$, we first determine $S_2$, the structure matrix of $\overline G_f^{(2)}(\lambda)$ and separate the fault components in two parts: $f^{(1)}$, which correspond to nonzero columns in $S_2$ and $f^{(2)}$, which correspond to zero columns in $S_2$. If we denote $\overline G_{f^{(1)}}^{(2)}(\lambda)$ and $\overline G_{f^{(2)}}^{(2)}(\lambda)$ the columns of $\overline G_{f}^{(2)}(\lambda)$ corresponding to $f^{(1)}$ and $f^{(2)}$, respectively, we can rewrite the reduced system (\ref{afdsyn:redsys2}) as \begin{equation}\label{afdsyn:redsys3} \overline {\mathbf{y}}^{(2)}(\lambda) := \overline G_{f^{(1)}}^{(2)}(\lambda){\mathbf{f}}^{(1)}(\lambda) + \overline G_{f^{(2)}}^{(2)}(\lambda){\mathbf{f}}^{(2)}(\lambda) + \overline G_v^{(2)}(\lambda){\mathbf{v}}(\lambda) \, . \end{equation} The filter component $\overline Q_2^{(2)}(\lambda)$ can be determined by solving an EFDP for the reduced system (\ref{afdsyn:redsys3}), with $f^{(1)}$ as fault inputs and $f^{(2)}$ and $v(t)$ as auxiliary inputs. To check the solvability of the AFDP, let $S_1$ be the structure matrix of $\overline G_f(\lambda)$. According to Corollary 5.4 of \cite{Varg17}, the AFDP is solvable if and only if $\overline G_{f_j}(\lambda) \not = 0$ for $j = 1, \ldots, m_f$, or equivalently all columns of $S_1$ are nonzero. More generally, if $H_1$ is the design matrix specified in a nonempty \texttt{OPTIONS.HDesign} (otherwise $H_1 = I_{p-r_d}$ is used) and $H_2$ is the design matrix specified in a nonempty \texttt{OPTIONS.HDesign2} (otherwise $H_2 = I_{p-r_d-r_w}$ is used), then let $S_1$ be the structure matrix of $H_1\overline G_f(\lambda)$ and let $S_2$ be the structure matrix of $H_2\overline G_f^{(2)}(\lambda)$. It follows that the AFDP is solvable if $S = \left[\begin{smallmatrix} S_1\\S_2\end{smallmatrix} \right]$ has all its columns nonzero. The solution of the AFDP for the reduced system (\ref{afdsyn:redsys}) to determine $\overline Q_1^{(1)}(\lambda)$ involves the solution of a $\mathcal{H}_{\infty -}/\mathcal{H}_\infty$ optimization problem \begin{equation}\label{afdpopt} \beta = \max_{\overline Q_1^{(1)}(\lambda)} \Big\{ \, \left\|R_f^{(1)}(\lambda)\right\|_{\infty -} \,\, \Big| \,\, \left\|R_w^{(1)}(\lambda)\right\|_{\infty} \leq \gamma \,\Big\} ,\end{equation} where $\big[\, R_f^{(1)}(\lambda)\; R_w^{(1)}(\lambda) \,\big] := \overline Q_1^{(1)}(\lambda)\big[\, \overline G_f(\lambda) \; \overline G_w(\lambda)\,\big]$ and $\gamma$ is a given upper bound on the resulting $\big\|R_w^{(1)}(\lambda)\big\|_\infty$ (specified via \texttt{OPTIONS.gamma}). The $\mathcal{H}_{\infty -}$-index $\|\cdot\|_{\infty -}$ characterizes the complete fault detectability property of the system (\ref{afdsyn:sysio}) and is evaluated, for \texttt{OPTIONS.FDFreq} empty, as \begin{equation}\label{minh} \|R_{f}^{(1)}(\lambda)\|_{\infty -} := \min_{1\leq j \leq m_f} \|R_{f_j}^{(1)}(\lambda)\|_{\infty}, \end{equation}% while for \texttt{OPTIONS.FDFreq} containing a nonempty set of real frequencies, which define a complex frequency domain $\Omega$, the $\mathcal{H}_{\Omega -}$-index \begin{equation}\label{minusindex1} \|R_{f}^{(1)}(\lambda)\|_{\Omega -} := \min_{1\leq j \leq m_f} \big\{\inf_{\lambda_s \in \Omega} \big\|R_{f_j}^{(1)}(\lambda_s)\big\|_2 \big\} \, \end{equation} is used instead. The value of the achieved fault-to-noise gap $\eta := \beta/\gamma$ is provided in \texttt{INFO.gap} and represents a measure of the noise attenuation quality of the fault detection filter. For $\gamma = 0$, the exact solution of an EFDP with $w \equiv 0$ is targeted and the corresponding gap $\eta = \infty$. \index{performance evaluation!fault detection and isolation!fault-to-noise gap} In general, the filter $Q(\lambda)$ and its corresponding internal form $R(\lambda)$ are determined in the partitioned forms \begin{equation}\label{QRpart} Q(\lambda) = \left [ \begin{array}{c}Q^{(1)}(\lambda) \\ Q^{(2)}(\lambda) \end{array} \right ] = \left [ \begin{array}{cc} \overline Q_1^{(1)}(\lambda) \\ \overline Q_2^{(2)}(\lambda) Q_2^{(2)}(\lambda) \end{array} \right ] Q_1(\lambda), \quad R(\lambda) = \left [ \begin{array}{c}R^{(1)}(\lambda) \\ R^{(2)}(\lambda) \end{array} \right ], \end{equation} where the filters $Q^{(1)}(\lambda)$ and $R^{(1)}(\lambda)$ with $q_1$ residual outputs are a solution of an AFDP, while $Q^{(2)}(\lambda)$ and $R^{(2)}(\lambda)$ with $q_2$ residual outputs are a solution of an EFDP. In what follows, we first describe the determination of $Q_1(\lambda)$ and $Q_2^{(2)}(\lambda)$, and discuss the verification of the solvability conditions. Then we discuss the determination of the remaining factors $\overline Q_1^{(1)}(\lambda)$ and $\overline Q_2^{(2)}(\lambda)$. \subsubsection*{Computation of $Q_1(\lambda)$} $Q_1(\lambda) = N_l(\lambda)$, with $N_l(\lambda)$ a $\big(p-r_d\big) \times (p+m_u)$ proper rational left nullspace basis satisfying $N_l(\lambda)G_1(\lambda) = 0$, where $r_d := \text{rank}\, G_d(\lambda)$. If \texttt{OPTIONS.nullspace = true} or $m_d > 0$ or $E$ is singular, then $N_l(\lambda)$ is determined as a minimal proper nullspace basis. In this case, if \texttt{OPTIONS.simple = true}, then $N_l(\lambda)$ is determined as a simple rational basis and the orders of the basis vectors are provided in \texttt{INFO.degs}. If \texttt{OPTIONS.simple = false}, then $N_l(\lambda)$ is determined as a proper rational basis and \texttt{INFO.degs} contains the degrees of the basis vectors of an equivalent polynomial nullspace basis. A stable basis is determined if \texttt{OPTIONS.FDfreq} is not empty. If \texttt{OPTIONS.nullspace = false}, $m_d = 0$ and $E$ is invertible, then $N_l(\lambda) = [ \, I_{p} \; -G_u(\lambda)\,]$ is used, which corresponds to a full-order Luenberger observer. If \texttt{OPTIONS.FDfreq} is not empty and the system (\ref{afdsyn:sysss}) is unstable, then $\widetilde N_l(\lambda) = M(\lambda)N_l(\lambda)$ is used instead $N_l(\lambda)$, where $M(\lambda)$ and $\widetilde N_l(\lambda)$ are the stable factors of a left coprime factorization $N_l(\lambda) = M^{-1}(\lambda)\widetilde N_l(\lambda)$. In this case \texttt{INFO.degs = [ ]}. \subsubsection*{Computation of $Q_2^{(2)}(\lambda)$} In the case when $r_w < p-r_d$, $Q_2^{(2)}(\lambda) = \overline N_{l,w}(\lambda)$, with $\overline N_{l,w}(\lambda)$ a $\big(p-r_d-r_w)\times (p-r_d)$ proper left nullspace basis satisfying $\overline N_{l,w}(\lambda)\overline G_w(\lambda) = 0$, where $r_w := \mathop{\mathrm{rank}} \overline G_w(\lambda)$. It follows, that $\overline N_{l,w}(\lambda)N_l(\lambda)$ is a proper left nullspace basis of \begin{equation}\label{afdsyn:gtfm2} G_2(\lambda) := \left [ \begin{array}{ccc} G_u(\lambda) & G_d(\lambda) & G_w(\lambda)\\ I_{m_u} & 0 & 0 \end{array} \right ] .\end{equation} If \texttt{OPTIONS.simple = true}, then $\overline N_{l,w}(\lambda)N_l(\lambda)$ is determined as a simple rational basis and the orders of the basis vectors are provided in \texttt{INFO.degs2}. If \texttt{OPTIONS.simple = false}, then $\overline N_{l,w}(\lambda)N_l(\lambda)$ is determined as a proper rational basis and \texttt{INFO.degs2} contains the degrees of the basis vectors of an equivalent polynomial nullspace basis. A stable basis is determined if \texttt{OPTIONS.FDfreq} is not empty. \subsubsection*{Checking the solvability conditions of the AFDP} Let $\overline G_f(\lambda) := Q_1(\lambda) \left[\begin{smallmatrix} G_f(\lambda) \\ 0 \end{smallmatrix}\right]$ and $\overline G_w(\lambda) := Q_1(\lambda) \left[\begin{smallmatrix} G_w(\lambda) \\ 0 \end{smallmatrix}\right]$ be the TFMs of the reduced model (\ref{afdsyn:redsys}) and let $\overline G_f^{(2)}(\lambda) = Q_2^{(2)}(\lambda)\overline G_f(\lambda)$ be the TFM from the fault inputs in the reduced model (\ref{afdsyn:redsys2}). To check the solvability of the AFDP, the structure matrices $S_1$ of $H_1\overline G_f(\lambda)$ and $S_2$ of $H_2\overline G_f^{(2)}(\lambda)$ are determined, where $H_1$ is a full row rank design matrix with $q_1 \leq p-r_d$ rows specified in a nonempty \texttt{OPTIONS.HDesign} (otherwise $H_1 = I_{p-r_d}$ is used) and $H_2$ is a full row rank design matrix specified with $q_2 \leq p-r_d-r_w$ rows in a nonempty \texttt{OPTIONS.HDesign2} (otherwise $H_2 = I_{p-r_d-r_w}$ is used). The AFDP is solvable if $S = \left[\begin{smallmatrix} S_1\\S_2\end{smallmatrix} \right]$ has all its columns nonzero. The resulted $S_1$ and $S_2$ are provided in \texttt{INFO.S} and \texttt{INFO.S2}, respectively. \subsubsection*{Computation of $\overline Q_1^{(1)}(\lambda)$} If $r_w > 0$, the filter $\overline Q_1^{(1)}(\lambda)$ is determined in the product form \begin{equation}\label{afdsym:Qprod1} \overline Q_1^{(1)}(\lambda) = Q_4^{(1)}(\lambda)Q_3^{(1)}(\lambda)Q_2^{(1)}(\lambda) , \end{equation} where the factors are determined as follows: \begin{itemize} \item[(a)] $Q_2^{(1)}(\lambda)$ is an admissible regularization factor; \item[(b)] $Q_3^{(1)}(\lambda)$ represents an optimal choice which maximizes the gap $\eta$; \item[(c)] $Q_4^{(1)}(\lambda)$ is a stable invertible factor determined such that $Q^{(1)}(\lambda)$ and $R^{(1)}(\lambda)$ have a desired dynamics. \end{itemize} The computations of individual factors depend on the user's options and specific choices are discussed in what follows. \subsubsection*{Computation of $Q_2^{(1)}(\lambda)$} Let $q =\texttt{OPTIONS.rdim}$ if \texttt{OPTIONS.rdim} is nonempty. If \texttt{OPTIONS.rdim} is empty, $q_1$ is set to a default value as follows: if \texttt{OPTIONS.HDesign} is empty, then $q_1 = 1$ if \texttt{OPTIONS.minimal} = \texttt{true}, or $q_1 = r_w$, if \texttt{OPTIONS.minimal} = \texttt{false}. If \texttt{OPTIONS.HDesign} is nonempty, then $q_1$ is the row dimension of the full row rank design matrix $H_1$ contained in \texttt{OPTIONS.HDesign}. To be admissible, $H_1$ must also fulfill $\mathop{\mathrm{rank}} H_1\overline G_w(\lambda) = q_1$. If \texttt{OPTIONS.minimal = false}, then $Q_2^{(1)}(\lambda) = H_1$, where $H_1$ is a suitable $q_1\times \big(p-r_d\big)$ full row rank design matrix. If both \texttt{OPTIONS.HDesign} and \texttt{OPTIONS.HDesign2} are empty, then $H_1$ is chosen to build $q_1 = \min(q,r_w)$ linear combinations of the $p-r_d$ left nullspace basis vectors, such that $\mathop{\mathrm{rank}} H_1\overline G_w(\lambda) = q_1$, and, additionally, $H_1\overline G_f(\lambda)$ has the same nonzero columns as $S_1$. If \texttt{OPTIONS.HDesign} is empty but \texttt{OPTIONS.HDesign2} is nonempty, then $q_1 = q-q_2$. If $q_1 = p-r_d$ then the choice $H_1 = I_{p-r_d}$ is used, otherwise $H_1$ is chosen a randomly generated $q_1 \times \big(p-r_d\big)$ real matrix. If \texttt{OPTIONS.minimal = true}, then $Q_2^{(1)}(\lambda)$ is a $q_1\times \big(p-r_d\big)$ transfer function matrix, with $q_1$ chosen as above. $Q_2^{(1)}(\lambda)$ is determined as \[ Q_2^{(1)}(\lambda) = \widetilde Q_2(\lambda) \, , \] where $\widetilde Q_2(\lambda) := H_1+Y_2(\lambda)$, $\widetilde Q_2(\lambda)Q_1(\lambda)$ $\big(\! = H_1N_l(\lambda)+Y_2(\lambda)N_l(\lambda)\big)$ and $Y_2(\lambda)$ are the least order solution of a left minimal cover problem \cite{Varg17g}. If \texttt{OPTIONS.HDesign} is nonempty, then $H_1 = \texttt{OPTIONS.HDesign}$, and if \texttt{OPTIONS.HDesign} is empty, then $q_1$ is chosen as above and a suitable randomly generated $H_1$ is employed (see above). To be admissible, $\widetilde Q_2(\lambda)$ must fulfill $\mathop{\mathrm{rank}} \widetilde Q_2(\lambda)\overline G_w(\lambda) = q_1$ and, additionally, $\widetilde Q_2(\lambda)\overline G_f(\lambda)$ has the same nonzero columns as $S_1$. The above rank condition is checked as \[ \mathop{\mathrm{rank}} \widetilde G_w(\lambda_s) = q_1 , \] where $\widetilde G_w(\lambda) := \widetilde Q_2(\lambda)\overline G_w(\lambda)$ and $\lambda_s$ is a suitable frequency value, which can be specified via the \texttt{OPTIONS.freq}. In the case when \texttt{OPTIONS.freq} is empty, the employed frequency value $\lambda_s$ is provided in \texttt{INFO.freq}. \subsubsection*{Computation of $Q_3^{(1)}(\lambda)$} Let redefine $\widetilde G_w(\lambda) := Q_2^{(1)}(\lambda)\overline G_w(\lambda)$ and compute the quasi-co-outer--co-inner factorization of $\widetilde G_w(\lambda)$ as \[ \widetilde G_w(\lambda) = R_{wo}(\lambda)R_{wi}(\lambda) ,\] where $R_{wo}(\lambda)$ is an invertible quasi-co-outer factor and $R_{wi}(\lambda)$ is a (full row rank) co-inner factor. In the \emph{standard case} $R_{wo}(\lambda)$ is outer (i.e., has no zeros on the boundary of the stability domain $\partial\mathds{C}_s$) and we choose $Q_3^{(1)}(\lambda) = R_{wo}^{-1}(\lambda)$. This is an optimal choice which ensures that the optimal gap $\eta$ is achieved. In the \emph{non-standard case} $R_{wo}(\lambda)$ is only quasi-outer and thus, has zeros on the boundary of the stability domain $\partial\mathds{C}_s$. Depending on the selected option to handle nonstandard optimization problems \texttt{OPTIONS.nonstd}, several choices are possible for $Q_3^{(1)}(\lambda)$ in this case: \begin{itemize} \item If \texttt{OPTIONS.nonstd} = 1, then $Q_3^{(1)}(\lambda) =R_{wo}^{-1}(\lambda)$ is used. \item If \texttt{OPTIONS.nonstd} = 2, then a modified co-outer--co-inner factorization of $[\,R_{wo}(\lambda)\;\epsilon I\,]$ is computed, whose co-outer factor $R_{wo,\epsilon}(\lambda)$ satisfies \[ R_{wo,\epsilon}(\lambda)\big(R_{wo,\epsilon}(\lambda)\big)^\sim = \epsilon^2 I + R_{wo}(\lambda)\big(R_{wo}(\lambda)\big)^\sim . \] Then $Q_3^{(1)}(\lambda) = R^{-1}_{wo,\epsilon}(\lambda)$ is used. The value of the regularization parameter $\epsilon$ is specified via \texttt{OPTIONS.epsreg}. \item If \texttt{OPTIONS.nonstd} = 3, then a Wiener-Hopf type co-outer--co-inner factorization is computed in the form \begin{equation}\label{WHfact} \widetilde G_w(\lambda) = R_{wo}(\lambda)R_{wb}(\lambda)R_{wi}(\lambda) ,\end{equation} where $R_{wo}(\lambda)$ is co-outer, $R_{wi}(\lambda)$ is co-inner, and $R_{wb}(\lambda)$ is a square stable factor whose zeros are precisely the zeros of $\widetilde G_w(\lambda)$ in $\partial\mathds{C}_s$. $Q_3^{(1)}(\lambda)$ is determined as before $Q_3^{(1)}(\lambda) = R_{wo}^{-1}(\lambda)$. \item If \texttt{OPTIONS.nonstd} = 4, then the Wiener-Hopf type co-outer--co-inner factorization (\ref{WHfact}) is computed and $Q_3^{(1)}(\lambda)$ is determined as $Q_3^{(1)}(\lambda) = R_{wb}^{-1}(\tilde{\lambda})R_{wo}^{-1}(\lambda)$, where $\tilde{\lambda}$ is a small perturbation of $\lambda$ to move all zeros of $R_{wb}(\lambda)$ into the stable domain. In the continuous-time case $\tilde s = \frac{s-\beta_z}{1-\beta_zs}$, while in the discrete-time case $\tilde z = z/\beta_z$, where the zero shifting parameter $\beta_z$ is the prescribed stability degree for the zeros specified in \texttt{OPTIONS.sdegzer}. For the evaluation of $R_{wb}(\tilde\lambda)$, a suitable bilinear transformation is performed. \item If \texttt{OPTIONS.nonstd} = 5, then the Wiener-Hopf type co-outer--co-inner factorization (\ref{WHfact}) is computed and $Q_3^{(1)}(\lambda)$ is determined as $Q_3^{(1)}(\lambda) = R_{wb,\epsilon}^{-1}(\lambda)R_{wo}^{-1}(\lambda)$, where $R_{wb,\epsilon}(\lambda)$ is the co-outer factor of the co-outer--co-inner factorization of $\big[\, R_{wb}(\lambda) \; \epsilon I\,\big]$ and satisfies \[ R_{wb,\epsilon}(\lambda)\big(R_{wb,\epsilon}(\lambda)\big)^\sim = \epsilon^2 I + R_{wb}(\lambda)\big(R_{wb}(\lambda)\big)^\sim . \] The value of the regularization parameter $\epsilon$ is specified via \texttt{OPTIONS.epsreg}. \end{itemize} A typical feature of the non-standard case is that, with the exception of using the option \texttt{OPTIONS.nonstd} = 3, all other choices of \texttt{OPTIONS.nonstd} lead to a poor dynamical performance of the resulting filter, albeit an arbitrary large gap $\eta$ can be occasionally achieved. \subsubsection*{Computation of $Q_4^{(1)}(\lambda)$} In the standard case, $Q_4^{(1)}(\lambda) = I$. In the non-standard case, $Q_4^{(1)}(\lambda)$ is a stable invertible transfer function matrix determined such that $Q^{(1)}(\lambda)$ and $R^{(1)}(\lambda)$ in (\ref{QRpart}) have a desired dynamics (specified via \texttt{OPTIONS.sdeg} and \texttt{OPTIONS.poles}). \subsubsection*{Computation of $\overline Q^{(2)}(\lambda)$} If $0 \leq r_w < p-r_d$ or \texttt{OPTIONS.exact = true}, then the filter $Q^{(2)}(\lambda)$ in (\ref{QRpart}) is determined with $\overline Q^{(2)}(\lambda)$ in the product form \begin{equation}\label{afdsym:Qprod2} \overline Q^{(2)}(\lambda) = Q_4^{(2)}(\lambda)Q_3^{(2)}(\lambda) , \end{equation} where the factors are determined as follows: \begin{itemize} \item[(a)] $Q_3^{(2)}(\lambda)$ is an admissible regularization factor; \item[(b)] $Q_4^{(2)}(\lambda)$ is a stable invertible factor determined such that $Q^{(2)}(\lambda)$ and $R^{(2)}(\lambda)$ in (\ref{QRpart}) have a desired dynamics. \end{itemize} The computations of individual factors depend on the user's options and specific choices are discussed in what follows. \subsubsection*{Computation of $Q_3^{(2)}(\lambda)$} Let $q =\texttt{OPTIONS.rdim}$ if \texttt{OPTIONS.rdim} is nonempty. If \texttt{OPTIONS.rdim} is empty, $q_2$ is set to a default value as follows: if \texttt{OPTIONS.HDesign2} is empty, then $q_2 = 1-\min(1,r_w)$ if \texttt{OPTIONS.minimal} = \texttt{true}, or $q_2 = p-r_d-r_w$, if \texttt{OPTIONS.minimal} = \texttt{false}. In the case when \texttt{OPTIONS.HDesign2} is nonempty, then $q_2$ is the row dimension of the full row rank design matrix $H_2$ contained in \texttt{OPTIONS.HDesign2}. If \texttt{OPTIONS.minimal = false}, then $Q_3^{(2)}(\lambda) = H_2$, where $H_2$ is a suitable $q_2\times \big(p-r_d-r_w\big)$ full row rank design matrix. If both \texttt{OPTIONS.HDesign} and \texttt{OPTIONS.HDesign2} are empty, then $H_2$ is chosen to build $q_2 = \min(q,r_w)$ linear combinations of the $p-r_d-r_w$ left nullspace basis vectors, such that $H_2\overline G_f^{(2)}(\lambda)$ has the same nonzero columns as $S_2$. If \texttt{OPTIONS.HDesign2} is empty but \texttt{OPTIONS.HDesign} is nonempty, then $q_2 = q-q_1$. If $q_2 = p-r_d-r_w$ then the choice $H_2 = I_{p-r_d-r_w}$ is used, otherwise $H_2$ is chosen a randomly generated $q_2 \times \big(p-r_d-r_w\big)$ real matrix. If \texttt{OPTIONS.minimal = true}, then $Q_3^{(2)}(\lambda)$ is a $q_2\times \big(p-r_d-r_w\big)$ transfer function matrix, with $q_2$ chosen as above. $Q_3^{(2)}(\lambda)$ is determined as \[ Q_3^{(2)}(\lambda) = \widetilde Q_3(\lambda) \, , \] where $\widetilde Q_3(\lambda) := H_2+Y_3(\lambda)$, $\widetilde Q_3(\lambda)Q_2^{(2)}(\lambda)$ $\big(\! = H_2\overline N_{l,w}(\lambda)+Y_3(\lambda)\overline N_{l,w}(\lambda)\big)$ and $Y_3(\lambda)$ are the least order solution of a left minimal cover problem \cite{Varg17g}. If \texttt{OPTIONS.HDesign2} is nonempty, then $H_2 = \texttt{OPTIONS.HDesign}$, and if \texttt{OPTIONS.HDesign2} is empty, then $q_2$ is chosen as above and a suitable randomly generated $H_2$ is employed (see above). To be admissible, $\widetilde Q_2(\lambda)$ must ensure that $\widetilde Q_3(\lambda)\overline G_f^{(2)}(\lambda)$ has the same nonzero columns as $S_2$. \subsubsection*{Computation of $Q_4^{(2)}(\lambda)$} $Q_4^{(2)}(\lambda)$ is a stable invertible transfer function matrix determined such that $Q^{(2)}(\lambda)$ and $R^{(2)}(\lambda)$ in (\ref{QRpart}) have a desired dynamics (specified via \texttt{OPTIONS.sdeg} and \texttt{OPTIONS.poles}). \subsubsection*{Example} \begin{example} This is Example 5.3 from the book \cite{Varg17}, with the disturbance redefined as a noise input and by adding a sensor fault for the first output measurement. The TFMs of the system are: \[ G_u(s) = {\arraycolsep=1mm\left [ \begin{array}{c} \displaystyle\frac{s+1}{s+2} \\ \\[-2mm] \displaystyle\frac{s+2}{s+3} \end{array} \right ], \quad G_d(s) = 0, \quad G_f(s) = [\, G_u(s)\; I\,], \quad G_w(s) = \left [ \begin{array}{c} \displaystyle\frac{s-1}{s+2} \\ \\[-2mm]0 \end{array} \right ]} ,\] where the fault input $f_1$ corresponds to an additive actuator fault, while the fault inputs $f_2$ and $f_3$ describe additive sensor faults in the outputs $y_1$ and $y_2$, respectively. The transfer function matrix $G_w(s)$ is non-minimum phase, having an unstable zero at 1. Interestingly, the EFDP formulated with $G_d(s) = G_w(s)$ is not solvable. We want to design a least order fault detection filter $Q(s)$, which fulfills: \begin{itemize} \item[--] the decoupling condition: $Q(s)\left[\begin{smallmatrix} G_u(s) & G_d(s) \\ I_{m_u} & 0 \end{smallmatrix}\right] = 0$; \item[--] the fault detectability condition: $\|R_f(s)\|_{\infty -} > 0$; \item[--] the maximization of the noise attenuation gap: $\eta := \|R_f(s)\|_{\infty -}/\|R_w(s)\|_\infty = \max$. \end{itemize} The results computed with the following script are \[ Q(s) = {\arraycolsep=.5mm\left [ \begin{array}{ccc} \displaystyle\frac{s+2}{s+1} & \displaystyle\frac{s+3}{s+1} & -\displaystyle\frac{2s+3}{s+1} \end{array} \right ] , \quad\; R_f(s) = \left [ \begin{array}{ccc} \displaystyle\frac{2s+3}{s+1} & \displaystyle\frac{s+2}{s+1} & \displaystyle\frac{s+3}{s+1} \end{array} \right ] }, \quad R_w(s) = \displaystyle\frac{s-1}{s+1} . \] \begin{verbatim} s = tf('s'); Gu = [(s+1)/(s+2); (s+2)/(s+3)]; Gw = [(s-1)/(s+2); 0]; sysf = fdimodset(ss([Gu Gw]),struct('c',1,'n',2,'f',1,'fs',1:2)); mu = 1; mw = 1; p = 2; mf = mu+p; [Q,R,info] = afdsyn(sysf); tf(Q), tf(R(:,'faults')), tf(R(:,'noise')) info.gap FSCOND = fdifscond(R) syse = [sysf;eye(mu,mu+mf+mw)]; norm_Ru = norm(Q*syse(:,'controls'),inf) norm_rez = norm(Q*syse(:,{'faults','noise'})-R,inf) gap = fdif2ngap(R,0) S_strong = fdisspec(R(:,'faults')) inpnames = {'f_1','f_2','f_3','w'}; set(R,'InputName',inpnames,'OutputName','r'); step(R); ylabel('') title('Step responses from fault and noise inputs') \end{verbatim} \end{example} \subsubsection{\texttt{\bfseries efdisyn}} \index{M-functions!\texttt{\bfseries efdisyn}} \index{fault detection and isolation problem!a@exact (EFDIP)} \subsubsection*{Syntax} \begin{verbatim} [Q,R,INFO] = efdisyn(SYSF,OPTIONS) \end{verbatim} \subsubsection*{Description} \texttt{\bfseries efdisyn} solves the \emph{exact fault detection and isolation problem} (EFDIP) (see Section \ref{sec:EFDIP}), for a given LTI system \texttt{SYSF} with additive faults and a given structure matrix $S_{FDI}$ (specified via the \texttt{OPTIONS} structure). Two banks of stable and proper filters are computed in the $n_b$-dimensional cell arrays \texttt{Q} and \texttt{R}, where $n_b$ is the number of specifications contained in $S_{FDI}$ (i.e., the number of rows of the structure matrix $S_{FDI}$). \texttt{Q\{i\}} contains the $i$-th fault detection filter (\ref{ri_fdip}) in the overall solution (\ref{qbank}) of the EFDIP and \texttt{R\{i\}} contains its internal form.\\[-7mm] \subsubsection*{Input data} \begin{description} \item \texttt{SYSF} is a LTI system in the state-space form \begin{equation}\label{efdisyn:sysss} {\begin{aligned} E\lambda x(t) & = Ax(t)+ B_u u(t)+ B_d d(t) + B_f f(t)+ B_w w(t) , \\ y(t) & = C x(t) + D_u u(t)+ D_d d(t) + D_f f(t) + D_w w(t) , \end{aligned}} \end{equation} where any of the inputs components $u(t)$, $d(t)$, $f(t)$, or $w(t)$ can be void. For the system \texttt{SYSF}, the input groups for $u(t)$, $d(t)$, $f(t)$, and $w(t)$ have the standard names \texttt{\bfseries 'controls'}, \texttt{\bfseries 'disturbances'}, \texttt{\bfseries 'faults'}, and \texttt{\bfseries 'noise'}, respectively.\\[-6mm] \item \texttt{OPTIONS} is a MATLAB structure used to specify various synthesis options and has the following fields:\\[-6mm] {\setlength\LTleft{30pt}\begin{longtable}{|l|p{11.6cm}|} \hline \textbf{\texttt{OPTIONS} fields} & \textbf{Description} \\ \hline \texttt{SFDI} & the desired structure matrix $S_{FDI}$ to solve the EFDIP\newline (Default: \texttt{[1 ... 1]}, i.e., solve an exact fault detection problem)\\ \hline \texttt{tol} & relative tolerance for rank computations \newline (Default: internally computed)\\ \hline \texttt{tolmin} & absolute tolerance for observability tests \newline (Default: internally computed)\\ \hline \texttt{FDTol} & threshold for fault detectability checks (Default: 0.0001)\\ \hline \texttt{FDGainTol} & threshold for strong fault detectability checks (Default: 0.01)\\ \hline \pagebreak[4] \hline \texttt{rdim} & vector, whose $i$-th component $q_i$, specifies the desired number of residual outputs for the $i$-th component filters \texttt{Q\{$i$\}} and \texttt{R\{$i$\}}; if \texttt{OPTIONS.rdim} is a scalar $q$, then a vector with all components $q_i = q$ is assumed. \\ & (Default: \hspace*{-2.5mm}\begin{tabular}[t]{l} \texttt{[ ]}, in which case: \\ \hspace*{-2em} -- if \texttt{OPTIONS.HDesign\{$i$\}} is empty, then \\ $q_i = 1$, if \texttt{OPTIONS.minimal} = \texttt{true}, or \\ $q_i$ is the dimension of the left nullspace which underlies the \\ synthesis of \texttt{Q\{$i$\}} and \texttt{R\{$i$\}}, if \texttt{OPTIONS.minimal} = \texttt{false}; \\ \hspace*{-2em} -- if \texttt{OPTIONS.HDesign\{$i$\}} is nonempty, then $q_i$ is the \\ row dimension of the design matrix contained in \\ \texttt{OPTIONS.HDesign\{$i$\}}.) \end{tabular}\\ \hline \texttt{FDFreq} & vector of real frequency values for strong detectability checks \newline (Default: \texttt{[ ]}) \\ \hline \texttt{smarg} & stability margin for the poles of the component filters \texttt{Q\{$i$\}} and \texttt{R\{$i$\}}\\ & (Default: \texttt{-sqrt(eps)} for a continuous-time system \texttt{SYSF}; \\ & \hspace*{4.5em}\texttt{1-sqrt(eps)} for a discrete-time system \texttt{SYSF}).\\ \hline \texttt{sdeg} & prescribed stability degree for the poles of the component filters \texttt{Q\{$i$\}} and \texttt{R\{$i$\}}\\ & (Default: $-0.05$ for a continuous-time system \texttt{SYSF}; \\ & \hspace*{4.8em} $0.95$ for a discrete-time system \texttt{SYSF}).\\ \hline \texttt{poles} & complex vector containing a complex conjugate set of desired poles (within the stability domain) to be assigned for the component filters \texttt{Q\{$i$\}} and \texttt{R\{$i$\}} (Default: \texttt{[ ]}) \\\hline \texttt{nullspace} & option to use a specific proper nullspace basis to be employed at the initial reduction step\\ & \hspace*{-.9mm}{\tabcolsep=0.7mm\begin{tabular}[t]{lcp{10cm}} \texttt{true } &--& use a minimal proper basis (default); \\ \texttt{false} &--& use a full-order observer based basis (see \textbf{Method}). \newline \emph{Note:} This option can only be used if no disturbance inputs are present in (\ref{efdisyn:sysss}) and $E$ is invertible. \end{tabular}} \\ \hline \texttt{simple} & option to employ simple proper bases for the synthesis of the component filters \texttt{Q\{$i$\}} and \texttt{R\{$i$\}} \\ & \texttt{true } -- use simple bases; \\ & \texttt{false} -- use non-simple bases (default)\\\hline \texttt{minimal} & option to perform least order synthesis of the component filters \texttt{Q\{$i$\}} and \texttt{R\{$i$\}} \\ & \texttt{true } -- perform least order synthesis (default); \\ & \texttt{false} -- perform full order synthesis \\\hline \texttt{tcond} & maximum alowed condition number of the employed non-orthogonal transformations (Default: $10^4$).\\ \hline \texttt{FDSelect} & integer vector with increasing elements containing the indices of the desired filters to be designed (Default: $[\,1, \ldots, n_b\,]$)\\ \hline \texttt{HDesign} & $n_b$-dimensional cell array; \texttt{OPTIONS.HDesign\{$i$\}}, if not empty, is a full row rank design matrix employed for the synthesis of the $i$-th fault detection filter (Default: \texttt{[ ]})\\ \hline \end{longtable}} \end{description} \subsubsection*{Output data} \begin{description} \item \texttt{Q} an $n_b$-dimensional cell array, with \texttt{Q\{$i$\}} containing the resulting $i$-th filter in a standard state-space representation \[ {\begin{aligned} \lambda x_Q^{(i)}(t) & = A_Q^{(i)}x_Q^{(i)}(t)+ B_{Q_y}^{(i)}y(t)+ B_{Q_u}^{(i)}u(t) ,\\ r^{(i)}(t) & = C_Q^{(i)} x_Q^{(i)}(t) + D_{Q_y}^{(i)}y(t)+ D_{Q_u}^{(i)}u(t) , \end{aligned}} \] where the residual signal $r^{(i)}(t)$ is a $q_i$-dimensional vector. For each system object \texttt{Q\{$i$\}}, two input groups \texttt{\bfseries 'outputs'} and \texttt{\bfseries 'controls'} are defined for $y(t)$ and $u(t)$, respectively, and the output group \texttt{\bfseries 'residuals'} is defined for the residual signal $r^{(i)}(t)$. \texttt{Q\{$i$\}} is empty if the index $i$ is not selected in \texttt{OPTIONS.FDSelect}. \item \texttt{R} an $n_b$-dimensional cell array, with \texttt{R\{$i$\}} containing the resulting internal form of the $i$-th filter in a standard state-space representation \[ {\begin{aligned} \lambda x_R^{(i)}(t) & = A_Q^{(i)}x_R^{(i)}(t)+ B_{R_f}^{(i)}f(t)+ B_{R_w}^{(i)}w(t), \\ r^{(i)}(t) & = C_Q^{(i)} x_R^{(i)}(t) + D_{R_f}^{(i)}f(t)+ D_{R_w}^{(i)}w(t). \end{aligned}} \] The input groups \texttt{\bfseries 'faults'} and \texttt{\bfseries 'noise'} are defined for $f(t)$, and $w(t)$, respectively, and the output group \texttt{\bfseries 'residuals'} is defined for the residual signal $r^{(i)}(t)$. Note that the realizations of \texttt{Q\{$i$\}} and \texttt{R\{$i$\}} share the matrices $A_Q^{(i)}$ and $C_Q^{(i)}$. \texttt{R\{$i$\}} is empty if the index $i$ is not selected in \texttt{OPTIONS.FDSelect}. \item \texttt{INFO} is a MATLAB structure containing additional information as follows: \begin{center} \begin{tabular}{|l|p{12cm}|} \hline \textbf{\texttt{INFO} fields} & \textbf{Description} \\ \hline \texttt{tcond} & $n_b$-dimensional vector; \texttt{INFO.tcond}$(i)$ contains the maximum of the condition numbers of the employed non-orthogonal transformation matrices to determine the $i$-th filter component \texttt{Q\{$i$\}}; a warning is issued if any \texttt{INFO.tcond}$(i)$ $\geq$ \texttt{OPTIONS.tcond}.\\ \hline \texttt{degs} & $n_b$-dimensional cell array; if \texttt{OPTIONS.simple} = \texttt{true}, \texttt{INFO.degs\{$i$\}} contains the orders of the basis vectors of the employed simple nullspace basis for the synthesis of the $i$-th filter component \texttt{Q\{$i$\}}; if \texttt{OPTIONS.simple = false}, \texttt{INFO.degs\{$i$\}} contains the degrees of the basis vectors of an equivalent polynomial nullspace basis\\ \hline \texttt{HDesign} & $n_b$-dimensional cell array; \texttt{INFO.HDesign\{$i$\}} is the $i$-th design matrix actually employed for the synthesis of the $i$-th fault detection filter \texttt{Q\{$i$\}}. \texttt{INFO.HDesin\{$i$\}} is empty if the index $i$ is not selected in \texttt{OPTIONS.FDSelect}. \\ \hline \end{tabular} \end{center} \end{description} \subsubsection*{Method} The \textbf{Procedure EFDI} from \cite[Sect.\ 5.4]{Varg17} is implemented, which relies on the nullspace-based synthesis method proposed in \cite{Varg07d}. This method essentially determines each filter $Q^{(i)}(\lambda)$ and its internal form $R^{(i)}(\lambda)$, by solving a suitably formulated EFDP for a reduced system without control inputs, and with redefined disturbance and fault inputs. For this purpose, the function \texttt{efdisyn} calls internally the function \texttt{efdsyn} to solve a suitably formulated EFDP for each specification (i.e., row) contained in the structure matrix $S_{FDI}$. \index{M-functions!\texttt{\bfseries efdsyn}} If the faulty system \texttt{SYSF} has the input-output form \begin{equation}\label{systemw1} {\mathbf{y}}(\lambda) = G_u(\lambda){\mathbf{u}}(\lambda) + G_d(\lambda){\mathbf{d}}(\lambda) + G_f(\lambda){\mathbf{f}}(\lambda) + G_w(\lambda){\mathbf{w}}(\lambda) \end{equation} and the $i$-th fault detection filter $Q^{(i)}(\lambda)$ contained in \texttt{Q\{$i$\}} has the input-output form \begin{equation}\label{detec1i} {\mathbf{r}}^{(i)}(\lambda) = Q^{(i)}(\lambda)\left [ \begin{array}{c} {\mathbf{y}}(\lambda)\\{\mathbf{u}}(\lambda)\end{array} \right ] \, , \end{equation} then, taking into account the decoupling conditions (\ref{ens}), the resulting internal form of the $i$-th fault detection filter $R^{(i)}(\lambda)$, contained in \texttt{R\{$i$\}}, is \begin{equation}\label{resys1i} \hspace*{-5mm}{\mathbf{r}}^{(i)}(\lambda) = R^{(i)}(\lambda){\arraycolsep=1mm \left [ \begin{array}{c}{\mathbf{f}}(\lambda)\\ {\mathbf{w}}(\lambda) \end{array} \right ] } = R_f^{(i)}(\lambda){\mathbf{f}}(\lambda) + R_w^{(i)}(\lambda){\mathbf{w}}(\lambda) \, , \hspace*{-4mm}\end{equation} with $R^{(i)}(\lambda) = [\, R_f^{(i)}(\lambda)\; R_w^{(i)}(\lambda)\,]$ defined as \begin{equation}\label{resys2i} \left [ \begin{array}{c|c} R_f^{(i)}(\lambda) & R_w^{(i)}(\lambda) \end{array} \right ] := {\arraycolsep=1mm Q^{(i)}(\lambda) \left [ \begin{array}{c|c} G_f(\lambda) & G_w(\lambda) \\ 0 & 0 \end{array} \right ] } \, . \end{equation} In accordance with (\ref{efdip}), the structure (row) vector corresponding to the zero and nonzero columns of the transfer function matrix $R_f^{(i)}(\lambda)$ is equal to the $i$-th row of the specified $S_{FDI}$. Each filter $Q^{(i)}(\lambda)$ is determined in the product form \begin{equation}\label{efdsyn:Qprodi} Q^{(i)}(\lambda) = \overline Q_1^{(i)}(\lambda)Q_1(\lambda) , \end{equation} where the factors are determined as follows: \begin{itemize} \item[(a)] $Q_1(\lambda) = N_l(\lambda)$, with $N_l(\lambda)$ a $\big(p-r_d\big) \times (p+m_u)$ proper rational left nullspace basis satisfying $N_l(\lambda)\left[\begin{smallmatrix}G_u(\lambda) & G_d(\lambda)\\ I_{m_u} & 0 \end{smallmatrix}\right] = 0$, with $r_d := \text{rank}\, G_d(\lambda)$; \item[(b)] $\overline Q_1^{(i)}(\lambda)$ is the solution of a suitably formulated EFDP to achieve the specification contained in the $i$-th row of $S_{FDI}$. The function \texttt{efdsyn} is called for this purpose and internally uses a design matrix $H^{(i)}$, which can be specified in \texttt{OPTIONS.HDesign\{$i$\}} (see \textbf{Method} for \texttt{efdsyn}). The actually employed design matrix is returned in \texttt{INFO.HDesign\{$i$\}}. \end{itemize} The computations to determine the individual factors $\overline Q^{(i)}(\lambda)$ depend on the user's options (see \textbf{Method} for the function \texttt{efdsyn}). In what follows, we only discuss shortly the computation of $Q_1(\lambda)$, performed only once as an initial reduction step. If \texttt{OPTIONS.nullspace = true} or $m_d > 0$ or $E$ is singular, then $N_l(\lambda)$ is determined as a minimal proper nullspace basis. In this case, only orthogonal transformations are performed at this computational step. If \texttt{OPTIONS.nullspace = false}, $m_d = 0$ and $E$ is invertible, then $N_l(\lambda) = [ \, I_{p} \; -G_u(\lambda)\,]$ is used, which corresponds to a full-order Luenberger observer. This option involves no numerical computations. \subsubsection*{Examples} \begin{example} \label{ex:Ex5.10} This is \emph{Example} 5.10 from the book \cite{Varg17}, which considers a continuous-time system with triplex sensor redundancy on its measured scalar output, which we denote, respectively, by $y_1$, $y_2$ and $y_3$. Each output is related to the control and disturbance inputs by the input-output relation \[ {\mathbf{y}}_i(s) = G_u(s){\mathbf{u}}(s) + G_d(s){\mathbf{d}}(s), \quad i = 1, 2, 3, \] where $G_u(s)$ and $G_d(s)$ are $1\times m_u$ and $1\times m_d$ TFMs, respectively. We assume all three outputs are susceptible to additive sensor faults. Thus, the input-output model of the system with additive faults has the form \[ {\mathbf{y}}(s) := \left [ \begin{array}{c} {\mathbf{y}}_1(s)\\ {\mathbf{y}}_2(s)\\ {\mathbf{y}}_3(s) \end{array} \right ] = \left [ \begin{array}{c} G_u(s)\\ G_u(s)\\ G_u(s) \end{array} \right ]{\mathbf{u}}(s) + \left [ \begin{array}{c} G_d(s)\\ G_d(s)\\ G_d(s) \end{array} \right ]{\mathbf{d}}(s)+ \left [ \begin{array}{c} {\mathbf{f}}_1(s)\\ {\mathbf{f}}_2(s)\\ {\mathbf{f}}_3(s) \end{array} \right ] \, . \] The maximal achievable structure matrix is \[ S_{max} = \left [ \begin{array}{ccc} 1 & 1 & 1 \\ 0 & 1 & 1 \\ 1 & 0 & 1 \\ 1 & 1 & 0 \end{array} \right ] \, .\] If we assume that no simultaneous sensor faults occur, then we can target to solve an EFDIP for the structure matrix \[ S_{FDI} = \left [ \begin{array}{ccc} 0 & 1 & 1 \\ 1 & 0 & 1 \\ 1 & 1 & 0 \end{array} \right ] \, ,\] where the columns of $S_{FDI}$ codify the desired fault signatures. The resulting least order overall FDI filter has the generic form (i.e, independent of the numbers of control and disturbance inputs) \begin{equation}\label{voting} Q(s) = \left [ \begin{array}{c} Q^{(1)}(s) \\ Q^{(2)}(s) \\ Q^{(3)}(s) \end{array} \right ] = \left [ \begin{array}{rrrccc} 0 & 1 & -1 & 0 & \cdots & 0\\-1 & 0 & 1 & 0 & \cdots & 0\\1 & -1 & 0 & 0& \cdots & 0\end{array} \right ] \end{equation} and the corresponding overall internal form is \begin{equation}\label{votingif} R_f(s) = \left [ \begin{array}{c} R_f^{(1)}(s) \\ R_f^{(2)}(s) \\ R_f^{(3)}(s) \end{array} \right ] = \left [ \begin{array}{rrr} 0 & 1 & -1 \\-1 & 0 & 1 \\1 & -1 & 0 \end{array} \right ] \end{equation} \newpage \vspace*{-10mm} \begin{verbatim} p = 3; mf = 3; rng('default') nu = floor(1+4*rand); mu = floor(1+4*rand); nd = floor(1+4*rand); md = floor(1+4*rand); Gu = ones(3,1)*rss(nu,1,mu); Gd = ones(3,1)*rss(nd,1,md); sysf = fdimodset([Gu Gd],struct('c',1:mu,'d',mu+(1:md),'fs',1:3)); SFDI = [ 0 1 1; 1 0 1; 1 1 0] > 0; options = struct('tol',1.e-7,'sdeg',-1,'rdim',1,'SFDI',SFDI); [Qt,Rft] = efdisyn(sysf,options); scale = sign([ Rft{1}.d(1,2) Rft{2}.d(1,3) Rft{3}.d(1,1)]); for i = 1:3, Qt{i} = scale(i)*Qt{i}; Rft{i} = scale(i)*Rft{i}; end Q = vertcat(Qt{:}); Rf = vertcat(Rft{:}); Q = set(Q,'InputName',['y1';'y2';'y3';strseq('u',1:mu)],... 'OutputName',['r1';'r2';'r3']) Rf = set(Rf,'InputName',['f1';'f2';'f3'],'OutputName',['r1';'r2';'r3']) syse = [sysf;eye(mu,mu+md+mf)]; norm_Ru_Rd = norm(Q*syse(:,{'controls','disturbances'}),inf) norm_rez = norm(Q*syse(:,'faults')-Rf,inf) [S_strong,abs_dcgains] = fdisspec(Rft) FSCOND = fdifscond(Rft,0,SFDI) set(Rf,'InputName',strseq('f_',1:mf),'OutputName',strseq('r_',1:size(SFDI,1))); step(Rf); title('Step responses from the fault inputs') ylabel('Residuals') \end{verbatim} \end{example} \begin{example}\label{ex:Yuan3} This is the example of \cite{Yuan97}, already considered in Example~\ref{ex:Yuan}. Using \texttt{efdisyn}, we can easily determine a bank of least order fault detection filters, which achieve the computed maximal weak structure matrix $S_{weak}$. With the default least order synthesis option, we obtain a bank of 18 filters, each one of order one or two. The overall filters $Q(s)$ and $R_f(s)$ obtained by stacking the 18 component filters have state-space realizations of order 32, which are usually non-minimal. Typically, minimal realizations of orders about 20 can be computed for each of these filters. The bank of 12 component filters ensuring strong fault detection can easily be picked-out from the computed filters. In this example, we show that using the pole assignment feature, the overall filters $Q(s)$ and $R_f(s)$ can be determined with minimal realizations of order 6, which is probably the least achievable global order. To arrive to this order, we enforce the same dynamics for all component filters by assigning, for example, all poles of the component filters to lie in the set $\{-1,-2\}$. The resulting least order of the overall filter $Q(s)$ can be easily read-out from the plot of its Hankel-singular values shown in Fig.~\ref{fig:hsvQ}. The synthesis procedure also ensures that $R_f(s)$, and even of the joint overall filter $[\, Q(s)\;R_f(s)\,]$ have minimal realizations of order 6!. It is also straightforward to check that the resulting weak structure matrix of $R_f(s)$ and $S_{weak}$ coincide. \begin{verbatim} rng('default'); p = 3; mu = 1; mf = 8; A = [ -1 1 0 0; 1 -2 1 0; 0 1 -2 1; 0 0 1 -2 ]; Bu = [1 0 0 0]'; Bf = [ 1 0 0 0 1 0 0 0; 0 1 0 0 -1 1 0 0; 0 0 1 0 0 -1 1 0; 0 0 0 1 0 0 -1 1]; C = [ 1 0 0 0; 0 0 1 0; 0 0 0 1]; Du = zeros(p,mu); Df = zeros(p,mf); sysf = fdimodset(ss(A,[Bu Bf],C,[Du Df]),struct('c',1:mu,'f',mu+(1:mf))); opt = struct('tol',1.e-7,'FDTol',1.e-5); S_weak = fdigenspec(sysf,opt); options = struct('tol',1.e-7,'sdeg',-5,'smarg',-5,'poles',[-1 -2],... 'FDTol',0.0001,'rdim',1,'simple',false,'SFDI',S_weak); [Q,Rf] = efdisyn(sysf,options); hsvd(vertcat(Q{:})) isequal(S_weak,fditspec(Rf)) \end{verbatim} \begin{figure}[h] \begin{center} \includegraphics[height=10cm]{varga_Fig_Exyuan_hsva}\vspace*{-5mm} \caption{Hankel-singular values of the overall filter $Q(s)$.} \label{fig:hsvQ} \end{center} \end{figure} \end{example} \newpage \subsubsection{\texttt{\bfseries afdisyn}} \index{M-functions!\texttt{\bfseries afdisyn}} \index{fault detection and isolation problem!approximate (AFDIP)} \subsubsection*{Syntax} \begin{verbatim} [Q,R,INFO] = afdisyn(SYSF,OPTIONS) \end{verbatim} \subsubsection*{Description} \texttt{\bfseries afdisyn} solves the \emph{approximate fault detection and isolation problem} (AFDIP) (see Section \ref{sec:AFDIP}), for a given LTI system \texttt{SYSF} with additive faults and a given structure matrix $S_{FDI}$ (specified via the \texttt{OPTIONS} structure). Two banks of stable and proper filters are computed in the $n_b$-dimensional cell arrays \texttt{Q} and \texttt{R}, where $n_b$ is the number of specifications contained in $S_{FDI}$ (i.e., the number of rows of the structure matrix $S_{FDI}$). \texttt{Q\{i\}} contains the $i$-th fault detection filter (\ref{ri_fdip}) in the overall solution (\ref{qbank}) of the AFDIP and \texttt{R\{i\}} contains its internal form. \subsubsection*{Input data} \begin{description} \item \texttt{SYSF} is a LTI system in the state-space form \begin{equation}\label{afdisyn:sysss} {\begin{aligned} E\lambda x(t) & = Ax(t)+ B_u u(t)+ B_d d(t) + B_f f(t)+ B_w w(t) , \\ y(t) & = C x(t) + D_u u(t)+ D_d d(t) + D_f f(t) + D_w w(t) , \end{aligned}} \end{equation} where any of the inputs components $u(t)$, $d(t)$, $f(t)$, or $w(t)$ can be void. For the system \texttt{SYSF}, the input groups for $u(t)$, $d(t)$, $f(t)$, and $w(t)$ have the standard names \texttt{\bfseries 'controls'}, \texttt{\bfseries 'disturbances'}, \texttt{\bfseries 'faults'}, and \texttt{\bfseries 'noise'}, respectively. \item \texttt{OPTIONS} is a MATLAB structure used to specify various synthesis options and has the following fields: {\setlength\LTleft{30pt}\begin{longtable}{|l|p{11.6cm}|} \hline \textbf{\texttt{OPTIONS} fields} & \textbf{Description} \\ \hline \texttt{SFDI} & the desired structure matrix $S_{FDI}$ with $n_b$ rows to solve the AFDIP\newline (Default: \texttt{[1...1]}, i.e., solve an approximate fault detection problem)\\ \hline \texttt{tol} & relative tolerance for rank computations \newline (Default: internally computed)\\ \hline \texttt{tolmin} & absolute tolerance for observability tests \newline (Default: internally computed)\\ \hline \texttt{FDTol} & threshold for fault detectability checks (Default: 0.0001)\\ \hline \texttt{FDGainTol} & threshold for strong fault detectability checks (Default: 0.01)\\ \hline \texttt{rdim} & vector, whose $i$-th component $q_i$, specifies the desired number of residual outputs for the $i$-th component filters \texttt{Q\{$i$\}} and \texttt{R\{$i$\}}; if \texttt{OPTIONS.rdim} is a scalar $q$, then a vector with all components $q_i = q$ is assumed. \\ & (Default: \hspace*{-2.5mm}\begin{tabular}[t]{p{10cm}} \texttt{[ ]}, in which case $q_i = q_{i,1}+q_{i,2}$, with $q_{i,1}$ and $q_{i,2}$ selected taking into account $r_w^{(i)}$, the rank of the transfer function matrix from the noise input to the reduced system output employed to determine \texttt{Q\{$i$\}}, as follows: \newline if \texttt{OPTIONS.HDesign\{$i$\}} is empty, then \\ \hspace*{1em} $q_{i,1} = \min\big(1,r_w^{(i)}\big)$, if \texttt{OPTIONS.minimal} = \texttt{true}, or \\ \hspace*{1em} $q_{i,1} = r_w^{(i)}$ if \texttt{OPTIONS.minimal} = \texttt{false}; \\ if \texttt{OPTIONS.HDesign\{$i$\}} is nonempty, then $q_{i,1}$ is the row dimension of the design matrix contained in \texttt{OPTIONS.HDesign\{$i$\}}; \\ if \texttt{OPTIONS.HDesign2\{$i$\}} is empty, then \\ \hspace*{1em} $q_{i,2} = 1-\min\big(1,r_w^{(i)}\big)$, if \texttt{OPTIONS.minimal} = \texttt{true}, or \\ \hspace*{1em} $q_{i,2}$ is set to its maximum achievable value, \newline \hspace*{2.8em} if \texttt{OPTIONS.minimal} = \texttt{false}; \\ if \texttt{OPTIONS.HDesign2\{$i$\}} is nonempty, then $q_{i,2}$ is the \\ row dimension of the design matrix contained in \\ \texttt{OPTIONS.HDesign2\{$i$\}}.) \end{tabular}\\ \hline \texttt{FDFreq} & vector of real frequency values for strong detectability checks \newline (Default: \texttt{[ ]}) \\ \hline \texttt{smarg} & stability margin for the poles of the component filters \texttt{Q\{$i$\}} and \texttt{R\{$i$\}}\\ & (Default: \texttt{-sqrt(eps)} for a continuous-time system \texttt{SYSF}; \\ & \hspace*{4.5em}\texttt{1-sqrt(eps)} for a discrete-time system \texttt{SYSF}).\\ \hline \pagebreak[4] \hline \texttt{sdeg} & prescribed stability degree for the poles of the component filters \texttt{Q\{$i$\}} and \texttt{R\{$i$\}}\\ & (Default: $-0.05$ for a continuous-time system \texttt{SYSF}; \\ & \hspace*{4.8em} $0.95$ for a discrete-time system \texttt{SYSF}).\\ \hline \texttt{poles} & complex vector containing a complex conjugate set of desired poles (within the stability domain) to be assigned for the component filters \texttt{Q\{$i$\}} and \texttt{R\{$i$\}} (Default: \texttt{[ ]}) \\\hline \texttt{nullspace} & option to use a specific proper nullspace basis to be employed at the initial reduction step\\ & \hspace*{-.9mm}{\tabcolsep=0.7mm\begin{tabular}[t]{lcp{10cm}} \texttt{true } &--& use a minimal proper basis (default); \\ \texttt{false} &--& use a full-order observer based basis (see \textbf{Method}). \newline \emph{Note:} This option can only be used if no disturbance inputs are present in (\ref{afdisyn:sysss}) and $E$ is invertible. \end{tabular}} \\ \hline \texttt{simple} & option to employ simple proper bases for the synthesis of the component filters \texttt{Q\{$i$\}} and \texttt{R\{$i$\}} \\ & \texttt{true } -- use simple bases; \\ & \texttt{false} -- use non-simple bases (default)\\\hline \texttt{minimal} & option to perform least order synthesis of the component filters \\ & \texttt{true } -- perform least order synthesis (default); \\ & \texttt{false} -- perform full order synthesis \\[2mm] \hline \texttt{exact} & option to perform exact filter synthesis \\ & \texttt{true } -- perform exact synthesis (i.e., no optimization performed); \\ & \texttt{false} -- perform approximate synthesis (default). \\\hline \texttt{freq} & complex frequency value to be employed to check the full row rank admissibility conditions within the function \texttt{afdsyn} (see \textbf{Method} for \texttt{afdsyn}) (Default:\texttt{[ ]}, i.e., a randomly generated frequency). \\ \hline \texttt{tcond} & maximum alowed condition number of the employed non-orthogonal transformations (Default: $10^4$).\\ \hline \texttt{FDSelect} & integer vector with increasing elements containing the indices of the desired filters to be designed (Default: $[\,1, \ldots, n_b\,]$)\\ \hline \texttt{HDesign} & $n_b$-dimensional cell array; \texttt{OPTIONS.HDesign\{$i$\}}, if not empty, is a full row rank design matrix $H_1^{(i)}$ employed for the synthesis of the $i$-th filter components $Q^{(1,i)}(\lambda)$ and $R^{(1,i)}(\lambda)$ (see \textbf{Method}) \newline (Default: \texttt{[ ]})\\ \hline \texttt{HDesign2} & $n_b$-dimensional cell array; \texttt{OPTIONS.HDesign2\{$i$\}}, if not empty, is a full row rank design matrix $H_2^{(i)}$ employed for the synthesis of the $i$-th filter components $Q^{(2,i)}(\lambda)$ and $R^{(2,i)}(\lambda)$ (see \textbf{Method}) \newline (Default: \texttt{[ ]})\\ \hline \texttt{gamma} & upper bound on the resulting $\|R_w^{(i)}(\lambda)\|_\infty$ (see \textbf{Method}) (Default: 1) \\ \hline \texttt{epsreg} & regularization parameter used in \textbf{\texttt{afdsyn}} (Default: 0.1) \\ \hline \pagebreak[4]\hline \texttt{sdegzer} & prescribed stability degree for zeros shifting \\ & (Default: $-0.05$ for a continuous-time system \texttt{SYSF}; \\ & \hspace*{4.8em} $0.95$ for a discrete-time system \texttt{SYSF}).\\ \hline \texttt{nonstd} & option to handle nonstandard optimization problems used in \textbf{\texttt{afdsyn}}:\\ & 1 -- use the quasi-co-outer--co-inner factorization (default); \\ & 2 -- use the modified co-outer--co-inner factorization with the \\ & \hspace{1.7em}regularization parameter \texttt{OPTIONS.epsreg}; \\ & 3 -- use the Wiener-Hopf type co-outer--co-inner factorization. \\ & 4 -- use the Wiener-Hopf type co-outer-co-inner factorization with\\ & \hspace{1.7em}zero shifting of the non-minimum phase factor using the\\ & \hspace{1.7em}stabilization parameter \texttt{OPTIONS.sdegzer} \\ & 5 -- use the Wiener-Hopf type co-outer-co-inner factorization with \\ & \hspace{1.7em}the regularization of the non-minimum phase factor using the \\ & \hspace{1.7em}regularization parameter \texttt{OPTIONS.epsreg} \\ \hline \end{longtable}} \end{description} \subsubsection*{Output data} \begin{description} \item \texttt{Q} is an $n_b$-dimensional cell array, with \texttt{Q\{$i$\}} containing the resulting $i$-th filter in a standard state-space representation \[ {\begin{aligned} \lambda x_Q^{(i)}(t) & = A_Q^{(i)}x_Q^{(i)}(t)+ B_{Q_y}^{(i)}y(t)+ B_{Q_u}^{(i)}u(t) ,\\ r^{(i)}(t) & = C_Q^{(i)} x_Q^{(i)}(t) + D_{Q_y}^{(i)}y(t)+ D_{Q_u}^{(i)}u(t) , \end{aligned}} \] where the residual signal $r^{(i)}(t)$ is a $q_i$-dimensional vector. For each system object \texttt{Q\{$i$\}}, two input groups \texttt{\bfseries 'outputs'} and \texttt{\bfseries 'controls'} are defined for $y(t)$ and $u(t)$, respectively, and the output group \texttt{\bfseries 'residuals'} is defined for the residual signal $r^{(i)}(t)$. \texttt{Q\{$i$\}} is empty if the index $i$ is not selected in \texttt{OPTIONS.FDSelect}. \item \texttt{R} is an $n_b$-dimensional cell array, with \texttt{R\{$i$\}} containing the resulting internal form of the $i$-th filter in a standard state-space representation \[ {\begin{aligned} \lambda x_R^{(i)}(t) & = A_Q^{(i)}x_R^{(i)}(t)+ B_{R_f}^{(i)}f(t)+ B_{R_w}^{(i)}w(t), \\ r^{(i)}(t) & = C_Q^{(i)} x_R^{(i)}(t) + D_{R_f}^{(i)}f(t)+ D_{R_w}^{(i)}w(t). \end{aligned}} \] The input groups \texttt{\bfseries 'faults'} and \texttt{\bfseries 'noise'} are defined for $f(t)$, and $w(t)$, respectively, and the output group \texttt{\bfseries 'residuals'} is defined for the residual signal $r^{(i)}(t)$. Note that the realizations of \texttt{Q\{$i$\}} and \texttt{R\{$i$\}} share the matrices $A_Q^{(i)}$ and $C_Q^{(i)}$. \texttt{R\{$i$\}} is empty if the index $i$ is not selected in \texttt{OPTIONS.FDSelect}. \item \texttt{INFO} is a MATLAB structure containing additional information as follows: \begin{center} \begin{tabular}{|l|p{12cm}|} \hline \textbf{\texttt{INFO} fields} & \textbf{Description} \\ \hline \texttt{tcond} & $n_b$-dimensional vector; \texttt{INFO.tcond}$(i)$ contains the maximum of the condition numbers of the employed non-orthogonal transformation matrices to determine the $i$-th filter component \texttt{Q\{$i$\}}; a warning is issued if any \texttt{INFO.tcond}$(i)$ $\geq$ \texttt{OPTIONS.tcond}.\\ \hline \texttt{HDesign} & $n_b$-dimensional cell array; \texttt{INFO.HDesign\{$i$\}} is the $i$-th design matrix actually employed for the synthesis of the filter component $Q_1^{(i)}$ of the $i$-th fault detection filter \texttt{Q\{$i$\}} (see \textbf{Method}). \texttt{INFO.HDesign\{$i$\}} is empty if the index $i$ is not selected in \texttt{OPTIONS.FDSelect}. \\ \hline \texttt{HDesign2} & $n_b$-dimensional cell array; \texttt{INFO.HDesign2\{$i$\}} is the $i$-th design matrix actually employed for the synthesis of the filter component $Q_2^{(i)}$ of the $i$-th fault detection filter \texttt{Q\{$i$\}} (see \textbf{Method}). \texttt{INFO.HDesign2\{$i$\}} is empty if the index $i$ is not selected in \texttt{OPTIONS.FDSelect}. \\ \hline \texttt{freq} & complex frequency value employed to check the full row rank admissibility conditions within the function \texttt{afdsyn} \\ \hline \texttt{gap} & $n_b$-dimensional cell array; \texttt{INFO.gap$(i)$} contains the $i$-th gap $\eta_i$ resulted by calling \texttt{afdsyn} to determine \texttt{Q\{$i$\}} (see \textbf{Method}).\\ \hline \end{tabular} \end{center} \end{description} \subsubsection*{Method} The \textbf{Procedure AFDI} from \cite[Sect.\ 5.4]{Varg17} is implemented, which relies on the optimization-based synthesis method proposed in \cite{Varg09b}. Each filter $Q^{(i)}(\lambda)$ and its internal form $R^{(i)}(\lambda)$, are determined by solving a suitably formulated AFDP for a reduced system without control inputs, and with redefined disturbance and fault inputs. For this purpose, the function \texttt{afdisyn} calls internally the function \texttt{afdsyn} to solve a suitably formulated AFDP for each specification (i.e., row) contained in the structure matrix $S_{FDI}$. \index{M-functions!\texttt{\bfseries afdsyn}} If the faulty system \texttt{SYSF} has the input-output form \begin{equation}\label{afdi:systemw1} {\mathbf{y}}(\lambda) = G_u(\lambda){\mathbf{u}}(\lambda) + G_d(\lambda){\mathbf{d}}(\lambda) + G_f(\lambda){\mathbf{f}}(\lambda) + G_w(\lambda){\mathbf{w}}(\lambda) \end{equation} and the $i$-th fault detection filter $Q^{(i)}(\lambda)$ contained in \texttt{Q\{$i$\}} has the input-output form \begin{equation}\label{afdi:detec1i} {\mathbf{r}}^{(i)}(\lambda) = Q^{(i)}(\lambda)\left [ \begin{array}{c} {\mathbf{y}}(\lambda)\\{\mathbf{u}}(\lambda)\end{array} \right ] \, , \end{equation} then, taking into account the decoupling conditions (\ref{ens}), the resulting internal form of the $i$-th fault detection filter $R^{(i)}(\lambda)$, contained in \texttt{R\{$i$\}}, is \begin{equation}\label{afdi:resys1i} \hspace*{-5mm}{\mathbf{r}}^{(i)}(\lambda) = R^{(i)}(\lambda){\arraycolsep=1mm \left [ \begin{array}{c}{\mathbf{f}}(\lambda)\\ {\mathbf{w}}(\lambda) \end{array} \right ] } = R_f^{(i)}(\lambda){\mathbf{f}}(\lambda) + R_w^{(i)}(\lambda){\mathbf{w}}(\lambda) \, , \hspace*{-4mm}\end{equation} with $R^{(i)}(\lambda) = [\, R_f^{(i)}(\lambda)\; R_w^{(i)}(\lambda)\,]$ defined as \begin{equation}\label{afdi:resys2i} \left [ \begin{array}{c|c} R_f^{(i)}(\lambda) & R_w^{(i)}(\lambda) \end{array} \right ] := {\arraycolsep=1mm Q^{(i)}(\lambda) \left [ \begin{array}{c|c} G_f(\lambda) & G_w(\lambda) \\ 0 & 0 \end{array} \right ] } \, . \end{equation} When determining $Q^{(i)}(\lambda)$ it is first attempted to solve the \emph{strict} AFDIP (\ref{afdip-sr1}), such that the structure vector corresponding to the zero and nonzero columns of $R_f^{(i)}(\lambda)$ is equal to the $i$-th row of the specified $S_{FDI}$. If this is not achievable, then the \emph{soft} AFDIP (\ref{afdip-sr}) is attempted to be solved. \index{performance evaluation!fault detection and isolation!fault-to-noise gap} The achieved gap $\eta_i$ is computed as $\eta_i = \big\|\overline R_f^{(i)}(\lambda)\big\|_{\infty -}/\big\|\big[\widetilde R_f^{(i)}(\lambda)\;R_w^{(i)}(\lambda)\big]\big\|_\infty$, where $\overline R_f^{(i)}(\lambda)$ is formed from the columns of $R_f^{(i)}(\lambda)$ corresponding to nonzero entries in the $i$-th row of $S_{FDI}$ and $\widetilde R_f^{(i)}(\lambda)$ is formed from the columns of $R_f^{(i)}(\lambda)$ corresponding to zero entries in the $i$-th row of $S_{FDI}$. If \texttt{OPTIONS.FDFreq} is nonempty, then $\big\|\overline R_f^{(i)}(\lambda)\big\|_{\infty -}$ is only evaluated over the frequency values contained in \texttt{OPTIONS.FDFreq}. The achieved gaps are returned in \texttt{INFO.gap}. Each filter $Q^{(i)}(\lambda)$ is determined in the product form \begin{equation}\label{afdsyn:Qprodi} Q^{(i)}(\lambda) = \overline Q_1^{(i)}(\lambda)Q_1(\lambda) , \end{equation} where the factors are determined as follows: \begin{itemize} \item[(a)] $Q_1(\lambda) = N_l(\lambda)$, with $N_l(\lambda)$ a $\big(p-r_d\big) \times (p+m_u)$ proper rational left nullspace basis satisfying $N_l(\lambda)\left[\begin{smallmatrix}G_u(\lambda) & G_d(\lambda)\\ I_{m_u} & 0 \end{smallmatrix}\right] = 0$, with $r_d := \text{rank}\, G_d(\lambda)$; \item[(b)] $\overline Q_1^{(i)}(\lambda)$ is the solution of a suitably formulated AFDP to achieve the specification contained in the $i$-th row of $S_{FDI}$. The function \texttt{afdsyn} is called for this purpose and internally uses the design matrices $H_1^{(i)}$, which can be specified in \texttt{OPTIONS.HDesign\{$i$\}}, and $H_2^{(i)}$, which can be specified in \texttt{OPTIONS.HDesign2\{$i$\}} (see \textbf{Method} for \texttt{afdsyn}). The actually employed design matrices are returned in \texttt{INFO.HDesign\{$i$\}} and \texttt{INFO.HDesign2\{$i$\}}, respectively. \end{itemize} Each factor $\overline Q_1^{(i)}(\lambda)$ is determined in the partitioned form \[ \overline Q_1^{(i)}(\lambda) = \left [ \begin{array}{cc} \overline Q_1^{(i,1)}(\lambda) \\ \overline Q_1^{(i,2)}(\lambda) \end{array} \right ] , \] where the computation of individual factors $\overline Q_1^{(i,1)}(\lambda)$ and $\overline Q_1^{(i,2)}(\lambda)$ depends on the user's options (see \textbf{Method} for the function \texttt{afdsyn}). In what follows, we only discuss shortly the computation of $Q_1(\lambda)$, performed only once as an initial reduction step. If \texttt{OPTIONS.nullspace = true} or $m_d > 0$ or $E$ is singular, then $N_l(\lambda)$ is determined as a minimal proper nullspace basis. In this case, only orthogonal transformations are performed at this computational step. If \texttt{OPTIONS.nullspace = false}, $m_d = 0$ and $E$ is invertible, then $N_l(\lambda) = [ \, I_{p} \; -G_u(\lambda)\,]$ is used, which corresponds to a full-order Luenberger observer. This option involves no numerical computations. \subsubsection*{Example} \begin{example} This is \emph{Example} 5.3 from the book \cite{Varg17}, with the disturbances redefined as noise inputs and by adding a sensor fault for the first output measurement. The TFMs of the system are: \[ G_u(s) = {\arraycolsep=1mm\left [ \begin{array}{c} \displaystyle\frac{s+1}{s+2} \\ \\[-2mm] \displaystyle\frac{s+2}{s+3} \end{array} \right ], \quad G_d(s) = 0, \quad G_f(s) = [\, G_u(s)\; I\,], \quad G_w(s) = \left [ \begin{array}{c} \displaystyle\frac{s-1}{s+2} \\ \\[-2mm]0 \end{array} \right ]} ,\] where the fault input $f_1$ corresponds to an additive actuator fault, while the fault inputs $f_2$ and $f_3$ describe additive sensor faults in the outputs $y_1$ and $y_2$, respectively. The transfer function matrix $G_w(s)$ is non-minimum phase, having an unstable zero at 1. Interestingly, the EFDIP formulated with $G_d(s) = G_w(s)$ is not solvable. The maximal achievable structure matrix (for the EFDIP) is \[ S_{max} = \left [ \begin{array}{ccc} 1 & 1 & 1 \\ 0 & 1 & 1 \\ 1 & 0 & 1 \\ 1 & 1 & 0 \end{array} \right ] \, .\] We assume that no simultaneous faults occur, and thus we can target to solve an AFDIP for the structure matrix \[ S_{FDI} = \left [ \begin{array}{ccc} 0 & 1 & 1 \\ 1 & 0 & 1 \\ 1 & 1 & 0 \end{array} \right ] \, ,\] where the columns of $S_{FDI}$ codify the desired fault signatures. We want to design a bank of three detection filters $Q^{(i)}(s)$, $i = 1, 2, 3$ which fulfill for each $i$: \begin{itemize} \item[--] the decoupling condition: $Q^{(i)}(s)\left[\begin{smallmatrix} G_u(s) & G_d(s) \\ I_{m_u} & 0 \end{smallmatrix}\right] = 0$; \item[--] the fault isolability condition: $S_{R_f^{(i)}}$ is equal to the $i$-th row of $S_{FDI}$; \item[--] the maximization of the noise attenuation gap: $\eta_i := \|\overline R_f^{(i)}(s)\|_{\infty -}/\|R_w^{(i)}(s)\|_\infty = \max$, where $\overline R_f^{(i)}(s)$ is formed from the columns of $R_f^{(i)}(s)$ corresponding to nonzero entries in the $i$-th row of $S_{FDI}$. \end{itemize} The results computed with the following script are:\\ -- $\eta_1 = 1.5$ with \[ Q^{(1)}(s) = {\left [ \begin{array}{ccc} \displaystyle\frac{s+2}{s+1} & -\displaystyle\frac{s+3}{s+2} & 0 \end{array} \right ] , \quad R_f^{(1)}(s) = \left [ \begin{array}{ccc} 0 & \displaystyle\frac{s+2}{s+1} & -\displaystyle\frac{s+3}{s+2} \end{array} \right ] }, \quad R_w^{(1)}(s) = \displaystyle\frac{s-1}{s+1}\; ; \] -- $\eta_2 = \infty$ with \[ Q^{(2)}(s) = {\left [ \begin{array}{ccc} 0 & 1 & -\displaystyle\frac{s+2}{s+3} \end{array} \right ] , \quad R_f^{(2)}(s) = \left [ \begin{array}{ccc} \displaystyle\frac{s+2}{s+3} & 0 & 1 \end{array} \right ] }, \quad R_w^{(2)}(s) = 0\; ; \] -- $\eta_3 = 1$ with \[ Q^{(3)}(s) = {\left [ \begin{array}{ccc} \displaystyle\frac{s+2}{s+1} & 0 & -1 \end{array} \right ] , \quad R_f^{(3)}(s) = \left [ \begin{array}{ccc} 1 & \displaystyle\frac{s+2}{s+1} & 0 \end{array} \right ] }, \quad R_w^{(3)}(s) = \displaystyle\frac{s-1}{s+1} \;. \] \begin{verbatim} s = tf('s'); mu = 1; mw = 1; p = 2; mf = mu+p; Gu = [(s+1)/(s+2); (s+2)/(s+3)]; Gw = [(s-1)/(s+2); 0]; sysf = fdimodset(ss([Gu Gw]),struct('c',1,'f',1,'fs',1:2,'n',2)); S = fdigenspec(sysf); SFDI = S(sum(S,2)==2,:) nb = size(SFDI,1); options = struct('tol',1.e-7,'smarg',-3,... 'sdeg',-3,'SFDI',SFDI); [Q,R,info] = afdisyn(sysf,options); minreal(tf(Q{1})), minreal(tf(R{1}(:,'faults'))), minreal(tf(R{1}(:,'noise'))) minreal(tf(Q{2})), minreal(tf(R{2}(:,'faults'))), tf(R{2}(:,'noise')) minreal(tf(Q{3})), minreal(tf(R{3}(:,'faults'))), tf(R{3}(:,'noise')) format short e info.gap gap = fdif2ngap(R,[],SFDI) inpnames = {'f_1','f_2','f_3','w'}; outnames = {'r_1','r_2','r_3'}; Rtot = vertcat(R{:}); set(Rtot,'InputName',inpnames,'OutputName',outnames); step(Rtot); ylabel('Residuals') title('Step responses from fault and noise inputs') \end{verbatim} \end{example} \pagebreak[4] \subsubsection{\texttt{\bfseries emmsyn}} \index{M-functions!\texttt{\bfseries emmsyn}} \index{model-matching problem!a@exact (EMMP)} \subsubsection*{Syntax} \begin{verbatim} [Q,R,INFO] = emmsyn(SYSF,SYSR,OPTIONS) \end{verbatim} \subsubsection*{Description} \texttt{\bfseries emmsyn} solves the \emph{exact model matching problem} (EMMP) (as formulated in the more general form (\ref{emm:resys}) in Remark~\ref{rem:gemm}; see Section \ref{sec:EMMP}), for a given LTI system \texttt{SYSF} with additive faults and a given stable reference filter \texttt{SYSR}. Two stable and proper filters, \texttt{Q} and \texttt{R}, are computed, where \texttt{Q} contains the fault detection and isolation filter representing the solution of the EMMP, and \texttt{R} contains its internal form. \subsubsection*{Input data} \begin{description} \item \texttt{SYSF} is a LTI system in the state-space form \begin{equation}\label{emmsyn:sysss} {\begin{aligned} E\lambda x(t) & = Ax(t)+ B_u u(t)+ B_d d(t) + B_f f(t)+ B_w w(t) , \\ y(t) & = C x(t) + D_u u(t)+ D_d d(t) + D_f f(t) + D_w w(t) , \end{aligned}} \end{equation} where any of the inputs components $u(t)$, $d(t)$, $f(t)$, or $w(t)$ can be void. For the system \texttt{SYSF}, the input groups for $u(t)$, $d(t)$, $f(t)$, and $w(t)$ have the standard names \texttt{\bfseries 'controls'}, \texttt{\bfseries 'disturbances'}, \texttt{\bfseries 'faults'}, and \texttt{\bfseries 'noise'}, respectively. \item \texttt{SYSR} is a proper and stable LTI system in the state-space form \begin{equation}\label{emmsyn:sysrss} {\begin{aligned} \lambda x_r(t) & = A_rx_r(t)+ B_{ru} u(t)+ B_{rd} d(t) + B_{rf} f(t)+ B_{rw} w(t) , \\ y_r(t) & = C_r x_r(t) + D_{ru} u(t)+ D_{rd} d(t) + D_{rf} f(t) + D_{rw} w(t) , \end{aligned}} \end{equation} where the reference model output $ry_(t)$ is a $q$-dimensional vector and any of the inputs components $u(t)$, $d(t)$, $f(t)$, or $w(t)$ can be void. For the system \texttt{SYSR}, the input groups for $u(t)$, $d(t)$, $f(t)$, and $w(t)$ have the standard names \texttt{\bfseries 'controls'}, \texttt{\bfseries 'disturbances'}, \texttt{\bfseries 'faults'}, and \texttt{\bfseries 'noise'}, respectively. \item \texttt{OPTIONS} is a MATLAB structure used to specify various synthesis options and has the following fields: {\setlength\LTleft{30pt}\begin{longtable}{|l|p{11.6cm}|} \hline \textbf{\texttt{OPTIONS} fields} & \textbf{Description} \\ \hline \texttt{tol} & relative tolerance for rank computations \newline (Default: internally computed)\\ \hline \texttt{tolmin} & absolute tolerance for observability tests \newline (Default: internally computed)\\ \hline \texttt{smarg} & stability margin for the poles of the filters \texttt{Q} and \texttt{R}\\ & (Default: \texttt{-sqrt(eps)} for a continuous-time system \texttt{SYSF}; \\ & \hspace*{4.5em}\texttt{1-sqrt(eps)} for a discrete-time system \texttt{SYSF}).\\ \hline \texttt{sdeg} & prescribed stability degree for the poles of the filters \texttt{Q} and \texttt{R}\\ & (Default: $-0.05$ for a continuous-time system \texttt{SYSF}; \\ & \hspace*{4.8em} $0.95$ for a discrete-time system \texttt{SYSF}).\\ \hline \texttt{poles} & complex vector containing a complex conjugate set of desired poles (within the stability domain) to be assigned for the filters \texttt{Q} and \texttt{R} (Default: \texttt{[ ]}) \\\hline \texttt{simple} & option to employ a simple proper basis for synthesis \\ & \texttt{true } -- use a simple basis; \\ & \texttt{false} -- use a non-simple basis (default)\\\hline \texttt{minimal} & option to perform least order synthesis of the filter \texttt{Q} \\ & \texttt{true } -- perform least order synthesis (default); \\ & \texttt{false} -- perform full order synthesis \\\hline \texttt{regmin} & option to perform regularization selecting a least order left annihilator \\ & \texttt{true } -- perform least order selection (default); \\ & \texttt{false} -- no least order selection performed \\\hline \texttt{tcond} & maximum allowed condition number of the employed non-orthogonal transformations (Default: $10^4$).\\ \hline \texttt{normalize} & option for the normalization of the diagonal elements of the updating matrix $M(\lambda)$:\\ & {\tabcolsep=1mm\begin{tabular}{llp{9.5cm}}\hspace*{-1.5mm}\texttt{'gain'}&--& scale with the gains of the zero-pole-gain \newline representation (default) \\ \hspace*{-1.5mm}\texttt{'dcgain'}&--& scale with the DC-gains \\ \hspace*{-1.5mm}\texttt{'infnorm'}&--& scale with the values of infinity-norms \end{tabular}} \\ \hline \texttt{freq} & complex frequency value to be employed to check the left-invertibility-based solvability condition (see \textbf{Method}) \newline (Default:\texttt{[ ]}, i.e., a randomly generated frequency). \\ \hline \texttt{HDesign} & full row rank design matrix $H$ employed for the synthesis of the filter \texttt{Q} (see \textbf{Method}) (Default: \texttt{[ ]}) \\ & \emph{Note.} This option can be only used in conjunction with the ``no least order synthesis'' option: \texttt{OPTIONS.minimal = false}. \\ \hline \end{longtable}} \end{description} \subsubsection*{Output data} \begin{description} \item \texttt{Q} is the resulting fault detection filter in a standard state-space representation \begin{equation}\label{emmsyn:detss} {\begin{aligned} \lambda x_Q(t) & = A_Qx_Q(t)+ B_{Q_y}y(t)+ B_{Q_u}u(t) ,\\ r(t) & = C_Q x_Q(t) + D_{Q_y}y(t)+ D_{Q_u}u(t) , \end{aligned}} \end{equation} where the residual signal $r(t)$ is a $q$-dimensional vector. For the system object \texttt{Q}, two input groups \texttt{\bfseries 'outputs'} and \texttt{\bfseries 'controls'} are defined for $y(t)$ and $u(t)$, respectively, and the output group \texttt{\bfseries 'residuals'} is defined for the residual signal $r(t)$. \item \texttt{R} is the resulting internal form of the fault detection filter in a standard state-space representation \begin{equation}\label{emmsyn:detinss} {\begin{aligned} \lambda x_R(t) & = A_Rx_R(t)+ B_{R_u}u(t)+B_{R_d}d(t)+B_{R_f}f(t)+ B_{R_w}w(t) ,\\ r(t) & = C_Rx_R(t)+ D_{R_u}u(t)+D_{R_d}d(t)+D_{R_f}f(t)+ D_{R_w}w(t) \end{aligned}} \end{equation} with the same input groups defined as for \texttt{SYSR} and the output group \texttt{\bfseries 'residuals'} defined for the residual signal $r(t)$. \item \texttt{INFO} is a MATLAB structure containing additional information as follows: \begin{center} \begin{longtable}{|l|p{12cm}|} \hline \textbf{\texttt{INFO} fields} & \textbf{Description} \\ \hline \texttt{tcond} & the maximum of the condition numbers of the employed non-orthogonal transformation matrices; a warning is issued if \texttt{INFO.tcond} $\geq$ \texttt{OPTIONS.tcond}.\\ \hline \texttt{degs} & the left Kronecker indices of $G(\lambda) := \left[\begin{smallmatrix} G_u(\lambda) & G_u(\lambda) \\ I & 0\end{smallmatrix}\right]$ (see \textbf{Metho}d); also the increasingly ordered degrees of a left minimal polynomial nullspace basis of $G(\lambda)$; (\texttt{INFO.degs = [ ]} if no explicit left nullspace basis is computed)\\ \hline \texttt{M} & state-space realization of the employed updating matrix $M(\lambda)$ (see \textbf{Method}) \\ \hline \texttt{freq} & complex frequency value employed to check the left invertibility condition; \texttt{INFO.freq = [ ]} if no frequency-based left invertibility check was performed. \\ \hline \texttt{HDesign} & design matrix $H$ employed for the synthesis of the fault detection filter; \texttt{INFO.HDesign = [ ]} if no design matrix was explicitly involved in the filter synthesis. \\ \hline \end{longtable} \end{center} \end{description} \subsubsection*{Method} Extensions of the \textbf{Procedure EMM} and \textbf{Procedure EMMS} from \cite[Sect.\ 5.6]{Varg17} are implemented in the function \texttt{\bfseries emmsyn}. The \textbf{Procedure EMM} relies on the model-matching synthesis method proposed in \cite{Varg04g}, while \textbf{Procedure EMMS} uses the inversion-based method proposed in \cite{Varg13a} in conjunction with the nullspace method. The \textbf{Procedure EMM} is employed to solve the general EMMP (see below), while \textbf{Procedure EMMS} is employed to solve the more particular (but more practice relevant) strong exact fault detection and isolation problem (strong EFDIP). Assume that the system \texttt{SYSF} has the input-output form \begin{equation}\label{emmsyn:systemw1} {\mathbf{y}}(\lambda) = G_u(\lambda){\mathbf{u}}(\lambda) + G_d(\lambda){\mathbf{d}}(\lambda) + G_f(\lambda){\mathbf{f}}(\lambda) + G_w(\lambda){\mathbf{w}}(\lambda) \end{equation} and the reference model \texttt{SYSR} has the input-output form \begin{equation}\label{emmsyn:systemw2} {\mathbf{y}}_r(\lambda) = M_{ru}(\lambda){\mathbf{u}}(\lambda) + M_{rd}(\lambda){\mathbf{d}}(\lambda) + M_{rf}(\lambda){\mathbf{f}}(\lambda) + M_{rw}(\lambda){\mathbf{w}}(\lambda) , \end{equation} where the vectors $y$, $u$, $d$, $f$, $w$ and $y_r$ have dimensions $p$, $m_u$, $m_d$, $m_f$, $m_w$ and $q$, respectively. The resulting fault detection filter in (\ref{emmsyn:detss}) has the input-output form \begin{equation}\label{emmsyn:detio} {\mathbf{r}}(\lambda) = Q(\lambda)\left [ \begin{array}{c} {\mathbf{y}}(\lambda)\\{\mathbf{u}}(\lambda)\end{array} \right ] , \end{equation} where the resulting dimension of the residual vector $r$ is $q$. The function \texttt{\bfseries emmsyn} determines $Q(\lambda)$ by solving the general exact model-matching problem \begin{equation}\label{gemmp} {\arraycolsep=1mm Q(\lambda) \left [ \begin{array}{c|c|c|c} G_u(\lambda) & G_d(\lambda) & G_f(\lambda) & G_w(\lambda) \\ I_{m_u} & 0 & 0 & 0 \end{array} \right ] } = M(\lambda) \big[\, M_{ru}(\lambda)\mid M_{rd}(\lambda) \mid M_{rf}(\lambda) \mid M_{rw}(\lambda)\,\big] \, , \end{equation} where $M(\lambda)$ is a stable, diagonal and invertible transfer function matrix chosen such that the resulting solution $Q(\lambda)$ of the linear rational matrix equation (\ref{gemmp}) is stable and proper. The resulting internal form $R(\lambda)$, contained in \texttt{R}, is computed as \begin{equation}\label{Rtilde} R(\lambda) := \big[\, R_u(\lambda)\!\mid\! R_d(\lambda) \!\mid\! R_f(\lambda) \!\mid\! R_w(\lambda)\,\big] := M(\lambda) \big[\, M_{ru}(\lambda)\!\mid\! M_{rd}(\lambda) \!\mid\! M_{rf}(\lambda) \!\mid\! M_{rw}(\lambda)\,\big].\end{equation} Two cases are separately addressed, depending on the presence or absence of $M_{rw}(\lambda)$ in the reference model (\ref{emmsyn:systemw2}). In the first case, when $M_{rw}(\lambda)$ is present, the general EMMP (\ref{gemmp}) is solved, with $M_{ru}(\lambda)$, or $M_{rd}(\lambda)$, or both of them, explicitly set to zero if not present in the reference model. In the second case, when $M_{rw}(\lambda)$ is not present, then $Q(\lambda)$ is determined by solving the EMMP \begin{equation}\label{gemmp1} {\arraycolsep=1mm Q(\lambda) \left [ \begin{array}{c|c|c} G_u(\lambda) & G_d(\lambda) & G_f(\lambda) \\ I_{m_u} & 0 & 0 \end{array} \right ] } = M(\lambda) \big[\, M_{ru}(\lambda)\mid M_{rd}(\lambda) \mid M_{rf}(\lambda)\,\big] \end{equation} with $M_{ru}(\lambda)$, or $M_{rd}(\lambda)$, or both of them, explicitly set to zero if not present in the reference model. In this case, if $G_w(\lambda)$ is present in the plant model (\ref{emmsyn:systemw1}), then $R_w(\lambda)$ is explicitly computed as \[ R_w(\lambda) = Q(\lambda) \left [ \begin{array}{c}G_w(\lambda) \\ 0 \end{array} \right ] . \] The particular EMMP formulated in Section~\ref{sec:EMMP} corresponds to solve the EMMP (\ref{gemmp1}) with $M_{ru}(\lambda) = 0$, $M_{rd}(\lambda) = 0$. If \texttt{OPTIONS.minimal = true}, then a least order solution $Q(\lambda)$ is determined in the form $Q(\lambda) = Q_2(\lambda)Q_1(\lambda)$, where $Q_1(\lambda)$ is a least McMillan degree solution of the linear rational matrix equation \begin{equation}\label{emmp-direct} {\arraycolsep=1mm Q_1(\lambda) \left [ \begin{array}{c|c|c|c} G_u(\lambda) & G_d(\lambda) & G_f(\lambda) & G_w(\lambda) \\ I_{m_u} & 0 & 0 & 0 \end{array} \right ] } = \big[\, M_{ru}(\lambda)\mid M_{rd}(\lambda) \mid M_{rf}(\lambda) \mid M_{rw}(\lambda)\,\big] \end{equation} and the diagonal updating factor $Q_2(\lambda) := M(\lambda)$ is determined to ensure that $Q(\lambda)$ is proper and stable. If \texttt{OPTIONS.minimal = false} and either $M_{ru}(\lambda)$ or $M_{rd}(\lambda)$, or both, are present in the reference model (\ref{emmsyn:systemw2}), then $Q(\lambda)$ is determined in the form $Q(\lambda) = Q_2(\lambda)Q_1(\lambda)$, where $Q_1(\lambda)$ is a particular solution of the linear rational equation (\ref{emmp-direct}) and the diagonal updating factor $Q_2(\lambda) := M(\lambda)$ is determined to ensure that $Q(\lambda)$ is proper and stable. If \texttt{OPTIONS.minimal = false} and if both $M_{ru}(\lambda)$ and $M_{rd}(\lambda)$ are absent in the reference model (\ref{emmsyn:systemw2}), then the nullspace method is employed as the first computational step of solving the EMMP (see \textbf{Procedure EMM} in \cite{Varg17}). The strong EFDIP arises if additionally $M_{rf}(\lambda)$ is diagonal and invertible, in which case, an extension of the \textbf{Procedure EMMS} in \cite{Varg17} is employed. In fact, this procedure works for arbitrary invertible $M_{rf}(\lambda)$ and this case was considered for the implementation of \texttt{\bfseries emmsyn}. The solution of a fault estimation problem can be targeted by choosing $M_{rf}(\lambda) = I_{m_f}$ and checking that the resulting $M(\lambda) = I_{m_f}$. Recall that $M(\lambda)$ is provided in \texttt{INFO.M}. In what follows, we give some details of the implemented synthesis approach employed if $M_{ru}(\lambda)$, $M_{rd}(\lambda)$ and $M_{rw}(\lambda)$ are not present in reference model. If \texttt{OPTIONS.regmin = false}, then $Q(\lambda)$ is determined in the form \[ Q(\lambda)= M(\lambda)Q_2(\lambda)HN_l(\lambda), \] where: $N_l(\lambda)$ is a $\big(p-r_d\big) \times (p+m_u)$ rational left nullspace basis satisfying \[ N_l(\lambda)\left [ \begin{array}{cc} G_u(\lambda) & G_d(\lambda)\\ I_{m_u} & 0 \end{array} \right ] = 0 , \] with $r_d := \text{rank}\, G_d(\lambda)$; $H$ is a suitable full row rank design matrix used to build $q$ linear combinations of the $p-r_d$ left nullspace basis vectors ($q$ is the number of outputs of \texttt{SYSR}); $Q_2(\lambda)$ is the solution of $Q_2(\lambda) H\overline G_f(\lambda) = M_{rf}(\lambda)$, where \[ \overline G_f(\lambda) = N_l(\lambda) \left [ \begin{array}{c} G_f(\lambda) \\ 0 \end{array} \right ] ; \] and $M(\lambda)$ is a stable invertible transfer function matrix determined such that $Q(\lambda)$ and the corresponding $\widetilde R(\lambda)$ in (\ref{Rtilde}) have desired dynamics (specified via \texttt{OPTIONS.sdeg} and \texttt{OPTIONS.poles}). The internal form of the filter $Q(\lambda)$ is obtained as \[ R(\lambda) = M(\lambda)Q_2(\lambda)H \overline G(\lambda), \] where \[ \overline G(\lambda) := \big[\, \overline G_f(\lambda) \mid \overline G_w(\lambda) \,\big] = N_l(\lambda) \left [ \begin{array}{c|c} G_f(\lambda) & G_w(\lambda) \\ 0 & 0 \end{array} \right ] \, . \] The solvability condition of the strong EFDIP is verified by checking the left invertibility condition \begin{equation}\label{leftinv} \mathop{\mathrm{rank}} H\overline G_{f}(\lambda_s) = m_f , \end{equation} where $\lambda_s$ is a suitable frequency value, which can be specified via the \texttt{OPTIONS.freq}. The design parameter matrix $H$ is set as follows: if \texttt{OPTIONS.HDesign} is nonempty, then $H = \texttt{OPTIONS.HDesign}$; if \texttt{OPTIONS.HDesign = [ ]}, then $H = I_{p-r_d}$, if $q = p-r_d$, or $H$ is a randomly generated $q \times \big(p-r_d\big)$ real matrix, if $q < p-r_d$. If \texttt{OPTIONS.simple = true}, then $N_l(\lambda)$ is determined as a simple rational basis. The orders of the basis vectors are provided in \texttt{INFO.degs}. These are also the degrees of the basis vectors of an equivalent polynomial nullspace basis. If \texttt{OPTIONS.regmin = true}, then $[\, Q(\lambda) \; R_f(\lambda)\,]$ has the least McMillan degree, with $Q(\lambda)$ having $q$ outputs. $Q(\lambda)$ and $R_f(\lambda)$ are determined in the form \[ [\, Q(\lambda) \mid R_f(\lambda)\,] = M(\lambda) Q_2(\lambda)\big[\, \overline Q(\lambda) \mid \overline R_f(\lambda)\,\big] \, , \] where \[ \big[\, \overline Q(\lambda) \mid \overline R_f(\lambda)\,\big] = H \big[\, N_l(\lambda) \mid \overline G_f(\lambda)\,\big] + Y(\lambda)\big[\, N_l(\lambda) \mid \overline G_f(\lambda)\,\big] \] with $[\, \overline Q(\lambda) \; \overline R_f(\lambda)\,]$ and $Y(\lambda)$ the least order solution of a left minimal cover problem \cite{Varg17g}; $Q_2(\lambda)$ is the solution of $Q_2(\lambda) \overline R_f(\lambda) = M_{rf}(\lambda)$; and $M(\lambda)$ is a stable invertible transfer function matrix determined such that $[\, Q(\lambda) \; R(\lambda)\,]$ has a desired dynamics. If \texttt{OPTIONS.HDesign} is nonempty, then $H = \texttt{OPTIONS.HDesign}$, and if \texttt{OPTIONS.HDesign = [ ]}, then a suitable randomly generated $H$ is employed, which fulfills the left invertibility condition (\ref{leftinv}). The actually employed design matrix $H$ is provided in \texttt{INFO.HDesign}, and \texttt{INFO.HDesign = [ ]} if the solution of the EMMP is obtained by directly solving (\ref{gemmp}). \subsubsection*{Examples} \begin{example}\label{ex:5.12} This is \emph{Example} 5.12 from the book \cite{Varg17} and was used in \emph{Example}~\ref{ex:Ex5.10}, to solve an EFDIP for a system with triplex sensor redundancy. To solve the same problem by solving an EMMP, we use the resulting $R_f(s)$ to define the reference model \[ M_{rf}(s) := R_f(s) = \left [ \begin{array}{rrr} 0 & 1 & -1\\ -1 & 0 & 1 \\ 1 & -1 & 0 \end{array} \right ] \, .\] The resulting least order filter $Q(s)$, determined by employing \texttt{\bfseries emmsyn} with \textbf{Procedure EMM}, has the generic form \[ Q(s) = \left [ \begin{array}{rrrccc} 0 & 1 & -1 & 0 & \cdots & 0\\-1 & 0 & 1 & 0 & \cdots & 0\\1 & -1 & 0 & 0& \cdots & 0\end{array} \right ] \, .\] \begin{verbatim} p = 3; mf = 3; rng('default') nu = floor(1+4*rand); mu = floor(1+4*rand); nd = floor(1+4*rand); md = floor(1+4*rand); Gu = ones(3,1)*rss(nu,1,mu); Gd = ones(3,1)*rss(nd,1,md); sysf = fdimodset([Gu Gd],struct('c',1:mu,'d',mu+(1:md),'fs',1:3)); Mr = fdimodset(ss([ 0 1 -1; -1 0 1; 1 -1 0]),struct('f',1:mf)); [Q,R,info] = emmsyn(sysf,Mr); FSCOND = fdifscond(R,0,fdisspec(Mr)) Ge = [sysf; eye(mu,mu+md+mf)]; Me = [zeros(p,mu+md) Mr]; norm(gminreal(Q*Ge)-info.M*Me,inf) norm(R-info.M*Mr,inf) \end{verbatim} \end{example} \begin{example}\label{ex:5.13} This is \emph{Exampl}e 5.13 from the book \cite{Varg17}, with a continuous-time system with additive actuator faults, having the transfer-function matrices \[ G_u(s) = \left[\begin{array}{cc} \displaystyle\frac{s}{s^2 + 3\, s + 2} & \displaystyle\frac{1}{s + 2}\\ \\[-2mm] \displaystyle\frac{s}{s + 1} & 0\\ \\[-2mm]0 & \displaystyle\frac{1}{s + 2} \end{array}\right] , \quad G_d(s) = 0, \quad G_f(s) = G_u(s), \quad G_w(s) = 0 \, . \] We want to solve an EMMP with the reference model \[ M_{rf}(s) = {\arraycolsep=2mm\left [ \begin{array}{cc} 1 & 0\\0 & 1 \end{array} \right ]} \, ,\] which is equivalent to solve a strong EFDIP with the structure matrix \[ S_{FDI} = {\arraycolsep=2mm\left [ \begin{array}{cc} 1 & 0\\0 & 1 \end{array} \right ]} .\] A least order stable filter $Q(s)$, with poles assigned to $-1$, has been determined by employing \texttt{\bfseries emmsyn} with \textbf{Procedure EMMS} of \cite{Varg17} (which is employed if \texttt{OPTIONS.minimal = false}). The resulting $Q(s)$ is \[ Q(s) = {\arraycolsep=2mm\left [ \begin{array}{ccccc} 0 & 1 & 0 & -\displaystyle\frac{s}{s+1} & 0 \\ 0 & 0 & \displaystyle\frac{s+2}{s+1} & 0 & -\displaystyle\frac{1}{s+1} \end{array} \right ]} \] and has the McMillan degree equal to 2. The resulting updating factor is \[ M(s) = \left [ \begin{array}{cc} \displaystyle\frac{s}{s+1} & 0 \\ 0 & \displaystyle\frac{1}{s+1} \end{array} \right ] \] and has McMillan degree 2. The presence of the zero at $s = 0$ in $R(s) := M(s)M_r(s)$ is unavoidable for the existence of a stable solution. It follows, that while a constant actuator fault $f_2$ is strongly detectable, a constant actuator fault $f_1$ is only detectable during transients. \begin{verbatim} s = tf('s'); Gu = [s/(s^2+3*s+2) 1/(s+2); s/(s+1) 0; 0 1/(s+2)]; [p,mu] = size(Gu); mf = mu; sysf = fdimodset(ss(Gu),struct('c',1:mu,'f',1:mu)); Mr = fdimodset(ss(eye(2)),struct('f',1:mf)); opts_emmsyn = struct('tol',1.e-7,'sdeg',-1,'minimal',false); [Q,R,info] = emmsyn(sysf,Mr,opts_emmsyn); G = [sysf;eye(mu,mu+mf)]; norm(Q*G-info.M*[zeros(mf,mu) Mr],inf) minreal(tf(Q)), tf(info.M) \end{verbatim} \end{example} \subsubsection{\texttt{\bfseries ammsyn}} \index{M-functions!\texttt{\bfseries ammsyn}} \index{model-matching problem!approximate (AMMP)} \subsubsection*{Syntax} \begin{verbatim} [Q,R,INFO] = ammsyn(SYSF,SYSR,OPTIONS) \end{verbatim} \subsubsection*{Description} \texttt{\bfseries ammsyn} solves the \emph{approximate model matching problem} (AMMP); (see Section \ref{sec:AMMP}), for a given LTI system \texttt{SYSF} with additive faults and a given stable reference filter \texttt{SYSR}. Two stable and proper filters, \texttt{Q} and \texttt{R}, are computed, where \texttt{Q} contains the fault detection and isolation filter representing the solution of the AMMP, and \texttt{R} contains its internal form. \subsubsection*{Input data} \begin{description} \item \texttt{SYSF} is a LTI system in the state-space form \begin{equation}\label{ammsyn:sysss} {\begin{aligned} E\lambda x(t) & = Ax(t)+ B_u u(t)+ B_d d(t) + B_f f(t)+ B_w w(t) , \\ y(t) & = C x(t) + D_u u(t)+ D_d d(t) + D_f f(t) + D_w w(t) , \end{aligned}} \end{equation} where any of the inputs components $u(t)$, $d(t)$, $f(t)$ or $w(t)$ can be void. For the system \texttt{SYSF}, the input groups for $u(t)$, $d(t)$, $f(t)$, and $w(t)$ must have the standard names \texttt{\bfseries 'controls'}, \texttt{\bfseries 'disturbances'}, \texttt{\bfseries 'faults'}, and \texttt{\bfseries 'noise'}, respectively. \item \texttt{SYSR} is a proper and stable LTI system in the state-space form \begin{equation}\label{ammsyn:sysrss} {\begin{aligned} \lambda x_r(t) & = A_rx_r(t)+ B_{ru} u(t)+ B_{rd} d(t) + B_{rf} f(t)+ B_{rw} w(t) , \\ y_r(t) & = C_r x_r(t) + D_{ru} u(t)+ D_{rd} d(t) + D_{rf} f(t) + D_{rw} w(t) , \end{aligned}} \end{equation} where the reference model output $y_r(t)$ is a $q$-dimensional vector and any of the inputs components $u(t)$, $d(t)$, $f(t)$, or $w(t)$ can be void. For the system \texttt{SYSR}, the input groups for $u(t)$, $d(t)$, $f(t)$, and $w(t)$ must have the standard names \texttt{\bfseries 'controls'}, \texttt{\bfseries 'disturbances'}, \texttt{\bfseries 'faults'}, and \texttt{\bfseries 'noise'}, respectively. \item \texttt{OPTIONS} is a MATLAB structure used to specify various synthesis options and has the following fields: {\setlength\LTleft{30pt}\begin{longtable}{|l|p{11.6cm}|} \hline \textbf{\texttt{OPTIONS} fields} & \textbf{Description} \\ \hline \texttt{tol} & relative tolerance for rank computations \newline (Default: internally computed)\\ \hline \texttt{tolmin} & absolute tolerance for observability tests \newline (Default: internally computed)\\ \hline \texttt{smarg} & stability margin for the poles of the updating factor $M(\lambda)$ (see \textbf{Method})\\ & (Default: \texttt{-sqrt(eps)} for a continuous-time system \texttt{SYSF}; \\ & \hspace*{4.5em}\texttt{1-sqrt(eps)} for a discrete-time system \texttt{SYSF}).\\ \hline \texttt{sdeg} & prescribed stability degree for the poles of the updating factor $M(\lambda)$ (see \textbf{Method})\\ & (Default: $-0.05$ for a continuous-time system \texttt{SYSF}; \\ & \hspace*{4.8em} $0.95$ for a discrete-time system \texttt{SYSF}).\\ \hline \texttt{poles} & complex vector containing a complex conjugate set of desired poles (within the stability domain) to be assigned for the updating factor $M(\lambda)$ (see \textbf{Method}) (Default: \texttt{[ ]}) \\\hline \texttt{nullspace} & option to use a specific proper nullspace basis to be employed in the nullspace-based synthesis step\\ & \hspace*{-.9mm}{\tabcolsep=0.7mm\begin{tabular}[t]{lcp{10cm}} \texttt{true } &--& use a minimal proper basis (default); \\ \texttt{false} &--& use a full-order observer based basis (see \textbf{Method}). \newline \emph{Note:} This option can only be used if no disturbance inputs are present in (\ref{ammsyn:sysss}) and $E$ is invertible. \end{tabular}} \\ \hline \texttt{simple} & option to employ a simple proper basis for the nullspace-based synthesis \\ & \texttt{true } -- use a simple basis; \\ & \texttt{false} -- use a non-simple basis (default)\\\hline \texttt{mindeg} &option to compute a minimum degree solution\\ & \hspace*{-.9mm}{\tabcolsep=0.7mm\begin{tabular}[t]{lcp{10cm}} \texttt{true} &--& determine, if possible, a minimum order stable solution \\ \texttt{false} &--& determine a particular stable solution which has possibly non-minimal (default). \end{tabular}} \\ \hline \texttt{regmin} & regularization option with least order left annihilator selection \\ & \texttt{true } -- perform least order selection (default); \\ & \texttt{false} -- no least order selection to be performed \\\hline \texttt{tcond} & maximum allowed condition number of the employed non-orthogonal transformations (Default: $10^4$).\\ \hline \texttt{normalize} & option for the normalization of the diagonal elements of the updating matrix $M(\lambda)$ (see \textbf{Method}):\\ & {\tabcolsep=1mm\begin{tabular}{llp{9.5cm}}\hspace*{-1.5mm}\texttt{'gain'}&--& scale with the gains of the zero-pole-gain \newline representation (default) \\ \hspace*{-1.5mm}\texttt{'dcgain'}&--& scale with the DC-gains \\ \hspace*{-1.5mm}\texttt{'infnorm'}&--& scale with the values of infinity-norms \end{tabular}} \\ \hline \texttt{freq} & complex frequency value to be employed to check frequency response based (admissibility) rank conditions (see \textbf{Method}) \newline (Default:\texttt{[ ]}, i.e., a randomly generated frequency). \\ \hline \texttt{HDesign} & full row rank design matrix $H$ employed for the synthesis of the filter \texttt{Q} (see \textbf{Method}) (Default: \texttt{[ ]}) \\ \hline \texttt{H2syn} & option to perform a $\mathcal{H}_2$-norm based synthesis \\ & \texttt{true } -- perform a $\mathcal{H}_2$-norm based synthesis; \\ & \texttt{false} -- perform a $\mathcal{H}_\infty$-norm based synthesis (default). \\\hline \end{longtable}} \end{description} \subsubsection*{Output data} \begin{description} \item \texttt{Q} is the resulting fault detection filter in a standard state-space representation \begin{equation}\label{ammsyn:detss} {\begin{aligned} \lambda x_Q(t) & = A_Qx_Q(t)+ B_{Q_y}y(t)+ B_{Q_u}u(t) ,\\ r(t) & = C_Q x_Q(t) + D_{Q_y}y(t)+ D_{Q_u}u(t) , \end{aligned}} \end{equation} where the residual signal $r(t)$ is a $q$-dimensional vector. For the system object \texttt{Q}, two input groups \texttt{\bfseries 'outputs'} and \texttt{\bfseries 'controls'} are defined for $y(t)$ and $u(t)$, respectively, and the output group \texttt{\bfseries 'residuals'} is defined for the residual signal $r(t)$. \item \texttt{R} is the resulting internal form of the fault detection filter in a standard state-space representation \begin{equation}\label{ammsyn:detinss} {\begin{aligned} \lambda x_R(t) & = A_Rx_R(t)+ B_{R_u}u(t)+B_{R_d}d(t)+B_{R_f}f(t)+ B_{R_w}w(t) ,\\ r(t) & = C_Rx_R(t)+ D_{R_u}u(t)+D_{R_d}d(t)+D_{R_f}f(t)+ D_{R_w}w(t) \end{aligned}} \end{equation} with the same input groups defined as for \texttt{SYSR} and the output group \texttt{\bfseries 'residuals'} defined for the residual signal $r(t)$. \item \texttt{INFO} is a MATLAB structure containing additional information as follows: \begin{center} \begin{longtable}{|l|p{12cm}|} \hline \textbf{\texttt{INFO} fields} & \textbf{Description} \\ \hline \texttt{tcond} & the maximum of the condition numbers of the employed non-orthogonal transformation matrices; a warning is issued if \texttt{INFO.tcond} $\geq$ \texttt{OPTIONS.tcond}.\\ \hline \texttt{degs} & the left Kronecker indices of $G(\lambda) := \left[\begin{smallmatrix} G_u(\lambda) & G_u(\lambda) \\ I & 0\end{smallmatrix}\right]$ (see \textbf{Metho}d); also, if \texttt{OPTIONS.simple} = \texttt{true}, the orders of the basis vectors of the employed simple nullspace basis, or if \texttt{OPTIONS.simple} = \texttt{false}, the degrees of the basis vectors of an equivalent polynomial nullspace basis. \texttt{INFO.degs = [ ]} if no strong FDI or fault detection oriented synthesis is performed. \\ \hline \texttt{M} & state-space realization of the employed updating matrix $M(\lambda)$ (see \textbf{Method}) \\ \hline \texttt{freq} & complex frequency value employed to check frequency response based (admissibility) rank conditions \\ \hline \texttt{HDesign} & design matrix $H$ employed for the synthesis of the fault detection filter; \texttt{INFO.HDesign = [ ]} if no design matrix was explicitly involved in the filter synthesis. \\ \hline \texttt{nonstandard} & logical value, which is set to \texttt{true} for a \emph{non-standard problem} (when $G_e(\lambda)$ in (\ref{ammsyn:Ge}) has zeros in $\partial\mathds{C}_s$), and to \texttt{false} for a \emph{standard problem} (when $G_e(\lambda)$ in (\ref{ammsyn:Ge}) has no zeros in $\partial\mathds{C}_s$) (see \textbf{Method}). \\ \hline \texttt{gammaopt0} & resulting optimal model-matching performance value $\gamma_{opt,0}$ in (\ref{ammsyn:opthinf2}) (see \textbf{Method}). \\ \hline \texttt{gammaopt} & resulting optimal model-matching performance value $\gamma_{opt,0}$ in (\ref{ammsyn:opthinf2}), in the \emph{standard case}, and $\gamma_{opt}$ in (\ref{ammsyn:modopthinf2}) in the \emph{non-standard case} (see \textbf{Method}). \\ \hline \texttt{gammasub} & resulting suboptimal model-matching performance value $\gamma_{sub}$ in (\ref{ammsyn:subopthinf2}) (see \textbf{Method}). \\ \hline \end{longtable} \end{center} \end{description} \subsubsection*{Method} The function \texttt{\bfseries ammsyn} implements the \textbf{Procedure AMMS} from \cite[Sect.\ 5.7]{Varg17}, which relies on the approximate model-matching synthesis methods proposed in \cite{Varg11} (see also \cite{Varg12d} for more computational details). This procedure is primarily intended to approximately solve the particular (but more practice relevant) strong fault detection and isolation problem, which is addressed in the standard formulation of the AMMP in Section \ref{sec:AMMP}. However, the function \texttt{\bfseries ammsyn} is also able to address the more general case of AMMP with an arbitrary stable reference model (see Remark \ref{rem:gamm} in Section \ref{sec:AMMP}). Therefore, in what follows, we consider the solution of the AMMP in this more general problem setting. Assume that the system \texttt{SYSF} has the input-output form \begin{equation}\label{ammsyn:systemw1} {\mathbf{y}}(\lambda) = G_u(\lambda){\mathbf{u}}(\lambda) + G_d(\lambda){\mathbf{d}}(\lambda) + G_f(\lambda){\mathbf{f}}(\lambda) + G_w(\lambda){\mathbf{w}}(\lambda) \end{equation} and the reference model \texttt{SYSR} has the input-output form \begin{equation}\label{ammsyn:systemw2} {\mathbf{y}}_r(\lambda) = M_{ru}(\lambda){\mathbf{u}}(\lambda) + M_{rd}(\lambda){\mathbf{d}}(\lambda) + M_{rf}(\lambda){\mathbf{f}}(\lambda) + M_{rw}(\lambda){\mathbf{w}}(\lambda) , \end{equation} where the vectors $y$, $u$, $d$, $f$, $w$ and $y_r$ have dimensions $p$, $m_u$, $m_d$, $m_f$, $m_w$ and $q$, respectively. Furthermore, we assume that $M_r(\lambda) := \big[\, M_{ru}(\lambda)\; M_{rd}(\lambda) \; M_{rf}(\lambda) \; M_{rw}(\lambda)\,\big] $ is stable. The resulting fault detection filter in (\ref{ammsyn:detss}) has the input-output form \begin{equation}\label{ammsyn:detio} {\mathbf{r}}(\lambda) = Q(\lambda)\left [ \begin{array}{c} {\mathbf{y}}(\lambda)\\{\mathbf{u}}(\lambda)\end{array} \right ] , \end{equation} where the resulting dimension of the residual vector $r$ is $q$. The function \texttt{\bfseries ammsyn} determines $Q(\lambda)$ by solving the approximate model-matching problem \begin{equation}\label{agemmp} Q(\lambda) G_e(\lambda) \approx M(\lambda) M_r(\lambda \, , \end{equation} where \begin{equation}\label{ammsyn:Ge} G_e(\lambda) := \left [ \begin{array}{c|c|c|c} G_u(\lambda) & G_d(\lambda) & G_f(\lambda) & G_w(\lambda) \\ I_{m_u} & 0 & 0 & 0 \end{array} \right ] , \end{equation} $M(\lambda)$ is a stable, diagonal and invertible transfer function matrix chosen such that the resulting approximate solution $Q(\lambda)$ of (\ref{agemmp}) is stable and proper. The resulting internal form $R(\lambda)$, contained in \texttt{R}, is computed as \begin{equation}\label{ammsyn:Rtilde} R(\lambda) := \big[\, R_u(\lambda)\!\mid\! R_d(\lambda) \!\mid\! R_f(\lambda) \!\mid\! R_w(\lambda)\,\big] := Q(\lambda) G_e(\lambda) .\end{equation} \index{performance evaluation!fault detection and isolation!model-matching performance} In the \emph{standard case}, $G_e(\lambda)$ has no zeros on the boundary of the stability domain $\partial\mathds{C}_s$, and the resulting stable filter $Q(\lambda) = Q_{opt}(\lambda)$, is the optimal solution of the $\mathcal{H}_\infty$- or $\mathcal{H}_2$-norm error minimization problem \begin{equation}\label{ammsyn:opthinf2} \gamma_{opt,0} := \|Q_{opt}(\lambda)G_e(\lambda)-M_0(\lambda)M_r(\lambda)\|_{\infty/2} = \min ,\end{equation} where $M_0(\lambda) = I$ in the case of $\mathcal{H}_\infty$-norm or of a discrete-time system. In the case of $\mathcal{H}_2$-norm and a continuous-time system, $M_0(s)$ is determined as a stable, diagonal, and invertible transfer function matrix, which ensures the existence of a finite $\mathcal{H}_2$-norm. In the \emph{non-standard case}, $G_e(\lambda)$ has zeros on the boundary of the stability domain $\partial\mathds{C}_s$, and the optimal solution $Q_{opt}(\lambda)$ of (\ref{ammsyn:opthinf2}) is possibly unstable or improper. In this case, $Q(\lambda)$ is chosen as $Q(\lambda) = M_1(\lambda)Q_{opt}(\lambda)$, with $M_1(\lambda)$ a stable, diagonal, and invertible transfer function matrix determined to ensure the stability of $Q(\lambda)$. In this case, $Q(\lambda)$ can be interpreted as a suboptimal solution of the updated $\mathcal{H}_\infty$- or $\mathcal{H}_2$-norm error minimization problem \begin{equation}\label{ammsyn:modopthinf2} \gamma_{opt} := \|\widetilde Q_{opt}(\lambda)G_e(\lambda) - M_1(\lambda)M_0(\lambda)M_r(\lambda)\|_{\infty/2} = \min ,\end{equation} whose optimal solution $\widetilde Q_{opt}(\lambda)$ is possibly unstable or improper, but for which $Q(\lambda)$ represents a stable and proper solution with the corresponding suboptimal model-matching error norm \begin{equation}\label{ammsyn:subopthinf2} \gamma_{sub} := \|Q(\lambda)G_e(\lambda) - M_1(\lambda)M_0(\lambda)M_r(\lambda)\|_{\infty/2} . \end{equation} The value of $\gamma_{opt,0}$ in (\ref{ammsyn:opthinf2}) is returned in \texttt{INFO.gammaopt0}, and also in \texttt{INFO.gammaopt} and \texttt{INFO.gammasub} in the \emph{standard case}. In the \emph{non-standard case}, the value $\gamma_{opt}$ in (\ref{ammsyn:modopthinf2}) is returned in \texttt{INFO.gammaopt} and the value of $\gamma_{sub}$ in (\ref{ammsyn:subopthinf2}) is returned in \texttt{INFO.gammasub}. The updating matrix $M(\lambda) := M_0(\lambda)$, in the \emph{standard case}, or $M(\lambda) := M_1(\lambda)M_0(\lambda)$, in the \emph{non-standard case}, is returned in \texttt{INFO.M}. Two cases are separately addressed in what follows, depending on the presence or absence of the terms $M_{ru}(\lambda)$, $M_{rd}(\lambda)$ and $M_{rw}(\lambda)$ in the reference model (\ref{emmsyn:systemw2}). In the first case, we consider the standard formulation of the AMMP of Section \ref{sec:AMMP}, with $M_{ru}(\lambda)=0$, $M_{rd}(\lambda)=0$ and $M_{rw}(\lambda)=0$, and with $M_{rf}(\lambda)$ having all its columns nonzero (to enforce complete fault detectability). If $M_{rf}(\lambda)$ is invertible, we target the solution of a \emph{strong fault detection and isolation} (\emph{strong} FDI) problem. Additionally, we assume that $q \leq p-r_d$, where $r_d := \text{rank}\, G_d(\lambda)$. The second case, covers the rest of situations and is discussed separately. To compute the solution $Q(\lambda)$ for the standard formulation of the AMMP, we employ a slight extension of the synthesis method which underlies \textbf{Procedure AMMD} in \cite{Varg17}. This procedure essentially determines the filter $Q(\lambda)$ as a stable rational left annihilator of \begin{equation}\label{ammsyn:gtfm} G(\lambda) := \left [ \begin{array}{cc} G_u(\lambda) & G_d(\lambda) \\ I_{m_u} & 0 \end{array} \right ] ,\end{equation} such that $Q(\lambda)$ also simultaneously solves the approximate model-matching problem \begin{equation}\label{ammsyn:gemmp} {\arraycolsep=1mm Q(\lambda) \left [ \begin{array}{c|c} G_f(\lambda) & G_w(\lambda) \\ 0 & 0 \end{array} \right ] } \approx M(\lambda) \big[\, M_{rf}(\lambda) \mid 0 \,\big] \, , \end{equation} where $M(\lambda)$ is a stable, diagonal and invertible transfer function matrix chosen such that the resulting solution $Q(\lambda)$ is stable and proper. The resulting internal form $R(\lambda)$, contained in \texttt{R}, is computed as \begin{equation}\label{ammsyn:R} R(\lambda) = [\, R_f(\lambda) \mid R_w(\lambda) \,] := Q(\lambda) \left [ \begin{array}{c|c} G_f(\lambda) & G_w(\lambda) \\ 0 & 0 \end{array} \right ] .\end{equation} If \texttt{OPTIONS.H2syn = false}, then a $\mathcal{H}_\infty$-norm based synthesis is performed by determining $Q(\lambda)$ and $M(\lambda)$ such that $\|\mathcal{E}(\lambda)\|_\infty$ is minimized, where \begin{equation}\label{ammsyn:Rez} \mathcal{E}(\lambda) = [\, R_f(\lambda) \mid R_w(\lambda) \,] - M(\lambda) \big[\, M_{rf}(\lambda) \mid 0 \,\big] .\end{equation} If \texttt{OPTIONS.H2syn = true}, then a $\mathcal{H}_2$-norm based synthesis is performed by determining $Q(\lambda)$ and $M(\lambda)$ such that $\|\mathcal{E}(\lambda)\|_2$ is minimized. The filter $Q(\lambda)$ is determined in the product form \begin{equation}\label{ammsym:Qprod} Q(\lambda) = Q_5(\lambda)Q_4(\lambda)Q_3(\lambda)Q_2(\lambda)Q_1(\lambda) , \end{equation} where the factors are determined as follows: \begin{itemize} \item[(a)] $Q_1(\lambda) = N_l(\lambda)$, with $N_l(\lambda)$ a $\big(p-r_d\big) \times (p+m_u)$ proper rational left nullspace basis satisfying $N_l(\lambda)G(\lambda) = 0$ (recall that $r_d := \text{rank}\, G_d(\lambda)$); \item[(b)] $Q_2(\lambda)$ is a $q\times (p-r_d)$ admissible regularization factor guaranteeing complete fault detectability or strong fault isolability; \item[(c)] $Q_3(\lambda)$ is the inverse or left inverse of a quasi-co-outer factor; \item[(d)] $Q_4(\lambda)$ is the solution of a least distance problem (LDP); \item[(e)] $Q_5(\lambda)$ is a stable invertible factor determined such that $Q(\lambda)$ has a desired dynamics. \end{itemize} The computations of individual factors depend on the user's options and specific choices are discussed in what follows. \subsubsection*{Computation of $Q_1(\lambda)$} If \texttt{OPTIONS.nullspace = true} or $m_d > 0$ or $E$ is singular, then $N_l(\lambda)$ is determined as a minimal proper nullspace basis. In this case, if \texttt{OPTIONS.simple = true}, then $N_l(\lambda)$ is determined as a simple rational basis and the orders of the basis vectors are provided in \texttt{INFO.degs}. If \texttt{OPTIONS.simple = false}, then $N_l(\lambda)$ is determined as a proper rational basis and \texttt{INFO.degs} contains the degrees of the basis vectors of an equivalent polynomial nullspace basis (see \cite[Section 9.1.3]{Varg17} for definitions). If \texttt{OPTIONS.nullspace = false}, $m_d = 0$ and $E$ is invertible, then $N_l(\lambda) = [ \, I_{p} \; -G_u(\lambda)\,]$ is used, which corresponds to a full-order Luenberger observer. To check the solvability of the AMMP, the transfer function matrix $\overline G_f(\lambda) := Q_1(\lambda) \left[\begin{smallmatrix} G_f(\lambda) \\ 0 \end{smallmatrix}\right]$ is determined and let $H$ be a full row rank design matrix, which is either specified in a nonempty \texttt{OPTIONS.HDesign}, or otherwise $H = I_{p-r_d}$ is assumed. The AMMP with complete detectability requirement is solvable provided $H\overline G_f(\lambda_s)$ has all its columns nonzero, where $\lambda_s$ is a suitable frequency value, which can be specified via the \texttt{OPTIONS.freq}. To check the solvability of the AMMP with a strong isolability condition, we check that $H\overline G_f(\lambda)$ has full column rank $m_f$. This rank condition is verified by checking the left invertibility condition \begin{equation}\label{ammsyn:leftinv} \mathop{\mathrm{rank}} H\overline G_{f}(\lambda_s) = m_f . \end{equation} In the case when \texttt{OPTIONS.freq} is empty, the employed frequency value $\lambda_s$ is provided in \texttt{INFO.freq}. \subsubsection*{Computation of $Q_2(\lambda)$} If \texttt{OPTIONS.regmin = false}, then $Q_2(\lambda) = H$, where $H$ is a suitable $q\times \big(p-r_d\big)$ full row rank design matrix. $H$ is set as follows. If \texttt{OPTIONS.HDesign} is nonempty, then $H = \texttt{OPTIONS.HDesign}$. If \texttt{OPTIONS.HDesign} is empty, then the matrix $H$ is chosen such that, either: (1) $H\overline G_f(\lambda)$ is invertible, if the solution of a strong FDI problem is targeted; or (2) $H\overline G_f(\lambda)$ has all its columns nonzero, if the focus is on guaranteeing complete fault detectability. In both cases, $H$ is built from an admissible set of $q$ rows of the identity matrix $I_{p-r_d}$. If \texttt{OPTIONS.regmin = true}, then $Q_2(\lambda)$ is a $q\times \big(p-r_d\big)$ transfer function matrix determined in the form \[ Q_2(\lambda) = H+Y_2(\lambda) \, , \] where $Q_2(\lambda)Q_1(\lambda)$ $\big(\! = HN_l(\lambda)+Y_2(\lambda)N_l(\lambda)\big)$ and $Y_2(\lambda)$ are the least order solution of a left minimal cover problem \cite{Varg17g}. If \texttt{OPTIONS.HDesign} is nonempty, then $H = \texttt{OPTIONS.HDesign}$, and if \texttt{OPTIONS.HDesign} is empty, then $H$ is chosen as above. This choice ensures that either: (1) $Q_2(\lambda)\overline G_f(\lambda)$ is invertible, if a strong FDI problem is solved; or (2) $H\overline G_f(\lambda)$ has all its columns nonzero, if the focus is on guaranteeing complete fault detectability. The structure field \texttt{INFO.HDesign} contains the employed value of the design matrix $H$. \subsubsection*{Computation of $Q_3(\lambda)$} Let $\tilde r$ be the rank of $[\, \widetilde G_f(\lambda) \mid \widetilde G_w(\lambda) \,]:= Q_2(\lambda)[\, \overline G_f(\lambda)\mid \overline G_w(\lambda)\,]$. If a strong FDI problem is solved, then $\tilde r = m_f = q$. The extended quasi-co-outer--co-inner factorization of $[\, \widetilde G_f(\lambda) \; \widetilde G_w(\lambda) \,]$ is computed as \[ [\, \widetilde G_f(\lambda) \; \widetilde G_w(\lambda) \,] = [\, G_{o}(\lambda) \; 0 \, ] \left [ \begin{array}{c} G_{i,1}(\lambda) \\ G_{i,2}(\lambda) \end{array} \right ] ,\] where $G_{o}(\lambda)$ is a $q\times \tilde r$ full column rank quasi-co-outer factor and $G_{i}(\lambda) = \left[\begin{smallmatrix} G_{i,1}(\lambda) \\ G_{i,2}(\lambda) \end{smallmatrix}\right] $ is a square inner factor. Note that the potential lack of stability of $G_{o}(\lambda)$ is not relevant at this stage for the employed solution method. If $\tilde r = q$ then, $Q_3(\lambda) = G_{o}^{-1}(\lambda)$, otherwise $Q_3(\lambda) = G_{o}^{-L}(\lambda)$, with $G_{o}^{-L}(\lambda)$ a left inverse of $G_{o}(\lambda)$, determined such that all its free poles are assigned into the stable domain $\mathds{C}_s$. It follows, that in the \emph{standard case}, when $G_{o}(\lambda)$ has no zeros in $\partial\mathds{C}_s$, $Q_3(\lambda)$ results stable, while in the \emph{non-standard case}, when $G_{o}(\lambda)$ has zeros in $\partial\mathds{C}_s$, $Q_3(\lambda)$ results with poles which are either stable or lie in $\partial \mathds{C}_s$. These latter poles are precisely the unstable zeros of $G_{o}(\lambda)$ in $\partial\mathds{C}_s$. The information on the type of the problem to be solved is returned in \texttt{INFO.nonstandard}, which is set equal to \texttt{false} for a standard problem, and \texttt{true} for a non-standard problem. \subsubsection*{Computation of $Q_4(\lambda)$} With $\widetilde F_1(\lambda) = [\, M_r(\lambda) \; 0\,] G_{i,1}^\sim(\lambda)$ and $\widetilde F_2(\lambda) = [\, M_r(\lambda) \; 0\,] G_{i,2}^\sim(\lambda)$, the $q\times \tilde r$ TFM $Q_4(\lambda)$ is determined as the optimal solution of the $\mathcal{H}_{\infty/2}$ least distance problem ($\mathcal{H}_{\infty/2}$-LDP) \begin{equation}\label{ammsyn:gammaopt} \gamma_{opt} = \min_{Q_4(\lambda) \in \mathcal{H}_\infty} \left\|{\arraycolsep=1mm\left [ \begin{array}{cc} \widetilde F_1 (\lambda)- Q_4(\lambda) & \widetilde F_2(\lambda) \end{array} \right ] } \right\|_{\infty/2}. \end{equation} To ensure the existence of the solution of a $\mathcal{H}_{2}$-LDP in the continuous-time case with $\widetilde F_2(s)$ a non-strictly-proper transfer function matrix, a strictly proper and stable updating factor $\widetilde M(s) = \frac{k}{s+k} I$ is used, to form an updated reference model $\widetilde M(s)M_r(s)$ and the updated $\widetilde F_1(\lambda) = \widetilde M(\lambda)[\, M_r(\lambda) \; 0\,] G_{i,1}^\sim(\lambda)$ and $\widetilde F_2(\lambda) = \widetilde M(\lambda[\, M_r(\lambda) \; 0\,] G_{i,2}^\sim(\lambda)$ are used. $\widetilde M(\lambda) = I$ in all other cases. The value of $\gamma_{opt}$ in (\ref{ammsyn:gammaopt}) is returned in \texttt{INFO.gammaopt}. For a standard $\mathcal{H}_\infty$-norm based synthesis, $\gamma_{opt}$ is the optimal approximation error $\|\mathcal{E}(\lambda)\|_\infty$, while for a non-standard problem this value is the optimal $\mathcal{H}_\infty$ least distance which corresponds to an improper or unstable filter. For a standard $\mathcal{H}_2$-norm based synthesis, $\gamma_{opt}$ is the optimal approximation error $\|\mathcal{E}(\lambda)\|_2$, while for a non-standard problem this value is the optimal $\mathcal{H}_2$ least distance which corresponds to an improper or unstable filter. \subsubsection*{Computation of $Q_5(\lambda)$} In the standard case, $Q_5(\lambda) = I$. In the non-standard case, $Q_5(\lambda)$ is a stable, diagonal and invertible transfer function matrix determined such that $Q(\lambda)$ in (\ref{ammsym:Qprod}) has a desired dynamics (specified via \texttt{OPTIONS.sdeg} and \texttt{OPTIONS.poles}). The overall updating factor used in (\ref{ammsyn:Rez}) is $M(\lambda) = Q_5(\lambda)\widetilde M(\lambda)$ and is provided in \texttt{INFO.M}. In the second case, we solve model-matching problems which differ from the standard formulation of Section \ref{sec:AMMP}, as for example, having $M_{ru}(\lambda)\not=0$, $M_{rd}(\lambda)\not=0$ or $M_{rw}(\lambda)\not=0$, or with a non-square $M_{rf}(\lambda)$, as well as other cases. To address the solution of these problems, we formulate general model-matching problems of the form (\ref{agemmp}) and solve these problems using general solvers as \texttt{glasol}, available in the Descriptor System Tools (DSTOOLS) \cite{Varg17a}. The filter $Q(\lambda)$ is determined in the product form \begin{equation}\label{ammsym:Qprod2} Q(\lambda) = Q_3(\lambda)Q_2(\lambda)Q_1(\lambda) , \end{equation} where the factors are determined as follows: \begin{itemize} \item[(a)] $Q_1(\lambda)$ is a proper rational left nullspace basis satisfying $Q_1(\lambda)\widetilde G(\lambda) = 0$ for a suitably defined $\widetilde G(\lambda)$ (see below); \item[(b)] $Q_2(\lambda)$ is the solution of a reduced or unreduced approximate model-matching problem; \item[(c)] $Q_3(\lambda)$ is a stable invertible factor determined such that $Q(\lambda)$ has a desired dynamics. \end{itemize} The computations of individual factors depend on the user's options and specific choices are discussed in what follows. \subsubsection*{Computation of $Q_1(\lambda)$} Three cases are considered. \begin{itemize} \item[$(i)$] If both $M_{ru}(\lambda)\not=0$ and $M_{rd}(\lambda)\not=0$, then $Q_1(\lambda) = I_{p+m_u}$ and the corresponding reduced system and reference model are $\overline R(\lambda) := G_e(\lambda)$ and $\overline M_r(\lambda) := M_r(\lambda)$. Note that $\widetilde G(\lambda)$ is an $(p+m_u)\times 0$ (empty) matrix. \item[$(ii)$] If $M_{ru}(\lambda)=0$, but $M_{rd}(\lambda)\not=0$, then $Q_1(\lambda)$ is a left proper rational nullspace basis of $\widetilde G(\lambda) := \left[\begin{smallmatrix} G_u(\lambda) \\ I_{m_u} \end{smallmatrix}\right]$. If \texttt{OPTIONS.nullspace = true} or $E$ is singular, then $Q_1(\lambda)$ is determined as a minimal proper nullspace basis. In this case, if \texttt{OPTIONS.simple = true}, then $Q_1(\lambda)$ is determined as a simple rational basis, while if \texttt{OPTIONS.simple = false}, then $Q_1(\lambda)$ is determined as a proper rational basis. The corresponding reduced system and reference model are \[ \overline R(\lambda) := Q_1(\lambda)\left [ \begin{array}{c|c|c} G_d(\lambda) & G_f(\lambda) & G_w(\lambda) \\ 0 & 0 & 0 \end{array} \right ] , \qquad \overline M_r(\lambda) = \big[\, M_{rd}(\lambda) \mid M_{rf}(\lambda) \mid M_{rw}(\lambda)\,\big] .\] If \texttt{OPTIONS.nullspace = false} and $E$ is invertible, then $Q_1(\lambda) = [ \, I_{p} \; -G_u(\lambda)\,]$ is used, which corresponds to a full-order Luenberger observer. The corresponding reduced system and reference model are \[ \overline R(\lambda) := \big[\, G_d(\lambda) \mid G_f(\lambda) \mid G_w(\lambda)\,\big] , \qquad \overline M_r(\lambda) = \big[\, M_{rd}(\lambda) \mid M_{rf}(\lambda) \mid M_{rw}(\lambda)\,\big] .\] \item[$(iii)$] If both $M_{ru}(\lambda)=0$ and $M_{rd}(\lambda)=0$, then $Q_1(\lambda)$ is a left proper rational nullspace basis of $\widetilde G(\lambda) := \left[\begin{smallmatrix} G_u(\lambda) & G_d(\lambda) \\ I_{m_u} & 0 \end{smallmatrix}\right]$. If the resulting nullspace is empty, then the case $(ii)$ can be applied. If \texttt{OPTIONS.nullspace = true} or $m_d > 0$ or $E$ is singular, then $Q_1(\lambda)$ is determined as a minimal proper nullspace basis. In this case, if \texttt{OPTIONS.simple = true}, then $Q_1(\lambda)$ is determined as a simple rational basis and if \texttt{OPTIONS.simple = false}, then $Q_1(\lambda)$ is determined as a proper rational basis. The corresponding reduced system and reference model are \[ \overline R(\lambda) := Q_1(\lambda)\left [ \begin{array}{c|c} G_f(\lambda) & G_w(\lambda) \\ 0 & 0 \end{array} \right ] , \qquad \overline M_r(\lambda) = \big[\, M_{rf}(\lambda) \mid M_{rw}(\lambda)\,\big] .\] If \texttt{OPTIONS.nullspace = false}, $m_d = 0$ and $E$ is invertible, then $Q_1(\lambda) = [ \, I_{p} \; -G_u(\lambda)\,]$ is used, which corresponds to a full-order Luenberger observer. The corresponding reduced system and reference model are \[ \overline R(\lambda) := \big[\, G_f(\lambda) \mid G_w(\lambda)\,\big] , \qquad \overline M_r(\lambda) = \big[\, M_{rf}(\lambda) \mid M_{rw}(\lambda)\,\big] .\] \end{itemize} \subsubsection*{Computation of $Q_2(\lambda)$} $Q_2(\lambda)$ is computed as the optimal solution which minimizes the model-matching error norm such that \begin{equation}\label{ammsym:ammopt} \|Q_2(\lambda)\overline R_1(\lambda) - \overline M_r(\lambda)\|_{\infty/2} = \min .\end{equation} The standard-case corresponds to $\overline R_1(\lambda)$ without zeros in $\partial\mathds{C}_s$, while the non-standard case corresponds to $\overline R_1(\lambda)$ having zeros in $\partial\mathds{C}_s$. \subsubsection*{Computation of $Q_3(\lambda)$} In the standard case, $Q_3(\lambda) = I$. In the non-standard case, $Q_3(\lambda)$ is a stable, diagonal and invertible transfer function matrix determined such that $Q(\lambda)$ in (\ref{ammsym:Qprod2}) has a desired dynamics (specified via \texttt{OPTIONS.sdeg} and \texttt{OPTIONS.poles}). The overall updating factor used in (\ref{gemmp}) is $M(\lambda) = Q_3(\lambda)$ and is provided in \texttt{INFO.M}. In the second case, \texttt{INFO.degs = [ ]} and \texttt{INFO.HDesign = [ ]} are returned in the \texttt{INFO} structure. \begin{example}\label{ex:5.11} This is \emph{Example} 5.11 from the book \cite{Varg17}, with a continuous-time system with additive faults, having the transfer function matrices \[ G_u(s) = \left [ \begin{array}{c} \displaystyle\frac{s+1}{s+2} \\ \\[-2mm] \displaystyle\frac{s+2}{s+3} \end{array} \right ], \quad G_d(s) = 0, \quad G_f(s) = \left [ \begin{array}{cc} \ \displaystyle\frac{s+1}{s+2} & 0\\ \\[-2mm] 0 & 1 \end{array} \right ] , \quad G_w(s) = \left [ \begin{array}{c} \displaystyle \frac{1}{s+2} \\\\[-2mm] 0 \end{array} \right ] \, .\] The maximally achievable structure matrix is \[ S_{max} = \left [ \begin{array}{cc} 0 & 1 \\ 1 & 0 \\ 1 & 1 \end{array} \right ] \] and therefore we can target to solve an AMMP with strong fault isolability using the following reference model \[ M_r(s) = {\arraycolsep=2mm\left [ \begin{array}{cc} 1 & 0\\0 & 1 \end{array} \right ]} \, .\] This involves to determine a stable $Q(s)$, and possibly also an updating factor $M(s)$, which fulfill \[ \gamma_{opt} := \left\|Q(s)\left [ \begin{array}{cccc} G_u(s) & G_d(s) & G_f(s) & G_w(s) \\ I_{m_u} & 0 & 0& 0 \end{array} \right ] - M(s)[\, 0 \; 0\; M_r(s) \; 0 \,] \right\|_\infty = \min .\] A least order stable optimal filter $Q(s)$ has been determined by employing \texttt{\bfseries ammsyn} with $M(s) = I_2$. The resulting optimal performance is $\gamma_{opt} = \frac{\sqrt{2}}{2} = 0.7071$. The resulting $Q(s)$ is \[ Q(s) = \left [ \begin{array}{ccc} 0.7072\displaystyle\frac{s+2}{s+\sqrt{2}} & 0 & -0.7072\displaystyle\frac{s+1}{s+\sqrt{2}} \\ 0 & 0.7072 & -0.7072\displaystyle\frac{s+2}{s+3} \end{array} \right ] \] and the resulting $R_f(s)$ and $R_w(s)$ are \[ R_f(s) = \left [ \begin{array}{cc} 0.7072\displaystyle\frac{s+1}{s+\sqrt{2}} & 0 \\ 0 & 0.7072 \end{array} \right ] , \quad R_w(s) = \left [ \begin{array}{c} 0.7072\displaystyle\frac{1}{s+\sqrt{2}} \\ 0 \end{array} \right ] . \] The fault-to-noise gaps can be computed using the function \texttt{fdif2ngap}, by assuming as structure matrix $S_{FDI}$, the structure matrix of the reference model $M_r(s)$ (i.e., $S_{FDI} = I_2$). The resulting filter $Q(s)$ can be considered formed by column concatenating two separate filters $Q^{(1)}(s)$ and $Q^{(2)}(s)$, which aims to match the first and second rows of $M_r(s)$, respectively. The resulting fault-to-noise gaps are respectively, $\sqrt{2}$ and $\infty$, which indicate that the second filter solves, in fact, an EMMP. The above results have been computed with the following script. \newpage \begin{verbatim} s = tf('s'); Gu = [(s+1)/(s+2); (s+2)/(s+3)]; Gf = [(s+1)/(s+2) 0; 0 1]; Gw = [1/(s+2); 0]; mu = 1; mf = 2; mw = 1; p = 2; inputs = struct('c',1:mu,'f',mu+(1:mf),'n',mu+mf+(1:mw)); sysf = fdimodset(ss([Gu Gf Gw]),inputs); Smax = fdigenspec(sysf,struct('tol',1.e-7)) Mr = fdimodset(ss(eye(mf)),struct('faults',1:mf)); opts_ammsyn = struct('tol',1.e-7,'reltol',5.e-8); [Q,R,info] = ammsyn(sysf,Mr,opts_ammsyn); minreal(zpk(Q)), tf(info.M) Rf = minreal(zpk(R(:,'faults'))), Rw = minreal(zpk(R(:,'noise'))) info format short e gap = fdif2ngap(R,[],fditspec(Mr)) gammaopt = fdimmperf(R,Mr) Ge = [sysf;eye(mu,mu+mf+mw)]; norm_Ru = norm(Q*Ge(:,'controls'),inf) norm_dif = norm(R-Q*Ge(:,{'faults','noise'}),inf) \end{verbatim} \end{example} \newpage \subsection{Functions for the Synthesis of Model Detection Filters }\label{fditools:mdsynthesis} \subsubsection{\texttt{\bfseries emdsyn}} \index{M-functions!\texttt{\bfseries emdsyn}} \index{model detection problem!a@exact (EMDP)} \subsubsection*{Syntax} \begin{verbatim} [Q,R,INFO] = emdsyn(SYSM,OPTIONS) \end{verbatim} \subsubsection*{Description} \texttt{\bfseries emdsyn} solves the \emph{exact model detection problem} (EMDP) (see Section \ref{sec:EMDP}), for a given stable LTI multiple model \texttt{SYSM} containing $N$ models. A bank of $N$ stable and proper residual generation filters $Q^{(i)}(\lambda)$, for $i = 1, \ldots, N$, is determined, in the form (\ref{detecmi}). For each filter $Q^{(i)}(\lambda)$, its associated internal forms $R^{(i,j)}(\lambda)$, for $j = 1, \ldots, N$, are determined in accordance with (\ref{ri_internal1}). \subsubsection*{Input data} \begin{description} \item \texttt{SYSM} is a multiple model which contains $N$ stable LTI systems in the state-space form \begin{equation}\label{emdsyn:sysiss} \begin{array}{rcl}E^{(j)}\lambda x^{(j)}(t) &=& A^{(j)}x^{(j)}(t) + B^{(j)}_u u^{(j)}(t) + B^{(j)}_d d^{(j)}(t) + B^{(j)}_w w^{(j)}(t) \, ,\\ y^{(j)}(t) &=& C^{(j)}x^{(j)}(t) + D^{(j)}_u u^{(j)}(t) + D^{(j)}_d d^{(j)}(t) + D^{(j)}_w w^{(j)}(t) \, , \end{array} \end{equation} where $x^{(j)}(t) \in \mathds{R}^{n^{(j)}}$ is the state vector of the $j$-th system with control input $u^{(j)}(t) \in \mathds{R}^{m_u}$, disturbance input $d^{(j)}(t) \in \mathds{R}^{m_d^{(j)}}$ and noise input $w^{(j)}(t) \in \mathds{R}^{m_w^{(j)}}$, and \index{faulty system model!physical}% \index{faulty system model!multiple model}% where any of the inputs components $u^{(j)}(t)$, $d^{(j)}(t)$, or $w^{(j)}(t)$ can be void. The multiple model \texttt{SYSM} is either an array of $N$ LTI systems of the form (\ref{emdsyn:sysiss}), in which case $m_d^{(j)} = m_d$ and $m_w^{(j)} = m_w$ for $j = 1, \ldots, N$, or is a $1\times N$ cell array, with \texttt{SYSM\{$j$\}} containing the $j$-th component system in the form (\ref{emdsyn:sysiss}). The input groups for $u^{(j)}(t)$, $d^{(j)}(t)$, and $w^{(j)}(t)$ have the standard names \texttt{\bfseries 'controls'}, \texttt{\bfseries 'disturbances'}, and \texttt{\bfseries 'noise'}, respectively. \item \texttt{OPTIONS} is a MATLAB structure used to specify various synthesis options and has the following fields: {\tabcolsep=1mm \setlength\LTleft{30pt}\begin{longtable}{|l|lcp{9cm}|} \hline \textbf{\texttt{OPTIONS} fields} & \multicolumn{3}{l|}{\textbf{Description}} \\ \hline \texttt{tol} & \multicolumn{3}{p{9cm}|}{relative tolerance for rank computations \newline (Default: internally computed)} \\ \hline \texttt{tolmin} & \multicolumn{3}{p{9cm}|}{absolute tolerance for observability tests \newline (Default: internally computed)} \\ \hline \texttt{MDTol} & \multicolumn{3}{p{9cm}|}{threshold for model detectability checks \newline (Default: $10^{-4}$)} \\ \hline \texttt{MDGainTol} & \multicolumn{3}{p{9cm}|}{threshold for strong model detectability checks \newline (Default: $10^{-2}$)} \\ \hline \texttt{rdim} & \multicolumn{3}{p{12cm}|}{$N$-dimensional vector or a scalar; for a vector $q$, the $i$-th component $q_i$ specifies the desired number of residual outputs for the $i$-th filter \texttt{Q\{$i$\}}; for a scalar value $\bar q$, a vector $q$ with all $N$ components $q_i = \bar q$ is assumed. \newline (Default: \hspace*{-5.5mm}\begin{tabular}[t]{l} \hspace*{4.5mm}\texttt{[ ]}, in which case:\\ \hspace*{-2em} -- if \texttt{OPTIONS.HDesign\{$i$\}} is empty, then \\ $q_i = 1$, if \texttt{OPTIONS.minimal} = \texttt{true}, or \\ $q_i = n_v^{(i)}$, the dimension of the left nullspace which underlies the \\ synthesis of \texttt{Q\{$i$\}}, if \texttt{OPTIONS.minimal} = \texttt{false} (see \textbf{Method}); \\ \hspace*{-2em} -- if \texttt{OPTIONS.HDesign\{$i$\}} is nonempty, then $q_i$ is the row dimension \\ of the design matrix contained in \texttt{OPTIONS.HDesign\{$i$\}}.) \end{tabular}}\\ \hline \texttt{MDFreq} & \multicolumn{3}{p{12cm}|}{real vector, which contains the frequency values $\omega_k$, $k = 1, \ldots, n_f$, to be used for strong model detectability checks. For each real frequency $\omega_k$, there corresponds a complex frequency $\lambda_k$ which is used to evaluate the frequency-response gains. Depending on the system type, $\lambda_k = \mathrm{i}\omega_k$, in the continuous-time case, and $\lambda_k = \exp (\mathrm{i}\omega_k T)$, in the discrete-time case, where $T$ is the common sampling time of the component systems. (Default: \texttt{[ ]}) } \\ \hline \texttt{emdtest} & \multicolumn{3}{p{12cm}|}{option to perform extended model detectability tests using both control and disturbance input channels:}\\ & \texttt{true} &--& use both control and disturbance input channels; \\ & \texttt{false}&--& use only the control channel (default). \\ \hline \texttt{smarg} & \multicolumn{3}{p{11cm}|}{prescribed stability margin for the resulting filters \texttt{Q\{$i$\}} \newline (Default: \texttt{-sqrt(eps)} for continuous-time component systems; \newline \hspace*{4.8em}\texttt{1-sqrt(eps)} for discrete-time component systems. } \\ \hline \texttt{sdeg} & \multicolumn{3}{p{11cm}|}{prescribed stability degree for the resulting filters \texttt{Q\{$i$\}} \newline (Default: $-0.05$ for continuous-time component systems; \newline \hspace*{4.8em} $0.95$ for discrete-time component systems. } \\ \hline \texttt{poles} & \multicolumn{3}{p{12cm}|}{complex vector containing a complex conjugate set of desired poles (within the stability margin) to be assigned for the resulting filters \texttt{Q\{$i$\}} (Default: \texttt{[ ]})}\\ \hline \texttt{nullspace} & \multicolumn{3}{p{12cm}|}{option to use a specific type of proper nullspace bases:}\\ & \texttt{true} &--& use minimal proper bases; \\ & \texttt{false}&--& use full-order observer based bases (default) \newline \emph{Note:} This option can only be used if no disturbance inputs are present in (\ref{emdsyn:sysiss}) and $\forall j$, $E^{(j)}$ is invertible.\\ \hline \texttt{simple} & \multicolumn{3}{l|}{option to compute simple proper bases:}\\ & \texttt{true} &--& compute simple bases; the orders of the basis vectors are provided in \texttt{INFO.degs}; \\ & \texttt{false}&--& no simple basis computed (default) \\ \hline \texttt{minimal} & \multicolumn{3}{l|}{option to perform least order filter syntheses:}\\ & \texttt{true} &--& perform least order syntheses (default); \\ & \texttt{false}&--& perform full order syntheses. \\ \hline \texttt{tcond} & \multicolumn{3}{l|}{maximum allowed value for the condition numbers of the employed}\\ & \multicolumn{3}{l|}{non-orthogonal transformation matrices (Default: $10^4$)}\\ & \multicolumn{3}{l|}{(only used if \texttt{OPTIONS.simple = true}) } \\ \hline \texttt{MDSelect} & \multicolumn{3}{p{12cm}|}{integer vector with increasing elements containing the indices of the desired filters to be designed (Default: $[\,1, \ldots, N\,]$)}\\ \hline \texttt{HDesign} & \multicolumn{3}{p{12cm}|}{$N$-dimensional cell array; \texttt{OPTIONS.HDesign\{$i$\}}, if not empty, is a full row rank design matrix employed for the synthesis of the $i$-th filter. If \texttt{OPTIONS.HDesign} is specified as a full row rank design matrix $H$, then an $N$-dimensional cell array is assumed with \texttt{OPTIONS.HDesign\{$i$\}} = $H$, for $i = 1, \ldots, N$. (Default:~\texttt{[ ]}).}\\ \hline \texttt{normalize} & \multicolumn{3}{p{12cm}|}{option to normalize the the filters \texttt{Q\{i\}} and \texttt{R\{i,j\}} such that the minimum gains of the off-diagonal elements of \texttt{R\{i,j\}} are equal to one; otherwise the standard normalization is performed to ensure equal gains for \texttt{R\{1,j\}} and \texttt{R\{j,1\}} :}\\ & \texttt{true} &--& perform normalization to unit minimum gains; \\ & \texttt{false}&--& perform standard normalization (default). \\ \hline \end{longtable}} \end{description} \subsubsection*{Output data} \begin{description} \item \texttt{Q} is an $N\times 1$ cell array of filters, where \texttt{Q\{$i$\}} contains the resulting $i$-th filter in a standard state-space representation \[ {\begin{aligned} \lambda x_Q^{(i)}(t) & = A_Q^{(i)}x_Q^{(i)}(t)+ B_{Q_y}^{(i)}y(t)+ B_{Q_u}^{(i)}u(t) ,\\ r^{(i)}(t) & = C_Q^{(i)} x_Q^{(i)}(t) + D_{Q_y}^{(i)}y(t)+ D_{Q_u}^{(i)}u(t) , \end{aligned}} \] where the residual signal $r^{(i)}(t)$ is a $q_i$-dimensional vector, with $q_i$ specified in \texttt{OPTIONS.rdim}. For each system object \texttt{Q\{$i$\}}, two input groups \texttt{\bfseries 'outputs'} and \texttt{\bfseries 'controls'} are defined for $y(t)$ and $u(t)$, respectively, and the output group \texttt{\bfseries 'residuals'} is defined for the residual signal $r^{(i)}(t)$. \texttt{Q\{$i$\}} is empty for all $i$ which do not belong to the index set specified by \texttt{OPTIONS.MDSelect}. \item \texttt{R} is an $N\times N$ cell array of filters, where the $(i,j)$-th filter \texttt{R\{$i,j$\}}, is the internal form of \texttt{Q\{$i$\}} acting on the $j$-th model. The resulting \texttt{R\{$i,j$\}} has a standard state-space representation \[ {\begin{aligned} \lambda x_R^{(i,j)}(t) & = A_R^{(i,j)}x_R^{(i,j)}(t)+ B_{R_u}^{(i,j)}u^{(j)}(t)+ B_{R_d}^{(i,j)}d^{(j)}(t)+ B_{R_w}^{(i,j)}w^{(j)}(t), \\ r^{(i,j)}(t) & = C_R^{(i,j)} x_R^{(i,j)}(t) + D_{R_u}^{(i,j)}u^{(j)}(t)+ D_{R_d}^{(i,j)}d^{(j)}(t)+ D_{R_w}^{(i,j)}w^{(j)}(t) \end{aligned}} \] and the input groups \texttt{\bfseries 'controls'}, \texttt{\bfseries 'disturbances'} and \texttt{\bfseries 'noise'} are defined for $u^{(j)}(t)$, $d^{(j)}(t)$, and $w^{(j)}(t)$, respectively, and the output group \texttt{\bfseries 'residuals'} is defined for the residual signal $r^{(i,j)}(t)$. \texttt{R\{$i,j$\}}, $j = 1, \ldots, N$ are empty for all $i$ which do not belong to the index set specified by \texttt{OPTIONS.MDSelect}. \pagebreak[4] \item \texttt{INFO} is a MATLAB structure containing additional information, as follows:\\[-2mm] {\setlength\LTleft{30pt}\begin{longtable}{|l|p{12cm}|} \hline \textbf{\texttt{INFO} fields} & \textbf{Description} \\ \hline \texttt{tcond} & $N$-dimensional vector; \texttt{INFO.tcond}$(i)$ contains the maximum of the condition numbers of the non-orthogonal transformation matrices used to determine the $i$-th filter \texttt{Q\{$i$\}}; a warning is issued if any \texttt{INFO.tcond}$(i)$ $\geq$ \texttt{OPTIONS.tcond}.\\ \hline \texttt{degs} & $N$-dimensional cell array; if \texttt{OPTIONS.simple} = \texttt{true}, then a nonempty \texttt{INFO.degs\{$i$\}} contains the orders of the basis vectors of the employed simple nullspace basis for the synthesis of the $i$-th filter component \texttt{Q\{$i$\}}; if \texttt{OPTIONS.simple} = \texttt{false}, then a nonempty \texttt{INFO.degs\{$i$\}} contains the degrees of the basis vectors of an equivalent polynomial nullspace basis; \texttt{INFO.degs\{$i$\} = [ ]} for all $i$ which do not belong to the index set specified by \texttt{OPTIONS.MDSelect}. \\ \hline \texttt{MDperf} & $N\times N$-dimensional array containing the achieved distance mapping performance, given as the peak gains associated with the internal representations (see \textbf{Method}). \newline $\texttt{INFO.MDperf($i,j$)} = -1$, for $j = 1, \ldots, N$ and for all $i$ which do not belong to the index set specified by \texttt{OPTIONS.MDSelect}. \\ \hline \texttt{HDesign} & $N$-dimensional cell array, where $\texttt{INFO.HDesign\{$i$\}}$ contains the $i$-th design matrix $H^{(i)}$ employed for the synthesis of the $i$-th filter (see \textbf{Method}) \\ \hline \end{longtable} } \end{description} \subsubsection*{Method} An extension of the \textbf{Procedure EMD} from \cite[Sect.\ 6.2]{Varg17} is implemented, which relies on the nullspace-based synthesis method proposed in \cite{Varg09h}. Assume that the $j$-th model has the input-output form \begin{equation}\label{emd:systemi} {\mathbf{y}}^{(j)}(\lambda) = G_u^{(j)}(\lambda){\mathbf{u}}^{(j)}(\lambda) + G_d^{(j)}(\lambda){\mathbf{d}}^{(j)}(\lambda) + G_w^{(j)}(\lambda){\mathbf{w}}^{(j)}(\lambda) \end{equation} and the resulting $i$-th filter $Q^{(i)}(\lambda)$ has the input-output form \begin{equation}\label{emd:detec1i} {\mathbf{r}}^{(i)}(\lambda) = Q^{(i)}(\lambda)\left [ \begin{array}{c} {\mathbf{y}}(\lambda)\\{\mathbf{u}}(\lambda)\end{array} \right ] \, . \end{equation} The synthesis method, which underlies \textbf{Procedure EMD}, essentially determines each filter $Q^{(i)}(\lambda)$ as a stable rational left annihilator of \[ G^{(i)}(\lambda) := \left [ \begin{array}{cc} G_u^{(i)}(\lambda) & G_d^{(i)}(\lambda) \\ I_{m_u} & 0 \end{array} \right ] ,\] such that for $i\neq j$ we have $[\, R_u^{(i,j)}(\lambda)\; R_d^{(i,j)}(\lambda) \,] \neq 0$, where \[ R^{(i,j)}(\lambda) := [\, R_u^{(i,j)}(\lambda)\; R_d^{(i,j)}(\lambda) \; R_w^{(i,j)}(\lambda)\,] = Q^{(i)}(\lambda) \left [ \begin{array}{ccc} G_u^{(j)}(\lambda) & G_d^{(j)}(\lambda) & G_w^{(j)}(\lambda) \\ I_{m_u} & 0 & 0\end{array} \right ] \] is the internal form of $Q^{(i)}(\lambda)$ acting on the $j$-th model. Each filter $Q^{(i)}(\lambda)$ is determined in the product form \begin{equation}\label{emdsym:Qprod} Q^{(i)}(\lambda) = Q_3^{(i)}(\lambda)Q_2^{(i)}(\lambda)Q_1^{(i)}(\lambda) , \end{equation} where the factors are determined as follows: \begin{itemize} \item[(a)] $Q_1^{(i)}(\lambda) = N_l^{(i)}(\lambda)$, with $N_l^{(i)}(\lambda)$ a $\big(p-r_d^{(i)}\big) \times (p+m_u)$ proper rational left nullspace basis satisfying $N_l^{(i)}(\lambda)G^{(i)}(\lambda) = 0$, with $r_d^{(i)} := \text{rank}\, G_d^{(i)}(\lambda)$; ($n_v^{(i)} := p-r_d^{(i)}$ is the number of basis vectors) \item[(b)] $Q_2^{(i)}(\lambda)$ is an admissible factor (i.e., guaranteeing model detectability) to perform least order synthesis; \item[(c)] $Q_3^{(i)}(\lambda)$ is a stable invertible factor determined such that $Q^{(i)}(\lambda)$ has a desired dynamics. \end{itemize} The computations of individual factors depend on the user's options. Specific choices are discussed in what follows. \subsubsection*{Computation of $Q_1^{(i)}(\lambda)$} If \texttt{OPTIONS.nullspace = true}, then the left nullspace basis $N_l^{(i)}(\lambda)$ is determined as a minimal proper rational basis, or, if \texttt{OPTIONS.nullspace = false} (the default option) and $m_d^{(i)} = 0$, then the simple observer based basis $N_l^{(i)}(\lambda) = [\, I \; -G_u^{(i)}(\lambda)\,]$ is employed. If $N_l^{(i)}(\lambda)$ is a minimal rational basis and if \texttt{OPTIONS.simple = true}, then $N_l^{(i)}(\lambda)$ is determined as a simple rational basis and the orders of the basis vectors are provided in \texttt{INFO.degs}. These are also the degrees of the basis vectors of an equivalent polynomial nullspace basis. If \texttt{OPTIONS.minimal = false}, a stable basis is determined whose dynamics is specified via \texttt{OPTIONS.sdeg} and \texttt{OPTIONS.poles}. \subsubsection*{Computation of $Q_2^{(i)}(\lambda)$} If \texttt{OPTIONS.minimal = false}, then $Q_2^{(i)}(\lambda) = H^{(i)}$, where $H^{(i)}$ is a suitable $q_i\times \big(p-r_d^{(i)}\big)$ full row rank design matrix. $H^{(i)}$ is set as follows. If \texttt{OPTIONS.HDesign}$\{i\}$ is nonempty, then $H^{(i)} = \texttt{OPTIONS.HDesign}\{i\}$. If \texttt{OPTIONS.HDesign}$\{i\}$ is empty, then $q_i = \texttt{OPTIONS.rdim}$ if \texttt{OPTIONS.rdim} is nonempty and $q_i = p-r_d^{(i)}$ if \texttt{OPTIONS.rdim} is empty, and the matrix $H^{(i)}$ is chosen to build $q_i$ linear combinations of the $p-r_d^{(i)}$ left nullspace basis vectors, such that $H^{(i)}Q_1^{(i)}(\lambda)$ has full row rank. If $q_i = p-r_d^{(i)}$ then the choice $H^{(i)} = I_{p-r_d^{(i)}}$ is used, otherwise $H^{(i)}$ is chosen a randomly generated $q_i \times \big(p-r_d^{(i)}\big)$ real matrix. If \texttt{OPTIONS.minimal = true}, then $Q_2^{(i)}(\lambda)$ is a $q_i\times \big(p-r_d^{(i)}\big)$ transfer function matrix, with $q_i$ chosen as above. $Q_2^{(i)}(\lambda)$ is determined in the form \[ Q_2^{(i)}(\lambda) = H^{(i)}+Y_2^{(i)}(\lambda)\, , \] such that $Q_2^{(i)}(\lambda)Q_1^{(i)}(\lambda)$ $\big(\!= H^{(i)}N_l^{(i)}(\lambda)+Y_2^{(i)}(\lambda)N_l^{(i)}(\lambda)\big)$ and $Y_2^{(i)}(\lambda)$ are the least order solution of a left minimal cover problem \cite{Varg17g}. If \texttt{OPTIONS.HDesign}$\{i\}$ is nonempty, then $H^{(i)} = \texttt{OPTIONS.HDesign}\{i\}$, and if \texttt{OPTIONS.HDesign}$\{i\}$ is empty, then a suitable randomly generated $H^{(i)}$ is employed (see above). The structure field \texttt{INFO.HDesign}$\{i\}$ contains the employed value of the design matrix $H^{(i)}$. \subsubsection*{Computation of $Q_3^{(i)}(\lambda)$} $Q_3^{(i)}(\lambda)$ is a stable invertible transfer function matrix determined such that $Q^{(i)}(\lambda)$ in (\ref{emdsym:Qprod}) has a desired dynamics (specified via \texttt{OPTIONS.sdeg} and \texttt{OPTIONS.poles}). \vspace*{5mm} \index{model detection!distance mapping} \index{performance evaluation!model detection!distance mapping} The resulting $N\times N$ matrix \texttt{INFO.MDperf} can be used for the assessment of the achieved distance mapping performance of the resulting model detection filters (see Section \ref{sec:mdperf} for definitions). If \texttt{OPTIONS.MDFreq} is empty, then \texttt{INFO.MDperf}$(i,j) = \big\| \big[\, R_u^{(i,j)}(\lambda)\; R_d^{(i,j)}(\lambda) \,\big] \big\|_\infty$ if \texttt{OPTIONS.emdtest = true} and \texttt{INFO.MDperf}$(i,j) = \big\| R_u^{(i,j)}(\lambda) \big\|_\infty$ if \texttt{OPTIONS.emdtest = false}, and, ideally, represents a measure of the distance between the $i$-th and $j$-th component systems. If \texttt{OPTIONS.MDFreq} contains a set of $n_f$ real frequency values $\omega_k$, $k = 1, \ldots, n_f$ and $\lambda_k$, $k = 1, \ldots, n_f$ are the corresponding complex frequencies (see the description of \texttt{OPTIONS.MDFreq}), then \texttt{INFO.MDperf}$(i,j)$ $= \max_k\big\|\big[\, R_u^{(i,j)}(\lambda_k)\; R_d^{(i,j)}(\lambda_k) \,\big]\big\|_\infty$ if \texttt{OPTIONS.emdtest = true} and \texttt{INFO.MDperf}$(i,j) =$ $\max_k\big\| R_u^{(i,j)}(\lambda_k) \big\|_\infty$ if \texttt{OPTIONS.emdtest = false}. In this case, the entry \texttt{INFO.MDperf}$(i,j)$ ideally represents a measure of the maximum distance between the frequency responses of the $i$-th and $j$-th component systems, evaluated in the selected set of frequency values. If \texttt{OPTIONS.normalize = true}, then for each row $i$, the filters \texttt{Q\{i\}} and \texttt{R\{i,j\}} are scaled such that the least value of \texttt{INFO.MDperf}$(i,j)$ for $i\neq j$ is normalized to one. The standard normalization is performed if \texttt{OPTIONS.normalize = false}, in which case \texttt{INFO.MDperf}$(1,j)$ = \texttt{INFO.MDperf}$(j,1)$ for $j > 1$. \subsubsection*{Example} \begin{example} \label{ex:Ex6.1} This is \emph{Example} 6.1 from the book \cite{Varg17}, which deals with a continuous-time state-space model, describing, in the fault-free case, the lateral dynamics of an F-16 aircraft with the matrices \[ A^{(1)} = \left[\begin{array}{rrrr} -0.4492& 0.046& 0.0053& -0.9926\\ 0& 0& 1.0000& 0.0067\\ -50.8436& 0& -5.2184& 0.7220\\ ~16.4148& 0& 0.0026& -0.6627 \end{array}\right] , \quad B_u^{(1)} = \left[\begin{array}{rr} 0.0004& 0.0011\\ 0& 0\\ -1.4161& 0.2621\\ -0.0633& -0.1205 \end{array}\right] ,\] \[ \;\, C^{(1)} = I_4, \;\qquad D_u^{(1)} = 0_{4\times 2} \, .\] The four state variables are the sideslip angle, roll angle, roll rate and yaw rate, and the two input variables are the aileron deflection and rudder deflection. The model detection problem addresses the synthesis of model detection filters for the detection and identification of loss of efficiency of the two flight actuators, which control the deflections of the aileron and rudder. The individual fault models correspond to different degrees of surface efficiency degradation. A multiple model with $N = 9$ component models is used, which correspond to a two-dimensional parameter grid for $N$ values of the parameter vector $\rho := [\rho_1,\rho_2]^T$. For each component of $\rho$, we employ the three grid points $\{0,0.5,1\}$. The component system matrices in (\ref{emdsyn:sysiss}) are defined for $i = 1, 2, \ldots, N$ as: $E^{(i)} = I_4$, $A^{(i)} = A^{(1)}$, $C^{(i)} = C^{(1)}$, and $B_u^{(i)} = B^{(1)}_u \Gamma^{(i)}$, where $\Gamma^{(i)} = \mathop{\mathrm{diag}} \big(1-\rho_1^{(i)},1-\rho_2^{(i)}\big)$ and $\big(\rho_1^{(i)},\rho_2^{(i)}\big)$ are the values of parameters $(\rho_1,\rho_2)$ on the chosen grid: \begin{center} {\tabcolsep=2mm\begin{tabular}{|r|rrrrrrrrr|} \hline $\rho_1:$ & 0 & 0 & 0 & 0.5 & 0.5 & 0.5 & 1 & 1 & 1 \\ $\rho_2:$ & 0 & 0.5 & 1 & 0 & 0.5 & 1 & 0 & 0.5 & 1 \\\hline \end{tabular} . } \end{center} For example, $\big(\rho_1^{(1)},\rho_2^{(1)}\big) = (0,0)$ corresponds to the fault-free situation, while $\big(\rho_1^{(9)},\rho_2^{(9)}\big) = (1,1)$ corresponds to complete failure of both control surfaces. It follows, that the TFM $G_u^{(i)}(s)$ of the $i$-th system can be expressed as \begin{equation}\label{Gui_ex} G_u^{(i)}(s) = G_u^{(1)}(s)\Gamma^{(i)}, \end{equation} where \[ G_u^{(1)}(s) = C^{(1)}\big(sI-A^{(1)}\big)^{-1}B^{(1)}_u \] is the TFM of the fault-free system. Note that $G_u^{(N)}(s) = 0$ describes the case of complete failure. The distances between the $i$-th and $j$-th models can be evaluated---for example, as the $\mathcal{H}_\infty$-norm of $G_u^{(i)}(s)-G_u^{(j)}(s)$, for $i,j = 1, \ldots, N$ and are plotted in Fig.~\ref{MDexample}. \begin{figure}[thpb] \begin{center} \includegraphics[width=14cm]{varga_Fig_MDdistances.pdf} \vspace*{-12mm} \caption{Distances between component models in terms of $\big\|G_u^{(i)}(s)-G_u^{(j)}(s)\big\|_\infty$} \label{MDexample} \end{center} \end{figure} We aim to determine $N$ filters $Q^{(i)}(s)$, $i = 1, \ldots, N$, with scalar outputs, having least McMillan degrees and satisfactory dynamics, which fulfill: \begin{itemize} \item[--] the decoupling conditions: $R_u^{(i,i)}(s) = 0$, $i = 1, \ldots, N$; \item[--] the model detectability condition: $R_u^{(i,j)}(s) \neq 0, \quad \forall j\neq i, \;\;i,j = 1, \ldots, N$. \end{itemize} Additionally, the resulting model detection performance measures $\|R_u^{(i,j)}(s)\|_\infty$ should (ideally) reproduce the shape of distances plotted in Fig.~\ref{MDexample}. For the design of scalar filters, we used the same $1\times p$ design matrix $H$ for the synthesis of all filters, which has been chosen, after some trials with randomly generated values, as \[ H = [ \,0.7645 \;\; 0.8848 \;\; 0.5778 \;\; 0.9026\,] \, .\] The filter synthesis, performed by employing \texttt{emdsyn}, led to first order stable filters, which, as can be observed in Fig.~\ref{MDexampleres}, produces similar shapes of the model detection performance measure as those in Fig.~\ref{MDexample}. \begin{figure}[thpb] \begin{center} \includegraphics[width=14cm]{varga_Fig_MDresnorms.pdf} \vspace*{-15mm} \end{center} \caption{Model detection performance in terms of $\big\|R_u^{(i,j)}(s)\big\|_\infty$} \label{MDexampleres} \end{figure} In Fig.~\ref{MDExampletimeresp} the step responses from $u_1$ (aileron) and $u_2$ (rudder) are presented for the $9\times 9$ block array, whose entries are the computed TFMs $R^{(i,j)}(s)$. Each column corresponds to a specific model for which the step responses of the $N$ residuals are computed. \newpage \begin{figure}[thpb] \begin{center} \hspace*{-1cm} \includegraphics[width=17.5cm]{varga_Fig_Ex_EMD.pdf} \vspace*{-.8cm} \caption[Step responses of $R^{(i,j)}(s)$ for least-order syntheses]{Step responses of $R^{(i,j)}(s)$ from $u_1$ (blue) and $u_2$ (red) for least order syntheses.} \label{MDExampletimeresp} \end{center} \end{figure} The following script implements the model building, filter synthesis and analysis steps. \begin{verbatim} A = [-.4492 0.046 .0053 -.9926; 0 0 1 0.0067; -50.8436 0 -5.2184 .722; 16.4148 0 .0026 -.6627]; Bu = [0.0004 0.0011; 0 0; -1.4161 .2621; -0.0633 -0.1205]; C = eye(4); p = size(C,1); mu = size(Bu,2); Gamma = 1 - [ 0 0 0 .5 .5 .5 1 1 1; 0 .5 1 0 .5 1 0 .5 1 ]'; N = size(Gamma,1); sysu = ss(zeros(p,mu,N,1)); for i=1:N sysu(:,:,i,1) = ss(A,Bu*diag(Gamma(i,:)),C,0); end sysu = mdmodset(sysu,struct('controls',1:mu)); nugapdist = mddist(sysu); figure, mesh(nugapdist), colormap hsv title('\nu-gap distances between component models') ylabel('Model numbers') xlabel('Model numbers') hinfdist = mddist(sysu,struct('distance','Inf')); figure, mesh(hinfdist), colormap hsv title('H_\infty norm based distances between component models') ylabel('Model numbers') xlabel('Model numbers') H = [ 0.7645 0.8848 0.5778 0.9026 ]; emdsyn_options = struct('sdeg',-1,'poles',-1,'HDesign',H); [Q,R,info] = emdsyn(sysu,emdsyn_options); figure, mesh(info.MDperf), colormap hsv title('Distance mapping performance') ylabel('Residual numbers') xlabel('Model numbers') figure k1 = 0; for j = 1:N, k1 = k1+1; k = k1; for i=1:N, subplot(N,N,k), [r,t] = step(R{j,i},4); plot(t,r(:,:,1),t,r(:,:,2)), if i == 1, title(['Model ',num2str(j)]), end if i == j, ylim([-1 1]), end if j == 1, ylabel(['r^(^', num2str(i),'^)'],'FontWeight','bold'), end if i == N && j == 5, xlabel('Time (seconds)','FontWeight','bold'), end k = k+N; end end \end{verbatim} \end{example} \subsubsection{\texttt{\bfseries amdsyn}} \index{M-functions!\texttt{\bfseries amdsyn}} \index{model detection problem!approximate (AMDP)} \subsubsection*{Syntax} \begin{verbatim} [Q,R,INFO] = amdsyn(SYSM,OPTIONS) \end{verbatim} \subsubsection*{Description} \texttt{\bfseries amdsyn} solves the \emph{approximate model detection problem} (AMDP) (see Section \ref{sec:AMDP}), for a given stable LTI multiple model \texttt{SYSM} containing $N$ models. A bank of $N$ stable and proper residual generation filters $Q^{(i)}(\lambda)$, for $i = 1, \ldots, N$, is determined, in the form (\ref{detecmi}). For each filter $Q^{(i)}(\lambda)$, its associated internal forms $R^{(i,j)}(\lambda)$, for $j = 1, \ldots, N$, are determined in accordance with (\ref{ri_internal1}). \subsubsection*{Input data} \begin{description} \item \texttt{SYSM} is a multiple model which contains $N$ stable LTI systems in the state-space form \begin{equation}\label{amdsyn:sysiss} \begin{array}{rcl}E^{(j)}\lambda x^{(j)}(t) &=& A^{(j)}x^{(j)}(t) + B^{(j)}_u u^{(j)}(t) + B^{(j)}_d d^{(j)}(t) + B^{(j)}_w w^{(j)}(t) \, ,\\ y^{(j)}(t) &=& C^{(j)}x^{(j)}(t) + D^{(j)}_u u^{(j)}(t) + D^{(j)}_d d^{(j)}(t) + D^{(j)}_w w^{(j)}(t) \, , \end{array} \end{equation} where $x^{(j)}(t) \in \mathds{R}^{n^{(j)}}$ is the state vector of the $j$-th system with control input $u^{(j)}(t) \in \mathds{R}^{m_u}$, disturbance input $d^{(j)}(t) \in \mathds{R}^{m_d^{(j)}}$ and noise input $w^{(j)}(t) \in \mathds{R}^{m_w^{(j)}}$, and \index{faulty system model!physical}% \index{faulty system model!multiple model}% where any of the inputs components $u^{(j)}(t)$, $d^{(j)}(t)$, or $w^{(j)}(t)$ can be void. The multiple model \texttt{SYSM} is either an array of $N$ LTI systems of the form (\ref{amdsyn:sysiss}), in which case $m_d^{(j)} = m_d$ and $m_w^{(j)} = m_w$ for $j = 1, \ldots, N$, or is a $1\times N$ cell array, with \texttt{SYSM\{$j$\}} containing the $j$-th component system in the form (\ref{amdsyn:sysiss}). The input groups for $u^{(j)}(t)$, $d^{(j)}(t)$, and $w^{(j)}(t)$ have the standard names \texttt{\bfseries 'controls'}, \texttt{\bfseries 'disturbances'}, and \texttt{\bfseries 'noise'}, respectively. \item \texttt{OPTIONS} is a MATLAB structure used to specify various synthesis options and has the following fields: {\tabcolsep=1mm \setlength\LTleft{30pt}\begin{longtable}{|l|lcp{10cm}|} \hline \textbf{\texttt{OPTIONS} fields} & \multicolumn{3}{l|}{\textbf{Description}} \\ \hline \texttt{tol} & \multicolumn{3}{p{9cm}|}{relative tolerance for rank computations \newline (Default: internally computed)} \\ \hline \texttt{tolmin} & \multicolumn{3}{p{9cm}|}{absolute tolerance for observability tests \newline (Default: internally computed)} \\ \hline \texttt{MDTol} & \multicolumn{3}{l|}{threshold for model detectability checks (Default: $10^{-4}$)} \\ \hline \texttt{MDGainTol} & \multicolumn{3}{l|}{threshold for strong model detectability checks (Default: $10^{-2}$)} \\ \hline \texttt{rdim} & \multicolumn{3}{p{12cm}|}{$N$-dimensional vector or a scalar; for a vector $q$, the $i$-th component $q_i$ specifies the desired number of residual outputs for the $i$-th filter \texttt{Q\{$i$\}}; for a scalar value $\bar q$, a vector $q$ with all $N$ components $q_i = \bar q$ is assumed. \newline (Default: \hspace*{-5.5mm}\begin{tabular}[t]{l} \hspace*{4.5mm}\texttt{[ ]}, in which case:\\ \hspace*{-2em} -- if \texttt{OPTIONS.HDesign\{$i$\}} is empty, then \\ $q_i = 1$, if \texttt{OPTIONS.minimal} = \texttt{true}, or \\ $q_i = n_v^{(i)}$, the dimension of the left nullspace which underlies the \\ synthesis of \texttt{Q\{$i$\}}, if \texttt{OPTIONS.minimal} = \texttt{false} and $r_w^{(i)} = 0$ \\ (see \textbf{Method}); \\ $q_i = r_w^{(i)}$, if \texttt{OPTIONS.minimal} = \texttt{false} and $r_w^{(i)} > 0$ \\ (see \textbf{Method}); \\ \hspace*{-2em} -- if \texttt{OPTIONS.HDesign\{$i$\}} is nonempty, then $q_i$ is the row dimension \\ of the design matrix contained in \texttt{OPTIONS.HDesign\{$i$\}}.) \end{tabular}}\\ \hline \texttt{emdtest} & \multicolumn{3}{p{12cm}|}{option to perform extended model detectability tests using both control and disturbance input channels:}\\ & \texttt{true} &--& use both control and disturbance input channels; \\ & \texttt{false}&--& use only the control channel (default). \\ \hline \texttt{smarg} & \multicolumn{3}{p{11cm}|}{prescribed stability margin for the resulting filters \texttt{Q\{$i$\}} \newline (Default: \texttt{-sqrt(eps)} for continuous-time component systems; \newline \hspace*{4.8em}\texttt{1-sqrt(eps)} for discrete-time component systems. } \\ \hline \texttt{sdeg} & \multicolumn{3}{p{11cm}|}{prescribed stability degree for the resulting filters \texttt{Q\{$i$\}} \newline (Default: $-0.05$ for continuous-time component systems; \newline \hspace*{4.8em} $0.95$ for discrete-time component systems. } \\ \hline \texttt{poles} & \multicolumn{3}{p{12cm}|}{complex vector containing a complex conjugate set of desired poles (within the stability margin) to be assigned for the resulting filters \texttt{Q\{$i$\}} (Default: \texttt{[ ]})}\\ \hline \texttt{MDFreq} & \multicolumn{3}{p{12cm}|}{real vector, which contains the frequency values $\omega_k$, $k = 1, \ldots, n_f$, to be used for strong model detectability checks. For each real frequency $\omega_k$, there corresponds a complex frequency $\lambda_k$ which is used to evaluate the frequency-response gains. Depending on the system type, $\lambda_k = \mathrm{i}\omega_k$, in the continuous-time case, and $\lambda_k = \exp (\mathrm{i}\omega_k T)$, in the discrete-time case, where $T$ is the common sampling time of the component systems. (Default: \texttt{[ ]}) } \\ \hline \texttt{nullspace} & \multicolumn{3}{p{12cm}|}{option to use a specific type of proper nullspace bases:}\\ & \texttt{true} &--& use minimal proper bases; \\ & \texttt{false}&--& use full-order observer based bases (default) \newline \emph{Note:} This option can only be used if no disturbance inputs are present in (\ref{amdsyn:sysiss}) and $\forall j$, $E^{(j)}$ is invertible.\\ \hline \texttt{simple} & \multicolumn{3}{l|}{option to compute simple proper bases:}\\ & \texttt{true} &--& compute simple bases; the orders of the basis vectors are provided in \texttt{INFO.degs}; \\ & \texttt{false}&--& no simple basis computed (default) \\ \hline \texttt{minimal} & \multicolumn{3}{l|}{option to perform least order filter syntheses:}\\ & \texttt{true} &--& perform least order syntheses (default); \\ & \texttt{false}&--& perform full order syntheses. \\ \hline \texttt{tcond} & \multicolumn{3}{l|}{maximum allowed value for the condition numbers of the employed}\\ & \multicolumn{3}{l|}{non-orthogonal transformation matrices (Default: $10^4$)}\\ & \multicolumn{3}{l|}{(only used if \texttt{OPTIONS.simple = true}) } \\ \hline \texttt{MDSelect} & \multicolumn{3}{p{12cm}|}{integer vector with increasing elements containing the indices of the desired filters to be designed (Default: $[\,1, \ldots, N\,]$)}\\ \hline \texttt{HDesign} & \multicolumn{3}{p{12cm}|}{$N$-dimensional cell array; \texttt{OPTIONS.HDesign\{$i$\}}, if not empty, is a full row rank design matrix employed for the synthesis of the $i$-th filter. If \texttt{OPTIONS.HDesign} is specified as a full row rank design matrix $H$, then an $N$-dimensional cell array is assumed with \texttt{OPTIONS.HDesign\{$i$\}} = $H$, for $i = 1, \ldots, N$. (Default:~\texttt{[ ]}).}\\ \hline \texttt{epsreg} & \multicolumn{3}{p{11cm}|}{regularization parameter (Default: 0.1)} \\ \hline \texttt{sdegzer} & \multicolumn{3}{p{11cm}|}{prescribed stability degree for zeros shifting \newline (Default: $-0.05$ for a continuous-time system \texttt{SYSF}; \newline \hspace*{4.8em} $0.95$ for a discrete-time system \texttt{SYSF}).}\\ \hline \texttt{nonstd} & \multicolumn{3}{l|}{option to handle nonstandard optimization problems (see \textbf{Method}):}\\ & ~~~1 &--& use the quasi-co-outer--co-inner factorization (default); \\ & ~~~2 &--& use the modified co-outer--co-inner factorization with the regularization parameter \texttt{OPTIONS.epsreg}; \\ & ~~~3 &--& use the Wiener-Hopf type co-outer--co-inner factorization. \\ & ~~~4 &--& use the Wiener-Hopf type co-outer-co-inner factorization with zero shifting of the non-minimum phase factor using the stabilization parameter \texttt{OPTIONS.sdegzer} \\ & ~~~5 &--& use the Wiener-Hopf type co-outer-co-inner factorization with the regularization of the non-minimum phase factor using the regularization parameter \texttt{OPTIONS.epsreg} \\ \hline \end{longtable}} \end{description} \subsubsection*{Output data} \begin{description} \item \texttt{Q} is an $N\times 1$ cell array of filters, where \texttt{Q\{$i$\}} contains the resulting $i$-th filter in a standard state-space representation \[ {\begin{aligned} \lambda x_Q^{(i)}(t) & = A_Q^{(i)}x_Q^{(i)}(t)+ B_{Q_y}^{(i)}y(t)+ B_{Q_u}^{(i)}u(t) ,\\ r^{(i)}(t) & = C_Q^{(i)} x_Q^{(i)}(t) + D_{Q_y}^{(i)}y(t)+ D_{Q_u}^{(i)}u(t) , \end{aligned}} \] where the residual signal $r^{(i)}(t)$ is a $q_i$-dimensional vector, with $q_i$ specified in \texttt{OPTIONS.rdim}. For each system object \texttt{Q\{$i$\}}, two input groups \texttt{\bfseries 'outputs'} and \texttt{\bfseries 'controls'} are defined for $y(t)$ and $u(t)$, respectively, and the output group \texttt{\bfseries 'residuals'} is defined for the residual signal $r^{(i)}(t)$. \texttt{Q\{$i$\}} is empty for all $i$ which do not belong to the index set specified by \texttt{OPTIONS.MDSelect}. \item \texttt{R} is an $N\times N$ cell array of filters, where the $(i,j)$-th filter \texttt{R\{$i,j$\}}, is the internal form of \texttt{Q\{$i$\}} acting on the $j$-th model. The resulting \texttt{R\{$i,j$\}} has a standard state-space representation \[ {\begin{aligned} \lambda x_R^{(i,j)}(t) & = A_R^{(i,j)}x_R^{(i,j)}(t)+ B_{R_u}^{(i,j)}u^{(j)}(t)+ B_{R_d}^{(i,j)}d^{(j)}(t)+ B_{R_w}^{(i,j)}w^{(j)}(t), \\ r^{(i,j)}(t) & = C_R^{(i,j)} x_R^{(i,j)}(t) + D_{R_u}^{(i,j)}u^{(j)}(t)+ D_{R_d}^{(i,j)}d^{(j)}(t)+ D_{R_w}^{(i,j)}w^{(j)}(t) \end{aligned}} \] and the input groups \texttt{\bfseries 'controls'}, \texttt{\bfseries 'disturbances'} and \texttt{\bfseries 'noise'} are defined for $u^{(j)}(t)$, $d^{(j)}(t)$, and $w^{(j)}(t)$, respectively, and the output group \texttt{\bfseries 'residuals'} is defined for the residual signal $r^{(i,j)}(t)$. \texttt{R\{$i,j$\}}, $j = 1, \ldots, N$ are empty for all $i$ which do not belong to the index set specified by \texttt{OPTIONS.MDSelect}. \item \texttt{INFO} is a MATLAB structure containing additional information, as follows:\\ {\setlength\LTleft{30pt}\begin{longtable}{|l|p{12cm}|} \hline \textbf{\texttt{INFO} fields} & \textbf{Description} \\ \hline \texttt{tcond} & $N$-dimensional vector; \texttt{INFO.tcond}$(i)$ contains the maximum of the condition numbers of the non-orthogonal transformation matrices used to determine the $i$-th filter \texttt{Q\{$i$\}}; a warning is issued if any \texttt{INFO.tcond}$(i)$ $\geq$ \texttt{OPTIONS.tcond}.\\ \hline \texttt{degs} & $N$-dimensional cell array; if \texttt{OPTIONS.simple} = \texttt{true}, then a nonempty \texttt{INFO.degs\{$i$\}} contains the orders of the basis vectors of the employed simple nullspace basis for the synthesis of the $i$-th filter component \texttt{Q\{$i$\}}; if \texttt{OPTIONS.simple} = \texttt{false}, then a nonempty \texttt{INFO.degs\{$i$\}} contains the degrees of the basis vectors of an equivalent polynomial nullspace basis; \texttt{INFO.degs\{$i$\} = [ ]} for all $i$ which do not belong to the index set specified by \texttt{OPTIONS.MDSelect}. \\ \hline \texttt{MDperf} & $N\times N$-dimensional array containing the achieved model detection performance measure, given as the gains associated with the internal representations (see \textbf{Method}). \newline $\texttt{INFO.MDperf($i,j$)} = -1$, for $j = 1, \ldots, N$ and for all $i$ which do not belong to the index set specified by \texttt{OPTIONS.MDSelect}. \\ \hline \texttt{HDesign} & $N$-dimensional cell array, where $\texttt{INFO.HDesign\{$i$\}}$ contains the $i$-th design matrix $H^{(i)}$ employed for the synthesis of the $i$-th filter (see \textbf{Method}) \\ \hline \texttt{MDgap} & $N$-dimensional vector, which contains the achieved noise gaps. \texttt{INFO.MDgap}$(i)$ contains the $i$-th gap $\eta_i$ achieved by the $i$-th filter (see \textbf{Method}). \\ \hline \end{longtable} } \end{description} \subsubsection*{Method} An extension of the \textbf{Procedure AMD} from \cite[Sect.\ 6.3]{Varg17} is implemented, which relies on the nullspace-based synthesis method proposed in \cite{Varg09h}. Assume that the $j$-th model has the input-output form \begin{equation}\label{amd:systemi} {\mathbf{y}}^{(j)}(\lambda) = G_u^{(j)}(\lambda){\mathbf{u}}^{(j)}(\lambda) + G_d^{(j)}(\lambda){\mathbf{d}}^{(j)}(\lambda) + G_w^{(j)}(\lambda){\mathbf{w}}^{(j)}(\lambda) \end{equation} and the resulting $i$-th filter $Q^{(i)}(\lambda)$ has the input-output form \begin{equation}\label{amd:detec1i} {\mathbf{r}}^{(i)}(\lambda) = Q^{(i)}(\lambda)\left [ \begin{array}{c} {\mathbf{y}}(\lambda)\\{\mathbf{u}}(\lambda)\end{array} \right ] \, . \end{equation} The synthesis method, which underlies \textbf{Procedure AMD}, essentially determines each filter $Q^{(i)}(\lambda)$ as a stable rational left annihilator of \[ G^{(i)}(\lambda) := \left [ \begin{array}{cc} G_u^{(i)}(\lambda) & G_d^{(i)}(\lambda) \\ I_{m_u} & 0 \end{array} \right ] ,\] such that for $i\neq j$ we have $[\, R_u^{(i,j)}(\lambda)\; R_d^{(i,j)}(\lambda) \,] \neq 0$, where \[ R^{(i,j)}(\lambda) := [\, R_u^{(i,j)}(\lambda)\; R_d^{(i,j)}(\lambda) \; R_w^{(i,j)}(\lambda)\,] = Q^{(i)}(\lambda) \left [ \begin{array}{ccc} G_u^{(j)}(\lambda) & G_d^{(j)}(\lambda) & G_w^{(j)}(\lambda) \\ I_{m_u} & 0 & 0\end{array} \right ] \] is the internal form of $Q^{(i)}(\lambda)$ with respect to the $j$-th model. Additionally, the gap $\eta_i$ achieved by the $i$-th filter is maximized. \index{model detection!distance mapping} \index{performance evaluation!model detection!distance mapping} The resulting $N\times N$ matrix \texttt{INFO.MDperf} can be used for the assessment of the achieved distance mapping performance of the resulting model detection filters (see Section \ref{sec:mdperf} for definitions). If \texttt{OPTIONS.MDFreq} is empty, then \texttt{INFO.MDperf}$(i,j) = \big\| \big[\, R_u^{(i,j)}(\lambda)\; R_d^{(i,j)}(\lambda) \,\big] \big\|_\infty$ if \texttt{OPTIONS.emdtest = true} and \texttt{INFO.MDperf}$(i,j) = \big\| R_u^{(i,j)}(\lambda) \big\|_\infty$ if \texttt{OPTIONS.emdtest = false}, and, ideally, represents a measure of the distance between the $i$-th and $j$-th component systems. If \texttt{OPTIONS.MDFreq} contains a set of $n_f$ real frequency values $\omega_k$, $k = 1, \ldots, n_f$ and $\lambda_k$, $k = 1, \ldots, n_f$ are the corresponding complex frequencies (see the description of \texttt{OPTIONS.MDFreq}), then \texttt{INFO.MDperf}$(i,j)$ $= \max_k\big\|\big[\, R_u^{(i,j)}(\lambda_k)\; R_d^{(i,j)}(\lambda_k) \,\big]\big\|_\infty$ if \texttt{OPTIONS.emdtest = true} and \texttt{INFO.MDperf}$(i,j) =$ $\max_k\big\| R_u^{(i,j)}(\lambda_k) \big\|_\infty$ if \texttt{OPTIONS.emdtest = false}. In this case, the entry \texttt{INFO.MDperf}$(i,j)$ ideally represents a measure of the maximum distance between the frequency responses of the $i$-th and $j$-th component systems, evaluated in the selected set of frequency values. If \texttt{OPTIONS.normalize = true}, then for each row $i$, the filters \texttt{Q\{i\}} and \texttt{R\{i,j\}} are scaled such that the least value of \texttt{INFO.MDperf}$(i,j)$ for $i\neq j$ is normalized to one. The standard normalization is performed if \texttt{OPTIONS.normalize = false}, in which case \texttt{INFO.MDperf}$(1,j)$ = \texttt{INFO.MDperf}$(j,1)$ for $j > 1$. \index{performance evaluation!model detection!noise gap} The $N$-dimensional vector \texttt{INFO.MDgap}, contains the resulting noise gaps $\eta_i$, for $i = 1, \ldots, N$ (see Section \ref{sec:mdgap} for definitions). If \texttt{OPTIONS.MDFreq} is empty, then $\eta_i$ is evaluated as \begin{equation}\label{gapi_ext} \eta_i := \min_{j\neq i} \big\|\big[\,R_u^{(i,j)}(\lambda)\; R_d^{(i,j)}(\lambda)\,\big]\big\|_\infty/\big\|R_w^{(i,i)}(\lambda)\big\|_\infty , \end{equation} if \texttt{OPTIONS.emdtest = true} and \begin{equation}\label{gapi} \eta_i := \min_{j\neq i} \big\|R_u^{(i,j)}(\lambda)\big\|_\infty/\big\|R_w^{(i,i)}(\lambda)\big\|_\infty , \end{equation} if \texttt{OPTIONS.emdtest = false}. If \texttt{OPTIONS.MDFreq} contains a set of $n_f$ real frequency values $\omega_k$, $k = 1, \ldots, n_f$ and $\lambda_k$, $k = 1, \ldots, n_f$ are the corresponding complex frequencies (see the description of \texttt{OPTIONS.MDFreq}), then \begin{equation}\label{gapifr-ext} \eta_i := \min_{j\neq i}\max_k \big\|\big[\,R_u^{(i,j)}(\lambda_k)\; R_d^{(i,j)}(\lambda_k)\,\big]\big\|_2/\big\|R_w^{(i,i)}(\lambda)\big\|_\infty , \end{equation} if \texttt{OPTIONS.emdtest = true} and \begin{equation}\label{gapifr} \eta_i := \min_{j\neq i}\max_k \big\|R_u^{(i,j)}(\lambda_k)\big\|_2/\big\|R_w^{(i,i)}(\lambda)\big\|_\infty , \end{equation} if \texttt{OPTIONS.emdtest = false}. Each filter $Q^{(i)}(\lambda)$ is determined in the product form \begin{equation}\label{amdsym:Qprod} Q^{(i)}(\lambda) = Q_4^{(i)}(\lambda)Q_3^{(i)}(\lambda)Q_2^{(i)}(\lambda)Q_1^{(i)}(\lambda) , \end{equation} where the factors are determined as follows: \begin{itemize} \item[(a)] $Q_1^{(i)}(\lambda) = N_l^{(i)}(\lambda)$, with $N_l^{(i)}(\lambda)$ a $\big(p-r_d^{(i)}\big) \times (p+m_u)$ proper rational left nullspace basis satisfying $N_l^{(i)}(\lambda)G^{(i)}(\lambda) = 0$, with $r_d^{(i)} := \text{rank}\, G_d^{(i)}(\lambda)$; ($n_v^{(i)} := p-r_d^{(i)}$ is the number of basis vectors) \item[(b)] $Q_2^{(i)}(\lambda)$ is an admissible regularization factor guaranteeing model detectability; \item[(c)] $Q_3^{(i)}(\lambda)$ represents an optimal choice to maximize the $i$-th gap $\eta_i$ in (\ref{gapi_ext}) -- (\ref{gapifr}); \item[(d)] $Q_4^{(i)}(\lambda)$ is a stable invertible factor determined such that $Q^{(i)}(\lambda)$ has a desired dynamics. \end{itemize} The computations of individual factors depend on the user's options and the optimization problem features. Specific choices are discussed in what follows. \subsubsection*{Computation of $Q_1^{(i)}(\lambda)$} If \texttt{OPTIONS.nullspace = true}, then the left nullspace basis $N_l^{(i)}(\lambda)$ is determined as a stable minimal proper rational basis, or, if \texttt{OPTIONS.nullspace = false} (the default option) and $m_d^{(i)} = 0$, then the simple observer based basis $N_l^{(i)}(\lambda) = [\, I \; -G_u^{(i)}(\lambda)\,]$ is employed. If $N_l^{(i)}(\lambda)$ is a minimal rational basis and if \texttt{OPTIONS.simple = true}, then $N_l^{(i)}(\lambda)$ is determined as a simple rational basis and the orders of the basis vectors are provided in \texttt{INFO.degs}. These are also the degrees of the basis vectors of an equivalent polynomial nullspace basis. The dynamics of $Q_1^{(i)}(\lambda)$ is specified via \texttt{OPTIONS.sdeg} and \texttt{OPTIONS.poles}. \subsubsection*{Computation of $Q_2^{(i)}(\lambda)$} Let $r_w^{(i)}$ be the rank of $\overline G_w^{(i,i)}(\lambda) := Q_1^{(i)}(\lambda) \left[\begin{smallmatrix} G_w^{(i)}(\lambda) \\ 0 \end{smallmatrix}\right]$ and let $q_i$ be the desired number of residual outputs for the $i$-th filter. If \texttt{OPTIONS.rdim} is nonempty, then $q_i = \texttt{OPTIONS.rdim}\{i\}$, while if \texttt{OPTIONS.rdim} is empty a default value of $q_i$ is defined depending on the setting of $\texttt{OPTIONS.HDesign}\{i\}$ and \texttt{OPTIONS.minimal}. If $\texttt{OPTIONS.HDesign}\{i\}$ is nonempty, then $q_i$ is the row dimension of the design matrix contained in $\texttt{OPTIONS.HDesign}\{i\}$. If $\texttt{OPTIONS.HDesign}\{i\}$ is empty, then $q_i = 1$ if \texttt{OPTIONS.minimal = true}. If \texttt{OPTIONS.minimal = false} and $r_w^{(i)} = 0$, then $q_i = p-r_d^{(i)}$, while if $r_w^{(i)} > 0$, then $q_i = r_w^{(i)}$. If \texttt{OPTIONS.minimal = false}, then $Q_2^{(i)}(\lambda) = M^{(i)}(\lambda) H^{(i)}$, where $H^{(i)}$ is a suitable $q_i\times \big(p-r_d^{(i)}\big)$ full row rank design matrix and $M^{(i)}(\lambda)$ is a stable invertible transfer function matrix determined such that $Q_2^{(i)}(\lambda)Q_1^{(i)}(\lambda)$ has a desired dynamics (specified via \texttt{OPTIONS.sdeg} and \texttt{OPTIONS.poles}). $H^{(i)}$ is set as follows. If \texttt{OPTIONS.HDesign}$\{i\}$ is nonempty, then $H^{(i)} = \texttt{OPTIONS.HDesign}\{i\}$. If \texttt{OPTIONS.HDesign}$\{i\}$ is empty, the matrix $H^{(i)}$ is chosen to build $q_i$ linear combinations of the $p-r_d^{(i)}$ left nullspace basis vectors, such that $H^{(i)}Q_1^{(i)}(\lambda)$ has full row rank. If $q_i = p-r_d^{(i)}$ then the choice $H^{(i)} = I_{p-r_d^{(i)}}$ is used, otherwise $H^{(i)}$ is chosen a randomly generated $q_i \times \big(p-r_d^{(i)}\big)$ real matrix. If \texttt{OPTIONS.minimal = true}, then $Q_2^{(i)}(\lambda)$ is a $q_i\times \big(p-r_d^{(i)}\big)$ transfer function matrix, with $q_i$ chosen as above. $Q_2^{(i)}(\lambda)$ is determined in the form \[ Q_2^{(i)}(\lambda) = M^{(i)}(\lambda)\widetilde Q_2^{(i)}(\lambda) \, , \] where $\widetilde Q_2^{(i)}(\lambda) := H^{(i)}+Y_2^{(i)}(\lambda)$, $\widetilde Q_2^{(i)}(\lambda)Q_1^{(i)}(\lambda)$ $\big(\! = H^{(i)}N_l^{(i)}(\lambda)+Y_2^{(i)}(\lambda)N_l^{(i)}(\lambda)\big)$ and $Y_2^{(i)}(\lambda)$ are the least order solution of a left minimal cover problem \cite{Varg17g}, and $M^{(i)}(\lambda)$, a stable invertible transfer function matrix determined such that $M^{(i)}(\lambda)\widetilde Q_2^{(i)}(\lambda)Q_1^{(i)}(\lambda)$ has a desired dynamics. If \texttt{OPTIONS.HDesign}$\{i\}$ is nonempty, then $H^{(i)} = \texttt{OPTIONS.HDesign}\{i\}$, and if \texttt{OPTIONS.HDesign}$\{i\}$ is empty, then a suitable randomly generated $H^{(i)}$ is employed (see above). \emph{Note:} The stabilization with $M^{(i)}(\lambda)$ is only performed if $r_w^{(i)} = 0$ (i.e., to also cover the case of an exact synthesis). The structure field \texttt{INFO.HDesign}$\{i\}$ contains the employed value of the design matrix $H^{(i)}$. \subsubsection*{Computation of $Q_3^{(i)}(\lambda)$} Let define $\widetilde G_w^{(i,i)}(\lambda) := Q_2^{(i)}(\lambda)\overline G_w^{(i,i)}(\lambda)$ and let $\tilde r_w^{(i)} = \mathop{\mathrm{rank}} \widetilde G_w^{(i,i)}(\lambda)$, which satisfies $\tilde r_w^{(i)} \leq q_i$. If $\tilde r_w^{(i)} = 0$ then $Q_3^{(i)}(\lambda) = I$. If $\tilde r_w^{(i)} > 0$, then the quasi-co-outer--co-inner factorization of $\widetilde G_w^{(i,i)}(\lambda)$ is computed as \[ \widetilde G_w^{(i,i)}(\lambda) = R_{wo}^{(i)}(\lambda)R_{wi}^{(i)}(\lambda) ,\] where $R_{wo}^{(i)}(\lambda)$ is a (full column rank) quasi-co-outer factor and $R_{wi}^{(i)}(\lambda)$ is a (full row rank) co-inner factor. In the \emph{standard case} $R_{wo}^{(i)}(\lambda)$ is outer (i.e., has no zeros on the boundary of the stability domain $\partial\mathds{C}_s$) and thus, there exists a stable left inverse $\big(R_{wo}^{(i)}(\lambda)\big)^{-L}$ such that $\big(R_{wo}^{(i)}(\lambda)\big)^{-L}R_{wo}^{(i)}(\lambda) = I$. In this case, we choose $Q_3^{(i)}(\lambda) = \big(R_{wo}^{(i)}(\lambda)\big)^{-L}$. This is an optimal choice which ensures that the maximal gap $\eta_i$ is achieved by the $i$-th filter (see below). If $\tilde r_w = q_i$ (the usual case), then $Q_3^{(i)}(\lambda)$ is simply $Q_3^{(i)}(\lambda) = \big(R_{wo}^{(i)}(\lambda)\big)^{-1}$. In the \emph{non-standard case} $R_{wo}^{(i)}(\lambda)$ is only quasi-outer and thus, has zeros on the boundary of the stability domain $\partial\mathds{C}_s$. Depending on the selected option to handle nonstandard optimization problems \texttt{OPTIONS.nonstd}, several choices are possible for $Q_3^{(i)}(\lambda)$ in this case: \begin{itemize} \item If \texttt{OPTIONS.nonstd} = 1, then $Q_3^{(i)}(\lambda) = \big(R_{wo}^{(i)}(\lambda)\big)^{-L}$ is used, where all spurious poles of the left inverse are assigned to values specified via \texttt{OPTIONS.sdeg} and \texttt{OPTIONS.poles}. \item If \texttt{OPTIONS.nonstd} = 2, then a modified co-outer--co-inner factorization of $[\,R_{wo}^{(i)}(\lambda)\;\epsilon I\,]$ is computed, whose co-outer factor $R_{wo,\epsilon}^{(i)}(\lambda)$ satisfies \[ R_{wo,\epsilon}^{(i)}(\lambda)\big(R_{wo,\epsilon}^{(i)}(\lambda)\big)^\sim = \epsilon^2 I + R_{wo}^{(i)}(\lambda)\big(R_{wo}^{(i)}(\lambda)\big)^\sim . \] Then $Q_3^{(i)}(\lambda) = \big(R_{wo,\epsilon}^{(i)}(\lambda)\big)^{-L}$ is used. The value of the regularization parameter $\epsilon$ is specified via \texttt{OPTIONS.epsreg}. \item If \texttt{OPTIONS.nonstd} = 3, then a Wiener-Hopf type co-outer--co-inner factorization is computed in the form \begin{equation}\label{WHfact-md} \widetilde G_w^{(i,i)}(\lambda) = R_{wo}^{(i)}(\lambda)R_{wb}^{(i)}(\lambda)R_{wi}^{(i)}(\lambda) ,\end{equation} where $R_{wo}^{(i)}(\lambda)$ is co-outer, $R_{wi}^{(i)}(\lambda)$ is co-inner, and $R_{wb}^{(i)}(\lambda)$ is a square stable factor whose zeros are precisely the zeros of $\widetilde G_w^{(i,i)}(\lambda)$ in $\partial\mathds{C}_s$. $Q_3^{(i)}(\lambda)$ is determined as before $Q_3^{(i)}(\lambda) = \big(R_{wo}^{(i)}(\lambda)\big)^{-L}$. \item If \texttt{OPTIONS.nonstd} = 4, then the Wiener-Hopf type co-outer--co-inner factorization (\ref{WHfact-md}) is computed and $Q_3^{(i)}(\lambda)$ is determined as $Q_3^{(i)}(\lambda) = \big(R_{wb}^{(i)}(\tilde{\lambda})\big)^{-1}\big(R_{wo}^{(i)}(\lambda)\big)^{-1}$, where $\tilde{\lambda}$ is a small perturbation of $\lambda$ to move all zeros of $R_{wb}^{(i)}(\lambda)$ into the stable domain. In the continuous-time case $\tilde s = \frac{s-\beta_z}{1-\beta_zs}$, while in the discrete-time case $\tilde z = z/\beta_z$, where the zero shifting parameter $\beta_z$ is the prescribed stability degree for the zeros specified in \texttt{OPTIONS.sdegzer}. For the evaluation of $R_{wb}^{(i)}(\tilde\lambda)$, a suitable bilinear transformation is performed. \item If \texttt{OPTIONS.nonstd} = 5, then the Wiener-Hopf type co-outer--co-inner factorization (\ref{WHfact-md}) is computed and $Q_3^{(i)}(\lambda)$ is determined as $Q_3^{(i)}(\lambda) = \big(R_{wb,\epsilon}^{(i)}(\lambda)\big)^{-1}\big(R_{wo}^{(i)}(\lambda)\big)^{-1}$, where $R_{wb,\epsilon}^{(i)}(\lambda)$ is the co-outer factor of the co-outer--co-inner factorization of $\big[\, R_{wb}^{(i)}(\lambda) \; \epsilon I\,\big]$ and satisfies \[ R_{wb,\epsilon}^{(i)}(\lambda)\big(R_{wb,\epsilon}^{(i)}(\lambda)\big)^\sim = \epsilon^2 I + R_{wb}^{(i)}(\lambda)\big(R_{wb}^{(i)}(\lambda)\big)^\sim . \] The value of the regularization parameter $\epsilon$ is specified via \texttt{OPTIONS.epsreg}. \end{itemize} A typical feature of the non-standard case is that, with the exception of using the option \texttt{OPTIONS.nonstd} = 3, all other choices of \texttt{OPTIONS.nonstd} lead to a poor dynamical performance of the resulting filter, albeit arbitrary large noise gaps $\eta_i$ can be occasionally achieved. \subsubsection*{Computation of $Q_4^{(i)}(\lambda)$} In the standard case, $Q_4^{(i)}(\lambda) = I$. In the non-standard case, $Q_4^{(i)}(\lambda)$ is a stable invertible transfer function matrix determined such that $Q^{(i)}(\lambda)$ in (\ref{amdsym:Qprod}) has a desired dynamics (specified via \texttt{OPTIONS.sdeg} and \texttt{OPTIONS.poles}). \subsubsection*{Example} \begin{example} \label{ex:Ex6.2} This is Example 6.2 from the book \cite{Varg17}, which deals with a continuous-time state-space model, describing, in the fault-free case, the lateral dynamics of an F-16 aircraft with the matrices\\[-2mm] \[ {\arraycolsep=1mm A^{(1)}\! =\! \left [ \begin{array}{rrrr} -0.4492& 0.046& 0.0053& -0.9926\\ 0& 0& 1.0000& 0.0067\\ -50.8436& 0& -5.2184& 0.7220\\ 16.4148& 0& 0.0026& -0.6627 \end{array} \right ], \;\; B_u^{(1)} \!=\! \left [ \begin{array}{rr} 0.0004& 0.0011\\ 0& 0\\ -1.4161& 0.2621\\ -0.0633& -0.1205 \end{array} \right ],} \;\, B_w^{(1)} \!=\! [\, I_4 \; 0_{4\times 2}\,] \; , \] \[ C^{(1)} = \left [ \begin{array}{cccc} 57.2958 & 0 & 0 & 0\\ 0 & 57.2958 & 0 & 0 \end{array} \right ], \;\, D_u^{(1)} = 0_{2\times 2} , \;\, D_w^{(1)} = [\, 0_{2\times 4} \;\; I_2\,] \, .\] The four state variables are the sideslip angle, roll angle, roll rate and yaw rate, and the two input variables are the aileron deflection and rudder deflection. The two measured outputs are the sideslip angle and roll angle, and, additionally input noise and output noise are included in the model. The component system matrices in (\ref{amdsyn:sysiss}) are defined for $i = 1, 2, \ldots, N$ as: $E^{(i)} = I_4$, $A^{(i)} = A^{(1)}$, $C^{(i)} = C^{(1)}$, $B_w^{(i)} = B^{(1)}_w$, $D_w^{(i)} = D^{(1)}_w$, and $B_u^{(i)} = B^{(1)}_u \Gamma^{(i)}$, where $\Gamma^{(i)} = \mathop{\mathrm{diag}} \big(1-\rho_1^{(i)},1-\rho_2^{(i)}\big)$ and $\big(\rho_1^{(i)},\rho_2^{(i)}\big)$ are the values of parameters $(\rho_1,\rho_2)$ on the chosen grid points:\\[-6mm] \begin{center} {\tabcolsep=2mm\begin{tabular}{|r|rrrrrrrrr|} \hline $\rho_1:$ & 0 & 0 & 0 & 0.5 & 0.5 & 0.5 & 1 & 1 & 1 \\ $\rho_2:$ & 0 & 0.5 & 1 & 0 & 0.5 & 1 & 0 & 0.5 & 1 \\\hline \end{tabular} . } \end{center} The TFMs $G_u^{(i)}(s)$ and $G_w^{(i)}(s)$ of the $i$-th system can be expressed as \begin{equation}\label{Gui_ex2} G_u^{(i)}(s) = G_u^{(1)}(s)\Gamma^{(i)}, \quad G_w^{(i)}(s) = G_w^{(1)}(s) \; ,\end{equation} where\\[-6mm] \[ G_u^{(1)}(s) = C^{(1)}\big(sI-A^{(1)}\big)^{-1}B^{(1)}_u, \quad G_w^{(1)}(s) = C^{(1)}\big(sI-A^{(1)}\big)^{-1}B^{(1)}_w + D^{(1)}_w \, .\] The individual fault models correspond to different degrees of surface efficiency degradation. The values $\big(\rho_1^{(1)},\rho_2^{(1)}\big) = (0,0)$ correspond to the fault-free situation, while $G_u^{(N)}(s) = 0$ describes the case of complete failure. The approximate model detection problem addresses the synthesis of model detection filters for the detection and identification of loss of efficiency of the two flight actuators, which control the deflections of the aileron and rudder, in the presence of noise inputs. For the design of the model detection system, we aim to determine the $N$ filters $Q^{(i)}(s)$, $i = 1, \ldots, N$ having satisfactory dynamic responses and exhibiting the maximally achievable gaps. In Fig.~\ref{AMDExampletimeresp} the time responses of the residual evaluation signals $\theta_i(t)$ are presented, where $\theta_i(t)$ are computed using a Narendra-type evaluation filter \cite{Nare97} with input $\|r^{(i)}(t)\|_2^2$ and parameters $\alpha = 0.9$, $\beta = 0.1$, $\gamma=10$ (see also Remark 3.13 in \cite{Varg17}). The control inputs have been chosen as follows: $u_1(t)$ is a step of amplitude 0.3 added to a square wave of period $2\pi$, and $u_2(t)$ is a step of amplitude 1.5 added to a sinus function of unity amplitude and period $\pi$. The noise inputs are zero mean white noise of amplitude 0.01 for the input noise and 0.03 for the measurement noise. Each column corresponds to a specific model for which the time responses of the $N$ residual evaluation signals are computed. The achieved typical structure matrix for model detection (with zeros down the diagonal) can easily be read out from this signal based assessment, even in presence of noise. \begin{figure}[thpb] \begin{center} \hspace*{-1cm} \includegraphics[width=13.5cm]{varga_Fig_Ex_AMD.jpg} \vspace*{-.4cm} \caption{Time responses of evaluation signals for optimal syntheses} \label{AMDExampletimeresp} \end{center} \end{figure} The following script implements the model building, synthesis and analysis steps. \begin{verbatim} A = [-.4492 .046 .0053 -.9926; 0 0 1 .0067; -50.8436 0 -5.2184 .722; 16.4148 0 .0026 -.6627]; Bu = [.0004 .0011; 0 0; -1.4161 .2621; -.0633 -.1205]; [n,mu] = size(Bu); p = 2; mw = n+p; m = mu+mw; Bw = eye(n,mw); C = 180/pi*eye(p,n); Du = zeros(p,mu); Dw = [zeros(p,n) eye(p)]; Gamma = 1 - [ 0 0 0 .5 .5 .5 1 1 1; 0 .5 1 0 .5 1 0 .5 1 ]'; N = size(Gamma,1); sysuw = ss(zeros(p,mu+mw,N,1)); for j = 1:N sysuw(:,:,j,1) = ss(A,[Bu*diag(Gamma(j,:)) Bw],C,[Du Dw]); end sysuw = mdmodset(sysuw,struct('controls',1:mu,'noise',mu+(1:mw))); opt_amdsyn = struct('sdeg',-1,'poles',-1,'minimal',false); [Q,R,info] = amdsyn(sysuw,opt_amdsyn); info.MDperf, info.MDgap figure, mesh(info.MDperf), colormap hsv title('Model detection performance') ylabel('Residual numbers') xlabel('Model numbers') d = diag([ 1 1 0.01 0.01 0.01 0.01 0.03 0.03]); t = (0:0.01:10)'; ns = length(t); usin = gensig('sin',pi,t(end),0.01)+1.5; usquare = gensig('square',pi*2,t(end),0.01)+0.3; u = [ usquare usin (rand(ns,mw)-0.5)]*d; figure k1 = 0; alpha = 0.9; beta = 0.1; gamma = 10; for j = 1:N, k1 = k1+1; k = k1; for i=1:N, subplot(N,N,k), [r,t] = lsim(R{j,i},u,t); theta = alpha*sqrt(r(:,1).^2+r(:,2).^2)+... beta*sqrt(lsim(tf(1,[1 gamma]),r(:,1).^2+r(:,2).^2,t)); plot(t,theta), if i == 1, title(['Model ',num2str(j)]), end if i == j, ylim([0 1]), end if j == 1, ylabel(['\theta_', num2str(i)],'FontWeight','bold'), end if i == N && j == 5, xlabel('Time (seconds)','FontWeight','bold'), end k = k+N; end end \end{verbatim} \end{example} \bookmarksetup{startatroot} \cleardoublepage \phantomsection \newpage \pdfbookmark[1]{References}{Refs}
{'timestamp': '2018-11-21T02:12:50', 'yymm': '1703', 'arxiv_id': '1703.08480', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08480'}
arxiv
\section{Introduction} \subsection{Motivation} When tasked with random sampling from a complicated state space, a popular choice is to run a rapidly mixing Markov chain. Markov chains have proven to be an incredibly powerful and versatile tool, however, there are several reasons why one would consider alternative methods. In particular, unless the chain starts off in stationarity, or has been coupled from the past~\cite{ProppWilson}, the error is seldom zero after a finite number of steps; quite often this is an acceptable tradeoff, and through a more complicated analysis one can bound the sampling error. For sampling problems with a large number of constraints, however, it is often difficult to analyze the resulting Markov chain and prove mixing time bounds. In addition, there is no general scheme to parallelize the sequential steps in a Markov chain, and many naive approaches can lead to unintended sampling bias~\cite[Chapter~18]{wilkinson2006parallel}. Another paradigm of random sampling, popular in combinatorics, is the Boltzmann sampler~\cite{Boltzmann, Flajolet}, where one samples from some combinatorial structure via independent random variables, determined by the form of the generating function to closely resemble the true distribution of component sizes in the random combinatorial structure. The result is a random combinatorial object with a random set of statistics, referred to as a \emph{grand canonical ensemble} in the statistical mechanics literature. For a fixed set of conditions, an exact sample can be obtained by sampling repeatedly until all of the conditions are satisfied, throwing away samples which miss the target~\cite{Duchon:2011aa}. We have the structure which is typical of Boltzmann sampling, which is a collection of independent random variables subject to a condition. However, unlike the plethora of combinatorial structures for which a randomly generated structure with random statistics contains an acceptable amount of bias, there are good reasons to demand that all statistics are satisfied, see for example~\cite{chen, PittelSetPartitions}. Fortunately, owing to the large amount of independence in the formulation, Boltzmann samplers are embarrassingly parallel, offering many different effective means of parallelizing the computation. Unfortunately, as with many multivariate combinatorial structures, the rejection costs associated with waiting until all statistics match exactly are prohibitively large, even with effective parallelizing. The Boltzmann sampler has been described as a generalization of the table methods of Nijenhuis and Wilf, also known as the \emph{recursive method}, see~\cite{NW}, although from our point of view it has a distinctly different flavor. The recursive method champions creating a table of numerical values which can be used to generate individual components of a sample in its correct proportion in an unbiased sample. This approach, however, demands the computing of a lookup table, which can be both prohibitively large in size and prohibitively long to compute each entry, typically by a recursion. Our approach lies somewhere in between the recursive method and Boltzmann sampling, with a distinctly probabilistic twist, and which avoids Markov chains altogether. Our approach, \emph{probabilistic divide-and-conquer} (PDC)~\cite{PDC}, provides an object which satisfies all constraints, and which targets the marginal distribution of components, in this case entries in a table, according to the Boltzmann sampling principle. Rather than sample all entries of the table at once and apply a rejection function which is either 0 or 1, we instead sample one bit of each entry in the table, one at a time, essentially building the table via its bits, starting with the least significant bit. In the case where rejection sampling probabilities are known or can be computed to arbitrary accuracy, the algorithm is unbiased. Probabilistic divide-and-conquer is similar in many respects to the recursive method, by approaching the problem in pieces and selecting a piece in proportion to already observed pieces. However, whereas the recursive method typically involves a more geometric/spatial decomposition of a finite, discrete sample space, we instead champion a probabilistic decomposition of the sample space, by decomposing the random variables themselves which describe random component-sizes. This approach also generalizes in a straightforward manner to sampling from continuous sample spaces and lower dimensional subspaces, see~\cite{PDCDSH}, as long as the random variables can be decomposed effectively. In the remainder of this section, we define $(r,c)$-contingency tables and Latin squares of order~$n$, and describe some of the standard algorithms to randomly sample them. Section~\ref{novel_algorithm} contains the highest-level explanation of our proposed algorithm for Latin squares of order~$n$, and in Section~\ref{section_probabilistic} we present the probabilistic tools which justify this approach. Section~\ref{algorithms} contains the complete statements of the algorithms, along with a word of caution in the final subsection. \subsection{$(r,c)$-contingency tables} \begin{definition} An \emph{$(r,c)$-contingency table} is an $m$ by $n$ table of nonnegative integer values with row sums given by $r = (r_1, \ldots, r_m)$ and column sums given by $c = (c_1, \ldots, c_n)$. A table for which the entries are further assumed to be in the set $\{0,1\}$ is called a \emph{binary $(r,c)$-contingency table}. \end{definition} The exact, uniform sampling from the set of $(r,c)$-contingency tables is a well-studied problem. Owing to the large parameter space, there are a plethora of results spanning many decades pertaining just to counting the number of such tables, see for example~\cite{Barvinok, BenderTables, Soules, BaldoniSilva, DeLoeraRational, BarvinokInequalities, BarvinokPermanents, GreenhillMcKay, BarvinokIntegerFlows, BarvinokApproximate, BarvinokHartigan, DiaconisGangolli, bender1978asymptotic, ONeil, GoodCrook}. There is also interest in various Markov chain approaches, including coupling from the past, see for example~\cite{chen, cryan2003polynomial, cryan2006rapidly, diaconissturmfels, fishman2012counting, dyergreenhill,kitajimamatsui, JerrumSinclair, Brualdi2007}. The random sampling of contingency tables is an extensive topic, and we do not attempt to recount all previously known results in this area, and instead refer the interested reader to, e.g., the introduction in~\cite{cryan2006rapidly} and the references therein. As mentioned previously, the main sampling approach traditionally championed is to use a Markov chain, e.g., starting with the general framework in~\cite{diaconissturmfels}, to define an appropriate state transition matrix, and then prove that such a chain is rapidly mixing; indeed, this approach has been profoundly fruitful, see for example~\cite{dyergreenhill, kitajimamatsui, JerrumSinclair}. Explicitly, one state transition championed in~\cite{DiaconisGangolli} is to sample two ordered rows and two ordered columns uniformly at random, and, \emph{if possible}, apply the transformation to their entries \[ \left(\begin{array}{cc} a_{11} & a_{12} \\ a_{21} & a_{22} \end{array}\right) \to \left(\begin{array}{cc} a_{11}+1 & a_{12} - 1 \\ a_{21} -1 & a_{22} + 1 \end{array}\right). \] If such a transformation would force the table to lie outside the solution set, then a different pair of ordered rows and columns is generated. This chain was shown in~\cite{DiaconisGangolli} to be ergodic and converge to the uniform distribution over the set of contingency tables. Mixing times were later proved in~\cite{diaconis1993comparison, hernek1998random, chung1996sampling} in various contexts. Other Markov chains have also been proposed, see for example~\cite{dyergreenhill, cryan2006rapidly}. The recent book~\cite{huber2015perfect} also contains many more examples involving Markov chains and coupling from the past to obtain exact samples. An arguably unique approach to random sampling of contingency tables is contained in~\cite{dyer1997sampling}. The algorithm associates to each state a parallelepiped with respect to some basis, and defines some convex set which contains all of the parallelepipeds. Then, one samples from this convex set, and if the sample generated lies within one of the parallelepipeds, it returns the corresponding state; otherwise, restart. This algorithm was shown to be particularly effective in~\cite{morris2002improved} when the row sums are all $\Omega(n^{3/2} m\log m)$ and the column sums are all $\Omega(m^{3/2} n\log n)$. Recently, a self-similar PDC algorithm was championed for the random sampling of contingency tables~\cite{DeSalvoCT}, offering an arguably new approach to random sampling of these intricate structures. In related work, the author demonstrated how to utilize PDC to improve upon existing algorithms for exact random sampling of Latin squares of order~$n$~\cite{DeSalvoSudoku}. The current work, motivated by improving further still the random sampling of Latin squares of order $n$, extends the original PDC sampling algorithm for contingency tables to the more general case when certain entries are forced to be 0, see for example~\cite{BrualdiDahl, bezakova}. The probabilistic analysis is straightforward, although the computational complexity changes drastically. Nevertheless, our numerical experiments demonstrate that this approach is simple, practical and executes fairly rapidly for a large class of tables. Thus, we champion our approach for practitioners looking for simple, alternative methods for sampling quickly from these intricate structures. \subsection{Latin squares of order~$n$} \label{novel_algorithm} \begin{definition} A Latin square of order $n$ is an $n \times n$ table of values such that the numbers from the set $\{1,2,\ldots, n\}$ appear exactly once in each row and in each column. \end{definition} There are many techniques available for random sampling of Latin squares of order~$n$, see for example~\cite[Section~6]{DeSalvoSudoku}. A Markov chain approach is contained in~\cite{JacobsonMatthews}; in particular, they construct and analyze two different Markov chains. The transition states are described via an explicit algorithm, requiring $O(n)$ time to transition from one state to the next, and guaranteed to satisfy all of the Latin square constraints. However, as far as we are aware, even though the stationary distribution was proved to be uniform over the set of Latin squares of order~$n$, neither of the Markov chains presented have been shown to be rapidly mixing. Another approach is to decompose the entries of a Latin square as sums of mutually disjoint permutation matrices, as in~\cite{Dahl, Fontana, FontanaFractions, YordzhevNumber}. This approach has practical limitations, as the straightforward rejection algorithm is prohibitive, and the more involved approach in~\cite{Fontana} requires an auxiliary computation which dominates the cost of the algorithm. We suspect that this approach may benefit from a probabilistic divide-and-conquer approach, though we have not carried out the relevant analysis. An informal description of our algorithm for random sampling of Latin squares of order~$n$ is as follows; see Algorithm~\ref{latin:square:algorithm} for the complete description. For simplicity of exposition, we assume $n = 2^m$ for some positive integer $m$, which has no theoretical significance, but avoids cumbersome notation involving rounding. First, sample an $n \times n$ binary contingency table with all row sums and column sums equal to $n/2$. Then consider the subset of entries in which a 1 appears, of which there are $n/2$ in each row and column, and sample within that subset of entries an $(n/2) \times (n/2)$ binary contingency table with all row sums and column sums equal to $n/4$; do the same for the subset of entries in which a 0 appears. Repeat this process through all $m$ levels. By interpreting the sequence of $m$ 1s and 0s as the binary expansion of a positive integer, we obtain a Latin square of order~$n$. This idea, that of generating a Latin square by its bits, could be considered a straightforward divide-and-conquer algorithm if one simply desires an object from the solution set. What makes our treatment more intricate is our approximation heuristic, designed to target the uniform distribution over the solution set; see Section~\ref{latin_square_heuristic}. Of course, in order to avoid bias in the sampling algorithm, we must sample each of the $n/2^\ell \times n/2^\ell$ binary contingency tables in their correct proportion of partially completed Latin squares of order~$n$; this is not such a trivial task, and requires either counting all possible completions, a computationally extensive task, or a more direct analysis of the resulting multivariate probability governing the acceptance probability, given explicitly in Equation~\eqref{fij}. While both approaches present technical difficulties, the probabilistic formulation yields a natural approximation heuristic, which we present in Equation~\eqref{alternative:rejection}, which is computable in polynomial time. It assumes independence of columns, a reasonable approximation heuristic in many parameter spaces of interest, while still enforcing several necessary conditions. A more complete probabilistic description of our heuristic is contained in Section~\ref{latin_square_heuristic}. \begin{example} The following is an example of how to apply the algorithm described above. \[ \begin{array}{rccrcc} & & & \left( \begin{array}{ccccc} 1 & 1 & 0 & 1 & 0 \\ 0 & 1 & 1 & 0 & 1 \\ 1 & 0 & 1 & 0 & 1 \\ 1 & 0 & 1 & 1 & 0 \\ 0 & 1 & 0 & 1 & 1 \end{array} \right) & & \\ & & \swarrow & \searrow & & \\ & \left(\begin{array}{ccccc} 1 & 0 & \blacksquare & 1 & \blacksquare \\ \blacksquare & 1 & 0 & \blacksquare & 1 \\ 0 & \blacksquare & 1 & \blacksquare & 1 \\ 1 & \blacksquare & 1 & 0 & \blacksquare \\ \blacksquare & 1 & \blacksquare & 1 & 0 \end{array}\right) & & & \left( \begin{array}{ccccc} \blacksquare & \blacksquare & 0 & \blacksquare & 1 \\ 1 & \blacksquare & \blacksquare & 0 & \blacksquare \\ \blacksquare & 0 & \blacksquare & 1 & \blacksquare \\ \blacksquare & 1 & \blacksquare & \blacksquare & 0 \\ 0 & \blacksquare & 1 & \blacksquare & \blacksquare \end{array} \right)\\ \swarrow & & & & \\ \left( \begin{array}{ccccc} 1 & \blacksquare & \blacksquare & 0 & \blacksquare \\ \blacksquare & 1 & \blacksquare & \blacksquare & 0 \\ \blacksquare & \blacksquare & 0 & \blacksquare & 1 \\ 0 & \blacksquare & 1 & \blacksquare & \blacksquare \\ \blacksquare & 0 & \blacksquare & 1 & \blacksquare \end{array}\right) \\ \end{array} \] This corresponds to the following order $5$ Latin square \[ \left(\begin{array}{ccccc} 5 & 1 & 2 & 3 & 4 \\ 4 & 5 & 1 & 2 & 3 \\ 1 & 2 & 3 & 4 & 5 \\ 3 & 4 & 5 & 1 & 2 \\ 2 & 3 & 4 & 5 & 1 \end{array}\right). \] \end{example} \ignore{ \begin{remark}\label{bit_independence} It is not a priori obvious whether the bits at different levels are independent, and whether certain configurations of binary tables at a given level can potentially be completed by a larger number of Latin squares than other configurations. For $n=6$, we are able to provide a negative answer by a simple observation. According to the OEIS sequence~A058527~\cite{OEIS}, the number of $6 \times 6$ binary contingency tables with row sums and column sums equal to 3 is 297200, which does not divide the number of Latin squares of order $6$, which is 812851200, see for example~\cite{McKayWanless}. Thus, some of the configurations of binary tables must necessarily yield a different number of completable Latin squares. Nevertheless, our approach exploits the principles of Boltzmann sampling, which has been previously utilized in various contexts involving contingency tables, see for example~\cite{barvinok2012asymptotic, barvinok2010approximation}. \end{remark} } \begin{remark} There is an extensive history related to \emph{partially completed Latin squares of order~$n$}, which are Latin squares of order~$n$ for which only some of the $n^2$ entries have been filled in, and none of those entries a priori violate any of the Latin square conditions. In particular, the treatment in~\cite[Chapter~17]{vanLintWilson} related to partially completed Latin squares pertains solely to leaving entire entries filled or unfilled, whereas the algorithm described above is of a distinctly different flavor. For example,~\cite[Theorem~17.1]{vanLintWilson} states that all Latin squares of order~$n$ with their first $k$ rows filled in can be extended to a partially completed Latin square with the first $k+1$ rows filled in, for $k=1,2,\ldots,n-1$. There are also ways of filling in elements for which no possible Latin square can be realized given those elements; in general, deciding whether a Latin square of order~$n$ with an arbitrary set of squares filled in can be completed is an NP-complete problem, see~\cite{colbourn1984complexity}. It would be interesting to explore the analogous analysis for our proposed bit-by-bit approach. \end{remark} \section{Probabilistic approach} \label{section_probabilistic} \subsection{Probabilistic divide-and-conquer} Probabilistic divide-and-conquer (PDC) is an approach for exact sampling by dividing up the sample space into two pieces, sampling each one separately, and then piecing them together appropriately~\cite{PDC}. In order to sample using PDC, one starts with a sample space $\Omega$ decomposed into two separate sets $\Omega = \mathcal{A} \times \mathcal{B}$, and writes the target distribution as \begin{equation}\label{LS} \L(S) = \L((A, B) | E), \end{equation} where $A \in \mathcal{A}$ and $B \in \mathcal{B}$ have given distributions and are independent, and $E \subset \mathcal{A}\times \mathcal{B}$ is some measurable event of the sample space. Whereas rejection sampling can be described as sampling $a$ from $\L(A)$ and $b$ from $\L(B)$, and then checking whether $(a,b) \in E$ (see Algorithm~\ref{WTGL procedure} below), PDC samples $x$ from $\L(A | E)$ and $y$ from $\L(B | E, a)$, and returns $(x,y)$ as an exact sample (see Algorithm~\ref{PDC procedure} below). \begin{algorithm}{\rm \begin{algorithmic} \State 1. Generate sample from $\L(A)$, call it $a$. \State 2. Generate sample from $\L(B)$, call it $b$. \State 3. Check if $(a,b) \in E$; if so, return $(a,b)$, otherwise restart. \end{algorithmic}} \caption{\cite{PDC} Standard rejection sampling from $\L((A,B) | E)$} \label{WTGL procedure} \end{algorithm} \begin{algorithm}{\rm \begin{algorithmic} \State 1. Generate sample from $\L(A\, |\, E)$, call it $x$. \State 2. Generate sample from $\L(B\, |\, E, A=x)$ call it $y$. \State 3. Return $(x,y)$. \end{algorithmic}} \caption{\cite{PDC} Probabilistic Divide-and-Conquer sampling from $\L((A,B) | E)$} \label{PDC procedure} \end{algorithm} \begin{lemma}{PDC Lemma~\cite[Lemma~2.1]{PDC}.} Suppose $E$ is a measurable event of positive probability. Suppose $X$ is a random element of $\A$ with distribution \begin{equation}\label{def X} \L(X) = \L( \, A \, | \, E \, ), \end{equation} and $Y$ is a random element of $\B$ with conditional distribution \begin{equation}\label{def Y} \L(Y \, | X=a ) = \L( \, B \, | \, E, A=a \, ). \end{equation} Then $(X,Y) =^d S$, i.e., the pair $(X,Y)$ has the same distribution as $S$, given by \eqref{LS}. \end{lemma} Often, however, the conditional distributions in Algorithm~\ref{PDC procedure} are not practical to sample from, and so the following PDC algorithm which uses rejection sampling has been proven to be effective and practical in many situations, see for example~\cite{PDCDSH, DeSalvoImprovements, DeSalvoSudoku}. \begin{algorithm}[H]{\rm \begin{algorithmic} \State 1. Generate sample from $\L(A),$ call it $a$. \State 2. Reject $a$ with probability $1-s(a)$, where $s(a)$ is a function of $\L(B)$, $E$; otherwise, restart. \State 3. Generate sample from $\L(B\, |\, (a,B) \in E),$ call it $y$. \State 4. Return $(a,y)$. \end{algorithmic}} \caption{PDC sampling from $\L( (A,B)\, |\, (A,B)\in E)$ using soft rejection sampling} \label{PDC procedure von Neumann} \end{algorithm} \ignore{ Of course, while we have started with the problem of sampling from one conditional distribution, now we have two! Fortunately, by splitting up the randomness into two pieces, which we have the freedom to choose based on available data, it is possible to more effectively target the smaller conditional distribution. A large class of PDC algorithms, for example, chooses $\A$ and $\B$ so that, conditional on observing $A = a$, $\{b \in \B : (a,b) \in E\}$ has cardinality at most 1, i.e., the second stage of Algorithm~\ref{PDC procedure} is deterministic, and all of the randomness is contained in the first stage. Further details and examples can be found in~\cite{PDCDSH}. The example below shows that this idea, decomposing the sample space into two pieces, one of which is deterministic, is a particularly good strategy which requires very little structural knowledge of the sample space, and provides a guaranteed speedup over traditional Boltzmann samplers. } \ignore{ \begin{example} Let us pause at this point to note a particularly elegant divide-and-conquer strategy for the random sampling of combinatorial structures of the form \[\L\left( (X_1, \ldots, X_n) \middle| \sum_{i=1}^n i\, X_i = n\right), \] where $X_1, X_2, \ldots, X_n$ are independent random variables, typically coming from some family of distributions like Poisson, geometric, or Bernoulli. Such structures are typical in combinatorics, see for example~\cite{IPARCS, Boltzmann, Flajolet}, and represent an initial benchmark for improvements to the random sampling of classical combinatorial structures like integer partitions, set partitions, etc. Consider two divisions: the first is \[ A_1 = (X_1, X_2, \ldots, X_n), \qquad B_1 = \emptyset \] and the second is, for any $I \in \{1,2,\ldots,n\}$, \[ A_2 = (X_1, \ldots, X_{I-1}, X_{I+1}, \ldots, X_n), \qquad B_2 = (X_I), \] with $E = \{ \sum_{i=1}^n i\, X_i = n\}$. The first division is in fact rejection sampling~\cite{Rejection}, whereas the second has been dubbed PDC deterministic second half, see~\cite{PDCDSH}. In order to sample from $\L(A_2 | E) = \L\left((X_1, \ldots,X_{I-1},X_{I+1},\ldots, X_n) \middle| \sum_{i=1}^n i\, X_i = n\right)$, we use what we call \emph{soft rejection sampling}, see~\cite{Rejection}, see also~\cite[Chapter 2]{devroye}. That is, we sample from $\L(A_2)$, i.e., the unconditional distribution, and apply a rejection probability to obtain the appropriate conditional distribution. The rejection probability is then \emph{proportional} to \begin{align*} \frac{\P( (X_2, \ldots, X_n) = (x_2,\ldots,x_n) | \sum_{i=1}^n i\, X_i = n)}{\P( (X_2, \ldots, X_n) = (x_2,\ldots,x_n) )}& = \frac{\P(X_1 = n - \sum_{i=2}^n i\, X_i | X_2=x_2, \ldots, X_n=x_n)}{\P(\sum_{i=1}^n i\, X_i = n)}. \\ & = \frac{\P(X_1 = n - \sum_{i=2}^n i\, x_i)}{\P(\sum_{i=1}^n i\, X_i = n)}. \end{align*} Specifically, we obtain the unbiased sampling algorithm in Algorithm~\ref{PDC discrete} below, see~\cite{PDCDSH}, where $U$ denotes a uniform random variable between $0$ and $1$, independent of all other random variables. \begin{algorithm} \caption{\cite{PDC, PDCDSH} PDC deterministic second half for sampling from $\L(\, (X_1, X_2, \ldots, X_{n})\ |\ E)$} \begin{algorithmic} \State { {\bf input:} Discrete distributions $\L(X_1), \L(X_2), \ldots, \L(X_n), E, I$} \State Sample from $\L(X_1, \ldots, X_{I-1},X_{I+1},\ldots,X_n)$, denote the observation by $x^{(I)}$. \State Let $x_I$ denote the unique value for which $(x^{(I)}, x_I) \in E$. \If {$U< \frac{P\left(X_I = x_I\right)}{\max_\ell P(X_I = \ell)}$ } \State {\bf return} $(x^{(I)},x_I)$ \Else \State {\bf restart} \EndIf \end{algorithmic} \label{PDC discrete} \end{algorithm} \begin{proposition} Choose any $I \in \{1, 2, \ldots, n\}$. Algorithm~\ref{PDC discrete} is faster, in terms of the expected number of random bits required, than an exact Boltzmann sampler by a factor of $(\max_\ell \P(X_I = \ell))^{-1}$. \end{proposition} \begin{proof} The acceptance set for Boltzmann sampling can be formulated as \[ \{(X_1, \ldots, X_{I-1}, X_{I+1},\ldots, X_n, U) : \sum_{i\neq I} i\, X_i \leq n \mbox{ and } U < \P(X_I = n - \sum_{i \neq I} i\, X_i) \}, \] and the acceptance set for PDC deterministic second half can be formulated as \[ \left\{(X_1, \ldots, X_{I-1}, X_{I+1},\ldots, X_n, U) : \sum_{i\neq I} i\, X_i \leq n \mbox{ and } U < \frac{\P(X_I = n - \sum_{i \neq I} i\, X_i)}{\max_\ell \P(X_I = \ell)} \right\}. \qedhere \] \end{proof} \end{example} \begin{remark} The PDC deterministic second half approach is \emph{not} simply an application of soft rejection sampling, see~\cite[Section~5]{PDCDSH}. Soft rejection sampling is indeed a great complementary technique for which sampling from conditional distributions can be made more accessible, but it is by no means necessary in order to apply PDC in general, especially if one can sample from the conditional distributions directly. \end{remark} } \begin{remark} A surprisingly efficient division occurs when the sets $A$, $B$, and $E$ are such that $ \L( \, B \, | \, E, A=a \, )$ is trivial for each $a \in \mathcal{A}$. In this case, it was shown in~\cite{PDC, PDCDSH}, that a nontrivial speedup can be obtained by relatively simple arguments. \end{remark} \begin{remark} A more recent application in~\cite{DeSalvoImprovements} uses the recursive method~\cite{NW, NWbook} in order to obtain both the rejection probability $s(a)$ along with the conditional distributions $\L(B | (a,B) \in E)$. It was proved to have a smaller rejection rate than exact Boltzmann sampling, and also requires less computational resources than the full recursive method. \end{remark} \ignore{ We now recall a division from~\cite{PDC} which is recursive and self-similar, and serves as the inspiration for the algorithm championed in this paper. Let $0<x<1$, and let $Z_1(x), Z_2(x), \ldots, Z_n(x)$ denote independent geometric random variables with $Z_i \equiv Z_i(x)$ having distribution which is geometric with parameter $1-x^i$, $i=1,2,\ldots,n$. Conditional on $\sum_{i=1}^n i\, Z_i(x) = n$, the random variables $Z_i(x)$, $i=1,2,\ldots, n$, represent the number of parts of size~$i$ in a uniformly chosen integer partition of size~$n$; see~\cite{Fristedt, VershikKerov, Vershik}. Our problem is to sample from $\L\left(Z_1(x), \ldots, Z_n(x) \middle | \sum_{i=1}^n i\, Z_i(x) = n\right)$. The division championed in this case is inherently probabilistic, and relies on a property of geometric random variables. Namely, letting $G(q)$ and $G'(q^2)$ denote independent geometric random variables with parameters $1-q$ and $1-q^2$ respectively, and letting $B(p)$ denote an independent Bernoulli random variable with parameter $p$, we have the decomposition \begin{equation}\label{decomposition} G(q) = B\left(\frac{q}{1+q}\right) + 2G'(q^2), \end{equation} where the equality is in distribution. In other words, this decomposition shows that the bits in a geometric random variable are independent, and specifies their distribution. It also suggests a PDC algorithm; that is, sample the least significant bits first, one at a time, and then the remaining part is twice a copy of the first part with a different parameter. As a bonus, many sampling algorithms have a tilting parameter which can be chosen arbitrarily, as is the case for parameter $x$ for integer partitions; after each stage of the PDC algorithm, we may adjust the tilting parameter to more optimally target the remaining sampling problem. Explicitly, we use the division \[ A = (\epsilon_1, \ldots, \epsilon_n), \qquad B = (2Z_1(x^2), 2Z_2(x^4), \ldots, 2 Z_n(x^{2n})), \] where $\epsilon_i$ denotes the least significant bit of $Z_i$, distributed as a Bernoulli random variable with parameter $x^i/(1+x^i)$. Even though we have written the geometric random variables in $B$ in terms of a new parameter $x^2$, since the distribution we are sampling from is conditionally independent of $x$, we are free to choose any $x' \in (0,1)$ which more optimally targets the sampling distribution, which is realized after the bits in $A$ are sampled. An application of Algorithm~\ref{PDC procedure von Neumann} in this setting is the following: Sample from $A = (\epsilon_1, \ldots, \epsilon_n)$ and let $a = \sum_{i=1}^n i\, \epsilon_i$. Then we have \begin{equation}\label{sa} s(a) = \frac{\P(\sum_{i=1}^n (2i) Z_{2i} = n-a)}{\max_\ell \P( \sum_{i=1}^n (2i)\, Z_{2i} = \ell)} = \frac{\P\left(\sum_{i=1}^{(n-a)/2} i Z_{i} = \frac{n-a}{2}\right)}{\max_\ell \P\left( \sum_{i=1}^{\ell} i\, Z_{i} = \ell\right)} = \frac{p\left(\frac{n-a}{2}\right)x^{(n-a)/2} \prod_{i=1}^{(n-a)/2} (1-x^i)}{\max_\ell p(\ell) x^\ell \prod_{i=1}^\ell (1-x^i)}, \end{equation} where $p(n)$ denotes the number of integer partitions of $n$, which is an extremely well-studied sequence; see for example~\cite{PDC} and the references therein. In addition, we have $\L(B | (a,B) \in E)$ is equivalent to the original problem with $n$ replaced by $(n-a)/2$, hence the description of this algorithm as self-similar. In terms of random sampling of integer partitions, this is also within a constant factor of the fastest possible algorithm; see~\cite[Theorem 3.5]{PDC}. More importantly, however, is that this type of divide-and-conquer is inherently probabilistic, table-free, and can be applied to other structures which are modeled by geometric random variables, namely, contingency tables. } Previous applications of PDC have considered mutually independent random variables $X_1, X_2, \ldots, X_n$, with target space given by some measurable event $E$, with the goal to sample from the distribution \[ \L(\, (X_1, \ldots, X_n)\, | \, E). \] We assume that the unconditional distributions $\L(X_1), \ldots, \L(X_n)$ are known and can be sampled. For general two-dimensional tables, we consider sampling problems of the form: $X_{1,1}, \ldots, X_{m,n}$ are mutually independent random variables, $E$ is some measurable event, and the goal is to the sample from the distribution \begin{equation}\label{distribution} \L\left(\begin{array}{ccc} X_{1,1}, & \ldots & X_{1,n}, \\ \vdots & \vdots & \vdots \\ X_{m,1}, & \ldots & X_{m,n} \end{array}\, \middle|\, E \right). \end{equation} The uniform distribution over all $(r,c)$-contingency tables can be obtained, see for example~\cite{BarvinokRandomCT, DeSalvoCT}, by taking $X_{i,j}$ to be geometrically distributed with parameter $p_{i,j} = \frac{m}{m+c_j}$, $i=1,\ldots,m$, $j=1,\ldots,n$, subject to the measurable event \begin{equation}\label{ctE} E \equiv E_{r,c} = \left\{ \ \begin{array}{l} \sum_{\ell=1}^n X_{i,\ell} = r_i, ~\forall ~ 1\leq i\leq m; \\ \\ \sum_{\ell=1}^m X_{\ell,j} = c_j, ~\forall ~1 \leq j \leq n \end{array}\right\}. \end{equation} Taking $X_{i,j}$ to be Bernoulli distributed with parameter $p_{i,j} / (1+p_{i,j})$, we obtain the uniform distribution over the set of $(r,c)$-binary contingency tables. In the case of Latin squares of order~$n$, we consider the parameterization which consists of $n \times n$ tables of values, each row of which is a permutation of elements $\{1,2,\ldots,n\}$, and each column is a permutation of elements $\{1,2,\ldots,n\}$. Let $U_{i,j}$ denote a collection of i.i.d.~discrete uniform random variables from the set $\{1,2,\ldots,n\}$, $ 1\leq i, j \leq n$, and let $S_n$ denote the set of all permutations of the elements $\{1,\ldots,n\}$. The sample space for random sampling of Latin squares is then given by Equation~\eqref{distribution} with $\L(X_{i,j}) = \L(U_{i,j})$ and measurable event $E$ given by \[ E = \left\{ \ \begin{array}{ll} (X_{i,1},\ldots,X_{i,n}) \in S_n, & \forall ~ 1\leq i\leq m; \\ \\ (X_{1,j},\ldots,X_{m,j}) \in S_n, & \forall ~1 \leq j \leq n \end{array}\right\}. \] Once this probabilistic framework has been established, the next task is to devise a PDC division that is both practical and amenable to the resulting analysis. We motivate our PDC division in the next section. \subsection{An heuristic for contingency tables} We first recall a division from~\cite{PDC} which is recursive and self-similar, and serves as the inspiration for the algorithm championed in this paper. Let $0<x<1$, and let $Z_1(x), Z_2(x), \ldots, Z_n(x)$ denote independent geometric random variables with $Z_i \equiv Z_i(x)$ having distribution which is geometric with parameter $1-x^i$, $i=1,2,\ldots,n$. Conditional on $\sum_{i=1}^n i\, Z_i(x) = n$, the random variables $Z_i(x)$, $i=1,2,\ldots, n$, represent the number of parts of size~$i$ in a uniformly chosen integer partition of size~$n$; see~\cite{Fristedt, VershikKerov, Vershik}. Suppose, for the purpose of this demonstration, that we wish to sample from $\L\left( (Z_1(x), \ldots, Z_n(x)) \middle | \sum_{i=1}^n i\, Z_i(x) = n\right)$. The division championed in this case is inherently probabilistic, and relies on a property of geometric random variables. Namely, letting $G(q)$ and $G'(q^2)$ denote independent geometric random variables with parameters $1-q$ and $1-q^2$ respectively, and letting $B(p)$ denote an independent Bernoulli random variable with parameter $p$, we have the decomposition \begin{equation}\label{decomposition} G(q) \stackrel{D}{=} B\left(\frac{q}{1+q}\right) + 2G'(q^2), \end{equation} where the equality is in distribution. In other words, this decomposition shows that the bits in a geometric random variable are independent, and specifies their distribution. It also suggests a PDC algorithm; that is, sample the least significant bits first, one at a time, and then the remaining part has a distribution which is two times a geometric distribution with parameter $q^2$ in place of $q$. As a bonus, many sampling algorithms have a tilting parameter which can be chosen arbitrarily, as is the case for parameter $x$ for integer partitions; after each stage of the PDC algorithm, we may adjust the tilting parameter to more optimally target the remaining sampling problem. Explicitly, we use the division \[ A = (\epsilon_1, \ldots, \epsilon_n), \qquad B = (2Z_1(x^2), 2Z_2(x^4), \ldots, 2 Z_n(x^{2n})), \] where $\epsilon_i$ denotes the least significant bit of $Z_i$, distributed as a Bernoulli random variable with parameter $x^i/(1+x^i)$. Even though we have written the geometric random variables in $B$ in terms of a new parameter $x^2$, since the distribution we are sampling from is conditionally independent of $x$, we are free to choose any $x' \in (0,1)$ which more optimally targets the sampling distribution, which is realized after the bits in $A$ are sampled. An application of Algorithm~\ref{PDC procedure von Neumann} in this setting is the following: Sample from $A = (\epsilon_1, \ldots, \epsilon_n)$ and let $a = \sum_{i=1}^n i\, \epsilon_i$. Then we have \begin{equation}\label{sa} s(a) = \frac{\P(\sum_{i=1}^n (2i) Z_{2i} = n-a)}{\max_\ell \P( \sum_{i=1}^n (2i)\, Z_{2i} = \ell)} = \frac{\P\left(\sum_{i=1}^{(n-a)/2} i Z_{i} = \frac{n-a}{2}\right)}{\max_\ell \P\left( \sum_{i=1}^{\ell} i\, Z_{i} = \ell\right)} = \frac{p\left(\frac{n-a}{2}\right)x^{(n-a)/2} \prod_{i=1}^{(n-a)/2} (1-x^i)}{\max_\ell p(\ell) x^\ell \prod_{i=1}^\ell (1-x^i)}, \end{equation} where $p(n)$ denotes the number of integer partitions of $n$, which is an extremely well-studied sequence; see for example~\cite{PDC} and the references therein. In addition, we have $\L(B | (a,B) \in E)$ is equivalent to the original problem with $n$ replaced by $(n-a)/2$, hence the description of this algorithm as self-similar. In terms of random sampling of integer partitions, this is also within a constant factor of the fastest possible algorithm due to the efficient computation of $p(n)$; see~\cite[Theorem 3.5]{PDC}. More importantly, however, is that this type of divide-and-conquer is inherently probabilistic, table-free, and can be applied to other structures which are modeled by geometric random variables, namely, contingency tables. Next, we revisit and generalize an approach in~\cite{DeSalvoCT} for random sampling of nonnegative integer-valued $(r,c)$-contingency tables inspired by the above application for integer partitions. The generalization fixes an arbitrary set of entries to be 0, which doesn't change the approximation heuristic; however, it does a priori drastically change the computational complexity of computing the exact sampling rejection probability. We start with a well-known probabilistic model for the entries in a random contingency table, generalized to include entries which are forced to be 0. In this section, we let $W$ be any given $m\times n$ matrix with values in $\{0,1\}$. For each $j=1,2,\ldots,n$, we define $J_j := \{1,\ldots, n\} \setminus \{ i : W(i,j) = 1\}$. Similarly, for each $i=1,2,\ldots,m$, we define $I_i := \{1,\ldots, n\} \setminus \{j : W(i,j) = 1\}$. Also, we let $h_j = \sum_{i=1}^m W(i,j)$ denote the number of entries forced to be zero in column $j$, for $j=1,2,\ldots,n$. \begin{lemma} \label{lemma:uniform} Let $\X_W=(X_{ij})_{1 \leq i \leq m, 1 \leq j \leq n}$ denote a collection of independent geometric random variables with parameters $p_{ij}$, such that $W(i,j) = 1$ implies $X_{i,j}$ is conditioned to have value 0. If $p_{ij}$ has the form $p_{ij} = 1 - \alpha_i \beta_j$, then $\X_W$ is uniform restricted to $(r,c)$-contingency tables with zeros in entries indicated by $W$. \end{lemma} \begin{proof} Let $\X=(X_{ij})_{1 \leq i \leq m, 1 \leq j \leq n}$ denote a collection of independent geometric random variables with parameters $p_{ij}$, where $p_{ij}$ has the form $p_{ij} = 1 - \alpha_i \beta_j$. We have \[\P\big(\X=\xi\big) =\prod_{i,j}\P\big(X_{ij}=\xi_{ij}\big) =\prod_{i,j}(\alpha_i \beta_j)^{\xi_{ij}}(1-\alpha_i \beta_j) =\prod_i\alpha_i^{r_i} \prod_j\beta_j^{c_j}\prod_{i,j}\big(1-\alpha_i \beta_j\big). \] Since this probability does not depend on $\xi$, it follows that the restriction of $\X$ to $(r,c)$-contingency tables is uniform. As the collection of random variables are independent, conditioning on any $X_{i,j} = 0$ only changes the constant of proportionality, and does not affect the dependence on the $\xi$, hence \[\P\big(\X_W=\xi\big) =\prod_{i,j : W(i,j) = 0}\P\big(X_{ij}=\xi_{ij}\big) =\prod_{i,j: W(i,j)=0}(\alpha_i \beta_j)^{\xi_{ij}}(1-\alpha_i \beta_j) =\prod_i\alpha_i^{r_i} \prod_j\beta_j^{c_j}\prod_{i,j}\big(1-\alpha_i \beta_j\big); \] i.e., it follows that the restriction of $\X_W$ to $(r,c)$-contingency tables with forced zero entries indicated by $W$ is uniform. \end{proof} \begin{lemma}\label{expectation} Suppose $\X_W$ is a collection of independent geometric random variables, where $X_{i,j}$ has parameter $p_{ij} = \frac{m-h_j}{m-h_j+c_j}$, for all pairs $(i,j)$ such that $W(i,j) = 0$, and $p_{i,j} = 1$ for all pairs $(i,j)$ such that $W(i,j) = 1$. Then the expected column sums of $\X_W$ are $c_1, c_2, \ldots, c_n$, and the expected row sums are $\sum_{j\in I_1} \frac{c_j}{m-h_j}, \ldots, \sum_{j\in I_m} \frac{c_j}{m-h_j}$. \end{lemma} \begin{proof} Note first that $\E X_{i,j} = p_{i,j}^{-1} - 1$. Then for any $j=1,2,\ldots,n$, \[ \sum_{i=1}^m \E\, X_{i,j} = \sum_{i \in J_j} \frac{m-h_j+c_j}{m-h_j} - 1= c_j \] and similarly for any $i=1,2,\ldots, m$, \[ \sum_{j=1}^n \E\, X_{i,j} = \sum_{j \in I_i} \frac{m-h_j+c_j}{m-h_j}-1 = \sum_{j\in I_i} \frac{c_j}{m-h_j}. \qedhere\] \end{proof} Next, we describe the PDC algorithm and how the heuristic is utilized. Suppose we have matrices $W$ and $\mathcal{O}$ with entries in $\{0,1\}$. For any set of row sums and column sums $(r,c)$, let $\Sigma(r,c,\mathcal{O}, W)$ denote the number of nonnegative integer-valued $(r,c)$-contingency tables with entry $(i,j)$ forced to be even if the $(i,j)$th entry of $\mathcal{O}$ is 1, and entry $(i,j)$ forced to be 0 if the $(i,j)$th entry of $W$ is 1. Let $\mathcal{O}_{i,j}$ denote the matrix which has entries with value $1$ in the first $j-1$ columns, and entries with value $1$ in the first $i$ rows of column $j$, and entries with value 0 otherwise. The algorithm we champion for contingency tables starts by considering the first entry in the first column not forced to be 0, say at entry $(s,1)$, and denote the least significant bit by $\epsilon_{s,1}$. As we are in the first column, we have $\L(\epsilon_{s,1} | E) = \L\left(\mbox{Bern}\left(\frac{q_1}{1+q_1}\right) \middle| E\right)$, where $E$ is given in Equation~\eqref{ctE}. In lieu of sampling from this conditional distribution directly, and a more practical alternative is to sample from $\L\left(\mbox{Bern}\left(\frac{q_1}{1+q_1}\right)\right)$ and reject the outcome with probability proportional to $1-\P(E | \epsilon_{s,1})$. We define $r_i(k) = (r_1, \ldots, r_i - k, \ldots r_m)$ and $c_j(k) = (c_1, \ldots, c_j - k, \ldots c_n)$ for $k \in \{0,1\}$. By Lemma~\ref{lemma:uniform}, we have \[ \P(E | \epsilon_{s,1} = k) = \Sigma(r_s(k),c_1(k),W,\mathcal{O}_{i,j})\,\cdot \, \left(q_1^{c_1-k}\, (1-q_1^2)\right) (1-q_1)^{m-h_1} \prod_{j=2}^n q_j^{c_j} (1-q_j)^{m-h_j}. \] Then, since we reject \emph{in proportion} to this probability, we normalize by all terms which do not depend on $k$, which gives \begin{equation}\label{enumerative} \P(E | \epsilon_{s,1} = k) \propto \Sigma(r_s(k),c_1(k),W,\mathcal{O}_{i,j})\,\cdot \, q_1^{-k}, \end{equation} where we use the notation $a(k) \propto b(k)$ to mean that $a(k)/b(k)$ is equal to a positive constant independent of $k$ (but potentially depending on all other parameters). Once we accept a value for $\epsilon_{s,1}$, we then move to the next bit further down in the column and sample analogously, continuing in this manner column by column, left to right. The following is a probabilistic formulation of the \emph{exact} rejection probability for an arbitrary entry $(i,j)$, which assumes that all bits above the entry in the current column have already been sampled, as well as all bits in all columns to the left of $(i,j)$; see Section~\ref{section_probabilistic} for the complete description of each random variable: \begin{align}\label{fij} \hspace{-0.25in} f(i,j,k, r, c,W) \propto \ & \P\left( \begin{array}{llll} \sum_{\ell\in J_1}^{\ell < j} 2\xi''_{1,\ell}(q_\ell^2, c_\ell) &+ \eta_{1,j,i}'(q_j, c_j) &+ \sum_{\ell\in J_1}^{\ell > j} \xi'_{1,j}(q_\ell, c_\ell) &= r_1 \\ \sum_{\ell\in J_2}^{\ell < j} 2\xi''_{2,\ell}(q_\ell^2, c_\ell) &+ \eta_{2,j,i}'(q_j, c_j) &+ \sum_{\ell\in J_2}^{\ell > j} \xi'_{2,j}(q_\ell, c_\ell) &= r_2 \\ \qquad \vdots \\ \sum_{\ell\in J_{i-1}}^{\ell < j} 2\xi''_{i-1,\ell}(q_\ell^2, c_\ell) &+ \eta_{i-1,j,i}'(q_j, c_j) &+ \sum_{\ell\in J_{i-1}}^{\ell > j} \xi'_{i-1,j}(q_\ell, c_\ell) &= r_{i-1} \\ \sum_{\ell\in J_i}^{\ell < j}2\xi''_{i,\ell}(q_\ell^2, c_\ell) &+ \eta_{i,j,i}''(q_j, c_j) &+ \sum_{\ell\in J_i}^{\ell > j} \xi'_{i,j}(q_\ell, c_\ell) &= r_{i}-k \\ \sum_{\ell\in J_{i+1}}^{\ell < j}2\xi''_{i+1,\ell}(q_\ell^2, c_\ell) &+ \eta_{i+1,j,i}''(q_j, c_j) &+ \sum_{\ell\in J_{i+1}}^{\ell > j} \xi'_{i+1,j}(q_\ell, c_\ell) &= r_{i+1} \\ \qquad \vdots \\ \sum_{\ell\in J_m}^{\ell < j}2\xi''_{m,\ell}(q_\ell^2, c_\ell) &+ \eta_{m,j,i}''(q_j, c_j) &+ \sum_{\ell\in J_m}^{\ell > j} \xi'_{m,j}(q_\ell, c_\ell) &= r_{m} \\ \end{array}\right) \\ \nonumber & \ \ \ \ \times \P\left( \sum_{\ell\in I_i, \ell \leq i} 2\, \xi_{\ell,j}(q_j^2) + \sum_{\ell\in I_i, \ell > i} \xi_{\ell,j}(q_\ell) = c_j - k \right). \end{align} If we could evaluate the multivariate probability above exactly, or to some arbitrarily defined precision, then the bit-by-bit sampling approach would yield an exact sampling algorithm. However, we champion the following approximation to Equation~\eqref{fij} based on the heuristic that the dependencies between the random variables are strongest along the $i$-th row and the $j$-th column: \begin{align} \nonumber & F(i,j,k, r, c,W) := \\ \label{alternative:rejection} &\qquad \Pr\left( \sum_{\ell \in I_i, \ell < j} 2\xi''_{i,\ell}(q_\ell^2, c_j, \epsilon) + 2\eta''_{i,j,i} + \sum_{\ell \in I_i, \ell > j} \xi'_{i,\ell}(q_\ell) = r_i - k\right) \\ \nonumber &\qquad \ \ \ \times \Pr\left( \sum_{\ell\in J_j, \ell \leq i} 2\xi_{\ell,j}(q_j^2) + \sum_{\ell \in J_j, \ell > i} \xi_{\ell,j}(q_j) = c_j - k\right), \qquad \qquad k \in \{0,1\}. \end{align} Note that while this approximation does not encode the essential global information, it nonetheless enforces several necessary conditions like parity of the row and column, and is fast to compute directly. \subsection{An heuristic for Latin squares} \label{latin_square_heuristic} The following is a variation of the motivating example of the previous section. Let $0<x<1$, and let $X_1(x), X_2(x), \ldots, X_n(x)$ denote independent Bernoulli random variables with $X_i \equiv X_i(x)$ having distribution which is Bernoulli with parameter $\frac{x^i}{1+x^i}$, $i=1,2,\ldots,n$. Conditional on $\sum_{i=1}^n i\, X_i(x) = n$, the random variables $X_i(x)$, $i=1,2,\ldots, n$, represent the number of parts of size~$i$ in a uniformly chosen integer partition of size~$n$ \emph{into distinct part sizes}; see~\cite{Fristedt, LD}. As before, suppose we wish to sample from $\L\left( (X_1(x), \ldots, X_n(x)) \middle | \sum_{i=1}^n i\, X_i(x) = n\right)$. We then consider the following ``spatial" PDC division \[ A = (X_1, X_3, X_5, \ldots), \qquad B = (X_2, X_4, X_6, \ldots). \] The result is again a self-similar, recursive PDC algorithm, with the rejection function given by \begin{equation}\label{sa} s(a) = \frac{\P(\sum_{i=1}^{n/2} (2i) X_{2i} = n-a)}{\max_\ell \P( \sum_{i=1}^{n/2} (2i)\, X_{2i} = \ell)} = \frac{p_d\left(\frac{n-a}{2}\right)x^{(n-a)/2} \prod_{i=1}^{(n-a)/2} (1+x^i)^{-1}}{\max_\ell p_d(\ell) x^\ell \prod_{i=1}^\ell (1+x^i)^{-1}}, \end{equation} where $p_d(n)$ is the number of integer partitions into distinct part sizes, which can be computed efficiently via, e.g.,~\cite{hua1942number}. Let $LS_n$ denote the set of Latin squares of order $n$, and let $\BC_{n,m}$ denote the set of all $n\times n$ binary contingency tables with line sums $m$. Consider any Latin square of order~$n$, and consider the map $\varphi_n : LS_n \longrightarrow \BC_{n,\lceil n/2\rceil}$ which replaces each entry having value $x$ with $x \mod 2$, i.e., each entry becomes a $1$ if it is odd and $0$ if it is even. The result is an $n\times n$ binary contingency table with row sums and column sums $\lceil n/2 \rceil$. Let us assume as before that $n$ is a perfect power of 2 for simplicity of exposition. By symmetry, each entry in a Latin square is equally likely to be even or odd, subject to the condition that there are an equal number of odd and even entries in each row and column. It is thus natural to conjecture that the joint distribution of the parity of entries in a random Latin square of order~$n$ is close in some sense to a joint distribution of $n\times n$ i.i.d.~Bernoulli random variables with parameter $1/2$, subject to an equal number of 0s and 1s in each row and column; i.e., a uniform distribution on the corresponding set of binary contingency tables $\BC_{n,n/2}$. In fact, the standard approach to sampling from binary contingency tables, given in~\cite{chen}, does in fact model each entry as independent subject to the constraints, with entry $(i,j)$ as having a Bernoulli distribution with parameter $\frac{c_j}{m}$, where $c_j$ is the column sum and $m$ is the number of rows; taking $c_j = n/2$ and $m=n$, we obtain our aforementioned natural heuristic for the parity of entries in a Latin square of order $n$. We may continue this reasoning for tables with prescribed entries forced to be zero, which is the inspiration for Algorithm~\ref{latin:square:algorithm}. We similarly have analogous lemmas as in the previous section specifically for binary-valued tables, which are also straightforward generalizations from the work in~\cite{chen}, and so we omit the proof. \begin{lemma} \label{lemma_uniform_binary} Let $\X_W=(X_{ij})_{1 \leq i \leq m, 1 \leq j \leq n}$ denote a collection of independent Bernoulli random variables with parameters $p_{ij}$, such that $W(i,j) = 1$ implies $X_{i,j}$ is conditioned to have value 0. If $p_{ij}$ has the form $p_{ij} = 1 - \alpha_i \beta_j$, then $\X_W$ is uniform restricted to $(r,c)$-binary contingency tables with zeros in entries indicated by $W$. \end{lemma} \begin{lemma}\label{expectation_binary} Suppose $\X_W$ is a collection of independent Bernoulli random variables, where $X_{i,j}$ has parameter $p_{ij} = \frac{c_j}{m-h_j}$, for all pairs $(i,j)$ such that $W(i,j) = 0$, and $p_{i,j} = 1$ for all pairs $(i,j)$ such that $W(i,j) = 1$. Then the expected column sums of $\X_W$ are $c_1, c_2, \ldots, c_n$, and the expected row sums are $\sum_{j\in I_1} \frac{c_j}{m-h_j}, \ldots, \sum_{j\in I_m} \frac{c_j}{m-h_j}$. \end{lemma} There are thus two distinct places where bias can occur in our approach championed in Section~\ref{novel_algorithm}. The first comes from the locations of the even/odd entries; even if we suppose that we may sample from $\BC_{n,n/2}$ uniformly at random, there is no a priori reason to believe that $\varphi_n$ maps the same number of Latin squares of order $n$ to each element of $\BC_{n,n/2}$, and indeed this is easily seen to \emph{not} be the case for $n=5$, even though the distribution is close to uniform. However, supposing we did know precisely the multiset of counts for the image of $\varphi_n$, a natural sampling approach would be to generate samples from $\BC_{n,n/2}$ uniformly and apply an appropriate rejection proportional to this multiset of counts (followed by the analogous procedure for the follow-up tables in the algorithm); however, sampling uniformly from $\BC_{n,n/2}$, is not always straightforward or efficient, which motivates the following approximation algorithm. In~\cite{chen}, the algorithm championed for binary contingency tables keeps track of an importance sampling weight, which represents the bias introduced by the sampling algorithm. The algorithm proceeds in the same manner as the one we champion for contingency tables, sampling entries column by column from top to bottom. Our suggested modification for binary contingency tables is to ignore the use of the Poisson-binomial distribution altogether, but still apply a rejection which captures several necessary conditions, along with what we suspect is the dominant source of bias in the sampling algorithm. That is, letting $X_{i,j}(p_{i,j})$ denote a Bernoulli random variable with parameter $p_j \equiv p_{i,j} = \frac{c_j}{n}$, we propose a rejection probability of the form \begin{align} \label{bct_rejection} B(i,j,k, r, c,W) & := \Pr\left(\sum_{\ell \in I_i, \ell > j} X_{i,\ell}(p_\ell) = r_i - k\right) \times \Pr\left(\sum_{\ell \in J_j, \ell > i} X_{\ell,j}(p_j) = c_j - k\right), \qquad k \in \{0,1\}. \end{align} It is plausible that for the random sampling of Latin squares the two sources of bias at times cancel each other out, or potentially exacerbate the individual biases; it would certainly be interesting to explore this in more detail. \begin{remark} One can also ask the following fundamental question: Is the range of the injection $\varphi_n$ equal to $\BC_{n,\lceil n/2\rceil}$ for all $n$? In other words, do there exist binary contingency tables which, if generated, doom our approach from the start? The unfortunate answer is yes, found by exhaustive search for $n=7$, although in practice we have not found there to be very many. The next natural question, of interest in complexity theory, would be if there are necessary and sufficient conditions on $\BC_{n,\lceil n/2\rceil}$ which indicate in advance whether such a configuration of even/odd entries cannot be completed. One could also ask similar questions pertaining to the later phases of the algorithm. \end{remark} \section{Algorithms} \label{algorithms} \subsection{Nonnegative integer-valued contingency tables with prescribed 0 entries} \ignore{ Suppose we have matrices $W$ and $\mathcal{O}$ with entries in $\{0,1\}$. For any set of row sums and column sums $(r,c)$, let $\Sigma(r,c,\mathcal{O}, W)$ denote the number of nonnegative integer-valued $(r,c)$-contingency tables with entry $(i,j)$ forced to be even if the $(i,j)$th entry of $\mathcal{O}$ is 1, and entry $(i,j)$ forced to be 0 if the $(i,j)$th entry of $W$ is 1. Let $\mathcal{O}_{i,j}$ denote the matrix which has entries with value $1$ in the first $j-1$ columns, and entries with value $1$ in the first $i$ rows of column $j$, and entries with value 0 otherwise. Let $\Sigma(r, c, \mathcal{O}, W; t_1, \ldots, t_r)$, where each $t_\ell$, $\ell = 1, \ldots, r$ denotes an entry in the table, say $t_\ell = (i_\ell, j_\ell)$, denote the number of nonnegative integer-valued $(r,c)$-contingency tables as before with the additional assumption that the entries $t_1, \ldots t_r$ are forced to be even. } \ignore{ Let $J_j \leftarrow \{1,\ldots, n\} \setminus \{ i : W(i,j) = 1\}$, and let $k_j$ denote the last entry in $J_j$, for all $j=1,2,\ldots,n$. Let $I_i \leftarrow \{1,\ldots, n\} \setminus \{j : W(i,j) = 1\}$, and let $\ell_i$ denote the last entry in $I_i$, for all $i=1,2,\ldots,m$. For each $1 \leq i \leq m, 1 \leq j \leq n$, define \begin{equation}\label{rejection:ij}\small f(i,j,k,r,c) := \frac{\Sigma\left( \begin{array}{l}(\ldots,r_{i}-k,\ldots), \\ (\ldots,c_{j}-k,\ldots), \\ W\end{array} \right)}{\Sigma\left( \begin{array}{l}(\ldots,r_{i}-1,\ldots), \\ (\ldots,c_{j}-1,\ldots), \\ W\end{array} \right) + \Sigma\left( \begin{array}{l}(\ldots,r_{i},\ldots), \\ (\ldots,c_{j},\ldots), \\ W\end{array} \right)} \end{equation} if $i \in J_j \setminus \{k_j\}$, and $j \in I_i \setminus \{\ell_i\}$. Let $g_i := \sum_{j=1}^n W_{i,j}$ denote the number of non-zero elements row $i$ of $W$, for $i=1,\ldots,m$, and let $h_j := \sum_{i=1}^m W_{i,j}$ denote the number of non-zero elements in column $j$, $j=1,2,\ldots,n$. Let $q_j := \frac{c_j}{m-h_j+c_j}$, and let $y_j := q_j^{-1} = 1+\frac{m-h_j}{c_j}$. Also, let $k_j'$ denote the penultimate entry in $J_j$, for all $j=1,2,\ldots,n$, and let $\ell_i'$ denote the penultimate entry in $I_i$, for all $i=1,2,\ldots,m$. Let $b(k)$ be such that $r_i-k-b(k)$ is even. Then we define for each $j =1,2,\ldots,n$ and $i \in J_j \setminus \{k_j\}$, \begin{equation} \label{equation:in} f(i,\ell_i',k,r,c) := \end{equation} \begin{equation*}\small \frac{\Sigma\left( \begin{array}{l}(\ldots,r_{i}-k-b(k),\ldots), \\ (\ldots,c_{\ell_i'}-k,c_{\ell_i}-b(k)), \\ W\end{array} \right)\,\cdot\, y_{\ell_i}^{b(k)}}{\Sigma\left( \begin{array}{l}(\ldots,r_{i}-1-b(1),\ldots), \\ (\ldots,c_{\ell_i'}-1,c_{\ell_i}-b(1)), \\ W\end{array} \right)\,\cdot\, y_{\ell_i}^{b(1)}+\Sigma\left( \begin{array}{l}(\ldots,r_{i}-b(0),\ldots), \\ (\ldots,c_{\ell_i'},c_{\ell_i}-b(0)), \\ W\end{array} \right)\,\cdot\, y_{\ell_i}^{b(0)}} \end{equation*} Let $v(k)$ be such that $c_j - k-v(k)$ is even. Similarly we define for each $i=1,2,\ldots,m$ and $j \in I_i \setminus \{\ell_i\}$, \begin{equation}\small \label{rejection:mj} f(k_j',j,k,r,c) := \end{equation} \begin{equation*} \frac{\Sigma\left( \begin{array}{l} (\ldots,r_{k_j'}-k,r_{k_j}-v(k)), \\ (\ldots,c_{j}-k-v(k),\ldots), \\ W\end{array}\right)\,\cdot\, y_{j}^{v(k)}}{\Sigma\left( \begin{array}{l} (\ldots,r_{k_j'}-1,r_{k_j}-v(1)), \\ (\ldots,c_{j}-1-v(1),\ldots), \\ W\end{array}\right)\,\cdot\, y_{j}^{v(1)}+\Sigma\left( \begin{array}{l} (\ldots,r_{k_j'},r_{k_j}-v(0)), \\ (\ldots,c_{j}-v(0),\ldots), \\ W\end{array}\right)\,\cdot\, y_{j}^{v(0)}}. \end{equation*} Finally, let $v(k)$ be such that $c_{n-1} - k-v(k)$ is even, let $\gamma(k)$ be such that $r_{m-1}-k-\gamma(k)$ is even, and let $b(k)$ be such that $c_n-\gamma-b(k)$ is even. Then we define \begin{equation*} A \equiv \Sigma\left(\begin{array}{l}(\ldots,r_{m-1}-k-\gamma(k),r_m-v(k)-b(k)), \\ (\ldots,c_{n-1}-k-v(k),c_n-\gamma(k)-b(k)), \\ \mathcal{O}_{m,n}\end{array} \right)\,\cdot \, y_{n-1}^{v(k)}\, y_n^{\gamma(k) + b(k)}, \end{equation*} \begin{equation*} B \equiv \Sigma\left(\begin{array}{l}(\ldots,r_{m-1}-1-\gamma(1),r_m-v(1)-b(1)), \\ (\ldots,c_{n-1}-k-v(1),c_n-\gamma(1)-b(1)), \\ \mathcal{O}_{m,n}\end{array} \right)\,\cdot \, y_{n-1}^{v(1)}\, y_n^{\gamma(1) + b(1)}, \end{equation*} \begin{equation*} C \equiv \Sigma\left(\begin{array}{l}(\ldots,r_{m-1}-\gamma(0),r_m-v(0)-b(0)), \\ (\ldots,c_{n-1}-v(0),c_n-\gamma(0)-b(0)), \\ \mathcal{O}_{m,n}\end{array} \right)\,\cdot \, y_{n-1}^{v(0)}\, y_n^{\gamma(0) + b(0)}, \end{equation*} \begin{equation}\label{equation:mn} f(m-1,n-1,k,r,c) := \frac{A}{B+C}. \end{equation} and let $\ldots$. } For any $ 1 \leq i \leq m$, $1 \leq j \leq n$, recall the definition of $\Sigma(r, c, \mathcal{O}_{i,j}, W)$ from the previous section. For $k=0,1$, let $r_i(k) = (r_1,\ldots,r_i-k,\ldots,r_m)$, and $c_j(k) = (c_1,\ldots, c_j-k, \ldots,c_n)$. Then define \begin{align*} A_{i,j}(k) & := \Sigma\left(r_i(k), c_j(k), \mathcal{O}_{i,j}, W\right), \end{align*} \begin{equation}\label{equation:mn} g(i,j,k,r,c,W) := \frac{A_{i,j}(k)}{A_{i,j}(0)+A_{i,j}(1)}, \qquad k \in \{0,1\}. \end{equation} The following notations and definitions from~\cite{DeSalvoCT} are used in the algorithms. \begin{tabular}{p{1.9cm}p{13cm}} $\mbox{Geo}(q)$ & Geometric distribution with probability of success $1-q$, for $0<q<1$, with $\Pr\left(\mbox{Geo}(q)=k\right)=(1-q)q^k$, $k=0,1,2,\ldots\, $. \\[.15cm] $\NB(m, q)$ & Negative binomial distribution with parameters $m$ and $1-q$, given by the sum of $m$ independent $\mbox{Geo}(q)$ random variables, with \[\Pr(\NB(m,q) = k) = \binom{m+k-1}{k}(1-q)^m q^k.\] \\[.15cm] U & Uniform distribution on $[0,1]$. We will also denote random variables from this distribution as $U$ or $u$; should be considered independent of all other random variables, including other instances of $U$. \\[.15cm] $\mbox{Bern}(p)$ & Bernoulli distribution with probability of success $p$. Similarly to $U$, we will also use it as a random variable. \\[.15cm] $\xi_{i,j}(q)$ & $\mbox{Geo}(q)$ random variables which are independent for distinct pairs $(i,j)$, $1\le i\le m$, $1\le j\le n$. \\[.15cm] $\xi_{i,j}'(q,c_j,W)$ & Random variables which have distribution \[\L\left(\xi_{i,j}(q) \bigg| \sum_{\ell\in J_j} \xi_{\ell,j}(q) = c_j\right),\] and are independent of all other random variables $\xi_{i,\ell}(q)$ for $\ell \ne j$. \\[.15cm] $2\xi_{i,j}''(q,c_j,W)$ & Random variables which have distribution \[\L\left(2\xi_{i,j}(q^2) \bigg| \sum_{\ell\in J_j} 2\xi_{\ell,j}(q^2) = c_j \right)\] and are independent of all other random variables $\xi_{i,\ell}(q)$ for $\ell \ne j$. \\[.15cm] $\eta'_{i,j,s}(q, c_j)$ & Random variables which have distribution \[ \L\left( \xi_{i,j}(q) \middle| \sum_{\ell\in J_j, \ell \leq s} 2\xi_{\ell,j}(q^2) + \sum_{\ell\in J_j, \ell > s} \xi_{\ell,j}(q) = c_j \right), \] and are independent of all other random variables $\xi_{i,\ell}(q)$ for $\ell \ne j$. \\[.15cm] \end{tabular} \begin{tabular}{p{1.9cm}p{13cm}} $2\eta''_{i,j,s}(q, c_j)$ & Random variables which have distribution \[ \L\left( 2\xi_{i,j}(q^2) \middle| \sum_{\ell\in J_j, \ell \leq s} 2\xi_{\ell,j}(q^2) + \sum_{\ell\in J_j, \ell > s} \xi_{\ell,j}(q) = c_j \right), \] and are independent of all other random variables $\xi_{i,\ell}(q)$ for $\ell \ne j$. \\[.15cm] $\mathbf q$ & The vector $(q_1, \ldots, q_n)$, where $0<q_i<1$ for all $i=1,\ldots,n$. \\[.15cm] \end{tabular} Consider next the following subroutines to generate a random bit: \begin{algorithm}[H] \label{bit_exact} \caption*{Exact sampling of least significant bit of entry $(i,j)$ via enumeration of contingency tables} \begin{algorithmic}[1] \Procedure{Exact}{$i,j,r,c,A,W_b$} \If{ $u \leq g(i,j,0,r,c,W_b) $}\label{reject_g} \State {\bf return} $0$ \Else \State {\bf return} $1$ \EndIf \EndProcedure \end{algorithmic} \end{algorithm} \begin{algorithm}[H] \label{bit_exact_prob} \caption*{Exact sampling of least significant bit of entry $(i,j)$ via exact rejection sampling} \begin{algorithmic}[1] \Procedure{Exact\_Probabilistic}{$i,j,r,c,A,W_b$} \If{ $u \leq f(i,j,0,r,c,W_b) $}\label{reject_f} \State {\bf return} $0$ \Else \State {\bf return} $1$ \EndIf \ignore{\State $X(i,j) \leftarrow \mbox{Bern}(c_j / (m-h_j))$ \label{random_step} \If{$U > \frac{f(i,j,X(i,j),r,c,W_b)}{\max_{\ell \in \{0,1\}f(i,j,\ell,r,c,A,W_b)}}$} \State Goto Line~\ref{random_step}. \EndIf \State {\bf return} $X_{i,j}$ } \EndProcedure \end{algorithmic} \end{algorithm} The previous two procedures are computationally intensive to evaluate, since they a priori rely on the entire solution set, i.e., the set of all potential values of entries. We suggest the following approximation approach, in which the $(i,j)$-th entry is decided based solely on the row sum $r_i$ and column sum $c_j$. For each fixed $1 \leq i \leq m$ and $ 1 \leq j \leq n$, let $t_{1}, \ldots, t_{\nu}$ denote the set of entries and the corresponding value which have a deterministic value (either the entire entry or the least significant bit) determined by the line sum conditions after the sampling of the least significant bit of entry $(i,j)$, and let $r_{i,j}(t_1,\ldots, t_\nu)$ and $c_{i,j}(t_1, \ldots, t_\nu)$ denote the residual row and column sums, respectively, given these entries. For example, if there is only one fillable entry in a given row or column, we may uniquely specify its value; if a row sum or column sum is zero, set all fillable entries in that row or column to zero; if there are two entries left in a given row and the row sum is even (and non-zero), then either both least significant bits are 0 or both are 1. \ignore{ \begin{enumerate} \item Fill in a set of values $\{t_1, \ldots, t_\nu\}$ into the table. \item Check if a priori the entries of any rows or columns are uniquely determined given these values. There are two cases: if a row sum is zero then all remaining entries must be 0, or if a row sum equals the number of undecided entries then they must all be 1. Similarly with columns. \item If any values were filled in from the previous step, call the function recursively; stop when no new elements are filled in, or when $W$ is the matrix of all 1s. \end{enumerate}} \begin{algorithm}[H] \label{bit_approx} \caption*{Given entries with values to fill in, return the set of determined entries.} \begin{algorithmic}[1] \Procedure{Deterministic\_Fill}{$\{t_1, \ldots t_\nu\}, r, c, A, W$} \State Fill in the values $\{t_1, \ldots, t_\nu\}$ into the table $A$, update $r$, $c$, and $W$ accordingly. \State For each row, fill in $A$ any uniquely determined values based on the row sum. \State For each column, fill in $A$ any uniquely determined values based on the column sum. \State If any values were filled in from the previous two steps, label them as $\{t_{\nu+1}, \ldots, t_d\}$ and update the values of $r$, $c$, $A$, and $W$ accordingly. \If {no new elements are filled in, i.e., $d=0$, or if $W$ is the matrix of all 1s} \State {\bf return} $(\{t_1, \ldots, t_\nu, \ldots, t_d\}, r, c, A, W$) \Else \State {\bf return} {\tt Deterministic\_Fill}$(\{t_1,\ldots,t_d\}, r, c, A, W)$ \EndIf \EndProcedure \end{algorithmic} \end{algorithm} The rejection procedure we thus champion for approximate sampling of contingency tables is as follows. For each entry $(i,j)$, we calculate the set of all values which would be determined if we set that particular entry's bit equal to 0 or 1 using Procedure~{\tt Deterministic\_Fill}. We then sample the bit in proportion to the probability that all of the determined bits were also generated with their uniquely determined values, and apply a rejection probability similar to Equation~\eqref{fij}, except we condition on these determined values. This is summarized in Procedure~{\tt Approximate\_Probabilistic} below. \ignore{ We define \begin{align} \nonumber & F(i,j,k, r, c,W, \{t_1,\ldots,t_\nu\}) := \\ \label{alternative:rejection} &\qquad \Pr\left( \sum_{\ell \in I_i, \ell < j} 2\xi''_{i,\ell}(q_\ell^2, c_j, \epsilon) + 2\eta''_{i,j,i} + \sum_{\ell \in I_i, \ell > j} \xi'_{i,\ell}(q_\ell) = r_i - k \middle| \{t_1, \ldots, t_\nu\}\right) \\ \nonumber &\qquad \ \ \ \times \Pr\left( \sum_{\ell\in J_j, \ell \leq i} 2\xi_{\ell,j}(q_j^2) + \sum_{\ell \in J_j, \ell > i} \xi_{\ell,j}(q_j) = c_j - k \middle| \{t_1 \ldots t_\nu\} \right), \qquad \qquad k \in \{0,1\}. \end{align} Note that in general we cannot be more specific in our notation, since $t_1$ might contain a deterministic bit, or an entire entry. In each case it is straightforward to rewrite the explicit probability. } \begin{algorithm}[H] \label{bit_approx} \caption*{Approximate sampling of least significant bit of entry $(i,j)$ via rejection sampling} \begin{algorithmic}[1] \Procedure{Approximate\_Probabilistic}{$i,j,r,c,A,W_b$} \State $({\bf s}_0,r_0,c_0,A_0,W_0) \leftarrow$ {\tt Deterministic\_Fill}$(\{(i,j,0)\}, r, c, A, W)$ \State $({\bf s}_1, r_1,c_1,A_1,W_1) \leftarrow$ {\tt Deterministic\_Fill}$(\{(i,j,1)\}, r, c, A, W)$ \State $p_0 \leftarrow \prod_{\ell} \P(X_{i_\ell^0, j_\ell^0} = k_\ell^0) \times F(i,j,0,r_0,c_0,W_0)$ \State $p_1 \leftarrow \prod_{\ell} \P(X_{i_\ell^1, j_\ell^1} = k_\ell^1) \times F(i,j,0,r_1,c_1,W_1)$ \If{$u \leq \frac{p_0}{p_0+p_1}$} \State {\bf return} $0$ \Else \State {\bf return} $1$ \EndIf \EndProcedure \end{algorithmic} \end{algorithm} Note that the $0$ in the term $F(i,j,0,r_1,c_1,W_1)$ above is \emph{not} a typo, since the row sums and column sums are assumed to be updated in the {\tt Deterministic\_Fill} algorithm. In addition, we did not specify whether the random variables $X_{i,j}$ refer to the entire entry or the least significant bit, since they reflect the information contained in the $t_\ell$, $\ell=1,\ldots,\nu$. In principle, the $X_{i,j}$ could refer to any statistic related to entry $(i,j)$, though for us we only consider the value of the entry $(i,j)$ or its least significant bit. \begin{lemma}\label{deterministic_fill_lemma} The time to evaluate Procedure {\tt Deterministic\_Fill} is $O(n^2+m^2)$. \end{lemma} \begin{proof} Each time we call the function, it iterates through all elements of the table, say twice, at cost $O(m\,n)$. At worst, we fill in one entire row or column at each recursive call of the function. Since we thus invoke the recursion at most $\max(n,m)$ times, the result follows. \end{proof} \ignore{ \begin{algorithm}[H] \label{bit_approx} \caption*{Given entries with values to fill in, return the set of determined entries. Here $t_\ell = (i_\ell, j_\ell, k_\ell)$ is a triple consisting of a row number, column number, and bit value, respectively. } \begin{algorithmic}[1] \Procedure{Deterministic\_Fill}{$\{t_1, \ldots t_\nu\}, r', c', W'$} \Statex \ \quad \textit{Initialize local variables} \State $s \leftarrow \{t_1, \ldots, t_\nu \}$, $r \leftarrow r'$, $c \leftarrow c'$, $W \leftarrow W'$ \Statex \qquad \quad \textit{Fill in the proposed values into the table} \For{$\ell=1,2,\ldots, \nu$} \State $W(i_\ell,j_\ell) \leftarrow 1$ \State $r_{i_\ell} \leftarrow r_{i_\ell}-k_\ell$ \State $c_{j_\ell} \leftarrow c_{j_\ell}-k_\ell$ \EndFor \Statex \qquad \quad \textit{Check if any row entries are uniquely determined} \For{$\ell=1,2,\ldots, m$} \State $w \leftarrow \sum_{j=1}^n W(\ell,j)$ \If{ $r_\ell = n-w$ } \State $r_\ell \leftarrow 0$ \For{$p=j+1, j+2, \ldots, n$} \State $W(\ell,p) \leftarrow 1$ \State $c_p \leftarrow c_p - 1$ \State $s \leftarrow s \cup \{ (\ell, p, 1) \}$ \EndFor \ElsIf{ $r_\ell = 0$} \For{$p=j+1,j+2,\ldots,n$} \State $W(\ell,p) \leftarrow 1$ \State $s \leftarrow s \cup \{ (\ell, p, 0) \}$ \EndFor \EndIf \EndFor \Statex \qquad \quad \textit{Check if any column entries are uniquely determined} \For{$p=1,2,\ldots, n$} \State $w \leftarrow \sum_{i=1}^n W(i,p)$ \If{ $c_p = m-w$ } \State $c_p \leftarrow 0$ \For{$\ell=i+1, i+2, \ldots, m$} \State $W(\ell,p) \leftarrow 1$ \State $r_\ell \leftarrow r_\ell - 1$ \State $s \leftarrow s \cup \{ (\ell, p, 1) \}$ \EndFor \ElsIf{ $c_p = 0$} \For{$p=j+1,j+2,\ldots,n$} \State $W(\ell,p) \leftarrow 1$ \State $s \leftarrow s \cup \{ (\ell, p, 0) \}$ \EndFor \EndIf \EndFor \If{$W = W'$} \State {\bf return} $(s,r,c,W)$ \Else \State {\bf return} {\tt Deterministic\_Fill}$(s,r,c,W)$ \EndIf \EndProcedure \end{algorithmic} \end{algorithm} } We now state the main algorithm championed for contingency tables, which depending on several parameters determines the cost of the algorithm and the bias. This algorithm serves as the main inspiration for Algorithm~\ref{latin:square:algorithm}, and is interesting in its own right. \begin{algorithm}[H] \caption{Random sampling of nonnegative integer-valued $(r,c)$-contingency table with forced zero entries in $W$.} \label{CT:algorithm} \begin{algorithmic}[1] \State Fix a procedure to sample a bit, denoted by {\tt Bit\_Sampler}. \State $A \leftarrow 0^{m\times n}$ (i.e., $A$ is initialized to be the $m\times n$ matrix of all 0s). \State $({\bf s}, r, c, A, W) \leftarrow$ {\tt Deterministic\_Fill}($ \{\}, r, c, A, W)$.\label{preprocess} \State $b_{\text{max}} \leftarrow \lceil \log_2(n) \rceil$. \For{$b = 0, 1, \ldots, b_{\text{max}}$} \State $W_b \leftarrow W.$ \State $X \leftarrow 0^{m\times n}$. \For {$j=1,2,\ldots,n$} \For{$i=1,2,\ldots,m$} \If{$W_b(i,j) \neq 1$} \State $X_{i,j} \leftarrow$ {\tt Bit\_Sampler}$(i,j,r,c,W_b)$.\label{line_reject_bit} \State $({\bf s}, r, c, X, W_b) \leftarrow$ {\tt Deterministic\_Fill}($ \{(i,j,X_{i,j})\}, r, c, X, W_b)$.\label{preprocess} \EndIf \EndFor \EndFor \State $A \leftarrow A + 2^b X$ \EndFor \State {\bf return} $A$. \end{algorithmic} \end{algorithm} The function we choose for {\tt Bit\_Sampler} determines the bias as well as the complexity, and we have presented three explicit possibilities: {\tt Exact}, {\tt Exact\_Probabilistic}, and {\tt Approximate\_Probabilistic}. The rejection function $g$ in Line~\ref{reject_g} of Procedure~{\tt Exact}, given in Equation~\eqref{equation:mn}, is stated as an expression involving counting the total number of such tables; this is the direct analog of the recursive method, and typically requires a large table of values computed via a recursion. It is similarly difficult to compute the rejection function $f$ in Line~\ref{reject_f} of Procedure~{\tt Exact\_Probabilistic}, i.e., the probabilistic equivalent of $g$, but which motivates our approximation heuristic. Procedure~{\tt Approximate\_Probabilistic} offers an alternative which is both practical and an heuristically reasoned approximation for the exact quantities. \ignore{ The resulting algorithm is a generalization of~\cite[Algorithm~2]{DeSalvoCT}, and in fact, it is equivalent to Algorithm~\ref{CT:algorithm} above, except it is based on rejection sampling, where one instead samples from a related distribution and applies a rejection probability which rejects samples in a proportion which yields the desired distribution. One simply replaces lines 12--16 in Algorithm~\ref{CT:algorithm} above with the following lines: \begin{tabular}{l} 12: $X(i,j) \leftarrow \mbox{Bern}(c_j / (m-h_j))$ \\ 13: {\bf if} $U > \frac{f(i,j,X(i,j),r,c,W_b)}{\max_{\ell \in \{0,1\}f(i,j,\ell,r,c,W_b)}}$ {\bf then} \\ 14: \qquad Goto Line~12. \\ 15: {\bf endif} \end{tabular} The rejection function $f$ is given by Equation~\eqref{fij}. Again, calculating functions $g$ or $f$ become the bottleneck in any computation. The form of rejection function $f$, however, suggests an approximation using rejection function $F$ given by Equation~\eqref{alternative:rejection} in place of $f$. The first term in Equation~\eqref{alternative:rejection} is a probability over a sum of \emph{independent} random variables with explicitly known distributions, see Section~\ref{A:1}, and as such can be computed using convolutions in space/time $O(n\, M^2)$ or fast Fourier transforms in space/time $O(n\, M \log M)$. Further speedups are possible since only the first few bits of the function are needed on average. It is also straightforward to adapt this approach to binary tables, where we recall that such tables have values restricted to be in $\{0,1\}$. A similar approach was obtained specifically for the case of binary contingency tables without specified zeros in~\cite{chen} using an approach called sequential importance sampling, where at each step one keeps track of weights associated with each placement of a 0 or 1 in each entry, and at the end of the algorithm obtains an importance sampling weight associated with each sample. This algorithm is ideal for the first stage of the Latin square algorithm, since we are able to take advantage of the Gale--Ryser necessary and sufficient condition for binary contingency tables~\cite{gale1957theorem, Ryser} after completion of each column; subsequent steps utilize Algorithm~\ref{binary:algorithm}, and to our knowledge there is no analogous Gale--Ryser condition applicable to binary tables with an arbitrary prescribed set of zeros. } \begin{example} As an example, an application of~\cite[Algorithm~2]{DeSalvoCT} yielded the following set of random bits in each of the five iterations of the algorithm for the random sampling of a contingency table with row sums $(40, 30, 30, 50, 100, 50)$ and column sums $(50, 50, 50, 50, 50, 50)$.\footnote{An implementation in Mathematica took about 1 second.} \begin{align*}\small \hskip-.5in \left( \begin{array}{cccccc} 12 & 12 & 3 & 0 & 9 & 4 \\ 2 & 7 & 0 & 11 & 5 & 5 \\ 2 & 9 & 10 & 0 & 4 & 5 \\ 6 & 1 & 24 & 3 & 14 & 2 \\ 18 & 2 & 12 & 32 & 16 & 20 \\ 10 & 19 & 1 & 4 & 2 & 14 \end{array} \right) & = \ \ \ \small \left( \begin{array}{cccccc} 0 & 0 & 1 & 0 & 1 & 0 \\ 0 & 1 & 0 & 1 & 1 & 1 \\ 0 & 1 & 0 & 0 & 0 & 1 \\ 0 & 1 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 1 & 0 & 0 & 0 \end{array} \right) +2^1 \left( \begin{array}{cccccc} 0 & 0 & 1 & 0 & 0 & 0 \\ 1 & 1 & 0 & 1 & 0 & 0 \\ 1 & 0 & 1 & 0 & 0 & 0 \\ 1 & 0 & 0 & 1 & 1 & 1 \\ 1 & 1 & 0 & 0 & 0 & 0 \\ 1 & 1 & 0 & 0 & 1 & 1 \end{array} \right) \\ \\ & + 2^2 \left( \begin{array}{cccccc} 1 & 1 & 0 & 0 & 0 & 1 \\ 0 & 1 & 0 & 0 & 1 & 1 \\ 0 & 0 & 0 & 0 & 1 & 1 \\ 1 & 0 & 0 & 0 & 1 & 0 \\ 0 & 0 & 1 & 0 & 0 & 1 \\ 0 & 0 & 0 & 1 & 0 & 1 \end{array} \right) + 2^3 \left( \begin{array}{cccccc} 1 & 1 & 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 1 & 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 1 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 \\ 1 & 0 & 0 & 0 & 0 & 1 \end{array} \right) \\ \\ & + 2^4\left( \begin{array}{cccccc} 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 \\ 1 & 0 & 0 & 0 & 1 & 1 \\ 0 & 1 & 0 & 0 & 0 & 0 \end{array} \right) + 2^5 \left( \begin{array}{cccccc} 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 \end{array} \right). \end{align*} \end{example} \begin{example} Consider the following example, a $3 \times 4$ nonnegative integer-valued $(r,c)$-contingency table with row sums $r = (20, 14, 18, 27)$ and column sums $c = (13, 56, 10)$. Furthermore, we force entries $(1,3)$, $(2,1)$, $(3,2)$, $(3,3)$, $(3,4)$ to be 0. The first step is Line~\ref{preprocess}, which transforms the initial sampling problem into the following: \[\hskip-.5in \begin{array}{ccccccc} \begin{array}{cc} \begin{array}{|c|c|c|c|} \hline & & \blacksquare & \\ \hline \blacksquare & & & \\ \hline & \blacksquare & \blacksquare & \blacksquare \\ \hline \end{array} & \begin{array}{c} 10 \\ 56 \\ 13 \end{array} \\ \begin{array}{cccc} 20 & 14 & 18 & 27 \end{array} \end{array} & \longrightarrow & \begin{array}{cc} \begin{array}{|c|c|c|c|} \hline 7 & & \blacksquare & \\ \hline \blacksquare & & 18 & \\ \hline 13 & \blacksquare & \blacksquare & \blacksquare \\ \hline \end{array} & \begin{array}{c} 10 \\ 56 \\ 13 \end{array} \\ \begin{array}{cccc} 20 & 14 & 18 & 27 \end{array} \end{array} & \longrightarrow & \\ \\ \begin{array}{cc} \begin{array}{|c|c|c|c|} \hline \blacksquare & & \blacksquare & \\ \hline \blacksquare & & \blacksquare & \\ \hline \blacksquare & \blacksquare & \blacksquare & \blacksquare \\ \hline \end{array} & \begin{array}{c} 3 \\ 38 \\ 0 \end{array} \\ \begin{array}{cccc} 0 & 14 & 0 & 27 \end{array} \end{array} & \longrightarrow & \begin{array}{cc} \begin{array}{|c|c|} \hline \ \ & \ \ \\ \hline \ \ & \ \ \\ \hline \end{array} & \begin{array}{c} 3 \\ 38 \end{array} \\ \begin{array}{cccc} 14 & 27 \end{array} \end{array} \end{array} \] Now since this reduces to a standard $2\times 2$ contingency table, we can apply a standard algorithm or continue with Algorithm~\ref{CT:algorithm}. We suggest in particular the \emph{exact} sampling algorithm for $2 \times n$ tables given in~\cite[Algorithm~3]{DeSalvoCT}, which for this particular example would sample a uniform number in the set $\{0, 1, 2, 3\}$ and then uniquely fill in the remaining entries. \end{example} \subsection{Binary contingency tables} \label{A:binary} One can formulate an exact sampling rejection function for binary contingency tables as in the previous section, although the approximation algorithm is again the one we champion due to practical computing reasons. It is straightforward but notationally messy to adapt and write out completely the analogous exact sampling procedures in this setting, and so we focus solely on our suggested approximate sampling approach. \ignore{ Let $\BC(r,c,W)$ denote the number of binary $(r,c)$-contingency tables with entry $(i,j)$ forced to be 0 if the $(i,j)$th entry of $W$ is 1. Let $\BC(r, c, W; t_1, \ldots, t_r)$, where each $t_\ell$, $\ell = 1, \ldots, r$ denotes an entry in the table, say $t_\ell = (i_\ell, j_\ell)$, denote the number of binary $(r,c)$-contingency tables as before with the additional assumption that the entries $t_1, \ldots t_r$ are also forced to be 0. Let $h_j := \sum_{i=1}^m W_{i,j}$ denote the number of non-zero elements in column $j$, $j=1,2,\ldots,n$. Let $q_j := \frac{c_j}{m-h_j}$, and let $y_j := q_j^{-1}$. For each $1 \leq i \leq m$ and $ 1 \leq j \leq n$, let $t_{1}, \ldots, t_{r}$ denote the set of entries which are determined by the line sum conditions after sampling of entry $(i,j)$, and let $b_{1}(k), \ldots, b_{r}(k)$ denote the deterministic value of the entry in order to satisfy the row and column constraints given that entry $(i,j)$ has value $k$, where $k \in \{0,1\}$. Then define \begin{align*} A & \equiv \BC\left(\begin{array}{l} (\ldots,r_i-k,\ldots, r_{i_1} - b_{1}(k),\ldots, r_{i_r} - b_{r}(k)), \\ (\ldots,c_j-k, \ldots, c_{j_1} - b_{1}(k),\ldots, c_{j_r} - b_{r}(k)), \\ W,\ \mathcal{O}_{i,j};\ t_1, \ldots, t_r \end{array} \right)\,\cdot \, \prod_{\ell=1}^r y_{j_\ell}^{b_{\ell}(k)}, \\ B & \equiv \BC\left(\begin{array}{l} (\ldots,r_i,\ldots, r_{i_1} - b_{1}(0),\ldots, r_{i_r} - b_{r}(0)), \\ (\ldots,c_j, \ldots, c_{j_1} - b_{1}(0),\ldots, c_{j_r} - b_{r}(0)), \\ W,\ \mathcal{O}_{i,j}; \ t_1, \ldots, t_r \end{array} \right)\,\cdot \, \prod_{\ell=1}^r y_{j_\ell}^{b_{\ell}(0)}, \\ C & \equiv \BC\left(\begin{array}{l} (\ldots,r_i-1,\ldots, r_{i_1} - b_{1}(1),\ldots, r_{i_r} - b_{r}(1)), \\ (\ldots,c_j-1, \ldots, c_{j_1} - b_{1}(1),\ldots, c_{j_r} - b_{r}(1)), \\ W,\ \mathcal{O}_{i,j};\ t_1, \ldots, t_r \end{array} \right)\,\cdot \, \prod_{\ell=1}^r y_{j_\ell}^{b_{\ell}(1)}, \end{align*} \begin{equation}\label{binary:equation:mn} h(i,j,k,r,c,W) := \frac{A}{B+C}. \end{equation} } \ignore{ \begin{algorithm}[H] \caption{Generation of an exactly uniform binary $(r,c)$-contingency table with forced zero entries in W.} \label{binary:algorithm} \begin{algorithmic}[1] \State {\bf Input: } $r = (r_1, \ldots, r_m)$, $c = (c_1, \ldots, c_n)$, and $W \in \{0,1\}^{m\times n}$. \State {\bf Output: } $(r,c)$-binary contingency table with entires in $W$ forced to be 0. \State Let $J_j(W) \leftarrow \{1,\ldots, n\} \setminus \{ i : W(i,j) = 1\}$ for each $j = 1,2,\ldots,n$. \State Let $k_j$ denote the last entry in $J_j(W)$, $j=1,2,\ldots,n$. \For {$j=1,2,\ldots,n$} \For{each $i \in J_j\setminus k_j$} \State $q_j \leftarrow \frac{c_j}{(m-h_j)+c_j}$ \If{ $U \leq h(i,j,0,r,c,W) $} \State $X(i,j) \leftarrow 0$. \Else \State $X(i,j) \leftarrow 1$. \EndIf \State $W(i,j) \leftarrow 1.$ \State Fill in all deterministic bits based on parity of constraints. \State $W(r,s) \leftarrow 1$ where $(r,s)$ runs through all entries which were filled in deterministically. \State Update $r, c, J_j, k_j.$ \EndFor \EndFor \State {\bf return} $X$. \end{algorithmic} \end{algorithm} Next we present a more probabilistic approach, which yields a natural approximate sampling algorithm. } Let $B_j(q)$, $j=1,\ldots,n$, denote independent Bernoulli random variables with success probability $1-q$. We have \begin{equation}\label{g:binary} b(n,{\bf q},k) := \P\left( \sum_{j=1}^n B_j(q_j) = k\right) \nonumber = \frac{1}{n+1}\sum_{\ell = 0}^n C^{-\ell k}\prod_{j=1}^n \left(1+(C^\ell-1)(1-q_j)\right), \end{equation} where $C = \exp\left(\frac{2\pi i}{n+1}\right)$ is a $(n+1)$th root of unity. \ignore{Define \[ d_{n,k} := \frac{\max\left(b(n,{\bf q}, {\bf c}, k), b(n,{\bf q}, {\bf c}, k-1)\right)}{b(n-1,{\bf q}, {\bf c}, k))}, \] and $d := \max_{n,k} d_{n,k}$. } The expression in~\eqref{g:binary} is a numerically stable way to evaluate the convolution of a collection of independent Bernoulli random variables using a fast Fourier transform, see for example~\cite{PoissonBinomial}. Next, we consider an $m\times n$ matrix $W$ which contains values in $\{0,1\}$. A value 1 in entry $(i,j)$ of $W$ implies that this entry is forced to be zero. Given an index set $J \subset \{1,2,\ldots, n\}$, we define similarly \[ b(n,{\bf q},k,J) := \P\left( \sum_{j\in J} B_j(q_j) = k\right). \] For each $i=1,2,\ldots,m$, let $I_i \leftarrow \{1,\ldots, n\} \setminus \{j : W(i,j) = 1\}$ denote the set of entries in row $i$ which can be non-zero; and for each $j=1,2,\ldots,n$, let $J_j \leftarrow \{1,\ldots, n\} \setminus \{ i : W(i,j) = 1\}$ denote the set of entries in column $j$ which can be non-zero. Also let ${\bf q} = (c_1/(m-h_1), c_2/(m-h_2),\ldots, c_n/(m-h_n))$ and let ${\bf \nu_j} = (c_j/(m-h_j), c_j/(m-h_j), \ldots, c_j/(m-h_j))$. Then we define for $i \in I_i$ and $j \in J_j$ \begin{equation} \label{binary:rejection} H(i,j,k,r,c,W) := b(m, {\bf q}, r_i - k, I_i) \times b(n,{\bf \nu_j}, c_j-k, J_j), \end{equation} and $0$ otherwise. We therefore define the following procedure to generates bits, noting that the wording of the {\tt Deterministic\_Fill} function defined in the previous section is equally applicable in this setting. \begin{algorithm}[H] \label{bit_exact} \caption*{Approximate sampling of entry $(i,j)$ of a binary contingency table} \begin{algorithmic}[1] \Procedure{Approximate\_Probabilistic\_Binary}{$i,j,r,c,A,W$} \State $({\bf s}_0,r_0,c_0,A_0,W_0) \leftarrow$ {\tt Deterministic\_Fill}$(\{(i,j,0)\}, r, c, A, W)$ \State $({\bf s}_1, r_1,c_1,A_1,W_1) \leftarrow$ {\tt Deterministic\_Fill}$(\{(i,j,1)\}, r, c, A, W)$ \State $p_0 \leftarrow \prod_{\ell} \P(X_{i_\ell^0, j_\ell^0} = k_\ell^0) \times H(i,j,0,r_0,c_0,W_0)$ \State $p_1 \leftarrow \prod_{\ell} \P(X_{i_\ell^1, j_\ell^1} = k_\ell^1) \times H(i,j,0,r_1,c_1,W_1)$ \If{$u \leq \frac{p_0}{p_0+p_1}$} \State {\bf return} $0$ \Else \State {\bf return} $1$ \EndIf \EndProcedure \end{algorithmic} \end{algorithm} \ignore{ For a given set of row sums $r = (r_1, \ldots, r_m)$ and column sums $c = (c_1, \ldots, c_n)$, let $\B\C(r,c)$ denote the number of $(r,c)$-binary contingency tables. Let $\mathcal{O}$ denote an $m\times n$ matrix with entries in $\{0,1\}$. For any set of row sums and column sums $(r,c)$, let $\B\C(r,c,\mathcal{O})$ denote the number of $(r,c)$-contingency tables with entry $(i,j)$ forced to be 0 if the $(i,j)$th entry of $\mathcal{O}$ is 1, and no restriction otherwise. Let $\mathcal{O}_{i,j}$ denote the matrix which has entries with value $1$ in the first $j-1$ columns, and entries with value $1$ in the first $i$ rows of column $j$, and entries with value 0 otherwise. Define for $1 \leq i \leq m-2, 1 \leq j \leq n-2$, \begin{equation}\label{rejection:ij}\small f(i,j,k,r,c) := \frac{\B\C\left( \begin{array}{l}(\ldots,r_{i}-k,\ldots), \\ (\ldots,c_{j}-k,\ldots), \\ \mathcal{O}_{i,j}\end{array} \right)}{\B\C\left( \begin{array}{l}(\ldots,r_{i}-1,\ldots), \\ (\ldots,c_{j}-1,\ldots), \\ \mathcal{O}_{i,j}\end{array} \right) + \B\C\left( \begin{array}{l}(\ldots,r_{i},\ldots), \\ (\ldots,c_{j},\ldots), \\ \mathcal{O}_{i,j}\end{array} \right)}. \end{equation} } \ignore{ \begin{algorithm}[H] \caption{Generation of an approximately uniform binary $(r,c)$-contingency table with forced zero entries in W.} \label{binary:algorithm:approx} \begin{algorithmic}[1] \State {\bf Input: } $r = (r_1, \ldots, r_m)$, $c = (c_1, \ldots, c_n)$, and $W \in \{0,1\}^{m\times n}$. \State {\bf Output: } $(r,c)$-binary contingency table with entires in $W$ forced to be 0. \State Let $J_j(W) \leftarrow \{1,\ldots, n\} \setminus \{ i : W(i,j) = 1\}$ for each $j = 1,2,\ldots,n$. \State Let $k_j$ denote the last entry in $J_j(W)$, $j=1,2,\ldots,n$. \For {$j=1,2,\ldots,n$} \For{each $i \in J_j\setminus k_j$} \State $q_j \leftarrow \frac{c_j}{(m-h_j)+c_j}$ \State $X(i,j) \leftarrow \mbox{Bern}(q_j / (1+q_j))$. \label{Bern \If{ $U > \frac{H(i,j,X(i,j),r,c,W)}{\max_{\ell \in \{0,1\}H(i,j,\ell,r,c,W)}} $} \State Goto Line~\ref{Bern}. \EndIf \State $W(i,j) \leftarrow 1.$ \State Fill in all deterministic bits based on parity of constraints. \State $W(r,s) \leftarrow 1$ where $(r,s)$ runs through all entries which were filled in deterministically. \State Update $r, c, J_j, k_j.$ \EndFor \EndFor \State {\bf return} $X$. \end{algorithmic} \end{algorithm} } \begin{lemma}\label{binary_lemma} Procedure {\tt Approximate\_Probabilistic\_Binary} has an arithmetic cost of $O(n^2+m^2)$ \end{lemma} \begin{proof} By Lemma~\ref{deterministic_fill_lemma}, each of the two calls to Procedure~{\tt Deterministic\_Fill} take at most $O(n^2+m^2)$. In addition, the cost to evaluate $H$ via Equation~\eqref{binary:rejection} and Equation~\eqref{g:binary} is also at most $O(n^2+m^2)$. \end{proof} We thus define the algorithm for approximate sampling of binary $(r,c)$-contingency tables as follows. \begin{algorithm}[H] \caption{Generation of an approximately uniform binary $(r,c)$-contingency table with forced zero entries in W.} \label{binary:algorithm:approx} \begin{algorithmic}[1] \State {\bf Input: } $r = (r_1, \ldots, r_m)$, $c = (c_1, \ldots, c_n)$, and $W \in \{0,1\}^{m\times n}$. \State {\bf Output: } binary $(r,c)$-contingency table with entries in $W$ forced to be 0. \State $X \leftarrow 0^{m\times n}$ (i.e., $X$ is initialized to be the $m\times n$ matrix of all 0s). \State $({\bf s}, r, c, X, W) \leftarrow$ {\tt Deterministic\_Fill}($ \{\}, r, c, X, W)$.\label{preprocess} \For {$j=1,2,\ldots,n$} \For{$i=1,2,\ldots,m$} \If{$W(i,j) \neq 1$} \State $X_{i,j} \leftarrow$ {\tt Approximate\_Probabilistic\_Binary}$(i,j,r,c,W)$.\label{line_reject_bit_binary} \State $({\bf s}, r, c, X, W) \leftarrow$ {\tt Deterministic\_Fill}($ \{(i,j,X_{i,j})\}, r, c, X, W)$.\label{preprocess} \EndIf \EndFor \EndFor \State {\bf return} $X$.\end{algorithmic} \end{algorithm} \subsection{Latin squares of order $n$} \ignore{ Suppose $b = (b_1, \ldots, b_k)\in \{0,1\}^k$ is some combination of $k$ 0s and 1s, for any $k \geq 1$. Given also positive integer $n$, let $n_b$ denote a sequence of ceiling and floor functions, each followed by a division by 2, applied to $\lceil n/2 \rceil$. For example, \[ n_{101} = \lceil \lfloor \lceil \lceil n/2 \rceil /2 \rceil / 2\rfloor / 2 \rceil. \] We now define elements $t_b$ inductively. Start with $t^{(0)}$, an $m \times n$ matrix of $0$s. Let $t_0$ denote an $m \times n$ matrix, conditional on $t^{(0)}$, which is 1 wherever $t$ is 0, and 0 otherwise. Similarly, let $t_1$ denote an $m \times n$ matrix, conditional on $t$, which is 1 whenever $t$ is 1, and 0 otherwise. Let $t^{(1)}$ denote an $m\times n$ matrix with each entry consisting of tuple $(g_0, g_1)$, where $g_0$ is the corresponding element in $t_0$, and $g_1$ is the corresponding element in $t_1$. Now define $t^{(b)}$, $b$ of size $k$, conditional on $t^{(b)}$, $b$ of size $k-1$, to be an $m\times n$ matrix which is 1 whenever Similarly, let $W_b$ denote a matrix in $\{0,1\}^{m\times n}$ which is conditional on } We now state a complete version of our main algorithm for random sampling of Latin squares. \begin{algorithm}[H] \caption{Generation of an approximately uniformly random Latin square of order $n$.} \label{latin:square:algorithm} \begin{algorithmic}[1] \State $r \leftarrow (\lfloor n/2 \rfloor, \ldots, \lfloor n/2 \rfloor)$. \State $c \leftarrow (\lfloor n/2 \rfloor, \ldots, \lfloor n/2 \rfloor)$. \State Let $W$ denote the $n\times n$ matrix with all 0 entries. \State $t \leftarrow$ the output from Algorithm~\ref{binary:algorithm:approx} with input $(r,c,W)$. \For {$i=1,2,\ldots, \lceil \log_2(n)\rceil$} \State $r \leftarrow \lfloor r/2\rfloor$. \State $c \leftarrow \lfloor c/2 \rfloor$. \For{$ b = 0, 1, \ldots, 2^{i}-1$} \State Let $W_b(i,j)$ be 0 if $t(i,j) = b$, and 1 otherwise, for all $1 \leq i \leq m, 1 \leq j \leq n$. \State $t_b \leftarrow$ the output from Algorithm~\ref{binary:algorithm:approx} with input $(r, c, W_b)$.\label{rejection_goes_here} \State $t \leftarrow t + 2^i t_b$ \EndFor \EndFor \State {\bf return} $t+1$ \end{algorithmic} \end{algorithm} \ignore{ \begin{remark} It bears repeating that while a priori this algorithm appears to be a sum over an exponentially growing number of tables, and indeed for exposition purposes we have chosen this form in order to clearly convey the procedure, each of the $2^k$ calls to Algorithm~\ref{binary:algorithm} inside the innermost for loop can be performed with one loop over each entry in the table, being careful to apply the correct rejection function for each entry $(i,j)$ based on previously observed bits in entry $(i,j)$. This makes the required time $O(n^2)$ times the cost to evaluate and pass the rejection function threshold in Algorithm~\ref{binary:algorithm}. \end{remark}} \begin{remark} It is easy to adapt this algorithm for the random sampling of $n^2 \times n^2$ Sudoku matrices, with an extra rejection due to the local block constraints; see for example~\cite{DeSalvoNewton} for the precise definition. One could start with Algorithm~\ref{latin:square:algorithm} and perform a hard rejection at each iteration until the binary contingency table generated also satisfies the block constraints, or one could adapt the rejection probability to more effectively target the block constraints. \end{remark} \subsection{Algorithmic costs and a word of caution} We are unable at present to formulate precise runtime estimates, only to say we have implemented the approximation algorithms in practice and they exhibit roughly the runtime estimates we show below, with one major caveat. Part of the difficulty in precisely costing the algorithms is that, for the exact sampling algorithms, they rely on computing numerical quantities for which no known polynomial time algorithm is known. For the approximation algorithms, we have not yet undertaken a full analysis of the bias, and in fact, we caution that the algorithm can potentially reach a state for which the algorithm cannot terminate due to unsatisfiable constraints. In those cases it is up to the practitioner whether the algorithm ought to halt altogether and restart, or whether some partially completed table should be salvaged; again, since we have not performed a detailed analysis of the bias in these algorithms, we have not explored this matter further, except to note that the algorithm is surprisingly effective when it avoids such unsalvageable states. In each of the estimates below, we assume $m$ denotes the number of rows and $n$ denotes the number of columns in a contingency table, and that $W$ is some $m \times n$ matrix with a $1$ in the $(i,j)$-th entry if the $(i,j)$-th entry of the contingency table is forced to be 0. We also define \[ R := \max(r_1, \ldots, r_m), \qquad C := \max(c_1, \ldots, c_n), \qquad M := \max(R,C). \] For Algorithm~\ref{CT:algorithm}, with Procedure~{\tt Approximate\_Probabilistic} used for the {\tt Bit\_Sampler} routine, it is easy to see that barring the encounter of a state which cannot be completed, the expected number of random bits required is $O(n\,m\,\log(M))$, one for each visit to each entry per bit-level. For the arithmetic cost, each call to Procedure~{\tt Approximate\_Probabilistic} involves $O(R \log R)$ arithmetic operations, since the evaluation of the function $F$ can be performed in a numerically stable manner using fast Fourier transforms. In addition, each call to Procedure~{\tt Deterministic\_Fill} involves $O(m^2+n^2)$ arithmetic operations by Lemma~\ref{deterministic_fill_lemma}. Thus, this corresponds to an informal arithmetic cost which is $O((m^2+n^2) m\, n\, R\, \log(R) \log(M))$ in the best case scenario. For Algorithm~\ref{binary:algorithm:approx}, it is easy to see that the expected number of random bits is $O(n\, m)$, with $O((n^2+m^2)m\,n)$ arithmetic operations, since we iterate through each of the $n\, m$ entries at most once, each time calling Procedure~{\tt Approximate\_Probabilistic\_Binary}. Finally, for Algorithm~\ref{latin:square:algorithm}, the expected number of random bits required is $O(n^2 \log(n))$ with $O(n^4 \log n)$ arithmetic operations. \ignore{ \begin{theorem}\label{ct_theorem_tables} Consider Algorithm~\ref{CT:algorithm} with Procedure~{\tt Approximate\_Probabilistic} used for the {\tt Bit\_Sampler} routine. The expected number of random bits required for the algorithm to run to completion is $O( n\, m\, \log(M))$, with $O((m^2+n^2) m\, n\, R\, \log(R) \log(M))$ arithmetic operations. \end{theorem} \begin{proof} Each call to Procedure~{\tt Approximate\_Probabilistic} involves $O(R \log R)$ arithmetic operations, since the evaluation of the function $F$ can be performed in a numerically stable manner using fast Fourier transforms. In addition, each call to Procedure~{\tt Deterministic\_Fill} involves $O(m^2+n^2)$ arithmetic operations by Lemma~\ref{deterministic_fill_lemma}. Finally, since we call these procedures on each of the $m\, n$ entries, and iterate at most $\log(M)$ times, the result follows. \end{proof} \begin{theorem}\label{binary_ct_theorem_tables} For Algorithm~\ref{binary:algorithm:approx}, the expected number of random bits required is $O(n\, m)$, with $O((n^2+m^2)m\,n)$ arithmetic operations. \end{theorem} \begin{proof} Similarly as in the Proof of Theorem~\ref{ct_theorem_tables}, we iterate through each of the $n\, m$ entries at most once, each time calling Procedure~{\tt Approximate\_Probabilistic\_Binary}. By Lemma~\ref{binary_lemma}, this has cost $O(n^2+m^2)$, hence the result follows. \end{proof} \begin{theorem} For Algorithm~\ref{latin:square:algorithm}, the expected number of random bits required is $O(n^2 \log(n))$ with $O(n^4 \log n)$ arithmetic operations. \end{theorem} \begin{proof} We iterate through each of the $n^2$ entries at most $\log(n)$ times, due to the disjoint nature of the divide-and-conquer strategy on the entries. At each entry we potentially call Procedure~{\tt Deterministic\_Fill}, which is $O(n^2)$ by Lemma~\ref{deterministic_fill_lemma}, and hence the result follows. \end{proof} } \ignore{ \subsection{Latin squares of order $n$} \ignore{ Suppose $b = (b_1, \ldots, b_k)\in \{0,1\}^k$ is some combination of $k$ 0s and 1s, for any $k \geq 1$. Given also positive integer $n$, let $n_b$ denote a sequence of ceiling and floor functions, each followed by a division by 2, applied to $\lceil n/2 \rceil$. For example, \[ n_{101} = \lceil \lfloor \lceil \lceil n/2 \rceil /2 \rceil / 2\rfloor / 2 \rceil. \] We now define elements $t_b$ inductively. Start with $t^{(0)}$, an $m \times n$ matrix of $0$s. Let $t_0$ denote an $m \times n$ matrix, conditional on $t^{(0)}$, which is 1 wherever $t$ is 0, and 0 otherwise. Similarly, let $t_1$ denote an $m \times n$ matrix, conditional on $t$, which is 1 whenever $t$ is 1, and 0 otherwise. Let $t^{(1)}$ denote an $m\times n$ matrix with each entry consisting of tuple $(g_0, g_1)$, where $g_0$ is the corresponding element in $t_0$, and $g_1$ is the corresponding element in $t_1$. Now define $t^{(b)}$, $b$ of size $k$, conditional on $t^{(b)}$, $b$ of size $k-1$, to be an $m\times n$ matrix which is 1 whenever Similarly, let $W_b$ denote a matrix in $\{0,1\}^{m\times n}$ which is conditional on } We now state our main algorithm for random sampling of Latin squares, presented to be as simple and concise to follow as possible. As stated, it is a priori the sum of an exponential number of tables; a fortiori, the non-zero entries of these tables form a partition of all $n^2$ entries, and so one would implement the algorithm below to switch between the various rejection functions and thus avoid an exponential number of calls to Algorithm~\ref{binary:algorithm}. \begin{algorithm}[H] \caption{Generation of an approximately uniformly random Latin square of order $n$.} \label{latin:square:algorithm} \begin{algorithmic}[1] \State $r \leftarrow (\lfloor n/2 \rfloor, \ldots, \lfloor n/2 \rfloor)$. \State $c \leftarrow (\lfloor n/2 \rfloor, \ldots, \lfloor n/2 \rfloor)$. \State Let $W$ denote the $n\times n$ matrix with all 0 entries. \State $t \leftarrow$ the output from Algorithm~\ref{binary:algorithm} with input $(r,c,W)$. \For {$i=1,2,\ldots, \lceil \log_2(n)\rceil$} \State $r \leftarrow \lfloor r/2\rfloor$. \State $c \leftarrow \lfloor c/2 \rfloor$. \For{$ b = 0, 1, \ldots, 2^{i}-1$} \State Let $W_b(i,j)$ be 0 if $t(i,j) = b$, and 1 otherwise, for all $1 \leq i \leq m, 1 \leq j \leq n$. \State $t_b \leftarrow$ the output from Algorithm~\ref{binary:algorithm} with input $(r, c, W_b)$. \State $t \leftarrow t + 2^i t_b$ \EndFor \EndFor \State {\bf return} t+1 \end{algorithmic} \end{algorithm} \begin{remark} It bears repeating that while a priori this algorithm appears to be a sum over an exponentially growing number of tables, and indeed for exposition purposes we have chosen this form in order to clearly convey the procedure, each of the $2^k$ calls to Algorithm~\ref{binary:algorithm} inside the innermost for loop can be performed with one loop over each entry in the table, being careful to apply the correct rejection function for each entry $(i,j)$ based on previously observed bits in entry $(i,j)$. This makes the required time $O(n^2)$ times the cost to evaluate and pass the rejection function threshold in Algorithm~\ref{binary:algorithm}. \end{remark} \begin{remark} To make this an exact sampling algorithm one would need to apply an additional rejection after each call to Algorithm~\ref{binary:algorithm}. We have suppressed this rejection, as it requires enumerative estimates which are not easily accessible. \end{remark} } \ignore{ \section{Proofs} \subsection{Proof of Theorem~\ref{exact:theorem:tables}} We also have an analogous lemma for the quantitative bounds, cf.~\cite[Lemma~2.8]{DeSalvoCT}. \begin{lemma}\label{bound} Any algorithm which uses $\L\left(\mbox{Bern}\left(\frac{q_j}{1+q_j}\right)\right)$, where $q_j = \frac{c_j}{m-h_j + c_j}$, as the surrogate distribution for $\L(\epsilon_{i,j}|E)$ in rejection sampling, where $\epsilon_{i,j}$ denote the least significant bit of $X_{i,j}$, assuming each outcome in $\{0,1\}$ has a positive probability of occurring, accepts a bit with an incorrect proportion bounded by at most $m+2$, where $m$ is the number of rows. \end{lemma} \begin{proof} Let $B$ be distributed as $\L\left(\mbox{Bern}\left(\frac{q_j}{1+q_j}\right)\right)$. We have \[ \frac{q_j}{1+q_j} = \frac{c_j}{m-h_j+2c_j}, \] and so \[ \begin{array}{rcl} \frac{1}{m-h_j+2} & < \Pr(B = 1) < & \frac{1}{2} \\ \frac{1}{2} & < \Pr(B=0) < & \frac{m-h_j+1}{m-h_j+2}. \end{array} \] We are able to scale up by the larger point probability, i.e., the event $\{B=0\}$, which means we accept a generated bit of 1 with probability 1, for which we would have to wait at most an expected $m-h_j +2 \leq m+2$ iterations. Thus, at worst we accept a bit $m+2$ times more likely in one state than the other. \end{proof} All that remains is the costing estimates. For Algorithm~\ref{CT:algorithm}, there is no rejection, and so the cost in terms of the expected number of random bits required is simply the cost of visiting all $s$ entries at most $\log M$ times to assign a bit. For Algorithm~\ref{CT:algorithm:approx}, the rejection adds at most $O(m)$ iterations for each entry, which implies $O(s\, m\, \log M)$ expected random bits required. To calculate the rejection probabilities is a convolution of at most $n$ independent random variables. Each convolution costs a priori $O(M^2)$ directly, or $O(M\, \log M)$ using an FFT. Repeating this $n$ times gives $O(n\, M\, \log M)$ for each entry, and so the total arithmetic cost is $O(s\, n\, M\, \log M)$. \subsection{Proof of Theorem~\ref{binary:theorem:tables}} We start with a similar treatment as in the previous section, except instead of taking $X_{i,j}$ to be geometrically distributed, with parameter $p_{i,j} = 1-\alpha_i \beta_j$, we instead take $X_{i,j}$ to be Bernoulli with parameter $\frac{q_{i,j}}{1+q_{i,j}}$, where $q_{i,j} = 1-p_{i,j}$. In fact, this is precisely the distribution of the least significant bit utilized in Algorithm~\ref{CT:algorithm:approx}. \begin{lemma} \label{lemma:uniform} Let $\X_W=(X_{ij})_{1 \leq i \leq m, 1 \leq j \leq n}$ denote a collection of independent Bernoulli random variables with parameters $p_{ij}$, such that $W(i,j) = 1$ implies $p_{i,j} = 0$, and otherwise $p_{ij}$ has the form $p_{ij} = \frac{\alpha_i \beta_j}{1+\alpha_i \beta_j}$. Then $\X_W$ is uniform restricted to binary $(r,c)$-contingency tables with zeros in entries indicated by $W$. \end{lemma} The proof is straightforward, as is the analogous result for Lemma~\ref{bound} and Lemma~\ref{expectation}. The proof of uniformity of Algorithm~\ref{binary:algorithm} follows again almost verbatim from~\cite[Section~4]{DeSalvoCT}, aside from straightforward modifications of boundary conditions, summing over index sets $j \in I_i$ rather than $j=1,2,\ldots,n$, and replacing the role of $\Sigma(r,c,\mathcal{O})$ with $\BC(r,c,W)$. The costing estimates are also straightforward. For Algorithm~\ref{binary:algorithm}, there is no rejection, and so the cost in terms of the expected number of random bits required is simply the cost of visiting all $s$ entries once. For Algorithm~\ref{binary:algorithm:approx}, the rejection adds at most $O(m)$ iterations for each entry, which implies $O(s\, m)$ expected random bits required. To calculate the rejection probabilities is again a convolution of at most $n$ independent random variables. Each convolution costs a priori $O(M^2)$ directly, or $O(M\, \log M)$ using an FFT. Repeating this $n$ times gives $O(n\, M\, \log M)$ for each entry, and so the total arithmetic cost is $O(s\, n\, M\, \log M)$. Since this is a binary contingency table, we must have $M \leq \max(m,n)$, although we prefer to keep this as a separate variable to highlight the case of sparse tables. \subsection{Proof of Theorem~\ref{latin:square:theorem}} The fact that a Latin square can be decomposed into its corresponding bits is straightforward, as is the connection with collections of binary $(r,c)$-contingency tables with restrictions. It is not a priori obvious whether the bits at different levels are independent, and whether certain configurations of binary tables at a given level can potentially be completed by a larger number of Latin squares than other configurations. For $n=6$, we are able to provide a negative answer, although it would be interesting to explore how non-uniform the distribution truly is. According to the OEIS sequence~A058527~\cite{OEIS}, the number of $6 \times 6$ binary contingency tables with row sums and column sums equal to 3 is 297200, which does not divide the number of Latin squares of order $6$, which is 812851200, see for example~\cite{McKayWanless}. Thus, some of the configurations of binary tables yield a different number of completable Latin squares. If one could bound the range of possible completions given such a binary contingency table, then one could obtain quantitative bounds on the number of Latin squares. Next we consider the arithmetic cost. The algorithm requires visiting each entry at most $\lceil \log_2(n)) \rceil$ times. Let us consider the first time entry $(1,1)$ is visited. The rejection probability given in Equation~\eqref{binary:rejection} is the product of two convolutions of at most $n$ elements each, for a total of $2\times O\left(n\, \frac{n}{2}\, \log \frac{n}{2}\right)$. The second time entry $(1,1)$ is visited, the cost is $O\left(\frac{n}{2} \frac{n}{4} \log \frac{n}{4}\right)$. Summing over at most $\lceil \log_2(n)\rceil$ visits, the total cost associated with entry $(1,1)$ is $O(n^2)$. Consider the entry $(i,j)$. The convolutions in Equation~\eqref{binary:rejection} have an initial cost of \[O\left( (n-i) \frac{n-i}{2} \log \frac{n-i}{2} + (n-j) \frac{n-j}{2}\log \frac{n-j}{2}\right) = O\left(n\, \frac{n}{2} \log \frac{n}{2}\right). \] Thus, summing over all entries $O(\log n)$ times we have at most $O(n^4 \log(n))$ arithmetic operations total. The expected number of random bits comes from the rejection probabilities at each step. Consider the first step, which is the random sampling of binary $(\lfloor n/2\rfloor ,\lfloor n/2\rfloor )$-contingency tables. By the previous section, this costs $O(n^3)$, and we repeat this at most $O(\log n)$ times. } \ignore{ \section{Other extensions} \label{continuous} One could also consider, e.g., tables with continuous--valued entries. In this case, the conditioning event is more delicate, as we can condition on events of probability zero with sufficient regularity; see~\cite{PDCDSH}. One can reason a priori that if the conditioning event $E$ can be written as a random variable $T$ with a density evaluated at various values $k \in \mbox{supp}(T)$, then a similar PDC algorithm can be adapted, see~\cite{PDCDSH, DeSalvoCT}. In particular, like the decomposition of geometric random variables into their individual bits, an exponential distribution also has an analogous property. For real $x$, $\{x \}$ denotes the fractional part of $x$, and $\lfloor x \rfloor $ denotes the integer part of $x$, so that $x = \lfloor x \rfloor + \{x \}$. \begin{lemma} Let $Y$ be an exponentially distributed random variable with parameter $\lambda>0$, then: \begin{itemize} \item the integer part, $\lfloor Y \rfloor$, and the fractional part, $\{Y\}$, are independent~\cite{Rejection, SteutelThiemann}; \item $\lfloor Y\rfloor$ is geometrically distributed with parameter $1-e^{-\lambda}$, and $\{Y\}$ has density $f_\lambda(x) = \lambda e^{-\lambda x} / (1-e^{-\lambda})$, $0\leq x < 1$. \end{itemize} \end{lemma} Using this property, a random sampling algorithm for nonnegative real-valued $(r,c)$-contingency tables is presented in~\cite[Algorithm~6]{DeSalvoCT}. The algorithm first samples the fractional part of each entry of the table; conditional on this first step, the remaining sampling problem is the usual random sampling of nonnegative integer-valued $(r',c')$-contingency table, for which Algorithm~\ref{CT:algorithm} is applicable. We are not aware of any non-trivial generalizations of Latin squares to real-valued entries. Here is one which may be of interest. Define a partition $J_1, \ldots, J_n$ of the interval $[0,n]$, and demand that that each row and each column of a matrix $M$ has exactly one entry in each of the sets $J_1, \ldots, J_n$. One can ask, then, to sample from the uniform measure over the set of all such matrices, which has a density with respect to Lebesgue measure. Another generalization would be to take $J_1, \ldots, J_n$ such that $J_1 \cup \ldots \cup J_n = [0,n]$, without the assumption that the sets form a partition, i.e., allow overlap. } \ignore{ \section{Calculations for small $n$} \label{section_calculations} \subsection{$n=2$} Consider the set of Latin squares of order~$2$, i.e., $\left(\begin{array}{cc}1&2\\2&1\end{array}\right)$ and $\left(\begin{array}{cc}2&1\\1&2\end{array}\right)$. These correspond to the bit-wise decomposition \begin{align} \left(\begin{array}{cc}1&2\\2&1\end{array}\right) & = 2^1 \left(\begin{array}{cc}0&1\\1&0\end{array}\right) + 2^0 \left(\begin{array}{cc}1&\blacksquare\\\blacksquare&1\end{array}\right) \\ \left(\begin{array}{cc}2&1\\1&2\end{array}\right) & = 2^1 \left(\begin{array}{cc}1&0\\0&1\end{array}\right) + 2^0 \left(\begin{array}{cc}\blacksquare&1\\ 1&\blacksquare\end{array}\right), \end{align} where we use $\blacksquare$ to denote a forced 0 entry. An application of Algorithm~\ref{latin:square:algorithm} starts by sampling from $X_{11}$, which to yield the uniform distribution over such tables must be $0$ or $1$ with equal probability. We have $c_1 = c_2 = 1$, $m=2$, $q_1 = q_2 = \frac{1}{3}$ and $\frac{q_1}{1+q_1} = \frac{q_2}{1+q_2} = 1/4$. The algorithm generates $X_{11}$ as a Bernoulli$(1/4)$ and applies one of the following rejection probabilities depending on whether the outcome is $0$ or $1$. \begin{align*} R_0 = \P(X_{12} = 1) \P(X_{21}=1) \P(X_{22} = 0) = \frac{3^2}{4^2}, \\ R_1 = \P(X_{12} = 0) \P(X_{21}=0) \P(X_{22} = 1) = \frac{3}{4^2}. \end{align*} The scaling factor in this case is given by $\alpha = \min(R_0, R_1) = \frac{3}{4^2}$. Let $\tilde R_0 = R_0 / \alpha$, and $\tilde R_1 = R_1 / \alpha$. For this particular example we have $\tilde R_0 = 1/3$. The overall probability of accepting $0$ for the $(1,1)$ entry is then given by the geometric series \begin{align*} \P(\tilde X_{11}=0) & = \P(X_{11} = 0) \tilde R_0 + \P(X_{11}=0)^2 (1-\tilde R_0) \tilde R_0 + \P(X_{11}=0)^3 (1-\tilde R_0)^2 \tilde R_0 + \cdots \\ & = \frac{ \P(X_{11}=0)\tilde R_0}{1-\P(X_{11}=0)(1-R_0)} = \frac{1}{2}. \end{align*} Thus, each outcome is produced with probability $1/2$, corresponding to the uniform distribution. \subsection{$n=3$} Rather than apply Algorithm~\ref{latin:square:algorithm} directly to the case $n=3$, we shall approach it in the opposite direction by looking at various $3 \times 3$ tables. Let us take for our next example the $3\times 3$ table with row sums and column sums all equal to 1, of which there are $6!$ tables corresponding to the permutation matrices of $3$. This case allows us an easy way to asses potential bias in Algorithm~\ref{binary:algorithm:approx}. In this case we have $c_1 = 1$, $m=3$, $q_1 = 1/4$, and $\frac{q_1}{1+q_1} = 1/5$. We have \begin{align*} R_0 & = \P(X_{12} +X_{13} = 1) \P(X_{21}+X_{31}=1) = \left(2\, \frac{4}{5^2}\right)^2 = \frac{4^3}{5^4}. \\ R_1 & = \P(X_{12} +X_{13} = 0) \P(X_{21}+X_{31}=0) = \left(\frac{4^2}{5^2}\right)^2 = \frac{4^4}{5^4}. \end{align*} Hence, $\tilde R_0 = 1/4$, and as noted previously we must have $\tilde R_1 = 1$. The overall probability of accepting a $0$ in entry $(1,1)$ is therefore $1/2$, by the same geometric series argument, whereas for the uniform distribution over permutation matrices of size~$3$ it should be $2/3.$ We thus tend to under sample permutation matrices with a $1$ in entry $(1,1)$, with an error proportion not exceeding $|1/2 - 2/3| = 1/6$. Next, we consider a $3 \times 3$ table with row sums and column sums all equal to $1$, with the following fixed zeros \[ \left(\begin{array}{ccc} \underline{\ \ }& \blacksquare &\underline{\ \ } \\ \blacksquare& \underline{\ \ }&\underline{\ \ } \\ \underline{\ \ }&\underline{\ \ } & \blacksquare\end{array}\right). \] WLOG, this covers the case of all possible $3\times 3$ tables row sums and column sums all equal to 1 with exactly one entry in each row and column fixed to be 0. We have $c_1 = 1, m=3, h_1 = 1$, and so $q_1 = \frac{c_1}{c_1+m-h_1}$ } \ignore{ \section{Further directions} It is most common when working with Latin squares to normalize the first row and the first column to be the identity permutation $\{1,2,\ldots,n\}$. We have not carried out this in the interest of simplicity, but this would be a natural optimization to the current approach. } \ignore{ \section{Recycle} Our results are now summarized below. \begin{theorem}\label{exact:theorem:tables} Let $m$ denote the number of rows and $n$ denote the number of columns in a nonnegative integer-valued $(r,c)$-contingency table, and let $M$ denote the largest row sum or column sum. Let $W$ denote an $m\times n$ matrix with a $1$ in the $(i,j)$th entry if the $(i,j)$-th entry of the contingency table is forced to be 0, and let $s := m\, n - \sum_{i,j} W_{i,j}$ denote the number of entries not forced to be 0. \begin{enumerate} \item[(1)] Algorithm~\ref{CT:algorithm} returns a nonnegative integer-valued $(r,c)$-contingency table, uniform over all such tables. The expected number of random bits required is $O( s \log M)$. \item[(2)] Algorithm~\ref{CT:algorithm:approx} returns a nonnegative integer-valued $(r,c)$-contingency table, which is approximately uniform. The expected number of random bits required is $O( s\, m\, \log M)$, with $O(s\, n\, M\, \log^2 M)$ arithmetic operations. \end{enumerate} \end{theorem} Item (1)~in Theorem~\ref{exact:theorem:tables} demonstrates that, should one be able to compute certain numerical quantities efficiently, one would have an optimal sampling method. Item (2)~in Theorem~\ref{exact:theorem:tables} offers an alternative explicit and practical approximation algorithm which does not require any enumeration formulas, and instead uses convolution of independent random variables with explicitly known distribution functions. Analogous results hold for binary $(r,c)$-contingency tables. In addition, motivated by the initial results concerning Shannon's entropy of the collections of Latin squares and Sudoku matrices in~\cite{DeSalvoNewton}, later extended in~\cite{Cameron1, Cameron2}, the goal of sampling uniformly from Latin squares and Sudoku matrices allows us to glean important information about various statistics of interest in information theory, e.g., Shannon's entropy, compared to uniformly random matrices without restrictions. Several PDC algorithms were applied recently for the \emph{exact} sampling from Latin squares and Sudoku matrices in~\cite{DeSalvoSudoku}, by taking advantage of certain statistics in, e.g.,~\cite{FelgenJarvis, Sudoku2}, extending the range of practical exact sampling methods for these structures from those in~\cite{Dahl, Yordzhev2}. There are, however, alternatives like importance sampling for Sudoku matrices~\cite{RidderIS}, and also Markov chain techniques which have been specifically applied to Latin squares, see for example~\cite{Fontana, FontanaFractions}. \begin{theorem}\label{latin:square:theorem} Algorithm~\ref{latin:square:algorithm} produces a valid Latin square of order $n$, approximately uniform over all such Latin squares, which terminates in finite time a.s. The expected number of random bits required is $O(n^3\, \log(n))$, with $O(n^4 \log n)$ arithmetic operations. \end{theorem} One can also generalize the aforementioned tables to having continuous--valued entries, in which case many of the traditional sampling algorithms either break down or require significant adaptation. Using PDC, such generalities are often easily handled, often by adding in just one extra step, see Section~\ref{continuous}; see also~\cite[Algorithm 6]{DeSalvoCT} and~\cite{PDCDSH}. We start with a well-known probabilistic model for the entries in a random contingency table, generalized to include entries which are forced to be 0. In this section, we let $W$ be any given $m\times n$ matrix with values in $\{0,1\}$. For each $j=1,2,\ldots,n$, we define $J_j := \{1,\ldots, n\} \setminus \{ i : W(i,j) = 1\}$, and let $k_j$ denote the last entry in $J_j$. Similarly, for each $i=1,2,\ldots,m$, we define $I_i := \{1,\ldots, n\} \setminus \{j : W(i,j) = 1\}$, and let $\ell_i$ denote the last entry in $I_i$, $i=1,2,\ldots,m$. Also, we let $h_j = \sum_{i=1}^m W(i,j)$ denote the number of entries forced to be zero in column $j$, for $j=1,2,\ldots,n$. \begin{lemma} \label{lemma:uniform} Let $\X_W=(X_{ij})_{1 \leq i \leq m, 1 \leq j \leq n}$ denote a collection of independent geometric random variables with parameters $p_{ij}$, such that $W(i,j) = 1$ implies $X_{i,j}$ is conditioned to have value 0. If $p_{ij}$ has the form $p_{ij} = 1 - \alpha_i \beta_j$, then $\X_W$ is uniform restricted to $(r,c)$-contingency tables with zeros in entries indicated by $W$. \end{lemma} \begin{proof} Let $\X=(X_{ij})_{1 \leq i \leq m, 1 \leq j \leq n}$ denote a collection of independent geometric random variables with parameters $p_{ij}$, where $p_{ij}$ has the form $p_{ij} = 1 - \alpha_i \beta_j$. We have \[\P\big(\X=\xi\big) =\prod_{i,j}\P\big(X_{ij}=\xi_{ij}\big) =\prod_{i,j}(\alpha_i \beta_j)^{\xi_{ij}}(1-\alpha_i \beta_j) =\prod_i\alpha_i^{r_i} \prod_j\beta_j^{c_j}\prod_{i,j}\big(1-\alpha_i \beta_j\big). \] Since this probability does not depend on $\xi$, it follows that the restriction of $\X$ to $(r,c)$-contingency tables is uniform. As the collection of random variables are independent, conditioning on any $X_{i,j} = 0$ only changes the constant of proportionality, and does not affect the dependence on the $\xi$, hence \[\P\big(\X_W=\xi\big) =\prod_{i,j : W(i,j) = 0}\P\big(X_{ij}=\xi_{ij}\big) =\prod_{i,j: W(i,j)=0}(\alpha_i \beta_j)^{\xi_{ij}}(1-\alpha_i \beta_j) =\prod_i\alpha_i^{r_i} \prod_j\beta_j^{c_j}\prod_{i,j}\big(1-\alpha_i \beta_j\big); \] i.e., it follows that the restriction of $\X_W$ to $(r,c)$-contingency tables with forced zero entries indicated by $W$ is uniform. \end{proof} \begin{lemma}\label{expectation} Suppose $\X_W$ is a collection of independent geometric random variables, where $X_{i,j}$ has parameter $p_{ij} = \frac{m-h_j}{m-h_j+c_j}$, for all pairs $(i,j)$ such that $W(i,j) = 0$, and $p_{i,j} = 1$ for all pairs $(i,j)$ such that $W(i,j) = 1$. Then the expected column sums of $\X_W$ are $c_1, c_2, \ldots, c_n$, and the expected row sums are $\sum_{j\in I_1} \frac{c_j}{m-h_j}, \ldots, \sum_{j\in I_m} \frac{c_j}{m-h_j}$. \end{lemma} \begin{proof} Note first that $\E X_{i,j} = p_{i,j}^{-1} - 1$. Then for any $j=1,2,\ldots,n$, \[ \sum_{i=1}^m \E\, X_{i,j} = \sum_{i \in J_j} \frac{m-h_j+c_j}{m-h_j} - 1= c_j \] and similarly for any $i=1,2,\ldots, m$, \[ \sum_{j=1}^n \E\, X_{i,j} = \sum_{j \in I_i} \frac{m-h_j+c_j}{m-h_j}-1 = \sum_{j\in I_i} \frac{c_j}{m-h_j}. \qedhere\] \end{proof} The proof of uniformity of Algorithm~\ref{CT:algorithm} now follows almost verbatim from~\cite[Section~4]{DeSalvoCT}, aside from straightforward modifications of boundary conditions and summing over index sets $j \in I_i$ rather than $j=1,2,\ldots,n$. Start by considering any the first entry in the first column not forced to be 0, say at entry $(s,1)$, and denote the least significant bit by $\epsilon_{s,1}$. As we are in the first column, we have $\L(\epsilon_{s,1}) = \L\left(\mbox{Bern}\left(\frac{q_1}{1+q_1}\right)\right)$, and we reject according to the correct proportion $\P(E | \epsilon_{s,1})$. In fact, as we reject \emph{in proportion} to this probability, we normalize by all terms which do not depend on $k$, which gives \[ \P(E | \epsilon_{s,1} = k) \propto \Sigma\left(\begin{array}{l} (\ldots,r_s-k,\ldots, r_{i_1} - b_{1}(k),\ldots, r_{i_r} - b_{r}(k)), \\ (\ldots,c_1-k, \ldots, c_{j_1} - b_{1}(k),\ldots, c_{j_r} - b_{r}(k)), \\ W,\ \mathcal{O}_{i,j};\ t_1, \ldots, t_r \end{array} \right)\,\cdot \, q_1^{-k}\, \left(\prod_{\ell=1}^r q_{j_\ell}^{-b_{\ell}(k)}\right).\] Since $\P(\epsilon_{s,1} = k) \propto q_1^k$, the rejection function in Equation~\eqref{equation:mn} follows. The rest of the proof follows by induction in a straightforward manner, cf.~\cite[Section~4]{DeSalvoCT}. The second part of the theorem, with rejection function given in Equation~\eqref{alternative:rejection}, is motivated by the following alternative probabilistic formulation of Equation~\eqref{equation:mn}: \begin{align}\label{fij1} \hspace{-0.25in} f(i,j,k, r, c,W) \propto \ & \P\left( \begin{array}{llll} \sum_{\ell\in J_1}^{\ell < j} 2\xi''_{1,\ell}(q_\ell^2, c_\ell) &+ \eta_{1,j,i}'(q_j, c_j) &+ \sum_{\ell\in J_1}^{\ell > j} \xi'_{1,j}(q_\ell, c_\ell) &= r_1 \\ \sum_{\ell\in J_2}^{\ell < j} 2\xi''_{2,\ell}(q_\ell^2, c_\ell) &+ \eta_{2,j,i}'(q_j, c_j) &+ \sum_{\ell\in J_2}^{\ell > j} \xi'_{2,j}(q_\ell, c_\ell) &= r_2 \\ \qquad \vdots \\ \sum_{\ell\in J_{i-1}}^{\ell < j} 2\xi''_{i-1,\ell}(q_\ell^2, c_\ell) &+ \eta_{i-1,j,i}'(q_j, c_j) &+ \sum_{\ell\in J_{i-1}}^{\ell > j} \xi'_{i-1,j}(q_\ell, c_\ell) &= r_{i-1} \\ \sum_{\ell\in J_i}^{\ell < j}2\xi''_{i,\ell}(q_\ell^2, c_\ell) &+ \eta_{i,j,i}''(q_j, c_j) &+ \sum_{\ell\in J_i}^{\ell > j} \xi'_{i,j}(q_\ell, c_\ell) &= r_{i}-k \\ \sum_{\ell\in J_{i+1}}^{\ell < j}2\xi''_{i+1,\ell}(q_\ell^2, c_\ell) &+ \eta_{i+1,j,i}''(q_j, c_j) &+ \sum_{\ell\in J_{i+1}}^{\ell > j} \xi'_{i+1,j}(q_\ell, c_\ell) &= r_{i+1} \\ \qquad \vdots \\ \sum_{\ell\in J_m}^{\ell < j}2\xi''_{m,\ell}(q_\ell^2, c_\ell) &+ \eta_{m,j,i}''(q_j, c_j) &+ \sum_{\ell\in J_m}^{\ell > j} \xi'_{m,j}(q_\ell, c_\ell) &= r_{m} \\ \end{array}\right) \\ \nonumber & \ \ \ \ \times \P\left( \sum_{\ell\in I_i, \ell \leq i} 2\, \xi_{\ell,j}(q_j^2) + \sum_{\ell\in I_i, \ell > i} \xi_{\ell,j}(q_\ell) = c_j - k \right). \end{align} If we could evaluate the probability above exactly, or to some arbitrarily defined precision, then we would obtain an exact sampling algorithm. However, we surmise that the dependencies between the random variables are strongest along the $i$-th row and the $j$-th column, which is why we champion the rejection function in Equation~\eqref{alternative:rejection}, as it captures what is most likely the dominant source of bias, and enforces the parity condition as well. } \section{Acknowledgements} The author would like to acknowledge helpful discussions with Alejandro Morales, Igor Pak, Richard Arratia, and James Zhao. \bibliographystyle{plain}
{'timestamp': '2017-03-28T02:02:36', 'yymm': '1703', 'arxiv_id': '1703.08627', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08627'}
arxiv
\section{Problem Statement}\label{sec:problem-statement} In order to fully specify the scheduler, we need to define the priority values $v^i_k$ for the packets generated by all NCS. The priorities must be designed such that all participating NCS remain stable under limited-capacity priority scheduling. Within these constraints, the scheduler should optimize the overall control performance. In order to formalize the problem statement, we consider the overall system using a lumped switching model that integrates all NCS models with the scheduling behaviour. First, we rewrite the model of each individual NCS in a simpler form. Plugging \eqref{eq:plant}--\eqref{eq:controller} together, we get the following autonomous model for an individual NCS with augmented state $\ensuremath{\mathbf{x}}^i_k = [x^{i\mkern2mu\scriptstyle\trglyph\mkern3mu}_k \; \hat x^{i\mkern2mu\scriptstyle\trglyph\mkern3mu}_k]\ensuremath{^{\scriptstyle\trglyph}}$: \begin{align} \ensuremath{\mathbf{x}}^i_{k+1} &= \ensuremath{\mathbf{A}}^i_{\theta(i,k)} \ensuremath{\mathbf{x}}^i_k,\notag \\ \text{with\quad} \ensuremath{\mathbf{A}}^i_{\theta} &= \begin{bmatrix} A^i & -B^i K^i \\ \theta A^i & (1\!-\!\theta)A^i - B^i K^i \end{bmatrix}. \label{eq:A-individual} \end{align} Note that this is a switching system with two modes: $\ensuremath{\mathbf{A}}^i_0$ for open-loop and $\ensuremath{\mathbf{A}}^i_1$ for closed-loop behaviour. The cost \eqref{eq:cost} of the individual NCS can be rewritten as \begin{align} J^i &= \sum_{k=1}^\infty \ensuremath{\mathbf{x}}^{i\mkern2mu\scriptstyle\trglyph\mkern3mu}_k \ensuremath{\mathbf{Q}}^i\, \ensuremath{\mathbf{x}}^i_k,\notag \\ \text{\quad with\quad} \ensuremath{\mathbf{Q}}^i &= \begin{bmatrix} Q^i & -H^i K^i \\ -K^{i\mkern2mu\scriptstyle\trglyph\mkern3mu} H^{i\mkern2mu\scriptstyle\trglyph\mkern3mu} & K^{i\mkern2mu\scriptstyle\trglyph\mkern3mu} R^i K^i \end{bmatrix}. \label{eq:Q-individual} \end{align} Next, we combine all the systems into one model for the lumped state $\eta_k = \bigl[\ensuremath{\mathbf{x}}^{1\mkern2mu\scriptstyle\trglyph\mkern3mu}_k,\ensuremath{\mathbf{x}}^{2\mkern2mu\scriptstyle\trglyph\mkern3mu}_k,\dotsc,\ensuremath{\mathbf{x}}^{N\mkern2mu\scriptstyle\trglyph\mkern3mu}_k\bigr]\ensuremath{^{\scriptstyle\trglyph}}$ of all NCS: \begin{align} \eta_{k+1} &= \ensuremath{\mathcal{A}}_{\sigma(k)}\eta_k, \label{eq:lumped}\\ \text{with\quad} \ensuremath{\mathcal{A}}_s &= \operatorname{diag}\Bigl( \ensuremath{\mathbf{A}}^1_{\delta(1,s)},\, \ensuremath{\mathbf{A}}^2_{\delta(2,s)},\, \dotsc,\, \ensuremath{\mathbf{A}}^N_{\delta(N,s)} \Bigr) \notag \end{align} This overall system switches between $\scriptstyle\binom{N}{q}$ modes, one for every possible outcome of the scheduler $\sigma(k)$. The mode of each subsystem is determined by whether it is a member of the set $S_{\sigma(k)}$ of scheduled systems as determined by \eqref{eq:scheduler-coupling}. The cost of the overall system is the sum over all NCS \begin{align} \ensuremath{\mathcal{J}} &= \sum_{i=1}^N J^i = \sum_{k=1}^\infty \mathbf \eta_k\ensuremath{^{\scriptstyle\trglyph}} \ensuremath{\mathcal{Q}} \eta_k, \label{eq:lumped-performance}\\ \text{with\quad} \ensuremath{\mathcal{Q}} &= \operatorname{diag}\Bigl( \ensuremath{\mathbf{Q}}^1,\, \ensuremath{\mathbf{Q}}^2,\, \dotsc,\, \ensuremath{\mathbf{Q}}^N \Bigr). \notag \end{align} Our goal is to choose the priorities $v^i_k$ which determine the scheduling function $\sigma(k)$ in \eqref{eq:scheduling-function} such that the overall system \eqref{eq:lumped} is asymptotically stable, while aiming to minimize the overall cost $\mathcal{J}$. Moreover, the priority $v^i_k$ must depend solely on state information of the individual NCS $i$ that is available at the sensor. \section*{Acknowledgments} The authors would like to thank the German Research Foundation (DFG) for financial support, and the anonymous reviewers for their thoughtfulness and helpful suggestions. \section{State-dependent Scheduler for $q=1$}\label{sec:scheduler-1} For ease of presentation, we will begin our analysis for a link capacity of $q=1$, and later generalize the problem setting for an arbitrary queue length in Sec.~\ref{sec:scheduler-q}. In this particular case, the scheduling function \eqref{eq:scheduling-function} simplifies to \begin{equation*} \sigma(k) = \arg\min_i v^i_k. \end{equation*} We use the following sufficient condition from Geromel et al.~\cite{Geromel2008} to find a state-dependent, stabilizing scheduling function and performance bound for the system \eqref{eq:lumped}--\eqref{eq:lumped-performance}. (Other stabilizing switching designs can be found, e.g., in \cite{Lin2006,Lin2009} and references therein.) \begin{thm}[\hskip.1pt\cite{Geromel2008}]\label{thm:lyapunov-metzler} Let $\ensuremath{\mathcal{Q}} \succeq 0$ be given. If there exist a set of positive definite matrices $\ensuremath{\mathcal{P}}_1,\ensuremath{\mathcal{P}}_2\mkern1mu,\dotsc,\ensuremath{\mathcal{P}}_N$ and a matrix $\Pi$ with entries $\pi_{ij}\ge0$ and $\sum_{i=1}^N \pi_{ij} = 1,\; j=1,\dotsc,N$ satisfying the so-called Lyapunov--Metzler inequalities \begin{equation}\label{eq:lyapunov-metzler} \ensuremath{\mathcal{A}}_j\ensuremath{^{\scriptstyle\trglyph}} \biggl( \sum_{i=1}^N \pi_{ij} \ensuremath{\mathcal{P}}_i \biggr) \ensuremath{\mathcal{A}}_j - \ensuremath{\mathcal{P}}_j + \ensuremath{\mathcal{Q}} \prec 0 \end{equation} for all $j \in \{1,\dotsc,N\}$, then the switching policy \begin{equation}\label{eq:centralized-scheduler} \sigma(k) = \arg\min_i \eta_k\ensuremath{^{\scriptstyle\trglyph}} \ensuremath{\mathcal{P}}_i \eta_k \end{equation} makes the origin $\eta=0$ of the system \eqref{eq:lumped} globally asymptotically stable and \begin{equation}\label{eq:performance-bound} \ensuremath{\mathcal{J}} = \sum_{k=1}^\infty \eta_k\ensuremath{^{\scriptstyle\trglyph}} \ensuremath{\mathcal{Q}}\, \eta_k < \eta_0\ensuremath{^{\scriptstyle\trglyph}} \ensuremath{\mathcal{P}}_{\sigma(0)} \eta_0, \end{equation} i.e., the overall performance is bounded. \hfill\QEDopen \end{thm} Note that the condition \eqref{eq:lyapunov-metzler} can also be found in the context of Markov Jump Linear Systems (MJLS). More precisely, if $\Pi$ were the transition probability matrix of a Markov chain, \eqref{eq:lyapunov-metzler} would give mean square stability, see, e.g., \cite{Costa2005}. However, in the considered scenario, the jumps are not driven by a Markov chain but selected deterministically by the scheduler \eqref{eq:centralized-scheduler}. Thus, \eqref{eq:lyapunov-metzler} together with the scheduler \eqref{eq:centralized-scheduler} guarantees stability in the classical, non-stochastic sense. Note further that finding a feasible solution to \eqref{eq:lyapunov-metzler} is a non-convex problem due to the products of $\pi_{ij}$ and $\ensuremath{\mathcal{P}}_i$. However, if the matrix $\Pi$ is fixed, it becomes an LMI problem which can be solved efficiently using available numeric methods. Therefore, we will later propose a heuristic for determining $\Pi$ using necessary stability conditions. However, the scheduling function \eqref{eq:centralized-scheduler} depends on the full state of the lumped system, i.e.\ without further knowledge the states of all NCS have to be aggregated before a scheduling decision can be taken. However, our system architecture requires that packet priorities only depend on the local state. We can rectify this by imposing some constraints on the structure of the matrices $\ensuremath{\mathcal{P}}_i$ as follows. For each NCS, we introduce two positive definite $2n_i\times 2n_i$ matrices $\ensuremath{\mathbf{P}}^i_0$ and $\ensuremath{\mathbf{P}}^i_1$ and add the restriction \begin{equation}\label{eq:P-block-diagonal} \ensuremath{\mathcal{P}}_i = \operatorname{diag}\Bigl( \ensuremath{\mathbf{P}}^1_{\delta(1,i)},\, \ensuremath{\mathbf{P}}^2_{\delta(2,i)},\, \dotsc,\, \ensuremath{\mathbf{P}}^N_{\delta(N,i)} \Bigr) \end{equation} to the conditions in Thm.~\ref{thm:lyapunov-metzler}. This allows us to rewrite the scheduling function \eqref{eq:centralized-scheduler} as follows: \begin{align*} \sigma(k) &= \arg\min_i \eta_k\ensuremath{^{\scriptstyle\trglyph}} \ensuremath{\mathcal{P}}_i\, \eta_k = \arg\min_i \sum_n \ensuremath{\mathbf{x}}_k^{n\mkern2mu\scriptstyle\trglyph\mkern3mu} \ensuremath{\mathbf{P}}^n_{\delta(n,i)}\, \ensuremath{\mathbf{x}}_k^n \\ &= \arg\min_i \ensuremath{\mathbf{x}}_k^{i\mkern2mu\scriptstyle\trglyph\mkern3mu} \ensuremath{\mathbf{P}}^i_1\, \ensuremath{\mathbf{x}}_k^i + \sum_{n\neq i} \ensuremath{\mathbf{x}}_k^{n\mkern2mu\scriptstyle\trglyph\mkern3mu} \ensuremath{\mathbf{P}}^n_0\, \ensuremath{\mathbf{x}}_k^n \\ &= \arg\min_i \ensuremath{\mathbf{x}}_k^{i\mkern2mu\scriptstyle\trglyph\mkern3mu} \bigl( \ensuremath{\mathbf{P}}^i_1 - \ensuremath{\mathbf{P}}^i_0 \bigr) \ensuremath{\mathbf{x}}_k^i + \cancel{\sum_n \ensuremath{\mathbf{x}}_k^{n\mkern2mu\scriptstyle\trglyph\mkern3mu} \ensuremath{\mathbf{P}}^n_0\, \ensuremath{\mathbf{x}}_k^n}. \end{align*} As the minimum in the expression above is independent of the last term, this is equivalent to the priority scheduler \eqref{eq:scheduling-function} together with the priority functions \begin{equation}\label{eq:priority-function} v^i_k = v^i(\ensuremath{\mathbf{x}}^i_k) = \ensuremath{\mathbf{x}}_k^{i\mkern2mu\scriptstyle\trglyph\mkern3mu} \bigl(\ensuremath{\mathbf{P}}^i_1 - \ensuremath{\mathbf{P}}^i_0\bigr)\, \ensuremath{\mathbf{x}}_k^i, \end{equation} which depend only on the state of the corresponding NCS. \begin{figure*}[!t] \normalsize \newcounter{MYtempeqncnt} \setcounter{MYtempeqncnt}{\value{equation}} \setcounter{equation}{26} \begin{align} \ensuremath{\mathbf{A}}_1^{i\mkern2mu\scriptstyle\trglyph\mkern3mu} \biggl( \sum_j^{i\in S_j\mkern-10mu} \pi_{jk} \ensuremath{\mathbf{P}}^i_1 + \sum_j^{i\not\in S_j\mkern-10mu} \pi_{jk} \ensuremath{\mathbf{P}}^i_0 \biggr)\, \ensuremath{\mathbf{A}}^i_1 - \ensuremath{\mathbf{P}}^i_1 + \ensuremath{\mathbf{Q}}^i &\prec 0, \quad\forall (i,k),\, i\in S_k \label{eq:LM-closed-q}\\ \ensuremath{\mathbf{A}}_0^{i\mkern2mu\scriptstyle\trglyph\mkern3mu} \biggl( \sum_j^{i\in S_j\mkern-10mu} \pi_{jk} \ensuremath{\mathbf{P}}^i_1 + \sum_j^{i\not\in S_j\mkern-10mu} \pi_{jk} \ensuremath{\mathbf{P}}^i_0 \biggr)\, \ensuremath{\mathbf{A}}^i_0 - \ensuremath{\mathbf{P}}^i_0 + \ensuremath{\mathbf{Q}}^i &\prec 0, \quad\forall (i,k),\, i\not\in S_k \label{eq:LM-open-q} \end{align} \setcounter{equation}{\value{MYtempeqncnt}} \hrulefill \end{figure*} In order to use this scheduler, we must first determine whether a particular set of NCS can be stabilized under this discipline, and calculate the corresponding coefficient matrices of the priority functions. We will formulate this admission phase as an optimization problem based on the conditions in Thm.~\ref{thm:lyapunov-metzler}. In the following, we reformulate the Lyapunov--Metzler inequalities \eqref{eq:lyapunov-metzler} and propose a heuristic for choosing the matrix $\Pi$ in order to make the problem convex. The benefits of this formulation will become apparent in Sec.~\ref{sec:scheduler-q}, where we show how to generalize our approach to arbitrary queue lengths. All $\ensuremath{\mathcal{P}}_i$ as defined in \eqref{eq:P-block-diagonal} have the same block diagonal structure as $\ensuremath{\mathcal{A}}_i$ and $\ensuremath{\mathcal{Q}}$. Furthermore, as $q=1$, the $i^\text{th}$ diagonal block of $\ensuremath{\mathcal{A}}_i / \ensuremath{\mathcal{P}}_i$ is always given by $\ensuremath{\mathbf{A}}^i_1 / \ensuremath{\mathbf{P}}^i_1$ (closed-loop), whereas the remaining blocks are $\ensuremath{\mathbf{A}}^j_0 / \ensuremath{\mathbf{P}}^j_0$ (open-loop). This allows us to replace the inequalities \eqref{eq:lyapunov-metzler} by the following set of lower-dimensional inequalities: \begin{align} \ensuremath{\mathbf{A}}_1^{i\mkern2mu\scriptstyle\trglyph\mkern3mu} \biggl( \pi_{ii} \ensuremath{\mathbf{P}}^i_1 + (1\!-\!\pi_{ii}) \ensuremath{\mathbf{P}}^i_0 \biggr)\, \ensuremath{\mathbf{A}}^i_1 - \ensuremath{\mathbf{P}}^i_1 + \ensuremath{\mathbf{Q}}_i &\prec 0, \quad\forall_i \label{eq:LM-closed}\\ \ensuremath{\mathbf{A}}_0^{i\mkern2mu\scriptstyle\trglyph\mkern3mu} \biggl( \pi_{ij} \ensuremath{\mathbf{P}}^i_1 + (1\!-\!\pi_{ij}) \ensuremath{\mathbf{P}}^i_0 \biggr)\, \ensuremath{\mathbf{A}}^i_0 - \ensuremath{\mathbf{P}}^i_0 + \ensuremath{\mathbf{Q}}_i &\prec 0, \quad\forall_{i\neq j} \label{eq:LM-open} \end{align} For each $i=1,\dotsc,N$, we can replace all inequalities in \eqref{eq:LM-open} by a single inequality by choosing $\pi_{ij}=p_i,\; \forall_{j=1,\dotsc,N}$. For notational convenience we also define $m_i=\pi_{ii}$, which gives us \begin{equation*} \Pi = \begin{bmatrix} m_1 & p_1 & \cdots & p_1 \\ p_2 & m_2 & \cdots & p_2 \\ \vdots & \vdots & \ddots & \vdots \\ p_N & p_N & \cdots & m_N \end{bmatrix}. \end{equation*} If we fix all $m_i$ and $p_i$, then \eqref{eq:LM-closed}--\eqref{eq:LM-open} become LMIs in $\ensuremath{\mathbf{P}}^i_{0/1}$. In \cite{Geromel2008}, the authors use an approach which is equivalent to choosing $m_i=\alpha\in[0,1]$ and performing a line search over $\alpha$ to accomplish this simplification. However, since \eqref{eq:lyapunov-metzler} implies that all $\sqrt{m_i}\ensuremath{\mathcal{A}}_i$, $i=1,\dotsc,N$ are Schur-stable \cite{Deaecto2015}, we propose the heuristic \begin{equation}\label{eq:ansatz-metzler-m} m_i=\rho(\ensuremath{\mathcal{A}}_i)^{-2}\cdot\alpha, \end{equation} where $\rho(\cdot)$ is the spectral radius, in order to exclude infeasible values a priori. Because in Thm.~\ref{thm:lyapunov-metzler} the matrix $\Pi$ is required to be left-stochastic, i.e.\ with non-negative entries and columns summing up to 1, we can determine the coefficients $p_i$ entirely from $m_i$: \begin{equation}\label{eq:ansatz-metzler-p-1} p = \bigl(\mathbf{11}\ensuremath{^{\scriptstyle\trglyph}}-I\bigr)^{-1}(\mathbf1-m), \end{equation} where $p$ and $m$ are the corresponding column vectors of $p_i$ and $m_i$. This allows us to formulate our first main result. \begin{thm}\label{thm:scheduler} Let $q=1$ and a set of $N$ control systems of the form \eqref{eq:plant}--\eqref{eq:cost} be given with $\theta(i,k)$ as in \eqref{eq:scheduler-coupling}. Let $\ensuremath{\mathbf{A}}^i_0$, $\ensuremath{\mathbf{A}}^i_1$, $\ensuremath{\mathbf{Q}}^i$, $i\in\{1,\dotsc,N\}$, be defined as in \eqref{eq:A-individual}--\eqref{eq:Q-individual}. If there exist a scalar $\alpha\in[0,1]$ and matrices $\ensuremath{\mathbf{P}}^i_0,\ensuremath{\mathbf{P}}^i_1\succ0$ solving the semidefinite program \begin{align} \min\; & \rho \label{eq:sdp-objective}\\ \operatorname{s.t.}\; & \ensuremath{\mathbf{P}}^i_1 - \rho I \prec 0, \quad\forall_i \label{eq:sdp-constraint-rho1}\\ & \ensuremath{\mathbf{P}}^i_0 - \rho I \prec 0, \quad\forall_i \label{eq:sdp-constraint-rho0}\\ & \ensuremath{\mathbf{A}}_1^{i\mkern2mu\scriptstyle\trglyph\mkern3mu} \biggl( m_i \ensuremath{\mathbf{P}}^i_1 + (1\!-\!m_i) \ensuremath{\mathbf{P}}^i_0 \biggr)\, \ensuremath{\mathbf{A}}^i_1 - \ensuremath{\mathbf{P}}^i_1 + \ensuremath{\mathbf{Q}}_i \prec 0, \quad\forall_i \label{eq:sdp-constraint-LM1}\\ & \ensuremath{\mathbf{A}}_0^{i\mkern2mu\scriptstyle\trglyph\mkern3mu} \biggl( p_i \ensuremath{\mathbf{P}}^i_1 + (1\!-\!p_i) \ensuremath{\mathbf{P}}^i_0 \biggr)\, \ensuremath{\mathbf{A}}^i_0 - \ensuremath{\mathbf{P}}^i_0 + \ensuremath{\mathbf{Q}}_i \prec 0, \quad\forall_i \label{eq:sdp-constraint-LM0} \end{align} where $m$ and $p$ are defined as in \eqref{eq:ansatz-metzler-p-1} and \eqref{eq:ansatz-metzler-m}, then the scheduler \eqref{eq:scheduling-function} with the priority functions \eqref{eq:priority-function} makes the origin of each control system globally asymptotically stable. Moreover, the joint LQR cost is bounded by \begin{equation*} \ensuremath{\mathcal{J}}<\rho\sum_{i=1}^N\|\ensuremath{\mathbf{x}}^i_0\|^2. \end{equation*} \vskip-1em\hfill\QEDopen \end{thm} This follows from Thm.~\ref{thm:lyapunov-metzler} together with the definition of $\ensuremath{\mathcal{P}}_i$ in \eqref{eq:P-block-diagonal}, as shown above. To confirm the upper bound on the control cost, we can verify that \begin{equation*}\textstyle \ensuremath{\mathcal{J}} < \eta_0\ensuremath{^{\scriptstyle\trglyph}} \ensuremath{\mathcal{P}}_{\sigma(0)} \eta_0 = \sum_{i=1}^N \ensuremath{\mathbf{x}}^{i\mkern2mu\scriptstyle\trglyph\mkern3mu}_0 \ensuremath{\mathbf{P}}^i_{\sigma(0)} \ensuremath{\mathbf{x}}^i_0 < \sum_{i=1}^N \rho \cdot \ensuremath{\mathbf{x}}^{i\mkern2mu\scriptstyle\trglyph\mkern3mu}_0 \ensuremath{\mathbf{x}}^i_0, \end{equation*} due to \eqref{eq:sdp-constraint-rho1} and \eqref{eq:sdp-constraint-rho0}. Clearly, decomposing the scheduler to enable the use of priority scheduling in the network comes at the cost of suboptimal performance compared to a centralized scheduler \eqref{eq:centralized-scheduler}, as can be seen by comparing the performance bounds in Theorems~\ref{thm:lyapunov-metzler} and \ref{thm:scheduler}. \begin{table} \caption{Size of optimization problem for our approach compared to \cite{Al-Areqi2015}.} \label{tab:lmi-size} \vskip-1ex \centering \begin{tabular}{cccc} \toprule Approach & \#LMIs & size(LMI) & \#vars \\ \midrule ours & $4N$ & $2n \times 2n$ & $2N(2n^2\!+\!n)+1$ \\ \cite{Al-Areqi2015} & $>(N\!+\!1)^2$ & $4N(n\!+\!m) \times 4N(n\!+\!m)$ & $>N^3(n\!+\!m)^2$ \\ \bottomrule \end{tabular} \end{table} In Table~\vref{tab:lmi-size} we compare the size of the optimization problem in Thm.~\ref{thm:scheduler} with that proposed in \cite{Al-Areqi2015} for a set of $N$ systems, all with state dimensions $n$ and input dimensions $m$, in terms of the number of LMI constraints, dimensions of LMI constraints, and number of scalar decision variables. While \cite{Al-Areqi2015} co-designs a suboptimal controller in the process, our approach clearly remains more practical from a computational point of view as the number of participating NCS grows. \section{State-dependent Scheduler for $0<q<N$}\label{sec:scheduler-q} In the previous section, we used the special block diagonal structure of $\ensuremath{\mathcal{A}}_i$, $\ensuremath{\mathcal{P}}_i$, and $\ensuremath{\mathcal{Q}}$ and a heuristic for $\Pi$ to simplify the matrix inequalities in Thm.~\ref{thm:lyapunov-metzler}, and rewrite them as an optimization problem in Thm.~\ref{thm:scheduler}. There, we made the specific assumption that $q=1$. \addtocounter{equation}{2}% If we drop this assumption in favor of the generalization $0<q<N$, then rewriting inequalities \eqref{eq:lyapunov-metzler} in a similar fashion yields the inequalities \eqref{eq:LM-closed-q}--\eqref{eq:LM-open-q} instead (see the top of this page). It is easy to verify that \eqref{eq:LM-closed}--\eqref{eq:LM-open} are in a special case thereof. As before, we can reduce this to a pair of inequalities for each NCS $i=1,\dotsc,N$. For this purpose, the coefficients $\pi_{jk}$ of the matrix $\Pi$ must satisfy the following conditions: \begin{align} \textstyle\sum_{\{j \mid\, i\in S_j\!\}} \pi_{jk} &= m_i,\quad\forall (i,k),\, i\in S_k \label{eq:ansatz-metzler-m-q}\\ \textstyle\sum_{\{j \mid\, i\in S_j\!\}} \pi_{jk} &= p_i,\quad\forall (i,k),\, i\not\in S_k \label{eq:ansatz-metzler-p-q} \end{align} We assume again that the vector $m$ is given, e.g., using \eqref{eq:ansatz-metzler-m}. As $\Pi$ now has additional degrees of freedom and its entries are not directly determined by $m$ and $p$ as they were in the previous section, we need to use a different heuristic to determine a feasible $p$. For instance, we can use the following optimization problem: \begin{align} \min_{\Pi,p}\quad & \operatorname{tr}(\Pi) \label{eq:heuristic-p:first}\\ \operatorname{s.t.}\quad & \pi_{ij} \ge 0, \quad\forall_{i,j}\\ & \!\textstyle\sum_i\, \pi_{ij} = 1, \quad\forall_j\\ & \pi_{ii} \le \rho(\ensuremath{\mathcal{A}}_i)^{-2}, \quad\forall_i \label{eq:heuristic-p:schur}\\ & \eqref{eq:ansatz-metzler-m-q}, \eqref{eq:ansatz-metzler-p-q}, \label{eq:heuristic-p:last} \end{align} where the first two constraints are required by Thm.~\ref{thm:lyapunov-metzler}. The third constraint is equivalent to the necessary condition that $\sqrt{\pi_{ii}}\ensuremath{\mathcal{A}}_i$ must be Schur-stable, which is also our reasoning behind minimizing the trace of $\Pi$. With \eqref{eq:ansatz-metzler-m-q}--\eqref{eq:ansatz-metzler-p-q} the inequalities \eqref{eq:LM-closed-q}--\eqref{eq:LM-open-q} become equivalent to the linear inequalities \eqref{eq:sdp-constraint-LM1}--\eqref{eq:sdp-constraint-LM0} in Thm.~\ref{thm:scheduler}. This allows us to generalise the same result to an arbitrary queue length. \begin{thm}\label{thm:scheduler-q} Let $0<q<N$ and a set of $N$ control systems of the form \eqref{eq:plant}--\eqref{eq:cost} be given with $\theta(i,k)$ as in \eqref{eq:scheduler-coupling}. Let $\ensuremath{\mathbf{A}}^i_0$, $\ensuremath{\mathbf{A}}^i_1$, $\ensuremath{\mathbf{Q}}^i$, $i\in\{1,\dotsc,N\}$, be defined as in \eqref{eq:A-individual}--\eqref{eq:Q-individual}. If there exist a scalar $\alpha\in[0,1]$ and matrices $\ensuremath{\mathbf{P}}^i_0,\ensuremath{\mathbf{P}}^i_1\succ0$ solving the semidefinite program \eqref{eq:sdp-objective}--\eqref{eq:sdp-constraint-LM0}, where $m$ and $p$ are defined as in \eqref{eq:ansatz-metzler-m} and \eqref{eq:heuristic-p:first}--\eqref{eq:heuristic-p:last}, then the scheduler \eqref{eq:scheduling-function} with the priority functions \eqref{eq:priority-function} makes the origin of each control system globally asymptotically stable. Moreover, the joint LQR cost is bounded by $\ensuremath{\mathcal{J}}<\rho\sum_{i=1}^N\|\ensuremath{\mathbf{x}}^i_0\|^2$.~\hfill\QEDopen \end{thm} Analogous to the previous section, it is straightforward to verify that $\sigma(k) = \arg\min_i \eta_k\ensuremath{^{\scriptstyle\trglyph}} \ensuremath{\mathcal{P}}_i\, \eta_k = \arg\min_s \sum_{i\in S_s} \ensuremath{\mathbf{x}}_k^{i\mkern2mu\scriptstyle\trglyph\mkern3mu} \bigl( \ensuremath{\mathbf{P}}^i_1 - \ensuremath{\mathbf{P}}^i_0 \bigr) \ensuremath{\mathbf{x}}_k^i$. From there, the same line of argument as for Thm.~\ref{thm:scheduler} holds. Interestingly, this shows that the scheduling problem for any queue length can be reduced to the same semidefinite programming problem, provided the parameters $p$ are chosen appropriately according to the queue length. Note that our previously defined scheduler requires both the plant state $x^i_k$ and the controller state $\hat x^i_k$ to be known to calculate the priorities $v^i(\ensuremath{\mathbf{x}}^i_k)$. This can be accomplished by maintaining a copy of the controller state recurrence \eqref{eq:prediction} at the sensor, for which $\theta(i,k)$ must be known, e.g., by sending acknowledgments from the controllers to the sensors, cf.\ \cite{Ramesh2013}. However, acknowledgments would have to be delivered reliably, e.g., by reserving an additional virtual link. Also, sending an acknowledgment of size $L_\text{ACK}$ introduces an additional delay, which must be modelled by modifying the propagation delay $D$, e.g., to $D' = 2D + \frac{L_\text{ACK}}{B}$ under the assumption of a symmetric duplex channel. Alternatively, we can impose an appropriate structure on the optimization problem \eqref{eq:sdp-objective}--\eqref{eq:sdp-constraint-LM0}. If we add the following constraints \begin{equation}\label{eq:UDP-constraint} \ensuremath{\mathbf{P}}^i_1 = \begin{bmatrix} X^i_1 & Y^i \\[2pt] Y^{i\mkern2mu\scriptstyle\trglyph\mkern3mu} & Z^i \end{bmatrix},\quad \ensuremath{\mathbf{P}}^i_0 = \begin{bmatrix} X^i_0 & Y^i \\[2pt] Y^{i\mkern2mu\scriptstyle\trglyph\mkern3mu} & Z^i \end{bmatrix}, \end{equation} then the priority functions become $v^i(x^i_k) = x_k^{i\mkern2mu\scriptstyle\trglyph\mkern3mu} \bigl(X^i_1 - X^i_0\bigr)\, x_k^i$, which depend only on the plant state. A similar approach is proposed in \cite{Geromel2008} in a different setup to design a switching output feedback controller. Of course, the corresponding optimization problem is more conservative. However, it allows us to achieve a higher bandwidth utilization than using acknowledgments. \section{System Model}\label{sec:system-model} Consider a set of $N$ different NCS, each comprising a plant and controller, where state samples are sent from sensor to controller over a (virtual) network, as shown in Fig.\,\ref{fig:system-model}. The network is shared by these NCS, but no other applications (i.e., no cross-traffic), and is modelled as a virtual link with bandwidth $B$, delay $D$, and an input queue of capacity $q$. The queue is served by a priority scheduler. In the following, we describe the components of the system model\,---\,control systems, virtual link, and scheduler\,---\,in more detail. \subsection{Control System Model} We assume that all NCS are sampled synchronously at times $t_k$ with a common sampling period $t_{k+1} - t_k = T_s$. Each sample of a plant's state is sent in a packet addressed to the corresponding controller, together which an attached priority value. At the same time, each controller applies a control input to the corresponding plant based on the packets that it has received so far. The plant of NCS $i\in\{1,\dotsc,N\}$ is modelled as a discrete-time system \begin{equation}\label{eq:plant} x^i_{k+1} = A^i x^i_k + B^i u^i_k, \end{equation} where $x^i_k\in\R^{n_i}$ is the state and $u^i_k\in\R^{m_i}$ is the input of plant $i$ at time $t_k$. Upon sampling, the sensor sends a tuple $\bigl(x^i_k,v^i_k\bigr)$ over the network, where $v^i_k$ is the packet priority used by the scheduler to dequeue packets for transmission. We will derive a function for calculating these priorities in Sec.~\ref{sec:scheduler-1}. As measurements may be dropped by the scheduler due to bandwidth limitations, each controller uses the following predictive control law proposed in \cite{Blind2012}. \begin{align} \hat x^i_{k+1} &= \theta(i,k) A^i x^i_k + \bigl( 1 - \theta(i,k) \bigr) A^i \hat x^i_k + B^i u^i_k, \label{eq:prediction}\\ u^i_k &= -K^i \hat x^i_k \label{eq:controller} \end{align} Here, the binary arrival function $\theta(i,k)$ indicates whether the state measurement $x^i_k$ has been successfully received at the controller by time $t_{k+1}$ ($\theta=1$) or not ($\theta=0$). The controller uses the predictive state estimate $\hat x^i_k\in\R^{n_i}$ to compensate for a constant transfer delay of $T_s$ and for dropped packets. We assume that all plants $(A^i,B^i)$ are controllable and that a stabilizing controller $K^i$ is given, i.e., the matrices $A^i-B^iK^i$ are Schur-stable. We use the standard LQR cost \begin{equation}\label{eq:cost} J^i = \sum_{k=1}^\infty x^{i\mkern2mu\scriptstyle\trglyph\mkern3mu}_k Q^i x^i_k + 2 x^{i\mkern2mu\scriptstyle\trglyph\mkern3mu}_k H^i u^i_k + u^{i\mkern2mu\scriptstyle\trglyph\mkern3mu}_k R^i u^i_k \end{equation} as a measure of the control performance of NCS $i$. Therefore, a natural choice for $K^i$ is the standard infinite-horizon LQR controller, which we use in our evaluations. However, the controller may be arbitrary, and we assume it to be designed independently from the scheduler. Please note that we do not derive the optimal controller for this setup. Concerning the separation of optimal control and scheduling, we refer, e.g., to \cite{Ramesh2013,Molin2014}. \subsection{Virtual Link Model} We assume that all NCS packets are of uniform size $L$, which accounts for the memory required for both the state and the attached priority value. A certain bandwidth $B$ is allocated to the shared link, with an input queue of capacity $q$ (in packets) to buffer packets for forwarding. Moreover, the link incurs a fixed delay $D$, which results from the network delay of the underlying communication service. The end-to-end delay experienced by a batch of $q$ NCS packets is therefore $T = \frac{L}{B}q + D$. This channel model corresponds to the end-to-end service offered, for instance, by the `Guaranteed Service' class of the IntServ architecture \cite{RFC2212} for IP networks. Because the transfer delay of a packet must not exceed one sampling period $T_s$ in order to be useful to the controller, the queue must be dimensioned accordingly, such that \begin{equation}\label{eq:queue-capacity} q \le \tfrac{B}{L}(T_s - D). \end{equation} Naturally, this is equivalent to a channel with a one step delay and fixed capacity $q$. For a given (physical) network, we may trade capacity for sampling frequency subject to \eqref{eq:queue-capacity}. As mentioned in the introduction, this shared link need not necessarily be physically restricted, but could also be realized through a virtualized network slice or an IP resource reservation, for instance. Therefore, the bandwidth $B$ may also be regarded as a design parameter to adjust queue capacity and sampling period. \subsection{Priority Scheduler Model} Following the assumption of synchronous sampling, we also assume that all packets from one sampling period arrive at the queue simultaneously, as this yields the worst-case transfer delay. The scheduler is then responsible for servicing the $q$ highest-priority packets, the remainder being dropped. To this end, we define the set of $q$-out-of-$N$-subsets as \begin{equation} \mathcal{S}_q = \Bigl\{\, S\subset\{1,\dotsc,N\} \Bigm| |S|=q \,\Bigr\} = \bigcup_{s} \bigl\{ S_s \bigr\}, \end{equation} with an arbitrary numbering $s=1,\dotsc,{\scriptstyle\binom{N}{q}}$. (For the simplest case $q=1$, we choose $S_s=\{s\}$.) Now, we can define the priority scheduling function \begin{equation}\label{eq:scheduling-function} \sigma(k) = \arg\min_s \sum_{i\in S_s} v^i_k, \end{equation} such that each NCS $i\in S_{\sigma(k)}$ receives a successful transmission in the period $[t_k,t_{k+1})$, whereas all others do not. Thereby, the scheduling function \eqref{eq:scheduling-function} imposes a coupling on the individual arrival indicators $\theta(i,k)$ of all NCS: \begin{equation}\label{eq:scheduler-coupling} \theta(i,k) = \delta\bigl(i,\sigma(k)\bigr) \quad\text{with}\quad \delta(i,s) = \begin{cases} 1 & \text{if }i\in S_s \\ 0 & \text{otherwise.} \end{cases} \end{equation} \section{Evaluation}\label{sec:evaluation} To demonstrate the feasibility of our approach, we ran experiments using real networking hardware with a set of simulated NCS and a proof-of-concept implementation of the priority scheduler. We also show a set of pure simulation examples to illustrate the relationship between queue size, bandwidth utilization and control cost. \subsection{Proof-of-concept Implementation} We ran a proof-of-concept evaluation in a networking testbed consisting of commodity machines (Intel Xeon E5-1650) with $4\times10$\,Gbps Ethernet network interface cards, connected to a 10\,Gbps Ethernet switch (Edge-Core AS5712-54X). The setup of our testbed is shown in Fig.~\ref{fig:eval-setup}. \begin{figure} \centering \begin{tikzpicture}[font=\small,>=latex,every node/.style={align=center}] \node[draw,thick,minimum width=8cm,text width=7cm,text height=7mm,text depth=1mm] (switch) {Switch}; \foreach \p/\x in {1/.1,2/.25,3/.352,4/.515,5/.7,6/.9} {\path (switch.north west) -- node[anchor=north,pos=\x,draw](p\p){} (switch.north east);} \path (p5) -- coordinate[pos=.5](pncs) (p6); \draw (p1) -- ++(0,-.28) -| (p2); \draw (p3) -- ++(0,-.35) -| (p6); \draw (p4) -- ++(0,-.2) -| (p5); \node[draw,thick,yshift=1.3cm,rotate=90,minimum width=1.6cm,minimum height=1cm] (trafgen) at (p1) {cross-\\traffic}; \node[draw,thick,yshift=1.3cm,minimum height=1.6cm,minimum width=2.2cm] (ncsnode) at (pncs) {}; \node[above,font=\footnotesize\slshape] at (ncsnode.north) {NCS Simulations}; \path (trafgen) --node[pos=.5,draw,thick,minimum height=1.6cm,minimum width=3.2cm](middlebox){} (ncsnode); \node[above,font=\footnotesize\slshape] at (middlebox.north) {Middlebox}; \node[draw,yshift=1.6cm,text width=9mm] (fifo) at (p3) {FIFO}; \node[draw,yshift=1.0cm,text width=9mm] (prio) at (p3) {PRIO$^*$}; \node[draw,yshift=1.3cm,minimum height=1cm] (wrr) at (p4) {WRR}; \node[draw,xshift=1pt,yshift=1.7cm,text width=8mm] (ncs1) at (pncs) {NCS\,1}; \node[draw,xshift=1pt,yshift=0.9cm,text width=8mm] (ncs6) at (pncs) {NCS\,6}; \path (ncs1) -- node[pos=.25]{$\vdots$} (ncs6); \draw[->] (trafgen) -- (p1); \draw[->] (p2) |- (fifo); \draw[->] (p3) -- (prio); \draw[->] (fifo) -- (fifo-|wrr.west); \draw[->] (prio) -- (prio-|wrr.west); \draw[->] (wrr) -- (p4); \draw[->] (p5) |- coordinate (branch-left) (ncs6); \draw[->] (branch-left) |- (ncs1); \draw[->] (ncs6) -| coordinate (branch-right) (p6); \draw (ncs1) -| (branch-right); \end{tikzpicture} \caption{% Networking testbed setup used for evaluation. $^*$) Priority scheduling and deficit round robin scheduling were implemented for comparison. } \label{fig:eval-setup} \end{figure} A set of $N=6$ NCS were simulated on one of the machines, with outgoing measurement packets from the simulated sensors of all NCS instances being sent over one network interface, and incoming packets being received on a different interface. In order to improve throughput and reduce unpredictable delays, we used Intel's Data Plane Development Kit (DPDK) \cite{DPDK} instead of Sockets for sending and receiving packets from the simulation instances. We used identical models of an inverted pendulum on a cart for all 6 NCS simulation instances (for details see \cite{Zinkler2016}). The sampling period was chosen at $T_s=50$\,ms. The pendulum for NCS 1 was started at an initial angle of $\phi=35\si\degree$, while all others were started at the origin $\phi=0\si\degree$. A second machine was dedicated to producing cross-traffic approximately at line rate on a dedicated network interface. We use this cross-traffic to demonstrate that our proof-of-concept implementation realizes a dedicated virtual link to isolate NCS traffic from the effects of traffic from other applications, which is one of our initial assumptions. A third machine was used to host a software middlebox implementation realizing both the virtual link provisioning and priority scheduling, also using DPDK for networking. The middlebox maintains two input queues: a priority queue with capacity $q=2$ for NCS traffic, and a FIFO queue for all other traffic. The two queues are served in a weighted round robin fashion, where the priority queue is fully served every $T_s=50$\,ms and the FIFO queue is served during the remaining time. All outgoing traffic is transmitted on the same interface, but cross-traffic is discarded at the switch while NCS traffic is forwarded to the NCS simulation node. In order to compare our state-based dynamic scheduler to a fair static scheduler, we also implemented an alternative middlebox, with the difference that the queue for NCS traffic is not served using packet priorities, but using a deficit round robin (DRR) protocol. \begin{figure} \centering \begin{tikzpicture} \pgfplotsset{footnotesize} \begin{axis}[ name=RoundRobin,legend cell align=left, width=7cm,height=2cm,scale only axis,grid=major, xticklabels={},xmin=0,xmax=300,xtick={0,50,...,300}, ylabel=$\phi\!$,y unit=\si{\degree},ymin=-99,ymax=99,ylabel near ticks,y label style={rotate=-90,xshift=1ex},ytick={-90,-45,0,45,90} ] \addplot[black,thick] table[x index=0,y index=1] {eval/ncs_coord_rr.txt}; \addplot[black!50,very thin] table[x index=0,y index=2] {eval/ncs_coord_rr.txt}; \addplot[black!50,very thin] table[x index=0,y index=3] {eval/ncs_coord_rr.txt}; \addplot[black!50,very thin] table[x index=0,y index=4] {eval/ncs_coord_rr.txt}; \addplot[black!50,very thin] table[x index=0,y index=5] {eval/ncs_coord_rr.txt}; \addplot[black!50,very thin] table[x index=0,y index=6] {eval/ncs_coord_rr.txt}; \addplot[black,thick] table[x index=0,y index=1] {eval/ncs_coord_rr.txt}; \addplot[mark=none, black, dashed] coordinates {(-2,90) (300,90)}; \addplot[mark=none, black, dashed] coordinates {(-2,-90) (300,-90)}; \legend{NCS 1,NCS 2--6} \end{axis} \begin{axis}[ name=PriorityScheduling,legend cell align=left, at={(RoundRobin.below south west)},anchor=north west,yshift=2em, width=7cm,height=2cm,scale only axis,grid=major, xlabel=$t$,xmin=0,xmax=300,x unit=\si{\second},xlabel near ticks,xtick={0,50,...,300}, ylabel=$\phi\!$,y unit=\si{\degree},ymin=-99,ymax=99,ylabel near ticks,y label style={rotate=-90,xshift=1ex},ytick={-90,-45,0,45,90} ] \addplot[black,thick] table[x index=0,y index=1] {eval/ncs_coord_p.txt}; \addplot[black!50,very thin] table[x index=0,y index=2] {eval/ncs_coord_p.txt}; \addplot[black!50,very thin] table[x index=0,y index=3] {eval/ncs_coord_p.txt}; \addplot[black!50,very thin] table[x index=0,y index=4] {eval/ncs_coord_p.txt}; \addplot[black!50,very thin] table[x index=0,y index=5] {eval/ncs_coord_p.txt}; \addplot[black!50,very thin] table[x index=0,y index=6] {eval/ncs_coord_p.txt}; \addplot[black,thick] table[x index=0,y index=1] {eval/ncs_coord_p.txt}; \addplot[mark=none, black, dashed] coordinates {(-2,90) (300,90)}; \addplot[mark=none, black, dashed] coordinates {(-2,-90) (300,-90)}; \legend{NCS 1,NCS 2--6} \end{axis} \end{tikzpicture} \vskip-1ex \caption{% Time series of pendulum angles from evaluation of proof-of-concept implementation with $N=6$, $q=2$, and $T_s=50$\,ms; top: round robin scheduling; bottom: state-based priority scheduling. } \label{fig:eval-timeseries} \end{figure} \begin{table} \caption{% LQR cost comparison for proof-of-concept implementation } \label{tab:eval-cost} \vskip-1ex \centering \begin{tabular}{cccccccc} \toprule Scheduler & $\ensuremath{\mathcal{J}}$ & $J^1$ & $J^2$ & $J^3$ & $J^4$ & $J^5$ & $J^6$ \\ \midrule Round-robin & 73.0 & 48.0 & 5.3 & 4.3 & 3.8 & 7.3 & 4.3 \\ Priority & 23.0 & 13.7 & 2.1 & 1.8 & 1.8 & 1.5 & 2.1 \\ \bottomrule \end{tabular} \end{table} We ran evaluations for both configurations: once using naive deficit round robin and once using our state-based priority scheduling for NCS traffic. Fig.~\ref{fig:eval-timeseries} shows time series for the angle $\phi$ of all six simulated pendulums, while Table~\ref{tab:eval-cost} shows joint and individual LQR cost for comparison. Using state-based priority scheduling reduces the joint cost $\ensuremath{\mathcal{J}}$ by 68\% compared to round robin. Moreover, the cost is more evenly distributed between the NCS. While the stretch between the worst and best performing NCS is $\frac{\max_iJ^i}{\min_iJ^i}=12.8$ with round robin, it is only $8.8$ with state-based priority scheduling. \subsection{Simulation Example} To illustrate the effects of queue dimensioning, we show some simulation results for a fixed set of NCS and network model with varying $q$. We simulate a link with bandwidth $B=10\,000\,\frac{\mathrm{bit}}{\mathrm{s}}$ and delay $D=20\,\mathrm{ms}$, that is shared by $N=10$ NCS with identical (continuous) plant dynamics \begin{equation*} \frac{\operatorname{d}}{\operatorname{d}t} x^i(t) = \begin{bmatrix} 0 & 1 \\ -2 & 2 \end{bmatrix} x^i(t) + \begin{bmatrix} 0 \\ 1 \end{bmatrix} u^i(t) + w^i(t), \end{equation*} initial conditions $x^i(t_0)=\bigl[1,1\bigr]\ensuremath{^{\scriptstyle\trglyph}}$, LQR controller for $Q=I$ and $R=0.1$, and additive white noise $w^i(t)\sim\mathcal{N}\bigl(0,10^{-3}I\bigr)$. We assume the packet size to be $L=192\,\mathrm{bit}$, which corresponds to two IEEE double-precision floating point values for the state and one for the priority. The overall system with the state-based scheduler is simulated for $q=1,\dotsc,N$ over a time period of 100 seconds. In each simulation, the systems are discretized to the minimum possible sampling time according to the link model, i.e.\ $T_s = \frac{L}{B}q + D$. \begin{figure} \centering \begin{tikzpicture} \pgfplotsset{footnotesize,set layers} \begin{axis}[width=5.5cm,height=1.8cm,scale only axis,grid=major, xlabel=$q$,xmin=1,xmax=10,xlabel style={yshift=1ex}, axis y line*=left,ylabel near ticks,ylabel style={rotate=-90,xshift=-0.2em}, ylabel=$\ensuremath{\mathcal{J}}$,ymin=0.3,ymax=0.6] \addplot[black,very thick] coordinates { (1,0.467538) (2,0.438682) (3,0.436419) (4,0.442590) (5,0.443952) (6,0.455901) (7,0.465654) (8,0.476727) (9,0.485225) (10,0.493196) }; \end{axis} \begin{axis}[width=5.5cm,height=1.8cm,scale only axis, axis x line=none,xmin=1,xmax=10, axis y line*=right,ylabel near ticks, ylabel=utilization,ymin=0,ymax=1,ytick={0,0.5,1},ylabel style={yshift=-1em}] \addplot[black,dashed] coordinates { (1,0.489796) (2,0.657534) (3,0.742268) (4,0.793388) (5,0.827586) (6,0.852071) (7,0.870466) (8,0.884793) (9,0.896266) (10,0.90566) }; \end{axis} \end{tikzpicture} \vskip-1ex \caption{ Simulations for varying queue capacity $q$: joint cost $\ensuremath{\mathcal{J}}$ (thick) and bandwidth utilization (dashed). } \label{fig:example} \end{figure} The results, averaged over 50 realizations of the simulation, can be seen in Fig.~\ref{fig:example}. The plot shows the joint LQR cost $\ensuremath{\mathcal{J}}$, together with the bandwidth utilization, which is given by the ratio of the transmission rate $\frac{qL}{T_s}$ to the available bandwidth $B$. Note that the case $q=10$ corresponds to a static equal-bandwidth schedule. We can see that the cost decreases with decreasing $q$, corresponding to more dynamic scheduling, but increases again towards $q=1$. This can be attributed to a lower bandwidth utilization, as the propagation delay $D$ dominates the sampling period for small $q$. \section{Introduction}\label{sec:intro} Networked control systems (NCS) \cite{Hespanha2007} enable the economical and flexible deployment of control applications by closing feedback loops over a packet-switched network. Applications lending themselves naturally to this kind of architecture include autonomous traffic systems, smart factories, and tele-operation, to name but a few. With the rise of an Internet of Things (IoT) ecosystem that brings forth an increasing number of network-enabled appliances, we also expect to see more and more transient and dynamically changing NCS in the future. All these types of applications may commonly involve widely distributed sensors, actuators and controllers. A crucial factor for the proliferation of these applications will be to what extent existing IP networks can be leveraged by control applications. Building NCS on top of packet-switched networks is a challenging task, because the network imposes resource constraints that conflict with the communication requirements of the control systems. Therefore, problems relating to NCS have been studied from various angles over the last decade. In most of these works, the communication system is assumed to be given and modelled as random packet loss or delay. Under these assumptions, a stabilizing or optimal controller as well as bounds on the loss probability or delay are derived. E.g., in \cite{sinopoli04a} the optimal state estimation with intermittent observations as well as bounds for the maximal allowed packet loss probability are derived. The dual problem, i.e., optimal control over links with random packet losses is studied in \cite{imer06a,Schenato2007}. These works are extended to more complex scenarios and more detailed models for the loss process. E.g., in \cite{Schenato2008} the case of packet loss and delay is studied, in \cite{Garone2008} also acknowledgment packets can get lost, in \cite{Mo2013}, packet loss is modelled by a Markov chain, and in \cite{Heemels2010} trade-offs between various network related quantities are studied. To sum up, stabilizability and optimal control for a given model of the communication system has been studied extensively. Recently, the (co-)design of the communication system has also received increasing attention. For instance, it has been investigated how the control performance may be improved through modifications at the transport \cite{Blind2012}, network \cite{Carabelli2014TR} or data link layer \cite{Al-Areqi2013,Al-Areqi2015,Dai2010,Molin2009,Ramesh2011,Ramesh2013,Molin2014}. In this paper, we concern ourselves with the latter. As already stated, most of the previous works model the network as a random loss and delay process. Unfortunately, this does not allow strict stability guarantees, but only allows stochastic stability guarantees. Moreover, loss probabilities and delay distributions of a network are usually neither constant nor readily available. While such assumptions make perfect sense in wireless networks with a high degree of random channel failures, stronger guarantees are possible in switched Ethernet-based IP networks, where bandwidth restrictions and queuing delays are the main limiting factors. In this paper, we start out under the premise that a dedicated `network slice' with fixed resources is available for a set of control systems. This could be realized, e.g., by making a bandwidth reservation along a common route using the integrated services architecture (IntServ) \cite{RFC2212,RFC3175} of the Internet protocol stack. Alternatively, several network virtualization technologies have been proposed \cite{Chowdhury2010} which allow provisioning of such an isolated network slice with arbitrary topologies. Our question is then how to optimally allocate the available resources among all control systems. This question boils down to the scheduling discipline which is used to manage the control systems' access to the network. An early example of a dynamic scheduler for control systems is the Maximum--Error--First policy used for the Try--Once--Discard (TOD) protocol \cite{Walsh2002,Nesic2004}. It assumes that delay-free broadcast communication is used, which may be a reasonable approximation for fieldbuses, but is an unrealistic assumption for IP networks. In \cite{Dai2010}, a static periodic scheduling policy is derived for a set of different NCS, where the schedule is derived from average dwell times. In \cite{Greco2011}, a stochastic RTOS scheduler for anytime control on embedded systems is studied. In \cite{Blind2015}, the suitability of weakly hard real-time schedulers \cite{Gettings2015} has been investigated by deriving sufficient stability conditions for a single NCS, however, without directly taking network utilization and competing traffic into account. Dynamic state-based schedulers for NCS have also been investigated. In \cite{Molin2009,Ramesh2011}, network schedulers are designed for a single delay-free control loop, investigating under which conditions a separation principle holds for the scheduler and certainty-equivalent controller design. This is extended in \cite{Ramesh2013,Molin2014} to multiple control loops, where each sensor uses a local scheduling policy to reduce the number of transmissions, with probabilistic contention based medium access among all NCS. However, these works do not strictly follow a fixed resource constraint. In \cite{Molin2014}, for instance, a price for transmissions is added to the LQR cost and adapted dynamically to maintain an upper bound on the total average transmission rate. Therefore, while available bandwidth may be shared with other applications, a significant amount of bandwidth has to be over-provisioned in advance. \begin{figure} \centering \vskip1em \begin{tikzpicture}[scale=.75, thick, >=latex, csnode/.style={draw,fill=white,text width=#1,text height=1.2em,text depth=0.4em,align=center}] \foreach \n/\y in {1/0,2/-1,N/-2.55} { \node[csnode=2.5cm] (c\n) at (-2,\y) {Controller $\n$}; \node[csnode=1.9cm] (p\n) at (2,\y) {Plant $\n$}; \draw (c\n) edge[->] (p\n); } \path (-2,-1.65) node {$\vdots$} (2,-1.65) node {$\vdots$}; \node[draw=black!40,fill=black!10,cloud,minimum width=6.5cm,minimum height=2cm,cloud puffs=15.3,cloud puff arc=100] at (-0.2,-4.8) {}; \node[csnode=1.8cm] (delay) at (-2.3,-4.7) {Delay $D$}; \node[draw,fill=white,inner sep=1pt,minimum height=2.2em,rectangle split,rectangle split parts=5,rectangle split horizontal] (queue) at (2,-4.7) {\nodepart{three}$\,\cdots$}; \node[below=-.5em] at (queue.south) {$\underbrace{\hskip1.6cm}_{q}$}; \node[csnode=1em,circle,left=-.5pt] (server) at (queue.west) {$B\,$}; \draw (server) edge[->] (delay); \foreach \n/\x/\y in {N/1/6pt,2/1.2/0,1/1.4/-6pt} { \draw[->] (p\n.east) -- ++(\x,0) |- ($(queue.east)+(0,\y)$); \draw[->] ($(delay.west)+(0,\y)$) -- ++(-\x-0.2,0) |- (c\n.west); } \end{tikzpicture} \caption{System architecture: $N$ different NCS communicate over a shared (virtual) link with bandwidth $B$, delay $D$, and input queue of capacity $q$.} \label{fig:system-model} \end{figure} By contrast, we propose to use priority scheduling to utilize the reserved bandwidth as well as possible to optimize control performance. A similar approach is proposed in \cite{Al-Areqi2013,Al-Areqi2015}, where a state-based dynamic priority scheduler for physically coupled NCS is derived from a quadratically structured event-triggering rule and designed together with a suboptimal controller. We, however, assume that the controllers are already given, and design a scheduler accordingly. In \cite{Al-Areqi2015}, a tuning parameter is used to penalize transmissions, thereby reducing control traffic. Like the state-based scheduling strategies mentioned in the previous paragraph, this approach assumes that only one NCS can transmit at any time. We, on the other hand, provide formulations for an arbitrary fixed transmission rate (i.e., number of concurrent transmissions). Also, while \cite{Al-Areqi2015} assumes that the delays are given a priori, we use a channel abstraction conforming with \cite{RFC2212} to model the relationship between available bandwidth, overall transmission rate, and delay. We use LMI stability conditions for switched linear systems from \cite{Geromel2008} to design a scheduler that guarantees asymptotic stability and provides performance bounds for all NCS, and show how these conditions can be generalised to accommodate concurrent transmissions. Our scheduling policy uses dynamic state-based priorities calculated at the sensors which are then used for stateless priority queuing in the network, making it both scalable and efficient to implement. Priority queuing can be found, e.g., as part of the weighted fair queuing (WFQ) algorithm \cite{Parekh1993} supported by many routers. Our paper is organized as follows. In Sec.\,\ref{sec:system-model}, we present our system model, which comprises a set of NCS and the shared communication channel. Based on this model, we formally state our scheduling problem in Sec.\,\ref{sec:problem-statement}. We then derive a scheduler under the assumption that the communication channel admits only one transmission each sampling period in Sec.\,\ref{sec:scheduler-1}, which we then go on to generalize for an arbitrary number of transmissions per sampling period in Sec.\,\ref{sec:scheduler-q}. In Sec.\,\ref{sec:evaluation}, we illustrate our approach with a proof-of-concept implementation and simulation examples. A short discussion of our results and possible avenues for future work in Sec.\,\ref{sec:discussion} concludes this paper. \section{Summary and Discussion}\label{sec:discussion} In this paper, we addressed the optimal scheduling problem for a set of NCS sharing a dedicated network slice. We introduced a switched model of the overall system with a limited-capacity queue model for the communication channel. Based on LMI stability conditions for switched linear systems from \cite{Geromel2008}, we first designed a state-based priority scheduler for a channel capacity of one transmission per sampling period. We then generalised our scheduler design to allow an arbitrary number of NCS to transmit concurrently within one sampling period. The resulting scheduling policy guarantees performance and asymptotic stability of all NCS, and only requires stateless priority queuing in the network, making it both scalable and efficient to implement. To conclude this work, we would like to discuss some aspects of our results. We designed a scheduler under the assumption that all NCS come with a given controller. Of course, joint optimal design of scheduling and controller, e.g.\ as in \cite{Al-Areqi2015}, is an interesting topic for future work. Furthermore, it could be studied how to choose the queue length for a given available bandwidth and network delay, such as to optimize the overall control performance. Also, while we considered priority scheduling for full state feedback here, the output feedback case can be studied by adding restrictions to the LMI constraints, as proposed in \cite{Geromel2008}. Our approach does not provide isolation between the traffic of individual NCS. While this allows us to utilize the available bandwidth to improve overall performance, it opens up the opportunity for one or more NCS to use more of their ``fair'' share to the detriment of all others, possibly to the point of instability. Apart from malicious priority inflation, modelling errors could also lead to this kind of behaviour. One possible solution is to use traffic shaping to limit the bandwidth available to each NCS. The consideration of additional shaping constraints is a topic for future work. In our system model, we make some assumptions that should also be discussed briefly. First, sampling times and therefore packet arrival times of all NCS are synchronized. If this assumption is violated, i.e.\ sampling times of different NCS are phase shifted or packets experience different delays between sensor and scheduler, then any low-priority packet arriving early could impose an additional queuing delay on the remaining NCS traffic and might ultimately cause a higher-priority packet to be dropped. Moreover, we did not account for priorities from different (overlapping) sampling periods to be compared at the scheduler. Second, the communication channels of all NCS are modelled by one shared link. However, in a realistic application scenario, it should be assumed that the traffic of different NCS is routed over overlapping multi-hop paths. This means that a scheduling decision may be required at every hop. In principle, the same scheduler could be implemented at all network elements, since the priorities are preserved under scheduling of different packet subsets in an arbitrary order. However, even if the sampling times are synchronized, this is not necessarily true for the arrival times at schedulers in the network, which has been discussed above. Also, it may lead to suboptimal resource utilization, since unnecessary constraints may be imposed on traffic flows with mutually disjoint network paths. How our approach can be extended to address these issues is to be investigated in future work.
{'timestamp': '2017-03-27T02:04:47', 'yymm': '1703', 'arxiv_id': '1703.08311', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08311'}
arxiv
\section{Introduction} Technology must keep up with the needs of the new innovative optimized systems. An increasing tendency in the usage of pure electronically driven systems for handling complex multifunctional systems, such as an aircraft or an automobile, can be observed. For instance traditional steering or throttle, in the automotive sector, has been modified with electronically driven systems. In aircraft, fly-by-wire technology, or Intelligent Flight Control System by NASA \cite{ifcs}, have been researched and developed to optimize the traditional manual flight controls.\\ Stability, reliability and stand-alone ability are some of the required features by modern systems. These systems are the result of combining complex hardware components with multiple computational units which are in charge of the arithmetic calculations, logic, I/O and control operations.\\ It is the case that a full multifunctional system must be driven by a large amount of different systems, or sub-systems, in addition to their redundant backups to reduce their points of failure. This large amount has a significant negative impact on the cost effectiveness, weight and required physical space.\\ With the design and development of such multifunctional systems comes the necessity of combining multiple physical computational units. As a consequence the degree of difficulty when optimising some basic parameters such as performance, functionality and cost effectiveness rises. Stacking up the various units and interconnecting them might be at first glance the most straight forwarded and simplex solution. This way the required features such as performance are guaranteed. however a different approach has to be taken if an optimum trade-off of the parameters ought to be achieved.\\ \newline A possible workaround is to make use of virtual environments. By way of using a single physical unit instance to hold and populate various virtual instances in charge of running the respective sub-systems. These virtual instances will hence share the physical resources such as processing units and memory. A correct configuration and scaling of such virtual environment may allow to achieve the required performance specifications while decreasing cost, saving weight and reducing space.\\ Nevertheless this walk-around rises yet a further difficulty. Keeping up the performance specifications of the different virtual instances at all moment in time may not be as uncomplicated as it may seem initially. There are many factors that must be examined in depth before asserting whether a system is adequate for a virtual environment. Regardless of the sufficiency of the more obvious aspects in a virtual environment (virtual processing units, memory, shared storage among others) is the connectivity between the different virtual instances or sub-systems.\\ \newline Inside an automobile or an aircraft complex data cross reference operations are made to calculate millions of instructions. This data is sent across the interconnected sub-systems. These operations require perfect connectivity patterns. Furthermore time is a critical factor, milliseconds, even microseconds may change the course of outcome in a specific situation. The electronic stability control (ESP) may be taken as an example. Continuous monitoring and comparison of two data samples, the intended and the actual moving direction, helps keep a automobile, under any circumstance, on track. In the event of ice on the road, the actual moving direction is affected, the system detects this discrepancy when comparing it with the intended moving direction and reacts adequately correcting the trajectory almost instantaneously. This way the automobile is kept safe on track. An absolute failure of the data communication, or simply a delay, may have indeed fatal consequences.\\ \newline The previous example can be used analogously with other systems and helps to understand how important the time factor is.\\ Here lies the crucial aspect of virtualization. Is data transmission performance using virtual environments sufficient? Does it match the reliability of traditional communication? Does virtualization add a noticeable delay to the transmissions? This paper examines virtual environments and their communication capabilities in order to be able to be able to draw conclusions to these questions. It is structured as follows. Section \ref{sec:Overview} provides a survey on selected virtualization technologies describing particular aspects of virtualization software for real-time domains. Section \ref{sec:Development} presents experimental set up. Section \ref{sec:Results} provides experimental results and draws the conclusions. Lastly Section \ref{sec:Background} describes selected related work and Section. \section{Virtualized distributed systems} \label{sec:Overview} \subsection{Virtualization technologies} As briefly mentioned in the introduction, virtualization is the act of creating a virtual version of the systems. One physical platform allows to hold multiple virtual machines which are run by software packages such as hypervisors and emulators. Various types of virtualization techniques have been developed. The two techniques more often used are the so called paravirtualization and hardware virtual machine virtualization. Do note that there are variations and combinations of these techniques which result in further techniques. \begin{itemize} \item \textbf{Paravirtualization (PV)}: efficient and lightweight technique that does not require to emulate the full set of hardware and firmware services. Guest operating systems are aware of the hypervisor and run more efficiently without the emulation nor the virtualization of HW. There is no explicit virtualization support, however PV-Kernel and PV-drivers are essential. \item \textbf{Hardware Virtual Machine (HVM)}: also known as full virtualization, makes use of virtualization extensions from the host CPU to achieve guest virtualization. These extensions are used for performance boost purposes. The Hardware components, adapters and BIOS are emulated while kernel support is not required. \end{itemize} \subsection{Virtualization platforms} Additional to these techniques there are over 50 different platforms that allows to undergo virtualization in the systems. the scope of this paper will focus on \textit{KVM},\textit{QEMU} and \textit{Xen} for general purpose domains, and \textit{XtratuM} for real-time domains.\\ \newline \textit{\textbf{QEMU}} is an emulator and virtualization machine that allows you to run a complete operating system as just another task on your desktop. It can be very useful for trying out different operating systems, testing software, and running applications that won't run on your desktops native platform.\\ QEMU runs on x86 systems running Linux, Microsoft Windows, and some UNIX platforms, and can host target systems from a range of different microprocessors.[5]\\ \newline \textit{\textbf{KVM}}, Kernel-based Virtual Machine, is a full virtualization solution for Linux on x86 hardware containing virtualization extensions, Intel VT or AMD-V. It consists of a loadable kernel module, kvm.ko, which provides the core virtualization infrastructure and a processor specific module, kvm-intel.ko or kvm-amd.ko. Using KVM, multiple virtual machines running unmodified Linux or Windows images can run. Each virtual machine has private virtualized hardware, network cards, disks, graphics adapters an so on.[4]\\ It is important to note that KVM is a fork of Qemu executable. A system can run Qemu by itself and it will handle all the virtual machine resources as well as all the virtual HW and CPU. The only drawback is the extreme slow communication between the host and guests CPU's. This aspect can be optimized using KVM on top, which only focuses on the acceleration of the CPU.\\ If we define the hypervisor or Virtual Machine Monitor (VMM) as a system that creates and runs VM then we can affirm that QEMU is a fully standalone hypervisor whereas KVM is just an accelerator that uses processor extensions.\cite{kvm}\\ \newline \textit{\textbf{Xen}}, now called Xen Project is a native type 1 hypervisor which makes it possible to run various instances, or rather different operating systems, on a single physical machine. It makes use of the paravirtualization technique. Server and desktop virtualizations as well as IaaS applications are the most common direct application of this hypervisor.\cite{xen}\\ \begin{figure}[h] \begin{center} \includegraphics[width=0.6\textwidth]{Xen} \\ \end{center} \caption{Xen Architecture \cite{xen}} \label{fig:xen_arh} \end{figure} \newline Due to the microkernel design Xen only generates a small memory footprint, around 1MB, and restricts a limited interface to the guests. This enforces the robustness and security of the hypervisor. Additionally it provides driver isolation which guarantees that a driver's fault within a VM does not affect the rest of the system.\\ The hypervisor runs directly on the HW and is responsible for managing the memory, CPU and diverse I/O interrupts. The domain 0 is a special domain that apart from containing the drivers will also control and manage creation, destruction and configuration of further virtual machines of the system via means of the toolstack.\cite{xen}\\ \newline \textit{\textbf{Xtratum}} is a real time hypervisor, also of type 1, that provides a framework to run several real-time executives in a robust partitioned environment. Designed as a nanokernel, it virtualizes the essential hardware components for the execution of several concurrent operating systems, being at least one a real time Os. Additionally in order to reduce the design complexity and increase the reliability, its nanokernel was designed as a monolithic and nonpreembale. It is important to note its Independence from Linux and its ability to be bootable.\cite{xtratum}\cite{xm1}\\ \newline Xtratum meets safety critical real-time requirements and hence is used to build partitioned systems. A partition is defined analogous to a virtual machine or instance, as an execution environment managed by the hypervisor. Each partition can make use of the full physical resources at given times, and can support multiple processes implemented by the guest OSes. In order for these partitions to be executed on the hypervisor, they need to be virtualized. The applications, or the execution code must be written the corresponding partition. Additionally, XtratuM takes control of the system at boot time and initializes the hardware prior to executing the partition code.\\ A further relevant feature of XtratuM is the strong temporal and spatial isolation. Temporal isolation is achieved via a fixed cyclic scheduler which makes it impossible for an application to run in parallel with one-another. Strong spatial isolation prevents the sharing of memory and enforces each partition to only access its own allocated memory. Additionally it also provides a strong robust communication mechanism.\cite{xm6} \\ This robust communication mechanism between partitions is a port-based communication. XtratuM implements the channel between at least two access points or ports. Hence the channel is only accessible by the different partitions containing those ports. It is the hypervisor responsibility to encapsulate and transport the data through the channels. There are two different modes in which communication can occur: sampling and queuing.\\ \newline Xtratum also provides with a Fault Management Model. Fault shall include events of a system trap including HW and SW interrupts including processor interrupts, or an event triggered by the hypervisor itself. Faults are at first detected and handled by the hypervisor, then propagated to the corresponding partitions. Furthermore a Health Monitor, part of the hypervisor, is in charge of detecting and reacting to anomalous events or states.\cite{xm6}\\ As a result of the spatial isolation of the different partitions subsystems will not be affected by a faulty partitions.\\ XtratuM uses a cyclic scheduler to run the various partitions, therefore the system consist of states and transitions. During the initialization the partitions find themselves in the \textit{Boot} state. There the initialization of the virtual machine and the standard execution environment including communication, I/O, interrupts and more services occur. After booting the partition changes to \textit{Normal} state. At this state the code is ready to be executed whenever demanded by the hypervisor. The transition between the execution of the different partitions happens automatically according to the fixed time schedule predefined during the initial set up of the environment.\cite{xm4} \\ \newline The simplest scenario for developing XtratuM is composed of two different actors, a partition developer (PD) and an integrator (I). The interaction of these two will allow the establishment of a correct working environment for XtratuM. \\ The first step is for the PD to define the required resources and inform this to the integrator. With this information the integrator configures the XtratuM source code, adapting it to the requirements and using libraries and tools builds the hypervisor binary, \\ Additionally the integrator then allocates the available system resources to the partitions. This is creates the \textit{XM CF} configuration file, where memory areas, scheduling plans, port and channel creation among other resources are detailed described for further processing.\cite{xm5}\\ These resulting binaries are unique and are then sent back to the PDs for the development and building of the execution environment. Once the environment is built, the PD can move on, and creates the partition application. Lastly the integrator will pack the gathered binaries and image together with the resident software. This will allow the partition to be deployed and run.\\ This work-flow has been described in a very simplistic manner. Each step described, includes multiple sub-steps and the use of the extensive XtratuM tool's library.\cite{xm5}\\ \subsection{Communication software or middleware} The middleware can be described in its wide sense as software glue. It lies between the OSes and applications and enables multiple components of a system to communicate and share data.\\ \newline \textit{\textbf{Internet Communication Engine}},Ice, is an object oriented middleware platform. It provides tools, APIs and library support to be used in heterogeneous environments, being unnecessary that both emitter and receiver are written in the same programming language. It can run on different OSes and machine architectures and allows communicating using various networking technologies.\cite{ice} \\ Each Ice object contains an interface with a certain number of operations. These operations, as well as interfaces and data types are exchanged between both ends, client and server, using the Slice language.This language is purely declarative and no statement for execution can be written. The translation of Slice into the different programming languages is supported for C++, C\#, Java, JavaScript, Python, Objective-C, PHP and Ruby.\\ \noindent The IceStorm Service simplifies substantially the implementation of data transfer between multiple clients. It presents a publisher-subscriber solution. It acts as a mediator between the publisher and subscribers respectively. This way the clients are only responsible for sending or receiving data to or from the server. The server will then be in charge of the distribution of the data which allows the clients to disregard any further action rather than sending one set of data to the server.\cite{ice}\\ \newline \textit{\textbf{Data Distribution Service}}, DDS, is a data communication standard managed by Object Management Group (OMG) that provides scalable, low-latency, high performance and interoperable data exchange for distributed applications. It is suitable for real time and near real time systems.\cite{dds} \\ The DDS Standard includes a well defined API that allows the creation of portable code. It references the Real Time Publish Subscribe (RTPS) Wire Protocol standard which defines the wire protocol for DDS communications. Generally speaking DDS is a p2p communication model requiring no gateway, server nor daemons that have to be running nor configured. \\ \textit{OpenDDS} is an open-source version supporting the capability defined in the DDS 1.2 Specification and version 2.2 of The RTPS DDS Interoperability Wire Protocol Specification. A very basic conceptual view of the mentioned Publish Subscribe Architecture can be seen in figure \ref{fig:dds-arch}.\\ \begin{figure}[H] \begin{center} \includegraphics[height=6cm]{dds} \end{center} \caption{DDS\cite{dds}} \label{fig:dds-arch} \end{figure} \noindent Basic components are: Topic, Publisher, Subscriber, DataWriter and DataReader. Topics contain information about a single data type, the distribution and availability. Publication or a Subscription can have many associated Subscriptions or Publications receptively. It is important to note that an application can be either a Publisher a Subscriber or eventually both. Hence the data flow can be easily understood by following the arrows in the conceptual diagram. The association of a publication and a subscription exists only when compatible Topics meet at both writer and reader side.. In this case the Publication and Subscription become associated and data can be exchanged.\\ \section{Developing a distributed partitioned/virtualized system} \label{sec:Development} This section includes a high level description of the procedure taken to develop and implement a distributed environment. As mentioned, the scope of this paper includes both real-time and general purpose domains, therefore two different setups will be implemented. Also as briefly explained in Section \ref{sec:Overview}, by definition real-time systems are described as being partitioned rather than virtualized.\\ For a common understanding a distributed virtual system is a system combined of multiple components across a network which work together. In this case these components will be virtual rather than physical which will be interconnected. A distributed system can be hence translated into a virtual environment.\\ \newline The requirements will therefore be a physical computer unit with the correspondent compatible hardware for the virtualization software. Additionally as the focus is to deep-dive into the transmission performance aspects, middleware technology will be enforced. This will ensure communication scenarios for analysis purposes. \\ \newline \textit{\textbf{Setup A}} will server as the distributed environment for the analysis of general purpose domain. For the implementation Xen 4.4 hypervisor is used to run various domains using the Ubuntu Xenia Xersus distribution. The last piece of the puzzle, the middleware, consists of Ice's service Icestorm which include the components of the subscriber, publisher and server. Version 3.6 is used \cite{Ice36}\\ The various described software components require different overlapping minimum hardware specifications. In order to ensure that everything will work the most restrictive minimum specs of all different aspects must be chosen. Xen, for example, imposes the more restrictive minimum requirement of 1 GB RAM, regardless of whether Ubuntu will work just fine with half of that.\\ The decision for this setup lies in the fact that Xen allows to perform a clean paravirtualization.\\ Additionally Icestorm offers the necessity to have at least three different components that will form a clean distributed virtual system with coherent roles in each of the component members. \\ \begin{table}[] \centering \caption{Unit A} \label{tab:setupa} \begin{tabular}{ll} \hline \textbf{Chipset} & \textit{Intel Core 2 Duo P8700} \\ \hline \multicolumn{1}{l|}{\textbf{Performance}} & \textit{2 x 2.53 GHz} \\ \hline \textbf{RAM} & \textit{1536 MB} \\ \hline \end{tabular} \end{table} For the multiple domain configuration and installation of the Ubuntu distributions, configuration files have to be created appropriately. These config files include all hardware parameters such as memory allocation, network configuration and also the paths to the distribution installation package.\\ On command, Xen parses the configuration file and installs the corresponding domain as described on the configuration file.\\ The different domains will hold the different components, publisher, subscriber and server. This latter one being in charge of the correct distributing of the data.\\ The intercommunication among the various domains implemented by means of the the Xen Toolstack. Brdige-utils allows to implement a virtual switch and virtual network interfaces per guest domain, and so allow communication.\\ With this setup the pertinent performance tests are ready to be executed.\\ \newline \textit{\textbf{Setup B}} includes the implementation of a portioned system on the Xtratum hypervisor, version \textit{xmvm-x86-2.4}. Similar to the first setup hardware specifications have to be met. In this case the thought of concurrent computation is no longer valid, hence a different mind-set must be triggered to better understand this system.\\ The hypervisor can be install on a bare machine, and via the configuration fies, in this case an xml file, the partition cyclic schedule can be configured. A single cycle, milliseconds, in the configuration is represented with the total duration of the cycle and the duration of each of the partitions. Moreover in this file the correspondent ports, channels and resource allocation has to be detailed. After a correct implementation of this xml file, Xtratum is in charge of bringing up the various partitions and keeping the cycles.\\ \begin{figure}[H] \begin{center} \includegraphics[width=0.6\textwidth]{xtr_cycle} \end{center} \caption{Cycle Description \cite{xm5}} \label{fig:xt_cycle} \end{figure} \noindent For simplicity purposes, and in order to obtain clean deterministic results, just simple applications will be installed on the partitions. This means that no real Os will be installed, but rather the simple applications of publisher and subscriber. This two applications will be communicating via a defined channel using the dedicated virtual ports. Hence port based communication. One of the applications will send data to the other.\\ Internally the communication procedure implies that when the publisher is active, the applications writes data to a dedicated buffer. When the subscriber application is active, it will read the data from the buffer. It is important to remember that all parameters, ports, channel as well as the size of such buffer has to be described in the xml file.\\ In other words this second setup can be seen as a more traditional system, with the singularity of not running parallel components, but still communicating by simply writing on a buffer and reading from it.\\ \section{Experiments and Results} \label{sec:Results} With the implemented setups of the two different scenarios, over 100 repetitions of performance tests were carried out to make a detailed analysis of the impact on the transmission times. In order to set ground zero, multiple data samples of 1 Byte, 1 Mbyte and 6 Mbytes were transmitted and its transmission times were recorded.\\ \newline For \textit{\textbf{Setup A}}, as the general purpose domain is under analysis the absolute transmission times do not offer any interesting information. In order to obtain meaningful results the distributed system was set under full CPU load, and around 75\% of memory usage. By means of the following formula, comparing results of idle CPU transmission and loaded CPU, results in the transmission delay can be obtained\\ $$ Tx Delay = Stressed Tx Time - Relaxed Tx Time$$ An overall average value of just under 5 ms in transmission delay was obtained. With this information conclusions can be drawn on how well distributed virtual systems perform, and what its impact in the transmission times are.\\ \newline As for \textbf{\textit{Setup B}} a similar performance test was carried out. The only difference is the lack of middleware and the complexity of having to adjust the channel buffer accordingly to the amount of data wanting to be sent. No CPU load increase was possible as just simple bare applications were running on the different partitions. Nevertheless combinations of different cyclic schedule were made to observe its behaviour.\\ As the real-time domain is under analysis, the actual absolute delay of the transmission is of high importance. For interpreting the results obtained, the understanding of the cyclic partitioned functionality is crucial. As there is a fixed duration predefined for each partition to be executed each cycle, the transmission time should is indirectly set by design, and corresponds to the transition time from one partition to the other partition. In other words, for the system to maintain the real-time aspect, the transmission of data should not exceed the actual time set between the execution of these two partitions.\\ The results obtained indicate a total transmission delay of 2.1\% compared to the transition time between partitions. In absolute values this corresponds to just a few $\mu s$ which are indeed negligible. The results obtained confirms the time criticality of this hypervisor, and indicates the possibility to implement such for real-time systems as the dala is far from being significant. However a further important finding indicates anomalies when the actual execution time of the application within the partition exceeds the the predefined duration of the partition itself. \\ \section{Background} \label{sec:Background} The presented paper is framed in the context of the research performed by the group on time-sensitive distributed large scale systems of Universidad Carlos III de Madrid, and precisely on middleware design, resource management, and analysis of virtualization technologies for real time distributed systems and cyber-physical systems. More precisely, this work is based on the challenges, open problems, and solutions identified in \cite{RTCloud,JSASI2015,JSASI2017,FGCSSI2017} for middleware technologies both over bare machines and virtualized envirornments for predictable cloud computing, and in \cite{Omacy} for middleware technologies in cyber-physical systems. \\ \newline Different middleware technologies have served as basis for design improvements. For example, Ice (Internet Communication Engine) middleware was improved in various contributions such as \cite{Sac2016} in which different parameters were adjusted to improve performance. Moreover, in \cite{Isorc2016} a centralized architecture for real time distributed systems was designed to support a variable (and larger) number of clients. Additional proposals were made for online verification of cyber-physical systems connected as in \cite{Compsac2014}, \cite{Indin2014} and \cite{Hase2016} as well as middleware with augmented logic for supporting changes in the dynamic structure of real time distributed systems based on services \cite{iLandTII}.\\ \newline The current report summarizes a larger work enclosed within the efficient management of the execution platform resources, not only in the participating nodes but also in the interaction and communication between the nodes by means of the improved middleware technology. Likewise, it is enclosed within the dynamic management which requires augmented logic \cite{Vision2011}.\\ \newline With the management of the resources in the participating nodes, a better exploitation of the computational resources (CPU, memory, energy, etc.) is obtained using priorities and resource managers as in \cite{HolaQoS}, \cite{PhD}, \cite{ARES98}, \cite{ModeChange}, \cite{dualBand}, \cite{Clara}, \cite{Cano2013}, or \cite{mobileOS}. Analysis of the kernel functions has also been performed for the kernel itself \cite{AdaEurope2004} and for the networked storage \cite{SPE2006}. Integration of a tight resource control has been recently performed to make the communication middleware aware of the multicore nature of the underlying processors \cite{Sac2017}.\\ \newline In the management of the communication between the nodes based on middleware, for a system with time requirements, or in general for real time systems it is necessary to analyze the reliability of the platform, its performance and temporal stability. In this context the following projects have been developed. In \cite{ACMSigbediLand} an eHealth application was developed supporting reconfiguration triggered by sensors; this work has been recently enhanced with a component model \cite{Compsac2017} for the Integrated Clinical Environment. The temporal cost of the communication of sensors and embedded computers such as Rasperry Pi has been analyzed in \cite{gpcRaspi} and the influence of the middleware design in the communication costs has been analyzed in \cite{gpcUMA,DDSPartitioned} A bridge for adapting middleware to different communication paradigms is presented in \cite{AdaEurope2011}. And lastly, augmented interconnection between iLand and the distributed annex Ada (Ada DSA) is presented in \cite{AdaEurope2012}.\\ \section{Conclusions} This report has presented a summary of a larger work on analyzing the temporal behavior of distributed virtualized systems making use of middleware over real-time virtualization technology. The paper has presented an overview of virtualization technology for efficient, low footprint, and high performance systems, as well as middleware technology that is used to enable distributed communication. The paper has also reported on some summarized results on an actual setting for a distributed virtualized/partitioned system.
{'timestamp': '2017-03-27T02:08:36', 'yymm': '1703', 'arxiv_id': '1703.08469', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08469'}
arxiv
\section{Introduction} \label{sec:intro} Grammatical Evolution (GE) is a grammar-based form of Genetic Programming~\cite{Koza:1992:GP}, where a formal grammar is used in the genotype to phenotype mapping process~\cite{ONeill:2003:GE}. Whereas previous releases of Grammatical Evolution have been written in C~\cite{libGE}, Java~\cite{ONeill:2008:GEVA}, R~\cite{Noorian:2015:GE_R}, and even Ruby~\cite{GERET}, PonyGE2 is an implementation of GE in Python. The original version of PonyGE~\cite{PonyGE} was designed to be short and contained in a single file. However, over time it grew to become unwieldy and a more structured approach was needed. This has led to the development of PonyGE2, presented here. PonyGE2 is intended as an advertisement and a starting-point for those new to GE, a reference for students and researchers, a rapid-prototyping medium for our own experiments, and a Python workout. Grammatical Evolution marries principles from molecular biology to the representational power of formal grammars~\cite{ONeill:2003:GE}. GE’s rich modularity gives a unique flexibility, making it possible to use alternative search strategies, whether evolutionary, deterministic or some other approach, and to radically change its behaviour by merely changing the grammar supplied. As a grammar is used to describe the structures that are generated by GE, it is trivial to modify the output structures by editing the grammar, typically represented in plain text BNF (Backus-Naur Form) format. This is one of the main advantages that makes the GE approach so attractive. The genotype-phenotype mapping also means that instead of operating exclusively on solution trees, as in standard GP, GE allows search operators to act on the genotypes (i.e.~integer or binary lists), on partially derived phenotypes, or on the fully-formed phenotypic derivation trees themselves. The rest of this paper is structured as follows. Section~\ref{sec:ponyge2} frames PonyGE2 against the backdrop of previous GE releases, and outlines its modular structure. Section~\ref{sec:grammars} gives an overview of grammars under PonyGE2, including how grammars are parsed using Regular Expressions in Section~\ref{subsec:parsing_grammars}, and PonyGE2's handling of special grammar characters in Section~\ref{subsec:variable_grammar_ranges}. Section~\ref{sec:linear_representation} details the linear representation of PonyGE2 (including mapping, wrapping, invalid individuals, and unit productions), while Section~\ref{sec:tree_representation} details derivation tree representations. Operators are listed in Section~\ref{sec:operators}. A list of example problems provided with PonyGE2 is given in Section~\ref{sec:examples}, before conclusions are drawn and avenues for future work identified in Section \ref{sec:future_work}. \section{PonyGE2} \label{sec:ponyge2} GEVA \cite{ONeill:2008:GEVA} represented a feature-rich, mature representation of linear GE. However, the codebase was verbose and difficult to maintain or modify, and the release cycle of GEVA had stagnated due to a knowledge gap within the development community. Furthermore, advances in Java 7 and 8 were not being taken advantage of. Python has become a widely used language, and has seen broad adoption from people with little or no programming background in both academia and industry as it provides an easy first step into data science and machine learning. Since GEVA had become verbose, the original version of PonyGE~\cite{PonyGE} was developed as a clean, compact, and overall user-friendly implementation for a user base of varying research needs and backgrounds. Recently PonyGE had seen an uptake in new users, and feedback was that while PonyGE presented a usable Python implementation of GE, the code base had become disorganised. While the original incarnation was intended to be small and compact (`pony-sized') and as such was implemented as a single source file, the continual extension of this original code base to accommodate varying requirements of different researchers negated this original goal. What was once small and compact had become large and unmanageable. The decision was made to merge the feature-rich and modular aspects of GEVA with Python, and to re-structure the development code base of PonyGE into a package structure. As such, the original PonyGE file was re-factored, re-written, and greatly extended to present a cleaner and simpler structure with much added functionality. This modular code base allows users to work on a single package without having to wade through thousands of lines of potentially irrelevant code. As shown in Fig.~\ref{fig:code_base}, each element of the algorithm has been confined in a modular way and the code adapted to allow for usage of multiple search engines and operators. This move harks back to some of the design choices made for GEVA~\cite{ONeill:2008:GEVA}, but also embraces the original ideology behind GE~\cite{ONeill:2003:GE,libGE}. \begin{figure} \centering \tikzstyle{every node}=[thick,anchor=west, rounded corners, font={\scriptsize\ttfamily}, inner sep=2.5pt] \tikzstyle{selected}=[draw=blue,fill=blue!10] \tikzstyle{root}=[selected, fill=blue!30] \begin{tikzpicture}[% scale=.7, grow via three points={one child at (1,0) and two children at (1.15,0) and (1.15,-0.45)}, edge from parent path={(\tikzparentnode.east) |- (\tikzchildnode.west)}] \node [root] {src} child {node {ponyge.py}} child { node at (0, -0.19) [selected] {algorithm} child { node {mapper.py}} child { node {parameters.py}} child { node {search\_loop.py}} child { node {step.py}} } child { node at (0,-1.5) [selected] {fitness} child { node {evaluation.py}} child { node {classification.py}} child { node {regression.py}} child { node {string\_match.py}} child { node {\dots}} } child { node at (0,-3.3) [selected] {operators} child { node {crossover.py}} child { node {initialisation.py}} child { node {mutation.py}} child { node {replacement.py}} child { node {\dots}} } child { node at (0,-5.25) [selected] {representation} child { node {derivation.py}} child { node {grammar.py}} child { node {individual.py}} child { node {tree.py}} } child { node at (0,-6.6) [selected] {stats} child { node {stats.py}} } child { node at (0,-6.9) [selected] {scripts} child { node {\dots}} } child { node at (0,-7.25) [selected] {utilities} child { node {\dots}} }; \end{tikzpicture} \caption{Organizational structure of the PonyGE2 Codebase.} \label{fig:code_base} \end{figure} The modular structure of PonyGE2, as shown in Fig.~\ref{fig:code_base}, allows for a high degree of flexibility in the algorithm. The control flow for a typical PonyGE2 setup is shown in Fig.~\ref{fig:control_flow}. All function blocks in Fig.~\ref{fig:control_flow} represent parametrisable functions. This means that in PonyGE2 not only is it possible to specify unique operators, but it is also possible to easily define unique step and search loop control flows. Unlike with previous official releases of GE systems which required compiling (such as C \cite{libGE} or Java \cite{ONeill:2008:GEVA}), the plug-and-play nature of Python programming coupled with the modularity of the control flow makes PonyGE2 an intuitive, highly user-friendly system that has been designed first and foremost with customisation and personalisation in mind. Furthermore, PonyGE2 is fully PEP-8 compliant \cite{PEP-8}. \begin{figure}[!ht] \begin{center} \includegraphics[width=0.44\textwidth]{ponyge_cf} \caption{PonyGE2 control flow diagram for typical GE/GP setup.} \label{fig:control_flow} \end{center} \end{figure} A major strength of PonyGE2 is the ability to mix and match representation types. Both linear genome representations \cite{ONeill:2003:GE} and derivation tree representations \cite{Whigham:1995:GBGP} are implemented simultaneously in PonyGE2, meaning that every individual has both a genome and full derivation tree. Operators of either type can be mixed and used freely, while maintaining full compatibility with both representation types. There are advantages and disadvantages to both types, discussed later in Sections \ref{sec:linear_representation} and \ref{sec:tree_representation}. PonyGE2 is run from the command line from within the source directory. Executing the main \texttt{ponyge.py} file will run an example regression problem\footnote{Note that the default settings do not necessarily represent suggested good settings, but are to serve primarily as examples of how to use the system.} and generate a results folder. Each results folder generated by an evolutionary run contains several files, detailing all statistics gathered over the course of the run, a graph of the best fitness plotted against generations, a documented list of all the parameters used, as well as a file detailing the best individual. An array of command line arguments are available for specifying desired parameters, which can also be specified in an external parameters file. An important issue for any scientific field is experimental clarity and comparability, i.e.~allowing for experiments to be easily reproduced. To that extent, it is possible to exactly recreate a PonyGE2 run by using the parameters file saved from that run. Parameters files are saved automatically for each run, and include all necessary information (including random seeds) to set the parameters of a new run in order to perfectly reproduce a given experiment\footnote{Note that this is contingent on the use of the original grammar, fitness function, and datasets (if used). Note also that changes to the code may affect result outcomes.}. Furthermore, PonyGE2 comes pre-packaged with a number of benchmark datasets and grammars which can be used to verify and test previous results~\cite{McDermott:2012:Benchmarks,Nicolau:2015:Guidelines}. The PonyGE2 project uses GitHub~\cite{PonyGE2} to allow for open usage of the code with forking and version control. This allows users to stay up to date with current releases as new functionality is rolled out. The use of GitHub also provides issue tracking and a forum for users to voice their desires/problems with the software. PonyGE2 requires Python 3.5 or higher, and uses the matplotlib, numpy, scipy, scikit-learn (sklearn), and pandas packages. All requirements can be satisfied with Anaconda. PonyGE2 v0.1.0 has been released under GNU GPL version 3 \cite{PonyGE2}. \subsection{Scripts and Utilities} Besides the main \texttt{ponyge.py} file that can be found in the \texttt{src} directory, a number of extra scripts are provided with PonyGE2. These are located in the \texttt{scripts} folder. These extra scripts have been designed to work either as standalone files, or to work in tandem with PonyGE2. Various functions from within these scripts can provide extra functionality to PonyGE2. Most prominent of the scripts are a basic experiment manager and statistics parser for executing multiple experimental runs. A full breakdown of all scripts is provided in the \texttt{README} file \cite{PonyGE2}. The \texttt{utilities} folder provides an array of additional functions used by PonyGE2, such as file I/O, plotting, the command-line parser, protected mathematical operators, and error metrics. \section{Grammars} \label{sec:grammars} When tackling a problem with GE, a suitable grammar must initially be defined. The grammar can be either the specification of an entire programming language or, perhaps more usefully, a subset of a language geared towards the problem at hand. In PonyGE2, Bacus-Naur Form (BNF) is used to describe the output language to be produced by the system. BNF is a notation for expressing a grammar in the form of production rules. BNF grammars consist of terminals, which are symbols that can appear in the language, e.g.~locally or globally defined variables, binary boolean operators \texttt{and}, \texttt{or}, \texttt{xor}, and \texttt{nand}, unary boolean operators \texttt{not}, constants, \texttt{True} and \texttt{False} etc.~and non-terminals, which can be expanded into one or more terminals and non-terminals. A grammar is a set of production rules that defines a language. Each production rule is composed of a left-hand side (a single non-terminal), followed by the "goes-to" symbol \texttt{::=}, followed by a list of production choices separated by the "or" symbol \texttt{|}. Production choices can be composed of any combination of terminals or non-terminals. Non-terminals are enclosed by angle brackets \texttt{<>}. For example, consider the following production rule: \begin{center} \texttt{<a> ::= <b>c | d} \end{center} In this rule, the non-terminal \texttt{<a>} maps to either the choice \texttt{<b>c} (a combination of a new non-terminal \texttt{<b>} and a terminal \texttt{c}), or a single terminal \texttt{d}. \subsection{Recursion} \label{sec:recursion} One of the most powerful aspects of GE is that the representation can be variable in length. Notably, rules can be recursive (i.e.~a non-terminal production rule can contain itself as a production choice), which can allow GE to generate solutions of arbitrary size, e.g.: \begin{center} \texttt{<a> ::= <a> + b | b} \end{center} The grammar is used in a developmental approach whereby the evolutionary process chooses the productions to be chosen at each stage of a mapping process, starting from the start symbol, until a complete program is formed. A complete program is one that is comprised solely from elements of the terminal set \texttt{T}. In PonyGE2 the BNF definition is comprised entirely of the set of production rules, with the definition of terminals and non-terminals implicit in these rules. The first non-terminal symbol is by default the start symbol. As the BNF definition is a plug-in component of the system, it means that GE can produce code in any language thereby giving the system flexibility. \subsection{Grammar Parsing} \label{subsec:parsing_grammars} Instead of a handwritten tokenization parser (as implemented in previous versions of GE \cite{libGE,ONeill:2008:GEVA,PonyGE} and in other systems such as ECJ \cite{ECJ}), BNF grammars in PonyGE2 are parsed using regular expressions. The use of regular expressions allows other researchers to integrate parsing BNF grammars easily in their EC systems. The regular expressions have originally been created by \cite{Forstenlechner:2017:GRAMMARS}. The parser allows for the separation of productions onto multiple lines, Python-esque line commenting with `\#', as well as single quotations within double quotations and vice versa for terminals. This allows for the creation of `meta-grammars'. \subsection{Variable ranges in grammars} \label{subsec:variable_grammar_ranges} A useful special case is available when writing grammars: a production can be given as: \begin{center} \texttt{GE\_RANGE:4} \end{center} \noindent for example, and this will be replaced by a set of productions: \begin{center} \texttt{0 | 1 | 2 | 3}. \end{center} With \texttt{GE\_RANGE:dataset\_n\_vars}, the number of productions will be set by the number of columns in the dataset. Using grammar productions like the following, we can avoid hard-coding the number of independent variables, as illustrated in the grammar excerpt shown in Fig.~\ref{fig:GE_range}. \begin{figure}[!ht] \begin{Verbatim} <var> ::= x[<varidx>] <varidx> ::= GE_RANGE:dataset_n_vars \end{Verbatim} \caption{Grammar excerpt showing use of \texttt{GE\_range}.} \label{fig:GE_range} \end{figure} Along with the fitness function, the grammar is one of the most problem-specific components of the PonyGE2 algorithm. The performance of PonyGE2 can be greatly affected by the grammar. \section{Linear Genome Representation} \label{sec:linear_representation} Canonical Grammatical Evolution uses linear genomes (also called chromosomes) to encode genetic information \cite{ONeill:2003:GE}. These linear genomes are then mapped via the use of a formal BNF-style grammar to produce a phenotypic output. All individuals in PonyGE2 have an associated linear genome which can be used to exactly reproduce that individual. \subsection{Genotype-Phenotype Mapping Process} \label{subsec:linear_mapping} The genotype is used to map the start symbol as defined in the Grammar onto terminals by reading codons to generate a corresponding integer value, from which an appropriate production rule is selected by using the Mod (or modulus) rule: \begin{center} \texttt{Rule = c \% r} \end{center} \noindent where \texttt{c} is the codon integer value, and \texttt{r} is the number of rule choices for the current non-terminal symbol. Consider the rule described in Fig. \ref{fig:non_terminal_mapping}. Given the non-terminal \texttt{<op>} which describes a set of mathematical operators that can be used, there are four production rules to select from. As can be seen, the choices are effectively labelled with integers counting from zero. \begin{figure}[!ht] \centering \begin{Verbatim} <op> ::= + (0) | - (1) | * (2) | / (3) \end{Verbatim} \caption{Definition of a non-terminal \texttt{<op>} with four terminal production choices.} \label{fig:non_terminal_mapping} \end{figure} If we assume the codon being read produces the integer 6, then \texttt{6 \% 4 = 2} would select rule (2) \texttt{*}. Therefore, the non-terminal \texttt{<op>} is replaced with the terminal \texttt{*} in the derivation string. Each time a production rule has to be selected to transform a non-terminal, another codon is read. In this way the system traverses the genome. The linear genotype-to-phenotype mapping process in PonyGE2 compiles a full derivation tree for the individual in question by default (this process is detailed in Section \ref{sec:tree_representation}). However, in certain configurations (such as when all variation operators operate on the linear genome), PonyGE2 has no need to maintain the full derivation trees of individuals during the course of an evolutionary run\footnote{Note that this excludes the initialisation of the initial population.}. In this case, a separate mapper is used which only generates numerical information on aspects of the derivation tree such as the overall maximum derivation tree depth and the number of nodes in the tree, resulting in a substantial reduction in the run-time of the algorithm. Thus, individuals mapped from a genome will have the same attributes as those generated from a derivation tree. \subsection{Tails and Wrapping} \label{subsec:wrapping} The `used' portion of the genome (i.e. the portion of the genome that directly maps to the phenotype) may not necessarily cover the entire length of the genome. The remaining unused portion of the genome is referred to as the `tail' of the genome. When initialising individuals by derivation tree-based methods such as Sensible initialisation \cite{Ryan:2003:Sensible} or Position Independent Grow \cite{Fagan:2016:PI}, a complete individual is generated with a complete genome (i.e. the number of used codons is equal to the length of the initial genome). A tail of randomly generated codons is then appended to the complete genome. Tails in PonyGE2 are initialised at 50\% of the length of the original genome, as per recommendations described in \cite{Nicolau:2012:Tails}. However, it must be noted that the use of linear genome operators means that these tails may become used (i.e. tails are not maintained subsequent to initialisation). Even with the presence of tails, during the genotype-to-phenotype mapping process, it is possible to run out of codons before the mapping process has terminated. In this case, a \emph{wrapping} operator can be applied which results in the mapping process re-reading the genome again from the start (i.e. wrapping past the end of the genome back to the beginning). As such, codons are reused when wrapping occurs. This means that it is possible for codons to be used two or more times depending on the number of wraps specified. GE works with or without wrapping, and wrapping has been shown to be useful on some problems \cite{ONeill:2003:GE}, however, it does come at the cost of introducing functional dependencies between codons that would not otherwise arise \cite{Nicolau:2012:Tails}. By default, wrapping in PonyGE2 is not used, however it is possible to specify the desired maximum number of times the mapping process is permitted to wrap past the end of the genome back to the beginning again. Note that permitting the mapping process to wrap on genomes does not necessarily mean it will wrap across genomes. The provision is merely allowed. \subsection{Invalid Individuals} \label{subsec:invalids} In GE each time the same codon is expressed it will always generate the same integer value, but depending on the current non-terminal to which it is being applied, it may result in the selection of a different production rule. This feature is referred to as ``intrinsic polymorphism''. What is crucial however, is that each time a particular individual is mapped from its genotype to its phenotype, the same output is generated. This is the case because the same choices are made each time. In some cases it is possible that an incomplete mapping could occur; if the genome has been completely traversed (even after multiple wrapping events), and the derivation string (i.e. the derived expression) still contains non-terminals, such an individual is dubbed \emph{invalid} as it will never undergo a complete mapping to a set of terminals. For this reason an upper limit on the number of wrapping events that can occur is imposed (as detailed in Section \ref{subsec:wrapping}), otherwise mapping could continue indefinitely in this case. In the case of an invalid individual, the mapping process is typically aborted and the individual in question is given the lowest possible fitness value. The selection and replacement mechanisms then operate accordingly to increase the likelihood that this individual is removed from the population. To reduce the number of invalid individuals being passed from generation to generation various strategies can be employed. Strong selection pressure could be applied, for example, through a steady state replacement. Alternatively, a repair strategy can be adopted which ensures that every individual results in a valid program. For example, in the case that there are non-terminals remaining after using all the genetic material of an individual (with or without the use of wrapping) default rules for each non-terminal can be pre-specified that are used to complete the mapping in a deterministic fashion. Another strategy is to remove the recursive production rules that cause an individual’s phenotype to grow, and then to reuse the genotype to select from the remaining non-recursive rules. Finally, the use of genetic operators which manipulate the derivation tree rather than the linear genome can be used to ensure the generation of completely mapped phenotype strings. \subsection{A note on unit productions} \label{subsec:unit_productions} A {\em unit production} is a production which is the only production on the right-hand side of a rule. Traditionally, GE would not consume a codon for unit productions. This was a design decision taken by O'Neill et al.~\cite{ONeill:2003:GE}. However, in PonyGE2 unit productions consume codons, the logic being that it helps to do linear tree-style operations. The original design decision on unit productions was also taken before the introduction of evolvable grammars whereby the arity of a unit production could change over time. In this case consuming codons will help to limit the ripple effect from that change in arity. In summary, the merits for not consuming a codon for unit productions are not clearly defined in the literature. The benefits in consuming codons are a reduction in computation and improved speed with linear tree style operations. Other benefits are an increase in non-coding regions in the chromosome that through evolution of the grammar may then express useful information. \section{Derivation Tree Representation} \label{sec:tree_representation} During the linear genotype-to-phenotype mapping process, a derivation tree is implicitly generated; since each production choice generates a codon, it can be viewed as a node in an overall derivation tree. The parent rule that generated that choice is viewed as the parent node, and any production choices resultant from non-terminals in the current production choice are viewed as child nodes. The depth of a particular node is defined as how many parents exist in the tree directly above it, with the root node of the entire tree (the start symbol of the grammar) being at depth 1. Finally, the root of each individual node in the derivation tree is the non-terminal production rule that generated the node choice itself. A full derivation tree of a PonyGE2 individual is encoded as a recursive class, with all nodes in the tree being instances of that class. While linear genome mapping means that each individual codon specifies the production choice to be selected from the given production rule, it is possible to do the opposite. Deriving an individual solution purely using the derivation tree (i.e. \emph{not} using the genotype-to-phenotype mapping process defined in Section \ref{subsec:linear_mapping}) is entirely possible, and indeed provides a lot more flexibility towards the generation of individuals than a linear mapping. In a derivation tree based mapping process, each individual begins with the start rule of the grammar (as with the linear mapping). However, instead of a codon from the genome defining the production to be chosen from the given rule, a random production is chosen. Once a production is chosen, it is then possible to retroactively {\em create} a codon that would result in that same production being chosen if a linear mapping were to be used. In order to generate a viable codon, first the index of the chosen production is taken from the overall list of production choices for that rule. Then, a random integer from within the range: \begin{center} \texttt{[no.~choices : no.~choices : CODON\_SIZE]} \end{center} \noindent (i.e. a number from \texttt{no.~choices} to \texttt{CODON\_SIZE} with a step size of \texttt{no.~choices}). Finally, the index of the chosen production is added to this random integer. This results in a codon which will re-produce the production choice. For example, consider the following rule: \begin{center} \texttt{<e> ::= a | b | c} \end{center} Now, let us randomly select the production choice \texttt{b}. The index of production choice \texttt{b} is 1. Next, we randomly select an integer from within the range \texttt{[3: 3: CODON\_SIZE]}, giving us a random number of 768. Finally, we add the index of production choice \texttt{b}, to give a codon of 769. In this manner it is possible to build a derivation tree, where each node will have an associated codon. Simply combining all codons into a list gives the full genome for the individual. Importantly, since the genome does not define the mapping process, invalid solutions can not be generated by derivation tree-based methods. \subsection{Context-Aware Operations} Since production choices are not set with the use of a derivation tree representation (i.e. the production choice defines the codon, rather than the codon defining the production choice), it is possible to build derivation trees in an intelligent manner by restricting certain production choices. For example, it is possible to force derivation trees to a certain depth by only allowing recursive production choices to be made until the tree is deep enough that branches can be terminated at the desired depth. This is the basis of context-aware derivation methods such as Ramped Half-and-Half (or Sensible) initialisation \cite{Ryan:2003:Sensible}. It is also possible to perform intelligent variation operations using derivation tree methods. For example, crossover and mutation can be controlled by only selecting specific types of sub-trees for variation (e.g. sub-trees of specific sizes or sub-trees rooted at specific nodes). Note that the use of derivation tree-based operators comes at the expense of increased computational run-time. In general, the use of a linear genome does not allow for such context-aware operations, i.e. operations on linear genomes are performed randomly, without reference to the effect or output of any particular portion of the genome. Although intelligent linear genome operators exist, e.g. \cite{Byrne:2009:Mutation}, they are not implemented in PonyGE2 as similar functions can be performed in a simpler manner using derivation-tree based operations. \section{Operators} \label{sec:operators} This section contains a list of all operators currently implemented in PonyGE2. \subsection{Initialisation} \label{subsec:initialisation} There are two main ways to initialise a GE individual: by generating a genome, or by generating a derivation tree. Generation of a genome can only be done by creating a random genome string, and as such the use of genome initialisation cannot guarantee control over any aspects of the initial population. Population initialisation via derivation tree generation on the other hand allows for fine control over many aspects of the initial population, e.g. depth limits or derivation tree shape. Unlike with genome initialisation, there are a number of different ways to initialise a population using derivation trees. Currently implemented methods are detailed below. \textbf{\subsubsection{Linear genome initialisation}~} At present, the only method for initialising a population of individuals through the use of linear genomes in Grammatical Evolution is to generate random genome strings, known as Random Genome Initialisation. Random genome initialisation in Grammatical Evolution should be used with caution as poor grammar design can have a negative impact on the quality of randomly initialised solutions due to the inherent bias capabilities of GE \cite{Fagan:2016:PI,Nicolau:2016:Repetition}. \textbf{\subsubsection{Derivation tree initialisation}~} Initialising a population of individuals through the use of derivation tree-based methods allows for much greater control over many aspects of individuals in the population, including derivation tree depth, number of nodes, and shape. At present, there are three such initialisation methods in PonyGE2, outlined below. \smallskip \textbf{Random tree initialisation} \noindent Random derivation tree initialisation generates individuals by randomly building derivation trees up to the specified maximum initialisation depth limit. This is analogous to using the \texttt{Grow} component of Ramped Half-and-Half/Sensible initialisation to generate an entire population \cite{Ryan:2003:Sensible}. Note that there is no obligation that randomly generated derivation trees will extend to the depth limit; they will be of random size, but depending on how the grammar is written they may have a tendency towards smaller tree sizes with the use of a grammar-based mapping \cite{Fagan:2016:PI,Nicolau:2016:Repetition}. \smallskip \textbf{Ramped Half-and-Half/Sensible Initialisation} \cite{Ryan:2003:Sensible} \noindent Ramped Half-and-Half initialisation in Grammatical Evolution is often called ``Sensible Initialisation" \cite{Ryan:2003:Sensible}. Sensible Initialisation follows traditional GP Ramped Half-and-Half initialisation by initialising a population of individuals using two separate methods: \texttt{Full} and \texttt{Grow}. \texttt{Full} initialisation generates a derivation tree where all branches extend to the specified depth limit. This tends to generate very bushy, evenly balanced trees \cite{Fagan:2016:PI}. \texttt{Grow} initialisation generates a randomly built derivation tree where no branch extends past the depth limit. Note that the \texttt{Grow} component of Sensible initialisation is analogous to random derivation tree initialisation, i.e. no branch in the tree is \emph{forced} to reach the specified depth. Depending on how the grammar is written, this can result in a very high probability of small trees being generated, regardless of the specified depth limit \cite{Fagan:2016:PI}. Note also that RHH initialisation with the use of a grammar-based mapping process such as GE can potentially result in a high number of duplicate individuals in the initial generation, resulting from a potentially high number of very small solutions \cite{Fagan:2016:PI,Harper:2010:Initialisation,Nicolau:2016:Repetition}. As such, caution is advised when using RHH initialisation in grammar-based systems, as particular care needs to be given to grammar design in order to minimise this effect \cite{Fagan:2016:PI, Harper:2010:Initialisation}. \smallskip \textbf{Position Independent Grow Initialisation} \cite{Fagan:2016:PI} \noindent Position Independent Grow (PI Grow) initialisation in Grammatical Evolution mirrors Sensible/Ramped Half-and-Half initialisation by initialising a population of individuals over a ramped range of depths. However, while RHH uses two separate methods \texttt{Full} and \texttt{Grow} to generate pairs of individuals at each depth, PI Grow eschews the \texttt{Full} component and only uses the \texttt{Grow} aspect. There are two further differences between traditional GP \texttt{Grow} and PI Grow \cite{Fagan:2016:PI}: \begin{enumerate} \item At least one branch of the derivation tree is forced to the specified maximum depth in PI Grow, and \item Non-terminals are expanded in random (i.e. position independent) order rather than the left-first derivation of traditional mappers. \end{enumerate} \subsection{Selection} \label{subsec:selection} The selection operator takes the original Generation $n$ population and produces a parent population to be used by the variation operators. As detailed in Section \ref{subsec:invalids}, the linear genome mapping process in Grammatical Evolution can generate invalid individuals. Only valid individuals are selected by default in PonyGE2, however this can be changed with the use of an optional argument. Two selection operators are provided in PonyGE2. These operators are detailed below. \textbf{\subsubsection{Tournament Selection}~} \label{subsubsec:tournament} Tournament selection randomly selects \texttt{tournament\_size} individuals from the overall population and returns the best. This process continues until \texttt{generation\_size} individuals have been selected. If no elitism is used, the \texttt{generation\_size} is equal to the full \texttt{population\_size}. However, if elitism is used, the \texttt{generation\_size} is equal to the full \texttt{population\_size} minus the number of elites. This prevents extra individuals from being generated and evaluated which would constitute additional search. \textbf{\subsubsection{Truncation Selection}~} Truncation selection takes an entire population, sorts it, and returns a specified top proportion of that population. \subsection{Variation} \label{subsec:variation} Variation operators in evolutionary algorithms explore the search space by varying genetic material of individuals in order to explore new areas of the search space. The two main types of variation operator implemented in PonyGE2 are Crossover and Mutation. \textbf{\subsubsection{Crossover}~} Crossover randomly selects pairs of parents from the parent population created by the selection process. Unlike canonical Genetic Programming \cite{Koza:1992:GP}, crossover in Grammatical Evolution always produces \emph{two} children from these two parents \cite{ONeill:2003:Crossover}. As with Tournament Selection, Crossover in PonyGE2 continues until \texttt{generation\_size} children have been generated (i.e. crossover operates over the entire parent population rather than a specified percentage of that population). One derivation tree-based crossover operator is provided in PonyGE2, along with four linear crossover operators. Note that with all linear genome crossovers, crossover points are selected within the used portion of the genome by default (i.e. crossover does not occur in the unused tail of the individual). Note also that while subtree-based operators do not allow invalid individuals to be generated, this is possible with all linear operators. \smallskip \textbf{Fixed Onepoint Crossover} \noindent Given two individuals, fixed onepoint crossover creates two children by selecting the same point on both genomes for crossover to occur. The head of genome 0 is then combined with the tail of genome 1, and the head of genome 1 is combined with the tail of genome 0. This means that genomes will always remain the same length after crossover. \smallskip \textbf{Fixed Twopoint Crossover} \noindent Given two individuals, fixed twopoint crossover creates two children by selecting the same points on both genomes for crossover to occur. The head and tail of genome 0 are then combined with the mid-section of genome 1, and the head and tail of genome 1 are combined with the mid-section of genome 0. This means that genomes will always remain the same length after crossover. \smallskip \textbf{Variable Onepoint Crossover} \noindent Given two individuals, variable onepoint crossover creates two children by selecting a different point on each genome for crossover to occur. The head of genome 0 is then combined with the tail of genome 1, and the head of genome 1 is combined with the tail of genome 0. This allows genomes to grow or shrink in length. \smallskip \textbf{Variable Twopoint Crossover} \noindent Given two individuals, variable twopoint crossover creates two children by selecting two different points on each genome for crossover to occur. The head and tail of genome 0 are then combined with the mid-section of genome 1, and the head and tail of genome 1 are combined with the mid-section of genome 0. This allows genomes to grow or shrink in length. \textbf{\subsubsection{Mutation}~} While crossover operates on pairs of selected parents to produce new children, mutation in Grammatical Evolution operates on every individual in the child population \emph{after} crossover has been applied. Note that this is different in implementation so canonical GP crossover and mutation, whereby a certain percentage of the population would be selected for crossover with the remaining members of the population subjected to mutation \cite{Koza:1992:GP}. One subtree mutation operator is provided in PonyGE2, along with to linear genome mutation operators, detailed below. By default, linear genome mutation operators in PonyGE2 operate only on the used portion of the genome. \smallskip \textbf{Codon-based Integer Flip Mutation} \noindent Codon-based integer flip mutation randomly mutates every individual codon in the genome with a certain probability. \smallskip \textbf{Genome-based Integer Flip Mutation} \noindent Genome-based integer flip mutation mutates a specified number of codons randomly selected from the genome. \subsection{Evaluation} \label{subsec:evaluation} PonyGE2 takes advantage of vectorised evaluation to enable fast evaluation on large dataset arrays for supervised learning problems. Furthermore, caching is provided in PonyGE2, along with a few options for dealing with cached individuals as discussed in \cite{Nicolau:2016:Repetition}. Multicore evaluation is also provided, but this feature is not currently supported on machines using a Windows OS. \subsection{Replacement} \label{subsec:replacement} The replacement strategy for an Evolutionary Algorithm defines which parents and children survive into the next generation. Two replacement operators are provided in PonyGE2. \textbf{\subsubsection{Generational Replacement with Elitism}~} Generational replacement replaces the entire parent population with the newly generated child population at every generation. Generational replacement is most commonly used in conjunction with elitism. With elitism, the best \texttt{ELITE\_SIZE} individuals in the parent population are copied over unchanged to the next generation. Elitism ensures continuity of the best ever solution at all stages through the evolutionary process, and allows for the best solution to be updated at each generation. \textbf{\subsubsection{Steady State Replacement}~} Steady state replacement uses the GENITOR model \cite{Whitley:1989:GENITOR} whereby new individuals directly replace the worst individuals in the population regardless of whether or not the new individuals are fitter than those they replace. Note that traditional GP crossover generates only 1 child \cite{Koza:1992:GP}, whereas linear GE crossover (and thus all crossover functions used in PonyGE2) generates 2 children from 2 parents~\cite{ONeill:2003:GE,ONeill:2003:Crossover}. Thus, PonyGE2 uses a deletion strategy of 2. \section{Example Problems} \label{sec:examples} Four example problems are provided in the initial release of PonyGE2. These problems are described in this section. \subsection{String-match} The grammar specifies words as lists of vowels and consonants along with special characters. The aim is to match a target string. The default string match target is \texttt{Hello world!}. \subsection{Regression} The grammar generates a symbolic function composed of standard mathematical operations and a set of variables. This function is then evaluated using a pre-defined set of inputs, given in the datasets folder. Each problem suite has a unique set of inputs. The aim is to minimise some error between the expected output of the function and the desired output specified in the datasets. This is the default problem for PonyGE. The default dataset is the Vladislavleva-4 dataset~\cite{Vladislavleva:2009:Non_Linearity}. \subsection{Classification} Classification can be considered a special case of symbolic regression but with a different error metric. Like with regression, the grammar generates a symbolic function composed of standard mathematical operations and a set of variables. This function is then evaluated using a pre-defined set of inputs, given in the datasets folder. Each problem suite has a unique set of inputs. The aim is to minimise some classification error between the expected output of the function and the desired output specified in the datasets. \subsection{Pymax} One of the strongest aspects of a grammatical mapping approach such as PonyGE2 is the ability to generate executable computer programs in an arbitrary language \cite{ONeill:2003:GE}. In order to demonstrate this in the simplest way possible, we have included an example python programming problem. The \texttt{Pymax} problem is a traditional maximisation problem, where the goal is to produce as large a number as possible. However, instead of encoding the grammar in a symbolic manner and evaluating the result, we have encoded the grammar for the \texttt{Pymax} problem as a basic Python programming example. The phenotypes generated by this grammar are executable python functions, whose outputs represent the fitness value of the individual. Users are encouraged to examine the \texttt{pymax.bnf} grammar, the \texttt{pymax.py} fitness function, and the resultant individual phenotypes to gain an understanding of how grammars can be used to generate such arbitrary programs~\cite{PonyGE2}. \subsection{Adding New Problems} It has been made as simple as possible to add new problems to PonyGE. To add a new problem, any number of the following may be required: \begin{enumerate} \item a new grammar file named with a {\tt .bnf} suffix and placed in {\tt grammars/}; \item a new fitness function implemented as a class in a file {\tt fitness/x.py} where {\tt x} is the name of the class (note that existing fitness functions may be re-used, e.g. for supervised learning problems); \item for supervised learning, a new dataset split into {\tt datasets/x/Train.csv} and {\tt datasets/x/Test.csv} where {\tt x} is a subdirectory named after the dataset. \end{enumerate} \section{Conclusions and Future Work} \label{sec:future_work} This paper described PonyGE2, a modern Python implementation of Grammatical Evolution. While this paper presents a brief overview of the system, comprehensive documentation is available on GitHub at \url{https://github.com/jmmcd/PonyGE2}. The codebase is fully commented to facilitate understanding and to provide ease of extensibility, and is PEP-8 compliant for readability. We welcome future contributors and collaborators from the wider field, and GitHub provides a forum for future discussion \cite{PonyGE2}. A number of additions to PonyGE2 are planned in the immediate future. Development is ongoing, and will see the implementation of a number of additional features, including: \begin{enumerate} \item Multi-objective optimisation using NSGA-II \cite{Deb:2002:NSGAII}, \item Python packaging integration (e.g.~\texttt{setup.py}, \texttt{MANIFEST.in}, etc.): the aim is to have PonyGE2 PIP-installable. \item Parametrisable termination conditions, \item Extension of multicore evaluation support to Windows OS machines, and look into the integration of cloud based multicore support. \item Addition of more search engines and problems. \end{enumerate} Finally, PonyGE2 will be kept up to date with the most current best-of-practice techniques. \section*{Acknowledgments} This research is based upon works supported by Science Foundation Ireland under grant 13/IA/1850. \bibliographystyle{abbrv}
{'timestamp': '2017-04-27T02:07:43', 'yymm': '1703', 'arxiv_id': '1703.08535', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08535'}
arxiv
\section{Conclusion} \label{sec:conclusion} We did a preliminary study on the problem of distributed authentication in wireless networks. Specifically, we considered a system where multiple Bob (sensor) nodes listen to a channel and report their {\it correlated} measurements to a Fusion Center (FC). Numerical results showed that the authentication performance of the FC is superior to that of a single Bob node. Additionally, the correlated measurements by the Bob nodes allowed us to invoke compressed sensing at the Bob nodes to reduce the reporting overhead to the FC by at least $20\%$. Immediate future work will investigate the design of: i) optimal decision rules at the Bob nodes and the FC, ii) clever medium access schemes on the reporting channel. \section*{Acknowledgements} This publication was made possible by NPRP grant $\# 7-125-2-061$ from the Qatar National Research Fund (a member of Qatar Foundation). The statements made herein are solely the responsibility of the authors. \footnotesize{ \bibliographystyle{IEEEtran} \section{Introduction} \label{sec:intro} Physical layer authentication addresses the problem of intrusion (impersonation) attack where a legitimate node Alice transmits its data to its intended recipient Bob, while Eve is an intruder node who unlawfully transmits on the channel allocated to Alice, in order to impersonate Alice before Bob. More precisely, for intrusion detection, Bob needs to authenticate each and every data packet it receives from the channel occupant (Alice or Eve). To carry out the (feature-based) authentication, Bob performs binary hypothesis testing while utilizing some device fingerprint (some physical layer attribute) as the decision metric. The (authentication) problem at hand is in principle very similar to the classical problems of detection, classification, clustering etc. Nevertheless, the only important distinction is that in case of authentication problem, the device fingerprint of Eve is unknown. This limitation renders the classical likelihood ratio test (LRT) not computable (and hence Bayesian methods are not directly applicable). Therefore, Neyman-Pearson based binary hypothesis testing is typically implemented to carry out the authentication task at Bob. As for the decision metric for binary hypothesis testing, Researchers have considered many different physical-layer attributes so far. Broadly speaking, these attributes can be classified into two categories: i) medium-based attributes, ii) hardware-based attributes. Medium-based attributes/fingerprints include different menifestations of the wireless channel such as channel frequency response \cite{Xiao:TWC:2008},\cite{Baracca:TWC:2012}, channel impulse response \cite{Wang:MILCOM:2011},\cite{Jitendra:COMSNETS:2010}, received signal strength \cite{Trappe:TPDS:2013}, angle-of-arrival \cite{Xiong:2010:SIGCOMM} etc. On the other hand, hardware-based attributes/fingerprints include carrier frequency offsets \cite{Wang:ICC:2012},\cite{Mahboob:Globecom:2014}, IQ-imbalance \cite{Wang:ICC:2014}, mismatch parameters of non-reciprocal hardware \cite{Mahboob:Arxiv:2016} etc. In this preliminary work, motivated by the classical distributed detection problem \cite{Varshney:IEEEProc:1997}, we study the {\it distributed authentication} problem. Specifically, we consider a situation where instead of a single Bob (sensor) node, there are $N$ Bob (sensor) nodes which all report their raw measurements or local decisions to a Fusion Center (FC) which makes the ultimate authentication decision. The need for Distributed Authentication arises whenever a single sensor (Bob) node alone can't be relied upon (e.g., it could come under deep fade/shadowing, it might have excessive AWGN/noise figure due to cheap receive circuitry etc.). Another potential application scenario is that of a Wireless Sensor Network \cite{Bauer:ACMTISS:2008} where the sensor (Bob) nodes are primitive in nature (i.e., they can't do sophisticated signal processing by themselves due to processor, storage and battery constraints); therefore, the sensor nodes simply relay the critical/sensitive data to the FC which carries out the ultimate authentication. {\bf Contributions.} The main contributions of this paper are the following: i) a preliminary study on distributed authentication, ii) exploitation of compressed sensing at the Bob nodes for significant reduction of the reporting overhead to the FC. {\bf Outline.} The rest of this paper is organized as follows. Section-II introduces the system model. Section-III provides the necessary background for the channel impulse response which has been utilized as as device fingerprint in this work. Section-IV outlines the details of two strategies Bob (sensor) nodes could adopt to facilitate the cause of distributed detection. Section-V proposes to exploit compressed sensing at the Bob (sensor) nodes to reduce the overhead on the reporting channel. Section-VI provides some numerical results. Section VII concludes. {\bf Notations.} Bold-face letters (e.g., $\mathbf{x}$) represent vectors; Capitalized bold-face letters (e.g., $\mathbf{X}$) represent matrices; $tr(.)$ denotes the trace operator; $(.)^T$ denotes the transpose operator; $(.)^H$ denotes the conjugate transpose operator; $\mathbb{E}(.)$ denotes the expectation operator; {\it i.i.d} implies independent and identically distributed; $\mathbf{0}$ represents a vector (of appropriate length) of all zero's; $blkdiag(\mathbf{X_1} \; \hdots \; \mathbf{X_N})$ represents a block diagonal matrix; $X \sim \mathcal{CN} (.)$ signifies that $X$ is a random variable with (circularly-symmetric) complex normal distribution; $||\mathbf{x}||_{l_p}$ represents the $l_p$-norm of vector $\mathbf{x}$. \section{System Model} \label{sec:sys-model} Following the spirits and motivation of distributed detection problem \cite{Varshney:IEEEProc:1997}, this paper studies the distributed authentication problem whereby $N$ number of Bob nodes simultaneously receive the packet sent by the channel occupant (either Alice or Eve) on the {\it sensing channel} (see Fig. \ref{fig:sysmodel}). The $N$ Bob nodes are either co-located (in the form of an antenna array), or, follow a random geometry (where each Bob node represents a different sensing device). In both scenarios, each Bob node reports some quantity (either its raw measurement, or, its local authentication decision) via a {\it reporting channel} to a Fusion Center (FC) which makes the ultimate authentication decision. Inline with previous literature \cite{Varshney:IEEEProc:1997}, this work assumes that the reporting channel is error-free, delay-free and time-slotted (the performance curves obtained under these assumptions simply become upper-bounds on the performance curves obtained under realistic settings where these assumptions don't hold). \begin{figure}[ht] \begin{center} \includegraphics[width=3in]{fig1.pdf} \caption{The Distributed Authentication problem.} \label{fig:sysmodel} \end{center} \end{figure} \section{Background: Channel Impulse Response as Device Fingerprint} \label{sec:cir} An intrusion (impersonation) attack occurs when an intruder node Eve unlawfully transmits on the (sensing) channel allocated to legitimate node Alice so as to impersonate Alice before Bob. To counter the challenge of intrusion attack, Bob needs to do authentication of each and every data packet it receives. Motivated by \cite{Jitendra:COMSNETS:2010}, this work utilizes the channel impulse response (CIR) as the device fingerprint for the purpose of authentication (at Bob nodes, or, Fusion center). More precisely, this work considers a single-carrier, wideband system with a time-slotted sensing channel (with $\tau$ seconds long timeslots). To introduce the notations, let's assume that Alice transmits on the shared sensing channel; then Bob $n$ sees the channel $\mathbf{h}_{A,B_n}^{(i.i.d)}$. More precisely, $\mathbf{h}_{A,B_n}^{(i.i.d)}$ is the channel impulse response, i.e., $\mathbf{h}_{A,B_n}^{(i.i.d)}=[h_{A,B_n}(1) \; h_{A,B_n}(2) \; \hdots \; h_{A,B_n}(L)]^T$ where $n=1,...,N$ and $L$ represents the total number of channel taps for the considered multipath (i.e., frequency-selective), time-invariant channel. Define: \begin{equation*} \mathbf{{H}_{AB}^{(i.i.d)}} \overset{\Delta}{=} [ \mathbf{h}_{A,B_1}^{(i.i.d)} \; \mathbf{h}_{A,B_2}^{(i.i.d)} \; \hdots \; \mathbf{h}_{A,B_N}^{(i.i.d)} ] \in \mathbb{C}^{(L\times N)} \end{equation*} Typically, each of the columns of $\mathbf{{H}_{AB}^{(i.i.d)}}$ is modelled as a Complex Gaussian vector; moreover, all the columns (channel vectors) are considered to be {\it i.i.d}. However, in this study, we consider a more general/realistic setting; i.e., we assume that the channels measured by all the $N$ Bob nodes are correlated (i.e., either all the Bob nodes are co-located, or, all the nodes in system model of Fig. \ref{fig:sysmodel} are located outdoors). Therefore, to make the columns of the matrix $\mathbf{{H}_{AB}^{(i.i.d)}}$ correlated with each other (to exploit the phenomena of compressed sensing later), we leverage the classical Kronecker-product based correlation model \cite{Kermoal:JSAC:2002}. For the system model in Fig. \ref{fig:sysmodel}, the Kronecker-product model reduces to the following: \begin{equation} \label{eq:Hcorr} \mathbf{H_{AB}} = \frac{1}{\sqrt{tr(\mathbf{R_{B}})}} \mathbf{{H}_{AB}^{(i.i.d)}} \mathbf{R_{B}}^{1/2} \end{equation} where $\mathbf{R_{B}}$ $\in \mathbb{R}^{N\times N}$ represents the correlation matrix at the receive side (i.e., the correlation among Bob nodes). Specifically, we employ the exponential correlation model: $[\mathbf{R_{B}}]_{i,j}=\rho^{|i-j|}$ where $0\le \rho \le 1$ is the correlation amount and $i,j$ represent row and column indices of $\mathbf{R_{B}}$ (or, Bob $i$ and Bob $j$) respectively. Then, one can write: $\mathbf{{H}_{AB}} \overset{\Delta}{=} [ \mathbf{h}_{A,B_1} \; \mathbf{h}_{A,B_2} \; \hdots \; \mathbf{h}_{A,B_N} ]$. Similarly, when Eve transmits on the shared sensing channel, then one can define: \begin{equation*} \mathbf{{H}_{EB}^{(i.i.d)}} \overset{\Delta}{=} [ \mathbf{h}_{E,B_1}^{(i.i.d)} \; \mathbf{h}_{E,B_2}^{(i.i.d)} \; \hdots \; \mathbf{h}_{E,B_N}^{(i.i.d)} ] \in \mathbb{C}^{(L\times N)} \end{equation*} The channel matrix $\mathbf{H_{EB}} \overset{\Delta}{=} [ \mathbf{h}_{E,B_1} \; \mathbf{h}_{E,B_2} \; \hdots \; \mathbf{h}_{E,B_N} ]$ with correlated columns is then constructed via Eq. (\ref{eq:Hcorr}) as well\footnote{At this point, it is worth mentioning that we haven't incorporated the transmit side correlation (between Alice's antenna and Eve's antenna) into the Kronecker product model. The reason for this is that, inline with the previous work \cite{Xiao:TWC:2008}, we assume that Alice and Eve are spaced far apart (more than one wavelength) so that their mutual correlation is negligible.}. \section{Distributed Authentication} \label{sec:DistAuthen} This section outlines the proposed distributed authentication framework which in turn utilizes the channel impulse response as the transmit device fingerprint. During $m$-th timeslot, either Alice, or, Eve will transmit on the sensing channel (assuming that Eve avoids collisions so as to stay undetected). Therefore, when Bob $n$ receives a packet from the channel occupant (CO) (where CO $\in \{A,E\}$), it independently generates a measurement $\textbf{z}_n(m)$ of its local CIR $\mathbf{h}_{CO,B_n}$ as follows \cite{Jitendra:COMSNETS:2010}: \begin{equation} \label{eq:z_n} \textbf{z}_n(m) = \mathbf{h}_{CO,B_n} + \textbf{v}_n(m) \end{equation} where $\textbf{v}_n(m)$ is the measurement noise. Specifically, $\textbf{v}_n(m) \sim \mathcal{CN}(\mathbf{0},\mathbf{\Sigma}_n)$ where $\mathbf{\Sigma}_n=\sigma_n^2 (\mathbf{S}^H\mathbf{S})^{-1}$ $\in \mathbb{R}^{L \times L}$; $\sigma_n^2$ denotes the variance/power of the AWGN at Bob $n$. Furthermore, we assume that $\textbf{v}_n(m)$ ($n=1,...,N$) are {\it i.i.d}\footnote{$\mathbf{S}$ is the matrix formed by the training symbols. See \cite{Jitendra:COMSNETS:2010} for more details.}. With the raw measurements of local CIR available at each Bob node, two distinct strategies are possible: i) each Bob node sends its raw measurement as is (along with the ground truth) to the FC, ii) each Bob node does the authentication locally and sends its binary decision to the FC. Both strategies are discussed below. \subsection{Each Bob node sends its raw measurement as-is to the Fusion Center} Under this scenario, each Bob node sends its raw measurement $\mathbf{z}_{n}$ as-is (along with the ground truth) to the FC\footnote {For clarity of exposition, we drop the time-slot index $m$ in the rest of this paper.}. Since an error-free, time-slotted reporting channel is assumed, FC receives all the (perfect) measurements after $N$ time-slots (of the reporting channel). Fusion center then constructs a global measurement vector $\mathbf{{z}_{*}} \overset{\Delta}{=} [\mathbf{z}_{1}^T \; \mathbf{z}_{2}^T \; \hdots \; \mathbf{z}_{N}^T]^T$. Then, we can write: \begin{equation} \label{eq:z*} \mathbf{{z}_{*}}=\mathbf{h_{CO,B*}}+\mathbf{{v}_{*}} \end{equation} where $\mathbf{h_{CO,B*}}\overset{\Delta}{=}[\mathbf{h}_{CO,B_1}^T \; \mathbf{h}_{CO,B_2}^T \; \hdots \; \mathbf{h}_{CO,B_N}^T]^T$ and ${\mathbf{v_*}}\overset{\Delta}{=}[\mathbf{v}_1^T \; \mathbf{v}_2^T \; \hdots \; \mathbf{v}_N^T]^T$. ${\mathbf{v_*}}$ represents the global estimation error; ${\mathbf{v_*}}\sim \mathcal{CN} (\mathbf{0}, \mathbf{\Sigma_*})$ where $\mathbf{\Sigma_*} = blkdiag(\mathbf{\Sigma}_1 \; \mathbf{\Sigma}_2 \; \hdots \; \mathbf{\Sigma}_N)$ $\in \mathbb{R}^{(L\times N)\times (L\times N)}$. With $\mathbf{{z}_{*}}$ available, the FC casts the sender-node authentication problem as a binary hypothesis testing problem: \begin{equation} \label{eq:H0H1_raw} \begin{cases} H_0: & \mathbf{{z}_{*}}=\mathbf{h_{AB*}}+\mathbf{{v}_{*}} \\ H_1: & \mathbf{{z}_{*}}=\mathbf{h_{EB*}}+\mathbf{{v}_{*}} \end{cases} \end{equation} where ${\mathbf{h_{AB*}}}=[\mathbf{h}_{A,B_1}^T ,\mathbf{h}_{A,B_2}^T ,...,\mathbf{h}_{A,B_N}^T ]^T$ and ${\mathbf{h_{EB*}}}=[\mathbf{h}_{E,B_1}^T ,\mathbf{h}_{E,B_2}^T ,...,\mathbf{h}_{E,B_N}^T ]^T$. Then, ${\mathbf{z_*}|H_0} \sim \mathcal{CN}({\mathbf{h_{AB*}}}, \mathbf{\Sigma_*})$ and ${\mathbf{z_*}|H_1} \sim \mathcal{CN}({\mathbf{h_{EB*}}}, \mathbf{\Sigma_*})$. If $H_0=1$, received data (on the sensing channel) is accepted by the FC; if $H_1=1$, received data is discarded by the FC. Next, assuming that $\mathbf{h_{AB*}}$ is known to the FC (via the prior training of the Bob nodes, on a secure channel) with sufficient accuracy, the FC applies the following test \cite{Jitendra:COMSNETS:2010}: \begin{equation} \label{eq:test_raw} (\textbf{z}_* - \mathbf{h_{AB*}})^H \mathbf{\Sigma_*}^{-1} (\textbf{z}_* - \mathbf{h_{AB*}}) \underset{H_0}{\overset{H_1}{\gtrless}} \delta \end{equation} where $\delta$ is the comparison threshold whose value is to be determined by the FC. This work follows Neyman-Pearson procedure to systematically compute the threshold $\delta$. Specifically, $\delta$ is computed from a pre-specified, maximum Type-1 error (i.e., probability of false alarm, $P_{fa}$) that the FC can tolerate. Then, for a given Type-1 error, Neyman-Pearson method guarantees to minimize the Type-2 error (i.e., probability of missed detection, $P_{md}$). Denote by $T$ the test statistic in Eq. (\ref{eq:test_raw}); i.e., $T=(\textbf{z}_* - \mathbf{h_{AB*}})^H \mathbf{\Sigma_*}^{-1} (\textbf{z}_* - \mathbf{h_{AB*}})$. Then, the test statistic $T|H_0 \sim \chi^2(2NL)$; i.e., $T$ has central Chi-squared distribution with $2NL$ degrees of freedom, under $H_0$. Then, the probability of false alarm $P_{fa}$ (i.e., incorrectly identifying Alice's packet as if it is from Eve) is given as: \begin{equation} \label{eq:pfa_fc} P_{fa} = Pr(T>\delta |H_0) = \int_{\delta}^\infty p_{T|H_0}(x) dx \end{equation} where $p_{T|H_0}(x) \sim \chi^2(2NL)$ is the probability density function of $T|H_0$. Thus, one can set $P_{fa}$ to some value $\alpha$ in Eq. (\ref{eq:pfa_fc}) and solve for the threshold $\delta$. With $P_{fa}=\alpha$, the performance of the hypothesis test in Eq. (\ref{eq:test_raw}) is solely characterized by the Type-2 error a.k.a the probability of missed detection: $P_{md}=Pr(T<\delta |H_1)$. Since computing the distribution of $T|H_1$ is quite involved, we numerically compute the value of $P_{md}$ in simulation section. \subsection{Each Bob node sends its local decision to the Fusion Center} Under this scenario, Bob node $n$ (independently) utilizes its measurement $\textbf{z}_n$ of its local CIR $\mathbf{h}_{CO,B_n}$ (see Eq. (\ref{eq:z_n})) to construct the following binary hypothesis testing problem: \begin{equation} \label{eq:H0H1_local_D} \begin{cases} H_0: & \textbf{z}_n = \mathbf{h}_{A,B_n} + \textbf{v}_n \\ H_1: & \textbf{z}_n = \mathbf{h}_{E,B_n} + \textbf{v}_n \end{cases} \end{equation} Once again, assuming that $\mathbf{h}_{A,B_n}$ is perfectly known to Bob $n$, it applies the following test \cite{Jitendra:COMSNETS:2010}: \begin{equation} \label{eq:test_LD} (\textbf{z}_n - \mathbf{h}_{A,B_n})^H \mathbf{\Sigma}_n^{-1} (\textbf{z}_n - \mathbf{h}_{A,B_n}) \underset{H_0}{\overset{H_1}{\gtrless}} \delta_n \end{equation} where $\delta_n$ is the comparison threshold whose value is to be determined by Bob $n$. Once again, we follow the Neyman-Pearson procedure to systematically compute the threshold $\delta_n$. Denote by $T_n$ the test statistic in Eq. (\ref{eq:test_LD}); i.e., $T_n=(\textbf{z}_n - \mathbf{h}_{A,B_n})^H \Sigma_n^{-1} (\textbf{z}_n - \mathbf{h}_{A,B_n})$. Then, the test statistic $T_n|H_0 \sim \chi^2(2L)$; i.e., $T_n$ has central Chi-squared distribution with $2L$ degrees of freedom, under $H_0$. Then, the probability of false alarm $P_{fa,n}$ is given as: \begin{equation} \label{eq:pfa_1} P_{fa,n} = Pr(T_n>\delta_n |H_0) = \int_{\delta_n}^\infty p_{T_n|H_0}(x) dx \end{equation} where $p_{T_n|H_0}(x) \sim \chi^2(2L)$ is the probability density function of $T_n|H_0$. Thus, one can set $P_{fa,n}$ to some value $\alpha_n$ in Eq. (\ref{eq:pfa_1}) and solve for the threshold $\delta_n$. With $P_{fa,n}=\alpha_n$, the performance of the hypothesis test in Eq. (\ref{eq:test_LD}) is solely characterized by the Type-2 error a.k.a the probability of missed detection: $P_{md,n}=Pr(T_n<\delta_n |H_1)$. Since it is difficult to compute the distribution of $T_n|H_1$, we numerically compute the value of $P_{md,n}$ in simulation section. Then, the Fusion Center, having received the vector of local (binary-valued, hard) decisions $\mathbf{u_*}$ by all the Bob nodes, applies the following (heuristic) fusion rules to generate the ultimate (binary-valued, hard) decision: i) OR (optimistic) rule, ii) AND (pessimistic) rule, iii) majority voting, iv) weighted averaging. \section{Overhead Reduction on Reporting Channel via Compressed Sensing} \label{sec:CS} This section attempts to invoke Compressed Sensing\footnote{The interested reader is referred to \cite{Candes:SPMag:2008} for a comprehensive overview of compressed sensing.} at the Bob nodes owing to the fact that the CIR measurements made by the Bob nodes are correlated (see Eq. \ref{eq:Hcorr}). To this end, this section focuses on a specialized system model (more than the one given in Fig. \ref{fig:sysmodel} earlier) whereby the $N$ ($N$ is large) Bob nodes are all co-located as a linear antenna-array on a single receive device, now-called the relay node. Such system model could represent, for example, a situation where a multi-antenna relay node (e.g., a massive MIMO base station) forwards the data of a source (with unknown identity) towards a destination (the FC). Moreover, the relay node can either stay indifferent/blind to the authentication cause of the FC (the raw measurements case), or, the relay node could help the authentication cause of the FC (the local decisions case). We further assume that the relay node doesn't know its (vector) channel towards the FC. Thus, the multi-antenna relay doesn't do beamforming towards the FC; it rather transmits the length-$NL$ vector (containing raw measurements or local decisions) to the FC in a sequential manner. All in all, this specialized system model allows us to invoke compressed sensing (CS) at the relay node (to compress the length-$NL$ report vector into a length-$M$ vector where $M<<NL$) to reduce the number of channel uses (from $N$ to $M$) on the reporting channel. At this point, it is worth mentioning that to exploit compressed sensing under the generalized system model shown in Fig. \ref{fig:sysmodel}, one needs to employ more sophisticated medium access schemes on the reporting channel (which is beyond the scope of the current work)\footnote{For example, \cite{Yang:TSP:2013} presents a scheme where during each of the $M$ time-slots, each of the $N$ sensor nodes transmits its local measurement to the FC with some probability $p$, thus making the sensing/measurement matrix $\mathbf{\Phi}$ non-Gaussian.}. We now recall from the previous section that having received the data from the (sensing) channel occupant (Alice or Eve), the relay node could adapt either of the two distinct {\it compress-and-forward} strategies: i) the relay node compresses the vector of raw measurements and sends it to the FC (along with the vector of ground truths), ii) the relay node compresses the vector of local decisions and sends it to the FC. Both strategies are discussed below. \subsection{The relay node compresses the vector of raw measurements and sends it to the Fusion Center} The relay node compresses the vector of raw measurements $\mathbf{z_*}$ $\in \mathbb{C}^{(NL\times 1)}$ (see Eq. \ref{eq:z*}) into a vector $\mathbf{y}$ $\in \mathbb{C}^{(M\times 1)}$ ($M<<NL$) via random projections method: \begin{equation} \mathbf{y} = \mathbf{\Phi}\mathbf{z_*} \end{equation} where $\mathbf{\Phi}$ $\in \mathbb{R}^{(M\times NL)}$ is a random matrix, the so-called sensing/measurement matrix, whose entries are typically the realizations of {\it i.i.d} Gaussian or Bernoulli variables. After the compression, the relay node transmits the vector $\mathbf{y}$ to the FC in $M$ time-slots. Due to the error-free reporting channel, the FC receives $\mathbf{y}$ as-is; therefore, its task becomes to recover an estimate $\hat{\mathbf{z}}_*$ of $\mathbf{z_*}$ from $\mathbf{y}$. To this end, we invoke the classical Orthogonal Matching Pursuit (OMP) algorithm at the FC \cite{Tropp:TIT:2007}. Specifically, the OMP solves the following $l_1$-norm minimization problem: \begin{equation} \label{eq:omp} \min ||\mathbf{z_0}||_{l_1} \; s.t. \; \mathbf{y} = \mathbf{\Phi} \mathbf{\Psi}^T \mathbf{z_0} \end{equation} where \begin{equation} \label{eq:sparse} \mathbf{z_0} = \mathbf{\Psi} \mathbf{z}_* \end{equation} is the actual $K$-sparse representation of $\mathbf{z_*}$ in a transform domain. The matrix $\mathbf{\Psi}$ is called the sparsifying basis. The most frequently used sparsifying basis $\mathbf{\Psi}$ include discrete fourier transform (DFT), discrete cosine transform (DCT), Karhunen-Loeve Transform (KLT) etc. Finally, when $\hat{\mathbf{z}}_*$ is available via Eqs. (\ref{eq:omp}),(\ref{eq:sparse}), the FC follows the procedure of Section-IV-A to carry out the authentication. At this point, it is necessary to emphasize that the invocation of compressing sensing at the relay node is feasible only when the vector $\mathbf{z_*}$ is $K$-sparse (for some $K<<NL$) in some transform domain. This condition is fulfilled when the channel under consideration exhibits spatial correlation (see Eq. \ref{eq:Hcorr}) \cite{Ping:WCNC:2012}. Typically, the reconstruction error $\mathcal{E}=\mathbb{E}[||\hat{\mathbf{z}}_* - \mathbf{z_*}||_{l_2}^2]$ decreases with increase in $\rho$ (see Eq. \ref{eq:Hcorr}) and vice versa. \subsection{The relay node compresses the vector of local decisions and sends it to the Fusion Center} Under this strategy, the relay node compresses the vector of local decisions $\mathbf{u_*}$ $\in \{0,1\}^{(NL\times 1)}$ into a vector $\mathbf{y}$ $\in \{0,1\}^{(M\times 1)}$ ($M<<NL$) via random projections method and transmits $\mathbf{y}$ to the FC in $M$ time-slots, as discussed above. The FC then recovers $\hat{\mathbf{u}}_*$ from $\mathbf{y}$ via OMP and follows the procedure of Section-IV-B to carry out the authentication task. \section{Numerical Results} \label{sec:results} We assume uniform power delay profile (PDP) to generate each of the $N$ CIRs (with $L=6$ taps each) on the sensing channel. The received SNR at Bob $n$ is defined as $1/\sigma_n^2$ where $\sigma_n^2$ is the power of AWGN at Bob $n$. Furthermore, we evaluate the case of homogeneous SNRs only (i.e., we assume that the SNR/link quality of all the $N$ sensing links is the same). Finally, in all the results below, we evaluate the detection probability $P_d$ (where $P_d=1-P_{md}$) of the FC as the SNR (of a single sensing link) is varied over its full operational range. Fig. \ref{fig:DA-RM} represents the case when Bob nodes send their Raw Measurements to the FC. For Fig. \ref{fig:DA-RM}, we set $N=10$; the threshold $\delta$ is varied over the range: $260:20:340$. Fig. \ref{fig:DA-RM} shows that with decrease in $\delta$ (or, equivalently, with increase in the false alarm rate $P_{fa}$), the detection probability increases as one would intuitively expect. Additionally, the detection performance remains stable to a high value (close to 1) for SNR (at the FC) as low as $5$ dB. \begin{figure}[ht] \begin{center} \includegraphics[width=3.5in]{fig2.eps} \caption{Detection performance of the FC when Bob nodes send their Raw Measurements to FC (right-side plot shows the zoomed-in view (corresponding to SNR $\in$ $0-5$ dB) of the left-side plot).} \label{fig:DA-RM} \end{center} \end{figure} Fig. \ref{fig:DA-LD} represents the case when Bob nodes send their Local Decisions to FC. In Fig. \ref{fig:DA-LD}, $N=10$; additionally, from top to bottom, each of the $N$ thresholds is varied as: $\delta_n$ $\in$ $\{39,32.9,26.2\}$ which maps to the false alarm rates: $P_{fa,n}$ $\in$ $\{0.0001,0.001,0.01\}$ respectively. Fig. \ref{fig:DA-LD} shows that the AND-ing (OR-ing) based pessimistic (optimistic) fusion rule performs the best (worst) while the performance of the Majority Voting (Averaging) fusion rule is slightly better than (same as) the performance achieved by a single Bob node. Additionally, from top to bottom, sacrifice in terms of more and more false alarm rate results in improvement of detection performance of all the schemes for any given SNR. \begin{figure}[ht] \begin{center} \includegraphics[width=4in]{fig3.eps} \caption{Bob nodes send their Local Decisions to the FC (right-side plot shows the zoomed-in view (corresponding to SNR $\in$ $0-10$ dB) of the left-side plot).} \label{fig:DA-LD} \end{center} \end{figure} Figs. \ref{fig:DA-RM-CS}, \ref{fig:DA-LD-CS} show the results equivalent to Figs \ref{fig:DA-RM}, \ref{fig:DA-LD} when the Bob nodes (a.k.a the relay node) invoke the compressed sensing before sending their measurements to the FC. For compressed sensing, we have used a Gaussian measurement matrix $\mathbf{\Phi}$ and DCT as the sparsifying basis $\mathbf{\Psi}$. Fig. \ref{fig:DA-RM-CS} represents the case when Bob nodes send their raw measurements to the FC after compressed sensing. In Fig. \ref{fig:DA-RM-CS}, we set $N=100$; the threshold $\delta$ is varied in the range: $\delta$ $\in$ $\{2600,4800,5000\}$. The compressed sensing compresses the length $N\times L=100\times 6=600$ measurement vector $\mathbf{z_*}$ into a length $M=480$ vector achieving a saving of $20\%$ in reporting overhead. Fig. \ref{fig:DA-RM-CS} basically compares the two strategies by the relay node: S1) the relay node does the CS prior to sending the raw measurement vector to the FC, S2) the relay node sends the raw measurement vector as-is to the FC. Fig. \ref{fig:DA-RM-CS} indicates that a small ($<1$ dB) SNR margin is needed by S1 to achieve the same detection performance as S2, due to finite reconstruction error $\mathcal{E}$ at the FC. \begin{figure}[ht] \begin{center} \includegraphics[width=4in]{fig4.eps} \caption{Bob nodes send their raw measurements to the FC via compressed sensing (right-side plot shows the zoomed-in view (corresponding to SNR $\in$ $0-10$ dB) of the left-side plot).} \label{fig:DA-RM-CS} \end{center} \end{figure} Fig. \ref{fig:DA-LD-CS} represents the case when Bob nodes send their local decisions to the FC after compressed sensing. In Fig. \ref{fig:DA-LD-CS}, we set $N=100$; additionally, from top to bottom, each of the $N$ thresholds $\delta_n$ is varied in the range: $\delta_n$ $\in$ $\{39,32.9,26.2\}$ which maps to the following false alarm rates: $P_{fa,n}$ $\in$ $\{0.0001,0.001,0.01\}$ respectively. In all the three plots, the performance of the majority voting based fusion rule is considered with and without compressed sensing at the Bob nodes. In this case, compressed sensing at the Bob nodes leads to a $30\%$ overhead reduction on the reporting channel. \begin{figure}[ht] \begin{center} \includegraphics[width=4in]{fig5.eps} \caption{Bob nodes send their local decisions to the FC via compressed sensing (right-side plot shows the zoomed-in view (corresponding to SNR $\in$ $0-5$ dB) of the left-side plot).} \label{fig:DA-LD-CS} \end{center} \end{figure} \section{Conclusion} \label{sec:conclusion} We did a preliminary study on the problem of distributed authentication in wireless networks. Specifically, we considered a system where multiple Bob (sensor) nodes listen to a channel and report their {\it correlated} measurements to a Fusion Center (FC). Numerical results showed that the authentication performance of the FC is superior to that of a single Bob node. Additionally, the correlated measurements by the Bob nodes allowed us to invoke compressed sensing at the Bob nodes to reduce the reporting overhead to the FC by at least $20\%$. Immediate future work will investigate the design of: i) optimal decision rules at the Bob nodes and the FC, ii) clever medium access schemes on the reporting channel. \section*{Acknowledgements} This publication was made possible by NPRP grant $\# 7-125-2-061$ from the Qatar National Research Fund (a member of Qatar Foundation). The statements made herein are solely the responsibility of the authors. \footnotesize{ \bibliographystyle{IEEEtran} \section{Introduction} \label{sec:intro} Physical layer authentication addresses the problem of intrusion (impersonation) attack where a legitimate node Alice transmits its data to its intended recipient Bob, while Eve is an intruder node who unlawfully transmits on the channel allocated to Alice, in order to impersonate Alice before Bob. More precisely, for intrusion detection, Bob needs to authenticate each and every data packet it receives from the channel occupant (Alice or Eve). To carry out the (feature-based) authentication, Bob performs binary hypothesis testing while utilizing some device fingerprint (some physical layer attribute) as the decision metric. The (authentication) problem at hand is in principle very similar to the classical problems of detection, classification, clustering etc. Nevertheless, the only important distinction is that in case of authentication problem, the device fingerprint of Eve is unknown. This limitation renders the classical likelihood ratio test (LRT) not computable (and hence Bayesian methods are not directly applicable). Therefore, Neyman-Pearson based binary hypothesis testing is typically implemented to carry out the authentication task at Bob. As for the decision metric for binary hypothesis testing, Researchers have considered many different physical-layer attributes so far. Broadly speaking, these attributes can be classified into two categories: i) medium-based attributes, ii) hardware-based attributes. Medium-based attributes/fingerprints include different menifestations of the wireless channel such as channel frequency response \cite{Xiao:TWC:2008},\cite{Baracca:TWC:2012}, channel impulse response \cite{Wang:MILCOM:2011},\cite{Jitendra:COMSNETS:2010}, received signal strength \cite{Trappe:TPDS:2013}, angle-of-arrival \cite{Xiong:2010:SIGCOMM} etc. On the other hand, hardware-based attributes/fingerprints include carrier frequency offsets \cite{Wang:ICC:2012},\cite{Mahboob:Globecom:2014}, IQ-imbalance \cite{Wang:ICC:2014}, mismatch parameters of non-reciprocal hardware \cite{Mahboob:Arxiv:2016} etc. In this preliminary work, motivated by the classical distributed detection problem \cite{Varshney:IEEEProc:1997}, we study the {\it distributed authentication} problem. Specifically, we consider a situation where instead of a single Bob (sensor) node, there are $N$ Bob (sensor) nodes which all report their raw measurements or local decisions to a Fusion Center (FC) which makes the ultimate authentication decision. The need for Distributed Authentication arises whenever a single sensor (Bob) node alone can't be relied upon (e.g., it could come under deep fade/shadowing, it might have excessive AWGN/noise figure due to cheap receive circuitry etc.). Another potential application scenario is that of a Wireless Sensor Network \cite{Bauer:ACMTISS:2008} where the sensor (Bob) nodes are primitive in nature (i.e., they can't do sophisticated signal processing by themselves due to processor, storage and battery constraints); therefore, the sensor nodes simply relay the critical/sensitive data to the FC which carries out the ultimate authentication. {\bf Contributions.} The main contributions of this paper are the following: i) a preliminary study on distributed authentication, ii) exploitation of compressed sensing at the Bob nodes for significant reduction of the reporting overhead to the FC. {\bf Outline.} The rest of this paper is organized as follows. Section-II introduces the system model. Section-III provides the necessary background for the channel impulse response which has been utilized as as device fingerprint in this work. Section-IV outlines the details of two strategies Bob (sensor) nodes could adopt to facilitate the cause of distributed detection. Section-V proposes to exploit compressed sensing at the Bob (sensor) nodes to reduce the overhead on the reporting channel. Section-VI provides some numerical results. Section VII concludes. {\bf Notations.} Bold-face letters (e.g., $\mathbf{x}$) represent vectors; Capitalized bold-face letters (e.g., $\mathbf{X}$) represent matrices; $tr(.)$ denotes the trace operator; $(.)^T$ denotes the transpose operator; $(.)^H$ denotes the conjugate transpose operator; $\mathbb{E}(.)$ denotes the expectation operator; {\it i.i.d} implies independent and identically distributed; $\mathbf{0}$ represents a vector (of appropriate length) of all zero's; $blkdiag(\mathbf{X_1} \; \hdots \; \mathbf{X_N})$ represents a block diagonal matrix; $X \sim \mathcal{CN} (.)$ signifies that $X$ is a random variable with (circularly-symmetric) complex normal distribution; $||\mathbf{x}||_{l_p}$ represents the $l_p$-norm of vector $\mathbf{x}$. \section{System Model} \label{sec:sys-model} Following the spirits and motivation of distributed detection problem \cite{Varshney:IEEEProc:1997}, this paper studies the distributed authentication problem whereby $N$ number of Bob nodes simultaneously receive the packet sent by the channel occupant (either Alice or Eve) on the {\it sensing channel} (see Fig. \ref{fig:sysmodel}). The $N$ Bob nodes are either co-located (in the form of an antenna array), or, follow a random geometry (where each Bob node represents a different sensing device). In both scenarios, each Bob node reports some quantity (either its raw measurement, or, its local authentication decision) via a {\it reporting channel} to a Fusion Center (FC) which makes the ultimate authentication decision. Inline with previous literature \cite{Varshney:IEEEProc:1997}, this work assumes that the reporting channel is error-free, delay-free and time-slotted (the performance curves obtained under these assumptions simply become upper-bounds on the performance curves obtained under realistic settings where these assumptions don't hold). \begin{figure}[ht] \begin{center} \includegraphics[width=3in]{fig1.pdf} \caption{The Distributed Authentication problem.} \label{fig:sysmodel} \end{center} \end{figure} \section{Background: Channel Impulse Response as Device Fingerprint} \label{sec:cir} An intrusion (impersonation) attack occurs when an intruder node Eve unlawfully transmits on the (sensing) channel allocated to legitimate node Alice so as to impersonate Alice before Bob. To counter the challenge of intrusion attack, Bob needs to do authentication of each and every data packet it receives. Motivated by \cite{Jitendra:COMSNETS:2010}, this work utilizes the channel impulse response (CIR) as the device fingerprint for the purpose of authentication (at Bob nodes, or, Fusion center). More precisely, this work considers a single-carrier, wideband system with a time-slotted sensing channel (with $\tau$ seconds long timeslots). To introduce the notations, let's assume that Alice transmits on the shared sensing channel; then Bob $n$ sees the channel $\mathbf{h}_{A,B_n}^{(i.i.d)}$. More precisely, $\mathbf{h}_{A,B_n}^{(i.i.d)}$ is the channel impulse response, i.e., $\mathbf{h}_{A,B_n}^{(i.i.d)}=[h_{A,B_n}(1) \; h_{A,B_n}(2) \; \hdots \; h_{A,B_n}(L)]^T$ where $n=1,...,N$ and $L$ represents the total number of channel taps for the considered multipath (i.e., frequency-selective), time-invariant channel. Define: \begin{equation*} \mathbf{{H}_{AB}^{(i.i.d)}} \overset{\Delta}{=} [ \mathbf{h}_{A,B_1}^{(i.i.d)} \; \mathbf{h}_{A,B_2}^{(i.i.d)} \; \hdots \; \mathbf{h}_{A,B_N}^{(i.i.d)} ] \in \mathbb{C}^{(L\times N)} \end{equation*} Typically, each of the columns of $\mathbf{{H}_{AB}^{(i.i.d)}}$ is modelled as a Complex Gaussian vector; moreover, all the columns (channel vectors) are considered to be {\it i.i.d}. However, in this study, we consider a more general/realistic setting; i.e., we assume that the channels measured by all the $N$ Bob nodes are correlated (i.e., either all the Bob nodes are co-located, or, all the nodes in system model of Fig. \ref{fig:sysmodel} are located outdoors). Therefore, to make the columns of the matrix $\mathbf{{H}_{AB}^{(i.i.d)}}$ correlated with each other (to exploit the phenomena of compressed sensing later), we leverage the classical Kronecker-product based correlation model \cite{Kermoal:JSAC:2002}. For the system model in Fig. \ref{fig:sysmodel}, the Kronecker-product model reduces to the following: \begin{equation} \label{eq:Hcorr} \mathbf{H_{AB}} = \frac{1}{\sqrt{tr(\mathbf{R_{B}})}} \mathbf{{H}_{AB}^{(i.i.d)}} \mathbf{R_{B}}^{1/2} \end{equation} where $\mathbf{R_{B}}$ $\in \mathbb{R}^{N\times N}$ represents the correlation matrix at the receive side (i.e., the correlation among Bob nodes). Specifically, we employ the exponential correlation model: $[\mathbf{R_{B}}]_{i,j}=\rho^{|i-j|}$ where $0\le \rho \le 1$ is the correlation amount and $i,j$ represent row and column indices of $\mathbf{R_{B}}$ (or, Bob $i$ and Bob $j$) respectively. Then, one can write: $\mathbf{{H}_{AB}} \overset{\Delta}{=} [ \mathbf{h}_{A,B_1} \; \mathbf{h}_{A,B_2} \; \hdots \; \mathbf{h}_{A,B_N} ]$. Similarly, when Eve transmits on the shared sensing channel, then one can define: \begin{equation*} \mathbf{{H}_{EB}^{(i.i.d)}} \overset{\Delta}{=} [ \mathbf{h}_{E,B_1}^{(i.i.d)} \; \mathbf{h}_{E,B_2}^{(i.i.d)} \; \hdots \; \mathbf{h}_{E,B_N}^{(i.i.d)} ] \in \mathbb{C}^{(L\times N)} \end{equation*} The channel matrix $\mathbf{H_{EB}} \overset{\Delta}{=} [ \mathbf{h}_{E,B_1} \; \mathbf{h}_{E,B_2} \; \hdots \; \mathbf{h}_{E,B_N} ]$ with correlated columns is then constructed via Eq. (\ref{eq:Hcorr}) as well\footnote{At this point, it is worth mentioning that we haven't incorporated the transmit side correlation (between Alice's antenna and Eve's antenna) into the Kronecker product model. The reason for this is that, inline with the previous work \cite{Xiao:TWC:2008}, we assume that Alice and Eve are spaced far apart (more than one wavelength) so that their mutual correlation is negligible.}. \section{Distributed Authentication} \label{sec:DistAuthen} This section outlines the proposed distributed authentication framework which in turn utilizes the channel impulse response as the transmit device fingerprint. During $m$-th timeslot, either Alice, or, Eve will transmit on the sensing channel (assuming that Eve avoids collisions so as to stay undetected). Therefore, when Bob $n$ receives a packet from the channel occupant (CO) (where CO $\in \{A,E\}$), it independently generates a measurement $\textbf{z}_n(m)$ of its local CIR $\mathbf{h}_{CO,B_n}$ as follows \cite{Jitendra:COMSNETS:2010}: \begin{equation} \label{eq:z_n} \textbf{z}_n(m) = \mathbf{h}_{CO,B_n} + \textbf{v}_n(m) \end{equation} where $\textbf{v}_n(m)$ is the measurement noise. Specifically, $\textbf{v}_n(m) \sim \mathcal{CN}(\mathbf{0},\mathbf{\Sigma}_n)$ where $\mathbf{\Sigma}_n=\sigma_n^2 (\mathbf{S}^H\mathbf{S})^{-1}$ $\in \mathbb{R}^{L \times L}$; $\sigma_n^2$ denotes the variance/power of the AWGN at Bob $n$. Furthermore, we assume that $\textbf{v}_n(m)$ ($n=1,...,N$) are {\it i.i.d}\footnote{$\mathbf{S}$ is the matrix formed by the training symbols. See \cite{Jitendra:COMSNETS:2010} for more details.}. With the raw measurements of local CIR available at each Bob node, two distinct strategies are possible: i) each Bob node sends its raw measurement as is (along with the ground truth) to the FC, ii) each Bob node does the authentication locally and sends its binary decision to the FC. Both strategies are discussed below. \subsection{Each Bob node sends its raw measurement as-is to the Fusion Center} Under this scenario, each Bob node sends its raw measurement $\mathbf{z}_{n}$ as-is (along with the ground truth) to the FC\footnote {For clarity of exposition, we drop the time-slot index $m$ in the rest of this paper.}. Since an error-free, time-slotted reporting channel is assumed, FC receives all the (perfect) measurements after $N$ time-slots (of the reporting channel). Fusion center then constructs a global measurement vector $\mathbf{{z}_{*}} \overset{\Delta}{=} [\mathbf{z}_{1}^T \; \mathbf{z}_{2}^T \; \hdots \; \mathbf{z}_{N}^T]^T$. Then, we can write: \begin{equation} \label{eq:z*} \mathbf{{z}_{*}}=\mathbf{h_{CO,B*}}+\mathbf{{v}_{*}} \end{equation} where $\mathbf{h_{CO,B*}}\overset{\Delta}{=}[\mathbf{h}_{CO,B_1}^T \; \mathbf{h}_{CO,B_2}^T \; \hdots \; \mathbf{h}_{CO,B_N}^T]^T$ and ${\mathbf{v_*}}\overset{\Delta}{=}[\mathbf{v}_1^T \; \mathbf{v}_2^T \; \hdots \; \mathbf{v}_N^T]^T$. ${\mathbf{v_*}}$ represents the global estimation error; ${\mathbf{v_*}}\sim \mathcal{CN} (\mathbf{0}, \mathbf{\Sigma_*})$ where $\mathbf{\Sigma_*} = blkdiag(\mathbf{\Sigma}_1 \; \mathbf{\Sigma}_2 \; \hdots \; \mathbf{\Sigma}_N)$ $\in \mathbb{R}^{(L\times N)\times (L\times N)}$. With $\mathbf{{z}_{*}}$ available, the FC casts the sender-node authentication problem as a binary hypothesis testing problem: \begin{equation} \label{eq:H0H1_raw} \begin{cases} H_0: & \mathbf{{z}_{*}}=\mathbf{h_{AB*}}+\mathbf{{v}_{*}} \\ H_1: & \mathbf{{z}_{*}}=\mathbf{h_{EB*}}+\mathbf{{v}_{*}} \end{cases} \end{equation} where ${\mathbf{h_{AB*}}}=[\mathbf{h}_{A,B_1}^T ,\mathbf{h}_{A,B_2}^T ,...,\mathbf{h}_{A,B_N}^T ]^T$ and ${\mathbf{h_{EB*}}}=[\mathbf{h}_{E,B_1}^T ,\mathbf{h}_{E,B_2}^T ,...,\mathbf{h}_{E,B_N}^T ]^T$. Then, ${\mathbf{z_*}|H_0} \sim \mathcal{CN}({\mathbf{h_{AB*}}}, \mathbf{\Sigma_*})$ and ${\mathbf{z_*}|H_1} \sim \mathcal{CN}({\mathbf{h_{EB*}}}, \mathbf{\Sigma_*})$. If $H_0=1$, received data (on the sensing channel) is accepted by the FC; if $H_1=1$, received data is discarded by the FC. Next, assuming that $\mathbf{h_{AB*}}$ is known to the FC (via the prior training of the Bob nodes, on a secure channel) with sufficient accuracy, the FC applies the following test \cite{Jitendra:COMSNETS:2010}: \begin{equation} \label{eq:test_raw} (\textbf{z}_* - \mathbf{h_{AB*}})^H \mathbf{\Sigma_*}^{-1} (\textbf{z}_* - \mathbf{h_{AB*}}) \underset{H_0}{\overset{H_1}{\gtrless}} \delta \end{equation} where $\delta$ is the comparison threshold whose value is to be determined by the FC. This work follows Neyman-Pearson procedure to systematically compute the threshold $\delta$. Specifically, $\delta$ is computed from a pre-specified, maximum Type-1 error (i.e., probability of false alarm, $P_{fa}$) that the FC can tolerate. Then, for a given Type-1 error, Neyman-Pearson method guarantees to minimize the Type-2 error (i.e., probability of missed detection, $P_{md}$). Denote by $T$ the test statistic in Eq. (\ref{eq:test_raw}); i.e., $T=(\textbf{z}_* - \mathbf{h_{AB*}})^H \mathbf{\Sigma_*}^{-1} (\textbf{z}_* - \mathbf{h_{AB*}})$. Then, the test statistic $T|H_0 \sim \chi^2(2NL)$; i.e., $T$ has central Chi-squared distribution with $2NL$ degrees of freedom, under $H_0$. Then, the probability of false alarm $P_{fa}$ (i.e., incorrectly identifying Alice's packet as if it is from Eve) is given as: \begin{equation} \label{eq:pfa_fc} P_{fa} = Pr(T>\delta |H_0) = \int_{\delta}^\infty p_{T|H_0}(x) dx \end{equation} where $p_{T|H_0}(x) \sim \chi^2(2NL)$ is the probability density function of $T|H_0$. Thus, one can set $P_{fa}$ to some value $\alpha$ in Eq. (\ref{eq:pfa_fc}) and solve for the threshold $\delta$. With $P_{fa}=\alpha$, the performance of the hypothesis test in Eq. (\ref{eq:test_raw}) is solely characterized by the Type-2 error a.k.a the probability of missed detection: $P_{md}=Pr(T<\delta |H_1)$. Since computing the distribution of $T|H_1$ is quite involved, we numerically compute the value of $P_{md}$ in simulation section. \subsection{Each Bob node sends its local decision to the Fusion Center} Under this scenario, Bob node $n$ (independently) utilizes its measurement $\textbf{z}_n$ of its local CIR $\mathbf{h}_{CO,B_n}$ (see Eq. (\ref{eq:z_n})) to construct the following binary hypothesis testing problem: \begin{equation} \label{eq:H0H1_local_D} \begin{cases} H_0: & \textbf{z}_n = \mathbf{h}_{A,B_n} + \textbf{v}_n \\ H_1: & \textbf{z}_n = \mathbf{h}_{E,B_n} + \textbf{v}_n \end{cases} \end{equation} Once again, assuming that $\mathbf{h}_{A,B_n}$ is perfectly known to Bob $n$, it applies the following test \cite{Jitendra:COMSNETS:2010}: \begin{equation} \label{eq:test_LD} (\textbf{z}_n - \mathbf{h}_{A,B_n})^H \mathbf{\Sigma}_n^{-1} (\textbf{z}_n - \mathbf{h}_{A,B_n}) \underset{H_0}{\overset{H_1}{\gtrless}} \delta_n \end{equation} where $\delta_n$ is the comparison threshold whose value is to be determined by Bob $n$. Once again, we follow the Neyman-Pearson procedure to systematically compute the threshold $\delta_n$. Denote by $T_n$ the test statistic in Eq. (\ref{eq:test_LD}); i.e., $T_n=(\textbf{z}_n - \mathbf{h}_{A,B_n})^H \Sigma_n^{-1} (\textbf{z}_n - \mathbf{h}_{A,B_n})$. Then, the test statistic $T_n|H_0 \sim \chi^2(2L)$; i.e., $T_n$ has central Chi-squared distribution with $2L$ degrees of freedom, under $H_0$. Then, the probability of false alarm $P_{fa,n}$ is given as: \begin{equation} \label{eq:pfa_1} P_{fa,n} = Pr(T_n>\delta_n |H_0) = \int_{\delta_n}^\infty p_{T_n|H_0}(x) dx \end{equation} where $p_{T_n|H_0}(x) \sim \chi^2(2L)$ is the probability density function of $T_n|H_0$. Thus, one can set $P_{fa,n}$ to some value $\alpha_n$ in Eq. (\ref{eq:pfa_1}) and solve for the threshold $\delta_n$. With $P_{fa,n}=\alpha_n$, the performance of the hypothesis test in Eq. (\ref{eq:test_LD}) is solely characterized by the Type-2 error a.k.a the probability of missed detection: $P_{md,n}=Pr(T_n<\delta_n |H_1)$. Since it is difficult to compute the distribution of $T_n|H_1$, we numerically compute the value of $P_{md,n}$ in simulation section. Then, the Fusion Center, having received the vector of local (binary-valued, hard) decisions $\mathbf{u_*}$ by all the Bob nodes, applies the following (heuristic) fusion rules to generate the ultimate (binary-valued, hard) decision: i) OR (optimistic) rule, ii) AND (pessimistic) rule, iii) majority voting, iv) weighted averaging. \section{Overhead Reduction on Reporting Channel via Compressed Sensing} \label{sec:CS} This section attempts to invoke Compressed Sensing\footnote{The interested reader is referred to \cite{Candes:SPMag:2008} for a comprehensive overview of compressed sensing.} at the Bob nodes owing to the fact that the CIR measurements made by the Bob nodes are correlated (see Eq. \ref{eq:Hcorr}). To this end, this section focuses on a specialized system model (more than the one given in Fig. \ref{fig:sysmodel} earlier) whereby the $N$ ($N$ is large) Bob nodes are all co-located as a linear antenna-array on a single receive device, now-called the relay node. Such system model could represent, for example, a situation where a multi-antenna relay node (e.g., a massive MIMO base station) forwards the data of a source (with unknown identity) towards a destination (the FC). Moreover, the relay node can either stay indifferent/blind to the authentication cause of the FC (the raw measurements case), or, the relay node could help the authentication cause of the FC (the local decisions case). We further assume that the relay node doesn't know its (vector) channel towards the FC. Thus, the multi-antenna relay doesn't do beamforming towards the FC; it rather transmits the length-$NL$ vector (containing raw measurements or local decisions) to the FC in a sequential manner. All in all, this specialized system model allows us to invoke compressed sensing (CS) at the relay node (to compress the length-$NL$ report vector into a length-$M$ vector where $M<<NL$) to reduce the number of channel uses (from $N$ to $M$) on the reporting channel. At this point, it is worth mentioning that to exploit compressed sensing under the generalized system model shown in Fig. \ref{fig:sysmodel}, one needs to employ more sophisticated medium access schemes on the reporting channel (which is beyond the scope of the current work)\footnote{For example, \cite{Yang:TSP:2013} presents a scheme where during each of the $M$ time-slots, each of the $N$ sensor nodes transmits its local measurement to the FC with some probability $p$, thus making the sensing/measurement matrix $\mathbf{\Phi}$ non-Gaussian.}. We now recall from the previous section that having received the data from the (sensing) channel occupant (Alice or Eve), the relay node could adapt either of the two distinct {\it compress-and-forward} strategies: i) the relay node compresses the vector of raw measurements and sends it to the FC (along with the vector of ground truths), ii) the relay node compresses the vector of local decisions and sends it to the FC. Both strategies are discussed below. \subsection{The relay node compresses the vector of raw measurements and sends it to the Fusion Center} The relay node compresses the vector of raw measurements $\mathbf{z_*}$ $\in \mathbb{C}^{(NL\times 1)}$ (see Eq. \ref{eq:z*}) into a vector $\mathbf{y}$ $\in \mathbb{C}^{(M\times 1)}$ ($M<<NL$) via random projections method: \begin{equation} \mathbf{y} = \mathbf{\Phi}\mathbf{z_*} \end{equation} where $\mathbf{\Phi}$ $\in \mathbb{R}^{(M\times NL)}$ is a random matrix, the so-called sensing/measurement matrix, whose entries are typically the realizations of {\it i.i.d} Gaussian or Bernoulli variables. After the compression, the relay node transmits the vector $\mathbf{y}$ to the FC in $M$ time-slots. Due to the error-free reporting channel, the FC receives $\mathbf{y}$ as-is; therefore, its task becomes to recover an estimate $\hat{\mathbf{z}}_*$ of $\mathbf{z_*}$ from $\mathbf{y}$. To this end, we invoke the classical Orthogonal Matching Pursuit (OMP) algorithm at the FC \cite{Tropp:TIT:2007}. Specifically, the OMP solves the following $l_1$-norm minimization problem: \begin{equation} \label{eq:omp} \min ||\mathbf{z_0}||_{l_1} \; s.t. \; \mathbf{y} = \mathbf{\Phi} \mathbf{\Psi}^T \mathbf{z_0} \end{equation} where \begin{equation} \label{eq:sparse} \mathbf{z_0} = \mathbf{\Psi} \mathbf{z}_* \end{equation} is the actual $K$-sparse representation of $\mathbf{z_*}$ in a transform domain. The matrix $\mathbf{\Psi}$ is called the sparsifying basis. The most frequently used sparsifying basis $\mathbf{\Psi}$ include discrete fourier transform (DFT), discrete cosine transform (DCT), Karhunen-Loeve Transform (KLT) etc. Finally, when $\hat{\mathbf{z}}_*$ is available via Eqs. (\ref{eq:omp}),(\ref{eq:sparse}), the FC follows the procedure of Section-IV-A to carry out the authentication. At this point, it is necessary to emphasize that the invocation of compressing sensing at the relay node is feasible only when the vector $\mathbf{z_*}$ is $K$-sparse (for some $K<<NL$) in some transform domain. This condition is fulfilled when the channel under consideration exhibits spatial correlation (see Eq. \ref{eq:Hcorr}) \cite{Ping:WCNC:2012}. Typically, the reconstruction error $\mathcal{E}=\mathbb{E}[||\hat{\mathbf{z}}_* - \mathbf{z_*}||_{l_2}^2]$ decreases with increase in $\rho$ (see Eq. \ref{eq:Hcorr}) and vice versa. \subsection{The relay node compresses the vector of local decisions and sends it to the Fusion Center} Under this strategy, the relay node compresses the vector of local decisions $\mathbf{u_*}$ $\in \{0,1\}^{(NL\times 1)}$ into a vector $\mathbf{y}$ $\in \{0,1\}^{(M\times 1)}$ ($M<<NL$) via random projections method and transmits $\mathbf{y}$ to the FC in $M$ time-slots, as discussed above. The FC then recovers $\hat{\mathbf{u}}_*$ from $\mathbf{y}$ via OMP and follows the procedure of Section-IV-B to carry out the authentication task. \section{Numerical Results} \label{sec:results} We assume uniform power delay profile (PDP) to generate each of the $N$ CIRs (with $L=6$ taps each) on the sensing channel. The received SNR at Bob $n$ is defined as $1/\sigma_n^2$ where $\sigma_n^2$ is the power of AWGN at Bob $n$. Furthermore, we evaluate the case of homogeneous SNRs only (i.e., we assume that the SNR/link quality of all the $N$ sensing links is the same). Finally, in all the results below, we evaluate the detection probability $P_d$ (where $P_d=1-P_{md}$) of the FC as the SNR (of a single sensing link) is varied over its full operational range. Fig. \ref{fig:DA-RM} represents the case when Bob nodes send their Raw Measurements to the FC. For Fig. \ref{fig:DA-RM}, we set $N=10$; the threshold $\delta$ is varied over the range: $260:20:340$. Fig. \ref{fig:DA-RM} shows that with decrease in $\delta$ (or, equivalently, with increase in the false alarm rate $P_{fa}$), the detection probability increases as one would intuitively expect. Additionally, the detection performance remains stable to a high value (close to 1) for SNR (at the FC) as low as $5$ dB. \begin{figure}[ht] \begin{center} \includegraphics[width=3.5in]{fig2.eps} \caption{Detection performance of the FC when Bob nodes send their Raw Measurements to FC (right-side plot shows the zoomed-in view (corresponding to SNR $\in$ $0-5$ dB) of the left-side plot).} \label{fig:DA-RM} \end{center} \end{figure} Fig. \ref{fig:DA-LD} represents the case when Bob nodes send their Local Decisions to FC. In Fig. \ref{fig:DA-LD}, $N=10$; additionally, from top to bottom, each of the $N$ thresholds is varied as: $\delta_n$ $\in$ $\{39,32.9,26.2\}$ which maps to the false alarm rates: $P_{fa,n}$ $\in$ $\{0.0001,0.001,0.01\}$ respectively. Fig. \ref{fig:DA-LD} shows that the AND-ing (OR-ing) based pessimistic (optimistic) fusion rule performs the best (worst) while the performance of the Majority Voting (Averaging) fusion rule is slightly better than (same as) the performance achieved by a single Bob node. Additionally, from top to bottom, sacrifice in terms of more and more false alarm rate results in improvement of detection performance of all the schemes for any given SNR. \begin{figure}[ht] \begin{center} \includegraphics[width=4in]{fig3.eps} \caption{Bob nodes send their Local Decisions to the FC (right-side plot shows the zoomed-in view (corresponding to SNR $\in$ $0-10$ dB) of the left-side plot).} \label{fig:DA-LD} \end{center} \end{figure} Figs. \ref{fig:DA-RM-CS}, \ref{fig:DA-LD-CS} show the results equivalent to Figs \ref{fig:DA-RM}, \ref{fig:DA-LD} when the Bob nodes (a.k.a the relay node) invoke the compressed sensing before sending their measurements to the FC. For compressed sensing, we have used a Gaussian measurement matrix $\mathbf{\Phi}$ and DCT as the sparsifying basis $\mathbf{\Psi}$. Fig. \ref{fig:DA-RM-CS} represents the case when Bob nodes send their raw measurements to the FC after compressed sensing. In Fig. \ref{fig:DA-RM-CS}, we set $N=100$; the threshold $\delta$ is varied in the range: $\delta$ $\in$ $\{2600,4800,5000\}$. The compressed sensing compresses the length $N\times L=100\times 6=600$ measurement vector $\mathbf{z_*}$ into a length $M=480$ vector achieving a saving of $20\%$ in reporting overhead. Fig. \ref{fig:DA-RM-CS} basically compares the two strategies by the relay node: S1) the relay node does the CS prior to sending the raw measurement vector to the FC, S2) the relay node sends the raw measurement vector as-is to the FC. Fig. \ref{fig:DA-RM-CS} indicates that a small ($<1$ dB) SNR margin is needed by S1 to achieve the same detection performance as S2, due to finite reconstruction error $\mathcal{E}$ at the FC. \begin{figure}[ht] \begin{center} \includegraphics[width=4in]{fig4.eps} \caption{Bob nodes send their raw measurements to the FC via compressed sensing (right-side plot shows the zoomed-in view (corresponding to SNR $\in$ $0-10$ dB) of the left-side plot).} \label{fig:DA-RM-CS} \end{center} \end{figure} Fig. \ref{fig:DA-LD-CS} represents the case when Bob nodes send their local decisions to the FC after compressed sensing. In Fig. \ref{fig:DA-LD-CS}, we set $N=100$; additionally, from top to bottom, each of the $N$ thresholds $\delta_n$ is varied in the range: $\delta_n$ $\in$ $\{39,32.9,26.2\}$ which maps to the following false alarm rates: $P_{fa,n}$ $\in$ $\{0.0001,0.001,0.01\}$ respectively. In all the three plots, the performance of the majority voting based fusion rule is considered with and without compressed sensing at the Bob nodes. In this case, compressed sensing at the Bob nodes leads to a $30\%$ overhead reduction on the reporting channel. \begin{figure}[ht] \begin{center} \includegraphics[width=4in]{fig5.eps} \caption{Bob nodes send their local decisions to the FC via compressed sensing (right-side plot shows the zoomed-in view (corresponding to SNR $\in$ $0-5$ dB) of the left-side plot).} \label{fig:DA-LD-CS} \end{center} \end{figure}
{'timestamp': '2017-03-28T02:00:29', 'yymm': '1703', 'arxiv_id': '1703.08559', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08559'}
arxiv
\section{Introduction} \label{sec:introduction} \input{s1_intro} \section{Preliminary} \label{sec:pre} \input{s2_pre} \section{Algorithm Framework} \label{sec:kvcc} \input{s3_kvcc} \section{Basic Solution} \label{sec:base} \input{s4_base} \section{Search Reduction} \label{sec:opt} \input{s5_reduct} \section{Experiments} \label{sec:exp} \input{s6_exp.tex} \section{Related Work} \label{sec:relatedwork} \input{s7_reWrk.tex} \section{Conclusions} \label{sec:conclusion} Cohesive graph detection is an important graph problem with a wide spectrum of applications. Most of existing models will cause the free rider effect that combines irrelevant subgraphs into one subgraph. In this paper, we first study the problem of detecting all $k$-vertex connected components in a given graph where the vertex connectivity has been proved as a useful formal definition and measure of cohesion in social groups. This model effectively reduces the free rider effect while retaining many good structural properties such as bounded diameter, high cohesiveness, bounded graph overlapping, and bounded subgraph number. We propose a polynomial time algorithm to enumerate all $k$-{VCCs}\xspace via a overlapped graph partition framework. We propose several optimization strategies to significantly improve the efficiency of our algorithm. We conduct extensive experiments using seven real datasets to demonstrate the effectiveness and the efficiency of our approach. \balance {\small \bibliographystyle{abbrv} \subsection{Problem Statement} \label{sec:pre:ps} In this paper, we consider an undirected and unweighted graph $G(V,E)$, where $V$ is the set of vertices and $E$ is the set of edges. We also use $V(G)$ and $E(G)$ to denote the set of vertices and edges of graph $G$ respectively. The number of vertices and the number of edges are denoted by $n = |V|$ and $m = |E|$ respectively. For simplicity and without loss of generality, we assume that $G$ is a connected graph. We denote neighbor set of a vertex $u$ by $N(u)$, i.e., $N(u) = \{ u \in V| (u,v) \in E \}$, and degree of $u$ by $d(u) = |N(u)|$. Given two graphs $g$ and $g'$, we use $g\subseteq g'$ to denote that $g$ is a subgraph of $g'$. Given a set of vertices $V_s$, the induced subgraph $G[V_s]$ is a subgraph of $G$ such that $G[V_s] = (V_s,\{(u,v) \in E | u,v \in V_s\})$. For any two subgraphs $g$ and $g'$ of $G$, we use $g\cup g'$ to denote the union of $g$ and $g'$, i.e., $g\cup g'=(V(g)\cup V(g'), E(g)\cup E(g'))$. Before stating the problem, we firstly give some basic definitions. \begin{definition} \textsc{(Vertex Connectivity)} The vertex connectivity of a graph $G$, denoted by $\vc{G}$, is defined as the minimum number of vertices whose removal results in either a disconnected graph or a trivial graph (a single-vertex graph). \end{definition} \begin{definition} \label{def:kcon} \textsc{(k-Vertex Connected)} A graph $G$ is $k$-vertex connected if: 1) $|V(G)|>k$; and 2) the remaining graph is still connected after removing any ($k-1$) vertices. That is, $\vc{G} \ge k$. \end{definition} We use the term $k$-\textit{connected} for short when the context is clear. It is easy to see that any nontrivial connected graph is at least $1$-connected. Based on \refdef{kcon}, we define the $k$-\textit{Vertex Connected Component} ($k$-{VCC}\xspace) as follows. \begin{definition} \label{def:kvcc} \textsc{(k-Vertex Connected Component)} Given a graph $G$, a subgraph $g$ is a $k$-vertex connected component ($k$-{VCC}\xspace) of $G$ if: 1) $g$ is $k$-vertex connected; and 2) $g$ is maximal. That is, $\nexists g'\subseteq G$, such that $\vc{g'} \ge k$, $g \subseteq g'$. \end{definition} \stitle{Problem Definition.} Given a graph $G$ and an integer $k$, we denote the set of all $k$-{VCCs}\xspace of $G$ as ${VCC}\xspace_k(G)$. In this paper, we study the problem of efficiently enumerating all $k$-{VCCs}\xspace of $G$, i.e, to compute ${VCC}\xspace_k(G)$ . \begin{example} For the graph $G$ in \reffig{demo}, given parameter $k=4$, there are four $4$-{VCCs}\xspace: ${VCC}\xspace_4(G)=\{$$G_1$, $G_2$, $G_3$, $G_4\}$. We cannot disconnect each of them by removing any $3$ or fewer vertices. Subgraph $G_1\cup G_2$ is not a $4$-{VCC}\xspace because it will be disconnected after removing two vertices $a$ and $b$. \end{example} \subsection{Why k-Vertex Connected Component?} \label{sec:pre:why} $k$-{VCC}\xspace model effectively reduces the free-rider effect by ensuring that each $k$-{VCC}\xspace cannot be disconnected by removing any $k-1$ vertices. In this subsection, we show other good structural properties of $k$-{VCC}\xspace in terms of bounded diameter, high cohesiveness, bounded overlapping and bounded component number. None of other cohesive graph models, such as $k$-core and $k$-Edge Connected Component ($k$-{ECC}\xspace) can achieve these four goals simultaneously. \stitle{Diameter.} Before discussing the diameter of a $k$-{VCC}\xspace, we first quote Global Menger's Theorem as follows. \begin{theorem} \label{thm:menger} A graph is $k$-connected if and only if any pair of vertices $u$,$v$ is joined by at least $k$ vertex-independent $u$-$v$ paths. \cite{menger1927} \end{theorem} This theorem shows the equivalence of vertex connectivity and the number of vertex-independent paths, both of which are considered as important properties for graph cohesion \cite{white2001}. Based on this theorem, we can bound the diameter of a $k$-{VCC}\xspace, where the diameter of a graph $G$, denoted by $diam(G)$, is the longest shortest path between any pair of vertices in $G$: \vspace*{-0.1cm} \begin{equation} \label{eq:diameter} \small diam(G) = max_{u,v \in V(G)}dist(u,v,G) \end{equation} \noindent Here, $dist(u,v,G)$ is the shortest distance of the pair of vertices $u$ and $v$ in $G$. Small diameter is considered as an important feature for a good community in \cite{EdacherySB99}. We give the diameter upper bound for a $k$-{VCC}\xspace as follows. \begin{theorem} Given any $k$-{VCC}\xspace $G_i$ of $G$, we have: \begin{equation} \small diam(G_i) \leq \lfloor\frac{|V(G_i)|-2}{\vc{G_i}}\rfloor+1. \end{equation} \end{theorem} \begin{proof} Consider any two vertices $u$ and $v$ in $G_i$, we have $d(u,$ $v,$ $G_i)$ $\le$ $diam(G_i)$. \refthm{menger} indicates that there exist at least $\vc{G_i}$ vertex-disjoint paths between $u$ and $v$ in $G_i$, and in each path, we have at most $diam(G_i)-1$ internal vertices since $dist$$(u,$ $v,$ $G_i)$ $\le diam(G_i)$. Thus we have at most $\vc{G_i} \times (diam(G_i)-1)$ internal vertices between them. With two endpoints $u$ and $v$, we have $2+\vc{G_i}\times(diam(G_i)-1) \le |V(G_i)|$. Thus the upper bound of $diam(G_i)$ is $\lfloor \frac{|V(G_i)|-2}{\vc{G_i}}\rfloor+1$. \end{proof} \stitle{Cohesiveness.} To further investigate the quality of $k$-{VCC}\xspace, we introduce the Whitney Theorem \cite{hassler1932}. Given a graph $g$, it analyzes the inclusion relation between vertex connectivity $\vc{g}$, edge connectivity $\ec{g}$ and minimum degree $\mindegree{g}$. The theorem is presented as follows. \begin{theorem} \label{thm:relation} For any graph $g$, $\vc{g} \le \ec{g} \le \mindegree{g}$. \end{theorem} From this theorem, we know that for a graph $G$, every $k$-{VCC}\xspace of $G$ is nested in a $k$-{ECC}\xspace in $G$, and every $k$-{ECC}\xspace of $G$ is nested in a $k$-core in $G$. Therefore, $k$-{VCC}\xspace is generally more cohesive than $k$-{ECC}\xspace and $k$-core. \stitle{Overlapping.} The $k$-{VCC}\xspace model also supports vertex overlap between different $k$-{VCCs}\xspace, which is especially important in social networks. We can easily deduce the following property from the definition of $k$-{VCC}\xspace to bound the overlapping size. \begin{property} \label{pr:overlap} Given two $k$-{VCCs}\xspace $G_i$ and $G_j$ in graph $G$, the number of overlapped vertices of $G_i$ and $G_j$ is less than $k$. That is, $|V(G_i) \cap V(G_j)| < k$. \end{property} \begin{example} In \reffig{demo}, we find two vertices $a$ and $b$ that are contained in two $4$-{VCCs}\xspace $G_1$ and $G_2$. For $k$-{ECC}\xspace and $k$-core, two components will be combined if they have one vertex in common. For example, there is only one $4$-core, which is the union of $G_1$, $G_2$, $G_3$ and $G_4$. \end{example} \stitle{Component Number.} Once we allow overlapping between different components, the number of components can hardly be bounded. For example, the number of maximal cliques achieves $3^\frac{n}{3}$ for a graph with $n$ vertices \cite{Moon1965}. Nevertheless, we find that the number of $k$-{VCCs}\xspace in a graph $G$ can be bounded by a function that is linear to the number of vertices in $G$. That is: \begin{equation} \label{eq:cnum} |{VCC}\xspace_k(G)|\leq \frac{|V(G)|}{2} \end{equation} \noindent Detailed discussions of \refeq{cnum} can be found in \refsec{base}. It is worth noting that the linear number of $k$-{VCCs}\xspace allows us to design a polynomial time algorithm to enumerate all $k$-{VCCs}\xspace. We will also discuss this in detail in \refsec{base}. \subsection{The Cut-Based Framework} \label{sec:kvcc:frk} To compute all $k$-{VCCs}\xspace in a graph, we introduce a cut-based framework \kw{KVCC\textrm{-}ENUM} in this section. We define \textit{vertex cut}. \begin{definition} \label{def:vertexcut} \textsc{(Vertex Cut)} Given a connected graph $G$, a vertex subset ${\cal S}\xspace \subset V$ is a vertex cut if the removal of ${\cal S}\xspace$ from $G$ results in a disconnected graph. \end{definition} From \refdef{vertexcut}, we know that the vertex cut may not be unique for a given graph $G$, and the vertex connectivity is the size of the minimum vertex cut. For a complete graph, there is no vertex cut since any two vertices are adjacent. The size of a vertex cut is the number of vertices in the cut. In the rest of paper, we use cut to represent vertex cut when the context is clear. \begin{algorithm}[t] \caption{$\kw{KVCC\textrm{-}ENUM}(G,k)$} \label{alg:frk} \small \begin{algorithmic}[1] \REQUIRE a graph $G$ and an integer $k$; \ENSURE all $k$-vertex connected components; \vspace{2ex} \STATE ${VCC}\xspace_k(G) \leftarrow \emptyset$; \STATE \textbf{while} $\exists u: d(u)<k$ \textbf{do} remove $u$ and incident edges; \STATE identify connected components ${\cal G} = \{G_1, G_2,...,G_t\}$ in $G$; \FORALL{connected component $G_i\in {\cal G}$} \STATE ${\cal S}\xspace \leftarrow \kw{GLOBAL\textrm{-}CUT}(G_i,k)$; \IF{${\cal S}\xspace = \emptyset$} \STATE ${VCC}\xspace_k(G)\leftarrow {VCC}\xspace_k(G) \cup \{G_i\}$; \ELSE \STATE ${\cal G}_i\leftarrow \kw{OVERLAP\textrm{-}PARTITION}(G_i,{\cal S}\xspace)$; \FORALL{$G^j_i\in {\cal G}_i$} \STATE ${VCC}\xspace_k(G)\leftarrow {VCC}\xspace_k(G)\cup \kw{KVCC\textrm{-}ENUM}(G^j_i,k)$; \ENDFOR \ENDIF \ENDFOR \STATE \textbf{return} ${VCC}\xspace_k(G)$; \vspace*{0.2cm} \STATE \textbf{Procedure} $\kw{OVERLAP\textrm{-}PARTITION}($Graph $G'$, Vertex Cut ${\cal S}\xspace)$ \STATE ${\cal G}\leftarrow \emptyset$; \STATE remove vertices in ${\cal S}\xspace$ and their adjacent edges from $G'$; \FORALL{connected component $G'_i$ of $G'$} \STATE ${\cal G}\leftarrow {\cal G} \cup \{G'[V(G'_i)\cup {\cal S}\xspace]\}$; \ENDFOR \STATE \textbf{return} ${\cal G}$; \end{algorithmic} \end{algorithm} \stitle{The Algorithm.} Given a graph $G$, the general idea of our cut-based framework is given as follows. If $G$ is $k$-connected, $G$ itself is a $k$-{VCC}\xspace. Otherwise, there must exist a qualified cut ${\cal S}\xspace$ whose size is less than $k$. In this case, we find such cut and partition $G$ into overlapped subgraphs using the cut. We repeat the partition procedure until each remaining subgraph is a $k$-{VCC}\xspace. From \refthm{relation}, we know that a $k$-{VCC}\xspace must be a $k$-core (a graph with minimum degree no smaller than $k$). Thus we can compute all $k$-cores in advance to reduce the size of the graph. The pseudocode of our framework is presented in \refalg{frk}. In line 2, the algorithm computes the $k$-core by iteratively removing the vertices whose degree is less than $k$ and terminates once no such vertex exists. Then we identify connected components of the input graph $G$. For each connected component $G_i$ (line~4), we first find a cut of $G_i$ by invoking the subroutine $\kw{GLOBAL\textrm{-}CUT}$ (line~5). Here, we only need to find a cut with fewer than $k$ vertices instead of a minimum cut. The detailed implementation of $\kw{GLOBAL\textrm{-}CUT}$ will be introduced later. If there is no such cut, it means $G_i$ is $k$-connected and we add it to the result list ${VCC}\xspace_k(G)$ (line~6-7). Otherwise, we partition the graph into overlapped subgraphs using the cut ${\cal S}\xspace$ by invoking $\kw{OVERLAP\textrm{-}PARTITION}$ (line~9). We recursively cut each of other subgraphs using the same procedure $\kw{KVCC\textrm{-}ENUM}$ (line~11) until all remaining subgraphs are $k$-{VCCs}\xspace. Next, we introduce the subroutine $\kw{OVERLAP\_PARTITION}$, which partitions the graph into overlapped subgraphs by cut ${\cal S}\xspace$. \begin{figure}[t] \begin{center} \includegraphics[width=0.99\hsize]{fig/cutresult.pdf} \topcaption{An example of overlapped graph partition.} \label{fig:partition} \end{center} \end{figure} \stitle{Overlapped Graph Partition.} To partition a graph $G$ into overlapped subgraphs using a cut ${\cal S}\xspace$, we cannot simply remove all vertices in ${\cal S}\xspace$, since such vertices may be the overlapped vertices of two or more $k$-{VCCs}\xspace. Subroutine $\kw{OVERLAP\textrm{-}PARTITION}$ is shown in line~13-18 of \refalg{frk}. We first remove the vertices in ${\cal S}\xspace$ along with their adjacent edges from $G'$. $G'$ will become disconnected after removing ${\cal S}\xspace$, since ${\cal S}\xspace$ is a vertex cut of $G'$. We can simply add the cut ${\cal S}\xspace$ into each connected component $G'_i$ of $G'$ and return induced subgraph $G'[V(G'_i)\cup {\cal S}\xspace]$ as the partitioned subgraph (line~17-18). Partitioned subgraphs overlap each other since the cut ${\cal S}\xspace$ is duplicated in these subgraphs. Below, we use an example to illustrate the partition process. \begin{example} We consider a graph $G$ on the left of \reffig{partition}. given the input parameter $k = 3$, we can find a vertex cut in which all vertices are marked by gray. These vertices belong to both $3$-{VCCs}\xspace, $G_1$ and $G_2$. Thus, given a cut ${\cal S}\xspace$ of graph $G$, we partition the graph by duplicating the induced subgraph of cut ${\cal S}\xspace$. As shown on the right of \reffig{partition}, we obtain two $3$-{VCCs}\xspace, $G_1$ and $G_2$, by duplicating the two cut vertices and their inner edges. \end{example} \subsection{Algorithm Correctness} \label{sec:base:algcrt} In this section, we prove the correctness of \kw{KVCC\textrm{-}ENUM} using the following lemmas. \begin{lemma} \label{lem:kcon} Each of the subgraphs returned by \kw{KVCC\textrm{-}ENUM} is $k$-vertex connected. \end{lemma} \begin{proof} We prove it by contradiction. Assume one of the result subgraphs $G_i$ is not $k$-connected. $\kw{GLOBAL\textrm{-}CUT}$ in line 5 will find a vertex cut. $G_i$ will be partitioned in line 9 and cannot be returned, which contradicts that $G_i$ is in the result list. \end{proof} \begin{lemma} \label{lem:completeness} (Completeness) The result returned by \kw{KVCC\textrm{-}ENUM} contains all $k$-{VCCs}\xspace of the input graph $G$. \end{lemma} \begin{proof} Suppose graph $G$ is partitioned into overlapped subgraphs ${\cal G}'=\{$ $G'_1$, $G'_2$, $\ldots\}$ using a vertex cut ${\cal S}\xspace$. We first prove that each $k$-{VCC}\xspace $G_i$ of $G$ is contained in at least one subgraph in ${\cal G}'$. We prove this by contradiction. We suppose that $G_i$ is not contained in any subgraph in ${\cal G}'$. Consider the computation of ${\cal G}'$, after we remove the vertices in ${\cal S}\xspace$ and their adjacent edges from $G_i$, the remaining vertices in $G_i$ are contained in at least two graphs in ${\cal G}'$. This indicates that ${\cal S}\xspace$ is a vertex cut of $G_i$. Since $|{\cal S}\xspace|<k$, $G_i$ cannot be a $k$-{VCC}\xspace, which contradicts that $G_i$ is a $k$-{VCC}\xspace. Therefore, we prove that we will not lose any $k$-{VCC}\xspace. From \reflem{kcon}, we know that each of the returned subgraphs of \kw{KVCC\textrm{-}ENUM} is $k$-connected. Therefore, all maximal subgraphs that are $k$-connected will be returned by \kw{KVCC\textrm{-}ENUM}. In other words, all $k$-{VCCs}\xspace will be returned by \kw{KVCC\textrm{-}ENUM}. \end{proof} \begin{lemma} \label{lem:redundancyfree} (Redundancy-Free) There does not exist two subgraphs $G_i$ and $G_j$ returned by \kw{KVCC\textrm{-}ENUM} such that $G_i\subseteq G_j$. \end{lemma} \begin{proof} We prove it by contradiction. Suppose there are two subgraphs $G_i$ and $G_j$ returned by \kw{KVCC\textrm{-}ENUM} such that $G_i\subseteq G_j$. On the one hand, we have $|V(G_i)\cap V(G_j)|=|V(G_i)|\geq k$. On the other hand, there must exist a partition ${\cal G}'=\{$ $G'_1$, $G'_2$, $\ldots\}$ of $G$ by a certain cut ${\cal S}\xspace$ such that $G_i$ and $G_j$ are contained in two different graphs in ${\cal G}'$. From the partition procedure, we know that $G_i$ and $G_j$ have at most $k-1$ common vertices. This contradicts $|V(G_i)\cap V(G_j)|\geq k$. Therefore, the lemma holds. \end{proof} \begin{theorem} \label{thm:correctness} \kw{KVCC\textrm{-}ENUM} correctly computes all $k$-{VCCs}\xspace of $G$. \end{theorem} \begin{proof} From \reflem{kcon}, we know that all subgraphs returned by \kw{KVCC\textrm{-}ENUM} are $k$-connected. From \reflem{completeness}, we know that all $k$-{VCCs}\xspace are returned by \kw{KVCC\textrm{-}ENUM}. From \reflem{redundancyfree}, we know that all $k$-connected subgraphs returned by \kw{KVCC\textrm{-}ENUM} are maximal, and no redundant subgraph will be produced. Therefore, \kw{KVCC\textrm{-}ENUM} (\refalg{frk}) correctly computes all $k$-{VCCs}\xspace of $G$. \end{proof} Next, we show how to efficiently compute all $k$-{VCCs}\xspace following the framework in \refalg{frk}. From \refalg{frk}, we know that the key to improving algorithmic efficiency is to efficiently compute the vertex cut of a graph $G$. Below, we first introduce a basic algorithm in \refsec{base} to compute the vertex cut of a graph in polynomial time, and then we explore optimization strategies to accelerate the computation of the vertex cut in \refsec{opt}. \subsection{Find Vertex Cut} \label{sec:base:findcut} We give some necessary definitions before introducing the idea to implement $\kw{GLOBAL\textrm{-}CUT}$. \begin{definition} \textsc{(Minimum $u$-$v$ Cut)} A vertex cut ${\cal S}\xspace$ is a $u$-$v$ cut if $u$ and $v$ are in disjoint subsets after removing ${\cal S}\xspace$, and it is a minimum $u$-$v$ cut if its size is no larger than that of other $u$-$v$ cuts. \end{definition} \begin{definition} \label{def:lc} \textsc{(Local Connectivity)} Given a graph $G$, the local connectivity of two vertices $u$ and $v$, denoted by $\vc{u,v,G}$, is defined as the size of the minimum $u$-$v$ cut. $\vc{u,v,G}=+\infty$ if no such cut exists. \end{definition} Based on \refdef{lc}, we define two local $k$ connectivity relations as follows: \begin{itemize} \item $u \equiv_G^k v$: The local connectivity between $u$ and $v$ is not less than $k$ in graph $G$, i.e., $\vc{u,v,G} \ge k$. \item $u \not\equiv_G^k v$: The local connectivity between $u$ and $v$ is less than $k$ in graph $G$, i.e., $\vc{u,v,G} < k$. \end{itemize} We omit the suffix $G$, and use $u \equiv^k v$ and $u \not\equiv^k v$ to denote $u \equiv_G^k v$ and $u \not\equiv_G^k v$ respectively when the context is clear. Once $u \equiv^k v$, we say $u$ and $v$ is $k$-local connected. Obviously, $u \equiv^k v$ and $v \equiv^k u$ are equivalent. \begin{algorithm}[t] \caption{$\kw{GLOBAL\textrm{-}CUT}(G,k)$} \label{alg:findcutbase} \small \begin{algorithmic}[1] \REQUIRE a graph $G$ and an integer $k$; \ENSURE a vertex cut with fewer than $k$ vertices; \vspace{2ex} \STATE compute a sparse certification ${\cal SC}$ of $G$; \STATE select a source vertex $u$ with minimum degree; \STATE construct the directed flow graph $\overline{\cal SC}$ of ${\cal SC}$; \FORALL{$v \in V$} \STATE ${\cal S}\xspace \leftarrow \kw{LOC\textrm{-}CUT}(u,v,\overline{\cal SC},{\cal SC})$; \STATE \textbf{if} ${\cal S}\xspace \neq \emptyset$ \textbf{then} \textbf{return} ${\cal S}\xspace$; \ENDFOR \FORALL{$v_a \in N(u)$} \FORALL{$v_b \in N(u)$} \STATE ${\cal S}\xspace \leftarrow \kw{LOC\textrm{-}CUT}(v_a,v_b,\overline{\cal SC},{\cal SC})$; \STATE \textbf{if} ${\cal S}\xspace \neq \emptyset$ \textbf{then} \textbf{return} ${\cal S}\xspace$; \ENDFOR \ENDFOR \STATE return $\emptyset$; \vspace{2ex} \STATE \textbf{Procedure} $\kw{LOC\textrm{-}CUT}(u,v,\overline{G},G)$ \vspace{1ex} \STATE \textbf{if} $v \in N(u)$ or $v = u$ \textbf{then} \textbf{return} $\emptyset$; \STATE $\lambda \leftarrow $ calculate the maximum flow from $u$ to $v$ in $\overline{G}$; \STATE \textbf{if} $ \lambda \ge k $ \textbf{then} \textbf{return} $\emptyset$; \STATE compute the minimum edge cut in $\overline{G}$; \STATE \textbf{return} the corresponding vertex cut in $G$; \end{algorithmic} \end{algorithm} \stitle{The $\kw{GLOBAL\textrm{-}CUT}$ Algorithm.} We follow \cite{esfahanian1984} to implement $\kw{GLOBAL\textrm{-}CUT}$. Given a graph $G$, we assume that $G$ contains a vertex cut ${\cal S}\xspace$ such that $|{\cal S}\xspace| < k$. We consider an arbitrary source vertex $u$. There are only two cases: $(i)$ $u \not\in {\cal S}\xspace$ and $(ii)$ $u \in {\cal S}\xspace$. The general idea of algorithm $\kw{GLOBAL\textrm{-}CUT}$ considers two cases. In the first phase, we select a vertex $u$ and test the local connectivity between $u$ and all other vertices $v$ in $G$. We have either (a) $u\in {\cal S}\xspace$ or (b) $G$ is $k$-connected if each local connectivity is not less than $k$. In the second phase, we consider the case $u\in {\cal S}\xspace$ and test the local connectivity between any two neighbors of $u$ based on \reflem{cutnc}. More details can be found in \cite{esfahanian1984}. \begin{lemma} \label{lem:cutnc} Given a non-$k$-vertex connected graph $G$ and a vertex $u \in {\cal S}\xspace$ where ${\cal S}\xspace$ is a vertex cut and $|{\cal S}\xspace|<k$, there exist $v, v' \in N(u)$ such that $v \not\equiv^k v'$. \end{lemma} The pseudocode is given in \refalg{findcutbase}. An optimization here is computing a sparse certificate of the original graph in line~1. Given a graph $G(V,E)$, a sparse certificate is a subset of edges $E' \in E$, such that the subgraph $G'(V,E')$ is $k$-connected if and only if $G$ is $k$-connected. Undoubtedly, the same algorithm is more efficient in a sparser graph. We will introduce the details of sparse certification in the next subsection. The first phase is shown in line~4-6. Once finding such cut ${\cal S}\xspace$, we return it as the result. Similarly, the second phase is shown in line~7-10. Here, the procedure \kw{LOC\textrm{-}CUT} tests the local connectivity between $u$ and $v$ and returns the vertex cut if $u \not\equiv^k v$ (line 5 and line 9). To invoke \kw{LOC\textrm{-}CUT}, we need to transform the original graph $G$ into a directed flow graph $\overline{G}$. The details on how to construct the directed flow graph are introduced as follows. \begin{figure}[t] \begin{center} \includegraphics[width=0.8\hsize]{fig/dfgraph.pdf} \topcaption{An example of directed flow graph construction.} \label{fig:dfgraph} \end{center} \end{figure} \stitle{Directed Flow Graph.} The directed flow graph $\overline{G}$ of graph $G$ is an auxiliary directed graph which is used to calculate the local connectivity between two vertices. Given a graph $G$, we can construct the directed flow graph as follows. Each vertex $u$ in $G$ is represented by an directed edge $e_u$ in the directed flow graph $\overline{G}$. Let $u'$ and $u''$ denote the starting vertex and ending vertex of $e_u$. For each edge $(u,v)$ in $G$, we construct two directed edges: One is from $u''$ to $v'$, and the other is from $v''$ to $u'$. Consequently, we obtain $\overline{G}$ with $2n$ vertices and $n+2m$ edges and the capacity of every edge is $1$. \begin{example} \reffig{dfgraph} gives an example of the directed flow graph construction. The solid lines in the directed flow graph represent vertices in the original graph, and the dashed lines in the directed flow graph represent edges in the original graph. The original graph contains 4 vertices and 4 edges, and the directed flow graph contains 8 vertices and 12 edges. \end{example} \stitle{The \kw{LOC\textrm{-}CUT} Procedure.} By using the directed flow graph, we convert vertex connectivity problem into edge connectivity problem. To calculate the local connectivity of two vertices $u$ and $v$, we perform the maximum flow algorithm on the directed flow graph. The value of the maximum flow is the local connectivity between $u$ and $v$. The pseudocode of \kw{LOC\textrm{-}CUT} is given form line~12 to line~17 in \refalg{findcutbase}. It first checks whether $v$ is a neighbor of $u$ in line 13. If $u\in N(v)$, we always have $u \equiv^k v$ because of \reflem{nbrsave}. \begin{lemma} \label{lem:nbrsave} $u \equiv^k v$ if $(u,v) \in E$. \end{lemma} Then the procedure computes the maximum flow $\lambda$ from $u$ to $v$ in $\overline{G}$ in line 14. If $\lambda \ge k$, we have $u \equiv^k v$ and the procedure returns $\emptyset$ in line 15. Otherwise, we compute the edge cut in $\overline{G}$ in line~16. Then we locate the corresponding vertices in the original graph $G$ for each edge in the edge cut and return them as the vertex cut of $G$ (line~16-17). \subsection{Sparse Certificate} \label{sec:base:cert} We introduce the details of sparse certificate \cite{CheriyanKT93} in this section. In \refsec{opt}, we will show that the sparse certificate can not only be used to reduce the graph size, but also used to further reduce the local connectivity testings. \begin{definition} \label{def:cert} \textsc{(Certificate)} A certificate for the $k$-vertex connectivity of $G$ is a subset $E'$ of $E$ such that the subgraph $(V,E')$ is $k$-vertex connected if and only if $G$ is $k$-vertex connected. \end{definition} \begin{definition} \label{def:scert} \textsc{(Sparse Certificate)} A certificate for $k$-vertex connectivity of $G$ is called sparse if it has $O(k\cdot n)$ edges. \end{definition} From the definitions, we can see that a sparse certificate is equivalent to the original graph w.r.t $k$-vertex connectivity. It can also bound the edge size. We compute the sparse certificate (line 1 of \refalg{findcutbase}) according to the following theorem. \begin{theorem} \label{thm:maincert} Let $G(V,E)$ be an undirected graph and let $n$ denote the number of vertices. Let $k$ be a positive integer. For $i = 1,2,...,k$, let $E_i$ be the edge set of a scan first search forest $F_i$ in the graph $G_{i-1} = (V,E-(E_1 \cup E_2 \cup ... \cup E_{i-1}))$. Then $E_1 \cup E_2 \cup ... \cup E_k$ is a certificate for the $k$-vertex connectivity of $G$, and this certificate has at most $k\times(n-1)$ edges \cite{CheriyanKT93}. \end{theorem} Based on \refthm{maincert}, we can simply generate the sparse certificate of $G$ using scan first search $k$ times, each of which creates a scan first search forest $F_i$. Below, we introduce how to perform a scan first search. \stitle{Scan First Search.} In a scan first search of given graph $G$, for each connected component, we start from scanning a root vertex by marking all its neighbors. We scan an arbitrary marked but unscanned vertex each time and mark all its unvisited neighbors. This step is performed until all vertices are scanned. The resulting search forest forms the scan first forest of $G$. Obviously, a breath first search is a special case of scan first search. \begin{figure}[t] \begin{center} \includegraphics[width=0.99\hsize]{fig/sc.pdf} \topcaption{The sparse certificate of given graph $G$ with $k = 3$} \label{fig:sc} \end{center} \end{figure} \begin{example} \label{ex:sccn} \reffig{sc} presents construction of a sparse certificate for the graph $G$. Let $k = 3$. For $i\in\{1,2,3\}$, $F_i$ denotes the scan first search forest obtained from $G_{i-1}$. $G_i$ is obtained by removing the edges in $F_i$ from $G_{i-1}$. $G_0$ is the input graph $G$. The obtained sparse certificate $SC$ is shown on the right side of $G$ with $SC = F_1 \cup F_2 \cup F_3$. All removed edges are shown in $G_3$. \end{example} \subsection{Algorithm Analysis} \label{sec:base:complexity} We analyze the basic algorithm in this section. In the directed flow graph, all edge capacities are equal to 1 and every vertex either has a single edge emanating from it or has a single edge entering it. For this kind of graph, the time complexity for computing the maximum flow is $O(n^{1/2}m)$ \cite{even1975network}. Note that we do not need to calculate the exact flow value in the algorithm. Once the flow value reaches $k$, we know that local connectivity between any two given vertices is at least $k$ and we can terminate the maximum flow algorithm. The time complexity for the flow computation is $O(\min(n^{1/2},k)\cdot m)$. Given a flow value and corresponding residual network, we can perform a depth first search to find the cut. It costs $O(m+n)$ time. As a result, we have the following lemma: \begin{lemma} \label{lem:tlcut} The time complexity of $\kw{LOC\textrm{-}CUT}$ is $O(\min\\(n^{1/2},k)\cdot m)$. \end{lemma} Next we discuss the time complexity of $\kw{GLOBAL\textrm{-}CUT}$. The construction of both sparse certificate and directed flow graph costs $O(m+n)$ CPU time. Let $\delta$ denote the minimum degree in the input graph. We can easily get following lemma. \begin{lemma} \label{lem:lccnt} $\kw{GLOBAL\textrm{-}CUT}$ invokes $\kw{LOC\textrm{-}CUT}$\\ $O(n+\delta^2)$ times in the worst case. \end{lemma} Next we discuss the CPU time complexity of the entire algorithm $\kw{KVCC\textrm{-}ENUM}$. $\kw{KVCC\textrm{-}ENUM}$ iteratively removes vertices with degree less than $k$ in line~2. This costs $O(m+n)$ time. Identifying all connected components can be performed by adopting a depth first search (line 3). This also need $O(m+n)$ time. To study the total time complexity spent by invoking $\kw{GLOBAL\textrm{-}CUT}$, we first give the following lemma. \begin{lemma} \label{lem:dpcnt} For each subgraph created by the overlapped partition, at most $k-1$ vertices and $\frac{(k-1)(k-2)}{2}$ edges are increased after the partition. \end{lemma} \begin{proof} The vertex cut ${\cal S}\xspace$ contains not more than $k-1$ vertices, and only these vertices exist in the overlapped part. Therefore, at most $\frac{(k-1)(k-2)}{2}$ incident edges are duplicated. \end{proof} \begin{lemma} \label{lem:cccnt} Given a graph $G$ and an integer $k$, for each connected component $C$ obtained by overlapped partition in \refalg{frk}, $|V(C)| \ge k+1$. \end{lemma} \begin{proof} Let ${\cal S}\xspace$ denote a vertex cut in an overlapped partition. $C$ is one of the connected components obtained in this partition. Let $H$ denote the vertex set of all vertices in $V(C)$ but not in ${\cal S}\xspace$, i.e., $H = \{u | u \in V(C), u\not\in {\cal S}\xspace \}$. We have $H\neq \emptyset$. Note that each vertex in the graph has a degree at least $k$ in $G$ (line 5 in \refalg{frk}). There exist at least $k$ neighbors for each vertex $u$ in $H$ and therefore for each neighbor $v$ of $u$ we have $v \in C$ according to \reflem{nbrsave}. Thus, we have $|V(C)| \ge k+1$. \end{proof} \begin{lemma} \label{lem:cutcnt} Given a graph $G$ and an integer $k$, the total number of overlapped partitions during the algorithm $\kw{KVCC\textrm{-}ENUM}$ is no larger than $\frac{n-k-1}{2}$. \end{lemma} \begin{proof} Suppose that $\lambda$ is the total number of overlapped partitions during the whole algorithm $\kw{KVCC\textrm{-}ENUM}$. This generates at least $\lambda+1$ connected components. We know from \reflem{cccnt} that each connected component contains at least $k+1$ vertices. Thus, we have at least $(\lambda+1)(k+1)$ vertices in total. On the other hand, we increase at most $k-1$ vertices in each subgraph obtained by an overlapped partition according to \reflem{dpcnt}. Thus, at most $\lambda(k-1)$ vertices are added. We obtain the following formula. \begin{center} $(\lambda+1)(k+1) \le n+\lambda(k-1)$ \end{center} Rearranging the formula, we have $\lambda \le \frac{n-k-1}{2}$. \end{proof} Next, we prove the upper bound for number of $k$-{VCCs}\xspace. \begin{theorem} \label{thm:numkvcc} Given a graph $G$ and an integer $k$, there are at most $\frac{n}{2}$ $k$-{VCCs}\xspace, i.e., $|{VCC}\xspace_k(G)| < \frac{|V(G)|}{2}$. \end{theorem} \begin{proof} Similar to the proof of \reflem{cutcnt}, let $\lambda$ be the times of overlapped partitions in the whole algorithm $\kw{KVCC\textrm{-}ENUM}$. At most $\lambda(k-1)$ vertices are increased. Let $\sigma$ be the number of connected components obtained in all partitions. We have $\sigma > \lambda$. Each connected component contains at least $k+1$ vertices according to \reflem{cccnt}. Note that each connected component is either a $k$-{VCC}\xspace or a graph that does not contain any $k$-{VCC}\xspace. Otherwise, the connected component will be further partitioned. Let $x$ be the number of $k$-{VCCs}\xspace and $y$ be the number of connected components that do not contain any $k$-{VCC}\xspace, i.e., $x+y = \sigma$. We know that a $k$-{VCC}\xspace contains at least $k+1$ vertices. Thus there are at least $x(k+1)+y(k+1)$ vertices after finishing all partitions. We have following formula. \begin{center} $x(k+1)+y(k+1) \le n+\lambda(k-1)$ \end{center} Since $\lambda < \sigma$ and $\sigma = x+y$, we rearrange the formula as follows. \begin{center} $x(k+1)+y(k+1) < n+x(k-1)+y(k-1)$ $x(k+1) < n+x(k-1)$ \end{center} Therefore, we have $x < \frac{n}{2}$. \end{proof} \begin{theorem} \label{thm:time} The total time complexity of $\kw{KVCC\textrm{-}ENUM}$ is $O(\min(n^{1/2},$ $k)\cdot m \cdot (n+\delta^2) \cdot n)$. \end{theorem} \begin{proof} The total time complexity of $\kw{KVCC\textrm{-}ENUM}$ is dependent on the number of times $\kw{GLOBAL\textrm{-}CUT}$ is invoked. Suppose $\kw{GLOBAL\textrm{-}CUT}$ is invoked $p$ times during the whole $\kw{KVCC\textrm{-}ENUM}$ algorithm, the number of overlapped partitions during the whole $\kw{KVCC\textrm{-}ENUM}$ algorithm is $p_1$ and the total number of $k$-{VCCs}\xspace is $p_2$. It is easy to see that $p=p_1+p_2$. From \reflem{cutcnt}, we know that $p_1\leq \frac{n-k-1}{2} < \frac{n}{2}$. From \refthm{numkvcc}, we know that $p_2 < \frac{n}{2}$. Therefore, we have $p=p_1+p_2 < n$. According to \reflem{tlcut} and \reflem{lccnt}, the total time complexity of $\kw{KVCC\textrm{-}ENUM}$ is $O(\min(n^{1/2},$ $k)\cdot m\cdot (n+\delta^2) \cdot n )$. \end{proof} \stitle{Discussion.} \refthm{time} shows that all $k$-{VCCs}\xspace can be enumerated in polynomial time. Although the time complexity is still high, it performs much better in practice. Note that the time complexity is the product of three parts: \begin{itemize} \item The first part $O(\min(n^{1/2},$ $k)\cdot m)$ is the time complexity for $\kw{LOC\textrm{-}CUT}$ to test whether there exists a vertex cut of size smaller than $k$. In practice, the graph to be tested is much smaller than the original graph $G$ since (1) The graph to be tested has been pruned using the $k$-core technique and sparse certification technique. (2) Due to the graph partition scheme, the input graph is partitioned into many smaller graphs. \item The second part $O(n+\delta^2)$ is the number of times such that $\kw{LOC\textrm{-}CUT}$ (local connectivity testing) is invoked by the algorithm $\kw{GLOBAL\textrm{-}CUT}$. We will discuss how to significantly reduce the number of local connectivity testings in \refsec{opt}. \item The third part $O(n)$ is the number of times $\kw{GLOBAL\textrm{-}CUT}$ is invoked. In practice, the number can be significantly reduced since the number of $k$-{VCCs}\xspace is usually much smaller than $\frac{n}{2}$. \end{itemize} In the next section, we will explore several search reduction techniques to speed up the algorithm. \subsection{Neighbor Sweep} \label{sec:opt:ns} In this section, we propose a neighbor sweep strategy to prune unnecessary local connectivity testings ($\kw{LOC\textrm{-}CUT}$) in the first phase of $\kw{GLOBAL\textrm{-}CUT}$. Generally speaking, given a source vertex $u$, for any vertex $v$, we aim to skip testing the local connectivity of $(u,v)$ according to the information of the neighbors of $v$. Below, we explore two neighbor sweep strategies, namely neighbor sweep using side-vertex and neighbor sweep using vertex deposit. \subsubsection{Neighbor Sweep using Side-Vertex} \label{sec:opt:ns:sv} We first define \textit{side}-\textit{vertex} as follows. \begin{definition} \label{def:sd} \textsc{(Side-Vertex)} Given a graph $G$ and an integer $k$, a vertex $u$ is called a side-vertex if there does not exist a vertex cut ${\cal S}\xspace$ such that $|{\cal S}\xspace| < k$ and $u \in {\cal S}\xspace$. \end{definition} Based on \refdef{sd}, we give the following lemma to show the transitive property regarding the local $k$ connectivity relation $\equiv^k$. \begin{lemma} \label{lem:transitive} Given a graph $G$ and an integer $k$, suppose $a \equiv^k b$ and $b \equiv^k c$, we have $a \equiv^k c$ if $b$ is a side-vertex. \end{lemma} \begin{proof} We prove it by contradiction. Assume that $b$ is a side-vertex and $a \not\equiv^k c$. There exists a vertex cut with $k-1$ or fewer vertices between $a$ and $c$. $b$ is not in any such cut since it is a side-vertex. Then we have either $b \not\equiv^k a$ or $b \not\equiv^k c$. This contradicts the precondition that $a \equiv^k b$ and $b \equiv^k c$. \end{proof} A wise way to use the transitive property of the local connectivity relation in \reflem{transitive} can largely reduce the number of unnecessary testings. Consider a selected source vertex $u$ in algorithm $\kw{GLOBAL\textrm{-}CUT}$. We assume that $\kw{LOC\textrm{-}CUT}$ (line~5) returns $\emptyset$ for a vertex $v$, i.e., $u \equiv^k v$. We know from \reflem{transitive} that the vertex pair $(u,w)$ can be skipped for local connectivity testing if $(i)$ $v \equiv^k w$ and $(ii)$ $v$ is a side-vertex. For condition $(i)$, we can use a simple necessary condition according to \reflem{nbrsave}, that is, for any vertices $v$ and $w$, $v \equiv^k w$ if $(v,w) \in E$. In the following, we focus on condition $(ii)$ and look for necessary conditions to efficiently check whether a vertex is a side-vertex. \stitle{Side-Vertex Detection.} To check whether a vertex is a side-vertex, we can easily obtain the following lemma based on \refdef{sd}. \begin{lemma} \label{lem:issv} Given a graph $G$, a vertex $u$ is a side-vertex if and only if $\forall v, v' \in N(u)$, $v \equiv^k v'$. \end{lemma} Recall that two vertices are $k$-local connected if they are neighbors of each other. For the $k$-local connectivity of non-connected vertices, we give another necessary condition below. \begin{lemma} \label{lem:commonnbr} Given two vertices $u$ and $v$, $u \equiv^k v$ if $|N(u) \cap N(v)| \ge k$. \end{lemma} \begin{proof} $u$ and $v$ cannot be disjoint after removing any $k-1$ vertices since they have at least $k$ common neighbors. Thus $u$ and $v$ must be $k$-local connected. \end{proof} Combining \reflem{issv} and \reflem{commonnbr}, we derive the following necessary condition to check whether a vertex is a side-vertex. \begin{theorem} \label{thm:necessaryside} A vertex $u$ is a side-vertex if $\forall v, v' \in N(u)$, either $(v, v') \in E$ or $|N(v) \cap N(v')| \ge k$. \end{theorem} \begin{proof} The theorem can be easily verified using \reflem{nbrsave}, \reflem{issv} and \reflem{commonnbr}. \end{proof} \begin{definition} \label{def:ssv} \textsc{(Strong Side-Vertex)} A vertex $u$ is called a strong side-vertex if it satisfies the conditions in \refthm{necessaryside}. \end{definition} Using strong side-vertex, we can define our first rule for neighbor sweep as follows. \rtitle{(Neighbor Sweep Rule 1)} \textit{Given a graph $G$ and an integer $k$, let $u$ be a selected source vertex in algorithm $\kw{GLOBAL\textrm{-}CUT}$ and $v$ be a strong side-vertex in the graph. We can skip the local connectivity testings of all pairs of $(u,w)$ if we have $u \equiv^k v$ and $w \in N(v)$.} We give an example to demonstrate \textit{neighbor sweep rule 1} below. \begin{figure}[t] \begin{center} \begin{tabular}[t]{c} \subfigure[A strong side-vertex $s$]{ \includegraphics[width=0.49\columnwidth]{fig/ssv.pdf} } \subfigure[Vertex deposit]{ \includegraphics[width=0.49\columnwidth]{fig/deposit.pdf} } \end{tabular} \topcaption{Strong side-vertex and vertex deposit when $k=3$} \label{fig:ssv} \end{center} \end{figure} \begin{example} \reffig{ssv} (a) presents a strong side-vertex $s$ in graph $G$ while parameter $k = 3$. Assume that $r$ is the source vertex. Any two neighbors of $s$ are either connected by an edge or have at least $3$ common neighbors. If first test the local connectivity between $r$ and $s$ and $r \equiv^k s$, we can safely sweep all neighbors of $s$, which are marked by the gray color in \reffig{ssv} (a). \end{example} Below, we discuss how to efficiently detect the strong side-vertices and maintain strong side-vertices while the graph is partitioned in the whole algorithm. \stitle{Strong Side-Vertex Computation.} Following \refthm{necessaryside}, we can compute all strong side-vertices $v$ in advance and skip all neighbors of $v$ once $v$ is $k$ connected with the source vertex (line~5 in $\kw{GLOBAL\textrm{-}CUT}$). We can derive the following lemma. \begin{lemma} The time complexity of computing all strong side-vertices in graph $G$ is $O(\sum_{w\in V(G)}d(w)^2)$. \end{lemma} \begin{proof} To compute all strong side-vertices in a graph $G$, we first check all $2$-hop neighbors $v$ for each vertex $u$. Since $v$ and $u$ share a common vertex of $1$-hop neighbor, we can easily obtain all vertices which have $k$ common neighbors with $u$. Any vertex $w$ is considered as $1$-hop neighbor of other vertices $u$ $d(w)$ times. We use $d(w)$ steps to obtain $2$-hop neighbors of $u$ which share a common vertex $w$ with $u$. This phase costs $O(\sum_{w\in V(G)}d(w)^2)$ time. Now for each given vertex $u$, we have all vertices $v$ sharing $k$ common neighbors with it. For each vertex $w$, we check whether any two neighbors of $w$ have $k$ common neighbors. This phase also costs $O(\sum_{w\in V(G)}d(w)^2)$ time. Consequently, the total time complexity is $O(\sum_{w\in V(G)}d(w)^2)$. \end{proof} After computing all strong side-vertices for the original graph $G$, we do not need to recompute the strong side-vertices for all vertices in the partitioned graph from scratch. Instead, we can find possible ways to reduce the number of strong side-vertex checks by making use of the already computed strong side-vertices in $G$. We can do this based on \reflem{sidevertexpart} and \reflem{sidevertexonly} which are used to efficiently detect non-strong side-vertices and strong side-vertices respectively. \begin{lemma} \label{lem:sidevertexpart} Let $G$ be a graph and $G_i$ be one of the graphs obtained by partitioning $G$ using $\kw{OVERLAP\textrm{-}PARTITION}$ in \refalg{frk}, a vertex is a strong side-vertex in $G$ if it is a strong side-vertex in $G_i$. \end{lemma} \begin{proof} The strong side-vertex $u$ requires at least $k$ common neighbors between any two neighbors of $u$. The lemma is obvious since $G$ contains all edges and vertices in $G_i$. \end{proof} From \reflem{sidevertexpart}, we know that a vertex is not a strong side-vertex in $G_i$ if it is not a strong side-vertex in $G$. This property allows us checking limited number of vertices in $G_i$, which is the set of strong side-vertices in $G$. \begin{lemma} \label{lem:sidevertexonly} Let $G$ be a graph, $G_i$ be one of the graphs obtained by partitioning $G$ using $\kw{OVERLAP\textrm{-}PARTITION}$ in \refalg{frk}, and ${\cal S}\xspace$ is a vertex cut of $G$, for any vertex $v \in V(G_i)$, if $v$ is a strong side-vertex in $G$ and $N(v)\cap {\cal S}\xspace =\emptyset$, then $v$ is also a strong side-vertex in $G_i$. \end{lemma} \begin{proof} The qualification of a strong side-vertex of vertex $v$ requires the information about two-hop neighbors of $v$. Vertices in ${\cal S}\xspace$ are duplicated when partitioning the graph. Given a strong side-vertex $v$ in $G$, if $N(v)\cap {\cal S}\xspace =\emptyset$, the two-hop neighbors of $v$ are not affected by the partition operation, thus the relationships between the vertices in $N(v)$ are not affected by the partition operation. Therefore, $v$ is still a strong side-vertex in $G_i$ according to \refdef{ssv}. \end{proof} With \reflem{sidevertexpart} and \reflem{sidevertexonly}, in a graph $G_i$ partitioned from graph $G$ by vertex cut ${\cal S}\xspace$, we can reduce the scope of strong side-vertex checks from the vertices in the whole graph $G_i$ to the vertices $u$ satisfying following two conditions simultaneously: \begin{itemize} \item $u$ is a strong side-vertex in $G$; and \item $N(u) \cap {\cal S}\xspace \neq \emptyset$. \end{itemize} \subsubsection{Neighbor Sweep using Vertex Deposit} \label{sec:opt:ns:vd} \stitle{Vertex Deposit.} The strong side-vertex strategy heavily relies on the number of strong side-vertices. Next, we investigate a new strategy called vertex deposit, to further sweep vertices based on neighbor information. We first give the following lemma: \begin{lemma} \label{lem:2hop} Given a source vertex $u$ in graph $G$, for any vertex $v\in V(G)$, we have $u\equiv^k v$ if there exist $k$ vertices $w_1, w_2, \ldots, w_k$ such that $u\equiv^k w_i$ and $w_i\in N(v)$ for any $1\leq i \leq k$. \end{lemma} \begin{proof} We prove it by contradiction. Assume that $u \not\equiv^k v$. There exists a vertex cut ${\cal S}\xspace$ with $k-1$ or fewer vertices between $u$ and $v$. For any $w_i (1\leq i \leq k)$, we have $w_i\equiv^k v$ since $w_i\in N(v)$ (\reflem{nbrsave}) and we also have $w_i \equiv^k u$. Since $u \not\equiv^k v$, $w_i$ cannot satisfy both $w_i \equiv^k u$ and $w_i \equiv^k v$ unless $w_i \in {\cal S}\xspace$. Therefore, we obtain a cut ${\cal S}\xspace$ with at least $k$ vertices $w_1$, $w_2$, $\ldots$, $w_k$. This contradicts $|{\cal S}\xspace| < k$. \end{proof} Based on \reflem{2hop}, given a source vertex $u$, once we find a vertex $v$ with at least $k$ neighbors $w_i$ with $u\equiv^k w_i$, we can obtain $u\equiv^k v$ without testing the local connectivity of $(u,v)$. To efficiently detect such vertices $v$, we define the deposit of a vertex $v$ as follows. \begin{definition} \label{def:deposit} (Vertex Deposit) Given a source vertex $u$, the deposit for each vertex $v$, denoted by $deposit(v)$, is the number of neighbors $w$ of $v$ such that the local connectivity of $w$ and $u$ has been computed with $w\equiv^k u$. \end{definition} According to \refdef{deposit}, suppose $u$ is the source vertex and for each vertex $v$, $deposit(v)$ is a dynamic value depending on the number of processed vertex pairs. To maintain the vertex deposit, we initialize the deposit to $0$ and once we know $w \equiv^k u$ for a certain vertex $w$, we can increase the deposit $deposit(v)$ for each vertex $v\in N(w)$ by $1$. We can obtain the following theorem according to \reflem{2hop}. \begin{theorem} \label{thm:deposit} Given a source vertex $u$, for any vertex $v$, we have $u \equiv^k v$ if $deposit(v) \ge k$. \end{theorem} Based on \refthm{deposit}, we can derive our second rule for neighbor sweep as follows. \rtitle{(Neighbor Sweep Rule 2)} \textit{Given a selected source vertex $u$, we can skip the local connectivity testing of pair $(u,v)$ if $deposit(v) \ge k$.} We show an example below. \begin{example} \reffig{ssv} (b) gives an example of our vertex deposit strategy. Given the graph $G$ and parameter $k = 3$, let vertex $r$ be the selected source vertex. We assume that $v_0, v_1, v_2$ and $v_3$ are tested vertices. All these vertices are local $k$-connected with vertex $r$, i.e., $r \equiv^k v_i, i\in{0,1,2,3}$, since $v_0, v_1, v_2$ and $v_3$ are neighbors of $r$. We deposit once for the neighbors of each tested vertex. The deposit value for all influenced vertices are given in the figure. We mark the vertices with deposit no less than $3$ by dark gray. The local connectivity testing between $r$ and such a vertex can be skipped. \end{example} To increase the deposit of a vertex $v$, we only need any neighbor of $v$ is local $k$-connected with the source vertex $u$. We can also use vertex deposit strategy when processing the strong side-vertex. Given a source vertex $u$ and a strong side-vertex $v$, we sweep all $w \in N(v)$ if $u \equiv^k v$ according to the side-vertex strategy. Next we increase the deposit for each non-swept vertex $w' \in N(w)$. In other words, for a strong side-vertex, we can possibly sweep its $2$-hop neighbors by combining the two neighbor sweep strategies. An example is given below. \begin{figure}[t] \begin{center} \begin{tabular}[t]{c} \subfigure[$2$-hop deposit]{ \includegraphics[width=0.49\columnwidth]{fig/dp.pdf} } \subfigure[group sweep and deposit]{ \includegraphics[width=0.49\columnwidth]{fig/group.pdf} } \end{tabular} \topcaption{Increasing deposit with neighbor and group sweep} \label{fig:gsd} \end{center} \end{figure} \begin{example} \reffig{gsd} (a) shows the process for a strong side-vertex $s$. Given a source vertex $r$, assume $s$ is a strong side-vertex and $r \equiv^k s$. All neighbors of $s$ are swept and all $2$-hop neighbors of $s$ increase their deposits accordingly. The increased value of the deposit for each vertex depends on the number of connected vertices that are swept. \end{example} \subsection{Group Sweep} \label{sec:opt:gs} The neighbor sweep strategy can only prune unnecessary local connectivity testings in the first phase of $\kw{GLOBAL\textrm{-}CUT}$ by using the neighborhood information. In this subsection, we introduce a new pruning strategy, namely group sweep, which can prune unnecessary local connectivity testings in a batch manner. In group sweep, we do not limit the skipped vertices to the neighbors of certain vertices. More specifically, we aim to partition vertices into vertex groups and sweep a whole group when it satisfies certain conditions. In addition, our group sweep strategy can also be applied to reduce the unnecessary local connectivity testings in both phases of $\kw{GLOBAL\textrm{-}CUT}$. First, we define a new relation regarding a vertex $u$ and a set of vertices $C$ as follows. \sstitle{$u \equiv^k C$}: For all vertices $v \in C, u \equiv^k v$. Given a source vertex $u$ and a side-vertex $v$, we assume $u \equiv^k v$. According to the transitive relation in \reflem{transitive}, we can skip testing the pairs of vertices $u$ and $w$ for all $w$ with $w \equiv^k v$. In our neighbor sweep strategy, we select all neighbors of $v$ as such vertices $w$, i.e., $u \equiv^k N(v)$. To sweep more vertices each time, we define the side-group. \begin{definition} \textsc{(Side-Group)} Given a graph $G$ and an integer $k$, a vertex set ${\cal CC}$ in $G$ is a side-group if $\forall u, v \in C, u \equiv^k v$. \end{definition} Note that it is possible that a side-group contains vertices in a certain vertex cut ${\cal S}\xspace$ with $|{\cal S}\xspace|<k$. Next, we introduce how to construct the side-groups in graph $G$, and then discuss our group sweep rules. \stitle{Side-Group Construction.} \refsec{base:cert} introduces sparse certificate to bound the graph size. Let $F_i$ and $G_i$ be the notations defined in \refthm{maincert}. Assume that $G$ is not $k$-connected and there exists a vertex cut ${\cal S}\xspace$ such that $|{\cal S}\xspace|<k$. According to \cite{CheriyanKT93}, we have the following lemma. \begin{lemma} \label{lem:nopath} $F_k$ does not contain a simple tree path $P_k$ whose two end points are in different connected components of $G-{\cal S}\xspace$. \end{lemma} Based on \reflem{nopath}, we can obtain the following theorem. \begin{theorem} \label{thm:cc} Let ${\cal CC}$ denote the vertex set of any connected component in $F_k$. ${\cal CC}$ is a side-group. \end{theorem} \begin{proof} Assume that $u \not\equiv^k v$ in ${\cal CC}$. All simple paths from $u$ to $v$ will cross the vertex cut ${\cal S}\xspace$. This contradicts \reflem{nopath}. \end{proof} \begin{example} Review the construction of a sparse certificate in \reffig{sc}. Given $k=3$, two connected components with more than one vertex are obtained in $F_3$. The number of vertices in the two connected components are $6$ and $9$ respectively. Each of them is a side-group and any two vertices in the same connected component is local $3$-connected. Note that the connected component with $6$ vertices contains two vertices in the vertex cut as marked by gray. \end{example} We denote all the side-groups as ${\cal CS}=\{{\cal CC}_1, {\cal CC}_2, \ldots, {\cal CC}_t\}$. According to \refthm{cc}, ${\cal CS}$ can be easily computed as a by-product of the sparse certificate. With ${\cal CS}$, according to the transitive relation in \reflem{transitive}, we can easily obtain the following pruning rule. \rtitle{(Group Sweep Rule 1)} \textit{Let $u$ be the source vertex in the algorithm $\kw{GLOBAL\textrm{-}CUT}$, given a side-group ${\cal CC}$, if there exists a strong side-vertex $v\in {\cal CC}$ such that $u\equiv^k v$, we can skip the local connectivity testings of vertex pairs $(u,w)$ for all $w\in {\cal CC}-\{v\}$.} The above group sweep rule relies on the successful detection of a strong side-vertex in a certain side-group. In the following, we further introduce a deposit based scheme to handle the scenario that no strong side-vertex exists in a certain side-group. \stitle{Group Deposit.} Similar with the vertex deposit strategy, the group deposit strategy aims to deposit the values in a group level. To show our group deposit scheme, we first introduce the following lemma. \begin{lemma} \label{lem:ccprune} Given a source vertex $u$, an integer $k$, and a side-group ${\cal CC}$, we have $u \equiv^k {\cal CC}$ if $|\{v|v \in {\cal C}, u \equiv^k v\}| \ge k$. \end{lemma} \begin{proof} We prove it by contradiction. Assume that there exists a vertex $w$ in ${\cal CC}$ such that $u \not\equiv^k w$. A vertex cut ${\cal S}\xspace$ exists with $|{\cal S}\xspace|<k$. Let $v_0, v_1, ..., v_{k-1}$ be the $k$ vertices in ${\cal CC}$ such that $u \equiv^k v_i, 0 \le i \le k-1$. We have $w \equiv^k v_i$ based on the definition of a side-group. Each $v_i$ must belong to ${\cal S}\xspace$ since $u \not\equiv^k w$. As a result, the size of ${\cal S}\xspace$ is at least $k$. This contradicts $|{\cal S}\xspace|<k$. \end{proof} Based on \reflem{ccprune}, given a source vertex $u$, once we find a side-group ${\cal CC}$ with at least $k$ vertices $v$ with $u\equiv^k v$, we can get $u\equiv^k {\cal CC}$ without testing the local connectivity from $u$ to other vertices in ${\cal CC}$. To efficiently detect such side-groups ${\cal CC}$, we define the group deposit of a side-group ${\cal CC}$ as follows. \begin{definition} \label{def:gdeposit} (Group Deposit) The group deposit for each side-group ${\cal CC}$, denoted by $g\textrm{-}deposit({\cal CC})$, is the number of vertices $v\in {\cal CC}$ such that the local connectivity of $v$ and $u$ has been computed with $v\equiv^k u$. \end{definition} According to \refdef{gdeposit}, suppose $u$ is the source vertex, for each side-group ${\cal CC}\in {\cal CS}$, $g\textrm{-}deposit({\cal CC)}$ is a dynamic value depending on the already processed vertex pairs. To maintain the group deposit for each side-group ${\cal CC}$, we initialize the group deposit for ${\cal CC}$ to $0$. Once $v\equiv^k u$ for a certain vertex $v\in {\cal CC}$, we can increase $g\textrm{-}deposit({\cal CC})$ by 1. We obtain the following theorem according to \reflem{ccprune}. \begin{theorem} \label{thm:ccprune} Given a source vertex $u$, for any side-group ${\cal CC}\in {\cal CS}$, we have $u\equiv^k{\cal CC}$ if $g\textrm{-}deposit({\cal CC})\geq k$. \end{theorem} Based on \refthm{ccprune}, we can derive our second rule for group sweep as follows. \rtitle{(Group Sweep Rule 2)} \textit{Given a selected source vertex $u$, we can skip the local connectivity testings between $u$ and vertices in ${\cal CC}$ if $g\textrm{-}deposit({\cal CC})\geq k$.} Note that a group sweep operation can further trigger a neighbor sweep operation and vice versa, since both operations result in new local $k$-connected vertex pairs. We show an example below. \begin{example} \reffig{gsd} (b) presents an example of group sweep. Suppose $k = 3$ and the gray area is a detected side-group. Given a source vertex $r$, assume that $a, b, c$ are the tested vertices with $r \equiv^k a, r \equiv^k b$ and $r \equiv^k c$ respectively. According to \refthm{ccprune}, we can safely sweep all vertices in the same side-group. Also, we apply the vertex deposit strategy for neighbors outside the side-group. The increased value of deposit is shown on each vertex. \end{example} Next we show that the side-groups can also be used to prune the local connectivity testings in the second phase of $\kw{GLOBAL\textrm{-}CUT}$. Recall that in the second phase of $\kw{GLOBAL\textrm{-}CUT}$, given a source vertex $u$, we need to test the local connectivity of every pair $(v_a,v_b)$ of the neighbors of $u$. With side-groups, we can easily obtain the following group sweep rule. \rtitle{(Group Sweep Rule 3)} \textit{Let $u$ be the source vertex, and $v_a$ and $v_b$ be two neighbors of $u$. If $v_a$ and $v_b$ belong to the same side-group, we have $v_a\equiv^k v_b$ and thus we do not need to test the local connectivity of $(v_a, v_b)$ in the second phase of $\kw{GLOBAL\textrm{-}CUT}$.} The detailed implementation of the neighbor sweep and group sweep techniques is given in the following section. \subsection{The Overall Algorithm} \label{sec:opt:overall} In this section, we combine our pruning strategies and give the implementation of optimized algorithm $\kw{GLOBAL\textrm{-}CUT^*}$. The pseudocode is presented in \refalg{findcutstar}. We can replace $\kw{GLOBAL\textrm{-}CUT}$ with $\kw{GLOBAL\textrm{-}CUT^*}$ in $\kw{KVCC\textrm{-}ENUM}$ to obtain our final algorithm to compute all $k$-{VCCs}\xspace. The $\kw{GLOBAL\textrm{-}CUT^*}$ algorithm still follows the similar idea of $\kw{GLOBAL\textrm{-}CUT}$ that consider a source vertex $u$, and then compute the vertex cut in two phases based on whether $u$ belongs to the vertex cut ${\cal S}\xspace$. Given a source vertex $u$, phase 1 (line~8-15) considers the case that $u \notin {\cal S}\xspace$. Phase 2 (line~16-21) considers the case that $u\in {\cal S}\xspace$. If in both phase, the vertex cut ${\cal S}\xspace$ is not found, there is no such a cut and we simply return $\emptyset$ in line~22. We compute the side-groups ${\cal CS}$ while computing the sparse certificate (line~1). Note that here we only consider the side-group whose size is larger than $k$, since the group can be swept only if at least $k$ vertices in the group are swept according to \refthm{ccprune}. Then we compute all strong side-vertices, ${\cal SV}$ based on \refthm{necessaryside} (line~3). Here, the strong side-vertices are computed based on the method discussed in \refsec{opt:ns:sv}. If ${\cal SV}$ is not empty, we can select one inside vertex as source vertex $u$ and do not need to consider the phase 2, because $u$ cannot be in any cut ${\cal S}\xspace$ with $|{\cal S}\xspace|<k$ in this case. Otherwise, we still select the source vertex $u$ with the minimum degree (line~4-7). In phase 1 (line~8-15), we initialize the group deposit for each side-group, which is number of swept vertices in the side-group, to $0$ (line~8). Also, we initialize the local deposit for each vertex to $0$ and $pru$ for each vertex to $\textit{false}$ (line~9). Here, $pru$ is used to mark whether a vertex can be swept. Since the source vertex $u$ is local $k$-connected with itself, we first apply the sweeping rules on the source vertex by invoking $\kw{SWEEP}$ procedure (line~10). Intuitively, a vertex that is close to the source vertex $u$ tends to be in the same $k$-{VCC}\xspace with $u$. In other words, a vertex $v$ that is far away from $u$ tends to be separated from $u$ by a vertex cut ${\cal S}\xspace$. Therefore, we process vertices $v$ in $G$ according to the non-ascending order of $dist(u,v,G)$ (line~11). We aim to find the vertex cut by processing as few vertices as possible. For each vertex $v$ to be processed in phase 1, we skip it if $pru(v)$ is $\text{true}$ (line~12). Otherwise, we test the local connectivity of $u$ and $v$ using $\kw{LOC\textrm{-}CUT}$ (line~13). If there is a cut ${\cal S}\xspace$ with size smaller than $k$, we simply return ${\cal S}\xspace$ (line~15). Otherwise, we invoke $\kw{SWEEP}$ procedure to sweep vertices using the sweep rules introduced in \refsec{opt}. We will introduce the $\kw{SWEEP}$ procedure in detail later. In phase 2 (line~16-21), we first check whether the source vertex $u$ is a strong side-vertex. If so, we can skip phase 2 since a strong side-vertex is not contained in any vertex cut with size smaller than $k$. Otherwise, we perform pair-wise local connectivity testings for all vertices in $N(u)$. Here, we apply the \textit{group sweep rule 3} and skip testing those pairs of vertices that are in the same side-group (line~19). \stitle{Procedure $\kw{SWEEP}$.} The procedure $\kw{SWEEP}$ is shown in \refalg{sweep}. To sweep a vertex $v$, we set $pru(v)$ to be true. This operation may result in neighbor sweep and group sweep of other vertices as follows. \begin{itemize} \item (Neighbor Sweep) In line~1-5, we consider the neighbor sweep. For all the neighbors $w$ of $v$ that have not been swept, we first increase $deposit(w)$ by $1$ based on \refdef{deposit}. Then we consider two cases. The first case is that $v$ is a strong side-vertex. According to \textit{neighbor sweep rule 1} in \refsec{opt:ns:sv}, $w$ can be swept since $w$ is a neighbor of $v$. The second case is $deposit(w)>k$. According to \textit{neighbor sweep rule 2} in \refsec{opt:ns:vd}, $w$ can be swept. In both cases, we invoke $\kw{SWEEP}$ to sweep $w$ recursively. (line~4-5) \item (Group Sweep) In line~6-11, we consider the group sweep if $v$ is contained in a side-group ${\cal CC}_i$. We first increase $g\textrm{-}deposit({\cal CC}_i)$ by $1$ based on \refdef{gdeposit}. Then we consider two cases. The first case is that $v$ is a strong side-vertex. According to \textit{group sweep rule 1} in \refsec{opt:gs}, we can sweep all vertices in ${\cal CC}_i$. The second case is that $g\textrm{-}deposit\geq k$. According to \textit{group sweep rule 2} in \refsec{opt:gs}, we can sweep all vertices in ${\cal CC}_i$. In both cases we recursively invoke $\kw{SWEEP}$ to sweep each unswept vertex in ${\cal CC}_i$ (line~8-11). \end{itemize} \begin{algorithm}[h] \caption{$\kw{GLOBAL\textrm{-}CUT^*}(G,k)$} \label{alg:findcutstar} \small \begin{algorithmic}[1] \REQUIRE a graph $G$ and an integer $k$; \ENSURE a vertex cut with size smaller than $k$; \vspace{2ex} \STATE compute a sparse certification ${\cal SC}$ of $G$ and collect all side-groups as ${\cal CS} = \{{\cal CC}_1,...,{\cal CC}_t\}$; \STATE construct the directed flow graph $\overline{\cal SC}$ of ${\cal SC}$; \STATE ${\cal SV} \leftarrow $ compute all strong side vertices in ${\cal SC}$; \IF{${\cal SV} = \emptyset$} \STATE select a vertex $u$ with minimum degree; \ELSE \STATE randomly select a vertex $u$ from ${\cal SV}$; \ENDIF \vspace{2ex} \STATE \textbf{for all} ${\cal CC}_i$ in ${\cal CS}$: $g\textrm{-}deposit({\cal CC}_i) \leftarrow 0$; \STATE \textbf{for all} $v$ in $V$: $deposit(v) \leftarrow 0, pru(v) \leftarrow \text{false}$; \STATE $\kw{SWEEP}(u, pru, deposit, g\textrm{-}deposit, {\cal CS})$; \FORALL{$v\in V$ in non-ascending order of $dist(u,v,G)$} \STATE \textbf{if} $pru(v) = \text{true}$ \textbf{then continue}; \STATE ${\cal S}\xspace \leftarrow \kw{LOC\textrm{-}CUT}(u,v,\overline{\cal SC},{\cal SC})$; \STATE \textbf{if} ${\cal S}\xspace \neq \emptyset$ \textbf{then} \textbf{return} ${\cal S}\xspace$; \STATE $\kw{SWEEP}(v, pru, deposit, g\textrm{-}deposit, {\cal CS})$; \ENDFOR \vspace{2ex} \IF{$u$ is not a strong side-vertex} \FORALL{$v_a \in N(u)$} \FORALL{$v_b \in N(u)$} \STATE \textbf{if} $v_a$ and $v_b$ are in the same ${\cal CC}_i$ \textbf{then continue}; \STATE ${\cal S}\xspace \leftarrow \kw{LOC\textrm{-}CUT}(u,v,\overline{\cal SC},{\cal SC})$; \STATE \textbf{if} ${\cal S}\xspace \neq \emptyset$ \textbf{then} \textbf{return} ${\cal S}\xspace$; \ENDFOR \ENDFOR \ENDIF \vspace{2ex} \STATE \textbf{return} $\emptyset$; \end{algorithmic} \end{algorithm} \begin{algorithm}[h] \caption{$\kw{SWEEP}(v, pru, deposit, g\textrm{-}deposit, {\cal CS})$} \label{alg:sweep} \small \begin{algorithmic}[1] \STATE $pru(v) \leftarrow \text{true}$; \FORALL{$w \in N(v)$ s.t. $pru(w)=\text{false}$} \STATE $deposit(w)$++; \IF{ $v$ is a strong side-vertex \textbf{or} $deposit(w)\geq k$ } \STATE $\kw{SWEEP}(w, pru, deposit, g\textrm{-}deposit, {\cal CS})$; \ENDIF \ENDFOR \IF{$v$ is contained in a ${\cal CC}_i$ and ${\cal CC}_i$ has not been processed} \STATE $g\textrm{-}deposit({\cal CC}_i)$++; \IF{$v$ is a strong side-vertex \textbf{or} $g\textrm{-}deposit({\cal CC}_i)\geq k$} \STATE mark ${\cal CC}_i$ as processed; \FORALL{$w \in {\cal CC}_i$ s.t. $pru(w)=\text{false}$} \STATE $\kw{SWEEP}(w, pru, deposit, g\textrm{-}deposit, {\cal CS})$ \ENDFOR \ENDIF \ENDIF \end{algorithmic} \end{algorithm} \subsection{Effectiveness Evaluation} \label{subsec:exp:qe} We adopt the following three quality measures for effectiveness evaluation: \begin{itemize} \item\textit{Diameter $diam$.} The diameter definition is shown in \refeq{diameter}. \item\textit{Edge Density $\rho_e$.} Edge density is the ratio of the number of edges in a graph to the number of edges in a complete graph with the same set of vertices. Formal equation is given as follows: \begin{equation} \label{eq:edge_density} \small \rho_e(g)=\frac{2 |E(g)|}{|V(g)| \cdot (|V(g)|-1)} \end{equation} \item\textit{Clustering Coefficient ${\cal C}$.} The local clustering coefficient $c(u)$ for a vertex $u$ is the ratio of the number of triangles containing $u$ to the number of triples centered at $u$, which is defined as: \begin{equation} \label{eq:local_cc} \small c(u)=\frac{|\{(v,w) \in E| v \in N(u), w \in N(u)\}|}{|N(u)| \cdot (|N(u)|-1) / 2} \end{equation} The clustering coefficient of a graph is the average local clustering coefficient of all vertices: \begin{equation} \label{eq:cc} \small {\cal C}(G) = \frac{1}{|V|}\sum_{u \in V}c(u) \end{equation} \end{itemize} In our effectiveness testings, given a graph $G$ and a parameter $k$, we calculate the diameter, edge density and clustering coefficient respectively for every $k$-{VCC}\xspace of $G$. We show the average value of all $k$-{VCCs}\xspace for each parameter $k$. We compute the same statistics for all $k$-{ECCs}\xspace and $k$-{cores}\xspace of $G$ as comparisons. \begin{figure}[t!] \begin{center} \begin{tabular}[h]{c} \hspace{-1em} \subfigure[\kwnospace{Youtube}\xspace]{ \includegraphics[width=0.5\columnwidth]{exp/diameter-youtube} } \hspace{-1em} \subfigure[\kwnospace{DBLP}\xspace]{ \includegraphics[width=0.5\columnwidth]{exp/diameter-dblp} } \\ \hspace{-1em} \subfigure[\kwnospace{Google}\xspace]{ \includegraphics[width=0.5\columnwidth]{exp/diameter-google} } \hspace{-1em} \subfigure[\kwnospace{Cnr}\xspace]{ \includegraphics[width=0.5\columnwidth]{exp/diameter-cnr} } \end{tabular} \end{center} \topcaption{Average Diameter} \label{fig:exp:ad} \end{figure} \reffig{exp:ad} presents the average diameter of all $k$-{cores}\xspace, $k$-{ECCs}\xspace and $k$-{VCCs}\xspace under the different parameter $k$ in real datasets. Similarly, \reffig{exp:aed} and \reffig{exp:cco} give the statistics of edge density and clustering coefficient respectively. We choose four datasets \kwnospace{Youtube}\xspace, \kwnospace{DBLP}\xspace, \kwnospace{Google}\xspace, and \kwnospace{Cnr}\xspace as representatives in this experiment. In the experimental results, we can see that for the same parameter $k$ value, $k$-{VCCs}\xspace have the smallest average diameter, the largest average edge density and the largest clustering coefficient in all three tested metrics. The result shows that our $k$-{VCCs}\xspace are more cohesive than the $k$-{ECCs}\xspace and $k$-{cores}\xspace. \begin{figure}[t!] \begin{center} \begin{tabular}[h]{c} \hspace{-1em} \subfigure[\kwnospace{Youtube}\xspace]{ \includegraphics[width=0.5\columnwidth]{exp/density-youtube} } \hspace{-1em} \subfigure[\kwnospace{DBLP}\xspace]{ \includegraphics[width=0.5\columnwidth]{exp/density-dblp} } \\ \hspace{-1em} \subfigure[\kwnospace{Google}\xspace]{ \includegraphics[width=0.5\columnwidth]{exp/density-google} } \hspace{-1em} \subfigure[\kwnospace{Cnr}\xspace]{ \includegraphics[width=0.5\columnwidth]{exp/density-cnr} } \end{tabular} \end{center} \topcaption{Average Edge Density} \label{fig:exp:aed} \end{figure} It is worth to mention that in \reffig{exp:ad}, when $k$ increases, the diameter of the obtained $k$-{cores}\xspace, $k$-{VCCs}\xspace, and $k$-{ECCs}\xspace can either increase or decrease. As an example, the average diameter of $k$-{VCCs}\xspace decreases slightly while increasing $k$ from $7$ to $8$ in the \kwnospace{Youtube}\xspace dataset. This is because when $k$ increases, the $k$-{VCCs}\xspace obtained are more cohesive, thus the diameter for the $k$-{VCCs}\xspace containing a certain vertex becomes smaller. Such reason also leads to the increase for edge density and clustering coefficient for some $k$ values in these datasets. As another example, the average diameter of $k$-{VCCs}\xspace increases slightly while increasing $k$ from $20$ to $21$ in the \kwnospace{Google}\xspace dataset. The reason for this phenomenon is that there exist some small $20$-{VCCs}\xspace in which no vertex belongs to any $21$-{VCC}\xspace. Here the small $k$-{VCC}\xspace means there exist small number of vertices inside. These small $20$-{VCCs}\xspace have small diameter, which makes the average diameter small. Such reason also leads to the decrease for edge density and clustering coefficient for some $k$ values in these datasets. \begin{figure}[t!] \begin{center} \begin{tabular}[h]{c} \hspace{-1em} \subfigure[\kwnospace{Youtube}\xspace]{ \includegraphics[width=0.5\columnwidth]{exp/coefficient-youtube} } \hspace{-1em} \subfigure[\kwnospace{DBLP}\xspace]{ \includegraphics[width=0.5\columnwidth]{exp/coefficient-dblp} } \\ \hspace{-1em} \subfigure[\kwnospace{Google}\xspace]{ \includegraphics[width=0.5\columnwidth]{exp/coefficient-google} } \hspace{-1em} \subfigure[\kwnospace{Cnr}\xspace]{ \includegraphics[width=0.5\columnwidth]{exp/coefficient-cnr} } \end{tabular} \end{center} \topcaption{Average Clustering Coefficient} \label{fig:exp:cco} \end{figure} A case study is shown in \refsubsec{exp:cs} to further demonstrate the effectiveness of $k$-{VCCs}\xspace. \subsection{Efficiency Evaluation} \label{subsec:exp:qp} \begin{figure}[t!] \begin{center} \begin{tabular}[t]{c} \hspace{-1em} \subfigure[\kwnospace{Stanford}\xspace]{ \includegraphics[width=0.5\columnwidth]{exp/time_stanford} } \hspace{-1em} \subfigure[\kwnospace{DBLP}\xspace]{ \includegraphics[width=0.5\columnwidth]{exp/time_dblp} } \\ \hspace{-1em} \subfigure[\kwnospace{ND}\xspace]{ \includegraphics[width=0.5\columnwidth]{exp/time_nd} } \hspace{-1em} \subfigure[\kwnospace{Google}\xspace]{ \includegraphics[width=0.5\columnwidth]{exp/time_google} } \\ \hspace{-1em} \subfigure[\kwnospace{Cit}\xspace]{ \includegraphics[width=0.5\columnwidth]{exp/time_cit} } \hspace{-1em} \subfigure[\kwnospace{Cnr}\xspace]{ \includegraphics[width=0.5\columnwidth]{exp/time_cnr} } \end{tabular} \end{center} \topcaption{Processing time} \label{fig:exp:performance} \end{figure} To test the efficiency of our proposed techniques, we compare the following four algorithms to compute the $k$-{VCCs}\xspace. For each dataset, we show statistics of algorithms under different parameters $k$ varying from $20$ to $40$. \begin{itemize} \item \kw{VCCE}: Our basic algorithm introduced in \refsec{base}. \item \kw{VCCE\textrm{-}N}: The basic algorithm with the neighbor sweep strategy introduced in \refsec{opt:ns}. \item \kw{VCCE\textrm{-}G}: The basic algorithm with the group sweep strategy introduced in \refsec{opt:gs}. \item \kw{VCCE^*}: The algorithm with both neighbor sweep and group sweep strategies. \end{itemize} \stitle{Testing the Time Cost.} As we can see from \reffig{exp:performance}, the time cost of each algorithm generally presents a decreasing trend while parameter $k$ increases. That is because a higher value of parameter $k$ leads to a smaller number of $k$-{VCCs}\xspace. Intuitively, the algorithm will test less local connectivity during the processing when $k$ increases. A special case here is that algorithm \kw{VCCE^*} spends a little more time under $k=25$ than under $k=20$ in the \kwnospace{Stanford}\xspace dataset. This phenomenon happens due to the structure of the \kwnospace{Stanford}\xspace graph in which $k=25$ leads to more partitions than $k=20$. We also find that both algorithms \kw{VCCE\textrm{-}N} and \kw{VCCE\textrm{-}G} are more efficient than the basic algorithm in all testing cases. Considering the specific structures of different datasets, we find that the group sweep strategy is more effective on graph \kwnospace{Cnr}\xspace, and the neighbor sweep strategy is more effective on other datasets. Our \kw{VCCE^*} algorithm outperforms all other algorithms in all test cases. \begin{table}[t] \topcaption{\sc Proportion for Different Rules} \label{tab:ruleprop} \begin{center} {\small \begin{tabular}{l|c|c|c|c|c|c} \hline {\bf Rules} & \kwnospace{Stanford}\xspace & \kwnospace{DBLP}\xspace & \kwnospace{ND}\xspace & \kwnospace{Google}\xspace & \kwnospace{Cit}\xspace & \kwnospace{Cnr}\xspace \\\hline\hline \textit{NS\_1} & 14\% & 67\% & 1\% & 29\% & 12\% & 11\% \\ \textit{NS\_2} & 40\% & 21\% & 42\% & 36\% & 68\% & 32\% \\ \textit{GS} & 13\% & 4\% & 1\% & 9\% & 12\% & 48\% \\ \textit{Non-Pru} & 33\% & 8\% & 56\% & 26\% & 8\% & 9\% \\\hline \end{tabular} } \end{center} \end{table} \stitle{Testing the Effectiveness of Sweep Rules.} To further investigate the effectiveness of our sweep rules, we also track each processed vertex during the performance of \kw{VCCE^*} and record the number of vertices pruned by each strategy. Specifically, when performing sweep procedure, we separately mark the vertices pruned by \textit{neighbor sweep rule 1} (strong-side vertex), \textit{neighbor sweep rule 2} (neighbor deposit) and group sweep. Here, we divide neighbor sweep into two detailed sub-rules since the both of them perform well and the effectiveness of these two strategies is not very consistent in different datasets. For each vertex $v$ in line~11 of \kw{GLOBAL\textrm{-}CUT^*}, we increase the count for corresponding strategy if $v$ is pruned (line 13). We also record the number of vertices which are non-pruned and really tested (line 12). For each dataset, we record these data under different $k$ from $20$ to $40$ and obtain the average value. The result is shown in \reftab{ruleprop}. \textit{NS\_1} and \textit{NS\_2} represent \textit{neighbor sweep rule 1} and \textit{neighbor sweep rule 2} respectively. \textit{GS} is group sweep and \textit{Non-Pru} means the proportion of non-pruned vertices. Note that there is a large number of vertices which are pruned in advance by the $k$-core technique. The result shows our pruning strategies are effective. Over $90\%$ vertices are pruned in \kwnospace{DBLP}\xspace, \kwnospace{Cit}\xspace and \kwnospace{Cnr}\xspace. The proportion of totally pruned vertices is smallest in \kwnospace{ND}\xspace, which is about $45\%$. Among these pruning strategies, the effectiveness of \textit{neighbor sweep rule 1} and group sweep depends on the specific structure of datasets. \textit{neighbor sweep rule 1} performs much better than group sweep in \kwnospace{DBLP}\xspace. The pruned vertices due to such strategy accounts for $67\%$ of total (including really tested vertices). Group sweep is more effective than \textit{neighbor sweep rule 1} in \kwnospace{Cnr}\xspace. The percentage for group sweep is about $48\%$ while it is only $11\%$ for \textit{neighbor sweep rule 1}. These two strategies are of about the same effectiveness in other datasets. As comparison, the \textit{neighbor sweep rule 2} closely relies on the existing processed vertices. It becomes more and more effective with vertices tested or pruned constantly. Our result shows it is very powerful and stable. The percentage for such strategy reaches to $68\%$ in \kwnospace{Cit}\xspace and is over $20\%$ in all other datasets. \begin{figure}[t!] \begin{center} \begin{tabular}[t]{c} \hspace{-1em} \subfigure[\kwnospace{Stanford}\xspace]{ \includegraphics[width=0.5\columnwidth, height=2cm]{exp/cnt_stanford} } \hspace{-1em} \subfigure[\kwnospace{DBLP}\xspace]{ \includegraphics[width=0.5\columnwidth, height=2cm]{exp/cnt_dblp} } \\ \hspace{-1em} \subfigure[\kwnospace{ND}\xspace]{ \includegraphics[width=0.5\columnwidth, height=2cm]{exp/cnt_nd} } \hspace{-1em} \subfigure[\kwnospace{Google}\xspace]{ \includegraphics[width=0.5\columnwidth, height=2cm]{exp/cnt_google} } \\ \hspace{-1em} \subfigure[\kwnospace{Cit}\xspace]{ \includegraphics[width=0.5\columnwidth, height=2cm]{exp/cnt_cit} } \hspace{-1em} \subfigure[\kwnospace{Cnr}\xspace]{ \includegraphics[width=0.5\columnwidth, height=2cm]{exp/cnt_cnr} } \end{tabular} \end{center} \topcaption{Number of $k$-{VCCs}\xspace} \label{fig:exp:cnts} \end{figure} \stitle{Testing the Number of $k$-{VCCs}\xspace.} The numbers of $k$-{VCCs}\xspace under different $k$ values for each dataset are given in \reffig{exp:cnts}. The numbers of $k$-{VCCs}\xspace on all tested datasets have a decreasing trend when varying $k$ from $20$ to $40$ in \reffig{exp:cnts}. The reason is that when increasing $k$, some $k$-{VCCs}\xspace cannot satisfy the requirement and thus will not appear in the result list. The trend of the number of $k$-{VCCs}\xspace explains why the processing time of our algorithms decreases when $k$ increases in \reffig{exp:performance}. Note that the number of $k$-{VCCs}\xspace may vary a lot in different datasets for the same $k$ value. In the same dataset, when $k$ increases, the number of $k$-{VCCs}\xspace may drop sharply. For example, for when $k$ increases from $20$ to $25$, the number of $k$-{VCCs}\xspace in \kwnospace{Google}\xspace decreases by $10$ times. The number of $k$-{VCCs}\xspace depends on the graph structure of each specific graph. \begin{figure}[t!] \begin{center} \begin{tabular}[t]{c} \hspace{-1em} \subfigure[\kwnospace{Stanford}\xspace]{ \includegraphics[width=0.5\columnwidth, height=2cm]{exp/mem_stanford} } \hspace{-1em} \subfigure[\kwnospace{DBLP}\xspace]{ \includegraphics[width=0.5\columnwidth, height=2cm]{exp/mem_dblp} } \\ \hspace{-1em} \subfigure[\kwnospace{ND}\xspace]{ \includegraphics[width=0.5\columnwidth, height=2cm]{exp/mem_nd} } \hspace{-1em} \subfigure[\kwnospace{Google}\xspace]{ \includegraphics[width=0.5\columnwidth, height=2cm]{exp/mem_google} } \\ \hspace{-1em} \subfigure[\kwnospace{Cit}\xspace]{ \includegraphics[width=0.5\columnwidth, height=2cm]{exp/mem_cit} } \hspace{-1em} \subfigure[\kwnospace{Cnr}\xspace]{ \includegraphics[width=0.5\columnwidth, height=2cm]{exp/mem_cnr} } \end{tabular} \end{center} \topcaption{Memory Usage of Algorithm \kw{VCCE^*}} \label{fig:exp:ms} \end{figure} \stitle{Testing the Memory Usage.} \reffig{exp:ms} presents the memory usage of algorithm \kw{VCCE^*} on different datasets while verying parameter $k$. Note that the memory usage of all the four algorithms \kw{VCCE}, \kw{VCCE\textrm{-}N}, \kw{VCCE\textrm{-}G}, and \kw{VCCE^*} are very close since they follow the same framework to cut the graph recursively, and the memory usage mainly depends on the size of graph and the number of partitioned graphs which are the same for all the four algorithms. Therefore, we only show the memory usage of \kw{VCCE^*}. As we can see from the figure, the memory usage on most of the datasets has a decreasing trend when $k$ increases. The reasons are twofold. First, recall that all vertices with degree less than $k$ are firstly removed for each subgraph during the algorithm. A higher $k$ must lead to more removed vertices, and therefore, makes the graph smaller. Second, when $k$ increases, the number of $k$-{VCCs}\xspace decreases and the number of partitioned graphs also decreases, which lead to a smaller memory usage. For some cases, the memory usage increases when $k$ increases, this is because when $k$ increases, the sparse certificate of the graph becomes denser, which requires more memory. Generally, the memory usage keeps in a reasonable range in all testing cases. \subsection{Scalability Evaluation} \label{subsec:exp:scal} \begin{figure}[t!] \begin{center} \begin{tabular}[h]{c} \hspace{-1em} \subfigure[Vary Size (\kwnospace{Google}\xspace)]{ \includegraphics[width=0.5\columnwidth]{exp/scal-google-vertex} } \hspace{-1em} \subfigure[Vary Density (\kwnospace{Google}\xspace)]{ \includegraphics[width=0.5\columnwidth]{exp/scal-google-edge} } \\ \hspace{-1em} \subfigure[Vary Size (\kwnospace{Cit}\xspace)]{ \includegraphics[width=0.5\columnwidth]{exp/scal-cit-vertex} } \hspace{-1em} \subfigure[Vary Density (\kwnospace{Cit}\xspace)]{ \includegraphics[width=0.5\columnwidth]{exp/scal-cit-edge} } \end{tabular} \end{center} \topcaption{Scalability evaluation} \label{fig:exp:scal} \end{figure} In this section, we test the scalability of our proposed algorithms. We choose two real graph datasets \kwnospace{Google}\xspace and \kwnospace{Cit}\xspace as representatives. For each dataset, we vary the graph size and graph density by randomly sampling vertices and edges respectively from $20\%$ to $100\%$. When sampling vertices, we get the induced subgraph of the sampled vertices, and when sampling edges, we get the incident vertices of the edges as the vertex set. Here, we only report the processing time. The memory usage is linear to the number of vertices. We compare four algorithms in the experiments. The experimental results are shown in \reffig{exp:scal}. \reffig{exp:scal} (a) and (c) report the processing time of our proposed algorithms when varying $|V|$ in \kwnospace{Google}\xspace and \kwnospace{Cit}\xspace respectively. When $|V|$ increases, the processing time for all algorithms increases. \kw{VCCE^*} performs best in all cases and \kw{VCCE} is the worst one. The curves in \reffig{exp:scal} (b) and (d) report the processing time of our algorithms in \kwnospace{Google}\xspace and \kwnospace{Cit}\xspace respectively when varying $|E|$. Similarly, \kw{VCCE^*} is the fastest algorithm in all tested cases. In addition, the gap between \kw{VCCE^*} and \kw{VCCE} increases when $|E|$ increases. For example, in \kwnospace{Cit}\xspace, the processing time of \kw{VCCE^*} is $20$ times faster than that of \kw{VCCE} when $|E|$ reaches $100\%$. The result shows that our pruning strategy is effective and our optimized algorithm is more efficient and scalable than the basic algorithm. \subsection{Case Study} \label{subsec:exp:cs} \begin{figure}[t!] \begin{center} \vspace*{-0.25cm} \begin{tabular}[t]{c} \hspace{-2em} \subfigure[\small{4-{VCCs}\xspace}]{ \includegraphics[width=0.99\columnwidth]{exp/vccCase} } \\ \vspace*{-0.3cm} \hspace{-1em} \subfigure[\small{4-{ECCs}\xspace and 4-core}]{ \includegraphics[width=0.92\columnwidth]{exp/eccCase} } \end{tabular} \end{center} \vspace*{-0.1cm} \topcaption{Case Study on DBLP} \vspace*{-0.1cm} \label{fig:exp:caseStudy} \end{figure} In this experiment, we conduct a case study to visually reveal the quality of $k$-{VCCs}\xspace. We construct a collaboration graph from the \kwnospace{DBLP}\xspace (http://dblp.uni-trier.de/). Each vertex of the graph represents an author and an edge exists between two authors if they have $3$ or more common publications. Since the $k$-{VCCs}\xspace in the original graph are too large to show, we pick up the author `Jiawei Han' and his neighbors. We use the induced subgraph of these vertices to conduct this case study. We query all $4$-{VCCs}\xspace containing `Jiawei Han' and the result is shown in \reffig{exp:caseStudy} (a). We obtain seven $4$-{VCCs}\xspace. Each of them is dense. A vertex is marked black if it appears in more than one $4$-{VCCs}\xspace. The result clearly reveals different research groups related to `Jiawei Han'. Some core authors appear in multiple groups, such as `Philip S. Yu' and 'Jian Pei'. As a comparison, we get only one $4$-{ECC}\xspace, which contains the authors in all $4$-{VCCs}\xspace. The result of $4$-core is the same as $4$-{ECC}\xspace in this experiment. Note that author `Haixun Wang' appears in $4$-{ECCs}\xspace and $4$-cores but not in any $4$-{VCC}\xspace. That means he has cooperations with some authors in the research groups of `Jiawei Han', but those authors are from different identified groups and he does not belong to any of these groups.
{'timestamp': '2017-03-28T02:03:36', 'yymm': '1703', 'arxiv_id': '1703.08668', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08668'}
arxiv
\section{Introduction} Error correcting codes have many applications in communication systems, data storage devices and consumer electronics. The construction of linear codes with few weights has been widely studied (see, e.g., \cite{DingDingIEEE-Com2014,DingDingIEEE-IT2015,Mesnager_Linear,TangLiQiZhouHelleseth2015,XuCao2015,ZhouLiFanHelleseth2015}) since these codes have many applications in consumer electronics, secret sharing schemes, authentication codes, communication, data storage system, association schemes, and strongly regular graphs. Recently, in \cite{Ding-survey2015}, Ding has published a valuable survey on the construction of binary linear codes from Boolean functions. The notion of plateaued Boolean functions, as an extension of the notion of bent Boolean functions, has been introduced in \cite{Zeng} by Zheng and Zhang (1999), and then generalized to arbitrary characteristic: the so-called $p$-ary plateaued functions from $\F_{p^n}$ to $\F_p$ (see, e.g., \cite{MesnagerOzbudakSinak-Balkan2015}). Several researchers have studied plateaued functions since they have many applications in cryptography, sequence theory and coding theory. In particular, $p$-ary bent functions (mostly, quadratic and weakly regular bent functions) have been used in coding theory to construct linear codes with few weights. Very recently, Mesnager \cite{Mesnager_Linear} has constructed a new family of three-weight linear codes from weakly regular bent functions in arbitrary characteristic based on a generic construction. Within this framework, the aim of this paper is to construct a class of linear codes with few weights from weakly regular plateaued functions in arbitrary characteristic and determine their weight distributions.\\ The paper is structured as follows. Section \ref{preliminaries} sets the main notations and recalls some basic results in coding theory and number theory. In Section \ref{SectionWeakly}, we introduce the notion of (weakly) regular plateaued functions in odd characteristic $p$. We then give concrete examples to show the existence of (weakly) regular plateaued $p$-ary functions. Section \ref{SectionCodes} constructs a new class of three-weight linear $p$-ary (resp. binary) codes from weakly regular $p$-ary plateaued (resp. plateaued Boolean) functions based on a generic construction. We also determine the weight distributions of the constructed linear codes in this paper. Finally, in Section \ref{SectionSSS}, we observe that all nonzero codewords of the constructed linear codes are minimal for almost all cases \section{Preliminaries}\label{preliminaries} In this section, we set main notations and give some basic results on $p$-ary functions, coding theory and number theory, which will be used in the sequel.\\ For any set $E$, $\# E$ denotes the cardinality of $E$ and $E^\star=E\setminus \{0\}$. Given a complex number $z\in\mathbb{C}$, $\vert z\vert$ denotes the absolute value of $z$, where $\mathbb{C}$ is the field of complex numbers. Let $\F_{p^m}$ be the finite field with $p^m$ elements, where $p$ is a prime and $m\geq 1$ is a positive integer. Then, $\F_{p^m}^{\star}=\langle \zeta \rangle$ is a multiplicative cyclic group of order $p^m-1$ with generator $\zeta$, and $\F_{p}$ is the prime field of $\F_{p^m}$. The extension field $\mathbb{F}_{p^m}$ can be seen as an $m$-dimensional vector space over $\F_{p}$, denoted by $\F_p^m$. The absolute trace function $\Tr_{p}^{p^m} : \mathbb {F}_{p^m} \rightarrow \mathbb {F}_{p}$ is defined as $\Tr_{p}^{p^m}(x):=\sum_{i=0}^{ m-1}x^{p^{i}}.$ Recall that $\Tr_{p}^{p^m}$ is $\mathbb {F}_{p}$-linear. Given a function $f : \mathbb {F}_{p^m} \longrightarrow \mathbb {F}_{p}$, the direct and inverse Walsh transform of $f$ are defined, respectively, by: \be\nn \Wa {f}(b)=\sum_{x\in \mathbb {F}_{p^m}} {\xi_p}^{{f(x)}-\Tr_{p}^{p^m} (b x)} \mbox{ and } \ee \begin{equation}\label{inversetransform} \xi_p^{f(x)}=\frac{1}{p^m} \sum_{b\in\mathbb {F}_{p^m}} \Wa {f}(b) \xi_p^{\Tr_{p}^{p^m}(bx)}, \end{equation} where $\xi_p=e^{\frac{2\pi \sqrt {-1}}p}$ is a primitive $p$-th root of unity. The set $\{b\in \F_{p^m}: \widehat{\chi_f}(b)\neq 0 \}$ is called the Walsh support of $f$, and is denoted by $Supp\left({\widehat{\chi_f}}\right)$. \noindent For a nonnegative integer $i$, the moment of Walsh transform of $f$ is defined by $ S_i(f)= \sum_{b \in \F_{p^m}} | \widehat{\chi_f}(b)|^{2 i} $ with the convention $S_0(f) = p^{m}$, and $S_1(f)=p^{2m}$ is known as the \textit{Parseval identity}. Recall that $f$ is said to be \textit{balanced} over $\F_p$ if $\#\{ x\in \F_p^n : f(x)=k\}=p^{m-1}$ for each $k\in\F_p$, i.e., $f$ takes every value of $\F_p$ the same number $p^{m-1}$ times; otherwise, it is called \textit{unbalanced}.\\ \noindent \textbf{Basic background in number theory.} We now recall the basic facts of the Legendre symbol and cyclotomic field. Let $a$ be a positive integer and $p$ be an odd prime. We say that $a$ is a quadratic residue modulo $p$ if $ \sqrt{a} \in \F_p^{\star}$, and $a$ is a quadratic non-residue modulo $ p$ if $ \sqrt{a} \notin \F_p^{\star}$. The \textit{Legendre symbol} is defined as \begin{displaymath} \left( \frac{a}{p} \right) := \left\{ \begin{array}{ll} \,\,\,\, 0 & \textrm{ if }\, p\mid a,\\ \,\,\, \, 1 & \textrm{ if $a$ is a quadratic residue modulo } p,\\ -1 & \textrm { if $a$ is a quadratic non-residue modulo } p. \end{array} \right. \end{displaymath} The Legendre symbol satisfies $ \left( \frac{a}{p} \right)\equiv a^{\frac{p-1}{2}} \pmod p, $ and \be\label{Legendre} \left( \frac{-1}{p} \right) \equiv (-1)^{\frac{p-1}{2}}\pmod p= \left\{ \begin{array}{ll} \,\,\,\, 1 & \textrm{ if}\, \, p \equiv 1 \pmod 4,\\ -1 & \textrm{ if}\, \, p \equiv 3 \pmod 4. \end{array} \right. \ee Throughout this paper, $p^*$ denotes $\left(\frac{-1}{p}\right)p$, $\left(\frac{a}{p}\right)$ denotes the Legendre symbol for $ a \in \F_p^{\star}$, $\mathbb{Z}$ is the rational integer ring and $\mathbb{Q}$ is the rational field. The ring of integers in $\mathbb{Q}(\xi_p)$ is $\mathcal {O}_K:=\mathbb{Z}(\xi_p)$. An integral basis of $\mathcal {O}_{\mathbb{Q}(\xi_p)}$ is the set $\{\xi_p^i \mid 1\leq i\leq p-1\}$. The Galois field extension $\mathbb{Q}(\xi_p)/\mathbb{Q}$ of degree $p-1$ is the Galois group $Gal (\mathbb{Q}(\xi_p)/\mathbb{Q})=\{\sigma_a \mid a \in (\mathbb{Z}/p\mathbb{Z})^{\star}\}$, where the automorphism $\sigma_a$ of $\mathbb{Q}(\xi_p)$ is defined by $\sigma_a(\xi_p)=\xi_p^a$. The field $\mathbb{Q}(\xi_p)$ has a unique quadratic subfield $\mathbb{Q}(\sqrt{p^*})$. For $a\in \F_p^{\star}$, we have $\sigma_a(\sqrt {p^*})=\left(\frac{a}{p}\right)\sqrt{p^*}$. Hence, the Galois group $Gal(\mathbb{Q}(\sqrt{p^*})/\mathbb{Q}=\{1, \sigma_{\gamma}\}$ for any $\gamma \in \F_p$ such that $\sqrt{\gamma} \notin \F_p^{\star}$. The reader is referred to \cite{IrelandRosen1990} for further reading on cyclotomic fields.\\ \noindent \textbf{Basic background in coding theory.} \noindent Let $q$ be a prime power and $n$ be a positive integer. The support of a vector $\tilde a=(a_0,\ldots, a_{n-1})\in \mathbb {F}_{q}^n$ is defined as $supp(\tilde a):=\{0 \leq i\leq n-1: a_i\not=0 \}.$ The Hamming weight of $\tilde a\in \mathbb {F}_{q}^n$, denoted by $wt(\tilde a)$, is the cardinality of its support, i.e., $wt(\tilde a):=\#supp(\tilde a)$. A linear $[n,k]_{q}$ code $\mathcal {C}$ over $\mathbb {F}_{q}$ is a $k$-dimensional subspace of $\mathbb {F}_{q}^n$. A linear $[n,k,d]_{q}$ code $\mathcal {C}$ over $\mathbb {F}_{q}$ is a $k$-dimensional subspace of $\mathbb {F}_{q}^n$ with minimum Hamming distance $d$. The dual code of $\mathcal {C}$ is the linear code with parameters $[n,n-k,d^\perp]_{q}$ defined by \be\nn \mathcal {C}^\perp=\{\tilde b \in\mathbb {F}_{q}^n : \tilde b\cdot \tilde a=\tilde 0 \mbox{ for all } \tilde a\in\sC\}, \ee where $``\cdot"$ is an inner product in $\mathbb {F}_{q}^n$. Let $A_w$ denote the number of codewords with Hamming weight $w$ in $\sC$ of length $n$. Then, $(1,A_1, \ldots, A_n)$ is the weight distribution of $\sC$ and the polynomial $1+A_1y + \cdots + A_ny^n$ is called the weight enumerator of $\sC$. The code $\sC$ is called a $t$-weight code if the number of nonzero $A_w$ in the weight distribution is $t$. For further reading on coding theory, we send the reader to \cite{Huffman}.\\ \section{On (weakly) regular plateaued $p$-ary functions}\label{SectionWeakly} In this section, we introduce the notion of (weakly) regular plateaued functions in odd characteristic $p$ and give some properties of these functions. We first recall the notion of plateaued functions. \\ Let $f :\mathbb {F}_{p^m} \longrightarrow \mathbb {F}_{p}$ be a function. A $p$-ary function $f$ is called \emph{bent} if all of its Walsh transform coefficients satisfy $|\widehat{\chi}_f(b)|^2=p^{m}$, and $r$-\emph{plateaued} if all of its Walsh transform coefficients satisfy $ \vert \Wa {f} (b) \vert^2\in\{0,p^{m+r}\}$, where $r$ is an integer with $0 \leq r\leq m$. We point out that a $0$-plateaued function is bent. In characteristic $2$, it is safe to say that $f$ is \emph{ $r$-plateaued Boolean function} if $\Wa {f}(b) \in\{0,\pm 2^{(m+r)/2}\}$ for all $b\in\F_{2^m}$. By the Parseval identity, we have (see, e.g., \cite{MesnagerOzbudakSinak-Balkan2015}): \begin{lemma}\label{lemma1} Let $p$ be any prime and $f:\F_{p^m}\to\F_{p}$ be $r$-plateaued. Then for $b \in\F_{p^m}$, $| \widehat{\chi}_f(b)|^2$ takes $p^{m-r}$ times the value $p^{m+r}$ and $p^m-p^{m-r}$ times the value $0$. \end{lemma} \begin{lemma}\label{Distribution} Let $f:\F_{2^m}\to\F_{2}$ be a $r$-plateaued Boolean function. Then for $b \in\F_{2^m}$, the Walsh distribution of $f$ is given by \be\nn \Wa {f}(b)=\left\{\begin{array}{ll} 2^{\frac{m+r}2}, & 2^{ m-r-1}+ 2^{\frac{m-r-2}2} \mbox{ times, } \\ 0, & 2^{ m }- 2^{m-r} \mbox{ times, }\\ -2^{\frac{m+r}2}, & 2^{ m-r-1}- 2^{\frac{m-r-2}2} \mbox{ times. }\\ \end{array}\right. \ee \end{lemma} \noindent We recall the notion of (weakly) regular bent functions in odd characteristic $p$ (see, e.g., \cite{HellesethKholosha2006}). For an odd prime $p$, the Walsh transform coefficients of a $p$-ary bent function $f$ satisfy \be\nn \Wa {f}(b)=\left\{\begin{array}{ll}\pm p^{\frac{m}2} \xi_p^{f^{\star}(b)}, & \mbox{ if } m \mbox{ is even or } m \mbox{ is odd and } p \equiv 1\pmod 4,~ \\ \pm ip^{\frac{m}2} \xi_p^{f^{\star}(b)}, & \mbox{ if } m \mbox{ is odd and } p\equiv 3\pmod 4,\\ \end{array}\right. \ee where $i$ is a complex primitive $4$-th root of unity and $f^*$ is called the dual of $f$. A bent function $f$ is called \emph{regular} if for all $b\in \F_{p^m}$, $\Wa {f}(b)=p^{\frac{m}2}\xi_p^{f^*(b)},$ and \emph{weakly regular} if there exists a complex number $u$ having unit magnitude (in fact, $|u|=1$ and $u$ does not depend on $b$) such that $ \Wa {f}(b)=up^{\frac{m}2}\xi_p^{f^*(b)}$ for all $b\in \F_{p^m}$, where $f^*$ is the dual of $f$; otherwise, $f$ is called \emph{non-weakly regular}. \\ \noindent Very recently, Hyun et al. \cite{Hyun-Lee-Lee2016} have proved that the Walsh transform coefficients of a $p$-ary $r$-plateaued function $f$ satisfy \be\label{PlateauedWalsh} \Wa {f}(b)=\left\{\begin{array}{ll} \pm p^{\frac{m+r}2}\xi_p^{g(b)}, 0 & \mbox{ if } m+r \mbox{ is even or } m+r \mbox{ is odd and } p \equiv 1\pmod 4,~ \\ \pm i p^{\frac{m+r}2}\xi_p^{g(b)}, 0 & \mbox{ if } m+r \mbox{ is odd and } p\equiv 3\pmod 4,\\ \end{array}\right. \ee where $i$ is a complex primitive $4$-th root of unity and $g$ is a $p$-ary function over $\mathbb{F}_{p^m}$ with $g(b)=0$ for $b\notin Supp(\Wa {f})$. \noindent Notice that by definition of $g:\mathbb{\F}_{p^m}\to \mathbb{\F}_p$, it can be regarded as a mapping from $Supp(\Wa f)$ to $\mathbb{\F}_p$ since we have $g(b)=0$ for all $b\notin Supp(\Wa f)$.\\ \noindent The notion of weak regularity is meaningful for plateaued functions. We now introduce the notion of (weakly) regular plateaued functions, which covers a non-trivial subclass of the class of plateaued functions. \begin{definition} Let $p$ be an odd prime and $f:\F_{p^m}\to\F_{p}$ be a $p$-ary $r$-plateaued function, where $r$ is an integer with $0 \leq r\leq m$. Then, $f$ is called \emph{regular $p$-ary $r$-plateaued} if $ \Wa {f}(b)\in \{0,p^{\frac{m+r}2}\xi_p^{g(b)} \} $ for all $b\in \F_{p^m}$, where $g$ is a $p$-ary function over $\mathbb{F}_{p^m}$ with $g(b)=0$ for all $b\notin Supp(\Wa {f})$. Moreover, $f$ is called \emph{weakly regular $p$-ary $r$-plateaued} if there exists a complex number $u$ having unit magnitude (that is, $|u|=1$ and $u$ does not depend on $b$) such that \be\nn \Wa {f}(b)\in\left\{0, up^{\frac{m+r}2}\xi_p^{g(b)}\right\} \ee for all $b\in \F_{p^m}$, where $g$ is a $p$-ary function over $\mathbb{F}_{p^m}$ with $g(b)=0$ for all $b\notin Supp(\Wa {f})$; otherwise, $f$ is called \emph{non-weakly regular $p$-ary $r$-plateaued}. \end{definition} \noindent Notice that we have $\Wa {f}(b)=0$ if $b\notin Supp(\Wa {f})$. Then it is safe to say that $f$ is regular $r$-plateaued if $\Wa {f}(b)=p^{\frac{m+r}2}\xi_p^{g(b)}$ for all $b\in Supp(\Wa f)$, and $f$ is weakly regular $r$-plateaued if there exists a complex number $u$ having unit magnitude such that \be\label{PlateauedWalshh} \Wa {f}(b)=up^{\frac{m+r}2}\xi_p^{g(b)} \ee for all $b\in Supp(\Wa f)$, where $|u|=1$ (in fact, $u$ can only be equal to $\pm 1$ or $\pm i$ and it does not depend on $b$) and $g$ is a p-ary function over $Supp(\Wa f)$. By (\ref{PlateauedWalsh}), regular $r$-plateaued functions can only exist for even $m+r$ and for odd $m+r$ with $p\equiv 1\pmod 4$. We can derive from (\ref{PlateauedWalshh}) the following result. \begin{lemma}\label{WalshFact} Let $f$ be a weakly regular $r$-plateaued $p$-ary function. For all $b\in Supp(\Wa f)$, we can say $ \Wa {f}(b)=\epsilon \sqrt{p^*}^{m+r} \xi_p^{g(b)}, $ where $\epsilon=\pm 1$ is the sign of $ \Wa f$, $p^*$ denotes $\left(\frac{-1}{p}\right)p$ and $g$ is a $p$-ary function over $Supp(\Wa f)$. \end{lemma} \begin{pf} By (\ref{Legendre}) and (\ref{PlateauedWalsh}), using the fact that $u$ does not depend on $b$ in (\ref{PlateauedWalshh}), we obtain the following:\\ If $m+r$ is even or $m+r$ is odd and $p \equiv 1\pmod 4$, then $\left(\frac{-1}{p}\right)^{m+r}=1$ and $u=\pm 1$ in (\ref{PlateauedWalshh}). Hence, we have $ \epsilon \sqrt{p^*}^{m+r}=\epsilon \sqrt{1} \sqrt{p}^{m+r}=u \sqrt{p}^{m+r},$ where $ \epsilon=\pm 1$.\\ If $m+r$ is odd and $p \equiv 3\pmod 4$, then $\left(\frac{-1}{p}\right)=-1$ and $u=\epsilon i$ in (\ref{PlateauedWalshh}), where $ \epsilon=\pm 1$. Hence, $ \epsilon\sqrt{p^*}^{m+r}= \epsilon\sqrt{-1}^{m+r} \sqrt{p}^{m+r}=\epsilon{i}^{m+r} \sqrt{p}^{m+r}= \epsilon{i}\sqrt{p}^{m+r}=u\sqrt{p}^{m+r}.$ The result now follows. \end{pf} \begin{remark} Notice that the notion of (weakly) regular $0$-plateaued functions coincides with the one of (weakly) regular bent functions. Indeed, if we have $| \Wa {f}(b)|^2\in\{0,p^{m}\}$ for all $b\in \F_{p^m}$, then by the Parseval identity, $p^{2m}= p^m \# Supp(\Wa f)$, and so, $ \# Supp(\Wa f)=p^m$. Hence, a (weakly) regular $0$-plateaued function is the (weakly) regular bent. \end{remark} By MAGMA, we obtain several (weakly) regular $r$-plateaued functions, two of which are given as follows for $p=n=3$. \begin{example}\label{examplenewodd} A function $f(x)=\Tr_3^{3^3}(\zeta^5x^{11} + \zeta^{20}x^5 + \zeta^{11}x^4 + \zeta^2x^3+\zeta x^2)$ where $\F_{3^3}^{\star}=\langle \zeta \rangle$ with $\zeta^3+2\zeta+1=0$ is regular $3$-ary $1$-plateaued with $\Wa {f}(b)\in\{0,9\xi_3^{g(b)}\}$, where $g$ is an unbalanced $3$-ary function. \end{example} \begin{example}\label{examplenewodd} A function $f(x)=\Tr_3^{3^3}(\zeta x^{13} + \zeta^7x^4 + \zeta^7x^3 +\zeta x^2)$ where $\F_{3^3}^{\star}=\langle \zeta \rangle$ with $\zeta^3+2\zeta+1=0$ is weakly regular $3$-ary $1$-plateaued with $\Wa {f}(b)\in\{0,-9\xi_3^{g(b)}\}$, where $g$ is an unbalanced $3$-ary function. On the other hand, a function $\Tr_3^{3^3}(\zeta^{16}x^{13} + \zeta^2x^4 + \zeta^2x^3 + \zeta x^2)$ is non-weakly regular $3$-ary $2$-plateaued. \end{example} \noindent The following lemma will be used to determine the weight distributions of the constructed linear codes. \begin{lemma}\label{Walshinverse} Let $f$ be a weakly regular $r$-plateaued $p$-ary function, that is, for all $b\in Supp(\Wa f)$ we have $\Wa {f}(b)=up^{\frac{m+r}2}\xi_p^{g(b)}$, where $|u|=1$. Then, we have $$\Wa {g}(x)=u^{-1}p^{\frac{m-r}2}\xi_p^{f(-x)}.$$ \end{lemma} \begin{pf} By the inverse Walsh transform in (\ref{inversetransform}), we have \be\nn \begin{array}{ll} u^{-1}p^{\frac{m+r}2}\xi_p^{f(x)}&=\displaystyle u^{-1}p^{\frac{m+r}2}\frac{1}{p^m} \sum_{b\in \F_{p^m}} \Wa {f}(b) \xi_p^{\Tr_{p}^{p^m}(bx)}\\ &=\displaystyle u^{-1}p^{\frac{m+r}2}\frac{1}{p^m} \sum_{b\in Supp(\Wa f)}up^{\frac{m+r}2}\xi_p^{g(b)} \xi_p^{\Tr_{p}^{p^m}(bx)}\\ &=p^r\displaystyle \sum_{b\in Supp(\Wa f)} \xi_p^{g(b)+\Tr_{p}^{p^m}(bx)}=p^r\Wa {g}(-x). \end{array} \ee \end{pf} \section{A new class of three-weight linear codes from weakly regular plateaued functions}\label{SectionCodes} In this section, we construct a new class of linear codes with few weights from plateaued functions in arbitrary characteristic and determine their weight distributions (we shall analyse separately the binary case and the case when $p$ is odd). For any $\alpha, \beta\in \mathbb {F}_{p^m}$, one can define a function \be\nn \begin{array}{ccccl} f_{\alpha, \beta} &:& \mathbb {F}_{p^m}& \longrightarrow & \mathbb {F}_{p}\\ &&x&\longmapsto& f_{\alpha, \beta}(x):=\Tr_{p}^{p^m}(\alpha \Psi (x)-\beta x), \end{array} \ee where $\Psi$ is a polynomial from $\mathbb {F}_{p^m} $ to $\mathbb {F}_{p^m}$ such that $\Psi (0)=0$. Then one can define a linear code $\mathcal {C}_{\Psi}$ of length $p^m-1$ over $\mathbb {F}_{p}$ as: \be\nn \mathcal {C}_{\Psi}:=\{\tilde {c}_{\alpha, \beta}=(f_{\alpha, \beta}(\zeta_1),f_{\alpha, \beta}(\zeta_2),\ldots, f_{\alpha, \beta}(\zeta_{p^m-1})) \, | \; \alpha,\beta\in\mathbb {F}_{p^m}\}, \ee where $\zeta_1, \ldots, \zeta_{p^m-1}$ are the elements of $\mathbb {F}_{p^m}^{\star}$. In this context, the following main results have been obtained in \cite{Mesnager_Linear} by Mesnager. \begin{proposition} \label{distribution} Let $\psi_a$ be a function from $\mathbb {F}_{p^m}$ to $\mathbb {F}_{p}$ defined by $\psi_a(x)=\Tr_{p}^{p^m}(a\Psi(x))$, where $a\in \mathbb {F}_{p^m}$ and $\Psi:\mathbb {F}_{p^m}\to \mathbb {F}_{p^m}$ with $\Psi (0)=0$. For all $ \alpha,\beta\in\mathbb {F}_{p^m}$, we have \be\nn wt (\tilde {c}_{\alpha, \beta})=p^m-\frac {1}p \sum_{\omega \in\mathbb {F}_{p}} \Wa {\psi_{\omega\alpha}}(\omega \beta). \ee \end{proposition} \noindent We are going to consider a subclass of the class of linear codes $ \mathcal {C}_{\Psi}$. We assume $a=1$ and $\alpha\in \mathbb{F}_p$. Then, we have $f_{\alpha,\beta}(x)=\alpha \psi_1(x)-\Tr_{p}^{p^m}(\beta x)$ and define a subcode $\mathcal {C}$ of $\mathcal {C}_{\Psi}$ as follows: \begin{equation}\label{defCode} \mathcal {C}:=\{\tilde {c}_{\alpha, \beta}=(f_{\alpha, \beta}(\zeta_1), f_{\alpha, \beta}(\zeta_2),\ldots, f_{\alpha, \beta}(\zeta_{p^m-1})) \, | \; \alpha\in\mathbb{F}_{p},\beta\in\mathbb {F}_{p^m}\}, \end{equation} where $\zeta_1, \ldots, \zeta_{p^m-1}$ are the elements of $\mathbb {F}_{p^m}^{\star}$. Then, a linear code $\sC$ over $\F_p$ defined by $(\ref{defCode})$ is a $k$-dimensional subspace of $\F_p^n$, where $k=m+1$ and $n=p^m-1$, and it is denoted by $[p^m-1,m+1]_p$. By Proposition \ref{distribution}, the Hamming weights of the codewords of $\mathcal {C}$ can be given as follows. \begin{proposition} \label{HammingWeight} We keep the above arguments. For $\tilde {c}_{\alpha, \beta}\in \mathcal {C}$, if $\alpha=0$, we have $wt (\tilde {c}_{0, 0})=0$ and $wt (\tilde {c}_{0, \beta})=p^m-p^{m-1}$ for $\beta\not=0$, if $\alpha\in\mathbb{F}_p^{\star}$, for all $\beta\in\F_{p^m}$ we have \be\nn wt (\tilde {c}_{\alpha, \beta})=p^m-p^{m-1}-\frac {1}p \sum_{\omega \in\mathbb {F}_{p}^\star} \sigma_\omega\left(\sigma_\alpha(\Wa {\psi_{1}}(\alpha^{-1}\beta))\right), \ee where $\alpha^{-1}$ is the multiplicative inverse of $\alpha$ in $\mathbb{F}_p^{\star}$ and $\sigma_a$ is the automorphism of $\mathbb{Q}(\xi_p)$ for $a \in \F_p^{\star}$. \end{proposition} \subsection{A new class of binary three-weight linear codes from plateaued Boolean functions} In this subsection, we present a new class of binary linear codes with few weights and their weight distributions using plateaued Boolean functions.\\ Let $p=2$ and assume that $\psi_1(x)=\Tr_{2}^{2^m}(\Psi(x))$ is a $r$-plateaued Boolean function, where $m+r$ is even. For $\alpha\in\F_{2 }$ and $\beta\in\F_{2^m}$, we compute the Hamming weights of the codewords and weight distribution of $\mathcal {C}$ defined by $(\ref{defCode})$. By Proposition \ref{HammingWeight}, if $\alpha=0$, we have $wt (\tilde {c}_{0, 0})=0$ and $wt (\tilde {c}_{0, \beta})= 2^{m-1}$ for $\beta\not=0$, if $\alpha=1$ and $\beta\in\F_{2^m}$, we have $ wt (\tilde {c}_{1, \beta})= 2^{m-1}-\frac {1}2 \Wa {\psi_{1}}(\beta). $ By Lemma \ref{Distribution}, we have for all $\beta\in\F_{2^m}$, \be\nn wt (\tilde {c}_{1, \beta})=\left\{\begin{array}{ll} 2^{m-1}- 2^{\frac{m+r-2}2}, & 2^{ m-r-1}+ 2^{\frac{m-r-2}2} \mbox{ times, } \\ 2^{m-1}, & 2^{ m }- 2^{m-r} \mbox{ times, }\\ 2^{m-1}+2^{\frac{m+r-2}2}, & 2^{ m-r-1}- 2^{\frac{m-r-2}2} \mbox{ times}.\\ \end{array}\right. \ee \noindent We give in the following theorem the Hamming weights of the codewords and the weight distribution of $\sC$. \begin{theorem}\label{WTdistributionB} Let $p=2$ and $\mathcal {C}$ be a binary linear $[2^m-1, m+1]$ code defined by $(\ref{defCode})$. Assume that $\psi_1$ is a $r$-plateaued Boolean function, where $m+r$ is even with $0\leq r\leq m-2$ for $2\leq m$. Then, the Hamming weight of codewords and the weight distribution of $\mathcal {C}$ are as in Table \ref{tabloo}. \begin{table}[!h] \begin{center}\label{tabloo} \begin{tabular}{|c|c| } \hline Hamming weight $w$ & Multiplicity $A_w $ \\ \hline \hline 0 & 1 \\ \hline $2^{m-1}$ & $2^{ m+1 }- 2^{m-r}-1$ \\ \hline $2^{m-1}- 2^{\frac{m+r-2}2}$ &$ 2^{ m-r-1}+ 2^{\frac{m-r-2}2} $\\ \hline $2^{m-1}+2^{\frac{m+r-2}2}$ &$ 2^{ m-r-1}- 2^{\frac{m-r-2}2} $\\ \hline \end{tabular} \end{center} \caption{Hamming weight and multiplicity in $\sC$ when $p=2$ and $m+r$ is even. } \end{table} \end{theorem} For $m=5$, a $3$-plateaued Boolean function and the corresponding binary linear code are given. \begin{example}\label{examplenew} Let $\Psi(x)=\zeta^{18}x^5 + \zeta^2x^3$ be a mapping from $\F_{2^5}$ to $\F_{2^5}$, where $\F_{2^5}^{\star}=\langle \zeta \rangle$ with $\zeta^5+\zeta^2+1=0$. Then, $\psi_1(x)=\Tr_{2}^{2^5}( \Psi(x))$ is the $3$-plateaued Boolean function, and so the set $\mathcal {C}$ in $(\ref{defCode})$ is a binary three-wight linear code with parameters $[31,6]$, weight enumerator $1+59y^{16} + 3y^{8} + 1y^{24}$ and weight distribution $(1,59,3,1)$. \end{example} \subsection{A new class of three-weight linear $p$-ary codes from weakly regular plateaued functions} In this subsection, we construct a new class of linear $p$-ary codes with few weights from weakly regular plateaued $p$-ary functions and determine their weight distributions. \\ \noindent From now on, we assume that $p$ is an odd prime and the function $\psi_1(x)=\Tr_{p}^{p^m}(\Psi(x))$ is weakly regular $p$-ary $r$-plateaued, where $r$ is an integer with $0\leq r\leq m$ and $\Psi:\mathbb {F}_{p^m}\to\mathbb {F}_{p^m}$ with $\Psi (0)=0$. Let $\mathcal {C}$ be a linear $p$-ary code defined by $(\ref{defCode})$ whose codewords are denoted by $\tilde {c}_{\alpha, \beta}$. We first compute for all $ \alpha \in\mathbb{F}_p$ and $\beta\in\mathbb{F}_{p^m}$, the Hamming weights of $\tilde {c}_{\alpha, \beta}$ and next determine the weight distribution of $\sC$. By Proposition \ref{HammingWeight}, if $\alpha=0$, then we have $wt (\tilde {c}_{0, 0})=0$ and $wt (\tilde {c}_{0, \beta})=p^m-p^{m-1}$ for $\beta\not=0$. For $ \alpha \in\mathbb{F}^{\star}_p$, to compute $wt(\tilde {c}_{\alpha, \beta})$, we need the following. \begin{lemma}\label{NewLemma} Let $f:\F_{p^m}\to\F_{p}$ be $r$-plateaued, where $r$ is an integer with $0 \leq r \leq m$. Define the sets $W:=\{(\alpha,\beta)\in\mathbb{F}^{\star}_p\times\mathbb{F}_{p^m}\mid \widehat{\chi}_f({\alpha^{-1}}\beta)=0\}$ and \be\nn\label{Set} WS:=\{(\alpha,\beta)\in\mathbb{F}^{\star}_p\times\mathbb{F}_{p^m}\mid \widehat{\chi}_f({\alpha^{-1}}\beta)\neq 0\}. \ee Then, the cardinalities of $W$ and $WS$ are equal respectively to $(p-1)(p^m-p^{m-r})$ and $(p-1)p^{m-r}$. \end{lemma} \begin{pf} By Lemma \ref{lemma1}, we have $\#\{\beta\in\mathbb{F}_{p^m}\mid \Wa {f}(\beta)=0\}=p^m-p^{m-r}$ and $\#Supp( \Wa {f})=p^{m-r}$, where $Supp( \Wa {f})=\{\beta\in\mathbb{F}_{p^m}\mid \Wa {f}(\beta)\neq0\}$. Hence, the result follows. \end{pf}\\ \noindent For all $ \alpha \in\mathbb{F}^{\star}_p$ and $\beta\in\F_{p^m}$, by Proposition \ref{HammingWeight}, we have \be\label{weightdistt} wt (\tilde {c}_{\alpha, \beta})=p^m-p^{m-1}-\frac {1}p \sum_{\omega \in\mathbb {F}_{p}^\star} \sigma_\omega\left(\sigma_\alpha(\Wa {\psi_{1}}(\alpha^{-1}\beta))\right). \ee Then there are two cases: $\Wa {\psi_1}( \alpha^{-1}\beta)=0$ or $\ne 0$. If $ (\alpha, \beta)\in W$, i.e., $\Wa {\psi_1}( \alpha^{-1}\beta)=0$, then we have $ wt (\tilde {c}_{\alpha, \beta})=p^m-p^{m-1}, $ that is, the number of codewords of Hamming weight $p^m-p^{m-1}$ is equal to the cardinality of $W$ by Lemma \ref{NewLemma}. If $ (\alpha,\beta)\in WS$, i.e., $\Wa {\psi_1}( \alpha^{-1}\beta)\neq 0$, to compute $wt (\tilde {c}_{\alpha, \beta})$ in (\ref{weightdistt}), we use the following (see Lemma \ref{WalshFact}) \be\nn \Wa {\psi_1}( \alpha^{-1}\beta)=\epsilon \sqrt{p^*}^{m+r}\xi_p^{g( \alpha^{-1}\beta)}, \ee where $\epsilon=\pm 1$, $p^*$ denotes $\left(\frac{-1}{p}\right)p$ and $g$ is a p-ary function over $Supp(\Wa {\psi_1})$. Notice that we have $\sigma_\alpha(\sqrt {p^*}^{m+r})=\sigma_\alpha( \sqrt p^*)^{m+r}=\left(\frac{\alpha}{p}\right)^{m+r}\sqrt {p^*}^{m+r}$, where $\sigma_\alpha$ is the automorphism of $\mathbb{Q}(\xi_p)$ for $\alpha \in \F_p^{\star}$. Then we get \be\nn \begin{array}{ll} \vspace{.3 cm} & \sigma_\omega\left(\sigma_\alpha(\Wa {\psi_1}( \alpha^{-1} \beta))\right)=\sigma_\omega\Big(\epsilon \left({\frac{\alpha}{p}}\right)^{m+r}\sqrt {p^*}^{m+r} \xi_p^{\alpha g( \alpha^{-1}\beta)}\Big)=\\ &\epsilon\left(\frac{\alpha}{p}\right)^{m+r}\sigma_\omega(\sqrt {p^*}^{m+r}) \xi_p^{\omega\alpha g( \alpha^{-1}\beta)}=\epsilon\left({\frac{\alpha}{p}}\right)^{m+r}\left(\frac{\omega}{p}\right)^{m+r}\sqrt {p^*}^{m+r} \xi_p^{\omega\alpha g( \alpha^{-1}\beta)}, \end{array} \ee where $\sigma_\omega$ is the automorphism of $\mathbb{Q}(\xi_p)$ for $\omega \in \F_p^{\star}$. Notice that $\left(\frac{a}p\right)^{m+r}=1$ and $\sqrt {p^*}^{m+r}=\sqrt {p}^{m+r}$ if $m+r$ is even; otherwise, $\left(\frac{a}p\right)^{m+r}=\left(\frac{a}p\right)$ for $a\in\F_p^{\star}$. Hence, by (\ref{weightdistt}) we have \be\nn wt (\tilde {c}_{\alpha, \beta})=\left\{ \begin{array}{ll}\label{Distributionofm} p^m-p^{m-1}-\epsilon\frac{1}p\left(\frac{\alpha}{p}\right)\sqrt {p^*}^{m+r}\sum_{\omega\in\mathbb{F}^{\star}_p}\left(\frac{\omega}{p}\right) \xi_p^{\omega\alpha g( \alpha^{-1}\beta)}, &\mbox { if } m+r \mbox { odd, } \\ p^m-p^{m-1}-\epsilon p^{\frac{m+r}2-1}\sum_{\omega\in\mathbb{F}^{\star}_p} \xi_p^{\omega\alpha g( \alpha^{-1}\beta)}, &\mbox { if } m+r \mbox { even.}\nn \end{array}\nn \right. \ee We now investigate two cases. First, assume $m+r$ odd. If $g( \alpha^{-1}\beta)=0$, then \be\nn wt (\tilde {c}_{\alpha, \beta})&=p^m-p^{m-1}-\epsilon\frac{1}p\left(\frac{\alpha}{p}\right)\sqrt {p^*}^{m+r} \displaystyle\sum_{\omega\in\mathbb{F}^{\star}_p}\left(\frac{\omega}{p}\right)=p^m-p^{m-1}, \ee where we used $ \sum_{\omega \in\mathbb{F}^{\star}_p} \left(\frac{\omega}{p}\right)=0$. If $g( \alpha^{-1}\beta)\not=0$, then we have \be\nn &\displaystyle \sum_{\omega\in\mathbb{F}^{\star}_p}\left(\frac{\omega}{p}\right) (\xi_p^{\omega})^{\alpha g( \alpha^{-1}\beta)}= \sigma_{\alpha g( \alpha^{-1}\beta)}\left(\sum_{\omega\in\mathbb{F}^{\star}_p}\left(\frac{\omega}{p}\right) \xi_p^{\omega}\right)= \sigma_{\alpha g( \alpha^{-1}\beta)}(\sqrt {p^*}) = \left(\frac{\alpha g( \alpha^{-1}\beta)}{p}\right)\sqrt {p^*}, \ee where we used $\sum_{\omega\in\mathbb{F}^{\star}_p}(\frac{\omega}{p}) \xi_p^{\omega}=\sqrt {p^*}$. Hence, \be\nn \begin{array}{ll} wt (\tilde {c}_{\alpha, \beta})&=p^m-p^{m-1}-\epsilon\frac{1}{p} \sqrt{p^*}^{m+r+1} \left(\frac{\alpha^2}{p}\right) \left(\frac{ g( \alpha^{-1}\beta)}{p}\right)\\ &=p^m-p^{m-1}-\epsilon\frac{1}{p} \left(\frac{-1}{p}\right)^{\frac{m+r+1}2}p^{\frac{m+r+1}2} \left(\frac{ g( \alpha^{-1}\beta)}{p}\right)\\ &=p^m-p^{m-1}-\epsilon \left(-1\right)^{\frac{(p-1)(m+r+1)}{4}}p^{\frac{m+r-1}2} \left(\frac{ g( \alpha^{-1}\beta)}{p}\right), \end{array} \ee where we used $\left(\frac{\alpha}{p}\right)\left(\frac{\alpha}{p}\right)=\left(\frac{\alpha^2}{p}\right)=1$, $p^*=\left(\frac{-1}{p}\right)p$ and $\left(\frac{-1}{p}\right)=(-1)^{\frac{p-1}{2}}$.\\ Now, assume $m+r$ even. If $g( \alpha^{-1}\beta)=0$, then we have \begin{displaymath} wt (\tilde {c}_{\alpha, \beta})=p^m-p^{m-1}-\epsilon p^{\frac{m+r-2}2}(p-1); \end{displaymath} otherwise, we have $ wt (\tilde {c}_{\alpha, \beta})=p^m-p^{m-1}+\epsilon p^{\frac{m+r-2}2} $ because if $g( \alpha^{-1}\beta)\not=0$, then $\sum_{\omega\in \mathbb{F}^{\star}_p}\xi_p^{\alpha\omega g(\alpha^{-1}\beta)}=-1$ since $\sum_{j=0}^{p-1}x^j$ is the minimal polynomial of $\xi_p$ over $\mathbb{Q}$. \\ \noindent We now collect in the following theorem the Hamming weights of the codewords of $\mathcal {C}$ defined by $(\ref{defCode})$. \begin{theorem}\label{WTdistribution} Let $\mathcal {C}$ be a linear $p$-ary code defined by $(\ref{defCode})$. Assume that $\psi_1$ is weakly regular $p$-ary $r$-plateaued. Then, for all $ \alpha \in\mathbb{F}_p$ and $\beta\in\mathbb{F}_{p^m}$, the Hamming weights of $\tilde {c}_{\alpha, \beta}$ are given as follows. For $\alpha=0$, we have $wt (\tilde {c}_{0, 0})=0$ and $wt (\tilde {c}_{0, \beta})=p^m-p^{m-1}$ for $\beta\not=0$. For $\alpha\in\F_p^{\star}$ and $\beta\in\F_{p^m}$, if $ (\alpha, \beta)\in W$, i.e., $\Wa {\psi_1}( \alpha^{-1}\beta)=0$, then we get $wt (\tilde {c}_{\alpha, \beta})=p^m-p^{m-1}$, and if $ (\alpha,\beta)\in WS$ , i.e., $\Wa {\psi_1}( \alpha^{-1}\beta)\neq 0$, then \begin{itemize} \item when $m+r$ is odd, \begin{displaymath} wt (\tilde {c}_{\alpha, \beta})=\left\{ \begin{array}{ll} p^m-p^{m-1}, \mbox { if } \alpha\in\mathbb{F}_{p}^\star$ \mbox { and } $g( \alpha^{-1}\beta)=0, \\ p^m-p^{m-1}-\epsilon \left(-1\right)^{\frac{(p-1)(m+r+1)}{4}}p^{\frac{m+r-1}2} \left(\frac{ g( \alpha^{-1}\beta)}{p}\right), \mbox { if } \alpha, g( \alpha^{-1}\beta)\in\mathbb{F}_{p}^\star,\\ \end{array} \right.\\ \end{displaymath} \item when $m+r$ is even, \begin{displaymath} wt (\tilde {c}_{\alpha, \beta})=\left\{ \begin{array}{ll} p^m-p^{m-1}-\epsilon(p-1)p^{\frac{m+r-2}2}, \mbox { if } \alpha\in\mathbb{F}_{p}^\star$ \mbox { and } $g( \alpha^{-1}\beta)=0, \\ p^m-p^{m-1}+\epsilon p^{\frac{m+r-2}2}, \mbox { if } \alpha, g(\alpha^{-1}\beta)\in\mathbb{F}_{p}^\star,\\ \end{array} \right.\\ \end{displaymath} where $\epsilon=\pm 1$ is the sign of $ \Wa {\psi_1}$. \end{itemize} \end{theorem} \noindent Now we are going to determine the weight distributions of the constructed codes given in Theorem \ref{WTdistribution}. To do this, we first give the following result. By Lemma \ref{Walshinverse}, the Walsh transform of $g$ is written as \be\nn \Wa {g}(x)=\epsilon vp^{\frac{m-r}2}\xi_p^{ \psi_1(-x)}, \ee where $\epsilon=\pm 1$ denotes the sign of $\Wa{g}$ and $v\in\{1,i\}$ in $\C$. By using this for $x=0$, we can compute the number of $b\in Supp(\Wa { \psi_1})$ such that $g(b)=j$ for all $j\in\F_{p}$. Set $$N_{g}(j):=\#\{b\in Supp(\Wa { \psi_1}) \mid g(b)=j\}.$$ Notice that $g(b)=0$ for all $b\notin Supp(\Wa { \psi_1})$, and $\#Supp(\Wa { \psi_1})=p^{m-r}.$ Hence, we have \be\label{Numberg} \sum_{j=0}^{p-1} N_{g}(j)=p^{m-r}. \ee \begin{remark} \label{Balanced} If $g$ is balanced over $Supp(\Wa { \psi_1})$, we have $N_{g}(j)=p^{m-r-1}$ for all $j\in\F_{p}$. \end{remark} We include the proof of the following proposition for making the paper self-contained (see, e.g., \cite{HellesethKholosha2013,Mesnager_Linear}). \begin{proposition}\label{Prop:annexe} We keep the above notations and assume that $g$ is unbalanced over $Supp(\Wa { \psi_1})$. Then we have the following. If $m-r$ is even, then \be\nn N_{g}(j)= \left\{\begin{array}{ll} p^{m-r-1}+\epsilon p^{\frac{m-r-2}2}(p-1),& j=0,\\ p^{m-r-1}-\epsilon p^{\frac{m-r-2}2},& j\in\F_p^{\star}. \end{array}\right. \ee If $m-r$ is odd, then \be\nn N_{g}(j)= \left\{\begin{array}{ll} p^{m-r-1}, & j=0,\\ p^{m-r-1}+\epsilon p^{\frac{m-r-1}2}\left(\frac{j}{p}\right), & j\in\F_p^{\star}, \end{array}\right. \ee where $\epsilon=\pm 1$ is the sign of $\Wa{g}$. \end{proposition} \begin{pf} Using the Walsh value of unbalanced $g$ at point zero, then we have $$\Wa g(0)=\sum_{b\in Supp(\Wa { \psi_1}) }\xi^{g(b)}_p=\sum_{j=0}^{p-1}N_{g}(j)\xi^j_p=\epsilon vp^{\frac{m-r}2}\xi^{\psi_1(0)}_p$$ equivalently, \begin{equation}\label{equation1} \sum_{j=0}^{p-1}N_{g}(j)\xi^j_p-\epsilon vp^{\frac{m-r}2}=0. \end{equation} If $m-r$ is even, then $v=1$. Because $\sum_{j=0}^{p-1}x^j$ is the minimal polynomial of $\xi_p$ over the rational number field, then for all $ j\in\F_p^{\star}$ we have \be\nn N_{g}(j)=a, \mbox{ and } N_{g}(0)=a+\epsilon p^{\frac{m-r}2} \ee for some constant $a$. By (\ref{Numberg}), $a+\epsilon p^{\frac{m-r}2}+(p-1)a=p^{m-r}$ from which one deduces $a=p^{m-r-1}-\epsilon p^{\frac{m-r}2-1}$.\\ If $m-r$ is odd, then $ v=\left\{\begin{array}{ll}1, & \mbox{ if } p \equiv 1\pmod 4, \\ i ,& \mbox{ if } p\equiv 3\pmod 4.\\ \end{array}\right.$\\ Recall the well-known identity (see, e.g.,\cite{LidlNiederreter1997}) \be\nn \sum_{j=0}^{p-1}\left(\frac{j}p\right)\xi^j_p=\left\{\begin{array}{ll}p^{\frac{1}2}; & \mbox{ if } p \equiv 1\pmod 4,~ \\ ip^{\frac{1}2},& \mbox{ if } p\equiv 3\pmod 4,\\ \end{array}\right. \ee that is, $\sum_{j=0}^{p-1}\left(\frac{j}p\right)\xi^j_p=vp^{\frac {1}2}$. Thus, (\ref {equation1}) can be rewritten as \be\nn \sum_{j=0}^{p-1}N_{g}(j)\xi^j_p-\epsilon p^{\frac{m-r-1}2}\sum_{j=0}^{p-1} \left(\frac {j}p\right)\xi^j_p=0; \ee equivalently, \be\nn \sum_{j=0}^{p-1}\xi^j_p\left(N_{g}(j)-\epsilon p^{\frac{m-r-1}2} \left(\frac {j}p\right)\right)=0. \ee Then for all $ j\in\F_p^{\star}$, we have $ N_{g}(j)=N_{g}(0)+\epsilon p^{\frac{m-r-1}2}\left(\frac{j}p\right). $ By (\ref{Numberg}), we obtain $\sum_{j=0}^{p-1} N_{g}(j)=pN_{g}(0)+\epsilon p^{\frac{m-r-1}2}\sum_{j=0}^{p-1} \left(\frac{j}p\right)=p^{m-r}$. Thus, since $\sum_{j=0}^{p-1} \left(\frac{j}p\right)=0$, the proof is complete. \end{pf}\\ \noindent We can derive from Remark \ref{Balanced} and Proposition \ref{Prop:annexe} the weight distributions of the constructed codes. \begin{theorem}\label{weight-even} Let $\mathcal {C}$ be a linear $p$-ary code defined by $(\ref{defCode})$. Assume that $\psi_1$ is weakly regular $p$-ary $r$-plateaued and $m+r$ is even with $0\leq r\leq m-2$ for $2\leq m$. Then, the Hamming weights of codewords and the weight distributions of $[p^m-1,m+1]$ code $\cal{C}$ are as in Tables \ref{table11} and \ref{table1} if $g$ is unbalanced and balanced over $Supp(\Wa { \psi_1})$, respectively, where $\epsilon=\pm 1$ is the sign of $\Wa{\psi_1}$. \begin{table}[!h] \begin{center} \begin{tabular}{|c|c|c|} \hline Hamming weight $w$ & Multiplicity $A_w$ \\ \hline \hline $0$ & $1$\\ \hline {$p^m-p^{m-1}$} & {$p^{m+1}-p^{m-r}(p-1)-1$}\\ \hline {$p^m-p^{m-1}-\epsilon(p-1)p^{\frac{m+r-2}2}$} & $p^{m-r-1}(p-1)+\epsilon p^{\frac{m-r-2}2}(p-1)^2$\\ \hline {$p^m-p^{m-1}+\epsilon p^{\frac{m+r-2}2}$} & $(p^{m-r}-p^{m-r-1})(p-1)-\epsilon p^{\frac{m-r-2}2}(p-1)^2$\\ \hline \end{tabular} \end{center} \caption{ \label{table11} Hamming weight and multiplicity in $\mathcal{C}$ when $m+r$ is even and $p$ is odd for unbalanced $g$} \begin{center} \begin{tabular}{|c|c|c|} \hline Hamming weight $w$ & Multiplicity $A_w$ \\ \hline \hline $0$ & $1$\\ \hline {$p^m-p^{m-1}$} & {$p^{m+1}-p^{m-r}(p-1)-1$}\\ \hline {$p^m-p^{m-1}-\epsilon(p-1)p^{\frac{m+r-2}2}$} & $p^{m-r-1}(p-1)$\\ \hline {$p^m-p^{m-1}+\epsilon p^{\frac{m+r-2}2}$} & $\left(p^{m-r}-p^{m-r-1}\right)(p-1)$\\ \hline \end{tabular} \end{center} \caption{ \label{table1} Hamming weight and multiplicity in $\mathcal{C}$ when $m+r$ is even and $p$ is odd for balanced $g$} \end{table} \end{theorem} \begin{pf} By Theorem \ref{WTdistribution}, the numbers of codewords of Hamming weight $0$ and of Hamming weight $p^m-p^{m-1}$ are equal respectively to $1$ and $p^m-1+\# W=p^{m+1}+p^{m-r}-p^{m-r+1}-1$. Now we are going to determine the weight distribution of $\mathcal{C}$ for $(\alpha,\beta)\in WS$, i.e., $\Wa{ \psi_1}( \alpha^{-1}\beta)\neq 0$. Set \be\nn \begin{array}{ll} N_g(0)&:=\#\{\gamma\in Supp(\Wa { \psi_1})\mid g(\gamma)=0\},\\ K_g(0)&:=\#\{(\alpha,\beta)\in\mathbb{F}^{\star}_p\times\mathbb{F}_{p^m}\mid g({\alpha^{-1}}\beta)=0\},\\ KS_g&:=\#\{(\alpha,\beta)\in\mathbb{F}^{\star}_p\times\mathbb{F}_{p^m}\mid g({\alpha^{-1}}\beta)\neq 0\}. \end{array} \ee Notice that for all $b\notin Supp(\Wa { \psi_1})$, $g(b)=0$ by definition of $g$ and so, $g( \alpha^{-1}\beta)=0$ for all $ (\alpha, \beta)\in W$. Hence, by Lemma \ref{NewLemma}, $K_g(0)=\# W+(p-1) N_g(0)$ and $KS_g=(p-1)p^m-K_g(0)$. Assume that $g$ is unbalanced over $Supp(\Wa { \psi_1})$. Then, since $N_g(0)=p^{m-r-1}+\epsilon p^{(m-r-2)/2}(p-1)$ by Proposition \ref{Prop:annexe}, we have \begin{displaymath} K_g(0)=\# W+p^{m-r-1}(p-1)+\epsilon p^{\frac{m-r-2}2}(p-1)^2,\\ \end{displaymath} and $KS_g=(p^{m-r}-p^{m-r-1})(p-1)-\epsilon p^{(m-r-2)/2}(p-1)^2.$ Hence, by Theorem \ref{WTdistribution}, the numbers of codewords of Hamming weight $p^{m}-p^{m-1}-\epsilon (p-1)p^{(m+r-2)/2}$ and of Hamming weight $p^m-p^{m-1}+\epsilon p^{(m+r-2)/2}$ are equal to $K_g(0)-\# W$ and $KS_g$, respectively.\\ Assume that $g$ is balanced over $Supp(\Wa { \psi_1})$. By Remark \ref{Balanced}, $N_g(0)=p^{m-r-1}$, and so we have $K_g(0)=\# W+p^{m-r-1}(p-1)$ and $KS_g=\left(p^{m-r}-p^{m-r-1}\right)(p-1)$. As in the first case, the assertion holds. \end{pf}\\ \noindent For $p=3$ and $m=3$, a weakly regular $3$-ary $1$-plateaued function and the corresponding linear $3$-ary code are given as follows. \begin{example}\label{ } Let $\Psi:\F_{3^3}\to \F_{3^3}$ be a map defined by $\Psi(x)=\zeta^{22}x^{13} + \zeta^7x^4 + \zeta x^2$ where $\F_{3^3}^{\star}=\langle \zeta \rangle$ with $\zeta^3+2\zeta+1=0$. A function $\psi_1(x)=\Tr_{3}^{3^3}( \Psi(x))$ is weakly regular $3$-ary $1$-plateaued with $\Wa { \psi_1}(b)\in\{0,-9\xi_3^{g(b)}\}$, where $g$ is an unbalanced $3$-ary function. Then, the set $\mathcal {C}$ in $(\ref{defCode})$ is a three-wight linear $3$-ary code with parameters $[26,4]_3$, weight enumerator $1+62y^{18} +2y^{24} + 16y^{15}$ and weight distribution $(1,62,2,16)$. \end{example} \begin{theorem}\label{weight-odd} Let $\mathcal {C}$ be a linear $p$-ary code defined by $(\ref{defCode})$. Assume that $\psi_1$ is weakly regular $p$-ary $r$-plateaued and $m+r$ is odd with $0\leq r\leq m-1$. Then, the Hamming weights of codewords and the weight distributions of $[p^m-1,m+1]$ code $\cal{C}$ are as in Tables \ref{table22} and \ref{table2} if $g$ is unbalanced and balanced over $Supp(\Wa { \psi_1})$, respectively, where $\epsilon=\pm 1$ is the sign of $\Wa{\psi_1}$. \begin{table}[!] \begin{center} \begin{tabular}{|c|c|c|} \hline Hamming weight $w$ & Multiplicity $A_w$ \\ \hline \hline \footnotesize{$0$} & \footnotesize{$1$}\\ \hline \footnotesize{$p^m-p^{m-1}$} & \footnotesize{$p^{m+1}-p^{m-r-1} (p-1)^2-1$}\\ \hline \footnotesize{$p^m-p^{m-1}-\epsilon \left(-1\right)^{\frac{(p-1)(m+r+1)}{4}} p^{\frac{m+r-1}{2}}$} & \footnotesize{$\frac{1}{2}(p^{m-r-1}+\epsilon p^{\frac{m-r-1}2})(p-1)^2$}\\ \hline \footnotesize{$p^m-p^{m-1}+\epsilon\left(-1\right)^{\frac{(p-1)(m+r+1)}{4}} p^{\frac{m+r-1}{2}}$} & \footnotesize{$\frac{1}{2}(p^{m-r-1}-\epsilon p^{\frac{m-r-1}2})(p-1)^2$}\\ \hline \end{tabular}\end{center} \caption{ \label{table22} Hamming weight and multiplicity in $\mathcal{C}$ when $m+r$ and $p$ are odd for unbalanced $g$} \begin{center} \begin{tabular}{|c|c|c|} \hline Hamming weight $w$ & Multiplicity $A_w$ \\ \hline \hline \footnotesize{$0$} & \footnotesize{$1$}\\ \hline \footnotesize{$p^m-p^{m-1}$} & \footnotesize{$p^{m+1}-p^{m-r-1} (p-1)^2-1$}\\ \hline \footnotesize{$p^m-p^{m-1}-\epsilon \left(-1\right)^{\frac{(p-1)(m+r+1)}{4}} p^{\frac{m+r-1}{2}}$} & \footnotesize{$\frac{1}{2}p^{m-r-1} (p-1)^2 $}\\ \hline \footnotesize{$p^m-p^{m-1}+\epsilon \left(-1\right)^{\frac{(p-1)(m+r+1)}{4}} p^{\frac{m+r-1}{2}}$} & \footnotesize{$\frac{1}{2}p^{m-r-1}(p-1)^2$}\\ \hline \end{tabular}\end{center} \caption{ \label{table2} Hamming weight and multiplicity in $\mathcal{C}$ when $m+r$ and $p$ are odd for balanced $g$} \end{table} \end{theorem} \begin{pf} Set $N_g(j):=\#\{\gamma\in Supp(\Wa { \psi_1})\mid g(\gamma)=j\}$ and $K_g(j):=\#\{(\alpha,\beta)\in\mathbb{F}^{\star}_p\times\mathbb{F}_{p^m}\mid g({\alpha^{-1}}\beta)=j\}$ for all $j\in\F_p$. Notice that for all $b\notin Supp(\Wa { \psi_1})$, $g(b)=0$ by definition of $g$ and so, $g( \alpha^{-1}\beta)=0$ for all $ (\alpha, \beta)\in W$. Then, by Lemma \ref{NewLemma}, $K_g(0)=\# W+(p-1) N_g(0)$ where $N_g(0)=p^{m-r-1}$ (see Remark \ref{Balanced} and Proposition \ref{Prop:annexe}). Hence, by Theorem \ref{WTdistribution}, the number of codewords of Hamming weight $p^m-p^{m-1}$ is equal to $p^m-1+K_g(0)=p^{m+1}+2p^{m-r}-p^{m-r+1}-p^{m-r-1}-1.$ Moreover, the number of codewords of Hamming weight $p^m-p^{m-1}-\epsilon \left(-1\right)^{(p-1)(m+r+1)/4}p^{(m+r-1)/2}$ and of Hamming weight $p^m-p^{m-1}+\epsilon \left(-1\right)^{(p-1)(m+r+1)/4}p^{(m+r-1)/2}$ is equal respectively to $\sum_{j\in\{1,\ldots, p-1\}, \left(\frac{j}p\right)=1}(p-1) N_g(j)$ and $\sum_{j\in\{1,\ldots, p-1\}, \left(\frac{j}p\right)=-1} (p-1) N_g(j)$. If $g$ is unbalanced, then by Proposition \ref{Prop:annexe}, \be\nn \begin{array}{ll} \displaystyle \sum_{j\in\{1,\ldots, p-1\}, \left(\frac{j}p\right)=1}(p-1)N_g(j)&=\displaystyle \sum_{j\in\{1,\ldots, p-1\}, \left(\frac{j}p\right)=1}(p-1)(p^{m-r-1}+\epsilon p^{\frac{m-r-1}2})\\ &=\frac {(p-1)^2}2(p^{m-r-1}+\epsilon p^{\frac{m-r-1}2})\\ \end{array} \ee and \be\nn \begin{array}{ll} \displaystyle \sum_{j\in\{1,\ldots, p-1\}, \left(\frac{j}p\right)=-1}(p-1)N_g(j)&=\displaystyle\sum_{j\in\{1,\ldots, p-1\}, \left(\frac{j}p\right)=-1}(p-1) (p^{m-r-1}-\epsilon p^{\frac{m-r-1}2})\\ &=\frac {(p-1)^2}2(p^{m-r-1}-\epsilon p^{\frac{m-r-1}2}).\\ \end{array} \ee If $g$ is balanced then by Remark \ref{Balanced}, $\displaystyle \sum_{j\in\{1,\ldots, p-1\}, \left(\frac{j}p\right)=1}(p-1)N_g(j)=\frac {(p-1)^2}2p^{m-r-1} $ and \\ $\displaystyle \sum_{j\in\{1,\ldots, p-1\}, \left(\frac{j}p\right)=-1}(p-1)N_g(j)=\frac {(p-1)^2}2p^{m-r-1}.$ The proof is complete. \end{pf} \begin{remark}We finally should remark that if we assume only the weakly regular bentness in this paper, then we can recover the results given in \cite{Mesnager_Linear} by Mesnager. Therefore, this paper can be viewed as an extension of \cite{Mesnager_Linear} to the notion of weakly regular $r$-plateaued functions for any positive integer $r$. \end{remark} \section{The constructed three-weight linear codes for secret sharing schemes}\label{SectionSSS} In this section, we consider our linear codes presented in Section \ref{SectionCodes} for secret sharing schemes. A linear code provides a pair of secret sharing schemes, based on a linear code $\sC$ and its dual code $\sC^\perp$. For the secret sharing scheme based on the dual code $\sC^\perp$, we need to find all minimal codewords of $\sC$. We say that a vector $\tilde a$ covers a vector $\tilde b$ if $supp(\tilde b)\subset supp(\tilde a) $. Then, if a nonzero codeword $\tilde a$ of $\sC$ does not cover any other nonzero codeword of $\sC$, then $\tilde a$ is called \textit{minimal codeword} of $\sC$. The \textit{covering problem} is to find all the minimal codewords of $\sC$. In general, this problem is very hard, but it can be easy for some linear codes. Then the main question is how to find a linear code whose all nonzero codewords are minimal. For more details, we send the reader to \cite{DingDingIEEE-IT2015}. \begin{lemma}\label{Minimality}\cite{Ashikhmin} Let $\sC$ be a linear code over $\F_p$. Every nonzero codeword of $\sC$ is minimal if $\frac{p-1}{p}<\frac{w_{min}}{w_{max}}, $ where $w_{min}$ and $w_{max}$ denote the minimum and maximum nonzero weights in $\sC$, respectively. \end{lemma} \noindent We now consider the constructed linear codes in Theorems \ref{WTdistributionB}, \ref{weight-even} and \ref{weight-odd}. Let $\mathcal {C}$ be the binary linear code of Theorem \ref{WTdistributionB} and $m+r$ be even. Then we readily see that $ \frac{1}{2} <\frac{w_{min}}{w_{max}},$ where $w_{min}=2^{m-1}- 2^{(m+r-2)/2}$ and $w_{max}=2^{m-1}+2^{(m+r-2)/2}$ since we have $3\cdot 2^{(m+r)/2}< 2^{m}$ for $m\geq 4$ and $0\leq r\leq m-4$. Hence, by Lemma \ref{Minimality}, all nonzero codewords of $\mathcal {C}$ given in Theorem \ref{WTdistributionB} are minimal if $m\geq 4$ and $0\leq r\leq m-4$.\\ \noindent Let $p$ be any odd prime, $m+r$ be even and $\mathcal {C}$ be the linear $p$-ary code of Theorem \ref{weight-even}. If $\epsilon=1$, we have $w_{min}=p^m-p^{m-1}- (p-1)p^{(m+r-2)/2}$ and $w_{max}=p^m-p^{m-1}+p^{(m+r-2)/2}$. If $\epsilon=-1$, then $w_{min}=p^m-p^{m-1}- p^{(m+r-2)/2}$ and $w_{max}=p^m-p^{m-1}+(p-1)p^{(m+r-2)/2}$. For both cases, we see that $ \frac{p-1}{p} <\frac{w_{min}}{w_{max}}$ for $m\geq 4$ and $0\leq r\leq m-4$ since we have $(p+1) p^{(m+r)/2}<p^{m}$ if $\epsilon=1$ and $(p^2-p+1) p^{(m+r)/2}<p^{m}(p-1)$ if $\epsilon=-1$. Hence, by Lemma \ref{Minimality}, all nonzero codewords of $\mathcal {C}$ given in Theorem \ref{weight-even} are minimal if $m\geq 4$ and $0\leq r\leq m-4$. \\ \noindent Let $p$ be any odd prime, $m+r$ be odd and $\mathcal {C}$ be the linear $p$-ary code of Theorem \ref{weight-odd}. Then we see that $ \frac{p-1}{p} <\frac{w_{min}}{w_{max}},$ where $w_{min}=p^m-p^{m-1}- p^{(m+r-1)/2}$ and $w_{max}=p^m-p^{m-1}+p^{(m+r-1)/2}$ since we have $(2p-1)p^{(m+r+1)/2}< p^{m}(p-1)$ for $m\geq 3$ and $0\leq r\leq m-3$. Hence, by Lemma \ref{Minimality}, all nonzero codewords of $\mathcal {C}$ given in Theorem \ref{weight-odd} are minimal if $m\geq 3$ and $0\leq r\leq m-3$. \section{Conclusion} The paper studies for the first time constructions of linear codes with few weights from weakly regular plateaued functions. We first present a new family of binary three-weight linear codes from plateaued Boolean functions and their weight distributions. In odd characteristic $p$, we introduce the notion of (weakly) regular plateaued functions and give concrete examples of these functions. We next present a new family of three-weight linear $p$-ary codes from weakly regular plateaued functions, and their weight distributions. We finally analyse the constructed linear codes in this paper for secret sharing schemes. The constructed linear codes are inequivalent to the known ones (since there is no code with the obtained parameters) in literature as far as we know. \section*{Acknowledgment} The third author is supported by TÜBİTAK (the Scientific and Technological Research Council of Turkey), program no: BİDEB 2214/A.
{'timestamp': '2017-03-27T02:06:16', 'yymm': '1703', 'arxiv_id': '1703.08362', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08362'}
arxiv
\section{Introduction} \begin{figure*}[tb] \centering \includegraphics[width = 0.8\textwidth]{./figures/pipeline_cropped.pdf} \caption{The pipeline of a person re-identification system. The blue, green and red color indicate training data, gallery and probe, respectively. Previous works concentrate on feature extracting and metric learning, marked with dashed boxes. Our work can be the postprocessing procedure about affinity learning, marked with a solid box. Sample images come from GRID dataset~\cite{GRID1}.} \label{fig:pipeline} \vspace{-2ex} \end{figure*} Person re-identification (ReID) is an active task driven by the applications of visual surveillance, which aims to identify person images from the gallery that share the same identity as the given probe. Due to the large intra-class variations in viewpoint, pose, illumination, blur and occlusion, person re-identification is still a rather challenging task, though extensively studied in recent years. Current research interests can be coarsely divided into two mainstreams: 1) those focus on designing robust visual descriptors~\cite{SCNCD,symmetry,GOG,XQDA,zheng2015query} to accurately model the appearance of person; 2) those seek for a discriminative metric~\cite{PRDC,li2013decision,xiong2014person,lisanti2015person,hirzer2012relaxed}, under which instances of the same identity should be closer while instances of different identities are far away. Unlike those methods performed in the metric space, we investigate person re-identification task from another perspective,~\emph{i.e.},~taking into account the manifold structure~\cite{LLE}. Since existing methods only analyze the pairwise distances between instances, the underlying data manifold, which those images reside on, is more or less neglected. It results in that the learned relationships (similarities or dissimilarities) between instances are not smooth with respect to the local geometry of the manifold. To overcome this issue, potential solutions can be semi-supervised~\cite{LP,LGC} or unsupervised~\cite{zhou2004ranking,zhang2015query,donoser2013diffusion,RDP_AAAI} algorithms about manifold learning. However, directly applying such algorithms to person re-identification might be problematic for two reasons. First, semi-supervised algorithms (\emph{e.g.},~label propagation~\cite{LP}) can only predict the labels of unlabeled data, but fail to depict the relationship between the probe and gallery instances. Moreover, they require category labels, while supervision in ReID is given as pairwise (equivalence) constraints~\cite{KISSME}. Meanwhile, unsupervised algorithms (\emph{e.g.},~manifold ranking~\cite{zhou2004ranking}, graph transduction~\cite{GT}) totally ignore the beneficial influence from the labeled training data. Second, since most manifold learning algorithms operate on graph models, their algorithmic complexity is usually high. Therefore, the heavy computational cost hinders their promotions in this field, especially in recent years researchers begin to attach more importance to the scalability issue~\cite{Deepreid,market1501}. In summary, due to the above factors, those conventional manifold learning algorithms are inadequate to derive a more faithful similarity for person re-identification. In this paper, we tackle person re-identification task on the data manifold by proposing a novel affinity learning algorithm called Supervised Smoothed Manifold (SSM). Compared with existing algorithms, the primary contribution of SSM is that the similarity value between two instances is estimated in the context of other pairs of instances, thus the learned similarity well reflects the geometry structure of the underlying manifold. Moreover, SSM is customized specifically for person re-identification, which further possesses three merits (as illustrated in Fig.~\ref{fig:pipeline}) as follows: i)~\textbf{supervision}: instead of considering each instance individually, we propose to learn the similarity with instance pairs. By doing so, SSM can take advantage of the supervision in pairwise constraints, which is easily accessible in this task; ii)~\textbf{efficiency}: to overcome the limitation of high time complexity of SSM, two improvements are proposed to accelerate its on-line person matching. Consequently, the affinity learning is performed only with database instances off-line, and SSM can be applied to the scenario on large scale person re-identification; and iii)~\textbf{generalization}: different from most existing algorithms performed in metric space, SSM focuses on affinity learning between instances. Hence, SSM can be deemed as a postprocessing procedure (or a generic tool) to further boost the identification accuracies of those algorithms. The rest of the paper is organized as follows. In Sec.~\ref{sec:R_W}, we present the differences between SSM and relevant works. The basic affinity learning framework of SSM is introduced in Sec.~\ref{sec:proposed}, and significantly accelerated in Sec.~\ref{sec:fly}. Experiments are presented in Sec.~\ref{sec:exp}. Conclusions and future works are given in Sec.~\ref{sec:con}. \section{Related Work} \label{sec:R_W} The manifold structure has been observed by several works. Motivated by the fact that pedestrian data are distributed on a highly curved manifold, a sampling strategy for training neural network called Moderate Positive Mining (MPM) is proposed in~\cite{shi2016embedding}. However, considering the data distribution is hard to define, MPM does aim at estimating the geodesic distances along the manifold. From this point of view, SSM explicitly learns the geodesic distances between instances, which can be directly used for re-identification. Manifold ranking~\cite{zhou2004ranking} is introduced by~\cite{person_manifold_ranking} to person re-identification. Through a random walk~\cite{random_walk} on the affinity graph, it propagates the probe label to the gallery iteratively assuming that the probe is the only labeled data. Despite the ignorance of labeled training data as analyzed above, manifold ranking encounters severe obstacles when handling larger databases, since the graph-based iteration has to be run each time a new probe is observed. In this aspect, SSM also learns the similarities via iterative propagation. Nevertheless, it enables a highly-efficient on-line matching. Post-ranking techniques have not drawn much attention in this field. Most of them require human feedback in-the-loop~\cite{ali2010interactive,hirzer2011person}, such as Post-rank OPtimisation (POP)~\cite{POP}, Human Verification Incremental Learning (HVIL)~\cite{wang2016human}. Meanwhile, several works~\cite{an2016person,leng2015person} operate in an unsupervised manner. For example, Discriminant Context Information Analysis (DCIA)~\cite{DCIA} focuses on the visual ambiguities shared between the first ranks, where the true match is supposed to be located. In comparison, SSM does not need human interaction or hold the ``rank-1" assumption. Instead, its essence is to learn a smooth similarity measure, supervised by the special kind of labels in pairwise constraints. At the first glance, affinity learning in our work appears the same as similarity learning (\emph{e.g.},~PolyMap~\cite{PolyMap}). Unlike similarity learning on polynomial feature map~\cite{SCSP} which connects to Mahalanobis distance metric and bilinear similarity, affinity learning in SSM does not rely on the definition of metric (non-metric can be also used). Therefore, they are inherently different. Finally, it is acknowledged that those metric learning methods (\emph{e.g.},~KISSME~\cite{KISSME}, XQDA~\cite{XQDA}) are also relevant, but take effects prior to SSM in a person re-identification system as Fig.~\ref{fig:pipeline} shows. \section{Proposed Method} \label{sec:proposed} Given a probe $p$ and a testing gallery $X=\{x_1,x_2,\dots,x_{N_g}\}$, we aim at learning a smooth similarity $Q\in\mathbb{R}^{N\times N}$ with the help of the labeled training set $Y=\{y_1,y_2,\dots,y_{N_l}\}$, where $N=N_g+N_l+1$. The data manifold is modeled as a weighted affinity graph $\mathcal{G}=\{V,W\}$. The vertex set $V=\{v_1,v_2,\dots,v_N\}$ is equivalent to the union of the probe $p$ and the database instances (gallery $X$ and labeled set $Y$). $W\in\mathbb{R}^{N\times N}$ is the adjacency matrix of $\mathcal{G}$, with $W_{ij}$ measuring the similarity between vertex $v_i$ and $v_j$. To facilitate a random walk~\cite{random_walk} on the graph $\mathcal{G}$, a transition matrix $P\in\mathbb{R}^{N\times N}$ is usually needed. The transition probability from vertex $v_i$ to $v_j$ can be calculated as \begin{equation} P(i\rightarrow j)=P_{ij}=\frac{W_{ij}}{\sum_{j'=1}^NW_{ij'}}. \end{equation} Thus, $P$ is a row stochastic matrix. \subsection{Supervised Similarity Propagation} The label set $L\in\mathbb{R}^{N\times N}$ used in person re-identification is given in pairwise constraints,~\emph{i.e.},~if $v_i$ and $v_j$ belong to the same identity, $L_{ij}=1$, otherwise $L_{ij}=0$. Meanwhile, in the ideal case, the learned similarity $Q_{ij}$ should be larger if $v_i$ and $v_j$ belong to the same identity, and $Q_{ij}$ should be close to $0$ otherwise. Therefore, we can conclude that both $L$ and $Q$ provide a probabilistic interpretation to the likelihood of the tuple $(v_i, v_j)$ being a true matching pair. The difference is that $L_{ij}$ is a discrete binary variable, indicating exactly matching or not, while $Q_{ij}$ is a continuous variable, specifying a matching degree. Such an observation motivates us that affinity learning can be done by propagating the pairwise constraint label $L$ with tuples as primitive data. In other words, similarities are spread from the most confident tuples generated from the labeled set $Y$ to the unexplored tuples generated from the testing gallery $X$. Let $(v_k,v_i)$ and $(v_l,v_j)$ be two tuples, the propagation step in the $t$-th iteration is defined as \begin{equation} \label{eq:iteration} Q^{(t+1)}_{ki}=\alpha\sum_{l,j}^N\mathcal{P}(ki\rightarrow lj)Q^{(t)}_{lj}+(1-\alpha)L_{ki}, \end{equation} where $\mathcal{P}(ki\rightarrow lj)$ is the transition probability from tuple $(v_k,v_i)$ to tuple $(v_l,v_j)$, and $0<\alpha<1$. Eq.~\eqref{eq:iteration} reveals that at each iteration, the tuple $(v_k,v_i)$ absorbs a fraction of label information from the rest tuples with probability $\alpha$, then retains its initial label $L_{ki}$ with probability $1-\alpha$. Assuming the independence within tuples, we hold the \emph{product rule} to calculate $\mathcal{P}(ki\rightarrow lj)$, as \begin{equation} \mathcal{P}(ki\rightarrow lj)=P(k\rightarrow l)P(i\rightarrow j)=P_{kl}P_{ij}. \end{equation} Afterwards, Eq.~\eqref{eq:iteration} can be rewritten in matrix form \begin{equation} \label{eq:iteration1} \vec{Q}^{(t+1)}=\alpha\mathcal{P}\vec{Q}^{(t)}+(1-\alpha)\vec{L}. \end{equation} To prove this, we need two identical coordinate transformations, that is $\mu\equiv N(i-1)+k$ and $\nu\equiv N(j-1)+l$. Then $Q$ can be vectorized to $\vec{Q}=vec(Q)\in\mathbb{R}^{N^2\times 1}$, with the element correspondence $\vec{Q}_{\mu}=Q_{ki}$. Let $\mathcal{P}\in\mathbb{R}^{N^2\times N^2}$ be the Kronecker product of $P$ with itself,~\emph{i.e.},~$\mathcal{P}=P\otimes P$. Then, the correspondence between $\mathcal{P}$ and $P$ is given as $\mathcal{P}_{\mu\nu}=P_{ij}P_{kl}$. Eventually, Eq.~\eqref{eq:iteration} can be expressed as \begin{equation} \vec{Q}^{(t+1)}_{\mu}=\alpha\sum_{\nu=1}^{N^2}\mathcal{P}_{\mu\nu}\vec{Q}^{(t)}_{\nu}+(1-\alpha)\vec{L}_{\mu}. \end{equation} The proof is complete. \subsection{Convergence Proof} By running the iteration for $t$ times, Eq.~\eqref{eq:iteration1} can be expanded as \begin{equation} \label{eq:iteration2} \vec{Q}^{(t+1)}=({\alpha\mathcal{P}})^t\vec{Q}^{(1)}+(1-\alpha){\sum_{i=0}^{t-1}({\alpha\mathcal{P}})^i\vec{L}}. \end{equation} $\mathcal{P}$ is also a row stochastic matrix, since \begin{equation} \sum_{\nu}\mathcal{P}_{\mu\nu}=\sum_{l,j}P_{ij}P_{kl}=\sum_{j}{P_{ij}}\sum_l{P_{kl}}=1. \end{equation} Therefore, according to \emph{Perron-Frobenius Theorem}, we can obtain that spectral radius of $\mathcal{P}$ is bounded by $1$, the maximum value of its row sums. Considering that $0<\alpha<1$, we have \begin{equation} \lim_{t\rightarrow\infty}({\alpha\mathcal{P}})^t=0,~~~~\lim_{t\rightarrow\infty}{\sum_{i=0}^{t-1}({\alpha\mathcal{P}})^i}=(I-\alpha\mathcal{P})^{-1}, \end{equation} where $I$ is an identity matrix in appropriate size. Consequently, Eq.~\eqref{eq:iteration2} converges to \begin{equation} \label{eq:close} \lim_{t\rightarrow\infty}\vec{Q}^{(t+1)}=(1-\alpha)(I-\alpha\mathcal{P})^{-1}\vec{L}. \end{equation} Then $Q$ can be obtained by reshaping $\vec{Q}$ to matrix form as $Q=vec^{-1}(\vec{Q})$. \subsection{Basic Pipeline} Intuitively, person re-identification using the above affinity learning algorithm can be accomplished in three steps. First, each time a probe instance $p$ is observed, the affinity graph $\mathcal{G}$ is constructed. Second, a new similarity $Q$ is learned by either running Eq.~\eqref{eq:iteration1} until convergence or directly using the closed-form solution in Eq.~\eqref{eq:close}. At last, since $Q$ can be divided into \begin{equation} Q= \begin{bmatrix} Q_{pp} & Q_{pX} & Q_{pY} \\ Q_{Xp} & Q_{XX} & Q_{XY} \\ Q_{Yp} & Q_{YX} & Q_{YY} \\ \end{bmatrix}, \end{equation} we can obtain the matching probabilities between the probe $p$ and the gallery $X$, that is $Q_{pX}\in\mathbb{R}^{1\times N_g}$. Note that $W$ and $P$ also have such a division. We draw readers' attention that when the probe $p$ is used for testing, the other probe instances are invisible to users. Therefore, one cannot simultaneously include all the probe instances to constitute $\mathcal{G}$ for a global probe search. However, this pipeline is computationally too demanding in practice. First, affinity learning itself is computationally expensive. It requires time complexity $O(TN^4)$ and space complexity $O(N^4)$ to run the iteration in Eq.~\eqref{eq:iteration1}, where $T$ is the iteration number. Alternatively, using the closed-form solution in Eq.~\eqref{eq:close} requires time complexity $O(N^6)$ and space complexity $O(N^4)$, since we need to invert and store a huge matrix of size $N^2\times N^2$. Second, adapting new probe instances is computationally expensive. As our method is algorithmically graph-based, we need to discard the old probe and do the affinity learning at each time a new probe is observed. Assume we have $N_p$ probe instances in total, we at least need time complexity $O(TN_pN^4)$ to finish the whole probe search. Note that constructing the affinity graph is computationally cheap due to the fact that the similarities between database instances can be pre-computed off-line for once and reused consistently. \section{Re-identification on-the-fly} \label{sec:fly} In this section, we propose two modifications to decrease the high complexity of the basic pipeline in Sec.~\ref{sec:proposed}, such that person re-identification can be done on-the-fly. \subsection{Iteration Transform} Our first improvement focuses on affinity learning itself. We observe the following useful identity \begin{equation} \mathcal{P}\vec{Q}=(P\otimes P) vec(Q)=vec(PQP^{\mathrm{T}}). \end{equation} So, Eq.~\eqref{eq:iteration1} can be transformed into \begin{equation} \label{eq:iteration_effeiciency} Q^{(t+1)}=\alpha PQ^{(t)}P^{\mathrm{T}}+(1-\alpha)L. \end{equation} As a result, the time and space complexity of affinity learning are reduced to $O(TN^3)$ and $O(N^2)$, respectively. \subsection{Probe Embedding} Our second improvement concentrates on improving the efficiency in adapting new probe instances. First, we prove that the closed-form solution in Eq.~\eqref{eq:close} can be derived from \begin{equation} \label{eq:regularization} \min_{Q}\Phi(Q)+\frac{1-\alpha}\alpha\Omega(Q), \end{equation} where \begin{equation} \label{eq:twoQ} \begin{split} &\Phi(Q)=\frac12\sum_{i,j,k,l}^N{P_{ij}P_{kl}}(Q_{ki}-Q_{lj})^2,\\ &\Omega(Q)=\sum_{k,i=1}^N(Q_{ki}-L_{ki})^2. \end{split} \end{equation} Using the two identical coordinate transformations, Eq.~\eqref{eq:regularization} can be vectorized, where \begin{equation} \label{eq:regularization1} \Phi(\vec{Q})=\frac12\sum_{\mu,\nu}^{N^2}\mathcal{P}_{\mu\nu}(\vec{Q}_{\mu}-\vec{Q}_{\nu})^2,~~\Omega(\vec{Q})=\|\vec{Q}-\vec{L}\|_2^2, \end{equation} where $\Phi(\vec{Q})$ measures the smoothness of $\vec{Q}$ with respect to the local manifold structure, and $\Omega(\vec{Q})$ measures the fitness of $\vec{Q}$ to the given label $\vec{L}$. The derivative of $\Phi(\vec{Q})$ with respect to $\vec{Q}$ is \begin{equation} \label{eq:Phi2Q1} \frac{\partial\Phi(\vec{Q})}{\partial{\vec{Q}}}=\left((I-\mathcal{P})+(I-\mathcal{P})^{\mathrm{T}}\right)\vec{Q}. \end{equation} According to~\cite{belkin2003laplacian}, Eq.~\eqref{eq:Phi2Q1} can be approximated by $2(I-\mathcal{P})\vec{Q}$. So, one can easily induce the derivative of Eq.~\eqref{eq:regularization} with respect to $\vec{Q}$ \begin{equation} \label{eq:derivative} 2(I-\mathcal{P})\vec{Q}+\frac{2(1-\alpha)}\alpha(\vec{Q}-\vec{L}). \end{equation} By setting Eq.~\eqref{eq:derivative} to zero and applying $vec^{-1}$ operator, we can get the closed-form solution of Eq.~\eqref{eq:regularization} \begin{equation} Q=vec^{-1}\left((1-\alpha)(I-\alpha\mathcal{P})^{-1}\vec{L}\right), \end{equation} which is equivalent to Eq.~\eqref{eq:close}. The proof is complete. Compared with the large database (testing gallery and labeled data), there is only one probe $p$ at each testing time. Therefore, we hold two assumptions that 1) the database itself constitutes an underlying manifold; 2) when $p$ is embedded into the manifold smoothly, it will not alter its geometry structure. With these prerequisites, we can first perform affinity learning off-line with only database instances, then do the probe embedding on-line. Of course, the embedding of the probe should also follow the smoothness criterion $\Phi(Q)$. After the pairwise similarities between database instances are smoothed, the partial derivative of $\Phi(Q)$ with respect to $Q_{pi}$ is \begin{equation} \frac{\partial \Phi(Q)}{\partial{Q_{pi}}}=\sum_{j,l=1}^{N_g+N_l}P_{ij}P_{pl}(Q_{pi}-Q_{lj}). \end{equation} Setting it to zero, the similarity between the probe $p$ and a certain database instance $v_i$ can be calculated \begin{equation} \label{eq:embedding_solution} Q_{pi}=\sum_{j,l=1}^{N_g+N_l}P_{pl}Q_{lj}P_{ij}. \end{equation} By varying $v_i\in X$, Eq.~\eqref{eq:embedding_solution} can be rewritten in matrix form \begin{equation} \label{eq:embedding_solution_matrix} Q_{pX}=\begin{bmatrix}P_{pX}&P_{pY}\end{bmatrix}\begin{bmatrix}Q_{XX}&Q_{XY}\\Q_{YX}&Q_{YY}\end{bmatrix}\begin{bmatrix}P_{XX}^{\mathrm{T}}\\mathcal{P}_{XY}^{\mathrm{T}}\end{bmatrix}. \end{equation} \subsection{Complexity Analysis} \label{sec:complexity} The final pipeline of the proposed SSM is rather simple, summarized in Alg.~\ref{alg}. \begin{algorithm}[tb] \DontPrintSemicolon \KwData{~The probe $p$, the testing gallery $X$, the labeled data $Y$, the training label $L$.\\} \KwResult{~The matching probability $Q_{pX}$. \\} \Begin{\emph{Off-line:} \\ \Begin{ Construct the affinity graph with $X$ and $Y$;\\ Affinity learning with label $L$ using Eq.~\eqref{eq:iteration_effeiciency}. \\ \KwRet{$Q_{XX}$, $Q_{XY}$, $Q_{YX}$, $Q_{YY}$} } \emph{On-line:} \\ \Begin{ \For{each probe $p$}{ Do pedestrian matching using Eq.~\eqref{eq:embedding_solution_matrix};\\ \KwRet{$Q_{pX}$}.} } } \caption{Supervised Smoothed Manifold.\label{alg}} \end{algorithm} As can be seen, affinity learning is done only with database instances. The computational cost still seems a bit heavy, since there are $(N_g+N_l)$ vertices in the graph. However, those operations can be done off-line, and reused with different probe instances. The learned similarities can all be maintained dynamically as long as new database instances are added or distance matrices are changed. In Table~\ref{table:complexity}, we present the on-line complexity comparison between the standard solution in Sec.~\ref{sec:proposed} and the accelerated solution in Sec.~\ref{sec:fly}. Eq.~\eqref{eq:embedding_solution_matrix} reveals that on-line indexing for $N_p$ probe instances involves the multiplication of three matrices. Whereas the multiplication of the right two can be also computed off-line, the on-line time complexity is only $O\left (N_p(N_g+N_l)N_g\right)$. Furthermore, the space complexity is dominated by the storage of the learned similarity, requiring $O\left((N_g+N_l)^2\right)$. \begin{table}[tb] \small \centering \begin{tabular}{|l|*{2}{p{2.75cm}<{\centering}}|} \hline Methods & Time Complexity & Space Complexity \\ \hline \hline Standard & $O(TN_pN^4)$ & $O(N^4)$ \\ Accelerated & $O\left(N_p(N_g+N_l)N_g\right)$ & $O\left((N_g+N_l)^2\right)$ \\ \hline \end{tabular} \caption{The complexity comparison between the standard solution and the accelerated solution of SSM. Recall that $N_p$ is the number of probe, $N_g$ is the number of gallery, $N_l$ is the number of labeled data, and $T$ is the number of iterations. $N=N_g+N_l+1$.} \label{table:complexity} \vspace{-2ex} \end{table} \section{Experiments} \label{sec:exp} The proposed Supervised Smoothed Manifold (SSM) is evaluated on five popular benchmarks, including GRID~\cite{GRID1,GRID2}, VIPeR~\cite{VIPeR_ELF}, PRID450S~\cite{PRID450S}, CUHK03~\cite{Deepreid} and Market-1501~\cite{market1501}. In the implementations of SSM, we do not carefully tune parameters, but fix $\alpha=0.1$ and the number of iterations $T=30$ throughout our experiments. The affinity graph is constructed by applying self-tuning~\cite{self-tuning} Gaussian kernel to pairwise distances following~\cite{person_manifold_ranking}. \subsection{QMUL GRID} QMUL underGround Re-IDentification (GRID)~\cite{GRID1,GRID2} is a challenging dataset, which has gradually become popular. The variations in the pose, colors and illuminations of pedestrians, as well as the poor image quality, make it very difficult to yield high matching accuracies. GRID dataset consists of $250$ identities, with each identity having two images seen from different camera views. Besides, $775$ additional images that do not belong to the $250$ identities are used to enlarge the gallery. Sample images can be found in Fig.~\ref{fig:pipeline}. A fixed training/testing split with $10$ trials is provided. For each trial, $125$ image pairs are used for training. The remaining $125$ image pairs and the $775$ background images are used for testing. To evaluate the performances, we employ Cumulated Matching Characteristics (CMC) curves and the cumulated matching accuracy at selected ranks. To obtain the image representations, we utilize two representative descriptors,~\emph{i.e.},~Local Maximal Occurrence (LOMO)~\cite{XQDA} and Gaussian Of Gaussian (GOG)~\cite{GOG}. In addition, ELF6 feature~\cite{ELF6}, provided along with the dataset, is also tested to ensure the fair comparison. \vspace{1ex}\noindent\textbf{Comparison with Baselines.}~In Table~\ref{table:baseline_GRID900}, we present the performances before and after SSM is used. Besides the three individual visual features, two types of fused features are also used. \emph{Fusion} means the concatenation of LOMO and GOG, while \emph{Fusion$^\star$} means the concatenation of all the three features, both with equal weights. The pairwise distances between instances are computed in metric space. In our experiments, besides the natural choice of Euclidean metric, we also evaluate Cross-view Quadratic Discriminant Analysis (XQDA)~\cite{XQDA} which is taken as a representative of metric learning techniques. \begin{table}[tb] \small \centering \begin{tabular}{|l|*{2}{p{0.9cm}<{\centering}}|*{3}{p{0.95cm}<{\centering}}|} \hline Feature & Metric & Affinity & r=1 & r=10 & r=20 \\ \hline \hline ELF6 & Euclidean & $\times$ & 4.64 & 19.60 & 28.00 \\ ELF6 & Euclidean & $\surd$ & 6.96 & 23.44 & 34.08 \\ ELF6 & XQDA & $\times$ & 10.48 & 38.64 & \textbf{52.56} \\ ELF6 & XQDA & $\surd$ & \textbf{11.04} & \textbf{40.72} & 51.76 \\ \hline \hline LOMO & Euclidean & $\times$ & 15.20 & 30.80 & 36.40 \\ LOMO & Euclidean & $\surd$ & 16.00 & 33.68 & 41.60 \\ LOMO & XQDA & $\times$ & 16.56 & 41.84 & 52.40 \\ LOMO & XQDA & $\surd$ & \textbf{18.96} & \textbf{44.16} & \textbf{55.92} \\ \hline \hline GOG & Euclidean & $\times$ & 13.28 & 33.76 & 44.40 \\ GOG & Euclidean & $\surd$ & 14.40 & 36.80 & 44.48 \\ GOG & XQDA & $\times$ & 24.80 & 58.40 & 68.88 \\ GOG & XQDA & $\surd$ & \textbf{26.16} & \textbf{59.20} & \textbf{70.40} \\ \hline \hline Fusion & Euclidean & $\times$ & 14.72 & 35.44 & 45.84 \\ Fusion & Euclidean & $\surd$ & 17.76 & 37.60 & 44.48 \\ Fusion & XQDA & $\times$ & 27.04 & 59.36 & 70.00 \\ Fusion & XQDA & $\surd$ & \textbf{27.20} & \textbf{61.12} & \textbf{70.56} \\ \hline \hline Fusion$^\star$ & Euclidean & $\times$ & 14.80 & 35.60 & 46.24\\ Fusion$^\star$ & Euclidean & $\surd$ & 15.92 & 35.60 & 46.40\\ Fusion$^\star$ & XQDA & $\times$ & 27.20 & 61.12 & 71.20 \\ Fusion$^\star$ & XQDA & $\surd$ & \textbf{27.60} & \textbf{62.56} & \textbf{71.60} \\ \hline \end{tabular} \caption{The comparison with baselines on GRID dataset. $\surd$ indicates SSM is used and $\times$ indicates not used.} \label{table:baseline_GRID900} \vspace{-2ex} \end{table} As can be drawn, SSM leads to considerable performance gains against the baselines. For example, with ELF6 in Euclidean metric, the improvement of identification rate brought by SSM is $2.32$ at rank-$1$, $3.84$ at rank-$10$ and $6.08$ at rank-$10$. Meanwhile, by integrating XQDA, SSM can still boost the performances further. For example, the rank-1 accuracy of LOMO with XQDA is originally $16.56$, then increased to $18.96$ after the proposed SSM is used. Those experimental results suggest that most existing visual features or metric learning algorithms in person re-identification are compatible with SSM. In other words, after visual features are given, person re-identification systems can be improved with two steps,~\emph{i.e.},~applying metric learning first, and applying SSM next. As a related work to ours, manifold ranking~\cite{person_manifold_ranking} reports an identification rate of $30.96$ at rank-20 using ELF6 and Euclidean metric, which is significantly lower than $34.08$ achieved by SSM. It clearly demonstrates that it is beneficial to exploit the supervision information in affinity learning step. To avoid the performance uncertainty (though rather tiny) led by different implementation details, we compare SSM with manifold ranking using exactly the same affinity graph. The results are given in Fig.~\ref{fig:ELF6}. As we can see, the rank-1 accuracy of both manifold ranking and SSM is $6.96$. However, SSM outperforms manifold ranking by a large margin at higher ranks. The difference of accuracy is nearly $10$ at rank-100. \begin{figure}[tb] \centering \includegraphics[width = 0.35\textwidth]{./figures/ELF6_cropped.pdf} \caption{The comparison between the proposed SSM and Manifold Ranking with the same affinity graph.} \label{fig:ELF6} \vspace{-2ex} \end{figure} One of the most important properties of SSM is its high time efficiency in on-line pedestrian matching. Here, we omit the overhead in constructing the affinity graph, which can be done off-line. Under the same computing platform, manifold ranking takes $14.40$ seconds in total to fulfill searching $125$ probe instances, while SSM only needs $9.52ms$. One can easily find that SSM is $3$ orders of magnitude faster than manifold ranking. The reason behind is that the iteration of manifold ranking is conducted each time a new probe is observed. In comparison, SSM proposes to do affinity learning only off-line, and embed the probe smoothly into the manifold. As a result, although SSM has to do affinity learning on a much larger graph (to leverage the supervision from training data), the on-line cost can be controlled so that SSM has the potential ability of handling large-scale person re-identification. We will further discuss this aspect below. From Table~\ref{table:baseline_GRID900}, failure cases of SSM can be also observed. As it suggests, the rank-20 accuracy of ELF6 under XQDA metric is originally $52.56$, then is decreased slightly by SSM to $51.76$. The reason behind such abnormal phenomena is that the principle of SSM is to obtain a global similarity measure between each two instances, which varies smoothly with respect to the local geometry of the underlying manifold. The learned similarity cannot guarantee that the identification rate at specifical ranks will be improved. But in general cases, the overall performances will be refined. \vspace{1ex}\noindent\textbf{Comparison with State-of-the-art.}~In Table~\ref{table:art_GRID900}, we give a thorough comparison with other state-of-the-art methods. The performances of the proposed SSM are reported by using \emph{Fusion} feature (the concatenation of LOMO and GOG) under XQDA metric, which is a default configuration used in our later experiments. Previous state-of-the-art performances are achieved by Spatially Constrained Similarity function on Polynomial feature map (SCSP)~\cite{SCSP} and GOG~\cite{GOG}. Chen~\emph{et al}.~\cite{SCSP} impose spatially constraints to the similarity learning on polynomial feature map~\cite{PolyMap}, and report rank-1 accuracy $24.24$ by fusing $6$ visual cues. GOG~\cite{GOG} is a powerful descriptor proposed recently, which captures the mean and the covariance information of pixel features. With XQDA metric, it reports the best performances on GRID dataset,~\emph{i.e.},~rank-1 accuracy $24.80$. Benefiting from~\emph{Fusion} feature and XQDA metric, SSM easily sets a new state-of-the-art performance, outperforming the previous by $2.40$ in rank-1 accuracy. We emphasize that SSM is not restricted by the used descriptor and metric. Table~\ref{table:baseline_GRID900} presents that SSM can achieve higher performances with \emph{Fusion$^\star$} feature. \begin{table}[tb] \small \centering \begin{tabular}{|l|*{3}{p{1cm}<{\centering}}|} \hline Methods & r=1 & r=10 & r=20 \\ \hline \hline ELF6+RankSVM~\cite{RankSVM} & 10.24 & 33.28 & 43.68 \\ ELF6+PRDC~\cite{PRDC} & 9.68 & 32.96 & 44.32 \\ ELF6+RankSVM+MR~\cite{person_manifold_ranking} & 12.24 & 36.32 & 46.56 \\ ELF6+PRDC+MR~\cite{person_manifold_ranking} & 10.88 & 35.84 & 46.40 \\ ELF6 + XQDA~\cite{XQDA} & 10.48 & 38.64 & 52.56 \\ LOMO + XQDA~\cite{XQDA} & 16.56 & 41.84 & 52.40 \\ MLAPG~\cite{MLAPG} & 16.64 & 41.20 & 52.96 \\ NLML~\cite{NLML} & 24.54 & 43.53 & 55.25 \\ PolyMap~\cite{PolyMap} & 16.30 & 46.00 & 57.60 \\ SSDAL~\cite{SuChi2} & 22.40 & 48.00 & 58.40 \\ MtMCML~\cite{MtMCML} & 14.08 & 45.84 & 59.84 \\ LSSCDL~\cite{LSSCDL} & 22.40 & 51.28 & 61.20 \\ KEPLER~\cite{KEPLER} & 18.40 & 50.24 & 61.44 \\ DR-KISS~\cite{DR-KISS} & 20.60 & 51.40 & 62.60 \\ SCSP~\cite{SCSP} & 24.24 & 54.08 & 65.20 \\ GOG+XQDA~\cite{GOG} & \textbf{\color{blue}{24.80}} & \textbf{\color{blue}{58.40}} & \textbf{\color{blue}{68.88}} \\ \hline \hline SSM (Ours) & \textbf{\color{red}{27.20}} & \textbf{\color{red}{61.12}} & \textbf{\color{red}{70.56}} \\ \hline \end{tabular} \caption{The comparison with state-of-the-art on GRID dataset. The best and second best performances are marked in red and blue, respectively.} \label{table:art_GRID900} \vspace{-2ex} \end{table} \subsection{VIPeR, PRID450S and CUHK03} VIPeR~\cite{VIPeR_ELF} is a widely-accepted benchmark for person re-identification containing $632$ identities, and PRID450S~\cite{PRID450S} consists of $450$ identities, both captured by two disjoint cameras. The widely adopted experimental protocol on two datasets is that a random selection of half persons is used for training and the rest for testing. The procedure is repeated for $10$ times, then the average performances are reported. CUHK03~\cite{Deepreid} is among the largest public available benchmarks nowadays. It includes $13,164$ images of $1,360$ persons, with each person having $4.8$ images on average. Besides manually cropped images, auto detected images are also provided. Following the conventional experimental setup~\cite{Deepreid,XQDA,MLAPG,GOG,null}, $1,160$ persons are used for training and $100$ persons are used for testing. The experiments are conducted in single-shot setting with $20$ random splits. In Table~\ref{table:VIPeR_PRID450s_CUHK03}, we present the performances of SSM and the baselines, where distances are calculated under XQDA metric. Consistent to previous experiments, SSM can easily boost the performances of baselines by around $2.5$ percent on average. In particular, the performance improvements are more dramatic on CUHK03. For example, the rank-1 accuracy of \emph{Fusion} is increased by $4.76$ on CUHK03 labeled dataset, and by $4.65$ on CUHK03 detected dataset. The preference of SSM on larger datasets stems from the fact that the manifold structure can be better sampled given more data points. \begin{table*}[tb] \small \centering \begin{tabular}{|l|*{3}{p{0.8cm}<{\centering}}|*{3}{p{0.8cm}<{\centering}}|*{3}{p{0.8cm}<{\centering}}|*{3}{p{0.8cm}<{\centering}}|} \hline \multirow{2}{*}{Methods} & \multicolumn{3}{c|}{VIPeR} & \multicolumn{3}{c|}{PRID450S} & \multicolumn{3}{c|}{CUHK03 (labeled)} & \multicolumn{3}{c|}{CUHK03 (detected)} \\ \cline{2-13} & r=1 & r=10 & r=20 & r=1 & r=10 & r=20 & r=1 & r=5 & r=10 & r=1 & r=5 & r=10 \\ \hline \hline LOMO & 40.00 & 80.51 & 91.08 & 61.38 & 91.02 & 95.33 & 50.85 & 81.38 & 91.14 & 44.45 & 78.70 & 87.65 \\ LOMO++SSM & 42.22 & 83.54 & 92.82 & 62.84 & 92.62 & 96.49 & 52.50 & 84.53 & 92.49 & 49.05 & 81.25 & 90.30 \\ GOG & 49.72 & 88.67 & 94.53 & 68.00 & 94.36 & 97.64 & 68.47 & 90.69 & 95.84 & 64.10 & 88.40 & 94.30 \\ GOG+SSM & 50.73 & 89.97 & 95.63 & 68.49 & 95.73 & 98.53 & 71.82 & 92.54 & 96.64 & 68.20 & 90.30 & 94.10 \\ Fusion & 53.26 & 90.95 & 95.73 & 72.04 & 95.82 & 98.49 & 71.87 & 92.64 & 96.80 & 68.05 & 90.15 & 94.95 \\ Fusion+SSM & \textbf{53.73} & \textbf{91.49} & \textbf{96.08} & \textbf{72.98} & \textbf{96.76} & \textbf{99.11} & \textbf{76.63} & \textbf{94.59} & \textbf{97.95} & \textbf{72.70} & \textbf{92.40} & \textbf{96.05}\\ \hline \end{tabular} \caption{The comparison with baselines on VIPeR, PRID450S and CUHK03 dataset.} \label{table:VIPeR_PRID450s_CUHK03} \vspace{-2ex} \end{table*} \vspace{1ex}\noindent\textbf{Comparison on VIPeR.}~Since enormous algorithms have reported results on VIPeR dataset, it is less realistic to exhibit all of them. Hence, we only include those published in recent $3$ years or have close relationships with our work. \begin{table}[tb] \small \centering \begin{tabular}{|lc|*{3}{p{0.65cm}<{\centering}}|} \hline Methods & Ref & r=1 & r=10 & r=20 \\ \hline \hline Local Fisher~\cite{local_fisher} & CVPR2013 & 24.18 & 67.12 & - \\ eSDC~\cite{eSDC} & CVPR2013 & 26.74 & 62.37 & 76.36 \\ SalMatch~\cite{SalMatch} & ICCV2013 & 30.16 & - & - \\ Mid-Filter~\cite{Mid-Filter} & CVPR2014 & 29.11 & 65.95 & 79.87 \\ SCNCD~\cite{SCNCD} & ECCV2014 & 37.80 & 81.20 & 90.40 \\ \hline \hline ImprovedDeep~\cite{ImprovedDeep} & CVPR2015 & 34.81 & - & - \\ PolyMap~\cite{PolyMap} & CVPR2015 & 36.80 & 83.70 & 91.70 \\ XQDA~\cite{XQDA} & CVPR2015 & 40.00 & 80.51 & 91.08 \\ Semantic~\cite{Semantic} & CVPR2015 & 41.60 & 86.20 & 95.10\\ MetricEmsemb.~\cite{MetricEmsemble} & CVPR2015 & 45.90 & 88.90 & 95.80 \\ QALF~\cite{zheng2015query} & ICCV2015 & 30.17 & 62.44 & 73.81 \\ CSL~\cite{CSL} & ICCV2015 & 34.80 & 82.30 & 91.80 \\ MLAPG~\cite{MLAPG} & ICCV2015 & 40.73 & 82.34 & 92.37\\ MTL-LORAE~\cite{SuChi1} & ICCV2015 & 42.30 & 81.60 & 89.60 \\ DCIA~\cite{DCIA} & ICCV2015 & \textbf{\color{red}{63.92}} & 87.50 & - \\ \hline \hline DGD~\cite{DGD} & CVPR2016 & 38.60 & - & - \\ LSSCDL~\cite{LSSCDL} & CVPR2016 & 42.66 & 84.27 & 91.93 \\ TPC~\cite{TPC} & CVPR2016 & 47.80 & 84.80 & 91.10 \\ GOG~\cite{GOG} & CVPR2016 & 49.72 & 88.67 & 94.53 \\ Null~\cite{null} & CVPR2016 & 51.17 & \textbf{\color{blue}{90.51}} & 95.92 \\ SCSP~\cite{SCSP} & CVPR2016 & 53.54 & \textbf{\color{red}{91.49}} & \textbf{\color{red}{96.65}} \\ S-CNN~\cite{S-CNN} & ECCV2016 & 37.80 & 66.90 & - \\ Shi~\emph{et al}.~\cite{shi2016embedding} & ECCV2016 & 40.91 & - & - \\ $\ell$1-graph~\cite{L1_graph} & ECCV2016 & 41.50 & - & - \\ S-LSTM~\cite{S-LSTM} & ECCV2016 & 42.40 & 79.40 & - \\ SSDAL~\cite{SuChi2} & ECCV2016 & 43.50 & 81.50 & 89.00\\ TMA~\cite{TMA} & ECCV2016 & 48.19 & 87.65 & 93.54 \\ \hline \hline SSM (Ours) & & \textbf{\color{blue}{53.73}} & \textbf{\color{red}{91.49}} & \textbf{\color{blue}{96.08}} \\ \hline \end{tabular} \caption{The comparison with state-of-the-art on VIPeR dataset.} \label{table:VIPeR_art} \vspace{-1ex} \end{table} The comparison is given in Table~\ref{table:VIPeR_art}. As can be seen, SSM yields the best rank-10 accuracy $91.49$, which is the same as SCSP~\cite{SCSP}. Meanwhile, SSM also achieves the second best performances at rank-1 and rank-20. To our best knowledge now, the best rank-1 accuracy is achieved by Discriminant Context Information Analysis (DCIA)~\cite{DCIA}. The superiority of DCIA at rank-1 lies in that it tries to remove the visual ambiguities between the probe and its true match, which is supposed to be located at the first rank. By contrast, SSM does not hold such assumptions, which seem to be a bit strict in realistic settings. Thus, one can also observe that SSM outperforms DCIA by $3.99$ at rank-10. Considering their inherent difference of principles, it can be anticipated that SSM and DCIA can benefit from each other, and a proper ensemble of them can lead to better performances. \vspace{1ex}\noindent\textbf{Comparison on PRID450S.}~On PRID450S dataset, SSM provides the state-of-the-art performances on all the three evaluation metrics,~\emph{i.e.},~$72.98$ at rank-1, $96.76$ at rank-10, and $99.11$ at rank-20. \begin{table}[tb] \small \centering \begin{tabular}{|p{2cm}p{1.6cm}<{\centering}|*{3}{p{0.85cm}<{\centering}}|} \hline Methods & Ref & r=1 & r=10 & r=20 \\ \hline \hline SCNCD~\cite{SCNCD} & ECCV2014 & 41.60 & 79.40 & 87.80 \\ Semantic~\cite{Semantic} & CVPR2015 & 44.90 & 77.50 & 86.70 \\ CSL~\cite{CSL} & ICCV2015 & 44.40 & 82.20 & 89.80 \\ XQDA~\cite{XQDA} & CVPR2015 & 61.38 & 91.02 & 95.33 \\ TMA~\cite{TMA} & ECCV2016 & 52.89 & 85.78 & 93.33 \\ LSSCDL~\cite{LSSCDL} & CVPR2016 & 60.49 & 88.58 & 93.60 \\ GOG~\cite{GOG} & CVPR2016 & \textbf{\color{blue}{68.40}} & \textbf{\color{blue}{94.50}} & \textbf{\color{blue}{97.80}} \\ \hline \hline SSM (Ours) & & \textbf{\color{red}{72.98}} & \textbf{\color{red}{96.76}} & \textbf{\color{red}{99.11}} \\ \hline \end{tabular} \caption{The comparison with state-of-the-art on PRID450S.} \label{table:PRID450S_art} \vspace{-1ex} \end{table} \vspace{1ex}\noindent\textbf{Comparison on CUHK03.}~The comparison on CUHK03 dataset is given in Table~\ref{table:CUHK03_art}. As it shows, the rank-1 identification rate of SSM is $72.7$ with automatically detected bounding boxes, which is the first work reporting rank-1 accuracy larger than $70$. \begin{table}[tb] \small \centering \begin{tabular}{|l|*{3}{p{0.44cm}<{\centering}}|*{3}{p{0.44cm}<{\centering}}|} \hline \multirow{2}{*}{Methods} & \multicolumn{3}{c|}{Labeled} & \multicolumn{3}{c|}{Detected}\\ \cline{2-7} & r=1 & r=5 & r=10 & r=1 & r=5 & r=10 \\ \hline \hline DeepReID~\cite{Deepreid} & 20.7 & 51.7 & 68.3 & 19.9 & 49.0 & 64.3 \\ XQDA~\cite{XQDA} & 52.2 & - & - & 46.3 & - & - \\ ImprovedDeep~\cite{ImprovedDeep} & 54.7 & 88.3 & 93.3 & 45.0 & 75.7 & 83.0 \\ LSSCDL~\cite{LSSCDL} & 57.0 & - & - & 51.2 & - & - \\ MLAPG~\cite{MLAPG} & 58.0 & - & - & 51.2 & - & - \\ Shi~\emph{et al}.~\cite{shi2016embedding} & 61.3 & - & - & 52.0 & - & - \\ MetricEmsemb.~\cite{MetricEmsemble} & 62.1 & 89.1 & 94.3 & - & - & -\\ Null~\cite{null} & 62.5 & 90.0 & 94.8 & 54.7 & 84.7 & \textbf{\color{blue}{94.8}} \\ S-LSTM~\cite{S-LSTM} & - & - & - & 57.3 & 80.1 & 88.3 \\ S-CNN~\cite{S-CNN} & - & - & - & 61.8 & 80.9 & 88.3 \\ GOG~\cite{GOG} & 67.3 & \textbf{\color{blue}{91.0}} & \textbf{\color{blue}{96.0}} & \textbf{\color{blue}{65.5}} & \textbf{\color{blue}{88.4}} & 93.7 \\ DGD~\cite{DGD} & \textbf{\color{blue}{75.3}} & - & - & - & - & - \\ \hline \hline SSM (Ours) & \textbf{\color{red}{76.6}} & \textbf{\color{red}{94.6}} & \textbf{\color{red}{98.0}} & \textbf{\color{red}{72.7}} & \textbf{\color{red}{92.4}} & \textbf{\color{red}{96.1}}\\ \hline \end{tabular} \caption{The comparison with state-of-the-art on CUHK03 dataset.} \label{table:CUHK03_art} \vspace{-1ex} \end{table} In~\cite{null}, Zhang~\emph{et al}.~overcome the small sample size (SSS) problem by matching people in a discriminative null space of the training data, which report the second best performance $94.8$ at rank-10 with automatically detected bounding boxes. Nevertheless, the performance gap with SSM becomes larger at lower ranks. For instance, SSM makes a significant improvement of $18.0$ in rank-1 accuracy over Null~\cite{null} with detected bounding boxes. GOG remains to be one of the most robust descriptors on this dataset. Under XQDA metric, it achieves the second best performances at most ranks. As analyzed above, SSM can be deemed as a generic tool for those visual descriptors and metric learning techniques. Thus, SSM can further enhance their discriminative power. \subsection{Market-1501} Market-1501~\cite{market1501} is the largest benchmark in person re-identification up to present, which is comprised of $1501$ identities. $750$ identities ($12,936$ images) are used for training and $751$ identities ($19,732$ images) are used for testing. $3,368$ images are taken as the probe. Both CMC scores and mean average precision (mAP) are used for evaluation. Thanks to plenty of training images provided, training deep neural networks becomes feasible on this dataset and preferred by most previous works~\cite{SuChi2,S-LSTM,S-CNN}. Following this trend, we introduce Residual Network (ResNet)~\cite{ResNet}, for the first time, to person re-identification. More specifically, we fine-tune a 50-layer ResNet with classification loss on training images, and extract activations of its last fully connected layer. The $L_2$ normalized activations are taken as visual features and Euclidean metric is utilized to measure the distances between images. The baseline performances are mAP $61.12$ with single query (SQ) and $70.82$ with multiple query (MQ), respectively. In Table~\ref{table:market1501_art}, we present the experimental comparisons. As can be seen, SSM improves the baseline by mAP $7.68$ for SQ and $5.30$ for MQ. Moreover, SSM outperforms the previous state-of-the-art~\cite{S-CNN} by a very large margin, with the improvement of mAP $29.25$ for SQ and $27.73$ for MQ. \begin{table}[tb] \small \centering \begin{tabular}{|l|*{2}{p{1.1cm}<{\centering}}|*{2}{p{1.1cm}<{\centering}}|} \hline \multirow{2}{*}{Methods} & \multicolumn{2}{c|}{Single Query} & \multicolumn{2}{c|}{Multiple Query}\\ \cline{2-5} & Rank-1 & mAP & Rank-1 & mAP \\ \hline \hline SSDAL~\cite{SuChi2} & 39.40 & 19.60 & 49.00 & 25.80 \\ WARCA~\cite{WARCA} & 45.16 & - & - & - \\ SCSP~\cite{SCSP} & 51.90 & 26.35 & - & - \\ S-LSTM~\cite{S-LSTM} & - & - & 61.60 & 35.31 \\ Null~\cite{null} & 61.02 & 35.68 & 71.56 & 46.03 \\ S-CNN~\cite{S-CNN} & \textbf{\color{blue}{65.88}} & \textbf{\color{blue}{39.55}} & \textbf{\color{blue}{76.04}} & \textbf{\color{blue}{48.45}} \\ \hline \hline SSM (Ours) & \textbf{\color{red}{82.21}} & \textbf{\color{red}{68.80}} & \textbf{\color{red}{88.18}} & \textbf{\color{red}{76.18}} \\ \hline \end{tabular} \caption{The comparison with state-of-the-art on Market-1501.} \label{table:market1501_art} \vspace{-1ex} \end{table} \subsection{Time Analysis} As an additional improvement over metric learning, SSM introduces extra time cost without doubt as analyzed in Sec.~\ref{sec:complexity}. In Table~\ref{table:time}, we present the extra execution time of SSM over XQDA metric. \begin{table}[tb] \small \centering \begin{tabular}{|l|*{2}{p{1.15cm}<{\centering}}|*{2}{p{1.15cm}<{\centering}}|} \hline \multirow{2}{*}{Datasets} & \multicolumn{2}{c|}{Off-line} & \multicolumn{2}{c|}{On-line}\\ \cline{2-5} & \#M & \#A & \#M & \#A \\ \hline \hline GRID & 0.90$s$ & +2.38$s$ & 0.17$s$ & +10.3$ms$ \\ VIPeR & 2.19$s$ & +2.22$s$ & 0.19$s$ & +10.2$ms$ \\ PRID450S & 1.21$s$ & +0.78$s$ & 0.12$s$ & +3.80$ms$ \\ CUHK03 & 789.6$s$ & +1952$s$ & 0.09$s$ & +0.516$s$ \\ Market1501 & - & +2769$s$ & 146.11$s$ & +21.68$s$ \\ \hline \end{tabular} \caption{\#M denotes the initial time cost of metric learning using XQDA. \#A denotes the extra cost brought by the proposed SSM.} \label{table:time} \vspace{-2ex} \end{table} As SSM manages transferring the graph-based affinity learning to off-line, the off-line cost is increased especially on larger datasets (\emph{e.g.},~CUHK03 and Market-1501). In on-line stage, the extra indexing time brought by SSM only occupies a small percentage on all the datasets except CUHK03. On CUHK03 dataset, indexing using XQDA metric only requires $0.09s$, since CUHK03 has a small gallery. As SSM takes into account the larger training data provided by CUHK03, the extra indexing cost is $0.516s$. Nevertheless, the overall indexing time is still within $1$ second. \section{Conclusion} \label{sec:con} In this paper, we do not design robust features or metrics that are superior to others in person re-identification. Instead, we contribute a generic tool called Supervised Smoothed Manifold (SSM), upon which most existing algorithms can easily boost their performances further. SSM is very easy to implement. It can also handle the special kind of labeled data and has potential capacity in large scale ReID. Comprehensive experiments on five benchmarks demonstrate that SSM not only achieves the best performances, but more importantly, incurs acceptable extra on-line cost. In the furture, we will investigate how to effectively fuse multiple features~\cite{MetricEmsemble} and apply the proposed SSM to other datasets~\cite{OIM}. {\small \bibliographystyle{ieee}
{'timestamp': '2017-03-27T02:06:15', 'yymm': '1703', 'arxiv_id': '1703.08359', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08359'}
arxiv
\section{Related Work and Conclusion}\label{section:related} Constructive type theory, which was originally proposed by Martin-L{\"o}f for the purpose of establishing a foundation for mathematics, requires pure reasoning on programs. Generalizing as well as extending Martin-L{\"o}f's work, the framework Pure Type System ($\underline{\bf PTS}$) offers a simple and general approach to designing and formalizing type systems. However, type equality depends on program equality in the presence of dependent types, making it highly challenging to accommodate effectful programming features as these features often greatly complicate the definition of program equality~~\cite{CONSTABLE87,MENDLER87,HMST95,HN88}. The framework {\em Applied Type System} ($\underline{\bf ATS}$)~\cite{ATS-types03} introduces a complete separation between statics, where types are formed and reasoned about, and dynamics, where programs are constructed and evaluated, thus eliminating by design the need for pure reasoning on programs in the presence of dependent types. The development of $\underline{\bf ATS}$ primarily unifies and also extends the previous studies on both Dependent ML (DML)~\cite{XP99,DML-jfp07} and guarded recursive datatypes~\cite{GRDT-popl03}. DML enriches ML with a restricted form of dependent datatypes, allowing for specification and inference of significantly more precise type information (when compared to ML), and guarded recursive datatypes can be thought of as an impredicative form of dependent types in which type indexes are themselves types. Given the similarity between these two forms of types, it is only natural to seek a unified presentation for them. Indeed, both DML-style dependent types and guarded recursive datatypes are accommodated in $\underline{\bf ATS}$. In terms of theorem-proving, there is a fundamental difference between $\underline{\bf ATS}$ and various theorem-proving systems such as NuPrl~\cite{CONSTABLE86} (based on Martin-L{\"o}f's constructive type theory) and Coq~\cite{Dowek93tr} (based on the calculus of construction~\cite{COQUAND88A}). In $\underline{\bf ATS}$, proof construction is solely meant for constraint simplification and proofs are not expected to contain any computational meaning. On the other hand, proofs in NuPrl and Coq are required to be constructive as they are meant for supporting program extraction. The theme of combining programming with theorem-proving is also present in the programming language $\Omega$emga~\cite{LanguagesOfTheFuture}. The type system of $\Omega$emga is largely built on top of a notion called {\em equality constrained types} (a.k.a. phantom types~\cite{PhantomTypes}), which are closely related to the notion of guarded recursive datatypes~\cite{GRDT-popl03}. In $\Omega$emga, there seems no strict separation between programs and proofs. In particular, proofs need to be constructed at run-time. In addition, an approach to simulating dependent types through the use of type classes in Haskell is given in~\cite{FakingIt}, which is casually related to proof construction in the design of $\underline{\bf ATS}$. Please also see~\cite{CUTELIMpadl04} for a critique on the practicality of simulating dependent types in Haskell. In summary, a framework $\underline{\bf ATS}$ is presented in this paper to facilitate the design and formalization of type systems to support practical programming. With a complete separation between statics and dynamics, $\underline{\bf ATS}$ removes by design the need for pure reasoning on programs in the presence of dependent types. Additionally, $\underline{\bf ATS}$ allows programming and theorem-proving to be combined in a syntactically intertwined manner, providing the programmer with an approach to internalizing constraint-solving through explicit proof-construction. As a minimalist formulation of $\underline{\bf ATS}$, $\mbox{ATS}_0$ is first presented and its type-soundness formally established. Subsequently, $\mbox{ATS}_0$ is extended to $\mbox{ATS}_{\it pf}$ so as to support programming with theorem-proving, and the correctness of this extension is proven based on a translation often referred to as proof-erasure, which turns each well-typed program in $\mbox{ATS}_{\it pf}$ into a corresponding well-typed program in $\mbox{ATS}_0$ of the same dynamic semantics. \bibliographystyle{jfp}
{'timestamp': '2017-03-28T02:03:53', 'yymm': '1703', 'arxiv_id': '1703.08683', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08683'}
arxiv
\section{Introduction} \label{sec:intro} A central theme of neuroscience is to understand how a brain's functions are related to its neuronal structure~\cite{Ref:Lichtman11}. This is difficult because of the small size of neurons and the extremely high packing density of the neuropil, e.g., neurons densely packed axons and dendrites~\cite{Ref:Helmstaedter13}. Recent advances in high-throughput serial section electron microscopy (EM) have made possible the imaging of large volumes of neuronal tissue at high resolution, allowing neuroscience experts to reconstruct neuronal circuits and study the interconnections of neurons~\cite{Ref:Sporns05}. However, analysis of a large number of EM images by expert annotators is laborious and even impractical~\cite{Ref:Helmstaedter13}, which drives the demand for efficient automated neuronal circuit reconstruction approaches. Serial section EM produces a stack of 2D images by cutting sections of brain tissue. Due to the anisotropic resolutions of in-plane and out-of-plane, most neuronal circuit reconstruction approaches follow the following pipeline: (1) neuronal boundary detection on each 2D image, (2) neuronal structure segmentation based on the 2D boundary map, and (3) linking the neuronal segments across 2D images into a 3D reconstruction result. This paper focuses on neuronal boundary detection on 2D images from serial section EM, also called membrane detection, which is the essential first step of the reconstruction pipeline. The challenges of this problem, as can be seen from Fig.~\ref{fig:img_edge_seg}, mainly lie in the following aspects: (1) The variation of the membranal thickness is large, as thin as a filament to as thick as a blob. (2) The noise of EM acquisition makes the membrane contrast to be low, inducing some membranal boundaries are even invisible. (3) The presence of confounding structures, such as mitochondria and vesicles, also increases the difficulty in membrane detection. \begin{figure}[!t] \centering \includegraphics[trim=4cm 12cm 1cm 3cm, clip=true, width=1.0\linewidth]{img_edge_seg.pdf} \caption{Neuronal structure segmentation: an EM image (a) and the ground truths for its neuronal boundary detection result (b) and segmentation result (c), respectively.}\label{fig:img_edge_seg} \end{figure} Driven by the rapid process of deep neural networks, more and more deep learning based methods have been proposed for neuronal boundary detection on EM images, achieving considerable progress~\cite{Ref:Ciresan12,Ref:Chen16,Ref:Fakhry17,Ref:Quan16,Ref:Lee15}. However, most of them only focus on how to improve detection performance by using the deep learning strategies shown to be effective on general computer vision problems, like image classification~\cite{Ref:Krizhevsky12,Ref:Simonyan14,Ref:He16}, semantic segmentation~\cite{Ref:Long15} and boundary/symmetry detection~\cite{Ref:Shen15,Ref:Xie15,Ref:Shen16}. For example, using fully convolutional networks enables holistic image training instead of patch-by-patch training~\cite{Ref:Chen16}; deeply supervised learning hierarchical representations~\cite{Ref:Chen16}; using residual structures rather than plain structures~\cite{Ref:Fakhry17,Ref:Quan16}. Although these strategies indeed improve membrane detection results, they lack an interpretation for this problem, i.e., how can membranes be detected and intracellular structures be suppressed meanwhile, even the contrasts of intracellular structures to context are much higher than those of membranes? In this paper, we propose multi-stage multi-recursive-input fully convolutional networks ($\text{M}^2$FCN) for neuronal boundary detection. The architecture of $\text{M}^2$FCN is shown in Fig.~\ref{fig:network}. The whole net consists of multiple stages, where each stage generates multiple side outputs by imposing supervision at different levels~\cite{Ref:LeeXie15,Ref:Xie15} of the sub-net in this stage, and all these side outputs are concatenated with the original image to serve as the inputs for the next stage. From a neurobiological prospective, this network architecture is biologically-plausible. First, as explained in~\cite{Ref:Lee15}, this recursive framework is in accord with the interplay process, named ``countercurrent disambiguating process''~\cite{Ref:Chen14}, between the primary and higher visual cortical areas (V1 and V4, respectively) in monkeys' brains, found by examining monkeys' performances on contour detection tasks. The latter stages of our networks act as V4 to detect the overall ``contour'' of neuronal boundaries and feed top-down influence to the early stages, which acts as V1, to enhance the activation on neuronal boundaries while suppressing those on intracellular structures. Second, as pointed out in~\cite{Ref:Helmstaedter13}, the ambiguous neuronal boundaries make segmentation difficult, and this issue can only be resolved when explicitly comparing the different possible segmentation solutions, which is what the human visual system may compute when inspecting this situation. We can roughly think that of the multiple recursive inputs, computed at the different levels in the previous stage, provide different possible segmentation solutions for training of the next stage. We show that using multiple recursive inputs is very important in our experiments, as it leads to much better results than using a single recursive input. From the deep learning view, our networks take several advantages of the latest deep learning strategies to facilitate the learning of a neuronal boundary detection model, including (1) holistic image training and prediction benefited from using the architecture of fully convolutional neural networks, (2) supervised multi-scale feature learning at each level of each stage and (3) learning multi-stages in an end-to-end fashion, different from previous recursive approaches~\cite{Ref:Tu08,Ref:Lee15,Ref:Jurrus10,Ref:Dollar10} which learn a series of classifiers stepwise. Using multiple recursive inputs rather than one is a major difference between our networks and~\cite{Ref:Lee15}. Note that, the multiple recursive inputs for one stage are the multiple side outputs computed at the levels having different scales (receptive field sizes). In general, a side output with a small scale has better ability than one with larger scale for detecting a thin neuronal boundary between cluttered neurons. Conversely, a side output computed at a large scale can suppresses the false predictions on intracellular structures by using more image context. Therefore, these multiple recursive inputs provide richer information than one for the learning of next stage. We show that introducing these strategies in our networks can improve the performance of neuronal boundary detection. We verify our networks on two public available EM segmentation datasets. One is the mouse piroform cortex EM dataset~\cite{Ref:Lee15}, a sizable and important EM dataset, contains 4 stacks of EM images of mouse piriform cortex, covering 460 images for training and 168 images for testing. We analyze alternative designs in our network architecture on this dataset and show it outperforms the state-of-the-arts~\cite{Ref:Lee15}. The other is the dataset used for ISBI 2012 EM segmentation challenge~\cite{Ref:Ronneberger15}, covering 30 images for training and 30 images for testing. Our networks can achieve a comparable result to the state-of-the art~\cite{Ref:Quan16,Ref:Drozdzal17} on this dataset. In summary, our main contributions includes (1) end-to-end multi-stage networks architecture, in which each stage generates multiple side outputs by imposing supervision on different levels and feeds them into the next stage as the multiple recursive inputs. (2) using multiple recursive inputs rather than single recursive inputs can not only boost the performance of neuronal boundary detection, but also be biologically-plausible. (3) our networks achieve promising results on two public available EM segmentation datasets. \begin{figure*}[!t] \centering \vspace{-1em} \includegraphics[trim=0cm 4cm 0cm 1cm, clip=true, width=0.76\linewidth]{network.pdf} \vspace{-1em} \caption{The architecture of the proposed $\text{M}^2$FCN. The multiple side outputs of one stage are concatenated with the original image along the image channel dimension, and are fed into the next stage. It makes the side outputs learned at the next stage approach ground truth.}\label{fig:network} \end{figure*} \section{Related Work} Segmenting EM images of neural tissue is an important step to understand the circuit structure and the function of the brain \cite{Ref:Lee15,Ref:Quan16}. Early work of this topic needs to impose experts' knowledge. For example, users need to label intracellular regions to allow graph cut segmentation, and also correct segmentation errors afterwards \cite{Ref:Vu08}. To reduce the amount of human labor required~\cite{Ref:Helmstaedter13}, automatic neuron segmentation became an active research direction, which follows the pipeline that detects neuronal boundaries by machine learning algorithms~\cite{Ref:Laptev12,Ref:Kaynig10,Ref:Kumar10,Ref:Seyedhosseini11} and then applies post-processing algorithms, such as watershed~\cite{Ref:Najman96,Ref:Uzunbas14,Ref:Zlateski15}, hierarchical clustering~\cite{Ref:Nunez-Iglesias13,Ref:Liu14} and graph cut~\cite{Ref:Krasowski15} algorithms, to boundary maps to obtain neuron segments. But early methods, which are based on hand-crafted features, tend to fail when the membrane is ambiguous. With the rapid development of deep networks, segmentation and classification on medical images have undergone a vast revolution, from analyzing specific features of neuronal boundaries to designing fully automatic algorithm without experts' knowledge. Recent deep learning based neuron segmentation methods are well suited to deal with ambiguous neuronal boundaries in EM images. One of the earliest works made by Ciresan \emph{et al.} \cite{Ref:Ciresan12} used a succession of max-pooling convolutional networks as a pixel classifier, which estimated the probability of a pixel being a membrane. This method won the ISBI 2012 EM segmentation challenge \cite{Ref:Arganda-Carreras15}. Ronneberger \emph{et al.} \cite{Ref:Ronneberger15} presented a U-net structure with contracting paths, which captures multi-contextual information. Compared with the work in \cite{Ref:Ciresan12}, the U-net replaces pooling operations by upsampling operators, which propagates context information from multiple feature channels to higher resolution layers. Fully convolutional networks (FCNs) \cite{Ref:Long15} led to a breakthrough on semantic segmentation. With deep supervision and side outputs on FCN, a holistically-nested edge detector (HED) \cite{Ref:Xie15} was then proposed to solve the ambiguity in edge and object boundary detection. Due to the great success of these methods, Chen \emph{et al.} \cite{Ref:Chen16} presented a deeply supervised contextual network to fuse the multi-level side-outputs to segment the membrane. Deep residual network (ResNet) \cite{Ref:He16} addresses the degradation (of training accuracy) problem by optimizing the residual mapping, which ranked the 1st on ILSVRC 2015 image classification challenge~\cite{Ref:ILSVRC15}. This inspired fully residual convolutional neural networks with nested short and long skip connections for membrane segmentation, proposed by Quan \emph{et al.} \cite{Ref:Quan16} and Fakhry \emph{et al.} \cite{Ref:Fakhry17}. Most of the recent deep learning based methods were motivated by the novel network architectures proposed in the computer vision community. Although these methods achieve improvements on membrane detection, they lack interpretation and comprehensive analysis. Our proposed multi-stage multi-recursive-input fully convolutional networks ($\text{M}^2$FCN) not only considers the advantages of the latest deep network architectures but also is biologically plausible. The recursive training framework has been applied to many computer vision tasks, such as image labeling~\cite{Ref:Tu08}, instance segmentation~\cite{Ref:Li16}, human pose estimation~\cite{Ref:Shen12}, and face alignment~\cite{Ref:Dollar10,Ref:Cao12}. However, they trained the recursive framework stepwise and only used one single recursive input. There are two image segmentation methods~\cite{Ref:Seyedhosseini13,Ref:SeyedhosseiniICCV13} also fed multi-recursive inputs into next stage in the recursive training framework. But, their strategies to generate the multi-recursive inputs are different from ours. In the first one~\cite{Ref:Seyedhosseini13}, the multi-recursive inputs for one stage were obtained by applying a series of Gaussian filters to the single output of the previous stage, but ours are the multiple outputs supervised at different levels in a deep network. The second one~\cite{Ref:SeyedhosseiniICCV13} downsampled an original input image into multiple input images with different resolutions and obtained the multi-recursive inputs from these multiple input images, but ours are computed from the same input image by using the hierarchy of a deep net. In addition, the multiple stages in their methods were trained in a stepwise manner. On the contrary, we embed the recursive learning in a deep network and first learn it in an end-to-end fashion. Our work is related to the recursively trained network proposed in \cite{Ref:Lee15}, which trains a Very Deep 2D (VD2D) network first, then a Very Deep 2D-3D (VD2D3D) network initialized with learned 2D representations from VD2D network is trained to generate the boundary map. There are two important differences between the networks in \cite{Ref:Lee15} and our method. (1). We use multiple recursive inputs with different receptive field sizes to incorporate multi-level contextual boundary information learned from the previous stage, while VD2D3D only uses the single output of VD2D as its recursive input. (2). We train our network in an end-to-end fashion to co-enhance the learning ability (e.g., detect membranes while suppress intracellular structure) of all stages, while \cite{Ref:Lee15} sequentially learns deep networks. Benefited from end-to-end training and multiple recursive inputs, our networks can achieve better performance than VD2D3D while only using 2D EM images\vspace{-0.3em}. \section{Multi-stage Multi-recursive-input Fully Convolutional Networks} \subsection{Overview} Fig.~\ref{fig:network} illustrates the proposed network architecture. Our networks consist of multiple sequential stages, where each stage is a sub-net built based on fully convolutional networks with multiple side outputs~\cite{Ref:Xie15}. Each sub-net consists of multiple levels, each of which is composed of several combinations of one convolutional layers followed by one ReLU layer and a final pooling layer. Each side output layer is connected to the last convolutional layer of each level, which is composed of a $1\times1$ convolutional layer and a deconvolutional layer to ensure the resolution of each side output is the same as the input original image. A sigmoid layer is applied to each side output layer to generate a neuronal boundary map having values belonging to $[0, 1]$. Note that, the multiple side outputs of one stage are concatenated with the original image along the image channel dimension and fed into the next stage. By feeding multiple side outputs to the next stage, the side outputs of next stage can obtain the information from all scales, so that even low level side outputs in the next stage can capture large objects. While in a single stage network, each side output only corresponds to a certain scale, e.g., low level side outputs cannot suppress large intracellular structures, and high level side outputs cannot locate thin membranes accurately. This is like how a human visual system may compare different possible segmentation solutions and select the right scale from them \cite{Ref:Helmstaedter13}. The multiple stages in our networks can be trained in an end-to-end fashion, which enable the side outputs in a previous stage to receive feedback from those of the next stage, like V4 in the human visual system gives the top-down influence to V1. \subsubsection{Sub-net Architecture} \label{sec:sub-net} We adopt the well-known HED network~\cite{Ref:Xie15} as our default sub-net, which is converted from VGG-16 net~\cite{Ref:Simonyan14}, having 5 levels, with strides 1, 2, 4, 8 and 16, respectively, and receptive field sizes 5, 14, 40, 92, 196, respectively. Each side output layer is connected to the last convolutional layer of each level, i.e., conv1\_2, conv2\_2, conv3\_3, conv4\_3, conv5\_3, respectively. \subsection{$\textbf{M}^2$FCN for Neuronal Boundary Detection} Now we formulate our approach for neuronal boundary detection as a per-pixel classification problem. Given a raw input EM image $X=(x_j,j=1,\ldots,|X|)$, where index $j$ is over the image spatial dimensions of image $X$, the goal is to predict the neuronal boundary map $\hat{Y}=(\hat{y}_j,j=1,\ldots,|X|)$, where $\hat{y}_j\in\{0,1\}$ denotes the predicted label for each pixel $x_j$, i.e., if $x_j$ is predicted as a boundary pixel, $\hat{y}_j=0$; otherwise, $\hat{y}_j=1$. We learn an $\text{M}^2$FCN, which consists of $M$ stages and each stage has $N$ levels, to address this problem. Next, we introduce the training and testing phases of our approach respectively. \subsubsection{Training Phase} Since our networks use holistic image training, we consider each training image independently. Suppose that we are given a training batch with one 2D EM image $X$ and its corresponding ground truth neuronal boundary map $Y$, our goal is to supervise the multiple side outputs at different level to approach the ground truth map $Y$. Let $S^{m,n}=(s^{m,n}_j,j=1,\ldots,|X|)$ be the side output at the $n$-th level of the $m$-th stage. Since the side outputs of one stage will be fed to the next stage as the inputs, we express the input to the $m$-stage by \small \begin{equation} X^{(m)}=X \oplus S^{m-1,1} \oplus \ldots \oplus S^{m-1,n} \end{equation} \normalsize where $\oplus$ is the the concatenation operation along the image channel dimension and we define $X^{(1)}=X$. Let $\mathbf{W}^m$ be the network parameters for the sub-net in the $m$-th stage and $\mathbf{w}^{m,n}$ be the parameters for the $n$-th side output in the $m$-th stage, we define a cross-entropy loss function for this side output by \small \begin{eqnarray}\label{eqn:loss_side_output} &\ell^{m,n}(\mathbf{W}^m, \mathbf{w}^{m,n}; X^{(m)}, Y) =\nonumber\\ &-\beta\sum_{j \in |B|}\log (1-\sigma(s^{m, n}_j))\nonumber\\ &-(1-\beta)\sum_{j \in |\bar{B}|}\log (\sigma(s^{m,n}_j)). \end{eqnarray} \normalsize This loss function (Eqn.\ref{eqn:loss_side_output}) is computed over all pixels in the training image $X$, where $|B|$ and $|\bar{B}|$ denote the boundary and non-boundary ground truth label sets respectively, $\sigma(\cdot)$ is the sigmoid function and $\beta=|\bar{B}|/|B|$ is a positive/negative class-balancing weight~\cite{Ref:Xie15} to eliminate the bias between boundary and non-boundary ground truths in training (in a typical 2D EM image, most of the ground truth is non-boundary). To supervise all the side outputs in our network, we define a loss function by \small \begin{eqnarray} \mathcal {L}_s(\mathbf{W}, \mathbf{w}; X,Y)=\nonumber\\ \sum_{m=1}^M\sum_{n=1}^N\alpha_{m,n}\ell^{m,n}(\mathbf{W}^m, \mathbf{w}^{m,n}; X^{(m)}, Y), \end{eqnarray} \normalsize where $\mathbf{W}=(\mathbf{W}^m,m=1,\ldots,M)$, $\mathbf{w}=(\mathbf{w}^{m,n},m=1,\ldots,M,n=1\ldots,N)$ and $\alpha_{m,n}$ is a loss weight for each side output. To obtain a fused output $S^{f,m} $ for $m$-stage , we use a $1\times1$ convolutional layer to fuse its side outputs: \small \begin{equation} S^{f,m} = \sum_{n=1}^Nh_{m,n}S^{m,n}, \end{equation} \normalsize where $\mathbf{h}=(h_{m,n},m=1,\ldots,M,n=1\ldots,N)$ is the fusion weight. Similar to Eqn.~\ref{eqn:loss_side_output}, a class-balanced cross-entropy loss function is defined for the fused output of $m$-stage: \small \begin{eqnarray} \ell^{f,m}(\mathbf{W}^m, \mathbf{w}^{m}; X^{(m)}, Y)=\nonumber\\-\beta\sum_{j \in |B|}\log (1-\sigma(s^{f,m}_j)) -(1-\beta)\sum_{j \in |\bar{B}|}\log (\sigma(s^{f,m}_j)). \end{eqnarray} \normalsize where $\mathbf{w}^m=(\mathbf{w}^{m,n},n=1\ldots,N)$. The loss function for all the fused outputs is \small \begin{eqnarray} \mathcal {L}_f(\mathbf{W}, \mathbf{w}, \mathbf{h}; X,Y)=\nonumber\\ \sum_{m=1}^M\alpha_{f,m}\ell^{f,m}(\mathbf{W}^m, \mathbf{w}^{m}; X^{(m)}, Y), \end{eqnarray} \normalsize where $\alpha_{f,m}$ is a loss weight for each stage. All these parameters, $\mathbf{W}, \mathbf{w}, \mathbf{h}$, are optimized simultaneously by standard back-propagation: \small \begin{eqnarray} (\mathbf{W}, \mathbf{w}, \mathbf{h})^{\ast} = \arg\min(\mathcal {L}_s(\mathbf{W}, \mathbf{w}; X,Y) \nonumber\\ + \mathcal {L}_f(\mathbf{W}, \mathbf{w}, \mathbf{h}; X,Y)). \end{eqnarray} \normalsize \subsubsection{Testing Phase} In the testing stage, given an image $X$, by considering the $m$-th sub-net as a function $F_m$, we sequentially obtain the side outputs of the $m$-th sub-net by \small \begin{eqnarray} (S^{m,n},n=1\ldots,N)=F_m(X^{(m)}, \nonumber\\ (\mathbf{W}^{1})^{\ast},\ldots,(\mathbf{W}^{m})^{\ast},(\mathbf{w}^{m,1})^{\ast},\ldots,(\mathbf{w}^{m,N})^{\ast}). \end{eqnarray} \normalsize The fusion output of $m$-stage is obtained by \small \begin{equation} S^{f,m}= \sum_{n=1}^Nh^{\ast}_{m,n}S^{m,n}. \end{equation} \normalsize We use the fused output of the last stage $S^{f,M}$ as the final output of our network, then the unified boundary probability map is given by $\hat{Y}=\sigma(S^{f,M})$. \subsubsection{Initialization for Multi-stage Training} The proposed network is very deep (our 3-stage network with 5 levels has totally 48 layers). It is known that, training such a deep network from scratch is not easy. Here, we adopt a simple strategy to initialize the multi-stage network. First, we train a single stage network. Then, this network is used to initialize the first stage of our network, while the rest of the network is randomly initialized. The initialization for the first stage provides high-confidence recursive inputs to the consecutive stage, which facilitates the training procedure. \section{Experimental Results} In this section, we discuss our designs for network architectures and training strategies, and compare our performance with other competitors. \subsection{Experiment Setting} The hyper parameters of our networks include: the mini-batch size (1), the loss weight for each side-output (1), the momentum (0.9), and the weight decay ($2\times10^{-4}$). We set the base learning rate to 1e-8 and pre-train a single stage network by 20,000 iterations. Then we use this pre-trained single stage network to initialize the first stage of our multi-stage network, and reduce the base learning rate to 1e-9 and train it by 10,000 iterations. \subsection{Mouse Piriform Cortex Dataset} The images of mouse piriform cortex dataset \cite{Ref:Lee15} were collected from the piriform cortex of an adult mouse, which contains 4 stacks of EM images. We use the same training-testing split in \cite{Ref:Lee15}, i.e., stack2, stack3 and stack4 are for training and stack1 is for testing. \subsubsection{Evaluation Metric}\label{sec:metric_piriform} To evaluate membrane segmentation performances, we follow the protocol used in \cite{Ref:Lee15}, where the segmented membrane is measured by the Rand F-score: \small \begin{equation} V_{Fscore}^{Rand} = \frac{2V_{merge}^{Rand}V_{split}^{Rand}}{V_{merge}^{Rand}+V_{split}^{Rand}}, \end{equation} \normalsize where $V_{merge}^{Rand}$ and $V_{split}^{Rand}$ are Rand merge score and Rand split score respectively, and defined by: \small \begin{equation} V_{merge}^{Rand}=\frac{\sum_{ij}n_{ij}^2}{\sum_i(\sum_jn_{ij})^2}, \quad V_{split}^{Rand}=\frac{\sum_{ij}n_{ij}^2}{\sum_j(\sum_in_{ij})^2}, \end{equation} \normalsize where $n_{ij}$ denote the number of voxels in the $i$-th segment of the proposal segmentation and $j$-th segment of the ground truth segmentation. $V_{merge}^{Rand}$ and $V_{split}^{Rand}$ are close to $1$ when there are fewer merge and split errors, respectively. To calculate the Rand score, we obtain the neuronal segmentation based on the boundary map by applying the same modified graph-based watershed algorithm~\cite{Ref:Zlateski15} as in \cite{Ref:Lee15}. We use the default setting in~\cite{Ref:Lee15} and report our best Rand F-score $V_{Fscore}^{Rand}$. \subsubsection{Data Augmentation} Data augmentation is a standard way to generate sufficient training data for learning a ``good'' deep network. We rotate the images to 4 different angles ($0^\circ$, $90^\circ$, $180^\circ$, $270^\circ$) and flip them with different axis (up-down, left-right, no flip), then resize images to 3 different scales ($0.8$, $1.0$, $1.2$), totally leading to an augmentation factor of 36. \subsubsection{Alternative Design Discussion} We use the pre-trained single stage network as the baseline and discuss some possible alternative designs for network architectures and training strategies. The results of these alternative designs are summarized in Table.~\ref{tbl:alternative_design}. To simplify description, we denote each alternative design by ``AD'' plus an index. \paragraph{The role of multiple stages.} Since our networks consist of multiple stages, it's necessary to see whether the performance can be improved by adding stage by stage. Due to the limitation of GPU memory, the deepest network we can train is a 3-stage network with sub-nets of 5 levels (Sec. \ref{sec:sub-net}). We compare the performance between a 1-stage network (AD\_I), a 2-stage network (AD\_VI) and a 3-stage network (AD\_VII). Note that, the AD\_I has the same architecture as the pre-trained single stage network. As shown in Table.~\ref{tbl:alternative_design}, the performance of AD\_I is almost the same as that of the pre-trained single stage network, which indicates that training a single stage network by more iterations cannot improve the performance considerably. The AD\_VI and the AD\_VII achieve $1.39\%$ and $1.86\%$ performance improvements compared with the baseline, respectively, which shows that our multi-stage training is effective for neuronal boundary detection. A qualitative comparison between these three networks, i.e, 1-stage (AD\_I), 2-stage (AD\_VI) and 3-stage (AD\_VII) networks, is given in Fig.~\ref{fig:stage_comparison}. Observed that, the false detections on intracellular structures such as mitochondria and vesicles can be reduced (indicated by red arrows) by training a network with more stages. \begin{figure*}[!ht] \centering \vspace{-1em} \includegraphics[width=0.8\linewidth]{stage_comparison.jpg} \vspace{-0.5em} \caption{Qualitative comparison between 1-stage (AD\_I), 2-stage (AD\_VI) and 3-stage (AD\_VII) networks. Red arrows indicate suppressed false detections by training more stages.}\label{fig:stage_comparison} \end{figure*} \paragraph{The role of multiple recursive inputs.} As we stated in the Sec.~\ref{sec:intro}, using multiple recursive inputs for the multiple stage training is crucial for our framework. To evaluate this, we test two alternative network architectures, which only uses the side output of the 5-th level (AD\_III) and the 4-th level (AD\_IV) in each stage as the recursive input for the next stage respectively. As shown in Table.~\ref{tbl:alternative_design}, only using single recursive input results in a significant performance drop, $4.56\%$ decrease for AD\_III and $2.1\%$ decrease for AD\_IV. We illustrate the side outputs of the second stages of AD\_III and AD\_VI in Fig.~\ref{fig:multi-single}, where we see that the side outputs of the former one only response to large scale objects, while even the side outputs of the latter one can capture objects of different scales, thanks to the multiple recursive inputs. \begin{figure}[!ht] \centering \includegraphics[trim=14.5cm 8cm 0cm 0cm, clip=true, width=0.87\linewidth]{multi-single.pdf} \caption{The side outputs of the second stages learned by single recursive input (AD\_III) and multiple recursive inputs (AD\_VI).}\label{fig:multi-single} \end{figure} \paragraph{Stepwise or end-to-end training.} One difference between our multi-stage training framework to others~\cite{Ref:Tu08,Ref:Lee15,Ref:Jurrus10,Ref:Dollar10} is we train these multiple stages in an end-to-end fashion, not stepwise. To verify which way is better, we also train a 2-stage network stepwise, by simply fixing the parameters of the first stage in this 2-stage network (AD\_V). As can be seen from Table.~\ref{tbl:alternative_design}, training the 2-stage network stepwise leads to a considerable performance decrease ($0.9819\rightarrow0.9762$). During end-to-end training, previous stages are influenced by next stages. We visualize the fused outputs (after watershed) of the first stages of (AD\_V) and (AD\_VI), respectively, in Fig.~\ref{fig:end_stepwise}, where we see the latter one leads to better segmentation results (indicated by red arrows). Therefore, we conclude that training in an end-to-end way is better. \begin{figure}[!ht] \centering \includegraphics[width=1.0\linewidth]{end_stepwise.jpg} \caption{The comparison between the fused outputs (after watershed~\cite{Ref:Zlateski15}) of the first stages of a 2-stage network trained stepwise (AD\_V) and end-to-end (AD\_VI). The latter one leads to better segmenting results (indicated by red arrows).}\label{fig:end_stepwise} \end{figure} \paragraph{The range of the receptive field sizes in each sub-net.} The receptive field sizes of the 5 levels in each sub-net range from 5 to 196. Such a wide range of receptive field sizes ensure the side outputs to be able to capture small neuronal boundaries while suppress relative big intracellular structures. To show this wide range of receptive field sizes is important for neuronal boundary detection, we use an alternative network architecture for each sub-net, which is obtained by removing the last level from the default sub-net, i.e., a 2-stage network with 4-level sub-net (AD\_II). As we expected, as shown in Table.~\ref{tbl:alternative_design}, removing the last level in each sub-net leads to performance decrease. \begin{table}[!th] \centering \caption{Performance of alternative designs for network architectures and training strategies.}\label{tbl:alternative_design} \begin{tabu}{l|c} Alternative Design & $V_{Fscore}^{Rand}$\\ \tabucline[2pt]{-} pre-trained single stage, 5-level (baseline) &{0.9680}\\ \hline AD\_I: 1-stage, 5-level &{0.9688}\\ \hline AD\_II: 2-stage, 4-level, end-to-end, &\multirow{2}{*}{0.9739}\\ multi-recursive-input & $$\\ \hline AD III: 2-stage, 5-level, end-to-end,&\multirow{2}{*}{0.9410}\\ single-recursive-input (level 5) & $$\\ \hline AD\_IV: 2-stage, 5-level, end-to-end,&\multirow{2}{*}{0.9656}\\ single-recursive-input (level 4) & $$\\ \hline AD\_V: 2-stage, 5-level, stepwise, &\multirow{2}{*}{0.9762}\\ multi-recursive-input & $$\\ \hline AD\_VI: 2-stage, 5-level, end-to-end,&\multirow{2}{*}{0.9819}\\ multi-recursive-input & $$\\ \hline AD\_VII: 3-stage, 5-level, end-to-end,& \multirow{2}{*}{\textbf{0.9866}}\\ multi-recursive-input & $$\\ \hline \end{tabu} \end{table} \subsubsection{Performance Comparison} Now we compare our networks (3-stage with 5 levels) with other competitors on the mouse piriform cortex dataset. The quantitative results are summarized in Table~\ref{tbl:rand_f_score} and the precision (rand merge)-recall (rand split) curves are illustrated in Fig.~\ref{fig:rand_score_curve}. As can be seen, our method can maintain a high precision even when it achieves a high recall, thanks to the multi-stage training which suppresses false detections of boundaries on intracellular structures while enhancing neuronal boundaries. The current state-of-the-art method on the mouse piriform cortex dataset is VD2D3D~\cite{Ref:Lee15}, which is also a recursive training framework. But it trains two stages stepwise, i.e., train the first one, a 2D convolutional network, then uses its output as the recursive input for the second one, a 3D convolutional networks. The experimental results show that with the end-to-end multi-stage training and multi-recursive-inputs, our 2D 2-stage network can achieve better performance than a 2D-3D network. Note that, as VD2D3D already obtained a high Rand F-score, our method achieves around $1.5\%$ improvement on it, which is meaningful. Such a low error obtained on a large EM image dataset is important for neuron reconstruction. Some neuron segmentation results obtained by applying the watershed algorithm~\cite{Ref:Zlateski15} to our boundary maps are shown in Fig.~\ref{fig:segmentation}. \begin{table}[!th] \centering \caption{Neuronal boundary detection performance comparison between different methods. The values of $V_{merge}^{Rand}$ and $V_{split}^{Rand}$ correspond to the best Rand F-score $V_{Fscore}^{Rand}$.}\label{tbl:rand_f_score} \begin{tabular}{ccccccc} \toprule Method&$V_{merge}^{Rand}$&$V_{split}^{Rand}$&$V_{Fscore}^{Rand}$\\ \midrule N4~\cite{Ref:Ciresan12}&0.9619&0.9010&0.9304\\ VD2D~\cite{Ref:Lee15}&0.9771&0.9174&0.9463\\ VD2D3D~\cite{Ref:Lee15}&0.9891&0.9555&0.9720\\ $\text{M}^2$FCN (1 stage)&0.9576&0.9802&0.9688\\ $\text{M}^2$FCN (2 stage)&0.9759&0.9880&0.9819\\ $\text{M}^2$FCN (3 stage)&0.9917&0.9815&\textbf{0.9866}\\ \bottomrule \end{tabular} \end{table} \begin{figure}[!ht] \centering \includegraphics[trim=3cm 7cm 4cm 7.4cm, clip=true, width=0.8\linewidth]{rand_score_curve_1.pdf} \vspace{-1em} \caption{Evaluation of neuronal boundary detection methods by precision (rand merge)-recall (rand split) curves.}\label{fig:rand_score_curve} \end{figure} \begin{figure}[!ht] \centering \includegraphics[width=1.0\linewidth]{segmentation.jpg} \caption{Neuron segmentation examples. From left to right: the original image, the ground truth segmentation, our boundary map and the segmentations obtain by applying the watershed algorithm~\cite{Ref:Zlateski15} to our boundary maps.}\label{fig:segmentation} \end{figure} \subsection{ISBI 2012 EM segmentation dataset} Most of current neuronal boundary detection methods are evaluated on the public dataset of ISBI 2012 EM segmentation challenge~\cite{Ref:Ronneberger15}. The training data of this dataset is a set of 30 consecutive images (512 $\times$ 512 pixels) from a serial section Transmission Electron Microscopy (ssTEM) dataset of the Drosophila first instar larva ventral nerve cord~\cite{Ref:Cardona2010}. The testing data of this dataset also contains 30 consecutive EM images of the same resolution. The ground truth boundary maps of the training images are made publicly available to enable participants to develop their algorithm, while the ground truth boundary maps of the test images are kept by the organizers. Although this challenge is over, it is still open for submissions. The performance of the new submissions will be reported on the leader board of this challenge. There are over 70 results listed on the leader board, but not all of them have published papers. We summarized some leading quantitative results reported in published papers in Table~\ref{tbl:ISBI2012}. Note that, many state-of-the-art methods apply post-processing or average multiple trained models to boost the performance, such as PolyMtl~\cite{Ref:Drozdzal17}, FusionNet~\cite{Ref:Quan16} and CUMedVision~\cite{Ref:Chen16}. Our method, a two-stage network using a single trained model without post-processing, can achieve 0.9780 Rand F-score, which is comparable with the state-of-the-art methods and better than CUMedVision~\cite{Ref:Chen16}, a one-stage HED. But, CUMedVision used post-processing and averaged 6 trained models to improve the result. This comparison shows the effectiveness of our multi-stage learning. IAL IC~\cite{Ref:Beier16} is a post-processing method, which can be applied to our result to improve our performance. Besides, as both FusionNet and PolyMtl are built on ResNet~\cite{Ref:He16}, we can also replace the sub-net in our model by such a powerful network to gain improvement. \begin{table}[!th] \centering \caption{Comparison to published entries on the ISBI 2012 EM dataset~\cite{Ref:Ronneberger15}. For full ranking of all submitted methods, please refer to the challenge website: \url{http://brainiac2.mit.edu/isbi_challenge/leaders-board-new}.}\label{tbl:ISBI2012} \begin{tabular}{cc} \toprule Method&$V_{Fscore}^{Rand}$\\ \midrule PolyMtl~\cite{Ref:Drozdzal17}&0.9806\\ $\text{M}^2$FCN (ours)&0.9780\\ FusionNet~\cite{Ref:Quan16}&0.9780\\ IAL IC~\cite{Ref:Beier16}&0.9773\\ CUMedVision~\cite{Ref:Chen16}&0.9768\\ FCN+LSTM~\cite{Ref:ChenNIPS16}&0.9754\\ Unet~\cite{Ref:Ronneberger15}&0.9727\\ \bottomrule \end{tabular} \end{table} \section{Conclusion} We present multi-stage multi-recursive-input fully convolutional networks for neuronal boundary detection. In the proposed architecture, the multiple side outputs learned at different scales in one stage, are fed into the next stage. This provides the ability to detect neuronal boundaries while suppressing false predictions on intracellular structures. Extensive analysis on two public EM segmentation datasets, the mouse piriform cortex dataset and the ISBI 2012 EM dataset, verifies the advantages of our network architecture. \noindent {\bf Acknowledgement}. This work was supported in part by the National Natural Science Foundation of China No.~61672336 and No.~61303095, in part by ``Chen Guang'' project supported by Shanghai Municipal Education Commission and Shanghai Education Development Foundation No.~15CG43, and in part by NSF CCF-1231216. {\small \bibliographystyle{ieee}
{'timestamp': '2017-08-01T02:14:34', 'yymm': '1703', 'arxiv_id': '1703.08493', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08493'}
arxiv
\section{Introduction} In~\cite{strassen:1969}, V.\ Strassen presented a noncommutative algorithm for multiplication of two~$\matrixsize{2}{2}$ matrices using only~$7$ multiplications. The current upper bound~$23$ for~$\matrixsize{3}{3}$ matrix multiplication was reached by J.B.\ Laderman in~\cite{laderman:1976a}. This note presents a \emph{geometric} relationship between Strassen and Laderman algorithms. By doing so, we retrieve a \emph{geometric} formulation of results very similar to those presented by O.\ S\'ykora in~\cite{sykora:1977a}. \subsection{Disclaimer: there is no improvement in this note}\label{sec:disclaimer} We do not improve any practical algorithm or prove any theoretical bound in this short note but focus on effective manipulation of tensor associated to matrix multiplication algorithm. To do so, we present only the minimal number of needed definitions and thus leave many facts outside our scope. We refer to~\cite{landsberg:2010} for a complete description of the field and to~\cite{Ambainis:2014aa} for a state-of-the-art presentation of theoretical complexity issues. \subsection{So, why writing (or reading) it?} We follow the geometric spirit of~\cite{Grochow:2016aa,Chiantini:2016aa,Burgisser:2015aa,burichenko:2015,burichenko:2014} and related papers: symmetries could be used in practical design of matrix multiplication algorithms. Hence, this note presents another example of this philosophy by giving a precise geometric meaning to the following statement: \begin{quote} Laderman matrix multiplication algorithm is composed by four~$\matrixsize{2}{2}$ optimal matrix multiplication algorithms, a half of the classical~$\matrixsize{2}{2}$ matrix multiplication algorithm and a correction term. \end{quote} \section{Framework} To do so, we have to present a small part of the classical framework (for a complete presentation see~{\cite{groot:1978a,groot:1978,landsberg:2010}}) mainly because we do not take it literally and only use a simplified version. Let us start by some basic definitions and notations as the following generic matrices: \small% \begin{equation} \label{eq:1} A=\!\left(% \begin{array}{ccc} {a_{11}}&{a_{12}}&{a_{13}}\\ {a_{21}}&{a_{22}}&{a_{23}}\\ {a_{31}}&{a_{32}}&{a_{33}} \end{array}\right) \!, \ B=\!\left(% \begin{array}{ccc} {b_{11}}&{b_{12}}&{b_{13}}\\ {b_{21}}&{b_{22}}&{b_{23}}\\ {b_{31}}&{b_{32}}&{b_{33}} \end{array}\right)\!,\ C=\!\left(% \begin{array}{ccc} {c_{11}}&{c_{12}}&{c_{13}}\\ {c_{21}}&{c_{22}}&{c_{23}}\\ {c_{31}}&{c_{32}}&{c_{33}} \end{array}\right)\!, \end{equation} \normalsize% that will be used in the sequel. Furthermore, as we also consider their~$\matrixsize{2}{2}$ submatrices, let us introduce some associated notations. \begin{notations}\label{def:MatrixProjection} Let~$n,i,j$ be positive integers such that~${i\leq n}$ and~${j\leq n}$. We denote by~$\matrixprojectionoperator{n}{j}$ the identity~$\matrixsize{n}{n}$ matrix where the~$j$th diagonal term is~$0$. Given a~$\matrixsize{n}{n}$ matrix~$A$, we denote by~$\MatrixZero{j}{k}{A}$ the matrix~${\matrixprojectionoperator{n}{j}\cdot A\cdot \matrixprojectionoperator{n}{k}}$. For example, the matrix~$\MatrixZero{3}{3}{A}$,~$\MatrixZero{3}{2}{B}$ and~$\MatrixZero{2}{3}{C}$ are: \begin{equation} \label{eq:3} \left(% \begin{array}{ccc} {a_{11}}&{a_{12}}&{0}\\ {a_{21}}&{a_{22}}&{0}\\ {0}&{0}&{0} \end{array}\right)\!, \quad \left(% \begin{array}{ccc} {b_{11}}&{0}&{b_{13}}\\ {b_{21}}&{0}&{b_{23}}\\ {0}&{0}&{0} \end{array}\right) \quad \textup{and}\quad \left(% \begin{array}{ccc} {c_{11}}&{c_{12}}&{0}\\ {0}&{0}&{0}\\ {c_{31}}&{c_{32}}&{0} \end{array}\right)\!. \end{equation} Given a\,~$\matrixsize{n}{n}$ matrix~$A$, we sometimes consider~$\MatrixZero{i}{j}{A}$ as the~$\matrixsize{(n-1)}{(n-1)}$ matrix~$\MatrixProjection{i}{j}{A}$ where the line and column composed of~$0$ are removed. \par At the opposite, given any~$\matrixsize{(n-1)}{(n-1)}$ matrix~$A$, we denote by~$\MatrixLift{i}{j}{A}$ the~$\matrixsize{n}{n}$ matrix where a line and column of~$0$ were added to~$A$ in order to have~${\MatrixProjection{i}{j}{\MatrixLift{i}{j}{A}}=A}$. \end{notations} \subsection{Strassen multiplication algorithm} Considered as~$\matrixsize{2}{2}$ matrices, the matrix product~${\MatrixProjection{3}{3}{C}=\MatrixProjection{3}{3}{A}\cdot\MatrixProjection{3}{3}{B}}$ could be computed using Strassen algorithm (see~\cite{strassen:1969}) by performing the following computations: \begin{equation} \label{eq:StrassenMultiplicationAlgorithm} \begin{aligned} \begin{aligned} t_{1} &= (a_{11} + a_{22}) (b_{11} + b_{22}), &t_{2} & = (a_{12} - a_{22})(b_{21} + b_{22}), \\ t_{3} &= (-a_{11} + a_{21}) (b_{11} + b_{12}), &t_{4} & =(a_{11}+a_{12})b_{22}, \end{aligned} \\ \begin{aligned} t_{5} = a_{11} (b_{12} - b_{22}),\ t_{6} = a_{22} (-b_{11} + b_{21}),\ t_{7} = (a_{21} + a_{22}) b_{11}, \end{aligned}\\ \begin{aligned} c_{11} &= t_{1} + t_{2} - t_{4} + t_{6}, & c_{12} &= t_{6} + t_{7}, \\ c_{21} &= t_{4} + t_{5}, &c_{22} &= t_{1} + t_{3} + t_{5} -t_{7}. \end{aligned} \end{aligned} \end{equation} In order to consider above algorithm under a geometric standpoint, it is usually presented as a tensor. \subsection{Bilinear mappings seen as tensors and associated trilinear forms} \begin{definitions}\label{def:tensor} Given a tensor~$\tensor{T}$ decomposable as sum of rank-one tensors: \begin{equation} \label{eq:5} \tensor{T}=\sum_{i=1}^{r} T_{i1}\otimes T_{i2}\otimes T_{i3}, \end{equation} where~$T_{ij}$ are~$\matrixsize{n}{n}$ matrices: \begin{itemize} \item the integer~$r$ is the \emph{tensor rank} of tensor~$\tensor{T}$; \item the unordered list~${[{(\matrixrank{M_{ij}})}_{j=1\ldots 3}]}_{i=1\ldots r}$ is called the \emph{type} of tensor~$\tensor{T}$ ($\matrixrank{A}$ being the classical rank of the matrix~$A$). \end{itemize} \end{definitions} \subsection{Tensors' contractions} To explicit the relationship between what is done in the sequel and the bilinear mapping associated to matrix multiplication, let us consider the following tensor's contractions: \begin{definitions}\label{def:contractions} Using the notation of definition~\ref{def:tensor} given a tensor~$\tensor{T}$ and three~$\matrixsize{n}{n}$ matrices~$A,B$ and~$C$ with coefficients in the algebra~$\mathbb{K}$: \begin{itemize} \item the~$(1,2)$ contraction of~$\tensor{T}\otimes A\otimes B$ defined by: \begin{equation} \label{eq:6} \sum_{i=1}^{r} \textup{Trace} (\Transpose{T_{i1}} \cdot A)\, \textup{Trace} (\Transpose{T_{i2}} \cdot B) T_{i3} \end{equation} corresponds to a bilinear application~$\mathbb{K}^{\matrixsize{n}{n}}\times \mathbb{K}^{\matrixsize{n}{n}} \mapsto \mathbb{K}^{\matrixsize{n}{n}}$ with indeterminates~$A$ and~$B$. \item the~$(1,2,3)$ (a.k.a.\ full) contraction of~$\tensor{T}\otimes A\otimes B\otimes C$ defined by: \begin{equation} \label{eq:7a} {\left\langle\tensor{T} | A \otimes B \otimes C \right\rangle} = \sum_{i=1}^{r} \textup{Trace} (\Transpose{T_{i1}} \cdot A)\, \textup{Trace} (\Transpose{T_{i2}} \cdot B)\, \textup{Trace}(\Transpose{T_{i3}}\cdot C) \end{equation} corresponds to a trilinear form~$\mathbb{K}^{\matrixsize{n}{n}}\times \mathbb{K}^{\matrixsize{n}{n}} \times \mathbb{K}^{\matrixsize{n}{n}} \mapsto \mathbb{K}$ with indeterminates~$A,B$ and~$C$. \end{itemize} \end{definitions} \begin{remarks} As the studied object is the tensor, its expressions as full or incomplete contractions are equivalent. Thus, even if matrix multiplication is a bilinear application, we are going to work in the sequel with trilinear forms (see~\cite{Dumas:2016aa} for bibliographic references on this standpoint). \par The definition in~\ref{def:contractions} are taken to express the full contraction as a degenerate inner product between tensors; it is not the usual choice made in the literature and so, we have to explicitly recall some notions used in the sequel. \end{remarks} Strassen multiplication algorithm~(\ref{eq:StrassenMultiplicationAlgorithm}) is equivalent to the tensor~$\tensor{S}$ defined by:\par \footnotesize% \begin{equation} \label{eq:4} \begin{aligned} & \left(\! \begin{array}{cc} 1&0\\ 0&1\\ \end{array} \!\right) \otimes{} \left(\! \begin{array}{cc} 1&0\\ 0&1\\ \end{array} \!\right) \otimes{} \left(\! \begin{array}{cc} 1&0\\ 0&1\\ \end{array} \!\right) &+ \left(\! \begin{array}{cc} 0&1\\ 0&-1\\ \end{array} \!\right) \otimes{} \left(\! \begin{array}{cc} 0&0\\ 1&1\\ \end{array} \!\right) \otimes{} \left(\! \begin{array}{cc} 1&0\\ 0&0\\ \end{array} \!\right) + \\[\smallskipamount] & \left(\! \begin{array}{cc} -1&0\\ 1&0\\ \end{array} \!\right) \otimes{} \left(\! \begin{array}{cc} 1&1\\ 0&0\\ \end{array} \!\right) \otimes{} \left(\! \begin{array}{cc} 0&0\\ 0&1\\ \end{array} \!\right) &+ \left(\! \begin{array}{cc} 1&1\\ 0&0\\ \end{array} \!\right) \otimes{} \left(\! \begin{array}{cc} 0&0\\ 0&1\\ \end{array} \!\right) \otimes{} \left(\! \begin{array}{cc} -1&0\\ 1&0\\ \end{array} \!\right) +\\[\smallskipamount] & \left(\! \begin{array}{cc} 1&0\\ 0&0\\ \end{array} \!\right) \otimes{} \left(\! \begin{array}{cc} 0&1\\ 0&-1\\ \end{array} \!\right) \otimes{} \left(\! \begin{array}{cc} 0&0\\ 1&1\\ \end{array} \!\right) &+ \left(\! \begin{array}{cc} 0&0\\ 0&1\\ \end{array} \!\right) \otimes{} \left(\! \begin{array}{cc} -1&0\\ 1&0\\ \end{array} \!\right) \otimes{} \left(\! \begin{array}{cc} 1&1\\ 0&0\\ \end{array} \!\right) + \\[\smallskipamount] & \left(\! \begin{array}{cc} 0&0\\ 1&1\\ \end{array} \!\right) \otimes{} \left(\! \begin{array}{cc} 1&0\\ 0&0\\ \end{array} \!\right) \otimes{} \left(\! \begin{array}{cc} 0&1\\ 0&-1\\ \end{array} \!\right)\!. \end{aligned} \end{equation} \normalsize% This tensor defines the matrix multiplication algorithm~(\ref{eq:StrassenMultiplicationAlgorithm}) and its tensor rank is~$7$. \subsection{$\matrixsize{2}{2}$ matrix multiplication tensors induced by a~$\matrixsize{3}{3}$ matrix multiplication tensor}\label{sec:Projection} Given any~$\matrixsize{3}{3}$ matrix multiplication tensor, one can define~$3^{3}$ induced~$\matrixsize{2}{2}$ matrix multiplication tensors as shown in this section. First, let us introduce the following operators that generalize to tensor the notations~\ref{def:MatrixProjection}: \begin{definitions}\label{def:Projection} Using notations introduced in definition~\ref{def:MatrixProjection}, we define: \begin{subequations} \begin{align} \label{eq:14a} \TensorZero{i}{j}{k}{A\otimes{} B\otimes{} C}= \MatrixZero{i}{j}{A} \otimes{} \MatrixZero{j}{k}{B} \otimes{} \MatrixZero{k}{i}{C}, \\ \label{eq:14b} \TensorProjection{i}{j}{k}{A\otimes{} B\otimes{} C}= \MatrixProjection{i}{j}{A} \otimes{} \MatrixProjection{j}{k}{B} \otimes{} \MatrixProjection{k}{i}{C}, \\ \label{eq:14c} \TensorLift{i}{j}{k}{A\otimes{} B\otimes{} C}= \MatrixLift{i}{j}{A} \otimes{} \MatrixLift{j}{k}{B} \otimes{} \MatrixLift{k}{i}{C} \end{align} \end{subequations} and we extend the definitions of these operators by additivity in order to be applied on any tensor~$\tensor{T}$ described in definition~\ref{def:tensor}. \end{definitions} There is~$n^{3}$ such projections and given any matrix multiplication tensor~$\tensor{M}$, the full contraction satisfying the following trivial properties: \begin{equation} \label{eq:16} \left\langle \tensor{M} \,\big|\,\TensorZero{i}{j}{k}{A\otimes{} B\otimes{} C} \right\rangle = \left\langle \TensorZero{i}{j}{k}{\tensor{M}} \,\big|\,A\otimes{} B \otimes{} C \right\rangle = \left\langle \TensorProjection{i}{j}{k}{\tensor{M}}\, \big|\, \TensorProjection{i}{j}{k}{A\otimes{} B\otimes{} C} \right\rangle \end{equation} (where the projection operator apply on an~$\matrixsize{n}{n}$ matrix multiplication tensor); it defines explicitly a~$\matrixsize{(n-1)}{(n-1)}$ matrix multiplication tensor. \par The following property holds: \begin{lemma} \begin{equation} \label{eq:15} {(n-1)}^{3}\left\langle\tensor{M} | A \otimes{} B \otimes{} C \right\rangle = \sum_{1\leq i,j,k \leq n} \left\langle \tensor{M} \Big| \TensorZero{i}{j}{k}{A\otimes{} B\otimes{} C}\right\rangle \end{equation} and thus, we have: \begin{equation} \label{eq:16a} \left\langle \tensor{M} | A \otimes{} B \otimes{} C \right\rangle = \left\langle \frac{1}{{(n-1)}^{3}}\sum_{1\leq i,j,k \leq n} \TensorZero{i}{j}{k}{\tensor{M}}\Big| A \otimes{} B \otimes{} C \right\rangle\!. \end{equation} \end{lemma} The obvious facts made in this section underline the relationships between any~$\matrixsize{n}{n}$ matrix multiplication tensor and the~$n^{3}$ induced~$\matrixsize{(n-1)}{(n-1)}$ algorithms. \par Considering the Laderman matrix multiplication tensor, we are going to explore further this kind of relationships. First, let us introduce this tensor. \subsection{Laderman matrix multiplication tensor} The Laderman tensor~$\tensor{L}$ described below by giving its full contraction: \begin{equation} \label{eq:17} \begin{array}{lc} \left( { a_{11}}-{ a_{21}}+{ a_{12}}-{ a_{22}}-{ a_{32}}+{ a_{13}}-{ a_{33}} \right) { b_{22}} \,{ c_{21}} &+ \\{ a_{22}}\, \left( -{ b_{11}}+{ b_{21}}-{ b_{31}}+{ b_{12}}-{ b_{22}}-{ b_{23}}+{ b_{33}} \right) { c_{12}} &+\\ { a_{13}}\,{ b_{31}}\, \left( { c_{11}}+{ c_{21}}+{ c_{31}}+{ c_{12} }+{ c_{32}}+{ c_{13}}+{ c_{23}} \right) &+ \\ \left( { a_{11}}-{ a_{31}}+{ a_{12}}-{ a_{22}}-{ a_{32}}+{ a_{13}}-{ a_{23}} \right) { b_{23}}\,{ c_{31}}&+\\{ a_{32}}\, \left( -{ b_{11}}+{ b_{21}}-{ b_{31}}-{ b_{22}}+{ b_{32}}+{ b_{13}}-{ b_{23}} \right) { c_{13}} & + \\ { a_{11}}\,{ b_{11}}\, \left( { c_{11}}+{ c_{21}}+{ c_{31}}+{ c_{12}}+{ c_{22}}+{ c_{13}}+{ c_{33}} \right) &+ \\ \left( -{ a_{11}}+{ a_{31}}+{ a_{32}} \right) \left( { b_{11}}-{ b_{13}}+{ b_{23}} \right) \left( { c_{31}}+{ c_{13}}+{ c_{33}} \right) &+ \\ \left( { a_{22}}-{ a_{13}}+{ a_{23}} \right) \left( { b_{31}}+{ b_{23}}-{ b_{33}} \right) \left( { c_{31}}+{ c_{12}}+{ c_{32}} \right) & + \\ \left( -{ a_{11}}+{ a_{21}}+{ a_{22}} \right) \left( { b_{11}}-{ b_{12}}+{ b_{22}} \right) \left( { c_{21}}+{ c_{12}}+{ c_{22}} \right) & + \\ \left( { a_{32}}-{ a_{13}}+{ a_{33}} \right) \left( { b_{31}}+{ b_{22}}-{ b_{32}} \right) \left( { c_{21}}+{ c_{13}}+{ c_{23}} \right) &+\\ \left( { a_{21}}+{ a_{22}} \right) \left( -{ b_{11}}+{ b_{12}} \right) \left( { c_{21}}+{ c_{22}} \right)& + \\ \left( { a_{31}}+{ a_{32}} \right) \left( -{ b_{11}}+{ b_{13}} \right) \left( { c_{31}}+{ c_{33}} \right) & + \\ \left( { a_{13}}-{ a_{33}} \right) \left( { b_{22}}-{ b_{32}} \right) \left( { c_{13}}+{ c_{23}} \right) &+\\ \left( { a_{11}}-{ a_{21}} \right) \left( -{ b_{12}}+{ b_{22}} \right) \left( { c_{12}}+{ c_{22}} \right) &+\\ \left( { a_{32}}+{ a_{33}} \right) \left( -{ b_{31}}+{ b_{32}} \right) \left( { c_{21}}+{ c_{23}} \right)&+\\ \left( -{ a_{11}}+{ a_{31}} \right) \left( { b_{13}}-{ b_{23}} \right) \left( { c_{13}}+{ c_{33}} \right) &+\\ \left( { a_{13}}-{ a_{23}} \right) \left( { b_{23}}-{ b_{33}} \right) \left( { c_{12}}+{ c_{32}} \right) &+\\ \left( { a_{22}}+{ a_{23}} \right) \left( -{ b_{31}}+{ b_{33}} \right) \left( { c_{31}}+{ c_{32}} \right) &+\\ { a_{12}}\,{ b_{21}}\,{ c_{11}}+{ a_{23}}\,{ b_{32}}\,{ c_{22}} + { a_{21}}\,{ b_{13}}\,{ c_{32}}+{ a_{31}}\,{ b_{12}}\,{ c_{23}}+{ a_{33}}\,{ b_{33}}\,{ c_{33}} \end{array} \end{equation} and was introduced in~\cite{laderman:1976a} (we do not study in this note any other \emph{inequivalent} algorithm of same tensor rank e.g.~\cite{johnson:1986a,courtois:2011,oh:2013a,smirnov:2013a}, etc). Considering the projections introduced in definition~\ref{def:Projection}, we notice that: \begin{remark} Considering definitions introduced in Section~\ref{sec:Projection}, we notice that Laderman matrix multiplication tensor defines~$4$ optimal~$\matrixsize{2}{2}$ matrix multiplication tensors~$\TensorProjection{i}{j}{k}{\tensor{L}}$ with~${(i,j,k)}$ in~${\lbrace (2,1,3),(2,3,2), (3,1,2),(3,3,3)\rbrace}$ and~$23$ other with tensor rank~$8$. \end{remark} Further computations show that: \begin{remark} The type of the Laderman matrix multiplication tensor is \begin{equation} \label{eq:18} \big[ \repeated{(2,2,2)}{4}, \repeated{((1,3,1), (3,1,1), (1,1,3))}{2}, \repeated{(1,1,1)}{13} \big] \end{equation} where~$\repeated{m}{n}$ indicates that~$m$ is repeated~$n$ times. \end{remark} \subsection{Tensors' isotropies} We refer to~\cite{groot:1978a, groot:1978} for a complete presentation of automorphism group operating on varieties defined by algorithms for computation of bilinear mappings and as a reference for the following theorem: \begin{theorem} The isotropy group of the~$\matrixsize{n}{n}$ matrix multiplication tensor is \begin{equation} \label{eq:2} {\mathsc{pgl}({\mathbb{C}}^{n})}^{\times 3} \rtimes \mathfrak{S}_{3}, \end{equation} where~$\mathsc{pgl}$ stands for the projective linear group and~$\mathfrak{S}_{3}$ for the symmetric group on~$3$ elements. \end{theorem} Even if we do not completely explicit the concrete action of this isotropy group on matrix multiplication tensor, let us precise some terminologies: \begin{definitions} Given a tensor defining matrix multiplication computations, the orbit of this tensor is called the \emph{multiplication algorithm} and any of the points composing this orbit is a \emph{variant} of this algorithm. \end{definitions} \begin{remark} As shown in~\cite{Gesmundo:2016aa}, matrix multiplication is characterised by its isotropy group. \end{remark} \begin{remark} In this note, we only need the~${\mathsc{pgl}({\mathbb{C}}^{n})}^{\times 3}$ part of this group (a.k.a.\ sandwiching) and thus focus on it in the sequel. \end{remark} As our framework and notations differ slightly from the framework classically found in the literature, we have to explicitly define several well-known notions for the sake of clarity. Hence, let us recall the \emph{sandwiching} action: \begin{definition} Given~${\Isotropy{g}={(G_{1}\times G_{2} \times G_{3})}}$ an element of~${\mathsc{pgl}({\mathbb{C}}^{n})}^{\times 3}$, its action on a tensor~$\tensor{T}$ is given by: \begin{equation} \label{eq:7} \begin{aligned} \IsotropyAction{\Isotropy{g}}{\tensor{T}} &= \sum_{i=1}^{r} \IsotropyAction{\Isotropy{g}}{(T_{i1}\otimes{} T_{i2}\otimes{} T_{i3})}, \\ \IsotropyAction{\Isotropy{g}}{(T_{i1}\otimes{} T_{i2}\otimes{} T_{i3})} &= \left( \Transpose{G_{1}^{-1}} T_{i1}\Transpose{G_{2}} \right) \otimes{} \left( \Transpose{G_{2}^{-1}} T_{i2}\Transpose{G_{3}} \right) \otimes{} \left( \Transpose{G_{3}^{-1}} T_{i3}\Transpose{G_{1}} \right)\!. \end{aligned} \end{equation} \end{definition} \begin{example} Let us consider the action of the following isotropy \begin{equation} \label{eq:8} \left(% \begin{array}{cc} 0 & 1/\lambda \\ -1 & 0 \end{array}\right) \times\left(% \begin{array}{cc} 1/\lambda & -1/\lambda \\ 0 & 1 \end{array}\right) \times\left(% \begin{array}{cc} -1/\lambda & 0 \\ 1 & -1 \end{array}\right) \end{equation} on the Strassen variant of the Strassen algorithm. The resulting tensor~$\tensor{W}$ is: \par \scriptsize% \begin{equation} \label{eq:10} \begin{aligned} \sum_{i=1}^{7} w_{i} &= \left(\!\! \begin{array}{cc} -1&\lambda\\ -\frac{1}{\lambda}&0\\ \end{array} \!\!\right) \!\otimes\! \left(\!\! \begin{array}{cc} 1&-\lambda\\ \frac{1}{\lambda}&0\\ \end{array} \!\!\right) \!\otimes\! \left(\!\! \begin{array}{cc} 1&-\lambda\\ \frac{1}{\lambda}&0\\ \end{array} \!\!\right) + \left(\!\! \begin{array}{cc} -1&l\\ -\frac{1}{\lambda}&1\\ \end{array} \!\!\right) \!\otimes\! \left(\!\! \begin{array}{cc} 0&0\\ 1&0\\ \end{array} \!\!\right) \!\otimes\! \left(\!\! \begin{array}{cc} 0&1\\ 0&0\\ \end{array} \!\!\right) \\[\smallskipamount] & + \left(\!\! \begin{array}{cc} 1&0\\ \frac{1}{\lambda}&0\\ \end{array} \!\!\right) \!\otimes\! \left(\!\! \begin{array}{cc} 1&0\\ \frac{1}{\lambda}&0\\ \end{array} \!\!\right) \!\otimes\! \left(\!\! \begin{array}{cc} 1&0\\ \frac{1}{\lambda}&0\\ \end{array} \!\!\right) + \left(\!\! \begin{array}{cc} 0&0\\ 0&1\\ \end{array} \!\!\right) \!\otimes\! \left(\!\! \begin{array}{cc} 0&0\\ 0&1\\ \end{array} \!\!\right) \!\otimes\! \left(\!\! \begin{array}{cc} 0&0\\ 0&1\\ \end{array} \!\!\right) \\[\smallskipamount] & + \left(\!\! \begin{array}{cc} 0&0\\ 1&0\\ \end{array} \!\!\right) \!\otimes\! \left(\!\! \begin{array}{cc} 0&1\\ 0&0\\ \end{array} \!\!\right) \!\otimes\! \left(\!\! \begin{array}{cc} -1&\lambda\\ -\frac{1}{\lambda}&1\\ \end{array} \!\!\right) + \left(\!\! \begin{array}{cc} 1&-\lambda\\ 0&0\\ \end{array} \!\!\right) \!\otimes\! \left(\!\! \begin{array}{cc} 1&-\lambda\\ 0&0\\ \end{array} \!\!\right) \!\otimes\! \left(\!\! \begin{array}{cc} 1&-\lambda\\ 0&0\\ \end{array} \!\!\right) \\[\smallskipamount] &+ \left(\!\! \begin{array}{cc} 0&1\\ 0&0\\ \end{array} \!\!\right) \!\otimes\! \left(\!\! \begin{array}{cc} -1&\lambda\\ -\frac{1}{\lambda}&1\\ \end{array} \!\!\right) \!\otimes\! \left(\!\! \begin{array}{cc} 0&0\\ 1&0\\ \end{array} \!\!\right) \end{aligned} \end{equation} \normalsize% \end{example} that is the well-known Winograd variant of Strassen algorithm. \begin{remarks} We keep the parameter~$\lambda$ useless in our presentation as a tribute to the construction made in~\cite{chatelin:1986a} that gives an elegant and elementary (i.e.\ based on matrix eigenvalues) construction of Winograd variant of Strassen matrix multiplication algorithm. \par This variant is remarkable in its own as shown in~\cite{bshouty:1995a} because it is optimal w.r.t.\ multiplicative \emph{and} additive complexity. \end{remarks} \begin{remark} Tensor's type is an invariant of isotropy's action. Hence, two tensors in the same orbit share the same type. Or equivalently, two tensors with the same type are two variants that represent the same matrix multiplication algorithm. \end{remark} This remark will allow us in Section~\ref{sec:ResultingTensor} to recognise the tensor constructed below as a variant of the Laderman matrix multiplication algorithm. \section{A tensor's construction}\label{sec:LadermanWinogradConstruction} Let us now present the construction of a variant of Laderman matrix multiplication algorithm based on Winograd variant of Strassen matrix multiplication algorithm. \par First, let us give the full contraction of the tensor~$\TensorLift{1}{1}{1}{\tensor{W}}\otimes{} A \otimes{} B \otimes{} C$: \begin{subequations} \begin{align} \label{eq:FULLWIN1} \left( -{ a_{22}}-{\frac {{ a_{32}}}{\lambda}}+\lambda{ a_{23}} \right) \left( { b_{22}}+{ \frac {{ b_{32}}}{\lambda}}-\lambda{ b_{23}} \right) \left( { c_{22}}+{\frac {{ c_{32}}}{\lambda}}-\lambda{ c_{23}} \right) &+ \\ \left( { a_{22}}-\lambda{ a_{23}} \right) \left( { b_{22}}-\lambda{ b_{23}} \right) \left( { c_{22}}-\lambda{ c_{23}} \right) &+ \\ \left( { a_{22}}+{\frac {{ a_{32}}}{\lambda}} \right) \left( { b_{22}}+{\frac {{ b_{32}}}{\lambda}} \right) \left( { c_{22}}+{\frac {{ c_{32}}}{\lambda}} \right) &+ \\ \label{eq:FW1E1}\mathcolor{blue}{{ a_{23}}\, \left( -{ b_{22}}-{\frac {{ b_{32}}}{\lambda}}+\lambda{ b_{23}}+{ b_{33}} \right) { c_{32}}} &+\\ \label{eq:FW1E2}\mathcolor{blue}{\left( -{ a_{22}}-{\frac {{ a_{32}}}{\lambda}}+\lambda{ a_{23}}+{ a_{33}} \right) { b_{32}}\,{ c_{23}}} &+\\ \label{eq:FW1E3}\mathcolor{blue}{{ a_{32}}\,{ b_{23}}\, \left( -{ c_{22}}-{\frac {{ c_{32}}}{\lambda}}+\lambda{ c_{23}}+{ c_{33}} \right)} &+\\ \label{eq:FP1}\mathcolor{cyan}{{ a_{33}}\,{ b_{33}}\,{c_{33}}} \end{align} \end{subequations} \subsection{A Klein four-group of isotropies}\label{sec:KleinFourGroup} Let us introduce now the following notations: \begin{equation} \label{eq:12} \IdMat{3}=\left(% \begin{array}{ccc} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{array}\right)\! \quad \textup{and}\quad P_{(12)}=\left(% \begin{array}{ccc} 0 & 1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 1 \end{array}\right) \end{equation} used to defined the following group of isotropies: \begin{equation} \label{eq:KleinFourGroup} \Group{K} = \left\lbrace \begin{array}{cc} \Isotropy{g_{1}}={\IdMat{3}}^{\times 3}, & \Isotropy{g_{2}} =\left(\IdMat{3} \times P_{(12)} \times P_{(12)}\right)\!, \\ \Isotropy{g_{3}}=\left(P_{(12)} \times P_{(12)} \times \IdMat{3}\right)\!, & \Isotropy{g_{4}} =\left(P_{(12)} \times \IdMat{3} \times P_{(12)}\right) \end{array} \right\rbrace{} \end{equation} that is isomorphic to the Klein four-group. \subsection{Its action on Winograd variant of Strassen algorithm} In the sequel, we are interested in the action of Klein four-group~(\ref{eq:KleinFourGroup}) on our Winograd variant of Strassen algorithm: \begin{equation} \label{eq:19} \IsotropyGroupAction{\Group{K}}{\TensorLift{1}{1}{1}{\tensor{W}}}=\sum_{\Isotropy{g}\in\Group{K}} \IsotropyAction{\Isotropy{g}}{\TensorLift{1}{1}{1}{\tensor{W}}} = \sum_{\Isotropy{g}\in\Group{K}} \sum_{i=1}^{7}\IsotropyAction{\Isotropy{g}}{\TensorLift{1}{1}{1}{w_{i}}} \end{equation} As we have for any isotropy~$\Isotropy{g}$: \begin{equation} \label{eq:21} \left\langle\IsotropyAction{\Isotropy{g}}{\TensorLift{1}{1}{1}{\tensor{W}}} | A\otimes{} B \otimes{} C\right\rangle = \left\langle \TensorLift{1}{1}{1}{\tensor{W}} | \IsotropyAction{\Isotropy{g}}{(A \otimes{} B\otimes{} C)}\right\rangle, \end{equation} the action of isotropies~$\Isotropy{g_{i}}$ is just a permutation of our generic matrix coefficients. Hence, we have the full contraction of the tensor~$(\IsotropyAction{\Isotropy{g_{2}}}{\TensorLift{1}{1}{1}{\tensor{W}}})\otimes{} A \otimes{} B \otimes{} C$: \begin{subequations} \begin{align} \label{eq:FULLWIN2} \left( -{ a_{21}}-{\frac {{ a_{31}}}{\lambda}}+\lambda{ a_{23}} \right) \left( { b_{11}}+{ \frac {{ b_{31}}}{\lambda}}-\lambda{ b_{13}} \right) \left( { c_{12}}+{\frac {{ c_{32}}}{\lambda}}-\lambda{ c_{13}} \right) &+ \\ \left( { a_{21}}-\lambda{ a_{23}} \right) \left( { b_{11}}-\lambda{ b_{13}} \right) \left( { c_{12}}-\lambda{ c_{13}} \right) &+ \\ \left( { a_{21}}+{\frac {{ a_{31}}}{\lambda}} \right) \left( { b_{11}}+{\frac {{ b_{31}}}{\lambda}} \right) \left( { c_{12}}+{\frac {{ c_{32}}}{\lambda}} \right) &+ \\ \label{eq:FW2E1}\mathcolor{blue}{{ a_{23}}\, \left( -{ b_{11}}-{\frac {{ b_{31}}}{\lambda}}+\lambda{ b_{13}}+{ b_{33}} \right) { c_{32}}}&+\\ \label{eq:FW2E2}\mathcolor{blue}{\left( -{ a_{21}}-{\frac {{ a_{31}}}{\lambda}}+\lambda{ a_{23}}+{ a_{33}} \right) { b_{31}}\,{ c_{13}}} &+\\ \label{eq:FW2E3}\mathcolor{blue}{{ a_{31}}\,{ b_{13}}\, \left( -{ c_{12}}-{\frac {{ c_{32}}}{\lambda}}+\lambda{ c_{13}}+{ c_{33}} \right)} &+\\ \label{eq:FP2}\mathcolor{cyan}{{ a_{33}}\,{ b_{33}}\,{c_{33}}}, \end{align} \end{subequations} the full contraction of the tensor~$(\IsotropyAction{\Isotropy{g_{3}}}{\TensorLift{1}{1}{1}{\tensor{W}}})\otimes{} A \otimes{} B \otimes{} C$: \begin{subequations} \begin{align} \label{eq:FULLWIN3} \left( -{ a_{11}}-{\frac {{ a_{31}}}{\lambda}}+\lambda{ a_{13}} \right) \left( { b_{12}}+{ \frac {{ b_{32}}}{\lambda}}-\lambda{ b_{13}} \right) \left( { c_{21}}+{\frac {{ c_{31}}}{\lambda}}-\lambda{ c_{23}} \right) &+ \\ \left( { a_{11}}-\lambda{ a_{13}} \right) \left( { b_{12}}-\lambda{ b_{13}} \right) \left( { c_{21}}-\lambda{ c_{23}} \right) &+ \\ \left( { a_{11}}+{\frac {{ a_{31}}}{\lambda}} \right) \left( { b_{12}}+{\frac {{ b_{32}}}{\lambda}} \right) \left( { c_{21}}+{\frac {{ c_{31}}}{\lambda}} \right) &+ \\ \label{eq:FW3E1}\mathcolor{blue}{{ a_{13}}\, \left( -{ b_{12}}-{\frac {{ b_{32}}}{\lambda}}+\lambda{ b_{13}}+{ b_{33}} \right) { c_{31}}} &+\\ \label{eq:FW3E2}\mathcolor{blue}{\left( -{ a_{11}}-{\frac {{ a_{31}}}{\lambda}}+\lambda{ a_{13}}+{ a_{33}} \right) { b_{32}}\,{ c_{23}}} &+\\ \label{eq:FW3E3}\mathcolor{blue}{{ a_{31}}\,{ b_{13}}\, \left( -{ c_{21}}-{\frac {{ c_{31}}}{\lambda}}+\lambda{ c_{23}}+{ c_{33}} \right)} &+\\ \label{eq:FP3}\mathcolor{cyan}{{ a_{33}}\,{ b_{33}}\,{c_{33}}} \end{align} \end{subequations} and the full contraction of the tensor~$(\IsotropyAction{\Isotropy{g_{4}}}{\TensorLift{1}{1}{1}{\tensor{W}}})\otimes{} A \otimes{} B \otimes{} C$: \begin{subequations} \begin{align} \label{eq:FULLWIN4} \left( -{ a_{12}}-{\frac {{ a_{32}}}{\lambda}}+\lambda{ a_{13}} \right) \left( { b_{21}}+{ \frac {{ b_{31}}}{\lambda}}-\lambda{ b_{23}} \right) \left( { c_{11}}+{\frac {{ c_{31}}}{\lambda}}-\lambda{ c_{13}} \right) &+ \\ \left( { a_{12}}-\lambda{ a_{13}} \right) \left( { b_{21}}-\lambda{ b_{23}} \right) \left( { c_{11}}-\lambda{ c_{13}} \right) &+ \\ \left( { a_{12}}+{\frac {{ a_{32}}}{\lambda}} \right) \left( { b_{21}}+{\frac {{ b_{31}}}{\lambda}} \right) \left( { c_{11}}+{\frac {{ c_{31}}}{\lambda}} \right) &+ \\ \label{eq:FW4E1}\mathcolor{blue}{{ a_{13}}\, \left( -{ b_{21}}-{\frac {{ b_{31}}}{\lambda}}+\lambda{ b_{23}}+{ b_{33}} \right) { c_{31}}} &+\\ \label{eq:FW4E2}\mathcolor{blue}{\left( -{ a_{12}}-{\frac {{ a_{32}}}{\lambda}}+\lambda{ a_{13}}+{ a_{33}} \right) { b_{31}}\,{ c_{13}}} &+\\ \label{eq:FW4E3}\mathcolor{blue}{{ a_{32}}\,{ b_{23}}\, \left( -{ c_{11}}-{\frac {{ c_{31}}}{\lambda}}+\lambda{ c_{13}}+{ c_{33}} \right)} &+\\ \label{eq:FP4}\mathcolor{cyan}{{ a_{33}}\,{ b_{33}}\,{c_{33}}}. \end{align} \end{subequations} There is several noteworthy points in theses expressions: \begin{remarks} \begin{itemize} \item the term~(\ref{eq:FP1}) is a fixed point of~$\Group{K}$'s action; \item the trilinear terms~(\ref{eq:FW1E1}) and~(\ref{eq:FW2E1}), (\ref{eq:FW1E2}) and~(\ref{eq:FW3E2}), (\ref{eq:FW1E3}) and~(\ref{eq:FW4E3}), (\ref{eq:FW2E2}) and~(\ref{eq:FW4E2}), (\ref{eq:FW2E3}) and~(\ref{eq:FW3E3}), (\ref{eq:FW3E1}) and~(\ref{eq:FW4E1}) could be \emph{added} in order to obtain new rank-on tensors without changing the tensor rank. For example~(\ref{eq:FW1E1})+(\ref{eq:FW2E1}) is equal to: \begin{equation} \label{eq:23} \mathcolor{blue}{{ a_{23}}\, \left( -{ b_{22}}-{\frac {{ b_{32}}}{\lambda}}+ \lambda{ b_{23}}+2 { b_{33}} -{ b_{11}}-{\frac {{ b_{31}}}{\lambda}}+ \lambda{ b_{13}}\right) { c_{32}}}. \end{equation} \end{itemize} \end{remarks} The tensor rank of the tensor~${\IsotropyGroupAction{\Group{K}}{\TensorLift{1}{1}{1}{\tensor{W}}}=\sum_{\Isotropy{g}\in\Group{K}} \IsotropyAction{\Isotropy{g}}{\TensorLift{1}{1}{1}{\tensor{W}}}}$ is~${1+3\cdot 4 + 6=19}$. Unfortunately, this tensor does not define a matrix multiplication algorithm (otherwise according to the lower bound presented in~\cite{blaser:2003}, it would be optimal and this note would have another title and impact). \par In the next section, after studying the action of isotropy group~$\Group{K}$ on the classical matrix multiplication algorithm, we are going to show how the tensor constructed above take place in construction of matrix multiplication tensor. \subsection{How far are we from a multiplication tensor?} Let us consider the classical~$\matrixsize{3}{3}$ matrix multiplication algorithm \begin{equation} \label{eq:9} \tensor{M} = \sum_{1\leq i,j,k \leq 3} e^{i}_{j} \otimes{} e^{j}_{k} \otimes{} e^{k}_{i} \end{equation} where~$e^{i}_{j}$ denotes the matrix with a single non-zero coefficient~$1$ at the intersection of line~$i$ and column~$j$. By considering the trilinear monomial: \begin{equation} \label{eq:22} a_{ij}b_{jk}c_{ki} = \left\langle e^{i}_{j} \otimes{} e^{j}_{k} \otimes{} e^{k}_{i} \,\big|\, A \otimes{} B \otimes{} C \right\rangle, \end{equation} we describe below the action of an isotropy~$\Isotropy{g}$ on this tensor by the induced action: \begin{equation} \label{eq:11} \begin{aligned} \IsotropyAction{\Isotropy{g}}{a_{ij}b_{jk}c_{ki}}&= \left\langle \IsotropyAction{\Isotropy{g}}{(e^{i}_{j} \otimes{} e^{j}_{k} \otimes{} e^{k}_{i})}\,\big|\, A \otimes{} B \otimes{} C \right\rangle\!, \\ &= \left\langle {e^{i}_{j} \otimes{} e^{j}_{k} \otimes{} e^{k}_{i}}\,\big|\, \IsotropyAction{\Isotropy{g}}{(A \otimes{} B \otimes{} C)} \right\rangle\!. \end{aligned} \end{equation} \begin{remark} The isotropies in~$\Group{K}$ act as a permutation on rank-one composant of the tensor~$\tensor{M}$: we say that the group~$\Group{K}$ is a \emph{stabilizer} of~$\tensor{M}$. More precisely, we have the following~$9$ orbits represented by the trilinear monomial sums:\par \footnotesize% \begin{subequations} \begin{align} \label{eq:20:1} \sum_{i=1}^{4} \IsotropyAction{\Isotropy{g_{i}}}{{a_{11}}\,{b_{11}}\,{c_{11}}} & = {a_{11}}\,{b_{11}}\,{c_{11}} + {a_{12}}\,{b_{22}}\,{c_{21}} + {a_{22}}\,{b_{21}}\,{c_{12}} + {a_{21}}\,{b_{12}}\,{c_{22}}, \\ \label{eq:20:2} \sum_{i=1}^{4} \IsotropyAction{\Isotropy{g_{i}}}{\mathcolor{blue}{{a_{22}}\,{b_{22}}\,{c_{22}}}} &= \mathcolor{blue}{{a_{22}}\,{b_{22}}\,{c_{22}}} + {a_{21}}\,{b_{11}}\,{c_{12}} + {a_{11}}\,{b_{12}}\,{c_{21}} + {a_{12}}\,{b_{21}}\,{c_{11}}, \\ \label{eq:20:3} \sum_{i=1}^{4} \IsotropyAction{\Isotropy{g_{i}}}{\mathcolor{blue}{{a_{22}}\,{b_{23}}\,{c_{32}}}}&= \mathcolor{blue}{{a_{22}}\,{b_{23}}\,{c_{32}}} + {a_{21}}\,{b_{13}}\,{c_{32}} + {a_{11}}\,{b_{13}}\,{c_{31}} + {a_{12}}\,{b_{23}}\,{c_{31}}, \\ \label{eq:20:4} \sum_{i=1}^{4} \IsotropyAction{\Isotropy{g_{i}}}{\mathcolor{blue}{{a_{23}}\,{b_{32}}\,{c_{22}}}}&= \mathcolor{blue}{{{a_{23}}\,{b_{32}}\,{c_{22}}}} + {a_{23}}\,{b_{31}}\,{c_{12}} + {a_{13}}\,{b_{32}}\,{c_{21}} + {a_{13}}\,{b_{31}}\,{c_{11}}, \\ \label{eq:20:5} \sum_{i=1}^{4} \IsotropyAction{\Isotropy{g_{i}}}{\mathcolor{blue}{{a_{32}}\,{b_{22}}\,{c_{23}}}}&= \mathcolor{blue}{{a_{32}}\,{b_{22}}\,{c_{23}}} + {a_{31}}\,{b_{11}}\,{c_{13}} + {a_{31}}\,{b_{12}}\,{c_{23}} + {a_{32}}\,{b_{21}}\,{c_{13}}, \\ \label{eq:20:6} \frac{1}{2}\sum_{i=1}^{4} \IsotropyAction{\Isotropy{g_{i}}}{\mathcolor{blue}{{a_{23}}\,{b_{33}}\,{c_{32}}}} &= \mathcolor{blue}{{a_{23}}\,{b_{33}}\,{c_{32}}} +{a_{13}}\,{b_{33}}\,{c_{31}}, \\ \label{eq:20:7} \frac{1}{2}\sum_{i=1}^{4} \IsotropyAction{\Isotropy{g_{i}}}{\mathcolor{blue}{{a_{32}}\,{b_{23}}\,{c_{33}}}} &= \mathcolor{blue}{{a_{32}}\,{b_{23}}\,{c_{33}}} +{a_{31}}\,{b_{13}}\,{c_{33}}, \\ \label{eq:20:8} \frac{1}{2}\sum_{i=1}^{4} \IsotropyAction{\Isotropy{g_{i}}}{\mathcolor{blue}{{a_{33}}\,{b_{32}}\,{c_{23}}}}&= \mathcolor{blue}{{a_{33}}\,{b_{32}}\,{c_{23}}} +{a_{33}}\,{b_{31}}\,{c_{13}}, \\ \label{eq:20:9} \frac{1}{4} \sum_{i=1}^{4} \IsotropyAction{\Isotropy{g_{i}}}{\mathcolor{blue}{{a_{33}}\,{b_{33}}\,{c_{33}}}} &= \mathcolor{blue}{{a_{33}}\,{b_{33}}\,{c_{33}}}. \end{align} \end{subequations} \normalsize \end{remark} Hence, the action of~$\Group{K}$ decomposes the classical matrix multiplication tensor~$\tensor{M}$ as a transversal action of~$\Group{K}$ on the implicit projection~$\TensorZero{1}{1}{1}{\tensor{M}}$, its action on the rank-one tensor~${ e^{1}_{1} \otimes{} e^{1}_{1} \otimes{} e^{1}_{1}}$ and a correction term also related to orbits under~$\Group{K}$: \begin{equation} \label{eq:25b} \begin{aligned} \tensor{M}& = \IsotropyGroupAction{\Group{K}}{\left( e^{1}_{1} \otimes{} e^{1}_{1} \otimes{} e^{1}_{1}\right)} + \IsotropyGroupAction{\Group{K}}{\TensorZero{1}{1}{1}{\tensor{M}}} - \tensor{R}, \\ \tensor{R} &=(1/2)\, \IsotropyGroupAction{\Group{K}}{\left( e^{2}_{3} \otimes{} e^{3}_{3}\otimes{} e^{3}_{2}\right)} +(1/2)\, \IsotropyGroupAction{\Group{K}}{\left( e^{3}_{3} \otimes{} e^{3}_{2}\otimes{} e^{2}_{3}\right)}\\ &+(1/2)\, \IsotropyGroupAction{\Group{K}}{\left( e^{3}_{2} \otimes{} e^{2}_{3}\otimes{} e^{3}_{3}\right)} + 3\,\IsotropyGroupAction{\Group{K}}{\left( e^{3}_{3} \otimes{} e^{3}_{3}\otimes{} e^{3}_{3}\right)}. \end{aligned} \end{equation} \subsection{Resulting matrix multiplication algorithm}\label{sec:ResultingTensor} The term~${\TensorZero{1}{1}{1}{\tensor{M}}}$ is a~$\matrixsize{2}{2}$ matrix multiplication algorithm that could be replaced by any other one. Choosing~$\TensorLift{1}{1}{1}{\tensor{W}}$, we have the following properties: \begin{itemize} \item the tensor rank of~$\IsotropyGroupAction{\Group{K}}{\TensorLift{1}{1}{1}{\tensor{W}}}$ is~$19$; \item its addition with the correction term~$\tensor{R}$ does not change its tensor rank. \end{itemize} Hence, we obtain a matrix multiplication tensor with rank~${23(={19+4})}$. Furthermore, the resulting tensor have the same type than the Laderman matrix multiplication tensor, and thus it is a variant of the same algorithm. \par We conclude that the Laderman matrix multiplication algorithm can be constructed using the orbit of an optimal~$\matrixsize{2}{2}$ matrix multiplication algorithm under the action of a given group leaving invariant classical~$\matrixsize{3}{3}$ matrix multiplication variant/algorithm and with a transversal action on one of its projections. \section{Concluding remarks} All the observations presented in this short note came from an experimental mathematical approach using the computer algebra system Maple~\cite{monagan:2007a}. While implementing effectively (if not efficiently) several tools needed to manipulate matrix multiplication tensor---tensors, their isotropies and contractions, etc.---in order to understand the theory, the relationship between the Laderman matrix multiplication algorithm and the Strassen algorithm became clear by simple computations that will be tedious or impossible by hand. \par As already shown in~\cite{sykora:1977a}, this kind of geometric configuration could be found and used with other matrix size. \par The main opinion supported by this work is that symmetries play a central role in effective computation for matrix multiplication algorithm and that only a geometrical interpretation may brings further improvement. \paragraph{Acknowledgment.} The author would like to thank Alin Bostan for providing information on the work~\cite{sykora:1977a}. \bibliographystyle{acm}
{'timestamp': '2017-05-11T02:05:22', 'yymm': '1703', 'arxiv_id': '1703.08298', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08298'}
arxiv
\section{Algorithms} \section{Description of the Algorithms for the Three Sub-Problems} \label{apdx_subprobs} \subsection{Access Optimization} Given the placement and the auxiliary variables, this subproblem can be written as follows. \textbf{Input: $\boldsymbol{t}$, $\mathcal{\boldsymbol{S}}$ } \textbf{Objective:} $\qquad\quad\;\;$min $\left(\ref{eq:joint_otp_prob}\right)$ $\hphantom{\boldsymbol{\text{Objective:}\,}}\qquad\qquad$s.t. \eqref{eq:rho_j}, \eqref{eq:Lambda_j}, \eqref{eq:sum_ij}, \eqref{eq:pij}, \eqref{eq:don_pos_cond}, \eqref{eq:don_pos_cond2} $\hphantom{\boldsymbol{\text{Objective:}\,}}\qquad\qquad$var. $\boldsymbol{\pi}$ In order to solve this problem, we have used iNner cOnVex Approximation (NOVA) algorithm proposed in \cite{scutNOVA} to solve this sub-problem. The key idea for this algorithm is that the non-convex objective function is replaced by suitable convex approximations at which convergence to a stationary solution of the original non-convex optimization is established. NOVA solves the approximated function efficiently and maintains feasibility in each iteration. The objective function can be approximated by a convex one (e.g., proximal gradient-like approximation) such that the first order properties are preserved \cite{scutNOVA}, and this convex approximation can be used in NOVA algorithm. Let $\widetilde{U}\left(\boldsymbol{\pi};\boldsymbol{\pi^\nu}\right)$ be the convex approximation at iterate $\boldsymbol{\pi^\nu}$ to the original non-convex problem $U\left(\boldsymbol{\pi}\right)$, where $U\left(\boldsymbol{\pi}\right)$ is given by (\ref{eq:joint_otp_prob}). Then, a valid choice of $\widetilde{U}\left(\boldsymbol{\pi};\boldsymbol{\pi^\nu}\right)$ is the first order approximation of $U\left(\boldsymbol{\pi}\right)$, e.g., (proximal) gradient-like approximation, i.e., \begin{equation} \widetilde{U}\left(\boldsymbol{\pi},\boldsymbol{\pi^\nu}\right)=\nabla_{\boldsymbol{\pi}}U\left(\boldsymbol{\pi^\nu}\right)^{T}\left(\boldsymbol{\pi}-\boldsymbol{\pi^\nu}\right)+\frac{\tau_{u}}{2}\left\Vert \boldsymbol{\pi}-\boldsymbol{\pi^\nu}\right\Vert ^{2},\label{eq:U_x_u_bar} \end{equation} where $\tau_u$ is a regularization parameter. Note that all the constraints \eqref{eq:rho_j}, \eqref{eq:Lambda_j}, \eqref{eq:sum_ij}, \eqref{eq:pij}, \eqref{eq:don_pos_cond}, and \eqref{eq:don_pos_cond2} are linear in $\boldsymbol{\pi_{i,j}}$. The NOVA Algorithm for optimizing $\boldsymbol{\pi}$ is described in Algorithm \ref{alg:NOVA_Alg1Pi}. Using the convex approximation $\widetilde{U}\left(\boldsymbol{\pi};\boldsymbol{\pi^\nu}\right)$, the minimization steps in Algorithm \ref{alg:NOVA_Alg1Pi} are convex, with linear constraints and thus can be solved using a projected gradient descent algorithm. A step-size ($\gamma $) is also used in the update of the iterate $\boldsymbol{\pi}^{\nu}$. Note that the iterates $\left\{ \boldsymbol{\pi}^{(\nu)}\right\} $ generated by the algorithm are all feasible for the original problem and, further, convergence is guaranteed, as shown in \cite{scutNOVA} and described in the following lemma. \begin{lemma} \label{lem_pi} For fixed placement $\boldsymbol{\mathcal{S}}$ and $\boldsymbol{t}$, the optimization of our problem over $\boldsymbol{\pi}$ generates a sequence of decreasing objective values and therefore is guaranteed to converge to a stationary point. \end{lemma} \begin{algorithm}[h] \caption{NOVA Algorithm to solve Access Optimization sub-problem\label{alg:NOVA_Alg1Pi}} \begin{enumerate} \item \textbf{Initialize} $\nu=0$, $k=0$,$\gamma^{\nu}\in\left(0,1\right]$, $\epsilon>0$,$\boldsymbol{\pi}^{0}$ such that $\boldsymbol{\pi}^{0}$ is feasible , \item \textbf{while} $\mbox{obj}\left(k\right)-\mbox{obj}\left(k-1\right)\geq\epsilon$ \item $\quad$//\textit{\small{}Solve for $\boldsymbol{\pi}^{\nu+1}$ with given $\boldsymbol{\pi}^{\nu}$}{\small \par} \item $\quad$\textbf{Step 1}: Compute $\boldsymbol{\widehat{\pi}}\left(\boldsymbol{\pi}^{\nu}\right),$ the solution of $\boldsymbol{\widehat{\pi}}\left(\boldsymbol{\pi}^{\nu}\right)=$$\underset{\boldsymbol{\pi}}{\text{argmin}}$ $\boldsymbol{\widetilde{U}}\left(\boldsymbol{\pi},\boldsymbol{\pi}^{\nu}\right)\,\, $ s.t. $\left(\ref{eq:rho_j}\right)$, $\left(\ref{eq:Lambda_j}\right)$, $\left(\ref{eq:sum_ij}\right)$, $\left(\ref{eq:pij}\right)$, $(\ref{eq:t_i_alpha_j})$, $\left(\ref{eq:don_pos_cond}\right)$, solved using projected gradient descent \item $\quad$\textbf{Step 2}: $\ensuremath{\boldsymbol{\pi}^{\nu+1}=\boldsymbol{\pi}^{\nu}+\gamma^{\nu}\left(\widehat{\boldsymbol{\pi}}\left(\boldsymbol{\pi}^{\nu}\right)-\boldsymbol{\pi}^{\nu}\right)}$. \item $\quad$//\textit{\small{}update index}{\small \par} \item \textbf{Set} $\ensuremath{\nu\leftarrow\nu+1}$ \item \textbf{end while} \item \textbf{output: }$\ensuremath{\widehat{\boldsymbol{\pi}}\left(\boldsymbol{\pi}^{\nu}\right)}$ \end{enumerate} \end{algorithm} \begin{algorithm}[h] \caption{NOVA Algorithm to solve Auxiliary Variables Optimization sub-problem\label{alg:NOVA_Alg1}} \begin{enumerate} \item \textbf{Initialize} $\nu=0$,$\gamma^{\nu}\in\left(0,1\right]$, $\epsilon>0$, $\boldsymbol{t}^{0}$ such that $\boldsymbol{t}^{0}$ is feasible, \item \textbf{while} $\mbox{obj}\left(\nu\right)-\mbox{obj}\left(\nu-1\right)\geq\epsilon$ \item $\quad$//\textit{\small{}Solve for $\boldsymbol{t}^{\nu+1}$ with given $\boldsymbol{t}^{\nu}$}{\small \par} \item $\quad$\textbf{Step 1}: Compute $\boldsymbol{\widehat{t}}\left(\boldsymbol{t}^{\nu}\right),$ the solution of $\boldsymbol{\widehat{t}}\left(\boldsymbol{t}^{\nu}\right)=$$\underset{\boldsymbol{t}}{\text{argmin}}$ $\boldsymbol{\overline{U}}\left(\boldsymbol{t},\boldsymbol{t}^{\nu}\right)$, s.t. \eqref{eq:t_i_alpha_j}, \eqref{M_telda_less_1}, and \eqref{eq:don_pos_cond} using projected gradient descent \item $\quad$\textbf{Step 2}: $\ensuremath{\boldsymbol{t}^{\nu+1}=\boldsymbol{t}^{\nu}+\gamma^{\nu}\left(\widehat{\boldsymbol{t}}\left(\boldsymbol{t}^{\nu}\right)-\boldsymbol{t}^{\nu}\right)}$. \item $\quad$//\textit{\small{}update index}{\small \par} \item \textbf{Set} $\ensuremath{\nu\leftarrow\nu+1}$ \item \textbf{end while} \item \textbf{output: }$\ensuremath{\widehat{\boldsymbol{t}}\left(\boldsymbol{t}^{\nu}\right)}$ \end{enumerate} \end{algorithm} \subsection{Auxiliary Variables Optimization } Given the placement and the access variables, this subproblem can be written as follows. \textbf{Input: $\boldsymbol{\pi}$, $\mathcal{\boldsymbol{S}}$ } \textbf{Objective:} $\qquad\quad\;\;$min $\left(\ref{eq:joint_otp_prob}\right)$ $\hphantom{\boldsymbol{\text{Objective:}\,}}\qquad\qquad$s.t. \eqref{eq:t_i_alpha_j}, \eqref{eq:t_i_alpha_j2}, \eqref{M_telda_less_1_2},\eqref{M_telda_less_1}, \eqref{eq:don_pos_cond}, \eqref{eq:don_pos_cond2}, $\hphantom{\boldsymbol{\text{Objective:}\,}}\qquad\qquad$var. $\boldsymbol{t}$ Similar to Access Optimization, this optimization can be solved using NOVA algorithm. The constraints \eqref{eq:t_i_alpha_j} and \eqref{eq:t_i_alpha_j2} are linear in $\boldsymbol{t}$. The next two Lemmas show that the constraints \eqref{M_telda_less_1_2}, \eqref{M_telda_less_1}, \eqref{eq:don_pos_cond}, and \eqref{eq:don_pos_cond2} are convex in $\boldsymbol{t}$ respectively. \begin{lemma} \label{Mconvex} The constraints \eqref{M_telda_less_1_2} and \eqref{M_telda_less_1} are convex with respect to $\boldsymbol{{t}}$. \end{lemma} \begin{proof} The proof is provided in Appendix \ref{apdx:Mconvex}. \end{proof} \begin{lemma} The constraints \eqref{eq:don_pos_cond} and \eqref{eq:don_pos_cond2} are convex with respect to $\boldsymbol{{t}}$. \label{don_convex} \end{lemma} \begin{proof} The proof is provided in Appendix \ref{apdx_don}. \end{proof} Algorithm \ref{alg:NOVA_Alg1} shows the used procedure to solve for $\boldsymbol{t}$. Let $\overline{U}\left(\boldsymbol{t};\boldsymbol{t^\nu}\right)$ be the convex approximation at iterate $\boldsymbol{t^\nu}$ to the original non-convex problem $U\left(\boldsymbol{t}\right)$, where $U\left(\boldsymbol{t}\right)$ is given by (\ref{eq:joint_otp_prob}), assuming other parameters constant. Then, a valid choice of $\overline{U}\left(\boldsymbol{t};\boldsymbol{t^\nu}\right)$ is the first order approximation of $U\left(\boldsymbol{t}\right)$, i.e., \begin{equation} \overline{U}\left(\boldsymbol{t},\boldsymbol{t^\nu}\right)=\nabla_{\boldsymbol{t}}U\left(\boldsymbol{t^\nu}\right)^{T}\left(\boldsymbol{t}-\boldsymbol{t^\nu}\right)+\frac{\tau_{t}}{2}\left\Vert \boldsymbol{t}-\boldsymbol{t^\nu}\right\Vert ^{2}.\label{eq:U_t_u_bar} \end{equation} where $\tau_t$ is a regularization parameter. The detailed steps can be seen in Algorithm \ref{alg:NOVA_Alg1}. Since all the constraints \eqref{eq:t_i_alpha_j}, \eqref{M_telda_less_1},and \eqref{eq:don_pos_cond} have been shown to be convex in $\boldsymbol{t}$, the optimization problem in Step 1 of Algorithm \ref{alg:NOVA_Alg1} can be solved by the standard projected gradient descent algorithm. \input{plc} \section{Extension to more streams between the server and the edge router} \label{apdx_entend} In this section, we investigate extending the proposed approach to the case when there are $y$ parallel streams from each server to the edge router. Multiple streams can help obtain parallel video files thus helping one file not wait behind the other. We label the $y$ streams from server $j$ as $\nu_j \in \{1, \cdots, y\}$ (graphically depicted in Figure \ref{fig:PS_y}). The analysis in this paper considers only one stream between the server and the edge router. We now show how the analysis can be adapted when there are multiple streams. We first note that the scheduling need to decide not only the server $j$ but also the parallel stream $\nu_j$. We assume that the parallel stream $\nu_j$ is chosen equally likely. Further, the multiple streams are obtained through equal bandwidth splits, and thus the service time parameters would be different for streams as compared to the server. For instance, the service rate would be a factor of $y$ of the service rate from the server due to the bandwidth split. Thus, the probability of choosing server $j$ and stream $\nu_j$ is \begin{equation} q_{i,j,\nu_{j}}=\pi_{i,j}/y,\label{eq:pi_i_j_nu} \end{equation} where $\pi_{i,j}$ is the probability of choosing server $j$. Using this, we note that the analysis of download time from a server can be modified to download time from a stream of a server and the steps can be directly extended. The ordered statistics can use the above probabilistic scheduling to choose a stream of a server and thus the entire analysis can be easily extended. Since the optimization also has the same parameters, we show an improvement of the mean stall duration with the number of parallel streams in Fig. \ref{fig:meanStall_vs_y_j}. The choice of the number of streams $y$ can be determined by the practical limitations ({\it e.g.}, number of ports possible at the server). A more detailed analysis of the parallel streams, exploiting the flexibilities of splitting of bandwidths among the different streams, choosing one of the multiple parallel streams for each video are being considered by the PI in \cite{Abubakr_SPCOM, Abubakr_Stall_Qual}. \begin{figure} \includegraphics[trim=0.0in 4.5in 0.1in .1in, clip, width=.45\textwidth]{figsRev/sysModelPS_rev} \vspace{-.3in} \caption{An Illustration of a distributed storage system where a server has $y$ parallel streams to the edge router.\label{fig:PS_y}} \vspace{-.2in} \end{figure} \begin{figure}[t] \centering \includegraphics[trim=0in 0in 4.3in 0in, clip, width=0.48\textwidth]{figsRev/meanStall_vs_y} \caption{Mean stall duration for different number of parallel streams.} \label{fig:meanStall_vs_y_j} \end{figure}% \section{Impact Of Caching} \label{apdx:cache} So far, our analysis did not account for caching. In this Appendix, we present how our model can be extended to accommodate for the impact of caching. Caching content at the network edge, closer to the customers, can further help reducing the stall duration and thus improve the QoE. However, caching the video content has to address a number of crucial challenges that differ from caching of web objects, see for instance \cite{cache16} and the references therein for detailed treatment of this aspect. There are two methods for caching the video files. The first involves caching the complete video file (all $L_i$ video chunks of file $i$) at edge routers. The second method involves caching partial chunks, i.e., $L_{j,i}$, where $L_{j,i}\leq L_{i}$, for video file $i$. Most of the current caching schemes cache entire files (for example, hot files). Our analysis can accommodate both of these methods. In the first method, the video file is entirely cached, and is thus not requested from the servers. This is equivalent to changing the arrival rate of these files to zero, i.e., $\lambda_i=0$. In the second method, only the later $(L_{i} - L_{j,i})$ are needed from the servers. This can be easily incorporated by requesting the video of length $(L_{i} - L_{j,i})$, while the first chunk can wait for an additional $\tau L_{j,i}$ time which can be accounted by adding $\tau L_{j,i}$ in the startup delay for this file. \input{cachingMath} \section{Proof of Lemma \ref{Mconvex}}\label{apdx:Mconvex} The constraints \eqref{M_telda_less_1_2} and \eqref{M_telda_less_1} are separable for each $\widetilde{t}_i$ and $\overline{t}_i$ and thus it is enough to prove convexity of $C(t)=\alpha_{j}\left(e^{\left(\beta_{j}-\tau\right)t}-1\right)+t$. Thus, it is enough to prove that $C''(t)\ge 0$. The first derivative of $C(t)$ is given as \begin{equation} C'(t)=\alpha_{j}\left(\left(\beta_{j}-\tau\right)e^{\left(\beta_{j}-\tau\right)t}\right)+1 \end{equation} Differentiating it again, we get the second derivative as follows. \begin{equation} C''(t) =\alpha_{j}\left(\beta_{j}-\tau\right)^{2}e^{\left(\beta_{j}-\tau\right)t}\label{eq:C_22} \end{equation} Since $\alpha_j>0$, $C''(t)$ given in (\ref{eq:C_22}) is non-negative, which proves the Lemma. \section{Proof of Lemma \ref{don_convex}} \label{apdx_don} The constraints \eqref{eq:don_pos_cond} and \eqref{eq:don_pos_cond2} are separable for each each $\widetilde{t}_i$ and $\overline{t}_i$, and thus it is enough to prove convexity of $E(t) = \sum_{f=1}^r\pi_{fj}\lambda_{f}\left(\frac{\alpha_{j}e^{\beta_{j}t}}{\alpha_{j}-t}\right)^{L_{f}}-\left(\Lambda_{j}+t\right)$ for $t<\alpha_j$. Thus, it is enough to prove that $E''(t)\ge 0$ for $t<\alpha_j$. We further note that it is enough to prove that $D''(t)\ge 0$, where $D(t) = \frac{e^{L_f\beta_{j}t}}{(\alpha_{j}-t)^{L_{f}}}$. Hence, the first derivative of $D(t)$ is given as \begin{align} D^{'}(t) & =\frac{L_{f}e^{L_{f}\beta_{j}t}\left[\beta_{j}+\left(\alpha_{j}-t\right)^{-1}\right]}{\left(\alpha_{j}-t\right)^{L_{f}}}>0 \end{align} Note that $D'(t)>0$ since $\alpha_j>t$. Differentiating it again to get the second derivative, we get the second derivative as follows. \begin{eqnarray} &&D^{''}(t) =\frac{L_{f}\beta_{j}e^{L_{f}\beta_{j}t}}{\left(\alpha_{j}-t\right)^{L_{f}+2}}\times\nonumber\\ && \left[\beta_{j}+\left(1+L_{f}\right)\left(\alpha_{j}-t\right)^{-1}\left(1+\frac{1}{\beta_{j}\left(\alpha_{j}-t\right)}\right)\right] \label{eq:E_22} \end{eqnarray} Since $\alpha_j>t$, $D''(t)$ given in \eqref{eq:E_22} is non-negative, which proves the Lemma. \subsection{Download Times of the Chunks from each Server} In this subsection, we will quantify the download time of chunk for video file $i$ from server $j$ which has chunks $C_{i,q}^{(g_j)}$ for all $q = 1, \cdots L_i$. We consider download of $q^{\text{th}}$ chunk $C_{i,q}^{(g_j)}$. As seen in Figure \ref{fig:sysModel}, the download of $C_{i,q}^{(g_j)}$ consists of two components - the waiting time of all the video files in queue before file $i$ request and the service time of all chunks of video file $i$ up to the $q^{\text{th}}$ chunk. Let $\ensuremath{W_{j}}$ be the random variable corresponding to the waiting time of all the video files in queue before file $i$ request and $Y_{j}^{(q)}$ be the (random) service time of coded chunk $q$ for file $i$ from server $j$. Then, the (random) download time for coded chunk $q\in \{1, \cdots, L_i\}$ for file $i$ at server $j\in \mathcal{A}_{i}$, $D_{i,j}^{(q)}$, is given as \begin{equation} D_{i,j}^{(q)} = W_j + \sum_{v=1}^q Y_{j}^{(v)}. \label{dije} \end{equation} We will now find the distribution of $W_j$. We note that this is the waiting time for the video files whose arrival rate is given as $\varLambda_{j}=\sum_{i}\lambda_{i}\pi_{i,j}$. Since the arrival rate of video files is Poisson, the waiting time for the start of video download from a server $j$, $W_j$, is given by an M/G/1 process. In order to find the waiting time, we would need to find the service time statistics of the video files. Note that $f_{j}(x)$ gives the service time distribution of only a chunk and not of the video files. Video file $i$ consists of $L_{i}$ coded chunks at server $j$ ($j\in \mathcal{S}_{i}$). The total service time for video file $i$ at server $j$ if requested from server $j$, $ST_{i,j} $, is given as \begin{equation} ST_{i,j} = \sum_{v=1}^{L_i} Y_{j}^{(v)}. \end{equation} The service time of the video files is given as \begin{equation} R_{j} = \begin{cases} ST_{i,j} \quad \text{ with probability } \frac{\pi_{ij}\lambda_{i}}{\Lambda_j} \quad \forall i, \end{cases} \end{equation} since the service time is $ST_{i,j} $ when file $i$ is requested from server $j$. Let $\overline{R}_{j}(s) = {\mathbb E}[e^{-sR_{j} }]$ be the Laplace-Stieltjes Transform of $R_{j}$. \begin{lemma}\label{ljlemma} The Laplace-Stieltjes Transform of $R_{j}$, $\overline{R}_{j}(s)=\mathbb{E}\left[e^{-s\overline{R}_{j}}\right]$ is given as \begin{equation} \overline{R}_{j}(s) = \sum_{i=1}^r \frac{\pi_{ij}\lambda_i}{\Lambda_j} \left(\frac{\alpha_{j}e^{-\beta_{j}s}}{\alpha_{j}+s}\right)^{L_{i}}\label{eq:servTimeofFile} \end{equation} \end{lemma} \begin{proof} The proof is provided in Appendix \ref{apdx:ljlemma}. \end{proof} \begin{corollary} The moment generating function for the service time of video files when requested from server $j$, $B_{j}(t)$, is given by \begin{equation} B_{j}(t) = \sum_{i=1}^r \frac{\pi_{ij}\lambda_i}{\Lambda_j} \left(\frac{\alpha_{j}e^{\beta_{j}t}}{\alpha_{j}-t}\right)^{L_{i}}\label{eq:servTimeofFileB_j_i} \end{equation} for any $t>0$, and $t< \alpha_j$. \end{corollary} \begin{proof} This corollary follows from (\ref{eq:servTimeofFile}) by setting $t=-s$. \end{proof} The server utilization for the video files at server $j$ is given as $\rho_{j}=\varLambda_{j}\mathbb{E}\left[R_j\right]$. Since $\mathbb{E}\left[R_j\right] = B_j'(0)$, using Lemma \ref{eq:servTimeofFile}, we have \begin{equation} \rho_{j}=\sum_{i}\pi_{ij}\lambda_{i}L_{i}\left(\beta_{j}+\frac{1}{\alpha_{j}}\right)\label{eq:rho_j}. \end{equation} Having characterized the service time distribution of the video files via a Laplace-Stieltjes Transform $\overline{R}_{j}(s) $, the Laplace-Stieltjes Transform of the waiting time $W_{j}$ can be characterized using Pollaczek-Khinchine formula for M/G/1 queues \cite{zwart2000sojourn}, since the request pattern is Poisson and the service time is general distributed. Thus, the Laplace-Stieltjes Transform of the waiting time $W_{j}$ is given as \begin{equation} \mathbb{E}\left[e^{-sW_{j}}\right]=\frac{\left(1-\rho_{j}\right)s\overline{R}_{j}(s)}{s-\Lambda_{j}\left(1-\overline{R}_{j}(s)\right)}\label{eq:E_W_j_laplace} \end{equation} Having characterized the Laplace-Stieltjes Transform of the waiting time $W_{j}$ and knowing the distribution of $Y_{j}^{(v)}$, the Laplace-Stieltjes Transform of the download time $D_{i,j}^{(q)}$ is given as \begin{equation} {\mathbb E}[e^{-sD_{i,j}^{(q)}}] = \frac{\left(1-\rho_{j}\right)s\overline{R}_{j}(s)}{s-\Lambda_{j}\left(1-\overline{R}_{j}(s)\right)}\left( \frac{\alpha_{j}}{\alpha_{j}+s}\,e^{-\beta_{j}s}\right)^q.\label{LapOfE_D_ij} \end{equation} We note that the expression above holds only in the range of $s$ when $s-\Lambda_{j}\left(1-\overline{R}_{j}(s)\right)>0$ and $\alpha_{j}+s>0$. Further, the server utilization $\rho_j $ must be less than $1$. The overall download time of all the chunks for the segment $G_{i,q}$ at the client, $D_{i}^{(q)}$, is given by \begin{equation} D_{i}^{(q)} = \max_{j\in \mathcal{A}_{i}} D_{i,j}^{(q)}. \label{deq} \end{equation} \section{End-to-End Analysis} \label{apdx:e2e} In this Appendix, we show how our analysis can be extended to consider the last hop from the edge-router to the user. If the last hop is considered, the download time of the chunk $q$ for video file $i$, if requested from server $j$ can be written as follows \[ D_{i,j}^{(q)}=W_{j}+\sum_{v=1}^{q}Y_{j}^{(v)}+\frac{\tau\mathbb{R}_{i}}{\mathbb{C}_{i}}, \] where $W_j$ is the waiting time in the queue of server $j$, $Y_{j}^{(v)}$ is the service time for the chunk $v$, $\tau$ is the chunk size in seconds, $\mathbb{R}_{i}$ is the bit-rate for user $i$, and $\mathbb{C}_{i}$ is the average bandwidth when downloading chunk $q$. Thus, as long as $\frac{\tau\mathbb{R}_{i}}{\mathbb{C}_{i}}$ can be bounded, this is the additional stall duration (or additional startup delay). In most wired setups, the capacity for the last hop may not be a bottleneck, and thus this term is negligible and not varying significantly with $q$. Even for wireless network in homes, the average bandwidth numbers are much higher than the video rate, and thus this additional term may not be a bottleneck. Thus, the analysis can be easily extended to the last hop. Since the last hop is dependent on the user and the cloud provider wishes to optimize the system such that it does the best delivery in the part controlled by the provider, we did not explicitly consider the last hop. However, as long as the last hop capacity is higher than the data rate of the video, the last hop does not affect the analysis except a small additional delay. \section{Optimization Problem Formulation and Proposed Algorithm} \label{sec:probForm} \subsection{Problem Formulation} Let $\boldsymbol{\pi} = (\pi_{ij} \forall i=1, \cdots, r \text{ and } j=1, \cdots, m)$, $\boldsymbol{\mathcal{S}}=\left(\mathcal{S}_{1},\mathcal{S}_{2},\ldots,\mathcal{S}_{r}\right)$, and $\boldsymbol{t}=\left(\widetilde{t}_{1},\widetilde{t}_{2},\ldots,\widetilde{t}_{r}; \overline{t}_{1},\overline{t}_{2},\ldots,\overline{t}_{r}\right)$. Note that the values of $t_i$'s used for mean stall duration and the stall duration tail probability can be different and the parameters $\widetilde{t}$ and $\overline{t}$ indicate these parameters for the two cases, respectively. We wish to minimize the two proposed QoE metrics over the choice of scheduling and access decisions. Since this is a multi-objective optimization, the objective can be modeled as a convex combination of the two QoE metrics. Let $\overline{\lambda}=\sum_{i}\lambda_{i}$ be the total arrival rate. Then, $\lambda_{i}/\overline{\lambda}$ is the ratio of video $i$ requests. The first objective is the minimization of the mean stall duration, averaged over all the file requests, and is given as $\sum_{i}\frac{\lambda_{i}}{\overline{\lambda}}\,\mathbb{E}\left[\Gamma^{\left(i\right)}\right]$. The second objective is the minimization of stall duration tail probability, averaged over all the file requests, and is given as $\sum_{i}\frac{\lambda_{i}}{\overline{\lambda}}\,{\text{Pr}}\left(\Gamma^{(i)}\geq x\right)$. Using the expressions for the mean stall duration and the stall duration tail probability in Sections \ref{sec:mean} and \ref{sec:tail}, respectively, optimization of a convex combination of the two QoE metrics can be formulated as follows. \begin{align} \text{min\,\,\,\,\,}\sum_{i}\frac{\lambda_{i}}{\overline{\lambda}}\left[\theta\,\frac{1}{\widetilde{t}_{i}}\text{log}\left(\sum_{j=1}^{m}\pi_{ij}\left(1+\widetilde{H}_{ij}\right)\right)\right.\nonumber \\ +\left.\left(1-\theta\right)\sum_{j}\frac{\pi_{ij}}{e^{\overline{t}_{i}x}}\left(1+e^{-\overline{t}_{i}\left(d_{s}+(L_{i}-1)\tau\right)}\,\overline{H}_{ij}\right)\right]\label{eq:joint_otp_prob}\\ \mbox{s.t.}\,\,\,\,\, \widetilde{H}_{ij}=\frac{e^{-\widetilde{t}_{i}\left(d_{s}-\tau\right)}\left(1-\rho_{j}\right)\widetilde{t}_{i}B_{j}(\widetilde{t}_{i})}{\widetilde{t}_{i}-\Lambda_{j}\left(B_{j}(\widetilde{t}_{i})-1\right)}\widetilde{Q}_{ij}\,\, , \label{eq:H_ij}\\ \overline{H}_{ij}=\frac{e^{-\overline{t}_{i}\left(d_{s}-\tau\right)}\left(1-\rho_{j}\right)\overline{t}_{i}B_{j}(\overline{t}_{i})}{\overline{t}_{i}-\Lambda_{j}\left(B_{j}(\overline{t}_{i})-1\right)}\overline{Q}_{ij}\,\, , \label{eq:H_ij2}\\ \widetilde{Q}_{ij} =\left[\frac{\widetilde{M}_{j}(\widetilde{t}_{i})\left(1-\left(\widetilde{M}_{j}(\widetilde{t}_{i})\right)^{L_{i}}\right)}{1-\widetilde{M}_{j}(\widetilde{t}_{i})}\right],\,\, \label{eq:Q_ij}\\ \overline{Q}_{ij} =\left[\frac{\widetilde{M}_{j}(\overline{t}_{i})\left(1-\left(\widetilde{M}_{j}(\overline{t}_{i})\right)^{L_{i}}\right)}{1-\widetilde{M}_{j}(\overline{t}_{i})}\right],\,\, \label{eq:Q_ij2}\\ \widetilde{M}_{j}({t})=\frac{\alpha_{j}e^{\left(\beta_{j}-\tau\right){t}}}{\alpha_{j}-{t}},\,\, \label{eq:M_telda_opt2}\\ {B}_{j}(t)=\sum_{f=1}^r\frac{\lambda_{f}\pi_{fj}}{\Lambda_{j}}\left(\frac{\alpha_{j}e^{\beta_{j}{t}}}{\alpha_{j}-{t}}\right)^{L_f}\, , \label{eq:Bj_const}\\ \widetilde{M}_{j}({t})=\frac{\alpha_{j}e^{\left(\beta_{j}-\tau\right){t}}}{\alpha_{j}-{t}},\,\, \label{eq:M_telda_opt2}\\ {B}_{j}(t)=\sum_{f=1}^r\frac{\lambda_{f}\pi_{fj}}{\Lambda_{j}}\left(\frac{\alpha_{j}e^{\beta_{j}{t}}}{\alpha_{j}-{t}}\right)^{L_f}\, , \label{eq:Bj_const}\\ \rho_{j}=\sum_{f=1}^r\pi_{fj}\lambda_{f}L_{f}\left(\beta_{j}+\frac{1}{\alpha_{j}}\right)<1\,\,\,\,\,\,\forall j\label{eq:rho_j} \end{align} \begin{eqnarray} & & \varLambda_{j}=\sum_{f=1}^r\lambda_{f}\pi_{f,j}\,\,\,\,\,\forall j\label{eq:Lambda_j}\\ & & \sum_{j=1}^{m}\pi_{i,j}=k_{i}\,\,\,\,\label{eq:sum_ij}\\ & & \mbox{ \ensuremath{\pi_{i,j}}=0}\,\,\,\mbox{if \ensuremath{j\notin S_{i}}}\,,\ensuremath{\pi_{i,j}}\in\left[0,1\right]\label{eq:pij}\\ & & \left|\mathcal{S}_{i}\right|=n_{i},\,\,\forall i\label{eq:S_i_and_ni}\\ & & 0<\widetilde{t}_{i}<\alpha_j,\,\forall j \label{eq:t_i_alpha_j}\\ & & 0<\overline{t}_{i}<\alpha_j,\,\forall j \label{eq:t_i_alpha_j2}\\ & & \alpha_{j}\left(e^{(\beta_j-\tau)\widetilde{t}_i}-1\right)+\widetilde{t}_i<0\,,\forall j \label{M_telda_less_1_2} \\ & & \alpha_{j}\left(e^{(\beta_j-\tau)\overline{t}_i}-1\right)+\overline{t}_i<0\,,\forall j \label{M_telda_less_1} \\ & & \sum_{f=1}^r\pi_{fj}\lambda_{f}\left(\frac{\alpha_{j}e^{\beta_{j}\widetilde{t}_{i}}}{\alpha_{j}-\widetilde{t}_{i}}\right)^{L_{f}}-\left(\Lambda_{j}+\widetilde{t}_{i}\right)<0,\,\forall i, j\label{eq:don_pos_cond}\\ & & \sum_{f=1}^r\pi_{fj}\lambda_{f}\left(\frac{\alpha_{j}e^{\beta_{j}\overline{t}_{i}}}{\alpha_{j}-\overline{t}_{i}}\right)^{L_{f}}-\left(\Lambda_{j}+\overline{t}_{i}\right)<0,\,\forall i, j\label{eq:don_pos_cond2}\\ & & \mbox{var.} \ \ \ \ \ \boldsymbol{\pi},\boldsymbol{t}, \mathcal{\boldsymbol{S}} \label{eq:vars} \end{eqnarray} Here, $\theta\in [0,1]$ is a trade-off factor that determines the relative significance of mean and tail probability of the stall durations in the minimization problem. Varying $\theta=0$ to $\theta=1$, the solution for (\ref{eq:joint_otp_prob}) spans the solutions that minimize the mean stall duration to ones that minimize the stall duration tail probability. Note that constraint (\ref{eq:rho_j}) gives the load intensity of server $j$. Constraint (\ref{eq:Lambda_j}) gives the aggregate arrival rate $\Lambda_j$ for each node for the given probabilistic scheduling probabilities $\pi_{ij}$ and arrival rates $\lambda_i$. Constraints \eqref{eq:pij}-\eqref{eq:S_i_and_ni} guarantees that the scheduling probabilities are feasible. Constraints (\ref{eq:t_i_alpha_j})-(\ref{M_telda_less_1}) ensure that $\widetilde{M}_{j}({t})$ exist for each $\widetilde{t}_i$ and $\overline{t}_i$. Finally, Constraints (\ref{eq:don_pos_cond})-(\ref{eq:don_pos_cond2}) ensure that the moment generating function given in (\ref{eq:M_D_ij}) exists. We note that the the optimization over $\boldsymbol{\pi}$ helps decrease the objective function and gives significant flexibility over choosing the lowest-queue servers for accessing the files. The placement of the video files $\mathcal{\boldsymbol{S}}$ helps separate the highly accessed files on different servers thus reducing the objective. Finally, the optimization over the auxiliary variables $\boldsymbol{t}$ gives a tighter bound on the objective function. We note that the QoE for file $i$ is weighed by the arrival rate $\lambda_i$ in the formulation. However, general weights can be easily incorporated for weighted fairness or differentiated services. Note that the proposed optimization problem is a mixed integer non-convex optimization as we have the placement over $n$ servers and the constraints \eqref{eq:don_pos_cond} and \eqref{eq:don_pos_cond2} are non-convex in $(\boldsymbol{\pi},\boldsymbol{t})$. We also note the placement may be decided for multiple aggregation VMs simultaneously and may not be a parameter for single aggregation VM. In that case, the proposed algorithm can still be used without an optimization over the placement of video files. In the next subsection, we will describe the proposed algorithm. \section{Future Directions}\label{apd:future} A server does not need to serve different video requests one after the other. It may be better to serve video segments out of order from a queue thus helping stall durations since the later video requests do not have to wait for finishing chunks of earlier requests which have later deadlines. Exploiting this flexibility is an open problem. Most edge routers would have a cache capacity, where certain segments of video files can be stored to improve the QoEs. Analyzing QoEs and finding efficient caching mechanisms for video streaming over cloud is an open problem (See Appendix \ref{apdx:cache} for more details). Further, implementing the ideas in this paper over a real cloud computing environment is left as a future work. This paper also does not consider the last hop, and incorporating that is left as a future work (See Appendix \ref{apdx:e2e} for more details). We note that the current video streaming algorithms use adaptive bit-rate (ABR) strategies to change the video qualities of segments within a video \cite{huang2015buffer,AnisTON}. One of the strategies look at the buffer usage at the client to determine the quality of the next segment \cite{huang2015buffer}. Incorporating efficient ABR streaming algorithms is an interesting future work. The main challenge in this extension is to incorporate the client behavior which makes the arrival process non-memoryless thus making the analysis complex. Finally, considering the decoding time by combining data in the calculations is left as a future work. \section{Proof of Lemma \ref{ljlemma}}\label{apdx:ljlemma} \begin{align} \overline{R}_{j}(s) & =\sum_{i=1}^r \frac{\pi_{ij}\lambda_{i}}{\Lambda_{j}}\mathbb{E}\left[e^{-s\left(ST_{i,j}\right)}\right]\nonumber \\ & \overset{}{=}\sum_{i=1}^r \frac{\pi_{ij}\lambda_{i}}{\Lambda_{j}}\mathbb{E}\left[e^{-s\left(\sum_{\nu=1}^{L_{i}}Y_{j}^{(\nu)}\right)}\right]\nonumber \\ & =\sum_{i=1}^r \frac{\pi_{ij}\lambda_{i}}{\Lambda_{j}}\left(\mathbb{E}\left[e^{-s\left(Y_{j}^{(1)}\right)}\right]\right)^{L_{i}}\nonumber \\ & =\sum_{i=1}^r \frac{\pi_{ij}\lambda_{i}}{\Lambda_{j}}\left(\frac{\alpha_{j}e^{-\beta_{j}s}}{\alpha_{j}+s}\right)^{L_{i}} \end{align} \section{Proof of Lemma \ref{lemma_pijz}\label{apdx:mgf_pijz}} This follows by substituting $t=-s$ in (\ref{LapOfE_D_ij}) and $B_{j}(t)$ is given by (\ref{eq:servTimeofFileB_j_i}) and $M_j(t)$ is given by (\ref{M_j_t_1}). This expressions holds when $t-\Lambda_{j}\left(B_{j}(t)-1\right)>0$ and $t<0 \,\forall j$, since the moment generating function does not exist if the above does not hold. \section{Proof of Lemma \ref{hijlem}}\label{apdx:hjlem} \begin{eqnarray} &&H_{ij} \nonumber\\ & = & \sum_{\ell=1}^{L_{i}}\left(\frac{e^{-t_{i}\left(d_{s}+\left(\ell-1\right)\tau\right)}\left(1-\rho_{j}\right)t_{i}B_{j}(t_{i})}{t_{i}-\Lambda_{j}\left(B_{j}(t_{i})-1\right)}\left(\frac{\alpha_{j}e^{t_{i}\beta_{j}}}{\alpha_{j}-t_{i}}\right)^{\ell}\right)\nonumber\\ & = & \frac{e^{-t_{i}d_{s}}\left(1-\rho_{j}\right)t_{i}B_{j}(t_{i})}{t_{i}-\Lambda_{j}\left(B_{j}(t_{i})-1\right)}\sum_{\ell=1}^{L_{i}}\left(e^{-t_{i}\left(\ell-1\right)\tau}\left(\frac{\alpha_{j}e^{t_{i}\beta_{j}}}{\alpha_{j}-t_{i}}\right)^{\ell}\right)\nonumber\\ & = & \frac{e^{-t_{i}\left(d_{s}-\tau\right)}\left(1-\rho_{j}\right)t_{i}B_{j}(t_{i})}{t_{i}-\Lambda_{j}\left(B_{j}(t_{i})-1\right)}\sum_{\ell=1}^{L_{i}}\left(e^{-t_{i}\tau}\frac{\alpha_{j}e^{t_{i}\beta_{j}}}{\alpha_{j}-t_{i}}\right)^{\ell}\nonumber\\ & = & \frac{e^{-t_{i}\left(d_{s}-\tau\right)}\left(1-\rho_{j}\right)t_{i}B_{j}(t_{i})}{t_{i}-\Lambda_{j}\left(B_{j}(t_{i})-1\right)}\sum_{\ell=1}^{L_{i}}\left(\frac{\alpha_{j}e^{t_{i}\beta_{j}-t_{i}\tau}}{\alpha_{j}-t_{i}}\right)^{\ell}\nonumber\\ & = & \frac{e^{-t_{i}\left(d_{s}-\tau\right)}\left(1-\rho_{j}\right)t_{i}B_{j}(t_{i})}{t_{i}-\Lambda_{j}\left(B_{j}(t_{i})-1\right)}\times\nonumber\\ & & \left(M_{j}(t_{i})e^{-t_{i}\tau}\frac{1-\left(M_{j}(t_{i})\right)^{Li}e^{-t_{i}L_{i}\tau}}{1-M_{j}(t_{i})e^{-t_{i}\tau}}\right)\nonumber\\ & = & \frac{e^{-t_{i}\left(d_{s}-\tau\right)}\left(1-\rho_{j}\right)t_{i}B_{j}(t_{i})\widetilde{M}_{j}(t_{i})}{t_{i}-\Lambda_{j}\left(B_{j}(t_{i})-1\right)}\frac{1-\left(\widetilde{M}_{j}(t_{i})\right)^{L_{i}}}{\left(1-\widetilde{M}_{j}(t_{i})\right)} \end{eqnarray} \section{Proof of Theorem \ref{meanthm}}\label{apdx:boundmean} We first find an upper bound on $F_{ij}$ as follows. \begin{align} F_{ij} & =\mathbb{E}\left[\underset{z}{\text{max}}\, e^{t_{i}pijz}\right]\nonumber \\ & \overset{(d)}{\leq}\sum_{z}\mathbb{E}\left[e^{t_{i}pijz}\right]\nonumber \\ & \overset{(e)}{=}e^{t_{i}(d_{s}+(L_{i}-1)\tau)}+ \nonumber \\ & \sum_{z=2}^{L_{i}+1}\frac{e^{t_{i}\left(L_{i}-z+1\right)\tau}\left(1-\rho_{j}\right)t_{i}B_{j}(t_{i})}{t_{i}-\Lambda_{j}\left(B_{j}(t_{i})-1\right)}\left(\frac{\alpha_{j}e^{t_{i}\beta_{j}}}{\alpha_{j}-t_{i}}\right)^{z-1}\nonumber \\ & \overset{(f)}{=}e^{t_{i}(d_{s}+(L_{i}-1)\tau)}+ \nonumber \\ & \sum_{\ell=1}^{L_{i}}\frac{e^{t_{i}\left(L_{i}-\ell\right)\tau}\left(1-\rho_{j}\right)t_{i}B_{j}(t_{i})}{t_{i}-\Lambda_{j}\left(B_{j}(t_{i})-1\right)}\left(\frac{\alpha_{j}e^{t_{i}\beta_{j}}}{\alpha_{j}-t_{i}}\right)^{\ell}\label{eq:F_ij} \end{align} where (d) follows by bounding the maximum by the sum, (e) follows from (\ref{eq:momntPjz}), and (f) follows by substituting $\ell=z-1$. Further, substituting the bounds \eqref{eq:F_ij} and \eqref{eq:ET_i} in \eqref{eq:E_T_s_2}, the mean stall duration is bounded as follows. \begin{eqnarray} &&\mathbb{E}\left[\Gamma^{(i)}\right] \nonumber\\ &\leq& \frac{1}{t_{i}}\text{log}\left(\sum_{j=1}^{m}\pi_{ij}\left(e^{t_{i}(d_{s}+(L_{i}-1)\tau)}\right.\right.\nonumber \\ && \left.\left.+\sum_{\ell=1}^{L_{i}}e^{t_{i}\left(L_{i}-\ell\right)\tau}Z_{{i,j}}^{(\ell)}(t_{i})\right)\right)-\left(d_{s}+\left(L_{i}-1\right)\tau\right)\nonumber \\ &=& \frac{1}{t_{i}}\text{log}\left(\sum_{j=1}^{m}\pi_{ij}\left(e^{t_{i}(d_{s}+(L_{i}-1)\tau)}\right.\right.\nonumber \\ && \left.\left.+\sum_{\ell=1}^{L_{i}}e^{t_{i}\left(L_{i}-\ell\right)\tau}Z_{{i,j}}^{(\ell)}(t_{i})\right)\right)-\frac{1}{t_{i}}\text{log}\left(e^{t_{i}\left(d_{s}+\left(L_{i}-1\right)\tau\right)}\right)\nonumber \\ &=& \frac{1}{t_{i}}\text{log}\left(\sum_{j=1}^{m}\pi_{ij}\left(1+\sum_{\ell=1}^{L_{i}}e^{-t_{i}\left(d_{s}+\left(\ell-1\right)\tau\right)}Z_{{i,j}}^{(\ell)}(t_{i})\right)\right)\label{eq:ET_s_i_ap} \end{eqnarray} \section{Proof of Theorem \ref{tailthm}}\label{apdx:boundtail} Substituting (\ref{eq:max_z_pjz}) in (\ref{eq:Pr_T_i_L_i_x_bar}), we get \begin{eqnarray} &&\text{\text{Pr}}\left(T_{i}^{(L_{i})}\geq\overline{x}\right) \nonumber\\ & \leq & \sum_{j}\pi_{ij}\mathbb{P}\left(\underset{z}{\text{max}\,\,}p_{ijz}\geq\overline{x}\right)\nonumber\\ & \leq & \sum_{j}\pi_{ij}\frac{F_{ij}}{e^{t_{i}\overline{x}}}\nonumber\\ & \overset{(g)}{\leq} & \sum_{j}\frac{\pi_{ij}}{e^{t_{i}\overline{x}}}\left(e^{t_{i}(d_{s}+(L_{i}-1)\tau)}+H_{ij}\right)\nonumber\\ & = & \sum_{j}\frac{\pi_{ij}}{e^{t_{i}\left(x+d_{s}+(L_{i}-1)\tau\right)}}\left(e^{t_{i}(d_{s}+(L_{i}-1)\tau)}+H_{ij}\right)\nonumber\\ & = & \sum_{j}\frac{\pi_{ij}}{e^{t_{i}x}}\left(1+e^{-t_{i}\left(d_{s}+(L_{i}-1)\tau\right)}\,H_{ij}\right) \label{eq:Pr_T_i_L_i_x_bar_final} \end{eqnarray} where (g) follows from (\ref{eq:F_ij}) and $H_{ij}$ is given by (\ref{eq:H}). \subsection{Placement Optimization} Given $\boldsymbol{\mathcal{\pi}}$ and $\boldsymbol{t}$, this subproblem finds a permutation of the placement of files on the different servers. Let the given $\boldsymbol{\mathcal{\pi}}$ be denoted as $\boldsymbol{\mathcal{\pi}}' = \{\pi'_{ij}\forall i,j\}$ and the placement corresponding to this access be $\boldsymbol{\mathcal{S}}'=\left(\mathcal{S}_{1}',\mathcal{S}_{2}',\ldots,\mathcal{S}_{r}'\right)$. We find a permutation of the servers $m$ for each file $i$, and call it $\zeta_i(j)$ is a permutation of the servers from $j\in \{1,\cdots m\}$ to $\zeta_i(j) \in \{1,\cdots m\}$. Further, having the mapping of the servers for each file, the new access probabilities are $\pi_{ij}= \pi'_{i,\zeta_i(j)}$. Having these access probabilities, the new placement of the files will be $\mathcal{S}_{i} = \{\zeta_i(j) \forall j \in \mathcal{S}'_{i}\}$. We note that the constraints \eqref{eq:sum_ij}, \eqref{eq:pij}, and \eqref{eq:S_i_and_ni} for the access from the modified placement of the servers will already be satisfied. The Placement Optimization subproblem is to find the optimal permutations $\zeta_i(j)$. The problem can be formally written as follows. \textbf{Objective:} $\min$ \eqref{eq:joint_otp_prob} \textbf{s.t.} \eqref{eq:rho_j}, \eqref{eq:Lambda_j}, \eqref{eq:don_pos_cond}, $\pi_{ij}= \pi'_{i,\zeta_i(j)}$, ${\zeta_i}$ is a permutation on $\\\{1, \cdots, m\} \ \forall\ i\in \{1, \cdots, r\}$ \textbf{var.} ${\zeta_i(j)} \quad \forall j\in \{1, \cdots, m\}$ and $i\in \{1, \cdots, r\}$ We note that the optimization problem is to find $r$ permutations and is a discrete optimization problem. We first consider optimizing only over one of the permutation $\zeta_i$. Let $\zeta_i$ be written as an indicator function $x_{u,v}^{(i)}$ which is $1$ if $v=\zeta_i(u) $ and zero otherwise. Then, the new $\pi_{ij} = \sum_u x_{j,u}^{(i)}\pi'_{iu}$ while for other files $k\ne i$, $\pi_{ij}$ remains the same. With the new values of $\pi_{ij}$, the only optimization variables are $x_{j,u}^{(i)}$. The constraints for $x_{u,v}^{(i)}$ are $\sum_v x_{u,v}^{(i)} = \sum_u x_{u,v}^{(i)} =1$ and $x_{u,v}^{(i)}\in \{0,1\}$. We note that this is a non-linear bipartite matching problem \cite{Berstein200853}. All the $r$ permutations taken together result in $rm^2$ discrete optimization variables that we wish to optimize. In general, we have the constraints $\pi_{ij} = \sum_u x_{j,u}^{(i)}\pi'_{iu}$ and $\sum_v x_{u,v}^{(i)} = \sum_u x_{u,v}^{(i)} =1$ for all $i\in \{1, \cdots, r\}$, $u, v \in \{1, \cdots, m\}$, where binary $x_{u,v}^{(i)}$ for each $i, u, v$ are the decision variables. In order to solve the non-linear problem with integer constraints, we use NOVA algorithm, where a term $\left(1+e^{\left(\alpha_{c}x\right)}\right)^{-1}-\left(1+e^{\left(\alpha_{c}\left(x-1\right)\right)}\right)^{-1}$ is added in the objective for each constraint (to make the problem smooth), where $\alpha_c$ is a large number and $C$ is large enough to force the solutions to be binary. NOVA algorithm guarantees convergence for any given value of $C$ and thus for large enough $C$, we will obtain the stationary point that has integer constraints. \section{Related Work} {\em Latency in Erasure-coded Storage: } To our best knowledge, however, while latency in erasure coded storage systems has been widely studied, quantifying exact latency for erasure-coded storage system in data-center network is an open problem. Prior works focusing on asymptotic queuing delay behaviors \cite{Bramson:10,Lu:10} are not applicable because redundancy factor in practical data centers typically remains small due to storage cost concerns. Due to the lack of analytic latency models, most of the literature is focused on reliable distributed storage system design, and latency is only presented as a performance metric when evaluating the proposed erasure coding scheme, e.g., \cite{AJX05,J06}, which demonstrate latency improvement due to erasure coding in different system implementations. Related design can also be found in data access scheduling \cite{SH07,TI10}, access collision avoidance \cite{ZA02}, and encoding/decoding time optimization \cite{WK} and there is also some work using the LT erasure codes to adjust the system to meet user requirements such as availability, integrity and confidentiality \cite{AG14}. Recently, there has been a number of attempts at finding latency bounds for an erasure-coded storage system \cite{Xiang:2014:Sigmetrics:2014,Yu_TON,CS14,Joshi:13,MDS-Queue}. The key scheduling approaches include {\em block-one-scheduling} policy that only allows the request at the head of the buffer to move forward \cite{MG1:12}, fork-join queue \cite{Makowski:89,Joshi:13} to request data from all server and wait for the first $k$ to finish, and the probabilistic scheduling \cite{Xiang:2014:Sigmetrics:2014,Yu_TON} that allows choice of every possible subset of $k$ nodes with certain probability. Mean latency and tail latency have been characterized in \cite{Xiang:2014:Sigmetrics:2014,Yu_TON} and \cite{Jingxian} respectively for a system with multiple files using probabilistic scheduling. This paper considers video streaming rather than file downloading. The metrics for video streaming does not only account for the end of the download of the video but also of the download of each of the segment. Thus, the analysis for the content download cannot be extended to the video streaming directly and the analysis approach in this paper is very different from the prior works in the area. {\em Video Streaming over Cloud: } Servicing Video on Demand and Live TV Content from cloud servers have been studied widely \cite{lee2013vod,huang2011cloudstream,he2014cost,chang2016novel,oza2016implementation}. The placement of content and resource optimization over the cloud servers have been considered. To the best of our knowledge, reliability of content over the cloud servers have not been considered for video streaming applications. In the presence of erasure-coding, there are novel challenges to characterize and optimize the QoE metrics at the end user. Adaptive streaming algorithms have also been considered for video streaming \cite{chen2012amvsc,wang2013ames}, which are beyond the scope of this paper and are left for future work. \section{Acknowledgments} \input{tabl_not} \input{lemmalj} \input{apdx_algo} \input{convexity_lem} \input{algos} \input{sims_otherparams} \input{apdx_genstream} \input{future_work} \input{cachingEffect} \input{end2end} \end{document} \section{Introduction} The demands of video streaming services have been skyrocketing over these years, with the global video streaming market expected to grow annually at a rate of 18.3\% \cite{marketsandmarkets}. With the proliferation and advancement of video-streaming services, cloud-based video has become an imperative feature of any successful business. This can also be seen as IBM estimates cloud-based video will be a \$105 billion market opportunity by 2019 \cite{ibm}. In cloud storage systems, erasure coding has seen itself quickly emerged as a promising technique to reduce the storage cost for a given reliability as compared to the replicated systems \cite{2015_1,Dimakis:10}. It has been widely adopted in modern storage systems by companies like Facebook \cite{Sathiamoorthy13}, Microsoft \cite{Asure14}, and Google \cite{Fikes10}. This paper considers video streaming when the content is placed on cloud servers, where erasure coding is used. The key quality of experience (QoE) metric for video streaming is the duration of stalls at the clients. This paper gives bounds on the stall durations, and uses that to propose an optimized streaming service that minimizes average QoE for the clients. In this paper, we consider two measures of QoE metrics in terms of stall duration. The first is the mean stall duration. Almost every viewer can relate to the quality of experiences for watching videos being the stall duration and is thus one of the key focus in the studied streaming algorithms \cite{huang2015buffer,AnisTON}. The second is the probability that the stall duration is greater than a fixed number $x$, which determines the stall duration tail probability. It has been shown that in modern Web applications such as Bing, Facebook, and Amazon's retail platform, the long tail of latency is of particular concern, with $99.9$th percentile response times that are orders of magnitude worse than the mean \cite{T1,T2}. Thus, the QoE metric of stall duration tail probability becomes important. This paper characterizes an upper bound on both QoE metrics. We note that quantifying service latency for erasure-coded storage is an open problem \cite{MDS-Queue}, and so is tail latency \cite{Jingxian}. This paper takes a step forward and explores the notions for video streaming rather than video download. Thus, finding the exact QoE metrics is an open problem. This paper finds the bounds on the QoE metrics. The data chunk transfer time in practical systems follows a shifted exponential distribution \cite{Yu_TON,CS14} which motivates the choice that the service time distribution for each video server is a shifted exponential distribution. Further, the request arrival rates for each video is assumed to be Poisson. The video segments are encoded using an $(n,k)$ erasure code and the coded segments are placed on $n$ different servers. When a video is requested, the segments need to be requested from $k$ out of $n$ servers. Optimal strategy of choosing these $k$ servers would need a Markov approach similar to that in \cite{MDS-Queue} and suffers from a similar state explosion problem, because states of the corresponding queuing model must encapsulate not only a snapshot of the current system including chunk placement and queued requests but also past history of how chunk requests have been processed by individual nodes. In this paper, we use the probabilistic scheduling proposed in \cite{Xiang:2014:Sigmetrics:2014,Yu_TON} to access the $k$ servers, where each possibility of $k$ servers is chosen with certain probability and the probability terms can be optimized. Using this scheduling mechanism, the random variables corresponding to the times for download of different video segments from each server are found. Using ordered statistics over the $k$ servers, the random variables corresponding to the playback time of each video segment are characterized. These are then used to find bounds on the mean stall duration and the stall duration tail probability. Moment generating functions of the ordered statistics of different random variables are used in the bounds. We note that the problem of finding latency for file download is very different from the video stall duration for streaming. This is because the stall duration accounts for download time of each video segment rather than only the download time of the last video segment. Further, the download time of segments are correlated since the download of chunks from a server are in sequence and the playback time of a video segment are dependent on the playback time of the last segment and the download time of the current segment. Taking these dependencies into account, this paper characterizes the bounds on the two QoE metrics. We note that for the special case when each video has a single segment, the bounds on mean stall duration and stall duration tail probability reduce to that for file download. Further, the bounds based on the approach in this paper have been shown to outperform the results for mean file download latency in \cite{Xiang:2014:Sigmetrics:2014,Yu_TON}. The proposed framework provides a mathematical crystallization of the engineering artifacts involved and illuminates key system design issues through optimization of QoE. The average QoE metric over different requests can be optimized over the placement of the video files, the access of the video files from the servers, and the bound parameters. The tradeoff in the two QoE metrics is captured by defining the objective function which is a convex combination of the two QoE metrics. Varying the parameter trading off the two metrics can be used to get a tradeoff region between the two metrics helping the system designer to choose an appropriate point. An efficient algorithm is proposed to solve the proposed non-convex problem. The proposed algorithm does an alternating optimization over the placement, access, and the bound parameters. The optimization over probabilistic scheduling access parameters help reduce the mean and tail of the stall durations by differentiating video files thus providing more flexibility as compared to choosing the lowest queue servers. The sub-problems have been shown to have convex constraints and thus can be efficiently solved using iNner cOnVex Approximation (NOVA) algorithm proposed in \cite{scutNOVA}. The proposed algorithm is shown to converge to a local optimal. Numerical results demonstrate significant improvement of QoE metrics as compared to the baselines. Today, cloud-based video does not use erasure coding. One of the key reason is the additional decoding latency from multiple coded streams. Since the computing has been growing exponentially \cite{Denning:2016:ELC:3028256.2976758}, it is only a matter of time when the computation of decoding will not limit the latencies in delay sensitive video streaming and the networking latency will govern the system designs. Further, we note that replication is a special case of erasure coding. Thus, the proposed research using erasure-coded content on the servers can also be used when the content is replicated on the servers. The key contributions of our paper include: \begin{itemize}[leftmargin=0cm,itemindent=.5cm,labelwidth=\itemindent,labelsep=0cm,align=left] \item This paper formulates video streaming over erasure-coded cloud storage system. \item The random variable corresponding to the download time of a chunk of each video segment from a server is characterized. Using ordered statistics, the random variable corresponding to the playback time of each video segment is found. These are further used to derive upper bounds on the mean stall duration of the video and the video stall duration tail probability. \item The QoE metrics are used to formulate system optimization problems over the choice of the placement of video segments, probabilistic scheduling access policy and the bound parameters which are related to the moment generating function. Efficient iterative solutions are provided for these optimization problems. \item Numerical results show that the proposed algorithms converges within a few iterations. Further, the QoE metrics are shown to have significant improvement as compared to the considered baselines. For instance, the mean stall duration for the proposed algorithm is 60\% smaller and the stall duration tail probability is orders of magnitude better as compared to random placement and projected equal access probability strategy. \end{itemize} The remainder of this paper is organized as follows. Section 2 provides related work for this paper. In Section 3, we describe the system model used in the paper with a description of video streaming over cloud storage. Section 4 derives expressions on the download and play times of the chunks which are used in Sections 5 and 6 to find the upper bounds on the QoE metrics of the mean stall duration and video stall latency, respectively. Section 7 formulates the QoE optimization problem as a weighted combination of the two QoE metrics and proposes the iterative algorithmic solution of this problem. Numerical results are provided in Section 8. Section 9 concludes the paper. \section{System Model} We consider a distributed storage system consisting of $m$ heterogeneous servers (also called storage nodes), denoted by $\mathcal{M}=1,2,...,m$. Each video file $i$, where $i=1,2,...r,$ is divided into $L_{i}$ equal segments, $G_{i,1}, \cdots, G_{i,L_i}$, each of length $\tau$ sec. Then, each segment $G_{i,j}$ for $j\in\left\{ 1,2,\ldots,L_{i}\right\} $ is partitioned into $k_i$ fixed-size chunks and then encoded using an $(n_i, k_i)$ Maximum Distance Separable (MDS) erasure code to generate $n_i$ distinct chunks for each segment $G_{i,j}$. These coded chunks are denoted as $C_{i,j}^{(1)}, \cdots, C_{i,j}^{(n_i)}$. The encoding setup is illustrated in Figure \ref{fig:videoEncoding}. The encoded chunks are stored on the disks of $n_i$ distinct storage nodes. These storage nodes are represented by a set $\mathcal{S}_{i}$, such that $\mathcal{S}_{i}\subseteq\mathcal{M}$ and $n_{i}=\left|\mathcal{S}_{i}\right|$. Each server $z\in \mathcal{S}_{i}$ stores all the chunks $C_{i,j}^{(g_z)}$ for all $j$ and for some $g_z\in \{1, \cdots, n_i\}$. In other words, each of the $n_i$ storage nodes stores one of the coded chunks for the entire duration of the video. The placement on the servers is illustrated in Figure \ref{fig:plcOnServ}, where the server $1$ is shown to store first coded chunks of file $i$, third coded chunks of file $u$ and first coded chunks for file $v$. The use of $\left(n_{i},k_{i}\right)$ of MDS erasure code introduces a redundancy factor of $n_{i}/k_{i}$ which allows the video to be reconstructed from the video chunks from any subset of $k_{i}$-out-of-$n_{i}$ servers. We note that the erasure-code can also help in recovery of the content $i$ as long as $k_i$ of the servers containing file $i$ are available \cite{Dimakis:10}. Note that replication along $n$ servers is equivalent to choosing $(n,1)$ erasure code. Hence, when a video $i$ is requested, the request goes to a set $\mathcal{A}_{i}$ of the storage nodes, where $\mathcal{A}_{i}\subseteq\mathcal{S}_{i}$ and $k_{i}=\left|\mathcal{A}_{i}\right|$. From each server $z \in \mathcal{A}_{i}$, all chunks $C_{i,j}^{(g_z)}$ for all $j$ and the value of $g_z$ corresponding to that placed on server $z$ are requested. The request is illustrated in Figure \ref{fig:plcOnServ}. In order to play a segment $q$ of video $i$, $C_{i,q}^{(g_z)}$ should have been downloaded from all $z\in \mathcal{A}_{i}$. We assume that an edge router which is a combination of multiple users is requesting the files. Thus, the connections between the servers and the edge router is considered as the bottleneck. Since the service provider only has control over this part of the network and the last hop may not be under the control of the provider, the service provider can only guarantee the quality-of-service till the edge router. The key used notations are defined in Table \ref{tab:Key-Notations-Used} in Appendix \ref{notation}. \begin{figure} \includegraphics[trim=0in 0in 0in .8in, clip, scale=0.35]{figures/videncoding3} \caption{A schematic illustrates video fragmentation and erasure-coding processes. Video $i$ is composed of $L_{i}$ segments. Each segments is partitioned into $k_{i}$ chunks and then encoded using an $(n_{i},k_{i})$ MDS code.\label{fig:videoEncoding}} \end{figure} \begin{figure} \includegraphics[scale=0.28,angle=-90]{figures/placementOnServers.pdf} \vspace{-.3in} \caption{An Illustration of a distributed storage system equipped with $m$ nodes and storing $3$ video files assuming $(n_{i},k_{i})$ erasure codes.\label{fig:plcOnServ}} \end{figure} \begin{figure} \includegraphics[trim=0.2in .5in 0in .3in, clip, width=.45\textwidth]{figures/accessFromAserver_cov.pdf} \caption{An Example of the instantaneous queue status at server $q$, where $q\in{1,2,...,m}$.\label{fig:sysModel}} \end{figure} We assume that the files at each server are served in order of the request in a first-in-first-out (FIFO) policy. Further, the different chunks are processed in order of the duration. This is depicted in Figure \ref{fig:sysModel}, where for a server $q$, when a file $i$ is requested, all the chunks are placed in the queue where other video requests before this that have not yet been served are waiting. In order to schedule the requests for video file $i$ to the $k_i$ servers, the choice of $k_i$-out-of-$n_i$ servers is important. Finding the optimal choice of these servers to compute the latency expressions is an open problem to the best of our knowledge. Thus, this paper uses a policy, called Probabilistic Scheduling, which was proposed in \cite{Xiang:2014:Sigmetrics:2014,Yu_TON}. This policy allows choice of every possible subset of $k_i$ nodes with certain probability. Upon the arrival of a video file $i$, we randomly dispatch the batch of $k_{i}$ chunk requests to appropriate a set of nodes (denoted by set $\mathcal{A}_{i}$ of servers for file $i$) with predetermined probabilities ($P\left(\mathcal{A}_{i}\right)$ for set $\mathcal{A}_{i}$ and file $i$). Then, each node buffers requests in a local queue and processes in order and independently as explained before. The authors of \cite{Xiang:2014:Sigmetrics:2014,Yu_TON} proved that a probabilistic scheduling policy with feasible probabilities $\left\{ P\left(\mathcal{A}_{i}\right):\,\forall_{i},\,\mathcal{A}_{i}\right\} $ exists if and only if there exists conditional probabilities $\pi_{ij}\in\left[0,1\right]$ $\forall i,j$ satisfying \[ \sum_{j=1}^{m}\pi_{ij}=k_{i}\,\,\,\,\forall i\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\mbox{and}\,\,\,\,\,\,\pi_{ij}=0\,\,\,\,\,\mbox{if\,\,\,\ensuremath{j\notin \mathcal{S}_{i}}}. \] In other words, selecting each node $j$ with probability $\pi_{ij}$ would yield a feasible choice of $\left\{ P\left(\mathcal{A}_{i}\right):\,\forall_{i},\,\mathcal{A}_{i}\right\} $. Thus, we consider the request probabilities $\pi_{ij}$ as the probability that the request for video file $i$ uses server $j$. While the probabilistic scheduling have been used to give bounds on latency of file download, this paper uses the scheduling to give bounds on the QoE for video streaming. We note that it may not be ideal in practice for a server to finish one video request before starting another since that increases delay for the future requests. However, this can be easily alleviated by considering that each server has multiple queues (streams) to the edge router which can all be considered as separate servers. These multiple streams can allow multiple parallel videos from the server. The probabilistic scheduling can choose $k_i$ of the overall queues to access the content. Possible approaches of extension to accommodate such scenarios are shown in the Appendix \ref{apdx_entend}. We now describe a queuing model of the distributed storage system. We assume that the arrival of client requests for each video $i$ form an independent Poisson process with a known rate $\lambda_{i}$. The arrival of file requests at node $j$ forms a Poisson Process with rate $\varLambda_{j}=\sum_{i}\lambda_{i}\pi_{i,j}$ which is the superposition of $r$ Poisson processes each with rate $\lambda_{i}\pi_{i,j}$. We assume that the chunk service time for each coded chunk $C_{i,l}^{(g_j)}$ at server $j$, $X_{j}$, follows a shifted exponential distribution as has been demonstrated in realistic systems \cite{Yu_TON,CS14}. The service time distribution for the chunk service time at server $j$, $X_{j}$, is given by the probability distribution function $f_{j}(x)$, which is \begin{equation} f_{j}(x)=\begin{cases} \begin{array}{cc} \alpha_{j}e^{-\alpha_{j}\left(x-\beta_{j}\right)}\,, & \,\,\,\,\,x\geq\beta_{j}\\ 0\,, & \,\,\,\,\,\,x<\beta_{j} \end{array}\end{cases}. \end{equation} We note that exponential distribution is a special case with $\beta_{j}=0$. We note that the constant delays like the networking delay, and the decoding time can be easily factored into the shift of the shifted exponential distribution. Let $M_{j}(t)=\mathbb{E}\left[e^{tX_{j}}\right]$ be the moment generating function of $X_{j}$. Then, $M_{j}(t)$ is given as \begin{equation} M_{j}(t)=\frac{\alpha_{j}}{\alpha_{j}-t}\,e^{\beta_{j}t}\,\,\,\,\,\,\,\,\,\,t<\alpha_{j} \label{M_j_t_1} \end{equation} We note that the arrival rates are given in terms of the video files, and the service rate above is provided in terms of the coded chunks at each server. The client plays the video segment after all the $k_i$ chunks for the segment have been downloaded and the previous segment has been played. We also assume that there is a start-up delay of $d_{s}$ (in seconds) for the video which is the duration in which the content can be buffered but not played. This paper will characterize the stall duration and stall duration tail probability for this setting. \section{Mean Stall Duration} \label{sec:mean} In this section, we will provide a bound for the first QoE metric, which is the mean stall duration for a file $i$. We will find the bound by probabilistic scheduling and since probabilistic scheduling is one feasible strategy, the obtained bound is an upper bound to the optimal strategy. Using \eqref{eq:base}, the expected stall time for file $i$ is given as follows \begin{eqnarray} \mathbb{E}\left[\Gamma^{(i)}\right] & = & \mathbb{E}\left[T_{i}^{(L_{i})}-d_{s}-\left(L_{i}-1\right)\tau\right]\nonumber \\ \nonumber \\ & = & \mathbb{E}\left[T_{i}^{(L_{i})}\right]-d_{s}-\left(L_{i}-1\right)\tau\label{eq:E_T_s_2} \end{eqnarray} An exact evaluation for the play time of segment $L_{i}$ is hard due to the dependencies between $p_{jz}$ random variables for different values of $j$ and $z$, where $z\in{(1,2,...,L_{i}+1)}$ and $j\in \mathcal{A}_{i}$. Hence, we derive an upper-bound on the playtime of the segment $L_{i}$ as follows. Using Jensen's inequality \cite{kuczma2009introduction}, we have for $t_i>0$, \begin{equation} e^{t_{i}\mathbb{E}\left[T_{i}^{\left(L_{i}\right)}\right]} \leq \mathbb{E}\left[e^{t_{i}T_{i}^{\left(L_{i}\right)}}\right]. \label{eq:jensen} \end{equation} Thus, finding an upper bound on the moment generating function for $T_i^{(L_i)}$ can lead to an upper bound on the mean stall duration. Thus, we will now bound the moment generating function for $T_i^{(L_i)}$. \begin{eqnarray} \mathbb{E}\left[e^{t_{i}T_{i}^{\left(L_{i}\right)}}\right] & \overset{(a)}{=} & \mathbb{E}\left[\underset{z}{\mbox{max}} \,\underset{j\in\mathcal{A}_{i}}{\mbox{max}}\,e^{t_{i}p_{ijz}}\right]\nonumber\\ & = & \mathbb{E}_{\mathcal{A}_{i}}\left[\mathbb{E}\left[\underset{z}{\mbox{max}}\,\underset{j\in{\mathcal{A}_{i}}}{\mbox{max}}\,e^{t_{i}p_{ijz}}|\,\mathcal{A}_{i}\right]\right]\nonumber \\ &\overset{(b)}{\leq} & \mathbb{E}_{\mathcal{A}_{i}}\left[\sum_{j\in \mathcal{A}_{i}}\mathbb{E}\left[\underset{z}{\mbox{max}}\,e^{t_{i}p_{ijz}}\right]\right]\nonumber \\ & = & \mathbb{E}_{\mathcal{A}_{i}}\left[\sum_{j}F_{ij}\mathbf{1}_{\left\{ j\in\mathcal{A}_{i}\right\} }\right]\nonumber \\ & = & \sum_{j}F_{ij}\,\mathbb{E}_{\mathcal{A}_{i}}\left[\mathbf{1}_{\left\{ j\in\mathcal{A}_{i}\right\} }\right]\nonumber \\ & = & \sum_{j}F_{ij}\,\mathbb{P}\left(j\in\mathcal{A}_{i}\right)\nonumber \\ & \overset{(c)}{=} & \sum_{j}F_{ij}\pi_{ij} \label{eq:mgf_bound} \end{eqnarray} where (a) follows from \eqref{eq:pjstart}, (b) follows by upper bounding $\max_{j\in \mathcal{A}_{i}} $ by $\sum_{j\in \mathcal{A}_{i}} $, (c) follows by probabilistic scheduling where $\mathbb{P}\left(j\in\mathcal{A}_{i}\right) = \pi_{ij}$, and $F_{ij}=\mathbb{E}\left[\underset{z}{\mbox{max}} \, e^{t_{i}p_{ijz}}\right]$. We note that the only inequality here is for replacing the maximum by the sum. Since this term will be inside the logarithm for the mean stall latency, the gap between the term and its bound becomes additive rather than multiplicative. Substituting \eqref{eq:mgf_bound} in \eqref{eq:jensen}, we have \begin{equation} \mathbb{E}\left[T_{i}^{(L_{i})}\right]\leq\frac{1}{t_{i}}\text{log}\left(\sum_{j=1}^{m}\pi_{ij}F_{ij}\right).\label{eq:ET_i} \end{equation} Let $H_{ij}=\sum_{\ell=1}^{L_{i}}e^{-t_{i}\left(d_{s}+\left(\ell-1\right)\tau\right)}Z_{{i,j}}^{(\ell)}(t_{i})$, where $Z_{{i,j}}^{(\ell)}(t)$ is defined in equation \eqref{eq:M_D_ij}. We note that $H_{ij}$ can be simplified using the geometric series formula as follows. \begin{lemma}\label{hijlem} \begin{equation} H_{ij} = \frac{e^{-t_{i}\left(d_{s}-\tau\right)}\left(1-\rho_{j}\right)t_{i}B_{j}(t_{i})\widetilde{M}_{j}(t_{i})}{t_{i}-\Lambda_{j}\left(B_{j}(t_{i})-1\right)}\frac{1-\left(\widetilde{M}_{j}(t_{i})\right)^{L_{i}}}{\left(1-\widetilde{M}_{j}(t_{i})\right)}, \label{eq:H} \end{equation} where $\widetilde{M}_{j}(t_{i})=M_{j}(t_{\text{i}})e^{-t_{i}\tau}$, $M_j(t_i)$ is given in (\ref{M_j_t_1}), and $B_j(t_i)$ is given in (\ref{eq:servTimeofFileB_j_i}). \end{lemma} \begin{proof} The proof is provided in Appendix \ref{apdx:hjlem}. \end{proof} Substituting \eqref{eq:ET_i} in \eqref{eq:E_T_s_2} and some manipulations, the mean stall duration is bounded as follows. \begin{theorem} The mean stall duration time for file $i$ is bounded by \begin{equation} \mathbb{E}\left[\Gamma^{(i)}\right]\leq\frac{1}{t_{i}}\text{log}\left(\sum_{j=1}^{m}\pi_{ij}\left(1+H_{ij}\right)\right)\label{eq:T_s_main_stall} \end{equation} for any $t_{i}>0$, $\rho_{j}=\sum_{i}\pi_{ij}\lambda_{i}L_{i}\left(\beta_{j}+\frac{1}{\alpha_{j}}\right)$, $\rho_{j}<1,\,\text{and }$ \\ $\,\sum_{f=1}^r\pi_{fj}\lambda_{f}\left(\frac{\alpha_{j}e^{-\beta_{j}t_{i}}}{\alpha_{j}-t_{i}}\right)^{L_{f}}-\left(\Lambda_{j}+t_{i}\right)<0,\,\forall j$.\label{meanthm} \end{theorem} \begin{proof} The proof is provided in Appendix \ref{apdx:boundmean}. \end{proof} Note that Theorem \ref{meanthm} above holds only in the range of $t_i$ when $t_i-\Lambda_{j}\left(B_{j}(t_i)-1\right)>0$ which reduces to $\,\sum_{f=1}^r\pi_{fj}\lambda_{f}\left(\frac{\alpha_{j}e^{-\beta_{j}t_{i}}}{\alpha_{j}-t_{i}}\right)^{L_{f}}-\left(\Lambda_{j}+t_{i}\right)<0,\,\forall i, j$, and $\alpha_{j}-t_i>0$. Further, the server utilization $\rho_j $ must be less than $1$ for stability of the system. We note that for the scenario, where the files are downloaded rather than streamed, a metric of interest is the mean download time. This is a special case of our approach when the number of segments of each video is one, or $L_i=1$. Thus, the mean download time of the file follows as a special case of Theorem \ref{meanthm}. We note that the authors of \cite{Xiang:2014:Sigmetrics:2014,Yu_TON} gave an upper bound for mean file download time using probabilistic scheduling. However, the bound in this paper is different since we use moment generating function based bound. The two bounds are compared in Section \ref{sec:num}, and the bounds in this paper are shown to outperform those in \cite{Xiang:2014:Sigmetrics:2014,Yu_TON}. \subsection{Proposed Algorithm}\label{sec:algo} The joint mean-tail stall duration optimization problem given in \eqref{eq:joint_otp_prob}-\eqref{eq:vars} is optimized over three set of variables: scheduling probabilities $\boldsymbol{\pi}$, auxiliary parameters $\boldsymbol{t}$, and chunk placement $\boldsymbol{\mathcal{S}}$. Since the problem is non-convex, we propose an iterative algorithm to solve the problem. The proposed algorithm divides the problem into three subproblems that optimize one variable fixing the remaining two. The three sub-problems are labeled as (i) Access Optimization optimizes $\boldsymbol{\pi}$ for given $\boldsymbol{\mathcal{S}}$ and $\boldsymbol{t}$, (ii) Auxiliary Variables Optimization optimizes $\boldsymbol{t}$ for given $\boldsymbol{\pi}$ and $\boldsymbol{\mathcal{S}}$, and (iii) Placement Optimization optimizes $\boldsymbol{\mathcal{S}}$ for given $\boldsymbol{\pi}$ and $\boldsymbol{t}$. This algorithm is summarized as follows. \begin{enumerate}[leftmargin=0cm,itemindent=.5cm,labelwidth=\itemindent,labelsep=0cm,align=left] \item \textbf{Initilization}: Initialize $\boldsymbol{t}$,\,$\boldsymbol{\mathcal{S}}$, and $\boldsymbol{\pi}$ in the feasible set. \item \textbf{While Objective Converge } \begin{enumerate} \item Run Access Optimization using current values of $\boldsymbol{\mathcal{S}}$ and $\boldsymbol{t}$ to get new values of $\boldsymbol{\pi}$ \item Run Auxiliary Variables Optimization using current values of $\boldsymbol{\mathcal{S}}$ and $\boldsymbol{\pi}$ to get new values of $\boldsymbol{t}$ \item Run Placement Optimization using current values of $\boldsymbol{\mathcal{\pi}}$ and $\boldsymbol{t}$ to get new values of $\boldsymbol{\mathcal{S}}$ and $\boldsymbol{\mathcal{\pi}}$. \end{enumerate} \end{enumerate} We first initialize $\mathcal{S}_{i}$, $\pi_{ij}$ and $t_i$ $\forall$ $i,j$ such that the choice is feasible for the problem. Then, we do alternating minimization over the three sub-problems defined above. We will describe the three sub-problems along with the proposed solutions for the sub-problems in Appendix \ref{apdx_subprobs}. Each of the three sub-problems are solved by iNner cOnVex Approximation (NOVA) algorithm proposed in \cite{scutNOVA}, and is guaranteed to converge to a stationary point. Since each sub-problem converges (decreasing) and the overall problem is bounded from below, we have the following result. \begin{theorem} The proposed algorithm converges to a stationary point. \end{theorem} \section{Numerical Results}\label{sec:num} In this section, we evaluate our proposed algorithm for optimization of mean and tail probability of stall duration and show the effect of the trade-off of parameter $\theta$. We first study the two extremes where only either mean stall duration objective or tail stall duration probability is considered. Then, we show the tradeoff between the two QoE metrics based on the trade-off parameter $\theta$. \begin{table}[b] \vspace{-.1in} {\caption{Storage Node Parameters Used in our Simulation (Shift $\beta=10msec$ and rate $\alpha$ in 1/s)} } \resizebox{.49\textwidth}{!}{\begin{tabular}{|c|c|c|c|c|c|c|} \multicolumn{1}{c}{} & \multicolumn{1}{c}{\textbf{Node 1}} & \multicolumn{1}{c}{\textbf{Node 2}} & \multicolumn{1}{c}{\textbf{Node 3}} & \multicolumn{1}{c}{\textbf{Node 4}} & \multicolumn{1}{c}{\textbf{Node 5}} & \multicolumn{1}{c}{\textbf{Node 6}}\tabularnewline \hline {$\alpha_{j}$} & {$18.2298$} & {$24.0552$} & {$11.8750$} & {$17.0526$} & {$26.1912$} & {$23.9059$}\tabularnewline \hline \end{tabular}} \resizebox{.5\textwidth}{!}{\begin{tabular}{|c|c|c|c|c|c|c|} \multicolumn{1}{c}{} & \multicolumn{1}{c}{\textbf{Node 7}} & \multicolumn{1}{c}{\textbf{Node 8}} & \multicolumn{1}{c}{\textbf{Node 9}} & \multicolumn{1}{c}{\textbf{Node 10}} & \multicolumn{1}{c}{\textbf{Node 11}} & \multicolumn{1}{c}{\textbf{Node 12}}\tabularnewline \hline {$\alpha_{j}$} & {$27.006$} & {$21.3812$} & {$9.9106$} & {$24.9589$} & {$26.5288$} & {$21.8067$}\tabularnewline \hline \end{tabular}\label{tab:Storage-Nodes-Parameters} } \end{table} \vspace{-.2in} \subsection{Numerical Setup} We simulate our algorithm in a distributed storage system of $m=12$ distributed nodes, where each video file uses an $(10,4)$ erasure code. These parameters were chosen in \cite{Yu_TON} in the experiments using Tahoe testbed. Further, $(10,4)$ erasure code is used in HDFS-RAID in Facebook \cite{HDFS_ec} and Microsoft \cite{Asure14}. Unless otherwise explicitly stated, we consider $r=1000$ files, whose sizes are generated based on Pareto distribution \cite{arnold2015pareto} with shape factor of $2$ and scale of $300$, respectively. We note that the Pareto distribution is considered as it has been widely used in existing literature \cite{Vaphase} to model video files, and file-size distribution over networks. We also assume that the chunk service time follows a shifted-exponential distribution with rate $\alpha_{j}$ and shift $\beta_{j}$, whose values are shown in Table I, which are generated at random and kept fixed for the experiments ( Recall that this distribution has been validated in real experiments demonstrated in realistic systems \cite{Yu_TON,CS14}). Unless explicitly stated, the arrival rate for the first $500$ files is $0.002s^{-1}$ while for the next $500$ files is set to be $0.003s^{-1}$. Chunk size $\tau$ is set to be equal to $4$ s. When generating video files, the sizes of the video file sizes are rounded up to the multiple of $4$ sec. We note that a high load scenario is considered for the numerical results. In practice, the load will not be that high. However, higher load helps demonstrate the significant improvement in performance as compared to the lightly loaded scenarios where there are almost no stalls. In order to initialize our algorithm, we use a random placement of files on all the servers. Further, we set $\pi_{ij}=k/n$ on the placed servers with $t_{i}=0.01$ $\forall i$ and $j \in \mathcal{S}_{i}$. However, these choices of $\pi_{ij}$ and $t_{i}$ may not be feasible. Thus, we modify the initialization of $\boldsymbol{\pi}$ to be closest norm feasible solution given above values of $\boldsymbol{\mathcal{S}}$ and $\boldsymbol{t}$. We compare our proposed approach with five strategies: \begin{enumerate}[leftmargin=0cm,itemindent=.5cm,labelwidth=\itemindent,labelsep=0cm,align=left] \item {\em Random Placement, Optimized Access (RP-OA): } In this strategy, the placement is chosen at random where any $n$ out of $m$ servers are chosen for each file, where each choice is equally likely. Given the random placement, the variables $\boldsymbol{t}$ and $\boldsymbol{\pi}$ are optimized using the Algorithm in Section \ref{sec:algo}, where $\boldsymbol{\mathcal{S}}$-optimization is not performed. \item {\em Optimized Placement, Projected Equal Access (OP-PEA): } The strategy utilizes $\boldsymbol{\pi}$, $\boldsymbol{t}$ and $\boldsymbol{\mathcal{S}}$ as mentioned in the setup. Then, alternating optimization over placement and $\boldsymbol{t}$ are performed using the proposed algorithm. \item {\em Random Placement, Projected Equal Access (RP-PEA): } In this strategy, the placement is chosen at random where any $n$ out of $m$ servers are chosen for each file, where each choice is equally likely. Further, we set $\pi_{ij}=k/n$ on the placed servers with $t_{i}=0.01$ $\forall i$ and $j \in \mathcal{S}_{i}$. We then modify the initialization of $\boldsymbol{\pi}$ to be closest norm feasible solution given above values of $\boldsymbol{\mathcal{S}}$ and $\boldsymbol{t}$. Finally, an optimization over $\boldsymbol{t}$ is performed to the objective using Algorithm (\ref{alg:NOVA_Alg1}). \item OP-PSP ({\em Optimized Placement-Projected Service-Rate Proportional Allocation}) Policy: The joint request scheduler chooses the access probabilities to be proportional to the service rates of the storage nodes, i.e., $\pi_{ij}=k_{i}\frac{\mu_{j}}{\sum_{j}\mu_{j}}$. This policy assigns servers proportional to their service rates. These access probabilities are projected toward feasible region for a uniformly random placed files to ensure stability of the storage system. With these fixed access probabilities, the weighted mean stall duration and stall duration tail probability are optimized over the $\mathbf{t}$, and placement $\boldsymbol{\mathcal{S}}$. \item RP-PSP ({\em Random Placement-PSP}) Policy: As compared to the OP-PSP Policy, the chunks are placed uniformly at random. The weighted mean stall duration and stall duration tail probability are optimized over the choice of auxiliary variables ${\mathbf t}$. \subsection{Mean Download Time Comparison} We note that when the number of segments, $L_i$, the mean stall duration is the same as the mean download time of the file. Further, the bounds in this paper are different from those given in \cite{Xiang:2014:Sigmetrics:2014,Yu_TON} even though both the works use probabilistic scheduling. We will now compare our proposed upper-bound on download time of a file with the upper-bound given in \cite{Xiang:2014:Sigmetrics:2014,Yu_TON}. The comparison can be seen in Figure \ref{fig:downloadTime}, where the above service time distributions are used at the servers. We observe that our bound performs better for all values of arrival rate ($\lambda$), and the relative performance increases with the arrival rate. For instance, our bound is $30\%$ lower than that given in \cite{Xiang:2014:Sigmetrics:2014,Yu_TON} when the arrival rate equals $0.8\times\lambda$. \end{enumerate} \begin{figure*}[htb] \centering \hspace{2mm} \begin{minipage}{.31\textwidth} \centering \includegraphics[trim=0.0in 0in 4.2in 0in, clip, width=\textwidth]{figsRev/downloadComp} \captionof{figure}{Comparison between our upper bound on download time and the upper bound proposed in \cite{Xiang:2014:Sigmetrics:2014,Yu_TON}. } \label{fig:downloadTime} \end{minipage} \hspace{1.5mm} \begin{minipage}{.31\textwidth} \centering \includegraphics[trim=0in 0in 0in 0in, clip, width=\textwidth]{figures2/Fig1_converg_rate_new} \captionof{figure}{Convergence of mean stall duration.} \label{fig:ConvgMeanStall} \end{minipage}% \hspace{1.5mm} \begin{minipage}{.31\textwidth} \centering \includegraphics[trim=0.0in 0in 4.3in 0in, clip,width=\textwidth]{newFigsCycle2Oct/mean_vs_arrRateDiffSizeaOct} \captionof{figure}{Mean stall duration for different video arrival rates with different video lengths. } \label{fig:meanArrRateDiffSize} \end{minipage} \vspace{-.1in} \end{figure*} \subsection{Mean Stall Duration optimization} In this subsection, we focus only on minimizing the mean stall duration of all files by setting $\theta=1$, {\em i.e.}, stall duration tail probability is not considered \subsubsection*{Convergence of the Proposed Algorithm} Figure \ref{fig:ConvgMeanStall} shows the convergence of our proposed algorithm, which alternatively optimizes the mean stall duration of all files over scheduling probabilities $\boldsymbol{\pi}$, auxiliary variables $\boldsymbol{\widetilde{t}}$, and placement $\boldsymbol{\mathcal{S}}$. We notice that for $r=1000$ video files of size 600 sec with $m=12$ storage nodes, the mean stall duration converges to the optimal value within less than $700$ iterations. \subsubsection*{Effect of Arrival Rate and Video Length} Figure \ref{fig:meanArrRateDiffSize} shows the effect of different video arrival rates on the mean stall duration for different-size video length.The different size uses the Pareto-distributed lengths described above. We compare our proposed algorithm with the five baseline policies and we see that the proposed algorithm outperforms all baseline strategies for the QoE metric of mean stall duration. Thus, both access and placement of files are both important for the reduction of mean stall duration. Further, we see that the mean stall duration increases with arrival rates, as expected. Since the mean stall duration is more significant at high arrival rates, we notice a significant improvement in mean stall duration by about 60\% ( approximately 700s to about 250s) at the highest arrival rate in Figure \ref{fig:meanArrRateDiffSize} as compared to the random placement and projected equal access policy. In Figure \ref{fig:meanArrRateSameSize}, Appendix \ref{sec:par_enc}, we studied the effect of increasing the arrival rate when the video-sizes are equal with mean of 600 sec. \subsection{Stall Duration Tail Probability Optimization} In this subsection, we consider minimizing the stall duration tail probability, $\mathbb{P}\left(\Gamma^{(i)}\geq x\right)$, by setting $\theta=0$ in (\ref{eq:joint_otp_prob}). \subsubsection*{Decrease of Stall Duration Tail Probability with $x$} Figure \ref{fig:tailProbDiffX} shows the decay of weighted stall duration tail probability with respect to $x$ (in seconds) for the proposed and the baseline strategies. In order to signify (magnify) the small differences, we plot y-axis in logarithmic scale. We observe that the proposed algorithm gives orders improvement in the stall duration tail probabilities as compared to the baseline strategies. \begin{figure*} \centering \begin{minipage}{.31\textwidth} \centering \includegraphics[trim=0in 0in 4.1in 0in, clip,width=\textwidth]{newFigsCycle2Oct/tail_vs_x_logy_oct} \captionof{figure}{Stall duration tail probability for different values of $x$ (in seconds). } \label{fig:tailProbDiffX} \end{minipage} \hspace{2mm} \begin{minipage}{.32\textwidth} \centering \includegraphics[trim=0in 0in 4.3in 0in, clip, width=\textwidth]{figsRev/weightedStall_vs_NumFiles} \captionof{figure}{Stall duration tail probability for varying number of video files ($x=150$ s).} \label{fig:Fig_9_stallLat_vs_NumOfFiles} \end{minipage} \hspace{2mm} \begin{minipage}{.32\textwidth} \centering \includegraphics[trim=0.4in 0in 0.1in 0in, clip,width=\textwidth]{figsRev/accomd_mean_tail_final2_oct} \captionof{figure}{Tradeoff between mean stall duration and stall duration tail probability obtained by varying $\theta$. } \label{fig:tradeoff} \end{minipage} \vspace{-.2in} \end{figure*} \subsubsection*{Effect of the number of video files} Figure \ref{fig:Fig_9_stallLat_vs_NumOfFiles} demonstrates the effect of increase of the number of video files ( from $200$ files to $1200$ files whose sizes are defined based on Pareto) on the stall duration tail probability. The stall duration tail probability increases with the number of video files, and the proposed algorithm manages to significantly improve the QoE as compared to the considered baselines. \subsection{Tradeoff between mean stall duration and stall duration tail probability} If the mean stall duration decreases, intuitively the stall duration tail probability also reduces. Thus, a question arises whether the optimal point for decreasing the mean stall duration and the stall duration tail probability is the same. We answer the question in negative since for $r=1000$ of equal sizes of length 300 sec, we find that at the values of ($\boldsymbol{\pi}$, $\boldsymbol{\mathcal{S}}$) that optimize the mean stall duration, the stall duration tail probability is 12 times higher as compared to the optimal stall duration tail probability. Similarly, the optimal mean stall duration is 30\% lower as compared to the mean stall duration at the value of ($\boldsymbol{\pi}$, $\boldsymbol{\mathcal{S}}$) that optimizes the stall duration tail probability. Thus, an efficient tradeoff point between the QoE metrics can be chosen based on the point on the curve that is appropriate for the clients. \section{Conclusions} This paper considers video streaming over cloud where the content is erasure-coded on the distributed servers. Two quality of experience (QoE) metrics related to the stall duration, mean stall duration and stall duration tail probability are characterized with upper bounds. The download and play times of each video segment are characterized to evaluate the QoE metrics. An optimization problem that optimizes the convex combination of the two QoE metrics for the choice of placement and access of contents from the servers is formulated. Efficient algorithm is proposed to solve the optimization problem and the numerical results depict the improved performance of the algorithm as compared to the considered baselines. Some possible future directions are provided in Appendix \ref{apd:future}. \section{Effect of number of servers and encoding parameters}\label{sec:par_enc} \section{Additional Simulation Figures}\label{sec:par_enc} In this section, in addition to the variations studied earlier, we will explore the effects of changing some other system parameters, i.e., the number of servers, the number of video files, the increase of video request arrival rates, and the code choice on the stall durations. \begin{figure}[t] \centering \includegraphics[trim=0.0in 0in 4.2in 0in, clip, width=0.48\textwidth]{figsRev/meanStall_vs_servers} \caption{Mean stall duration for $2000$ files and different number of servers $m$ } \label{fig:meanStall_vs_Noserver} \end{figure} {\bf Effect of number of servers: } Figure \ref{fig:meanStall_vs_Noserver} depicts the mean stall duration for increasing number of servers ($12$, $24$, $36$, $48$). We note that the mean stall duration decreases with increase of servers. \begin{figure}[t] \centering \includegraphics[trim=0.01in 0in 4.2in 0in, clip,width=0.48\textwidth]{newFigsOct/weightedStall_vs_numberServers_ercode_oct} \caption{Weighted stall duration tail probability for different coding with different video lengths.} \label{fig:ersCodingEff} \end{figure} {\bf Effect of encoding parameters: } Figure \ref{fig:ersCodingEff} depicts the weighted stall duration tail probability for varying the number of files, and for different choices of code parameters. We first note that the weighted stall duration tail probability is higher for larger number of files. Further, we note that the code with larger $n$ for the same value of $k$ performs better. This is because larger value of $n$ gives more choice for the selection of servers. Thus, $(11,6)$ performs better than $(10,6)$ and $(8,4)$ performs better than $(7,4)$. Among $(10,6)$ and $(8,4)$, the additional redundancy is $4$. With the same number of parity symbols, it is better to have larger value of $k$ since smaller chunks are obtained from each server helping stall durations. Since the replication has $k=1$, this analysis thus shows that an erasure code with the same redundancy can help achieve better stall durations. {\bf Performance with Repetition Coding: } \begin{figure}[t] \centering \includegraphics[trim=0.01in 0in 4.0in 0in, clip,width=0.48\textwidth]{newFigsOct/mean_vs_arrRate_rep_oct} \caption{Mean Stall Duration for replication-based setup $(k=1)$. We set $m=24$ servers, $r=2000$ video files, arrival rate is varied from $1\times \lambda_i$ to $7\times \lambda_i$, where $\lambda_i$ is the base arrival rate. The video file sizes are Pareto-based distributed, i.e., can be anywhere between 1-120 minutes.} \label{fig:repCoding} \end{figure} Figure \ref{fig:repCoding} shows the effect of different video arrival rates on the mean stall duration for different-size video length when each file uses $(3,1)$ erasure-code (which is triple-replication). We compare our proposed algorithm with the five baseline policies and see that the proposed algorithm outperforms all baseline strategies for the QoE metric of mean stall duration. Thus, both access and placement of files are important for reducing the mean stall duration. We see that the mean stall duration of all approaches increases with arrival rates. However, since the mean stall duration is more significant at high arrival rates, we see the significant improvement in the mean stall duration of our approach as compared to the considered baselines. \begin{figure}[t] \centering \includegraphics[trim=0.1in 0in 4.3in 0in, clip, width=0.42\textwidth]{newFigsCycle2Oct/mean_vs_NoVidFilesOct} \captionof{figure}{Mean stall duration for different number of video files with different video lengths.} \label{fig:meanStallNumFiles} \end{figure}% \begin{figure}[t] \centering \includegraphics[trim=0in 0.1in 4.0in 0in, clip, width=0.42\textwidth]{newFigsCycle2Oct/tail_vs_ArrivalRates_oct017} \captionof{figure}{Stall duration tail probability for different arrival rates for video files ($x=150$ s).} \label{fig:tailProbArrRate} \end{figure} {\bf Effect of Arrival Rates} Figure \ref{fig:tailProbArrRate} demonstrates the effect of increasing workload, obtained by varying the arrival rates of the video files from $0.25\lambda$ to $2\lambda$, where $\lambda$ is the base arrival rate, on the stall duration tail probability for video lengths generated based on Pareto distribution defined above. We notice a significant improvement of the QoE metric with the proposed strategy as compared to the baselines. At the arrival rate of $2\lambda$, the proposed strategy reduces the stall duration tail probability by about 100\% as compared to the random placement and projected equal access policy. {\bf Convergence of Stall Duration Tail Probability} Figure \ref{fig:congStallDiffXvalues} demonstrates the convergence of our proposed algorithm for different values of $x$. Considering $r=1000$ files of length 300s each with $m=12$ storage nodes, the stall duration tail probability converges to the optimal value within less than $200$ iterations. \begin{figure}[t] \centering \includegraphics[trim=0.1in 0in 4.4in 0in, clip, width=0.4\textwidth]{newFigsCycle2Oct/stallTail_vs_iterations_oct} \captionof{figure}{Stall Duration Tail Probability for different number of iterations. } \label{fig:congStallDiffXvalues} \end{figure} \begin{figure}[t] \centering \includegraphics[trim=0.0in 0in 4.2in 0in, clip, width=0.4\textwidth]{newFigsCycle2Oct/mean_vs_arrRateOct} \captionof{figure}{Mean stall duration for different video arrival rates for 600s video files. } \label{fig:meanArrRateSameSize} \end{figure} {\bf Effect of the Number of Video Files} Figure \ref{fig:meanStallNumFiles} demonstrates the impact of varying the number of video files from $100$ files to $700$ files on the mean stall duration, where the video lengths are generated according to Pareto distribution with the same parameter defined earlier (scale of 300, and shape of 2). We note that the proposed optimization strategy effectively reduces the mean stall duration and outperforms the considered baseline strategies. Thus, joint optimization over all three variables $\boldsymbol{\mathcal{S}}$, $\boldsymbol{\pi}$, and $\boldsymbol{t}$ helps reduce the mean stall duration significantly. \section{Download and Play Times of the Chunks} In order to understand the stall duration, we need to see the download time of different coded chunks and the play time of the different segments of the video. \input{download} \subsection{Play Time of Each Video Segment} Let $T_{i}^{\left(q\right)}$ be the time at which the segment $G_{i,q}$ is played (started) at the client. The startup delay of the video is $d_s$. Then, the first segment can be played at the maximum of the time the first segment can be downloaded and the startup delay. Thus, \begin{eqnarray} T_{i}^{(1)} & = & \mbox{max }\left(d_{s},\,D_{i}^{(1)}\right). \label{eq:T_i_qi1} \end{eqnarray} For $1<q\le L_i$, the play time of segment $q$ of file $i$ is given by the maximum of the time it takes to download the segment and the time at which the previous segment is played plus the time to play a segment ($\tau$ seconds). Thus, the play time of segment $q$ of file $i$, $T_{i}^{(q)}$ can be expressed as \begin{eqnarray} T_{i}^{(q)} & = & \mbox{max }\left(T_{i}^{(q-1)}+\tau,\,D_{i}^{(q)}\right). \label{eq:T_i_qi} \end{eqnarray} Equation \eqref{eq:T_i_qi} gives a recursive equation, which can yield \begin{eqnarray} T_{i}^{(L_i)} & = & \mbox{max }\left(T_{i}^{(L_i-1)}+\tau,\,D_{i}^{(L_i)}\right)\nonumber\\ & = & \mbox{max }\left(T_{i}^{(L_i-2)}+2\tau,\, D_{i}^{(L_i-1)}+\tau,\,D_{i}^{(L_i)}\right)\nonumber\\ & = & \! \mbox{max} \left(d_s+(L_{i}-1)\tau,\right.\nonumber\\ &&\left. \max_{z=2}^{L_i+1}D_{i}^{(z-1)} + (L_i-z+1)\tau \right)\ \label{eq:T_i_qi2} \end{eqnarray} Since $D_{i}^{(q)} = \max_{j\in \mathcal{A}_{i}} D_{i,j}^{(q)}$ from \eqref{deq}, $T_{i}^{(L_{i})}$ can be written as \begin{eqnarray} T_{i}^{(L_{i})}= \max_{z=1}^{L_i+1}\max_{j\in \mathcal{A}_i}\left(p_{i,j,z}\right)\label{eq:T_i_L_i}, \label{eq:pjstart} \end{eqnarray}where \begin{eqnarray} p_{i,j,z}=\begin{cases} d_{s}+\left(L_{i}-1\right)\tau &,\,\, z=1\\ \\ D_{i,j}^{(z-1)} + (L_i-z+1)\tau \ &,\,\, 2\leq z\leq (L_{i}+1) \end{cases}\label{eq:pjz} \end{eqnarray} We next give the moment generating function of $p_{i,j,z}$ that will be used in the calculations of the QoE metrics in the next sections. Hence, we define the following lemma. \begin{lemma}\label{lemma_pijz} The moment generating function for $p_{i,j,z}$, is given as \begin{equation} \mathbb{E}\left[e^{tp_{i,j,z}}\right]=\begin{cases} e^{t\left(d_{s}+\left(L_{i}-1\right)\tau\right)} & ,\,z=1\\ e^{t\left(L_{i}+1-z\right)\tau}Z_{i,j}^{(z-1)}\left(t\right) & ,2\leq z\leq L_{i}+1 \end{cases} \label{eq:momntPjz} \end{equation} where \begin{equation} Z_{i,j}^{(\ell)}\left(t\right) = {\mathbb E}[e^{tD_{i,j}^{(\ell)}}] = \frac{\left(1-\rho_{j}\right)tB_{j}(t)\left(M_{j}(t)\right)^{\ell}}{t-\Lambda_{j}\left(B_{j}(t)-1\right)}\label{eq:M_D_ij} \end{equation} \end{lemma} \begin{proof} The proof is provided in Appendix \ref{apdx:mgf_pijz}. \end{proof} Ideally, the last segment should be completed by time $d_s + L_i \tau$. The difference between $T_{i}^{(L_i)}$ and $d_s + (L_i-1) \tau$ gives the stall duration. Note that the stalls may occur before any segment. This difference will give the sum of durations of all the stall periods before any segment. Thus, the stall duration for the request of file $\delta^{(i)}$ is given as \begin{equation} \Gamma^{(i)} = T_{i}^{(L_i)} - d_s - (L_i-1) \tau. \label{eq:base} \end{equation} In the next two sections, we will use this stall time to determine the bounds on the mean stall duration and the stall duration tail probability. \section{Key notations used in this paper}\label{notation} \begin{table}[h] \caption{Key Notations Used in This Paper\label{tab:Key-Notations-Used}} \begin{tabular}{|l|>{\raggedright}p{6cm}|} \hline \textbf{Symbol} & \textbf{Meaning}\tabularnewline \hline \hline $r$ & Number of video files in system\tabularnewline \hline $m$ & Number of storage nodes \tabularnewline \hline $L_{i}$ & Number of segments for video file $i$\tabularnewline \hline $G_{i,j}$ & Segment $j$ of video file $i$\tabularnewline \hline $\left(n_{i},k_{i}\right)$ & Erasure code parameters for file $i$\tabularnewline \hline $C_{i,j}^{(q)}$ & $q^{th}$ coded chunk of segment $j$ in file $i$ \tabularnewline \hline $\lambda_{i}$ & Possion arrival rate of file $i$\tabularnewline \hline $\pi_{ij}$ & Probability of retrieving chunk of file $i$ from node $j$ using probabilistic scheduling algorithm\tabularnewline \hline $\mathcal{S}_{i}$ & Set of storage nodes having coded chunks of file $i$\tabularnewline \hline $\mathcal{A}_{i}$ & Set of storage nodes used to access chunks from file $i$\tabularnewline \hline $\left(\alpha_{j},\,\beta_{j}\right)$ & Parameters of Shifted Exponential distribution\tabularnewline \hline $X_{j}$ & Service time distribution of a chunk at node $j$\tabularnewline \hline $M_{j}(t)$ & Moment generating function for the service time of a chunk at node $j$ $M_{j}(t)=\mathbb{E}\left[e^{tX_{j}}\right]$\tabularnewline \hline $x$ & Parameter indexing stall duration tail probability \tabularnewline \hline $D_{i,j}^{(q)}$ & Download time for coded chunk $q\in\left\{ 1,\ldots,L_{i}\right\} $ of file $i$ from storage node $j$\tabularnewline \hline $R_{j}$ & Service time of the video files \tabularnewline \hline $\overline{R}_{j}$ & Laplace-Stieltjes Transform of $R_{j}$, $\overline{R}_{j}=\mathbb{E}\left[e^{-sR_{j}}\right]$\tabularnewline \hline $B_{j}(t)$ & Moment generating function for the service time of video files $B_{j}(t)=\mathbb{E}\left[e^{tR_{j}}\right]$\tabularnewline \hline $\mu_{j}$ & Mean service time of a chunk from storage node $j$\tabularnewline \hline $\Lambda_{j}$ & Aggregate arrival rate at node $j$\tabularnewline \hline $\rho_{j}$ & Video file request intensity at node $j$\tabularnewline \hline $T_{i}^{(q)}$ & The time at which the segment $G_{i,q}$ is played back\tabularnewline \hline $d_{s}$ & Start-up delay \tabularnewline \hline $\tau$ & Chunk size in seconds\tabularnewline \hline $\Gamma^{(i)}$ & Stall duration tail probability for file $i$\tabularnewline \hline $\theta$ & Trade off factor between mean stall duration and stall duration tail probability\tabularnewline \hline \end{tabular} \end{table} \section{Stall Duration Tail Probability}\label{sec:tail} The stall duration tail probability of a file $i$ is defined as the probability that the stall duration tail $\Gamma^{(i)}$ is greater than (or equal) to $x$. Since evaluating $\text{\text{Pr}}\left(\Gamma^{(i)}\geq x\right)$ in closed-form is hard \cite{MG1:12,Joshi:13,MDS-Queue,Xiang:2014:Sigmetrics:2014,Yu_TON,CS14}, we derive an upper bound on the stall duration tail probability considering Probabilistic Scheduling as follows. \begin{align} \text{\text{Pr}}\left(\Gamma^{(i)}\geq x\right) & \overset{(a)}{=}\text{\text{Pr}}\left(T_{i}^{(L_{i})}\geq x+d_{s}+\left(L_{i}-1\right)\tau\right)\nonumber \\ & =\text{\text{Pr}}\left(T_{i}^{(L_{i})}\geq\overline{x}\right)\label{eq:Pr_T_s,i} \end{align} where $(a)$ follows from (\ref{eq:E_T_s_2}) and $\overline{x}=x+d_{s}+\left(L_{i}-1\right)\tau$. Then, \begin{equation} \begin{array}{ccc} \text{\text{Pr}}\left(T_{i}^{(L_{i})}\geq\overline{x}\right) & \overset{(b)}{=} & \text{\text{Pr}}\left(\underset{z}{\text{max}\,\,}\text{\ensuremath{\underset{j\in\mathcal{A}_{i}}{\text{max}}p_{ijz}}}\geq\overline{x}\right)\\ & = & \mathbb{E}_{\mathcal{A}_{i},p_{ijz}}\left[\text{\ensuremath{\boldsymbol{1}_{\left(\underset{z}{\text{max}}\,\,\text{\ensuremath{\underset{j\in\mathcal{A}_{i}}{\text{max}}p_{ijz}}}\geq\overline{x}\right)}}}\right]\\ & \overset{(c)}{=} & \mathbb{E}_{\mathcal{A}_{i},p_{ijz}}\left[\text{\ensuremath{\underset{j\in\mathcal{A}_{i}}{\text{max}}\,\,\boldsymbol{1}_{\left(\underset{z}{\text{max}}\,p_{ijz}\geq\overline{x}\right)}}}\right]\\ & \overset{(d)}{\leq} & \mathbb{E}_{\mathcal{A}_{i},p_{ijz}}\sum_{j\in\mathcal{A}_{i}}\,\boldsymbol{1}_{\left(\underset{z}{\text{max}}p_{ijz}\geq\overline{x}\right)}\\ & \overset{(e)}{=} & \sum_{j}\pi_{ij}\mathbb{\mathbb{E}}_{pijz}\left[\,\boldsymbol{1}_{\left(\underset{z}{\text{max}}p_{ijz}\geq\overline{x}\right)}\right]\\ & = & \sum_{j}\pi_{ij}\mathbb{P}\left(\underset{z}{\text{max}\,\,}p_{ijz}\geq\overline{x}\right) \end{array}\label{eq:Pr_T_i_L_i_x_bar} \end{equation} where $(b)$ follows from (\ref{eq:T_i_L_i}), (c) follows as both max over $z$ and max over $\mathcal{A}_{j}$ are discrete indicies (quantities) and do not depend on other so they can be exchanged, (d) follows by replacing the max by $\sum_{\mathcal{A}_{i}}$, (e) follows from probabilistic scheduling. Using Markov Lemma, we get \begin{equation} \mathbb{P}\left(\underset{z}{\text{max}\,\,}p_{ijz}\geq\overline{x}\right)\leq\frac{\mathbb{E}\left[e^{t_{i}\left(\underset{z}{\text{max}\,\,}p_{ijz}\right)}\right]}{e^{t_{i}\overline{x}}}\label{eq:Mark_lem} \end{equation} We further simplify to get \begin{align} \mathbb{P}\left(\underset{z}{\text{max}\,\,}p_{ijz}\geq\overline{x}\right) & \leq\frac{\mathbb{E}\left[e^{t_{i}\left(\underset{z}{\text{max}\,\,}p_{ijz}\right)}\right]}{e^{t_{i}\overline{x}}}\nonumber \\ & =\frac{\mathbb{E}\left[\underset{z}{\text{max}\,\,}e^{t_{i}p_{ijz}}\right]}{e^{t_{i}\overline{x}}}\nonumber \\ & \overset{\left(f\right)}{=}\frac{F_{ij}}{e^{t_{i}\overline{x}}}\label{eq:max_z_pjz} \end{align} where (f) follows from (\ref{eq:F_ij}). Substituting (\ref{eq:max_z_pjz}) in (\ref{eq:Pr_T_i_L_i_x_bar}), we get the stall duration tail probability as described in the following theorem (details are provided in Appendix \ref{apdx:boundtail}). \begin{theorem} The stall distribution tail probability for video file $i$ is bounded by \begin{equation} \sum_{j}\frac{\pi_{ij}}{e^{t_{i}x}}\left(1+e^{-t_{i}\left(d_{s}+(L_{i}-1)\tau\right)}\,H_{ij}\right)\ \label{eq:T_stall} \end{equation} for any $t_{i}>0$, $\rho_{j}=\sum_{i}\pi_{ij}\lambda_{i}L_{i}\left(\beta_{j}+\frac{1}{\alpha_{j}}\right)$, $\rho_{j}\leq1,$ \\ $\,\sum_{f=1}^r\pi_{fj}\lambda_{f}\left(\frac{\alpha_{j}e^{-\beta_{j}t_{i}}}{\alpha_{j}-t_{i}}\right)^{L_{f}}-\left(\Lambda_{j}+t_{i}\right)<0,\,\forall i,j$, \text{and} $H_{ij}$ is given by (\ref{eq:H}).\label{tailthm} \end{theorem} We note that for the scenario, where the files are downloaded rather than streamed, a metric of interest is the latency tail probability which is the probability that the file download latency is greater than $x$. This is a special case of our approach when the number of segments of each video is one, or $L_i=1$. Thus, the latency tail probability of the file follows as a special case of Theorem \ref{tailthm}. In this special case, the result reduces to that in \cite{Jingxian}.
{'timestamp': '2018-06-27T02:08:38', 'yymm': '1703', 'arxiv_id': '1703.08348', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08348'}
arxiv
\section{Background} This problem arose from the use of a novel robotically controlled microscope technology (\textit{Toponome Imaging System}, abbreviated to \textit{TIS}), invented by Walter Schubert (see \cite{Schubert.etal:2006:Analyzing}). TIS records, pixel by pixel, the location and abundance of proteins in a tissue section, thus co-locating many different proteins in the same pixel. Since proximity is necessary (though not sufficient) for interaction, this gives a powerful new method for discovering protein complexes and protein networks, particularly since the anatomy of the section is not disrupted by the TIS process. A TIS run results in a large number (typically, hundreds) of different images of the same tissue section. Such sequences of images may issue from the TIS machine approximately aligned, but they will seldom be completely correctly aligned without further processing, because physical reality, for example changes in temperature or vibrations from a passing heavy goods vehicle, ensures that camera measurements are never perfect. In order to obtain good information about co-location of proteins and other biomolecules, alignments that are as accurate as possible must first be achieved. In \cite{Raza.etal:2012:RAMTaB:}, it is explained how this can be done. The only adjustments necessary to achieve good alignments turn out to be rigid translation of the different images against one fixed image. \begin{figure}[tbp] \begin{center} \includegraphics[height=40mm]{fig1} \caption{$N=6,\: r=2$. Shading shows maximal intersections for $s=0,1,2$.} \label{fig1} \end{center} \end{figure} After alignment, some pixels will appear in all $N$ images, and others may appear in only $(N-1)$ images, or in $(N-2)$ images, and so on, as shown in Figure~\ref{fig1}. If we insist that a pixel can be analyzed only if it records all these signals simultaneously, then we have to restrict to the region where all $N$ images overlap. However, if one is prepared to discard completely one or more images, then the set of pixels which figure in all remaining images will be larger, much larger if one is discarding very seriously misaligned images. In practice one would normally decide to jettison poorest quality images first, so the algorithm presented here, though useful, is not the final word. For a similar scenario in more conventional photography, suppose one wants an image of St.~Mark's Basilica in Venice, but without the tourists and pigeons. To achieve this, one might take snapshots periodically from the same spot over an extended period. The tourists and pigeons can then be eliminated by aligning the images and then averaging the results over each pixel in the intersection of the images. Using our algorithm one can quickly determine which images to discard, in order to obtain a final image of desired area. \section{Statement of result} We start by fixing our notation and clarifying the meaning of the terms we use. In general, we will work in dimension $d$. In the discussion above, it was assumed that $d=2$, but our algorithm will work well in general. \begin{defn}\label{interval defn} Given an ordered pair $(\lambda,\rho)$ of reals numbers, we can form the space $\set{x:\lambda\le x\le \rho}\subseteq \mathbb{R}$. If $\lambda < \rho$, this is a closed interval; if $\lambda=\rho$, it is a point; and if $\lambda>\rho$ it is the empty set. For the purposes of this paper, it is convenient to have a concept that includes the {\it endpoints} $\lambda$ and $\rho$ as well as the underlying space. Refraining from pedantic rigour, we will use the word {\it interval} as though it is nothing more the underlying space, but nevertheless, we will feel free to extract the ``endpoints'' whenever necessary, even when $\lambda>\rho$. We will denote such an ``interval'' by $[\lambda,\rho]$, even if $\lambda > \rho$. \end{defn} \begin{defn}\label{rectangle defn} By a {\it \mbox{$d$-rectangle}\xspace}, we mean a product $$[\lambda_1,\rho_1]\times\dots\times [\lambda_d,\rho_d]\subseteq \mathbb{R}^d.$$ With the same level of informality as in Definition~\ref{interval defn}, we are able to extract the $2d$ endpoints, even when the underlying space is the empty set. Given a \mbox{$d$-rectangle}\xspace $R$ as above, suppose that $\lambda_i < \rho_i$ for exactly $k$ values of $i$, and that $\lambda_i=\rho_i$ for the other values of $i$. Then we call the $R$ a {\it $k$-dimensional rectangle} and define $\ensuremath{\mathtt{dim}}\xspace(R)=k$. \end{defn} Note that a \mbox{$d$-rectangle}\xspace may or may not be a $d$-dimensional rectangle. In general the underlying space of a \mbox{$d$-rectangle}\xspace may be the empty set or a point or a $k$-dimensional rectangle in $\mathbb{R}^d$. A \mbox{$d$-rectangle}\xspace can be presented as a $2d$-dimensional row vector \begin{equation}\label{matrix rectangle eqn} R = \begin{bmatrix} \lambda_1 & \rho_1 \dots & \lambda_d & \rho_d \end{bmatrix}. \end{equation} \begin{defn}\label{volume defn} Given a \mbox{$d$-rectangle}\xspace $R$ as above, we extend the definition of its volume slightly. The {\it $d$-volume} of $R$ is a pair $(\ensuremath{\mathtt{dim}}\xspace(R),\ensuremath{\mathtt{vol}}\xspace(R))$ where: \begin{enumerate} \item If, for each $i$, $\lambda_i < \rho_i$), then $$ \ensuremath{\mathtt{dim}}\xspace(R) = d \text{ and } \ensuremath{\mathtt{vol}}\xspace(R) =(\rho_1-\lambda_1)\times \dots \times (\rho_d-\lambda_d) >0 . $$ \item If $d>k> 0$ and $R$ is a $k$-dimensional rectangle in $\mathbb{R}^d$ (as in Definition~\ref{rectangle defn}), then $\ensuremath{\mathtt{dim}}\xspace(R)=k$ and $\ensuremath{\mathtt{vol}}\xspace(R)$ is equal to the volume of $R$, regarded as a $k$-rectangle in $\mathbb{R}^k$. For example, if $k=1$, then $R$ is an interval in $\mathbb{R}^d$ and $\ensuremath{\mathtt{vol}}\xspace(R)$ is its usual length. \item If $R$ is a 0-rectangle (that is, a point), then $(\ensuremath{\mathtt{dim}}\xspace(R),\ensuremath{\mathtt{vol}}\xspace(R)) = (0,0)$. \item If, for some $i$, $\lambda_i>\rho_i$, so that the underlying point set of $R$ is $\emptyset$, then $$(\ensuremath{\mathtt{dim}}\xspace(R),\ensuremath{\mathtt{vol}}\xspace(R))=(-1,0).$$ \end{enumerate} If $d=1$, this gives the length of the interval, and if $d=2$ the area of the rectangle. If $d$-volumes need to be ordered, then we use lexicographical ordering on the pair $(\ensuremath{\mathtt{dim}}\xspace(R),\ensuremath{\mathtt{vol}}\xspace(R))$. \end{defn} \begin{convention}\label{data} Throughout this paper (unless otherwise stated) $d>0$ will denote the dimension of the euclidean space $\mathbb{R}^d$ in which we are working, and \ensuremath{\script R}\xspace will denote a specific ordered list of $N$ \mbox{$d$-rectangles}\xspace. This list can equally well be represented by an $N\times 2d$ real matrix. We fix an integer $r$ with $0< r<N$. \end{convention} Our result can now be stated. Its proof will occupy most of the rest of this paper. \begin{theorem}\label{main} We are given data as in Convention~\ref{data}. Then there is an algorithm taking at most $$ O\bracket{d\binom{r+2d}{2d} + dN} $$ steps, that determines, for each $s$ with $0<s\le r$, exactly $s$ entries to delete from the list \ensuremath{\script R}\xspace, so that the list of the remaining $(N-s)$ \mbox{$d$-rectangles}\xspace, represented by the remaining $(N-s)$ elements of \ensuremath{\script R}\xspace, has an intersection whose $d$-volume is maximal, as we vary over the $\binom{N}{s}$ possible choices of $s$ elements of \ensuremath{\script R}\xspace. The constant in our bound for the number of steps is independent of $N$, $r$ and $d$. \end{theorem} \begin{corollary}\label{maincor} For any fixed dimension $d$, the running time of the algorithm is $O(r^{2d} + N)$. \end{corollary} In applications such as that of microscopy, which was our primary motivation, many rectangles may coincide in some coordinates. Our algorithm is designed to deal efficiently with this situation. Several of the complications result from this. We have been thinking mainly of the case when $r$ is small compared with $N$. For $r$ near $N$, it is possible to achieve better results with a brute force search. For example, if $r=N-1$, then one deletes all except one \mbox{$d$-rectangle}\xspace. So one need only compute the volume of each of the given \mbox{$d$-rectangles}\xspace, and one then takes the maximum of these. This takes $O(dN)$ steps. We will not bother to make explicit other similar brute force results when $r$ is nearly as big as $N$. To be explicit, we need a model of computation: we will assume the usual model of a RAM machine. This means that the number of memory cells is as large as we need for the computation, and that each of these is accessed in unit time. Moreover, memory cells are assumed to be large enough so that any particular integer that needs to be stored can be stored in a single cell. Formally, we do not work with floating point numbers. If necessary, these can be converted to integers by a suitable change of scale. However, it is convenient and less confusing to pretend that we can work with arbitrary real numbers. Arithmetical operations including simple comparisons are assumed to take unit time. This gives a reasonably realistic mathematical model of a computer for most practical purposes. \section{Some notations and definitions} We can think of a \mbox{$d$-rectangle}\xspace as an element in $\mathbb{R}^{2d}$, a row vector as in Equation~\ref{matrix rectangle eqn}. $\ensuremath{\script R}\xspace$ is then a map $\ensuremath{\script R}\xspace:\ensuremath{\set{1,\cdots,N}}\xspace\to\mathbb{R}^{2d}$. In particular, repetition is allowed. \begin{convention}\label{lists} Formally speaking, a list is a map, like $\ensuremath{\script R}\xspace$. However, it is convenient to use the same notation also for the image of the map. The advantage of this abuse of notation is that it allows us to write $R\in\ensuremath{\script R}\xspace$ for any element $R$ in the list. This paper will contain several lists, and we allow the same abuse of notation in each case. We will disambiguate if we think there is a possibility of confusion. \end{convention} For $1\le j\le N$, we write $R_j$ instead of $\ensuremath{\script R}\xspace(j)$, and, following Equation~\ref{matrix rectangle eqn}, we will consistently use the notation:. \begin{equation}\label{matrix rectangles eqn} R_j = \begin{bmatrix} \lambda_{j,1} & \rho_{j,1} \dots & \lambda_{j,d} & \rho_{j,d} \end{bmatrix} = \begin{bmatrix} r_{j,1} & \cdots & r_{j,2d} \end{bmatrix} \end{equation} \begin{defn}\label{rectangle indices defn} We often refer to elements of \ensuremath{\set{1,\cdots,N}}\xspace as {\it rectangle indices}, to remind ourselves that they are indices for our list $\ensuremath{\script R}\xspace$ of \mbox{$d$-rectangles}\xspace. \end{defn} \begin{defn}\label{intersection defn} Let $L\subseteq \ensuremath{\set{1,\cdots,N}}\xspace$ be non-empty. The {\it intersection} of the family $\bracket{R_j}_{j\in L}$ is defined as follows. For each $i$ with $1\le i\le d$, let $M_i=\max_{j\in L}\lambda_{ji}$ and let $m_i=\min_{j\in L}\rho_{ji}$. Then the {\it intersection} is the \mbox{$d$-rectangle}\xspace \begin{equation}\label{intersection eqn} {{\mathrm R}}(L) = \begin{bmatrix}M_1 & m_1 & \dots & M_d & m_d\end{bmatrix}. \end{equation} Equation~\ref{intersection eqn} is the result of a trivial calculation when ${{\mathrm R}}(L)$ is not empty, and is a definition when the point set of ${{\mathrm R}}(L)$ is empty. ${{\mathrm R}}(L)$ is called an {\it intersection rectangle}. We denote by \ensuremath{{\script I}_r}\xspace the set of non-empty intersection rectangles $({{\mathrm R}}(L)\neq\emptyset)$, where $L\subseteq \ensuremath{\set{1,\cdots,N}}\xspace$ and $|L|\ge N-r$. \end{defn} We will find an efficient way to produce, one by one, the elements of \ensuremath{{\script I}_r}\xspace. We will then be able to calculate, for each $R\in\ensuremath{{\script I}_r}\xspace$, the $d$-volume of $R$ and compare these results to find the best one. The number of subsets like $L$ above, giving rise to elements of \ensuremath{{\script I}_r}\xspace in Definition~\ref{intersection defn}, could be as large as $\sum_{s=0}^r \binom Ns$, potentially a large number. To reduce this number, note that a given element $R\in \ensuremath{{\script I}_r}\xspace$ can in general satisfy $R= {{\mathrm R}}(L)$ for many different $L\subset \ensuremath{\set{1,\cdots,N}}\xspace$. For any such $L$, we define ${\mathrm L}(R)$, by \begin{equation}\label{L function} {\mathrm L}(R)= \set{j|R\subseteq R_j}, \end{equation} which is the largest subset of the given set of rectangles with intersection $R$. Then $L\subseteq {\mathrm L}(R) = {\mathrm L}({\mathrm R}(L))$, and $|{\mathrm L}({\mathrm R}(L))| \ge |L| \ge N-r$. We are thinking of $r$ as small compared with $N$, and so it is easier to work with the complement of ${\mathrm L}(R)$ in \ensuremath{\set{1,\cdots,N}}\xspace. We define \begin{equation}\label{U function} {\mathrm U}(R)=\set{j|R\nsubseteq R_j} \end{equation} so that $|{\mathrm U}(R)| \le r$. \begin{defn}\label{U sub r defn} We define $$\ensuremath{\script U_r}\xspace = \set{{\mathrm U}(R): R\in\ensuremath{{\script I}_r}\xspace}.$$ The map ${\mathrm U}:\ensuremath{{\script I}_r}\xspace \to \ensuremath{\script U_r}\xspace$ is clearly a bijection. \end{defn} An essential feature of our solution will be the use of different orderings on the set \ensuremath{\set{1,\cdots,N}}\xspace, one for each $i$ with $1\le i \le 2d$. To understand better why and how orderings are important, we discuss the special case $d=1$. In this case, we are given a list of $N$ intervals $\ensuremath{\script R}\xspace=\bracket{I_1,\ldots,I_N}$, with $I_j=[\lambda_j,\rho_j]$. To avoid irrelevant detail, we assume for the moment that the $2N$ endpoints of these intervals are all distinct, and that the intersection of the $N$ intervals is not empty. We define $u,v \in \ensuremath{\set{1,\cdots,N}}\xspace$ so that $\lambda_u=\max_j\lambda_j=m$ and $\rho_v=\min_j\rho_j=M$, as in Definition~\ref{intersection defn}. Unless $I_u$ is removed from \ensuremath{\script R}\xspace, the lefthand endpoint of the intersection will continue to be $m$. Unless $I_v$ is removed from \ensuremath{\script R}\xspace, the righthand endpoint of the intersection will continue to be $M$. So $I_u$ or $I_v$ must be removed (and remember that $u=v$ is a possibility) if the length of the intersection is to strictly increase. If $r\ge 2$, and we are omitting $r$ intervals from \ensuremath{\script R}\xspace, then similar reasoning will apply to subsequent removal of intervals. We have to look repeatedly for the largest lefthand endpoint and, separately, for the smallest righthand endpoint, in the remaining intervals. Given a list \ensuremath{\script R}\xspace of $N$ \mbox{$d$-rectangles}\xspace, we now define, for each $i$ with $1\le i \le 2d$, orderings $\prec_i$ and $\preccurlyeq_i$ on \ensuremath{\set{1,\cdots,N}}\xspace, modelling the definitions on the discussion in the previous paragraph. \begin{defn}\label{orderings defn} Let $j,k\in \ensuremath{\set{1,\cdots,N}}\xspace$ and let $1\le t \le d$. If $i=2t-1$, we define $j\prec_i k$ if $\lambda_{j,t} > \lambda_{k,t}$, and $j\preccurlyeq_i k$ if $\lambda_{j,t}>\lambda_{k,t}$ or if $(\lambda_{j,t}=\lambda_{k,t}\text{ and } j\le k)$. If $i=2t$, we define $j\prec_i k$ if $\rho_{j,t} < \rho_{k,t}$, and $j\preccurlyeq_i k$ if $\rho_{j,t}<\rho_{k,t}$ or if $(\rho_{j,t}=\rho_{k,t}\text{ and } j\le k)$. Then $\prec_i$ is a partial order and $\preccurlyeq_i$ is a total order on \ensuremath{\set{1,\cdots,N}}\xspace. For odd $i$, the orderings are (weakly) decreasing in the $\lambda$'s, and, for even $i$, they are (weakly) increasing in the $\rho$'s. \end{defn} \section{Properties of $X\in\ensuremath{\script U_r}\xspace$.} We want to produce the elements $X\in\ensuremath{\script U_r}\xspace$ efficiently one by one. With this in mind, let $X\subset\ensuremath{\set{1,\cdots,N}}\xspace$ with $|X|\le r <N$, in which case we find necessary and sufficient conditions for $X$ to be an element of \ensuremath{\script U_r}\xspace. \begin{defn}\label{endpoint list defn} An {\it endpoint list} is a non-empty subset of \ensuremath{\set{1,\cdots,N}}\xspace, arranged in order, smallest first, with respect to one of the total orderings $\preccurlyeq_i$ described in Definition~\ref{orderings defn}. We set $E_i$ equal to the set \ensuremath{\set{1,\cdots,N}}\xspace, arranged in order according to $\preccurlyeq_i$, so that $E_i$ is an endpoint list. \end{defn} \begin{defn}\label{bv defn} Let $X\subset\ensuremath{\set{1,\cdots,N}}\xspace$, with $|X|\le r < N$. For each $i$, let ${\mathrm j}(i,X)$ be the smallest element of $E_i$ that is not in $X$ (which must exist since $X$ has fewer than $N$ elements). We define $\ensuremath{\mathrm{bv}}(i,X)=r_{{\mathrm j}(i,X),i}$ (where $\ensuremath{\mathrm{bv}}$ stands for {\it barrier value}). We set \begin{equation}\label{v(X) eqn} \ensuremath{\mathrm{bv}}(X) =(\ensuremath{\mathrm{bv}}(1,X),\cdots ,\ensuremath{\mathrm{bv}}(2d,X)). \end{equation} \end{defn} \begin{lemma}\label{U description} Suppose $X\subset\ensuremath{\set{1,\cdots,N}}\xspace$, with $|X| \le r < N$. $X\in\ensuremath{\script U_r}\xspace$ if and only if the following two conditions are satisfied: \begin{enumerate}[label=\thetheorem.\arabic{*}:\ ,ref=\thetheorem.\arabic{*}, leftmargin=0cm,itemindent=.5cm,labelwidth=\itemindent,labelsep=0cm,align=left] \item\label{U condn: bv inequality} For each $i$ with $1\le i\le d$, $\ensuremath{\mathrm{bv}}(2i-1,X)\le \ensuremath{\mathrm{bv}}(2i,X)$. \item\label{U condn: prec} For each $j\in X$, there is an $i$ such that $j\prec_i {\mathrm j}(i,X)$. \end{enumerate} Under these conditions, $X={\mathrm U}(\ensuremath{\mathrm{bv}}(X))$. \end{lemma} \begin{proof} Suppose first that $X\in\ensuremath{\script U_r}\xspace$, or equivalently that $X={\mathrm U}(R)$ for some $R\in\ensuremath{{\script I}_r}\xspace$, where $$\emptyset\neq R=\begin{bmatrix}r_1&r_2&\dots&r_{2d-1}&r_{2d}\end{bmatrix}.$$ For any $j\notin {\mathrm U}(R)$, we have $R\subseteq R_j$, and so, for $1\le i\le d$, \begin{equation*} r_{j,2i-1}\le r_{2i-1} \le r_{2i} \le r_{j,2i}. \end{equation*} This holds in particular with $j={\mathrm j}(2i-1,X)$ and with $j={\mathrm j}(2i,X)$, giving rise to \begin{equation}\label{bv inequalities} \ensuremath{\mathrm{bv}}(2i-1,X)\le r_{2i-1} \le r_{2i} \le \ensuremath{\mathrm{bv}}(2i,X), \end{equation} proving the first condition in the statement of Lemma~\ref{U description}. Continuing with the hypotheses $R\in\ensuremath{{\script I}_r}\xspace$ and $X={\mathrm U}(R)$, we next show that $\ensuremath{\mathrm{bv}}(X)=R$, when we regard both as elements of $\mathbb{R}^{2d}$. Suppose $1\le i\le 2d$. Since $R=\bigcap\set{R_j:R\subseteq R_j}$, we know that $r_i = r_{j,i}$, for some $j$ such that $R\subseteq R_j$, that is, for some $j\notin X$. By Equation~\ref{bv inequalities}, if $i$ is odd, we have $$r_i=r_{j,i} \ge \ensuremath{\mathrm{bv}}(i,X) = r_{{\mathrm j}(i,X)}.$$ But ${\mathrm j}(i,X)$ is, by definition, the smallest element not in $X$, and the ordering is reversed for odd $i$, according to the ordering $\preccurlyeq_{i}$ (see Definition~\ref{orderings defn}). So a strict inequality $\ensuremath{\mathrm{bv}}(i,X)<r_{j,i}$ is impossible, and we must have the equality $\ensuremath{\mathrm{bv}}(i,X)= r_{i}$. Similarly if $i$ is even. This proves that $R=\ensuremath{\mathrm{bv}}(X)$. Therefore $X={\mathrm U}(R)={\mathrm U}(\ensuremath{\mathrm{bv}}(X))$. We continue to assume that $X={\mathrm U}(R)$, and let $j\in X$. Then $R\nsubseteq R_j$. It follows that, for some $i$, $[r_{2i-1},r_{2i}]\nsubseteq [r_{j,2i-1},r_{j,2i}]$. This implies that $r_{2i-1}<r_{j,2i-1}$ or $r_{2i}>r_{j,2i}$. We have shown that $R=\ensuremath{\mathrm{bv}}(X)$, so this means that $j\prec_{2i-1} {\mathrm j}(2i-1,X)$ or $j\prec_{2i} {\mathrm j}(2i,X)$, proving the second condition in the statement of Lemma~\ref{U description}. Now let us assume the two conditions in the statement of the lemma, and prove that $X\in\ensuremath{\script U_r}\xspace$. Let $R=\ensuremath{\mathrm{bv}}(X)$ be a \mbox{$d$-rectangle}\xspace. By Condition~\ref{U condn: bv inequality}, $R\neq \emptyset$. If $j\notin X$, then, for each $i$, ${\mathrm j}(i,X) \preccurlyeq_i j$. Therefore $\ensuremath{\mathrm{bv}}(2i-1,X) \ge r_{j,2i-1}$ and $\ensuremath{\mathrm{bv}}(2i,X)\le r_{j,2i}$. It follows that $R\subseteq R_j$. In particular, for each $j\notin X$ and each $i$ with $1\le i\le 2d$, $R\subseteq R_{{\mathrm j}(i,X)}$, so that $R\subseteq \bigcap_i R_{{\mathrm j}(i,X)}$. On the other hand, Definition~\ref{intersection defn} shows that $\bigcap_i R_{{\mathrm j}(i,X)}\subseteq R$. We deduce that $R=\bigcap_{j\notin X} R_j$, which shows that $R\in\ensuremath{{\script I}_r}\xspace$. If, on the other hand, $j\in X$, then, by hypothesis, for some $i$, $j\prec_i {\mathrm j}(i,X)$. Then $r_{j,i} > \ensuremath{\mathrm{bv}}(i,X)$ if $i$ is odd, and $r_{j,i} < \ensuremath{\mathrm{bv}}(i,X)$ if $i$ is even. It follows that $R\nsubseteq R_j$. Therefore $X=\set{j:R\nsubseteq R_j}$ and $X\in \ensuremath{\script U_r}\xspace$. \end{proof} \section{Program paths}\label{Program paths} Before describing the algorithm that produces all the elements of $\ensuremath{\script U_r}\xspace$ one by one, we describe how to generate one particular $U\in\ensuremath{\script U_r}\xspace$. From Lemma~\ref{U description}, $U={\mathrm U}(\ensuremath{\mathrm{bv}}(U))$. For $1\le i\le 2d$, we write $U_i=\set{j|j\prec_i {\mathrm j}(i,U)}$, so that, by Lemma~\ref{U description}, $U = \bigcup_i U_i$. For $1\le i\le 2d$ let \begin{equation}\label{U sup i} U^i=U_i\setminus\bigcup_{1\le k<i}U_k. \end{equation} $U$ is equal to the disjoint union of the $U^i$. We generate first the elements of $U^1$, then the elements of $U^2$, and so on. We prefer to think of these rectangle indices in $U$ as being {\it discarded} or deleted, rather than generated, since we are thinking of generating the complement of $U$, $L=\ensuremath{\set{1,\cdots,N}}\xspace\setminus U$, and then taking the intersection of the \mbox{$d$-rectangles}\xspace in $L$. We start with \ensuremath{\set{1,\cdots,N}}\xspace, discard the rectangle indices in $U^1$, then the rectangle indices in $U^2$, and so on. To completely specify the order in which the rectangle indices in $U$ are discarded, we insist that the elements of $U^i$ are discarded in increasing $\preccurlyeq_i$ order, that is, least first. \begin{defn}\label{focus defn} By a $\Delta$-{\it move} we mean one of the deletions just mentioned. While working with $U^i$, $\Delta$ deletes the $\preccurlyeq_i$-smallest element of $E_i$ remaining. Until all elements of $U^i$ are deleted, this smallest element is an element of $U^i$. While carrying out such deletions, we say that the algorithm is {\it focussed at $i$}. An $S$-{\it move} moves from the {\it focus index} $i$ to $(i+1)$. In our process, there are only these two types of move, and the process starts with focus at $i=1$. $\Delta$ and $S$ are mnemonic for ``delete'' and ``shift index by one''. At the end of the process, a final $S$-move causes the process to stop. \end{defn} During the algorithm the $E_i$ keep on changing. In order to keep track of what is going on, we introduce a time variable $t$ which increases by one at each move. Let $\delta(t,U)$ be the number of $\Delta$-moves and $s(t,U)$ the number of $S$-moves during the first $t$ units of time, so that $t=\delta(t,U)+s(t,U)$. At time $t$, the focus is at $i=s(t,U)+1$. Recall from Definition~\ref{endpoint list defn} that $E_i$ consists of the elements of \ensuremath{\set{1,\cdots,N}}\xspace listed in ascending order according to $\preccurlyeq_i$. We write $E_i(t,U)$ for $E_i$ at time $t$, when all the lists $E_i(t,U)$ have exactly the same set of $N-\delta(t,U)$ entries, though the orders in which these entries appear are, in general, different. When a $\Delta$-move deletes an element of $E_i(t,U)$ during focus at $i$ (always the smallest element according to $\preccurlyeq_i$), then that element is also deleted from all the $E_k(t,U)$, for $1\le k \le 2d$. The process starts at $t=0$ with focus at $i=1$. For each $k$ with $1\le k\le 2d$, $E_k(0,U)=\ensuremath{\set{1,\cdots,N}}\xspace$. For $1\le i\le 2d$, let $t_i$ be the first time at which the focus moves to $i$ (so $t_1=0$), and let $t_{2d+1}$ be the time when the process ends. At time $t_i$, the set of rectangle indices so far deleted from \ensuremath{\set{1,\cdots,N}}\xspace and from the various $E_\ell$, is equal to $\bigcup_{1\le k<i}U^k$. From the definition of $U_i$ immediately preceding Equation~\ref{U sup i}, we know that \begin{equation}\label{Ui} U^i = \set{j|j\in E_i(t_i,U)\text{ and }j\prec_i {\mathrm j}(i,U)} \end{equation} (see Convention~\ref{lists} for the meaning of $j\in E_i$), so that the $\preccurlyeq_i$-smallest element of $U^i$, which is the next rectangle number to be discarded (assuming $U^i$ is not empty), is also the $\preccurlyeq_i$-smallest element of $E_i(t,U)$. Therefore, $|U^i|$ successive $\Delta$-moves will delete exactly the elements of $U^i$, and, following this, an $S$-move transfers focus to $(i+1)$, or, if $i=2d$, $S$ causes the process to stop. \begin{rules}\label{Rules} It is convenient to think of the process $\pi(U)$ just described, when $U\in\ensuremath{\script U_r}\xspace$, as a word ${\mathrm W}(U)$ in the terms $S$ and $\Delta$, read from left to right. Let $u(i)=\left| U^i\right|$ be the number of elements in $U^i$. Note that $\sum_i u(i) \le r$. We define \begin{equation}\label{W(U) defn} {\mathrm W}(U)= \Delta^{u(1)}S\Delta^{u(2)}S\cdots S\Delta^{u(2d)}S. \end{equation} We will now present several rules on words $w$ in $S$ and $\Delta$ that every $w={\mathrm W}(U)$ has to obey. Once the rules have all been made explicit, we will define $\ensuremath{\script W_r}\xspace$ to be the set of legal words, that is, the set of all words satisfying all the rules. We will then show that the map $F_{\mathit{WU}}:\ensuremath{\script U_r}\xspace \to\ensuremath{\script W_r}\xspace$ given by $F_{\mathit{WU}}(U)={\mathrm W}(U)$ is a bijection, so that the rules will be not only necessary but also sufficient for a word $w$ to be equal to ${\mathrm W}(U)$ for some $U\in\ensuremath{\script U_r}\xspace$. This will reduce our task to producing an algorithm that produces one by one the set of all legal words. We already have three rules, satisfied by any word $w={\mathrm W}(U)$ for some $U\in\ensuremath{\script U_r}\xspace$: \begin{enumerate}[label=\bf Rule~\Alph{*}:\ , ref=Rule~\Alph{*}, leftmargin=0cm,itemindent=.5cm,labelwidth=\itemindent,labelsep=0cm,align=left] \item\label{2d rule} $w$ contains exactly $2d$ terms equal to $S$. \item\label{end rule} $w$ ends with an $S$. \item\label{r rule} $w$ contains at most $r$ terms equal to $\Delta$. \end{enumerate} Rules A and B mean that each coordinate direction is considered and Rule C ensures that at most $r$ deletions are used. \begin{defn}\label{pi(w) and E(t,k,w)} Now suppose a word $w$ in $\Delta$ and $S$ satisfies \ref{2d rule}, \ref{end rule} and \ref{r rule}. We obtain a process $\pi(w)$, analogous to the process $\pi(U)$ (see first sentence of \ref{Rules}), that reads $w$ from left to right, taking action as appropriate for each term read. More precisely, we proceed as follows. If $t\le \mathrm{length}(w)$, we factorize $w=w_t.v_t$, where the length of $w_t$ is $t$. We denote by $\delta(t,w)$ the number of terms equal to $\Delta$ in $w_t$, and by $s(t,w)$ the number of terms equal to $S$ in $w_t$. After reading $w_t$, the focus is at $i=i(t,w)=s(t,w)+1$. In particular, the focus is at $i=1$ when $t=0$. We denote by $E_k(t,w)$ the list $E_k$ after the $\delta(t,w)$ deletions that occur while $w_t$ is being read. With the focus at $i$, let $j$ be the $\preccurlyeq_i$-smallest element of $E_i(t,w)$. If the first term of $v_t$ is $\Delta$, then $j$ is deleted from each $E_k(t,w)$, giving the endpoint list $E_k(t+1,w)$. If the first term of $v_t$ is $S$, then focus is transferred from $i$ to $(i+1)$, and, for each $k$ with $1\le k \le 2d$, $E_k(t+1,w)=E_k(t,w)$. Let $U(w)$ be the set of all the rectangle indices $j$ deleted while $w$ is read. We are interested only when $U(w)\in\ensuremath{\script U_r}\xspace$, which is not in general the case for an arbitrary word $w$ satisfying only the three rules above. \end{defn} We will now describe further rules that take account of coincident coordinates, and will prove in Lemma~\ref{rules true} that these rules are satisfied by $w={\mathrm W}(U)$, whenever $U\in \ensuremath{\script U_r}\xspace$. It will turn out that, conversely, if $w$ satisfies all the rules we present, then there is a unique $U\in \ensuremath{\script U_r}\xspace$ such that $w={\mathrm W}(U)$. \begin{enumerate}[resume*] \item\label{barrier constant rule} As rectangles are discarded, barrier values may change. A lefthand endpoint barrier value will not increase and may decrease. A righthand endpoint barrier value will not decrease and may increase. This rule will ensure that any rectangle whose removal would change the barrier value at $i$ must be removed when the focus is no later than $i$. Let ${\mathrm j}(t,k,w)$ be the $\preccurlyeq_k$-smallest element of $E_k(t,w)$, and let $\ensuremath{\mathrm{bv}}(t,k,w)=r_{{\mathrm j}(t,k,w),k}$. Suppose that $2\le i\le 2d$ and that $t_i$ is the first time at which the focus is at $i$. The condition on $w$ is that, if $1\le k<i$, then $\ensuremath{\mathrm{bv}}(t,k,w)$ is independent of $t$ provided that $t_i\le t\le \mathrm{length}(w)$. We denote this constant value by $\ensuremath{\mathrm{bv}}(k,w)$. \item\label{block rule} Fix $i$ with $1\le i\le 2d$. Let $A$ be an endpoint list with ordering $\preccurlyeq_i$. By an $A$-{\it block} we mean a non-empty set of entries in $A$ of the form $$B=\set{j|j\in A \text{ and } r_{ji}=x}$$ for some $x\in\mathbb{R}$. Any $j\in A$ is contained in a unique $A$-block. Such a block can be of length one, but blocks can also be of any length up to $N$, as would happen, for example, if all of the \mbox{$d$-rectangles}\xspace in the list $\ensuremath{\script R}\xspace$ were equal to each other. We denote by $B_k(t,w)$ the initial $E_k(t,w)$-block, and suppose $t$ is such that the focus is at $k$. Let $b(t,w)=|B_k(t,w)|$. Then $b(t,w)>0$. The condition on $w=w_t.v_t$ is that, if $v_t$ starts with $\Delta$, then $\delta(t,w)+b(t,w)\le r$ and $v_t$ starts with $\Delta^{b(t,w)}$. In other words, if $v_t$ starts with a $\Delta$, then all the elements of the initial block of $E_k(t,w)$ must be deleted before the focus increases. \item\label{barrier value inequality rule} For each $k$ with $1\le k\le d$, $\ensuremath{\mathrm{bv}}(2k-1,w)\le \ensuremath{\mathrm{bv}}(2k,w)$. This rule ensures that only non-empty intersections are reached, and this can be checked as the focus leaves any even integer. \end{enumerate} \end{rules} \begin{lemma}\label{rules true} Let $U\in\ensuremath{\script U_r}\xspace$ and $w={\mathrm W}(U)$. Then $w$ satisfies all the rules above. \end{lemma} \begin{proof} From Equation~\ref{W(U) defn} we immediately see that \ref{2d rule}, \ref{end rule} and \ref{r rule} are true. To prove \ref{barrier constant rule}, recall that ${\mathrm j}(k,U)$ is the $\preccurlyeq_k$ smallest element of $E_k(0,w)\setminus U$ (see Definition~\ref{pi(w) and E(t,k,w)} for the meaning of $E_k(t,w)$). Since only elements of $U$ are discarded while $w$ is being read, ${\mathrm j}(k,U)$ is never discarded. Therefore, for all $t$, ${\mathrm j}(k,U)$ is the $\preccurlyeq_k$ smallest element of $E_k(t,w)\setminus U$. Therefore, for all $t$, \begin{equation}\label{j inequality} {\mathrm j}(t,k,w)\preccurlyeq_k {\mathrm j}(k,U). \end{equation} We claim that, for $t\ge t_{k+1}$, \begin{equation}\label{independence of t} \ensuremath{\mathrm{bv}}(t,k,w)= r_{{\mathrm j}(t,k,w),k}= r_{{\mathrm j}(k,U),k} = \ensuremath{\mathrm{bv}}(k,U), \end{equation} where the first and third equalities are definitions. For, if Equation~\ref{independence of t} were false, then Equation~\ref{j inequality} would give ${\mathrm j}(t,k,w)\prec_k {\mathrm j}(k,U)$. Recall from the definition just before Equation~\ref{U sup i}, that $U_k=\set{j: j\prec_k {\mathrm j}(k,U)}$, so that ${\mathrm j}(t,k,w)\in U_k$. However, for $t\ge t_{k+1}$, all elements of $U_k$ have been discarded, in particular ${\mathrm j}(t,k,w)$, This contradiction proves our claim, which proves \ref{barrier constant rule}. Now we prove \ref{block rule}. Choose $k$ with $1\le k \le 2d$, and suppose the focus is at $k$ at time $t$. Let $B$ be the initial block of $E_k(t,w)$, and let $x\in \mathbb{R}$ be the real number such that $ B = \set{j\in E_k(t,w) | r_{jk} = x}$. The initial $\Delta$ in $v_t$ deletes some $j\in B\cap U^k$, so that $j\prec_k {\mathrm j}(k,U)$. If $k$ is even, this means that $x=r_{j,k} < r_{{\mathrm j}(k,U),k}$, and, if $k$ is odd, $x=r_{j,k} > r_{{\mathrm j}(k,U),k}$. It follows that, for all $j\in B$, $j\prec_k {\mathrm j}(k,U)$. But this means that $B\subseteq U_k$. Since the focus is on $k$, $B\cap U^j=\emptyset$ for $j<k$. We deduce that $B\subseteq U^k$, and so all elements of $B$ are discarded immediately. This completes the proof of \ref{block rule}. \ref{barrier value inequality rule} follows from Equation~\ref{independence of t} and Lemma~\ref{U description}, and this completes the proof of Lemma~\ref{rules true}. \end{proof} \begin{proposition} The map $F_{\mathit{WU}}:\ensuremath{\script U_r}\xspace\to \ensuremath{\script W_r}\xspace$, defined by $F_{\mathit{WU}}(U)={\mathrm W}(U)$, is a bijection. \end{proposition} \begin{proof} Lemma~\ref{rules true} shows that we do indeed have ${\mathrm W}(U)\in\ensuremath{\script W_r}\xspace$, for each $U\in\ensuremath{\script U_r}\xspace$. Conversely, given $w\in\ensuremath{\script W_r}\xspace$, we obtain a subset $U\subset \ensuremath{\set{1,\cdots,N}}\xspace$ of discards by means of the process $\pi(w)$ (Definition~\ref{pi(w) and E(t,k,w)}). We need to prove the two conditions of Lemma~\ref{U description}. Let $V_i=\set{j: j \prec_i {\mathrm j}(i,U)}$. By the definition of ${\mathrm j}(i,U)$ (see Definition~\ref{bv defn}), $V_i\subseteq U$, so, in due course, all elements of $V_i$ are discarded during the process $\pi(w)$. It follows that, for $i$ fixed and $t$ sufficiently large (of course $t\le r+2d$ throughout), ${\mathrm j}(t,i,w)={\mathrm j}(i,U)$, and therefore $\ensuremath{\mathrm{bv}}(i,w)=\ensuremath{\mathrm{bv}}(i,U)$. \ref{barrier value inequality rule} implies \ref{U condn: bv inequality}. Let $j\in U$. Then, for some $i$, $j$ is discarded while the focus is at $i$. While the focus is at $i$, only elements $k\in U$ with $k\prec_i{\mathrm j}(i,U)$ are discarded. Therefore $j \prec_i {\mathrm j}(i,U)$. We claim that $r_{j,i} \neq r_{{\mathrm j}(i,U),i}$. For otherwise $j$ and ${\mathrm j}(i,U)$ would be in the same $E_i$-block. But then \ref{block rule} would imply that ${\mathrm j}(i,U)$ is also discarded, implying that ${\mathrm j}(i,U)\in U$. This contradiction implies that $j\prec_i {\mathrm j}(i,U)$, which is \ref{U condn: prec}. We have proved the two conditions of Lemma~\ref{U description}, and so $U\in\ensuremath{\script U_r}\xspace$. \end{proof} \section{A brief sketch of the algorithm} \label{brief sketch} We have reduced our problem to that of finding an algorithm that produces the words of $\ensuremath{\script W_r}\xspace$ one-by-one. Consider the finite set $\script W(r)$ of words $w$ satisfying \ref{2d rule}, \ref{end rule} and \ref{r rule}. In the standard fashion, we form these words into a rooted tree $\script T(r)$, with directed edges, each edge labelled with either $\Delta$ or $S$, so that there is exactly one path in $\script T$ from the root to a leaf for each word in $\script W(r)$. There is a subtree $\ensuremath{\script T_r}\xspace$ corresponding to the words of $\ensuremath{\script W_r}\xspace$. Our algorithm traverses a certain subtree of the tree $\script T(r)$, in depth-first order, choosing to follow a $\Delta$-edge rather than an $S$-edge, where there is a choice. For efficiency reasons, we would prefer to arrange for this subtree to be exactly the subtree $\ensuremath{\script T_r}\xspace$ of interest. However, staying inside $\ensuremath{\script T_r}\xspace$ would require a substantial amount of additional computation---this is because \ref{barrier value inequality rule} cannot be easily checked term by term. Instead we explore a subtree of $\script T(r)$ that is somewhat larger than $\ensuremath{\script T_r}\xspace$. As soon as we discover that we are outside $\ensuremath{\script T_r}\xspace$, we backtrack. Our algorithm uses a recursive function call to perform a depth-first search of $\ensuremath{\script T_r}\xspace$. We maintain a global data structure enabling us to check that the rules are being followed during the search. We denote the recursive call by $F(p,s)$. Here $p$ is the maximum number of times we permit further rectangle indices to be discarded from \ensuremath{\set{1,\cdots,N}}\xspace, that is, the maximum number of terms $\Delta$ that the algorithm may still generate, and $p$ is mnemomic for {\it permissible discard}. Also $s$ is the number of endpoint lists still to be examined, that is, the number of terms $S$ still to be generated, and $s$ is mnemonic for {\it shift}. The behaviour of $F(p,s)$ depends on the state of the global data structure, for example deciding whether to call $F(p-1,s)$ or $F(p,s-1)$ or both. The depth-first aspect of the search comes about since $F(p,s)$ calls $F(p-1,s)$ before $F(p,s-1)$ if the data structure tells us to call both. A principle followed by our algorithm is that $F(p,s)$ alters the most important part of the data structure before calling $F(p-1,s)$ and/or $F(p,s-1)$. On its return, $F(p,s)$ changes this part of the data structure back again before exiting. Thus, (the most important part of) the global data structure, when $F(p,s)$ starts, is the same as the structure when $F(p,s)$ finishes. The depth-first search starts by calling $F(r,2d)$. \section{Selection versus sorting} \label{selection versus sorting} We will later describe in detail the data structures used by our algorithm to check, as rapidly as possible, that the rules are being followed. In this section we discuss a minor improvement that can be made on the most obvious approach. The first three rules are enforced by the notation $F(p,s)$ and so have no implications for the data structure. The procedure described above requires us to order \ensuremath{\set{1,\cdots,N}}\xspace with respect to the $2d$-different orderings $\preccurlyeq_i$ described in Definition~\ref{orderings defn}. This takes $O(dN\log N)$ steps. However, we can do a little better than this. For each $k$ with $1\le k\le 2d$, let $G_k\subseteq \ensuremath{\set{1,\cdots,N}}\xspace$ be the ordered set of the first $r+1$ elements of \ensuremath{\set{1,\cdots,N}}\xspace with respect to the ordering $\preccurlyeq_k$. It turns out (see Lemma~\ref{G rules}) that our algorithm can be confined to consideration only of the ordered sets $G_k$, and that it will then run in the same number of steps (or slightly fewer). To compute the $G_k$ we proceed as follows. For each $k$, find the $(r+1)$-st element $p_k\in E_k$. An algorithm doing this is called a {\it selection algorithm}, and it requires $O(N)$ steps, as described in the next paragraph. As an unordered set $G_k = \set{j:j\preccurlyeq_k p_k}$ is found in $O(N)$ steps. $G_k$ is then sorted in $O(r\log r)$ steps. To obtain all the $G_k$ as ordered sets takes \begin{equation}\label{selection} O(d(N+r\log r)) \end{equation} steps. There is a randomized selection algorithm \cite{Hoare:1961:Algorithm}, due to Hoare, with an expected number of steps equal to $O(N)$, though the worst-case bound is $O(N^2)$. \cite{Blum.etal:1973:Time} contains an algorithm where the number of steps is bounded by $O(N)$ steps even in the worst case, though the constant hidden by the $O$-notation is not small. The latter algorithm only rarely outperforms the Hoare algorithm, and the Hoare algorithm also has the advantage that it can be carried out in place, that is, without needing more space than is needed by the input data. There is a good article about this topic, giving Hoare's code, at \url{http://en.wikipedia.org/wiki/Selection_algorithm}. Given a word $w$ in $\Delta$ and $S$ satisfying \ref{2d rule}, \ref{end rule} and \ref{r rule}, we have the process $\pi(w)$ (see Definition~\ref{pi(w) and E(t,k,w)}). We change this slightly to the process $\pi_G(w)$, which is the same as $\pi(w)$, except that, when deletion of $j$ from $E_k$ is required in $\pi(w)$, then no action is taken unless $j\in G_k$. \begin{lemma}\label{G rules} \ref{barrier constant rule}, \ref{block rule} and \ref{barrier value inequality rule} can be checked within the process $\pi_G(w)$. \end{lemma} \begin{proof} We fix $k$, with $1\le k\le 2d$. By the time the process $\pi(w)$ has completed, $\alpha$ elements have been deleted from $G_k$, and $\beta$ elements from $\ensuremath{\set{1,\cdots,N}}\xspace \setminus G_k$, where $\alpha \le \alpha+\beta \le r$, so at most $r$ elements have been deleted. Since $|G_k|=r+1$, one or more elements of $G_k$ is never deleted during $\pi(w)$. This means that we can compute ${\mathrm j}(t,k,w)$ (defined in \ref{barrier constant rule}) within $\pi_G(w)$. So we can also compute $\ensuremath{\mathrm{bv}}(t,k,w)$. We are therefore able to check \ref{barrier constant rule} and \ref{barrier value inequality rule}. We assume now that $w$ fails \ref{block rule} but passes all the other rules. We show that the failure can be seen within the process $\pi_G(w)$. Using the notation in which \ref{block rule} was stated, we suppose the rule fails at time $t$, when the focus is at $k$. We are assuming that $w=w_t.v_t$, where $w_t$ has length $t$, and that $v_t$ deletes the first element of $B_k(t,w)$, but not all of it. This means that $v_t$ starts with $\Delta^\alpha.S$, where $1\le\alpha<b(t,w)$. The number of discards from $G_k$ caused by $w_t$ is bounded above by $\delta(t,w)$, and $\delta(t,w)+\alpha \le r$, by \ref{r rule}. Therefore $w=w_t.v_t$ deletes no more than $r$ elements from $G_k$, so that at least one element remains in $G_k$. Since $b(t,w)>\alpha$, the smallest such element must be in the block $B_k(t,w)$, so that we observe the failure of \ref{block rule} within $G_k$. \end{proof} \section{Data structure} \label{data structure} We start with the given input: the $N\times 2d$-matrix $\ensuremath{\script R}\xspace$ as in \ref{data}. Given $r$ with $0< r < N$, we want to generate all words in $\ensuremath{\script W_r}\xspace$. In particular, this means that we need the ability to efficiently check the rules, avoiding unnecessary computation. We now describe the different parts of the data structure. As stated above, significant parts of the data structure, used and changed by $F(p,s)$, are restored as $F(p,s)$ exits. We will label these with the label \texttt{restore}. \begin{enumerate}[label=\thesection.\arabic{*}] \item\label{tree} {\tt Tree:} The tree $\script T(r)$ of all words satisfying our first three rules was introduced in Section~\ref{brief sketch}. The subtree $\ensuremath{\script T_r}\xspace \subseteq \script T(r)$ is formed from \ensuremath{\script W_r}\xspace, the set of words satisfying all six of our rules. {\tt Tree} is a subtree of $\script T(r)$ that normally grows inside \ensuremath{\script T_r}\xspace as our algorithm progresses, and various words are explored. From time to time we may have to explore words outside \ensuremath{\script W_r}\xspace, because it may not be immediately apparent that \ref{barrier value inequality rule} must inevitably fail, no matter how the word is extended. The error is eventually discovered, and the illegal branch of {\tt Tree} is snipped off. Each node $\nu$ of the tree corresponds to a unique word $w(\nu)$ in the terms $\Delta$ and $S$, read from left to right as we descend the tree. Each node of the tree is provided with data under the following headings: \item \texttt{Nodes} and pointers $\Delta$, \texttt{ S, parent}: We establish two symbolic values \ensuremath{\mathtt{UNDEF}}\xspace and \ensuremath{\mathtt{ILLEGAL}}\xspace. The node $\nu$ has pointers $\nu.\Delta$, {\tt $\nu$.S} and {\tt $\nu$.parent}, each pointing to another node of the tree or set equal to \ensuremath{\mathtt{UNDEF}}\xspace or to \ensuremath{\mathtt{ILLEGAL}}\xspace. As soon as we find out that $w(\nu)$ is not a proper prefix of a word in $\ensuremath{\script W_r}\xspace$, we set $\nu.\Delta=\ensuremath{\mathtt{ILLEGAL}}\xspace$, and $\nu.\ensuremath{\mathtt{S}}\xspace=\ensuremath{\mathtt{ILLEGAL}}\xspace$. Initially, {\tt Tree} has only one node, namely {\tt root}, representing the null word, and initially all its three pointers point to \ensuremath{\mathtt{UNDEF}}\xspace. For every node $\nu$ the {\tt parent} pointer is never changed, so that the {\tt parent} pointer of {\tt root} always points to \ensuremath{\mathtt{UNDEF}}\xspace. If $\nu\neq \mathtt{root}$, then its {\tt parent} pointer always points to a node, not to \ensuremath{\mathtt{UNDEF}}\xspace, so this can be used to recognize {\tt root}. \item {\tt CurrentNode (restore)}: is a global variable, pointing to the node $\nu$ of {\tt Tree} currently reached by the algorithm. It fixes the word $w=w(\nu)$ corresponding to this node. Initially, {\tt CurrentNode} points to {\tt root}, the only initial node of {\tt Tree}. \item \texttt{BSZ (restore)} and $Q$ (constant): Let $B_i$ be the set of $G_i$-blocks, arranged in order using $\prec_i$. We set $b_i=|B_i|$, and number the elements of $B_i$ in order, using {\it block numbers} $\set{1,\dots,b_i}$, with 1 numbering the $\prec_i$-smallest block and $b_i$ the $\prec_i$-largest block. $Q$ is an $N\times 2d$ matrix, whose entry in position $(j,i)$ gives the block number of the $G_i$-block containing the rectangle index $j$, provided $j\in G_i$, and is equal to \ensuremath{\mathtt{UNDEF}}\xspace if $j\notin G_i$. Constructing $Q$ takes $O(d\,N)$ steps and $Q$ does not change during the algorithm. The changing block sizes are recorded in the $(r+1)\times 2d$-matrix \ensuremath{\mathtt{BSZ}}\xspace, such that $\ensuremath{\mathtt{BSZ}}\xspace(k,i)$ is the block size of the $k$-th block of $G_i$ if $k\le b_i$. If $k>b_i$, then $\ensuremath{\mathtt{BSZ}}\xspace(k,i)=\ensuremath{\mathtt{UNDEF}}\xspace$. Initializing \ensuremath{\mathtt{BSZ}}\xspace takes $O(d\,r)$ steps. Updating \ensuremath{\mathtt{BSZ}}\xspace when the rectangle $R_j$ is discarded or restored takes $O(d)$ steps. \item \ensuremath{\mathtt{DLL}}\xspace (\texttt{restore} Doubly Linked List): In Section~\ref{selection versus sorting} we defined, for each $i$ with $1\le i\le 2d$, $G_i$ as the $\preccurlyeq_i$-ordered set of the $r+1$ rectangle indices that are smallest with respect to $\preccurlyeq_i$. \ensuremath{\mathtt{DLL}}\xspace is an $N\times 2d$-matrix, whose $k$-th column is denoted by $\ensuremath{\mathtt{DLL}}\xspace_k$. Each entry of \ensuremath{\mathtt{DLL}}\xspace is a pair of rectangle indices, that initially records $G_i$ and its order as follows. If $j\notin G_i$, the entry at row $j$ and column $i$ is \ensuremath{\mathtt{UNDEF}}\xspace and this entry is unchanged throughout the algorithm. If $j\in G_i$, the $(j,i)$ entry is initially a pair (\ensuremath{\mathtt{prev}}\xspace,\ensuremath{\mathtt{next}}\xspace) of rectangle indices, specifying the ordering $\preccurlyeq_i$ on $G_i$ in the usual manner. We adjoin a row 0 to \ensuremath{\mathtt{DLL}}\xspace to accommodate, for each $i$, a start entry at $(0,i)$ with $\ensuremath{\mathtt{prev}}\xspace=\ensuremath{\mathtt{UNDEF}}\xspace$ and \ensuremath{\mathtt{next}}\xspace equal to the $\preccurlyeq_i$-smallest surviving element of $G_i$. If $j$ is the $\preccurlyeq_i$-largest rectangle index surviving, then $\ensuremath{\mathtt{next}}\xspace=\ensuremath{\mathtt{UNDEF}}\xspace$ at position $(j,i)$. The entries in \ensuremath{\mathtt{DLL}}\xspace are changed in the usual way (taking constant time) as elements $j\in G_i$ are deleted. When $j$ is deleted from $G_i$, we do not change the temporarily meaningless values (\ensuremath{\mathtt{prev}}\xspace,\ensuremath{\mathtt{next}}\xspace) at position $(j,i)$; instead these values are retained for use when $j$ is restored. \ensuremath{\mathtt{DLL}}\xspace takes $O(d\,(N+r\log r))$ steps to initialize. Deleting or restoring a rectangle index $j$ takes $O(d)$ steps. \item \label{nu.bv} $\nu.\mathtt{vol}$: Let $m$ be the number of terms in the word $w=w(\nu)$ that are equal to $S$. For $k\le m$, $\ensuremath{\mathrm{bv}}(k,w)=r_{j,k}$, where $j$ is the $\preccurlyeq_k$-smallest element remaining in the doubly linked list $\ensuremath{\mathtt{DLL}}\xspace_k$---this is because \ref{barrier constant rule} is enforced at each step. For $2i \le m$, let $$ \alpha(i)= \ensuremath{\mathrm{bv}}(2i,w)-\ensuremath{\mathrm{bv}}(2i-1,w).$$ This is already known, unless $m=2i$ and the final term of the word $w(\nu)$ is $S$. If $\alpha(i)<0$, we set $\nu.\mathtt{parent}.\ensuremath{\mathtt{S}}\xspace = \ensuremath{\mathtt{ILLEGAL}}\xspace$ and snip off the part of the tree hanging from $\nu$. Otherwise set $$\nu.\mathtt{vol} = \prod \set{\alpha(i)|\ 2i\le m \text{ and } \alpha(i)>0}, $$ which can be evaluated inductively, each step of the induction taking constant time. \item $\nu.\dim$: We set $\nu.\mathtt{dim}$ equal to the number of $i$ such that $\alpha(i)>0$. \item {\tt Results:}\label{Results} For $0\le p \le r$, $\mathtt{Results}(p)$ has three subcomponents, namely $\mathtt{dim}$, $\mathtt{vol}$ and $\mathtt{address}$. The first two subcomponents give the lexicographically largest result of the form {\tt(dim,vol)} so far achieved by discarding $p$ $d$-rectangles from the list $\ensuremath{\script R}\xspace$, then taking the intersection of the remaining $d$-rectangles. The third subcomponent is the address of the {\tt Tree} node $\nu_p$ that was current at the time that this best result was found. Initially each {\tt dim} entry is $-1$, each {\tt vol} entry is \ensuremath{\mathtt{UNDEF}}\xspace, and each {\tt address} entry is equal to \ensuremath{\mathtt{UNDEF}}\xspace. Initialization takes $O(r)$ steps. \end{enumerate} \section{Pseudocode} \label{pseudocode} {% Here is pseudocode for the algorithm sketched in Section~\ref{brief sketch}. We will use \& and * for the address and indirection operators, as in C. The address can be, as in C, an address in memory, or, in languages that do not attempt to mimic machine architecture, the number of a row in a table or matrix. The code starts with initialization, which consists of the sorting processes described above in Section~\ref{data structure} and setting up the various data structures in the obvious way. This takes $O(dN + dr\log r)$ steps. \vspace*{10pt} The execution path of the program $F(p,s)$, whose description follows, depends on the {\it state} in which it starts. By the {\it state} we mean the values contained in the global data structures described above. So $F(p,s)$ stands for many different possible execution paths. However, We will be able to give a reasonable upper bound for the number of steps that $F(p,s)$ requires, and this upper bound is independent of the particular execution path. \ref{2d rule} is enforced by the inequality $0\le s \le 2d$. We need to check that $F(p,s)$ enforces the other five rules. \subsection{$F(p,s)$: deciding how the tree can be extended} \label{deciding} \alginout{The global variables described above; $p$, an upper bound for the number of characters $\Delta$ still to be generated, or, equivalently, the number of rectangles still to discard; $s$, the number of characters $S$ still to be generated, or, equivalently, $2d$ minus the number of characters $S$ already generated; {\tt CurrentNode}, the address of the current node $\nu$ in the tree.} {Assignment of the pointers $\nu.\Delta$ and $\nu.\ensuremath{\mathtt{S}}\xspace$ to \ensuremath{\mathtt{ILLEGAL}}\xspace, where appropriate. Storage of best results so far.} \vspace*{10pt} \begin{algtab} \algbegin $f\leftarrow 2d-s+1$;\algcomm{focus now at $f$}\alglabel{f}\\ $j\leftarrow$ smallest element of $\ensuremath{\mathtt{DLL}}\xspace_f$;\alglabel{j}\\ $\nu \leftarrow *\mathtt{CurrentNode}$;\algcomm{$\nu$ is the current node}\\ \algif{$s==0$} \algcomm{Exploration of this word is complete and all rules are satisfied.} set $\nu.\Delta=\nu.\ensuremath{\mathtt{S}}\xspace=\ensuremath{\mathtt{ILLEGAL}}\xspace$;\algcomm{Enforcing \ref{end rule}}\alglabel{s nonzero}\\ \algif{$\mathtt{Results}(r-p).\mathtt{(dim,vol)}< \nu.\mathtt{(dim,vol)}$ (lexicographically)} $\mathtt{Results}(r-p).(\mathtt{(dim,vol)}\leftarrow (\nu.\mathtt{(dim,vol)},\&\nu$);\\ \algend\textbf{endif}\\ \algelse \algcomm{ $s>0$. Check all rules, but without altering the main data structures.} \algif{$p==0$} $\nu.\Delta\leftarrow\ensuremath{\mathtt{ILLEGAL}}\xspace$;\algcomm{Enforcing \ref{r rule}}\alglabel{partial nonzero}\\ \algelsecomm{$p >0$} \algif{$\ensuremath{\mathtt{BSZ}}\xspace(Q(j,f),f) > p$} \algcomm{Note that $\ensuremath{\mathtt{BSZ}}\xspace(Q(j,f),f)$ is the block containing $j$. When $p=0$, the inequality is automatically satisfied, we have already discarded $r$ rectangle indices, and further discards are not allowed. If $p>0$ and the inequality is satisfied then \ref{block rule} would be violated by a further discard and this rules out continuations of $w(\nu)$ with next letter $\Delta$.}\\ $\nu.\Delta\leftarrow\ensuremath{\mathtt{ILLEGAL}}\xspace$\\ \algelsecomm{\ref{block rule} is satisfied and we check \ref{barrier constant rule}} \algforeach{$i$ such that $1\le i < f$} $k\leftarrow$ smallest element of $\ensuremath{\mathtt{DLL}}\xspace_i$;\\ \algif{$Q(j,i)==Q(k,i)$ \algand $\ensuremath{\mathtt{BSZ}}\xspace(Q(j,i),i)==1$} \algcomm{$j,k$ in same $G_i$-block and \ref{barrier constant rule} would be violated by a further deletion.}\\ $\nu.\Delta\leftarrow\ensuremath{\mathtt{ILLEGAL}}\xspace$;\\ \algbreak\ from \textbf{foreach} loop\\ \algend\textbf{endif}\\ \algend\textbf{endfor}\\ \algend\textbf{endif}\\ \algend\textbf{endif}\\ \algif{$f$ is even} $k\leftarrow$ smallest element of $\ensuremath{\mathtt{DLL}}\xspace_{f-1}$\\ \algif{$r_{k,f-1} > r_{j,f}$} \algcomm{\ref{barrier value inequality rule} would be violated by following with \ensuremath{\mathtt{S}}\xspace.}\\ $\nu.\ensuremath{\mathtt{S}}\xspace\leftarrow\ensuremath{\mathtt{ILLEGAL}}\xspace$;\alglabel{negative volume}\\ \algend\textbf{endif}\\ \algend\textbf{endif}\\ \algend\textbf{endif}\\ \algend \end{algtab} \subsection{$F(p,s)$: extending the tree, and recursion} \label{recursion} At this stage we have determined all failures in the rules that would be immediately apparent on following $w(\nu)$ with either $\Delta$ or \ensuremath{\mathtt{S}}\xspace. As a result, we know which new nodes to construct, and we proceed with this task. We also alter the global data structures as we explore the tree. \alginout{The global variables; $p$, an upper bound for the number of characters $\Delta$ still to be generated, or, equivalently, the number of rectangles still to discard; $s$, the number of characters $S$ still to be generated, or, equivalently, $2d$ minus the number of characters $S$ already generated; {\tt CurrentNode}, the address of the current node $\nu$ in the tree.}{Construction of new nodes of the tree. Determination of the best results possible so far, using recursion.} \vspace*{10pt} \begin{algtab} \algbegin $f\leftarrow 2d-s+1$; \algcomm{same as Line~\algref{f} of \ref{deciding}}\\ $j\leftarrow$ smallest element of $\ensuremath{\mathtt{DLL}}\xspace_f$; \algcomm{same as Line~\algref{j} of \ref{deciding}}\\ $\nu\leftarrow *\mathtt{CurrentNode}$\\ \algif{$\nu.\Delta\neq \ensuremath{\mathtt{ILLEGAL}}\xspace$} Create node $\alpha$;\\ $\mathtt{Treelocation} \leftarrow \&\alpha$;\\ $\nu.\Delta\leftarrow\&\alpha$;\\ $\alpha.\mathtt{parent}\leftarrow\&\nu$;\\ \algforeach{$i$ such that $j\in \ensuremath{\mathtt{DLL}}\xspace_i$}\alglabel{tD} Delete $j$ from $\ensuremath{\mathtt{DLL}}\xspace_i$;\\ Decrease $\ensuremath{\mathtt{BSZ}}\xspace(Q(j,i),i)$ by 1;\alglabel{decrease block}\\ \algend\textbf{endfor}\\ $F(p-1,s)$;\algcomm{$p>0$ by Line~\algref{partial nonzero} of \ref{deciding}}\\ \algif{$\alpha.\Delta==\ensuremath{\mathtt{ILLEGAL}}\xspace$ \algand $\alpha.\ensuremath{\mathtt{S}}\xspace==\ensuremath{\mathtt{ILLEGAL}}\xspace$} set $\nu.\Delta = \ensuremath{\mathtt{ILLEGAL}}\xspace$;\\ \algend\textbf{endif}\\ Reinsert $j$ in the doubly linked lists $\ensuremath{\mathtt{DLL}}\xspace_i$;\\ Increase by 1 the various $\ensuremath{\mathtt{BSZ}}\xspace(Q(j,i),i)$ (see Line~§\algref{decrease block} above);\\ $\mathtt{CurrentNode}\leftarrow \&\nu$;\\ \algend\textbf{endif}\\ \algif{$\nu.\ensuremath{\mathtt{S}}\xspace\neq \ensuremath{\mathtt{ILLEGAL}}\xspace$} Create node $\beta$;\\ $\mathtt{Treelocation} \leftarrow \&\beta$;\\ $\nu.\ensuremath{\mathtt{S}}\xspace\leftarrow\&\beta$;\\ $\beta.\mathtt{parent}\leftarrow\&\nu$;\\ \algforeach{$i$ such that $j\in \ensuremath{\mathtt{DLL}}\xspace_i$} Delete $j$ from $\ensuremath{\mathtt{DLL}}\xspace_i$;\\ Decrease $\ensuremath{\mathtt{BSZ}}\xspace(Q(j,i),i)$ by 1;\\ \algend\textbf{endfor}\\ \algif{$f$ is even} $k\leftarrow$ smallest element of $\ensuremath{\mathtt{DLL}}\xspace_{f-1}$;\\ \algif{$r_{k,f-1} == r_{j,f}$} $\beta.(\mathtt{dim,vol})=\nu.(\mathtt{dim,vol})$;\\ \algelsecomm{By Line~\algref{negative volume} of Subsection~\ref{deciding} $r_{k,f-1} < r_{j,f}$.} $\beta.\mathtt{vol} \leftarrow \nu.\mathtt{vol}\times \bracket{r_{j,f}-r_{k,f-1}}$;\\ $\beta.\mathtt{dim} \leftarrow \nu.\mathtt{dim}+1$;\\ \algend\textbf{endif}\\ \algend\textbf{endif}\\ $F(p,s-1)$;\algcomm{$s>0$ by Line~\algref{s nonzero} of Subsection~\ref{deciding}}\\ \algif{$\beta.\Delta==\ensuremath{\mathtt{ILLEGAL}}\xspace$ \algand $\beta.\ensuremath{\mathtt{S}}\xspace==\ensuremath{\mathtt{ILLEGAL}}\xspace$} set $\nu.\ensuremath{\mathtt{S}}\xspace = \ensuremath{\mathtt{ILLEGAL}}\xspace$;\\ \algend\textbf{endif}\\ Reinsert $j$ in the doubly linked lists $\ensuremath{\mathtt{DLL}}\xspace_i$;\\ Increase by 1 the various $\ensuremath{\mathtt{BSZ}}\xspace(Q(j,i),i)$ (see Line~§\algref{decrease block} above);\\ $\mathtt{CurrentNode}\leftarrow \&\nu$;\\ \algend\textbf{endif}\\ \algend \end{algtab} } \section{Estimate for number of steps} By induction on $p+s$, there is a unique function $f(p,s)$ with the following properties: \begin{equation}\label{f equations} \begin{split} f(p,0) &= 1 \text{ for } p \ge 0\,;\\ f(0,s) &= s+1 \text{ for } s\ge 0\,;\\ f(p,s)&= f(p-1,s)+f(p,s-1)+d \text{ for } p > 0 \text{ and } s>0 \,. \end{split} \end{equation} From the pseudocode in Section~\ref{pseudocode}, one sees that there is a constant $k>0$, independent of $N$, $d$ and $r$, such that the number of steps necessary to execute $F(p,s)$ is bounded by $k.f(p,s)$. Using the addition formula for binomial coefficients $$\binom{n}{s}=\binom{n-1}{s}+\binom{n-1}{s-1} ,$$ one checks that $f(p,s)$ is given by \begin{equation}\label{steps for F} f(p,s)=d\binom{p+s}{s} + \binom{p+s+1}{s}-d , \end{equation} since it satisfies Equation~\ref{f equations}. In particular, we are interested in \begin{equation}\label{f r d bound} f(r,2d) = d\binom{r+2d}{2d} + \binom{r+2d+1}{2d}-d. \end{equation} To complete the computation of the upper bound for the number of steps involved in our algorithm, we need to extract the information in the data structure {\tt Results} (see \ref{Results}). From $\rho=\mathtt{Results}(p)$, we find the set of discarded $d$-rectangles by following {\tt parent} pointers, starting at $\rho.\mathtt{address}$. This takes at most $O(p+2d)$ steps. Summing over $0\le p \le r$, we obtain a bound \begin{equation}\label{reading Results} O((r+1)2d + r(r+1)/2). \end{equation} steps, where the constant implicit in the $O$ notation is independent of $N$, $d$ and $r$. Combining this with the bounds of Equations~\ref{selection} and \ref{f r d bound}, we get an overall bound \begin{equation}\label{overall} O\bracket{d\binom{r+2d}{2d} + dN} \end{equation} since the omitted terms are dominated by those that remain in Equation~\ref{overall}. \section{The dual situation} Let $\script S$ be the set of closed non-empty $d$-rectangles in $\mathbb{R}^d$, together with the null-set. We have a lattice: the greatest lower bound of a finite subset of $\script S$ is given by intersection. The least upper bound of any finite subset of $\script S$ exists, but is not in general equal to the union. Theorem~\ref{main} applies equally well to the dual situation. Here we are given $N$ $d$-rectangles and a number $r$ with $0\le r\le N$. The task is to find which $r$ rectangles to discard, so that the smallest rectangle containing all except these $r$ rectangles is as small as possible. We can then prove the dual result to Theorem~\ref{main} by reversing all inequalities and replacing intersection by least upper bound. It is possible to sketch scenarios in which such a result might be used, but we spare the reader rather than labour the point. \bibliographystyle{plain}
{'timestamp': '2017-03-28T02:03:29', 'yymm': '1703', 'arxiv_id': '1703.08658', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08658'}
arxiv
\section{Introduction} \label{sec:intro} Automatic Speech Recognition (ASR) \cite{lideng}, thanks to the substantial performance improvement achieved with modern deep learning technologies \cite{Goodfellow-et-al-2016-Book}, has recently been applied in several fields, and it is currently used by millions of users worldwide. Nevertheless, most state-of-the-art systems are still based on close-talking solutions, forcing the user to speak very close to a microphone-equipped device. It is easy to predict, however, that in the future users will prefer to relax the constraint of handling or wearing any device to access speech recognition services, requiring technologies able to cope with a distant-talking (far-field) interaction. In the last decade, several efforts have been devoted to improving Distant Speech Recognition (DSR) systems. Valuable examples include the AMI/AMIDA projects \cite{ami}, who were focused on automatic meeting transcription, DICIT \cite{dicit_1} which investigated voice-enabled TVs and, more recently, DIRHA which addressed speech-based domestic control. The progress in the field was also fostered by the considerable success of some international challenges such as CHiME \cite{chime,chime3} and REVERB \cite{revch_full} Despite the great progress made in the past years, current systems still exhibit a significant lack of robustness to acoustic conditions characterized by non-stationary noises and acoustic reverberation \cite{adverse}. To counteract such adversities, even the most recent DSR systems \cite{nakatani} must rely on a combination of several interconnected technologies, including for instance speech enhancement \cite{BrandWard}, speech separation \cite{bss}, acoustic event detection and classification \cite{aed1,eusipco}, speaker identification \cite{Beigi}, speaker localization \cite{gcf,hscma}, just to name a few. A potential limitation of most current solutions lies in the weak matching and communication between the various modules being combined. For example, speech enhancement and speech recognition are often designed independently and, in several cases, the enhancement system is tuned according to metrics which are not directly correlated with the final ASR performance. An early attempt to mitigate this issue was published in \cite{limabeam}. In LIMABEAM, the goal was to tune the parameters of a microphone array beamformer by maximizing the likelihood obtained through a GMM-based speech recognizer. Another approach was proposed in \cite{droppo}, where a front-end for feature extraction and a GMM-HMM back-end were jointly trained using maximum mutual information. An effective integration between the various systems, however, was very difficult for many years, mainly due to the different nature of the technologies involved at the various steps. Nevertheless, the recent success of deep learning has not only largely contributed to the substantial improvement of the speech recognition part of a DSR system \cite{pawel2,hain,dnn_rev,dnn_rev2,dnn3,rav_in14,ravanelli15}, but has also enabled the development of competitive DNN-based speech enhancement solutions \cite{dnn_se1,dnn_se2,dnn_se3}. Within the DNN framework, one way to achieve a fruitful integration of the various components is joint training. The core idea is to pipeline a speech enhancement and a speech recognition deep neural networks and to jointly update their parameters as if they were within a single bigger network. Although joint training for speech recognition is still an under-explored research direction, such a paradigm is progressively gaining more attention and some interesting works in the field have been recently published \cite{joint2,joint1,joint3,joint6,joint7,joint4,joint5}. In this paper, we contribute to this line of research by proposing an approach based on joint training of a speech enhancement and a speech recognition DNN coupled with batch normalization in order to help making one network less sensitive to changes in the other. Batch normalization \cite{batchnorm}, which has recently been proposed in the machine learning community, has been shown crucial to significantly improve both the convergence and the performance of the proposed joint training algorithm. Differently to previous works \cite{joint1,joint3}, thanks to batch normalization, we are able to effectively train the joint architecture even without any pre-training steps. Another interesting aspect concerns a deeper study of a gradient weighting strategy, which ended up being particularly effective to improve performance. The experimental validation has been carried out in a distant-talking scenario considering different training datasets, tasks and acoustic conditions. \section{Batch-normalized joint training} The proposed architecture is depicted in Fig.~\ref{fig:arch}. A bigger joint DNN is built by concatenating a speech enhancement and a speech recognition MLP. The speech enhancement DNN is fed with the noisy features $x_{noise}$ gathered within a context window and tries to reconstruct at the output the original clean speech (regression task). The speech recognition DNN is fed by the enhanced features $x_{enh}$ estimated at the previous layer and performs phone predictions $y_{pred}$ at each frame (classification task). The architecture of Fig. \ref{fig:arch} is trained with the algorithm described in Alg. \ref{alg}. \label{sec:format} \begin{figure}[t!] \centering \includegraphics[width=0.42\textwidth]{prop_sys2.png} \caption{The DNN architecture proposed for joint training.} \label{fig:arch} \end{figure} The basic idea is to perform a forward pass, compute the loss functions at the output of each DNN (mean-squared error for speech enhancement and negative multinomial log-likelihood for speech recognition), compute and weight the corresponding gradients, and back-propagate them. In the joint training framework, the speech recognition gradient is also back-propagated through the speech enhancement DNN. Therefore, at the speech enhancement level, the parameter updates not only depend on the speech enhancement cost function but also on the speech recognition loss, as shown by Eq.~\ref{eq:updates}: \begin{equation} \theta_{SE} \gets \theta_{SE}- lr * (g_{SE}+\lambda g_{SR}) \,. \label{eq:updates} \end{equation} In Eq.~\ref{eq:updates}, $\theta_{SE}$ are the parameters of the speech enhancement DNN, $g_{SE}$ is the gradient of such parameters computed from the speech enhancement cost function (mean squared error), while $g_{SR}$ is the gradient of $\theta_{SE}$ computed from the speech recognition cost function (multinomial log-likelihood). Finally, $\lambda$ is a hyperparameter for weighting $g_{SR}$ and $lr$ is the learning rate. The key intuition behind joint training is that since the enhancement process is in part guided by the speech recognition cost function, the front-end would hopefully be able to provide enhanced speech which is more suitable and discriminative for the subsequent speech recognition task. From a machine learning perspective, this solution can also be considered as a way of injecting a useful task-specific prior knowledge into a deep neural network. On the other hand, it is well known that training deep architectures is easier when some hints are given about the targeted function \cite{know_matter}. As shown previously \cite{know_matter}, such prior knowledge becomes progressively more precious as the complexity of the problem increases and can thus be very helpful for a distant speech recognition task. Similarly to the current work, in \cite{know_matter,Romero-et-al-ICLR2015-small} a task-specific prior knowledge has been injected into an intermediate layer of a DNN for better addressing an image classification problem. In our case, we exploit the prior assumption that to solve our specific problem, it is reasonable to first enhance the features and, only after that, perform the phone classification. Note that this is certainly not the only way of solving the problem, but among all the possible functions able to fit the training data, we force the system to choose from a more restricted subset, potentially making training easier. On the other hand, good prior knowledge is helpful to defeat the curse of dimensionality, and a complementary view is thus to consider the proposed joint training as a regularizer. According to this vision, the weighting parameter $\lambda$ of Eq. \ref{eq:updates} can be regarded as a regularization hyperparameter, as will be better discussed in Sec. \ref{sec:gw}. \begin{algorithm}[t!] \caption{Pseudo-code for joint training} \label{alg} \begin{algorithmic}[1] \State \textbf{DNN initialization} \For {i in minibatches} \State \textbf{Forward Pass:} \State Starting from the input layer do a forward pass \State (with batch normalization) through the networks. \State \textbf{Compute SE Cost Function:} \State $MSE_i=\frac{1}{N}\sum_{n=1}^{N}(x_{enh}^i-x_{clean}^i)^2$ \State \textbf{Compute SR Cost Function:} \State $NLL_i=-\frac{1}{N}\sum_{n=1}^{N}y_{lab}^i log(y_{pred}^i)$ \State \textbf{Backward Pass:} \State Compute the grad. $g_{SE}^i$ of $MSE_i$ and backprogate it. \State Compute the grad. $g_{SR}^i$ of $NLL_i$ and backprogate it. \State \textbf{Parameters Updates:} \State $\theta_{SE}^i \gets \theta_{SE}^i - lr * (g_{SE}^i+\lambda g_{SR}^i)$ \State $\theta_{SR}^i \gets \theta_{SR}^i - lr * g_{SR}^i$ \EndFor \State Compute NLL on the development dataset \If {$NLL_{dev} < NLL_{dev}^{prev}$} \State Train for another epoch (go to 2) \Else \State Stop Training \EndIf \end{algorithmic} \end{algorithm} \subsection{Batch normalization} \label{sec:batchnorm} Training DNNs is complicated by the fact that the distribution of each layer's inputs changes during training, as the parameters of the previous layers change. This problem, known as \textit{internal covariate shift}, slows down the training of deep neural networks. Batch normalization \cite{batchnorm}, which has been recently proposed in the machine learning community, addresses this issue by normalizing the mean and the variance of each layer for each training mini-batch, and back-propagating through the normalization step. It has been long known that the network training converges faster if its inputs are properly normalized \cite{yann} and, in such a way, batch normalization extends the normalization to all the layers of the architecture. However, since a per-layer normalization may impair the model capacity, a trainable scaling parameter $\gamma$ and a trainable shifting parameter $\beta$ are introduced in each layer to restore the representational power of the network. The idea of using batch normalization for the joint training setup is motivated by a better management of the internal covariate shift problem, which might be crucial when training our (very) deep joint architecture. As will be shown in Sec.\ \ref{sec:bn_exp}, batch normalization allows us to significantly improve the performance of the system, to speed-up the training, and to avoid any time-consuming pre-training steps. Particular attention should anyway be devoted to the initialization of the $\gamma$ parameter. Contrary to \cite{batchnorm}, where it was initialized to unit variance ($\gamma=1$), in this work we have observed better performance and convergence properties with a smaller variance initialization ($\gamma=0.1$). A similar outcome has been found in \cite{initbn}, where fewer vanishing gradient problems are empirically observed with small values of $\gamma$ in the case of recurrent neural networks. \subsection{System details} The features considered in this work are standard 39 Mel-Cepstral Coefficients (MFCCs) computed every 10 ms with a frame length of 25 ms. The speech enhancement DNN is fed with a context of 21 consecutive frames and predicts (every 10 ms) 11 consecutive frames of enhanced MFCC features. The idea of predicting multiple enhanced frames was also explored in \cite{joint3}. All the layers used Rectified Linear Units (ReLU), except for the output of the speech enhancement (linear) and the output of speech recognition (softmax). Batch normalization \cite{batchnorm} is employed for all the hidden layers, while dropout \cite{dropout} is adopted in all part of the architecture, except for the output layers. The datasets used for joint training are obtained through a contamination of clean corpora (i.e., TIMIT and WSJ) with noise and reverberation. The labels for the speech enhancement DNN (denoted as $x_{clean}$ in Alg.1) are the MFCC features of the original clean datasets. The labels for the speech recognition DNN (denoted as $y_{lab}$ in Alg.1) are derived by performing a forced alignment procedure on the original training datasets. See the standard s5 recipe of Kaldi for more details \cite{kaldi}. The weights of the network are initialized according to the \textit{Glorot} initialization \cite{xavier}, while biases are initialized to zero. Training is based on a standard Stochastic Gradient Descend (SGD) optimization with mini-batches of size 128. The performance on the development set is monitored after each epoch and the learning rate is halved when the performance improvement is below a certain threshold. The training ends when no significant improvements have been observed for more than four consecutive epochs. The main hyperparameters of the system (i.e., learning rate, number of hidden layers, hidden neurons per layer, dropout factor and $\lambda$) have been optimized on the development set. The proposed system, which has been implemented with Theano \cite{theano}, has been coupled with the Kaldi toolkit \cite{kaldi} to form a context-dependent DNN-HMM speech recognizer. \subsection{Relation to prior work} Similarly to this paper, a joint training framework has been explored in \cite{joint2,joint1,joint3,joint6,joint7,joint4,joint5}. A key difference with previous works is that we propose to combine joint training with batch normalization. In \cite{joint1,joint3}, for instance, the joint training was actually performed as a fine-tuning procedure, which was carried out only after training the two networks independently. A critical aspect of such an approach is that the learning rate adopted in the fine-tuning step has to be properly selected in order to really take advantage of pre-training. With batch normalization we are able not only to significantly improve the performance of the system, but also to perform joint training from scratch, skipping any pre-training phase. Another interesting aspect of this work is a deeper study of the role played by the gradient weighting factor $\lambda$ \section{Corpora and tasks} \label{sec:corpora} In order to provide an accurate evaluation of the proposed technique, the experimental validation has been conducted using different training datasets, different tasks and various environmental conditions\footnote{To allow reproducibility of the results reported in this paper, the code of our joint-training system will be available at \url{https://github.com/mravanelli}. In the same repository, all the scripts needed for the data contamination will be available. The public distribution of the DIRHA-English dataset is under discussion with the Linguistic Data Consortium (LDC).}. The experiments with TIMIT are based on a phoneme recognition task (aligned with the Kaldi s5 recipe). The original training dataset has been contaminated with a set of realistic impulse responses measured in a real apartment. The reverberation time ($T_{60}$) of the considered room is about 0.7 seconds. Development and test data have been simulated with the same approach. More details about the data contamination approach can be found in \cite{IRs_paper,lrec,rav_is16}. The WSJ experiments are based on the popular wsj5k task (aligned with the CHiME 3 \cite{chime3} task) and are conducted under two different acoustic conditions. For the \textit{WSJ-Rev} case, the training set is contaminated with the same set of impulse responses adopted for TIMIT. For the \textit{WSJ-Rev+Noise} case, we also added non-stationary noises recorded in a domestic context (the average SNR is about 10 dB). The test phase is carried out with the DIRHA English Dataset, consisting of 409 WSJ sentences uttered by six native American speakers in the above mentioned apartment. For more details see \cite{dirha_asru,rav_is16}. \section{Experiments} \subsection{Close-talking baselines} \label{sec:ct_baseline} The Phoneme Error Rate (PER\%) obtained by decoding the original test sentences of TIMIT is $19.5\%$ (using DNN models trained with the original dataset). The Word Error Rate (WER\%) obtained by decoding the close-talking WSJ sentences is $3.3\%$. It is worth noting that, under such favorable acoustic conditions, the DNN model leads to a very accurate sentence transcription, especially when coupled with a language model. \subsection{Joint training performance} \label{sec:jt_pers} In Table \ref{tab:res1}, the proposed joint training approach is compared with other competitive strategies. \begin{table}[t!] \centering \tabcolsep=0.28cm \begin{tabular}{ | l | c | c | c | c | } \cline{1-4} \multirow{2}{*}{\backslashbox{\em{System}}{\em{Dataset}}} & \multicolumn{1}{ | c |}{TIMIT} & \multicolumn{1}{ | c |}{WSJ} & \multicolumn{1}{ | c |}{WSJ} \\ \cline{2-4} & \textit{Rev} & \textit{Rev} & \textit{Rev+Noise} \\ \hline Single big DNN & 31.5 & 8.1 & 14.3 \\ \hline SE + clean SR & 31.1 & 8.5 & 15.7 \\ \hline SE + matched SR & 30.1 & 8.0 & 13.7 \\ \hline SE + SR joint training & \textbf{29.2} & \textbf{7.8} & \textbf{12.7} \\ \hline \end{tabular} \caption{Performance of the proposed joint training approach compared with other competitive DNN-based systems.} \label{tab:res1} \end{table} \label{sec:bn_exp} \begin{table}[t!] \centering \tabcolsep=0.108cm \begin{tabular}{ | l | c | c | c | c | c |} \cline{1-5} \multirow{2}{*}{\backslashbox{\em{Dataset}}{\em{System}}} & \multicolumn{2}{ | c |}{Without Pre-Training} & \multicolumn{2}{ | c |}{With Pre-Training} \\ \cline{2-5} & \textit{no-BN} & \textit{with-BN} & \textit{no-BN} & \textit{with-BN} \\ \hline TIMIT-Rev & 34.2 & 29.2 & 32.6 & 29.5 \\ \hline WSJ-Rev & 9.0 & 7.8 & 8.8 & 7.8 \\ \hline WSJ-Rev+Noise & 15.7 & 12.7 & 15.0 & 12.9 \\ \hline \end{tabular} \caption{Analysis of the role played by batch normalization within the proposed joint training framework.} \label{tab:test2} \end{table} In particular, the first line reports the results obtained with a single neural network. The size of the network has been optimized on the development set (4 hidden layers of 1024 neurons for TIMIT, 6 hidden layers of 2048 neurons for WSJ cases). The second line shows the performance obtained when the speech enhancement neural network (4 hidden layers of 2048 neurons for TIMIT, 6 hidden layers of 2048 neurons for WSJ) is trained independently and later coupled with the close-talking DNN of Sec.~\ref{sec:ct_baseline}. These results are particularly critical because, especially in adverse acoustic conditions, the speech enhancement model introduces significant distortions that a close-talking DNN trained in the usual ways is not able to cope with. To partially recover such a critical mismatch, one approach is to first train the speech enhancement, then pass all the training features though the speech enhancement DNN, and, lastly, train the speech recognition DNN with the dataset processed by the speech enhancement. The third line shows results obtained with such a matched training approach. The last line reports the performance achieved with the proposed joint training approach. Batch normalization is adopted for all the systems considered in Table \ref{tab:res1}. Although joint training exhibits in all the cases the best performance, it is clear that such a technique is particularly helpful especially when challenging acoustic conditions are met. For instance, a relative improvement of about $8\%$ over the most competitive matched training system is obtained for the WSJ task in noisy and reverberant conditions. \subsection{Role of batch normalization} In Table \ref{tab:test2}, the impact of batch normalization on the joint training framework is shown. The first two columns report, respectively, the results obtained with and without batch normalization when no pre-training techniques are employed. The impact of pre-training is studied in the last two columns. The pre-training strategy considered here consists of initializing the two DNNs with the matched training system discussed in Sec.~\ref{sec:jt_pers}, and performing a fine-tuning phase with a reduced learning rate. The column corresponding to the pre-training without batch normalization represents a system that most closely matches the approaches followed in \cite{joint1,joint3}. Table~\ref{tab:test2} clearly shows that batch normalization is particularly helpful. For instance, a relative improvement of about 23\% is achieved when batch normalization is adopted for the WSJ task in a noisy and reverberant scenario. The key importance of batch normalization is also highlighted in Fig.~\ref{fig:bn_frame}, where the evolution during training of the frame-level phone error rate (for the TIMIT-Rev dataset) is reported with and without batch normalization. From the figure it is clear that batch normalization, when applied to the considered deep joint architecture, ensures a faster convergence and a significantly better performance. Moreover, as shown in Table~\ref{tab:test2}, batch normalization eliminates the need of DNN pre-training, since similar (or even slightly worse results) are obtained when pre-training and batch normalization are used simultaneously. \begin{figure} \centering \includegraphics[width=0.52\textwidth]{batch_norm_fig.png} \caption{Evolution of the test frame error rate across various training epochs with and without batch normalization.} \label{fig:bn_frame} \end{figure} \subsection{Role of the gradient weighting} \label{sec:gw} In Fig. \ref{fig:grad_w}, the role of the gradient weighting factor $\lambda $ is highlighted. \begin{figure} \centering \includegraphics[width=0.49\textwidth]{lambda} \caption{Training and development frame error rates obtained on the TIMIT-Rev dataset for different values of $\lambda$.} \label{fig:grad_w} \end{figure} From the figure one can observe that small values of $\lambda$ lead to a situation close to underfitting, while higher values of $\lambda$ cause overfitting. The latter result is somewhat expected since, intuitively, with very large values of $\lambda$ the speech enhancement information tends to be neglected and training relies on the speech recognition gradient only. In the present work, we have seen that values of $\lambda$ ranging from 0.03 to 0.1 provide the best performance. Note that these values are smaller than that considered in \cite{joint1,joint2}, where a pure gradient summation ($\lambda=1$) was adopted. We argue that this result is due to the fact that, as observed in \cite{initbn}, the norm of the gradient decays very slowly when adopting batch normalization with a proper initialization of $\gamma$, even after the gradient has passed through many hidden layers. This causes the gradient backpropagated through the speech recognition network and into the speech enhancement network to be very large. \section{Conclusion} In this paper, a novel approach for joint training coupled with batch normalization is proposed. The experimental validation, conducted considering different tasks, datasets and acoustic conditions, showed that batch-normalized joint training is particularly effective in challenging acoustic environments, characterized by both noise and reverberation. In particular, batch normalization was of crucial importance for improving the system performance. A remarkable result is the relative improvement of about 23\% obtained for the WSJ task in a noisy and reverberant scenario when batch normalization is used within the joint training framework. This system can be seen as a first step towards a better and more fruitful integration of the various technologies involved in current distant speech recognition systems. Future efforts for improving the current solution will be devoted to progressively involve different NN architectures or to embed other technologies such as speech separation, speaker identification and acoustic scene analysis. \bibliographystyle{IEEEbib}
{'timestamp': '2017-03-27T02:08:37', 'yymm': '1703', 'arxiv_id': '1703.08471', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08471'}
arxiv
\section{Introduction} Language-aware program editors (like Eclipse or Emacs, with the appropriate extensions installed \cite{gamma2004contributing}) offer programmers a number of useful editor services. Simple examples include (1) syntax highlighting, (2) type inspection, (3) navigation to variable binding sites, and (4) refactoring services. More sophisticated editors provide context-aware code and action suggestions to the programmer (using various code completion, program synthesis and program repair techniques). Many editors also offer \emph{live programming}~\cite{McDirmid:2007:LUL:1297027.1297073,Burckhardt:2013:ACF:2491956.2462170} services, e.g. by displaying the run-time value of an expression directly within the editor as the program runs. When these editor services encounter \emph{complete programs} -- programs that are well-formed and semantically meaningful (i.e. assigned meaning) according to the definition of the language in use -- they can rely on a variety of well-understood reasoning principles and program manipulation techniques. For example, a syntax highlighter for well-formed programs can be generated automatically from a context-free grammar \cite{Brand:2001hl} and the remaining editor services enumerated above can follow the language's type and binding structure as specified by a standard static semantics. Live programming services can additionally follow the language's dynamic semantics. The problem, of course, is that many of the {edit states} encountered by a program editor do not correspond to complete programs. For example, the programmer may be in the midst of a transient edit, or the programmer may have introduced a type error somewhere in the program. Standard language definitions are silent about incomplete programs, so in these situations, simple program editors disable various editor services until the program is again in a complete state. In other words, useful editor services become unavailable when the programmer needs them most! More advanced editors attempt to continue to provide editor services during these incomplete states by using various \emph{ad hoc} and poorly understood heuristics that rely on idiosyncratic internal representations of incomplete programs. This paper advocates for a research program that seeks to understand both incomplete programs, and the editor services that interact with them, as semantically rich mathematical objects. This research program will broaden the scope of the ``programming language theory'' (PLT) tradition, which has made significant advances by treating complete programs, programming languages and logics as semantically rich mathematical objects. In following the PLT tradition, we intend to start by developing a series of minimal calculi that build upon well-understood typed lambda calculi to capture the essential character of incomplete programs and various editor services of interest. Editor designers will be able to apply the insights gained from studying these calculi (together with insights gained from the study of human factors and other topics) to design more sophisticated program editors. Some of these editors will evolve directly from editors already in use today. In parallel with these efforts, we plan to design a ``clean-slate'' programming environment, \Hazel, based directly on these first principles. This will allow researchers to explore the frontier of what is possible when one considers languages and editors within a common theoretical framework. Such a clean-slate design will also likely prove useful in certain educational settings, and even some day evolve into a practical tool. Figure \ref{fig:hazel-mockup} shows a mockup of the \Hazel~user interface, which is loosely modeled after the widely adopted IPython / Jupyter lab notebook interface~\cite{PER-GRA:2007}. This figure will serve as our running example throughout the remainder of the paper. Each section below briefly summarizes a fundamental problem that we must confront as we seek to develop a semantic foundation for advanced program editors. For each problem, we discuss existing approaches, including those advanced by our own recent research, and suggest a number of promising future research directions that we hope that the community will pursue. \section{Problem 1: Syntactically Malformed Edit States} Textual program editors frequently encounter edit states that are not well-formed with respect to the textual syntax of complete programs. For example, consider a programmer constructing a call to a function \lstinline{std}: \[ \texttt{std(m, } \] There is a syntax error, so editor services that require a syntactically complete program must be disabled. This is unsatisfying. Sophisticated editors like Eclipse, and editor generators like Spoofax \cite{DBLP:conf/oopsla/KatsV10}, use \emph{error recovery} heuristics that silently insert tokens so that the editor-internal representation is well-formed \cite{DBLP:journals/siamcomp/AhoP72,charles1991practical,graham1979practical,DBLP:conf/oopsla/KatsJNV09}. These heuristics are typically provided manually by the grammar designer, though certain heuristics can be generated semi-automatically by tools that are given a description of the scoping conventions of the language or of secondary notational conventions (e.g. whitespace) \cite{DBLP:conf/oopsla/KatsJNV09,DBLP:conf/sle/JongeNKV09}. Error recovery heuristics require guessing at the programmer's intent, so they are fundamentally \emph{ad hoc} and can confuse the programmer \cite{DBLP:conf/oopsla/KatsJNV09}. A more systematic alternative approach, and the approach that we plan to explore with \Hazel, is to build a \emph{structure editor} -- a program editor where every edit state maps onto a syntax tree, with \emph{holes} representing leaves of the tree that have not yet been constructed. This representation choice sidesteps the problem of syntactically malformed edit states. Notice that in Figure~\ref{fig:hazel-mockup}, the program fragment in cell \textbf{(a)} contains holes, appearing as squares. This design also permits non-textual \emph{projections} of expressions, e.g. the 2D projection of a matrix value in cell \textbf{(b)}. We will return to the topic of non-textual projections below. \begin{figure} \includegraphics[width=1.025\textwidth]{mockup-1} \vspace{-5px} \caption{A mockup of \Hazel.} \vspace{-6px} \label{fig:hazel-mockup} \vspace{-6px} \end{figure} Structure editors have a long history. For example, the Cornell Program Synthesizer was developed in the early 1980s \cite{teitelbaum_cornell_1981}. Although text-based syntax continues to predominate, there remains significant interest in structure editors today, particularly in practice. For example, Scratch is a structure editor that has achieved success as a tool for teaching children how to program \cite{Resnick:2009:SP:1592761.1592779}. \texttt{mbeddr} is an editor for a C-like language \cite{voelter_mbeddr:_2012}, built using the commercially supported MPS structure editor workbench \cite{voelter2011language}. TouchDevelop is an editor for an object-oriented language \cite{tillmann_touchdevelop:_2011}. Lamdu \cite{lamdu} and Unison \cite{unison} are open source structure editors for functional languages similar to Haskell. Most work on structure editors has focused on the user interfaces that they present. This is important work -- presenting a fluid user interface involving higher-level edit actions is a non-trivial problem, and some aspects of this problem remain open even after many years of research. There is reason to be optimistic, however, with recent studies suggesting that programmers experienced with a modern keyboard-driven structure editor (e.g. \texttt{mbeddr}) can be highly productive \cite{DBLP:conf/vl/Asenov014,DBLP:conf/sle/VolterSBK14}. Researchers have also explored various ``hybrid'' approaches, which incorporate holes into an otherwise textual program editor. These hybrid approaches are appealing in part because tools for interacting with text, like regular expressions and various differencing techniques used by version control systems, are already well-developed. For example, recent work on \emph{syntactic placeholders} envisions a textual program editor where edit actions cause textual placeholders (a.k.a. holes) of various sorts to appear, rather than leaving the program transiently malformed \cite{Amorim:2016:PSC:2997364.2997374}. This ``approximates'' the experience of a structure editor in common usage, while allowing the programmer to perform arbitrary text edits when necessary. Some programming systems, e.g. recent iterations of the Glasgow Haskell Compiler (GHC) \cite{GCHWIKI} and the Agda proof assistant \cite{norell2009dependently}, support a workflow where the programmer places holes manually at locations in the program that remain under construction. Another hybrid approach would be to perform error recovery by attempting to insert holes into the internal representation used by the program editor, without including them in the surface syntax exposed to programmers. If ``pure'' structure editing proves too rigid as we design \Hazel, we will explore hybrid approaches. \section{Problem 2: Statically Meaningless Edit States} \label{sec:p-statics} \begin{figure}[t] $\arraycolsep=4pt\begin{array}{lllllll} \mathsf{HTyp:} & \dot{\tau} & ::= & \tarr{\dot{\tau}}{\dot{\tau}} ~\vert~ \texttt{num} ~\vert~ \llparenthesiscolor\rrparenthesiscolor \\ \mathsf{HExp:} & \dot{e} & ::= & x ~\vert~ \hlam{x}{\dot{e}} ~\vert~ \hap{\dot{e}}{\dot{e}} ~\vert~ \hnum{n} ~\vert~ \hadd{\dot{e}}{\dot{e}} ~\vert~ (\dot{e} : \dot{\tau}) ~\vert~ \llparenthesiscolor\rrparenthesiscolor ~\vert~ \hhole{\dot{e}} \end{array}$ \caption{Syntax of H-types and H-expressions in the Hazelnut calculus \cite{popl-paper}.} \label{fig:hexp-syntax} \end{figure} No matter how an editor confronts syntactically malformed edit states, it must also confront edit states that are syntactically well-formed but statically meaningless. For example, the following value member definition (assuming an ML-like language) has a type inconsistency: \begin{lstlisting}[numbers=none] val x : float = std(m, ColumnWise) \end{lstlisting} because \li{std} has type \li{matrix(float) * dimension -> vec(float)}, but the type annotation on \li{x} is \li{float}, rather than \li{vec(float)}. This leaves the entire surrounding program formally meaningless according to a standard static semantics. In the presence of syntactic holes, the problem of reasoning statically about incomplete programs becomes even more interesting. Consider the incomplete expression \texttt{std(m,~$\square$)} from cell \textbf{(a)} in Figure \ref{fig:hazel-mockup}. Although it is intuitively apparent that the type of this expression, after hole instantiation, could only be \lstinline{vec(float)} (the return type of \lstinline{std}), and that the hole must be instantiated with values of type \li{dimension}, the static semantics of complete expressions is again silent about these matters. Various heuristic approaches are implemented in Eclipse and other sophisticated tools, but the formal character of these heuristics are obscure, buried deep within their implementations. What is needed is a clear static semantics for incomplete programs, i.e. programs that contain holes (in both expressions and types), type inconsistencies, binding inconsistencies (i.e. unbound variables), and other static problems. Such a static semantics is necessary for \Hazel~to be able to provide type inspection services. For example, in the right column of Figure \ref{fig:hazel-mockup}, \Hazel~is informing the programmer that the expression at the cursor, highlighted in blue in cell \textbf{(a)}, must be of type \li{dimension}). Similarly, \Hazel~must be able to assign the incomplete function \li{summary_stats} an incomplete function type for it to be able to understand subsequent applications of \li{summary_stats}. Here, the function body has been filled out enough to be able to assign the function the following incomplete function type: \[\texttt{matrix(float) -> \{ {mean} : vec(float), std : vec(float), median :~$\square$ \}}\] We have investigated a subset of this problem in recent work \cite{popl-paper} by defining a static semantics for a simply typed lambda calculus (with a single base type, $\texttt{num}$, for simplicity) extended with holes and type inconsistencies (but no binding inconsistencies). Figure~\ref{fig:hexp-syntax} defines the syntactic objects of this calculus -- \emph{H-types}, $\dot{\tau}$, are types with holes $\llparenthesiscolor\rrparenthesiscolor$, and \emph{H-expressions}, $\dot{e}$, are expressions with holes $\llparenthesiscolor\rrparenthesiscolor$, and marked type inconsistencies, $\hhole{\dot{e}}$. We call marked type inconsistencies \emph{non-empty holes}, because they mark portions of the syntax tree that remain incomplete and behave semantically much like empty holes. Types and expressions that contain no holes are \emph{complete types} and \emph{complete expressions}, respectively. We will not reproduce further details here. Instead, let us simply note some interesting connections with other work. First, type holes behave much like unknown types, $?$, from Siek and Taha's pioneering work on gradual typing \cite{Siek06a}. This discovery is quite encouraging, given that gradual typing is also motivated by a desire to make sense of one class of ``incomplete program'' -- programs that have not been fully annotated with types. Empty expression holes have also been studied formally, e.g. as the \emph{metavariables} of contextual modal type theory (CMTT) \cite{Nanevski2008}. In particular, expression holes can have types and are surrounded by contexts, just as metavariables in CMTT are associated with types and contexts. This begins to clarify the logical meaning of a typing derivation in Hazelnut -- it conveys well-typedness relative to an (implicit) modal context that extracts each expression hole's type and context. The modal context must be emptied -- i.e. the expression holes must be instantiated with expressions of the proper type in the proper context -- before the expression can be considered complete. This relates to the notion of modal necessity in contextual modal logic. For interactive proof assistants that support a tactic model based directly on hole filling, the connection to CMTT and similar systems is quite salient. For example, Beluga \cite{DBLP:conf/flops/Pientka10} is based on dependent CMTT and aspects of Idris' editor support \cite{brady2013idris} are based on a similar system -- McBride's OLEG \cite{mcbride2000dependently}. As we will discuss in Sec. \ref{sec:actions}, our notion of a program editor supports actions beyond hole filling. There are a number of future research directions that are worth exploring. \vspace{-10px} \subparagraph{Binding inconsistencies.} In the simple calculus developed so far, all variables must be bound before they are used, including those in holes. We plan extend Hazelnut to support reasoning when a variable is mentioned without having been bound (as is a common workflow). Dagenais and Hendren also studied how to reason statically about programs with binding errors using a constraint system, focusing on Java programs whose imports are not completely known~\cite{DBLP:conf/oopsla/DagenaisH08}. They neither considered programs with holes or other type inconsistencies, nor did they formally specify their technique. However, they provide a useful starting point. \vspace{-10px} \subparagraph{Expressiveness.} The simple calculus discussed above is only as expressive as the typed lambda calculus with numbers. We must scale up the semantics to handle other modern language features. Our plan is to focus initially on functional language constructs (so that \Hazel ~can be used to teach courses that are today taught using Standard ML, OCaml or Haskell). This will include recursive and polymorphic functions, recursive types, and labeled product (record) and sum types. We also propose to investigate ML-style structural pattern matching. All of these will require defining new sorts of holes and static inconsistencies, including: (1) non-empty holes at the type level, to handle kind inconsistencies; (2) holes in label position; and (3) holes and type inconsistencies in patterns. \vspace{-10px} \subparagraph{Automation.} Although we plan to explore some of these language extensions ``manually,'' extending our existing mechanized metatheory, we ultimately plan to \emph{automatically} generate a statics for incomplete terms from a standard statics for complete terms, annotated perhaps with additional information. There is some precedent for this in recent work on the Gradualizer, which is capable of producing a gradual type system from a standard type system with lightweight annotations that communicate the intended polarities of certain constructs~\cite{DBLP:conf/popl/CiminiS16}. However, although it provides a good starting point, gradual type systems only consider the problem of holes in types. Our plan is to build upon existing proof automation techniques, e.g. Agda's reflection \cite{van2012engineering} (in part because our present mechanization effort is in Agda). \section{Problem 3: Dynamically Meaningless Edit States} Modern programming tools are increasingly moving beyond simple ``batch'' programming models by incorporating \emph{live programming} features that interleave editing and evaluation \cite{DBLP:conf/icse/Tanimoto13,DBLP:journals/vlc/Tanimoto90,McDirmid:2007:LUL:1297027.1297073}. These tools provide programmers with rapid feedback about the dynamic behavior of the program they are editing, or selected portions thereof \cite{McDirmid:2013:ULP:2509578.2509585}. Examples include \emph{lab notebooks}, e.g. the popular IPython/Jupyter~\cite{PER-GRA:2007}, which allow the programmer to interactively edit and evaluate program fragments organized into a sequence of cells (an extension of the read-eval-print loop (REPL)); spreadsheets; {live graphics programming environments}, e.g. SuperGlue \cite{McDirmid:2007:LUL:1297027.1297073}, Sketch-n-Sketch \cite{DBLP:conf/pldi/ChughHSA16} and the tools demonstrated by Bret Victor in his lectures \cite{victor2012inventing}; the TouchDevelop live UI framework \cite{Burckhardt:2013:ACF:2491956.2462170}; and live visual and auditory dataflow languages \cite{DBLP:conf/vl/BurnettAW98}. In the words of Burckhardt et al. \cite{Burckhardt:2013:ACF:2491956.2462170}, live programming environments ``capture the imagination of today's programmers and promise to narrow the temporal and perceptive gap between program development and code execution''. Our proposed design for \Hazel~combines aspects of several of these designs to form a \emph{live lab notebook interface}. It will use the edit state of each cell to continuously update the output value displayed for that cell and subsequent cells that depend on it. Uniquely, rather than providing meaningful feedback about the dynamic behavior only once a cell becomes complete, \Hazel~will provide meaningful feedback also about the dynamic behavior of incomplete cells (and thereby further tighten Burckhardt's ``perceptive gap''). For example, in cell \textbf{(c)} of Figure~\ref{fig:hazel-mockup}, the programmer applies the incomplete function \li{summary_stats} to the matrix \lstinline{my_data}, and the editor is still able to display a result. The value of the column-wise mean is fully determined, because evaluation does not encounter any holes, whereas the standard deviation and median computations cannot be fully evaluated. Notice, however, that the standard deviation computation does communicate the substitution of the applied argument, \li{my_data}, for the variable \li{m}.\footnote{To avoid exposing the internals of imported library functions, evaluation does not step into functions, like \li{std}, that have been imported from external libraries indicated by the row at the top of Figure \ref{fig:hazel-mockup} (unless specifically requested, not shown).} To realize this functionality, we need a {dynamic semantics for incomplete programs} that builds upon our proposed static semantics. There is some precedent for this: research in gradual typing considers the dynamic semantics of programs with holes in types, and our proposed static semantics for incomplete programs borrows technical machinery from theoretical work on gradual typing~\cite{Siek06a}. However, we need a dynamic semantics for incomplete programs that also have expression holes (and in the future, other sorts of holes). Research on CMTT has not yet considered the problem of evaluating expressions under a non-empty metavariable context. Normally, this would violate the classical notion of Progress -- evaluation can neither proceed, nor has it produced a value. We conjecture that this is resolved by (1) positively characterizing \emph{indeterminate} evaluation states, those where a hole blocks progress at all locations within the expression, and (2) defining a notion of Indeterminate Progress that allows for evaluation to stop at an indeterminate evaluation state. By gradualizing CMTT and defining these notions, we believe we can achieve the basic functionality described above. There are several more applications that we aim to explore after developing these initial foundations. For example, it would be useful for the programmer to be able to select a hole that appears in an indeterminate state and be taken to its original location. There, they should be able to inspect the \emph{value} of a subexpression under the cursor in the environment of the selected hole (rather than just its type). Again, CMTT's closures provide a theoretical starting point for this debugger service. It would also be useful to be able to continue evaluation where it left off after making an edit to the program that corresponds to hole instantiation. This would require proving a commutativity property regarding hole instantiation. Fortunately, initial research on commutativity properties for holes has been conducted for CMTT, which will serve as a starting point for this work \cite{Nanevski2008}. There are likely to be interesting new theoretical questions (and, likely, some limitations) that arise if one adds non-termination and memory effects. Relatedly, IPython/Jupyter \cite{PER-GRA:2007} support a feature whereby numeric variable(s) in cells can be marked as being ``interactive'', which causes the user interface to display a slider. As the slider value changes, the value of the cell is recomputed. It would be useful to be able to use the mechanisms just proposed to incrementalize parts of this recomputation. \section{Problem 4: A Calculus of Edit Actions}\label{sec:actions} The previous sections considered the structure and meaning of intermediate edit states. However, to understand the act of \emph{editing} itself, we need \emph{a calculus of edit actions} that governs transitions between these edit states. In a structure editor, the ideal would be for every possible edit state to be both statically and dynamically meaningful according to the semantics proposed in the previous two sections. This corresponds formally to proving a metatheorem about the action semantics: when the initial edit state is semantically meaningful, the edit state that results from performing an action is as well. In a textual or hybrid setting, these structured edit actions would need to be supplemented by lower-level text edit actions that may not maintain this invariant. In addition to this crucial metatheorem, which we call \emph{sensibility}, there are a number of other metatheorems of interest that establish the expressive power of the action semantics, e.g. that every well-typed term can be constructed by some sequence of edit actions. In our recent work on Hazelnut, we have developed an action calculus for the minimal calculus of H-types and H-expressions described in Section~\ref{sec:p-statics} \cite{popl-paper}. We have mechanically proven the sensibility invariant, as well as expressivity metatheorems, using the Agda proof assistant. What remains is to investigate \emph{action composition principles}. For example, it would be worthwhile to investigate the notion of an \emph{action macro}, whereby functional programs could themselves be lifted to the level of actions to compute non-trivial compound actions. Such compound actions would give a uniform description of transformations ranging from the simple---like ``move the cursor to the next hole to the right''---to quite complex whole program refactorings, while r{}emaining subject to the core semantics. Using proof automation, it should be possible to prove that an action macro implements derived action logic that is admissible with respect to the core semantics. This would eliminate the possibility of ``edit-time'' errors. This is closely related to work on tactic languages in proof assistants, e.g. the Mtac typed macro language for Coq \cite{ziliani2015mtac}, differing again in that the action language involves notions other than hole filling. \section{Problem 5: Meaningful Suggestion Generation and Ranking} The simplest edit actions will be bound to keyboard shortcuts. However, \Hazel~will also provide suggestions to help the programmer edit incomplete programs by providing a \emph{suggestion palette}, marked \textbf{(d)} in Figure~\ref{fig:hazel-mockup}. This palette will suggest semantically relevant code snippets when the cursor is on an empty hole. It will also suggest other relevant edit actions, including high-level edit actions implemented by imported action macros (e.g. the refactoring action in Figure~\ref{fig:hazel-mockup}). When the cursor is on a non-empty hole, indicating a static error, it will suggest bug fixes. We plan to also consider bugs that do not correspond to static errors, including those identified explicitly by the programmer, and those related to assertion failures or exceptions encountered when using the live programming features of \Hazel. In these situations, we plan to build on existing automated fault localization techniques~\cite{Jones02, Qi13issta,Renieris03}. Note that features like these are not themselves novel. Many editors provide contextually relevant suggestions. Indeed, suggestion generation is closely related to several major research areas: code completion~\cite{Muslu12icse-nier,icse-naturalness12}, program synthesis~\cite{Gulwani2010}, and program repair~\cite{legoues12tse,angelix,prophet,Ke15ase}. The problems that such existing systems encounter is exactly the problem we have been discussing throughout this proposal: when attempting to integrate these features into an editor, it is difficult to reason about malformed or meaningless edit states. Many of these systems therefore fall back onto tokenized representations of programs \cite{icse-naturalness12}. Because \Hazel~ will maintain the invariant that every edit state is a syntactically and semantically meaningful formal structure, we can develop a more principled solution to the problem of generating meaningful suggestions. In particular, we will be able to \emph{prove} that every action suggestion generated for a particular edit state is meaningful for that edit state. In addition to investigating the problem of populating the suggestion palette with semantically valid actions, we will consider the problem of evaluating the statistical likelihood of the suggestions. This requires developing a statistical model over actions. We will prove that this statistical model is a proper probability distribution (e.g. that it ``integrates'' to 1), and that it assigns zero probability to semantically invalid actions. We will also develop techniques for estimating the parameters of these distributions from a corpus of code or a corpus of edit actions. Collectively, we refer to these contributions as a \emph{statistical action suggestion semantics}. Ultimately, we envision this work as being the foundation for an \emph{intelligent programmer's assistant} that is able to integrate semantic information gathered from the incomplete program with statistics gathered from other programs and interactions that the system has observed to do much of the ``tedious'' labor of programming, without hiding the generated code from the programmer (as is the case with fully automated program synthesis techniques). \section{Language-Editor Co-Design} In designing \Hazel, we are intentionally blurring the line between the programming language and the program editor. This opens up a number of interesting research directions in {language-editor co-design}. For example, it may be possible to recast ``tricky'' language mechanisms, like function overloading, type classes \cite{hall96:_typeclasses}, implicit values, and unqualified imports, as editor mechanisms. Because we will be treating programming as a structured conversation between the programmer and the programming environment, the editor can simply ask the programmer to resolve ambiguities when they arise. The programmer's choice is then stored unambiguously in the underlying syntax tree. Another important research direction lies in exploring how types can be used to control the presentation of expressions in the editor. In the textual setting, we have developed \emph{type-specific languages} (TSLs) \cite{TSLs}. It should be possible to define an analagous notion of \emph{type-specific projections} (TSPs) in the setting of a structure editor. For example, the matrix projection shown in Figure \ref{fig:hazel-mockup} need not be built in to \Hazel. Instead, the \li{Numerics} library provider will be able to introduce this logic. In particular, TSPs will define not only derived visual forms, but also derived edit actions (e.g. ``add new column'' for the example just given.) It should be possible to switch between multiple projections (including purely textual projections) while editing code and interacting with values. This line of research is also related to our work on \emph{active code completion}, which investigated type-specific code generation interfaces in a textual program editor (Eclipse) \cite{Omar:2012:ACC:2337223.2337324}. Another interesting direction is that of {semantic, interactive documentation}. In particular, in \Hazel, references to program structures that appear in documentation will be treated in the same way as other references and be subject to renaming and other operations. Documentation will also be capable of containing expressions of arbitrary types (e.g. of the \li{Image} or \li{Link} type). Together with the type-specific projection mechanism mentioned above, we hope that this will allow \Hazel~ to function not only as a structured programming environment, but also as a {structured document authoring environment}! By understanding hyperlinks as variable references (in, perhaps, a different modality \cite{vii2007type}), we may be able to blur the line between a module and a webpage. \section{Conclusion} To summarize, there are a number of interesting semantic questions that come up in the design of program editors. We advocate a research program that studies these problems using mathematical tools previously used to study programming languages and complete programs. This work will both demystify the design of program editors and open up the doors for a number of advanced editor services. Ultimately, we envision an intelligent programmer's assistant that combines a deep semantic understanding of incomplete programs with a broad statistical understanding of common idioms to help humans author both programs and documents (as one and the same sort of artifact.) \section*{Acknowledgments} We thank the SNAPL~2017 reviewers and our paper shepherd Nate Foster for the thoughtful comments and suggestions. This work is supported in part through a gift from Mozilla; by NSF under grant numbers CCF-1619282, 1553741 and 1439957; by AFRL and DARPA under agreement \#FA8750-16-2-0042; and by the NSA under lablet contract \#H98230-14-C-0140. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of Mozilla, NSF, AFRL, DARPA or NSA. \bibliographystyle{plainurl}
{'timestamp': '2017-03-28T02:04:08', 'yymm': '1703', 'arxiv_id': '1703.08694', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08694'}
arxiv
\section{Introduction} Catastrophic forgetting is a fundamental challenge for artificial general intelligence based on neural networks. The models that use stochastic gradient descent often forget the information of previous tasks after being trained on a new task \cite{mccloskey1989,french1999}. Online multi-task learning that handles such problems is described as \textit{continual learning}. This classic problem has resurfaced with the renaissance of deep learning research \cite{goodfellow2013,srivastava2013}. Recently, the concept of applying a regularization function to a network trained by the old task to learning a new task has received much attention. This approach can be interpreted as an approximation of sequential Bayesian \cite{Ghahramani2000,Broderick2013}. Representative examples of this regularization approach include learning without forgetting \cite{li2016} and elastic weight consolidation \cite{kirkpatrick2016}. These algorithms succeeded in some experiments where their own assumption of the regularization function fits the problem. Here, we propose incremental moment matching (IMM) to resolve the catastrophic forgetting problem. IMM uses the framework of Bayesian neural networks, which implies that uncertainty is introduced on the parameters in neural networks, and that the posterior distribution is calculated \cite{mackay1992,Blundell2015}. The dimension of the random variable in the posterior distribution is the number of the parameters in the neural networks. IMM approximates the mixture of Gaussian posterior with each component representing parameters for a single task to one Gaussian distribution for a combined task. To merge the posteriors, we introduce two novel methods of moment matching. One is \textit{mean-IMM}, which simply averages the parameters of two networks for old and new tasks as the minimization of \textcolor[rgb]{0.01,0,0}{the average of KL-divergence between one approximated posterior distribution for the combined task and each Gaussian posterior for the single task \cite{goldberger2005}.} The other is \textit{mode-IMM}, which merges the parameters of two networks using a Laplacian approximation \cite{mackay1992} to approximate a mode of the mixture of two Gaussian posteriors, which represent the parameters of the two networks. \begin{figure}[t] \centering \includegraphics[width=0.80\textwidth]{fig2_v4} \caption{Geometric illustration of incremental moment matching (IMM). Mean-IMM simply averages the parameter\textcolor[rgb]{0.01,0,0}{s} of two neural networks, whereas mode-IMM \textcolor[rgb]{0.01,0.005,0}{tries to find} a maximum of the mixture of Gaussian posteriors. \textcolor[rgb]{0.01,0,0}{To make IMM be} reasonable, the search space of the loss function between the posterior means $\mu_1$ and $\mu_2$ should be \textcolor[rgb]{0.01,0.005,0}{reasonably} smooth and convex-like. To find a $\mu_2$ which satisfies this condition of a smooth and convex-like path from $\mu_1$, we propose \textcolor[rgb]{0.01,0.005,0}{applying} various transfer techniques for the IMM procedure. } \label{fig:fig1} \end{figure} In general, it is too na{\"i}ve to assume that the final posterior distribution for the whole task is Gaussian. To make our IMM work, the search space of the loss function between the posterior means needs to be smooth and convex-like. In other words, there should not be high cost barriers between the means of the two networks for an old and a new task. To make our assumption of Gaussian distribution for neural network reasonable, we applied three main transfer learning techniques on the IMM procedure: weight transfer, L2-norm of the old and the new parameters, and our newly proposed variant of dropout using the old parameters. The whole procedure of IMM is illustrated in Figure \ref{fig:fig1}. \section{Previous Works on Catastrophic Forgetting} One of the major approaches preventing catastrophic forgetting is to use an ensemble of neural networks. When a new task arrives, the algorithm makes a new network, and shares the representation between the tasks \cite{lee2016,rusu2016}. However, this approach has a complexity issue, especially in inference, because the number of networks increases \textcolor[rgb]{0.01,0,0}{as} the number of new tasks that need to be learned \textcolor[rgb]{0.01,0,0}{increases.} Another approach studies \textcolor[rgb]{0.01,0,0}{the} methods using implicit distributed storage of information\textcolor[rgb]{0.01,0.005,0}{, in typical} stochastic gradient descent (SGD) learning. These methods use the idea of dropout, maxout, or neural module \textcolor[rgb]{0.01,0,0}{to} distributively \textcolor[rgb]{0.01,0,0}{store} the information for each task by making use of the large capacity of the neural network \cite{srivastava2013}. Unfortunately, most studies following this approach had limited success and failed to preserve performance on the old task when an extreme change to the environment occurred \cite{goodfellow2013}. Alternatively, Fernando et al. \cite{fernando2017} proposed PathNet, which extends the idea of the ensemble approach for parameter reuse \cite{rusu2016} within a single network. In PathNet, a neural network has ten or twenty modules in each layer, and three or four modules are picked for one task in each layer by an evolutionary approach. This method alleviates the complexity issue of the ensemble approach to continual learning in a plausible way. The approach with \textcolor[rgb]{0.01,0,0}{a} regularization term also \textcolor[rgb]{0.01,0,0}{has} \textcolor[rgb]{0.01,0,0}{received attention}. Learning without forgetting (LwF) is one example of this approach, which uses the pseudo-training data from the old task \cite{li2016}. Before learning the new task, LwF puts the training data of the new task into the old network, and uses the output as pseudo-labels of the pseudo-training data. By optimizing both the pseudo-training data of the old task and the real data of the new task, LwF attempts to prevent catastrophic forgetting. This framework is promising where the properties of the pseudo training set is similar to the ideal training set. Elastic weight consolidation (EWC), another example of this approach, uses sequential Bayesian estimation to update neural networks for continual learning \cite{kirkpatrick2016}. In EWC, the posterior distribution trained by the previous task is used to update the new prior distribution. This new prior is used for learning the new posterior distribution of the new task in a Bayesian manner. EWC assumes that the covariance matrix of the posterior is diagonal and there are no correlations between the nodes. Though this assumption is \textcolor[rgb]{0.01,0,0}{fragile}, EWC performs well in some domains. \textcolor[rgb]{0,0.0065,0}{EWC is a monumental recent work that uses sequential Bayesian for continual learning of neural networks. However, updating the parameter of complex hierarchical models by sequential Bayesian estimation is not new \cite{Ghahramani2000}. Sequential Bayes was used to learn topic models from stream data} \textcolor[rgb]{0.01,0,0}{by} \textcolor[rgb]{0,0.0065,0}{Broderick et al. \cite{Broderick2013}.} \textcolor[rgb]{0.01,0,0}{Huang et al. applied sequential Bayesian to adapt a deep neural network to the specific user in the speech recognition domain \cite{huang2014,huang2015}. They assigned the layer for the user adaptation and applied MAP estimation to this single layer.} \textcolor[rgb]{0,0.0065,0}{Similar to our IMM method, Bayesian moment matching is used for sum-product networks, a kind of deep hierarchical probabilistic model \cite{rashwan2016}. Though sum-product networks are usually not scalable to large datasets, their online learning method is useful, and it achieves similar performance to the batch learner. Our method using moment matching focuses on continual learning and deals with significantly different statistics between tasks, unlike the previous method.} \section{Incremental Moment Matching} In incremental moment matching (IMM), the moments of posterior distributions are matched in an incremental way. In our work, we use a Gaussian distribution to approximate the posterior distribution of parameters. Given $K$ sequential tasks, we want to find the optimal parameter $\mu^*_{1:K}$ and $\Sigma^*_{1:K}$ of the Gaussian approximation function $q_{1:K}$ from the posterior parameter for each $k$th task, $(\mu_k,\Sigma_k)$. \begin{gather} p_{1:K} \equiv p(\theta|X_1,\cdots,X_K,y_1,\cdots,y_K) \approx q_{1:K} \equiv q(\theta|\mu_{1:K},\Sigma_{1:K}) \label{eq:eq1}\\ p_k \equiv p(\theta|X_k,y_k) \approx q_k \equiv q(\theta|\mu_k,\Sigma_k) \label{eq:eq2} \end{gather} \textcolor[rgb]{0.01,0.005,0}{$q_{1:K}$} denotes an approximation of the true posterior distribution $p_{1:K}$ for the whole task, and $q_k$ denotes an approximation of the true posterior distribution $p_k$ over the training dataset $(X_k,y_k)$ for the $k$th task. $\theta$ denotes the vectorized parameter of the neural network. The dimension of $\mu_k$ and $\mu_{1:k}$ is $D$, and the dimension of $\Sigma_k$ and $\Sigma_{1:k}$ is $D \times D$, respectively, where $D$ is the dimension of $\theta$. For \textcolor[rgb]{0.01,0,0}{example, a} multi-layer perceptrons (MLP) with \textcolor[rgb]{0.01,0,0}{[784-800-800-800-10] has} the number of nodes, $D$ = 1917610 \textcolor[rgb]{0.01,0,0}{including bias terms.} Next, we explain two proposed moment matching algorithms for the continual learning of \textcolor[rgb]{0.01,0.005,0}{modern} deep neural networks. \textcolor[rgb]{0.01,0,0}{The two algorithms generate two different moments of Gaussian with different objective functions} for the same dataset. \subsection{Mean-based Incremental Moment Matching (mean-IMM)} \textbf{Mean-IMM} averages the parameters of two networks in each layer, using mixing ratios $\alpha_k$ with $\sum^K_k \alpha_k = 1$. The objective function of mean-IMM is to minimize \textcolor[rgb]{0.01,0,0}{the following \textit{local KL-distance} or the weighted sum of KL-divergence between each $q_k$ and $q_{1:K}$ \cite{goldberger2005,zhang10}:} \begin{gather} \mu^*_{1:K}, \Sigma^*_{1:K} = \argminA_{\mu_{1:K},\Sigma_{1:K}} \textcolor[rgb]{0.01,0,0}{\mbox{$\sum^K_k$} \alpha_k KL ( q_k || q_{1:K} )} \label{eq:eq4}\\ \mu^*_{1:K} = \mbox{$\sum^K_k$} \alpha_k \mu_k \label{eq:eq5}\\ \Sigma^*_{1:K} = \mbox{$\sum^K_k$} \alpha_k ( \Sigma_k + (\mu_k-\mu^*_{1:K})(\mu_k-\mu^*_{1:K})^T) \end{gather} \textcolor[rgb]{0.01,0,0}{$\mu^*_{1:K}$ and $\Sigma^*_{1:K}$ are the optimal solution of the local KL-distance.} Notice that covariance information is not needed for mean-IMM, since calculating $\mu^*_{1:K}$ does not require any $\Sigma_k$. A series of $\mu_k$ is sufficient to perform the task. The idea of mean-IMM is commonly used in shallow networks \cite{Pathak10,Baldi13}. However, the contribution of this paper is to discover \textcolor[rgb]{0.01,0,0}{when} and how mean-IMM can be applied in modern deep neural networks and to show it can performs better with other transfer techniques. \textcolor[rgb]{0.01,0,0}{Future works may include other measures to merge the networks, including the KL-divergence between $q_{1:K}$ and the mixture of each $q_k$ (i.e. $KL ( q_{1:K}||\mbox{$\sum^K_k$} \alpha_k q_k )$) \cite{zhang10}.} \subsection{Mode-based Incremental Moment Matching (mode-IMM)} \textbf{Mode-IMM} is a variant of mean-IMM which uses the covariance information of the posterior of Gaussian distribution. \textcolor[rgb]{0.01,0,0}{In general,} a weighted average of two mean vectors of Gaussian distributions is not a mode of MoG. In discriminative learning, the maximum of the distribution is of primary interest. According to Ray and Lindsay \cite{ray2005}, all the modes of MoG with $K$ clusters lie on $(K-1)$-dimensional hypersurface $\{ \theta | \theta = (\sum^K_k a_k \Sigma^{-1}_k )^{-1} (\sum^K_k a_k \Sigma^{-1}_k \mu_k), 0 < a_k < 1$ and $\sum_k a_k = 1 \}$. See Appendix A for more detail\textcolor[rgb]{0.01,0,0}{s}. Motivated by the above description, a mode-IMM approximate MoG with Laplacian approximation, in which the logarithm of the function is expressed by \textcolor[rgb]{0.01,0,0}{the} \textcolor[rgb]{0.01,0.005,0}{Taylor expansion} \cite{mackay1992}. Using \textcolor[rgb]{0.01,0.005,0}{Laplacian approximation}, the MoG is approximated as follows: \begin{gather} \log q_{1:K} \approx \mbox{$\sum^K_k$} \alpha_k \log q_k + C = -\frac{1}{2} \theta^T (\mbox{$\sum^K_k$} \alpha_k \Sigma^{-1}_k ) \theta + (\mbox{$\sum^K_k$} \alpha_k \Sigma^{-1}_k \mu_k) \theta + C' \end{gather} \begin{gather} \mu^*_{1:K} = \Sigma^{*}_{1:K} \cdot (\mbox{$\sum^K_k$} \alpha_k \Sigma^{-1}_k \mu_k) \label{eq:eq9}\\ \Sigma^{*}_{1:K} = (\mbox{$\sum^K_k$} \alpha_k \Sigma^{-1}_k)^{-1} \label{eq:eq10} \end{gather} \textcolor[rgb]{0.01,0,0}{For Equation \ref{eq:eq10}, we add $\epsilon I$ to the term to be inverted in practice, with an identity matrix $I$ and a small constant $\epsilon$.} Here, we assume diagonal covariance matrices, which means that there is no correlation among parameters. This diagonal assumption is useful, since it decreases the number of parameters for each covariance matrix from $O(D^2)$ to $O(D)$ for the dimension of the parameters $D$. For covariance, we use the inverse of a Fisher information matrix, following \cite{kirkpatrick2016,pascanu2013}. The main idea of this approximation is that the square of gradients for parameters is a good indicator of their precision, which is the inverse of the variance. The Fisher information matrix for the $k$th task, $F_k$ is defined as: \begin{equation} \begin{aligned} F_k = E \left[\frac{\partial}{\partial \mu_k} \ln p(\tilde{y}|x,\mu_k) \cdot \frac{\partial}{\partial \mu_k} \ln p(\tilde{y}|x,\mu_k)^T \right], \end{aligned} \end{equation} where the probability of the expectation follows $x \sim \pi_k$ and $\tilde{y} \sim p(y|x,\mu_k)$, where $\pi_k$ denotes an empirical distribution of $X_k$. \section{Transfer Techniques for Incremental Moment Matching} \label{sec:transfer_techniques} In general, the loss function of neural networks is not convex. \textcolor[rgb]{0.01,0,0}{Consider that shuffling nodes and their weights in a neural network preserves the original performance.} If the parameters of two neural networks initialized independently are averaged, it might perform poorly \textcolor[rgb]{0.01,0,0}{because of the} high cost barriers between the \textcolor[rgb]{0.01,0,0}{parameters of the two neural networks} \cite{goodfellow2014}. However, we will show that various transfer learning techniques can be used to ease this problem, and make the assumption of Gaussian distribution for neural networks reasonable. In this section, we introduce three practical techniques for IMM, including weight-transfer, L2-transfer, and drop-transfer. \subsection{Weight-Transfer} \textbf{Weight-transfer} initialize the parameters for the new task $\mu_k$ with the parameters of the previous task $\mu_{k-1}$ \cite{yosinski2014}. In our experiments, the use of weight-transfer was critical to the continual learning performance. For this reason, the experiments on IMM in this paper use the weight-transfer technique \textcolor[rgb]{0.01,0,0}{by} default. The weight-transfer technique is motivated by the geometrical property of neural networks discovered in the previous work \cite{goodfellow2014}. They found that there is a straight path from the initial point to the solution without any high cost barrier, in various types of neural networks and datasets. This discovery suggests that the weight-transfer from the previous task to the new task makes a smooth loss surface between two solutions for the tasks, so that the optimal solution for both tasks lies on the interpolated point of the two solutions. To empirically validate the concept of weight-transfer, we use the linear path analysis proposed by Goodfellow et al. \cite{goodfellow2014} (Figure \ref{fig:fig2}). We randomly chose 18,000 instances from the training dataset of CIFAR-10, and divided them into three subsets of 6,000 instances each. These three subsets are used for sequential training by CNN models, parameterized by $\theta_1$, $\theta_2$, and $\theta_3$, respectively. Here, $\theta_2$ is initialized from $\theta_1$, and then $\theta_3$ is initialized from $\theta_2$, in the same way as weight-transfer. In \textcolor[rgb]{0.01,0,0}{this} analysis, each loss and accuracy is evaluated at a series of points $\theta = \theta_1 + \alpha(\theta_2-\theta_1)+\beta(\theta_3-\theta_2)$, varying $\alpha$ and $\beta$. In Figure \ref{fig:fig2}, the loss surface of the model on each online subset is nearly convex. The figure shows that the parameter at $\frac{1}{3}(\theta_1 + \theta_2 + \theta_3)$, which is the same as the solution of mean-IMM, performs better than any other reference points $\theta_1$, $\theta_2$, or $\theta_3$. However, when $\theta_2$ is not initialized by $\theta_1$, \textcolor[rgb]{0.01,0.005,0}{the convex-like shape disappears,} since there is a high cost barrier between the loss function of $\theta_1$ and $\theta_2$. \begin{figure}[t] \includegraphics[width=\textwidth]{vernu127-2401} \vskip -0.00in \caption{Experimental results on visualizing the effect of weight-transfer. The geometric property of the parameter space of the neural network is analyzed. Brighter is better. $\theta_1$, $\theta_2$, and $\theta_3$ are the \textcolor[rgb]{0.01,0,0}{vectorized parameters} of trained networks from randomly selected subsets of the CIFAR-10 dataset. This figure shows that there are better solutions between the three locally optimized parameters.} \label{fig:fig2} \end{figure} \subsection{L2-transfer} \textbf{L2-transfer} is a variant of L2-regularization. L2-transfer can be interpreted as a special case of EWC where the prior distribution is Gaussian with $\lambda I$ as a covariance matrix. In L2-transfer, a regularization term of the distance between $\mu_{k-1}$ and $\mu_k$ is added to the following objective function for finding $\mu_k$, where $\lambda$ is a hyperparameter: \begin{equation} \log p(y_k|X_k,\mu_k) - \lambda \cdot ||\mu_k - \mu_{k-1}||^2_2 \label{eq:eq16} \end{equation} The concept of L2-transfer is commonly used in transfer learning \cite{evgeniou2004,kienzle2006} and continual learning \cite{li2016,kirkpatrick2016} with large $\lambda$. Unlike the previous usage of large $\lambda$, we use small $\lambda$ for the IMM procedure. In other words, $\mu_k$ is first trained by Equation \ref{eq:eq16} with small $\lambda$, and then merged to $\mu_{1:k}$ in our IMM. Since we want to make the loss surface between $\mu_{k-1}$ and $\mu_k$ smooth, and not to minimize the distance between $\mu_{k-1}$ and $\mu_k$. In convex optimization, the L2-regularizer makes the convex function \textcolor[rgb]{0.01,0.005,0}{strictly convex}. Similarly, we \textcolor[rgb]{0.01,0.005,0}{hope} L2-transfer with small $\lambda$ \textcolor[rgb]{0.01,0,0}{help to} find a $\mu_k$ with a convex-like loss space between $\mu_{k-1}$ and $\mu_k$. \subsection{Drop-transfer} \textbf{Drop-transfer} is a novel method devised in this paper. \textcolor[rgb]{0.01,0.005,0}{Drop-transfer is a variant of dropout} where $\mu_{k-1}$ is the zero point of the dropout procedure. In the training phase, the following $\hat{\mu}_{k,i}$ is used for the weight vector corresponding to the $i$th node $\mu_{k,i}$: \begin{equation} \label{eq:eq17} \hat{\mu}_{k,i}= \begin{cases} \mu_{k-1,i}, & \mbox{if } i \mbox{th node is turned off} \\ \frac{1}{1-p} \cdot \mu_{k,i} - \frac{p}{1-p} \cdot \mu_{k-1,i}, & \mbox{otherwise} \end{cases} \end{equation} where $p$ is the dropout ratio. Notice that the expectation of $\hat{\mu}_{k,i}$ is $\mu_{k,i}$. \begin{table}[t] \centering \scriptsize \caption{The averaged accuracies on the disjoint MNIST for two sequential tasks (Top) and the shuffled MNIST for three sequential tasks (Bottom). The untuned setting refers to \textcolor[rgb]{0.01,0.005,0}{the most natural} hyperparameter in the equation of each algorithm, whereas the tuned setting refers to using heuristic hand-tuned hyperparameters. Hyperparam denotes the main hyperparameter of each algorithm. For IMM with transfer, only $\alpha$ is tuned. The numbers in the parentheses refer to standard deviation. Every IMM uses weight-transfer.} \begin{tabular}{ l c c c c c} \hline & Explanation of & \multicolumn{2}{c}{Untuned} & \multicolumn{2}{c}{Tuned} \\ \textbf{Disjoint MNIST Experiment} & Hyperparam & Hyperparam & Accuracy & Hyperparam & Accuracy \\ \hline SGD \cite{goodfellow2013} & epoch per dataset & 10 & 47.72 ($\pm$ 0.11) & 0.05 & 71.32 ($\pm$ 1.54) \\ L2-transfer \cite{evgeniou2004} & $\lambda$ in \eqref{eq:eq16} & - & - & 0.05 & 85.81 ($\pm$ 0.52) \\ \textbf{Drop-transfer} & $p$ in \eqref{eq:eq17} & 0.5 & 51.72 ($\pm$ 0.79) & 0.5 & 51.72 ($\pm$ 0.79) \\ EWC \cite{kirkpatrick2016} & $\lambda$ in \eqref{eq:eq15} & 1.0 & 47.84 ($\pm$ 0.04) & 600M & 52.72 ($\pm$ 1.36) \\ \hline \textbf{Mean-IMM} & $\alpha_2$ in \eqref{eq:eq5} & 0.50 & 90.45 ($\pm$ 2.24) & 0.55 & 91.92 ($\pm$ 0.98) \\ \textbf{Mode-IMM} & $\alpha_2$ in \eqref{eq:eq9} & 0.50 & 91.49 ($\pm$ 0.98) & 0.45 & 92.02 ($\pm$ 0.73) \\ \hline \textbf{L2-transfer + Mean-IMM} & $\lambda$ / $\alpha_2$ & 0.001 / 0.50 & 78.34 ($\pm$ 1.82) & 0.001 / 0.60 & 92.62 ($\pm$ 0.95) \\ \textbf{L2-transfer + Mode-IMM} & $\lambda$ / $\alpha_2$ & 0.001 / 0.50 & 92.52 ($\pm$ 0.41) & 0.001 / 0.45 & 92.73 ($\pm$ 0.35) \\ \hline \textbf{Drop-transfer + Mean-IMM} & $p$ / $\alpha_2$ & 0.5 / 0.50 & 80.75 ($\pm$ 1.28) & 0.5 / 0.60 & 92.64 ($\pm$ 0.60) \\ \textbf{Drop-transfer + Mode-IMM} & $p$ / $\alpha_2$ & 0.5 / 0.50 & 93.35 ($\pm$ 0.49) & 0.5 / 0.50 & 93.35 ($\pm$ 0.49) \\ \hline \textbf{L2, Drop-transfer + Mean-IMM} & $\lambda$ / $p$ / $\alpha_2$ & 0.001 / 0.5 / 0.50 & 66.10 ($\pm$ 3.19) & 0.001 / 0.5 / 0.75 & \textbf{93.97} ($\pm$ 0.23) \\ \textbf{L2, Drop-transfer + Mode-IMM} & $\lambda$ / $p$ / $\alpha_2$ & 0.001 / 0.5 / 0.50 & \textbf{93.97} ($\pm$ 0.32) & 0.001 / 0.5 / 0.45 & \textbf{94.12} ($\pm$ 0.27) \\ \hline \\ \textbf{Shuffled MNIST Experiment} & & Hyperparam & Accuracy & Hyperparam & Accuracy \\ \hline SGD \cite{goodfellow2013} & epoch per dataset & 60 & 89.15 ($\pm$ 2.34) & - & $\sim$95.5 \cite{kirkpatrick2016} \\ L2-transfer \cite{evgeniou2004} & $\lambda$ in \eqref{eq:eq16} & - & - & 1e-3 & 96.37 ($\pm$ 0.62) \\ \textbf{Drop-transfer} & $p$ in \eqref{eq:eq17} & 0.5 & 94.75 ($\pm$ 0.62) & 0.2 & 96.86 ($\pm$ 0.21) \\ EWC \cite{kirkpatrick2016} & $\lambda$ in \eqref{eq:eq15} & - & - & - & \textbf{$\sim$98.2} \cite{kirkpatrick2016} \\ \hline \textbf{Mean-IMM} & $\alpha_3$ in \eqref{eq:eq5} & 0.33 & 93.23 ($\pm$ 1.37) & 0.55 & 95.02 ($\pm$ 0.42) \\ \textbf{Mode-IMM} & $\alpha_3$ in \eqref{eq:eq9} & 0.33 & 98.02 ($\pm$ 0.05) & 0.60 & 98.08 ($\pm$ 0.08) \\ \hline \textbf{L2-transfer + Mean-IMM} & $\lambda$ / $\alpha_3$ & 1e-4 / 0.33 & 90.38 ($\pm$ 1.74) & 1e-4 / 0.65 & 95.93 ($\pm$ 0.31) \\ \textbf{L2-transfer + Mode-IMM} & $\lambda$ / $\alpha_3$ & 1e-4 / 0.33 & \textbf{98.16 ($\pm$ 0.08)} & 1e-4 / 0.60 & \textbf{98.30 ($\pm$ 0.08)} \\ \hline \textbf{Drop-transfer + Mean-IMM} & $p$ / $\alpha_3$ & 0.5 / 0.33 & 90.79 ($\pm$ 1.30) & 0.5 / 0.65 & 96.49 ($\pm$ 0.44) \\ \textbf{Drop-transfer + Mode-IMM} & $p$ / $\alpha_3$ & 0.5 / 0.33 & 97.80 ($\pm$ 0.07) & 0.5 / 0.55 & 97.95 ($\pm$ 0.08) \\ \hline \textbf{L2, Drop-transfer + Mean-IMM} & $\lambda$ / $p$ / $\alpha_3$ & 1e-4 / 0.5 / 0.33 & 89.51 ($\pm$ 2.85) & 1e-4 / 0.5 / 0.90 & 97.36 ($\pm$ 0.19) \\ \textbf{L2, Drop-transfer + Mode-IMM} & $\lambda$ / $p$ / $\alpha_3$ & 1e-4 / 0.5 / 0.33 & 97.83 ($\pm$ 0.10) & 1e-4 / 0.5 / 0.50 & 97.92 ($\pm$ 0.05) \\ \hline \end{tabular} \label{table:table1} \end{table} There are studies \cite{srivastava2014, Baldi13} that have interpreted dropout as an exponential ensemble of weak learners. By this perspective, \textcolor[rgb]{0.01,0,0}{since} the marginalization of output distribution over the whole weak learner is intractable, the parameters multiplied by the inverse of the dropout rate are used for the test phase in the procedure. In other words, the parameters of the weak learners are, in effect, simply averaged oversampled learners by dropout. At the process of drop-transfer in our continual learning setting, we hypothesize that the dropout process makes the averaged point of two arbitrary sampled points using Equation~\ref{eq:eq17} a good estimator. We investigated the search space of the loss function of the MLP trained from the MNIST handwritten digit recognition dataset for with and without dropout regularization, to supplement the evidence of the described hypothesis. Dropout regularization makes the accuracy of a sampled point from dropout distribution and an average point of \textcolor[rgb]{0.01,0,0}{two sampled parameters}, from 0.450 ($\pm$ 0.084) to 0.950 ($\pm$ 0.009) and 0.757 ($\pm$ 0.065) to 0.974 ($\pm$ 0.003), respectively. For the case of both with and without dropout, the space between two arbitrary samples is empirically convex, and fits \textcolor[rgb]{0.01,0,0}{to} the second-order equation. Based on this experiment, we expect not only that the search space of the loss function between \textcolor[rgb]{0.01,0.005,0}{modern} neural networks \textcolor[rgb]{0.01,0,0}{can be easily} nearly convex \cite{goodfellow2014}, but also that regularizers, such as dropout, make the search space smooth and the point in the search space \textcolor[rgb]{0.01,0,0}{have} a good accuracy in continual learning. \section{Experimental Results} We evaluate our approach on four experiments, \textcolor[rgb]{0.01,0,0}{whose} settings are intensively used in the previous works \cite{srivastava2013,kirkpatrick2016,li2016,lee2016}. For more details and experimental results, see Appendix D. The source code for the experiments is available in Github repository\footnote{https://github.com/btjhjeon/IMM\_tensorflow}. \textbf{Disjoint MNIST Experiment. } The first experiment is the disjoint MNIST experiment \cite{srivastava2013}. In this experiment, the MNIST dataset is divided into two datasets: the first dataset consists of only digits \{0, 1, 2, 3, 4\} and the second dataset consists of the remaining digits \{5, 6, 7, 8, 9\}. Our task is 10-class joint categorization, unlike \textcolor[rgb]{0.01,0,0}{the setting} in the previous work, \textcolor[rgb]{0.01,0.005,0}{which considers two independent tasks of 5-class categorization.} Because the inference should \textcolor[rgb]{0.01,0,0}{decide} whether a new instance comes from the first or the second task, our task is more difficult than the task \textcolor[rgb]{0.01,0,0}{of} the previous work. We evaluate the models both on the untuned setting and the tuned setting. The untuned setting refers to \textcolor[rgb]{0.01,0.005,0}{the most natural} hyperparameter in the equation of each algorithm. The tuned setting refers to using heuristic hand-tuned hyperparameters. Consider that tuned \textcolor[rgb]{0.01,0,0}{hyperparameter setting} is often used in previous works of continual learning as it is difficult to define a validation set in their setting. For example, when the model needs to learn from the new task after learning from the old task, a low learning rate or early stopping without a validation set, or arbitrary hyperparameter for balancing is used \cite{goodfellow2013,kirkpatrick2016}. We discover hyperparameters in the tuned setting not only \textcolor[rgb]{0.01,0,0}{to find} the oracle performance of each algorithm, but also \textcolor[rgb]{0.01,0,0}{to show} that there \textcolor[rgb]{0.01,0.005,0}{exist} some paths consisting of the point that performs reasonably for both tasks. Hyperparam in Table \ref{table:table1} denotes hyperparameter mainly searched in the tuned setting. Table \ref{table:table1} (Top) and Figure \ref{fig:fig3} (Left) shows the experimental results from the disjoint MNIST experiment. \textcolor[rgb]{0,0.0065,0}{In our experimental setting, the usual SGD-based optimizers always perform less than 50\%, because the biases of the output layer for the old task are always pushed to large negative values, which implies that our task is} \textcolor[rgb]{0.01,0,0}{difficult.} \textcolor[rgb]{0,0.0065,0}{Figure \ref{fig:fig4} also shows that mode-IMM is robust with $\alpha$ and the optimal $\alpha$ of mean-IMM is larger than $1/2$ in the disjoint MNIST experiment.} \begin{figure}[t] \centering \begin{adjustwidth}{-0.1cm}{-0.1cm} \includegraphics[width=0.333\textwidth,trim={0.4cm 0 0.4cm 0},clip]{vernu2405_02_01_01} \includegraphics[width=0.333\textwidth,trim={0.4cm 0 0.4cm 0},clip]{vernu2403_01_170518_01} \includegraphics[width=0.333\textwidth,trim={0.4cm 0 0.4cm 0},clip]{vernu2406_08_170518_01b} \end{adjustwidth} \caption{Test accuracies of two IMM models with weight-transfer on the disjoint MNIST (Left), the shuffled MNIST (Middle), and the ImageNet2CUB experiment (Right). $\alpha$ is a hyperparameter that balances the information between the old and the new task.} \label{fig:fig3} \end{figure} \begin{figure}[t] \centering \includegraphics[width=0.40\textwidth]{vernu2405_03_01} \includegraphics[width=0.40\textwidth]{vernu2405_03_02} \caption{\textcolor[rgb]{0,0.0065,0}{Test accuracies of IMM with various transfer techniques on the disjoint MNIST. Both L2-transfer and drop-transfer boost the performance of IMM and make the optimal value of $\alpha$ larger than 1/2. However, drop-transfer tends to make the accuracy curve more smooth than L2-transfer does.}} \label{fig:fig4} \end{figure} \textbf{Shuffled MNIST Experiment. } The second experiment is the shuffled MNIST experiment \cite{goodfellow2013,kirkpatrick2016} of three sequential tasks. In this experiment, the first dataset is the same as the original MNIST dataset. However, in the second dataset, the input pixels of all images are shuffled with a fixed, random permutation. In previous work, EWC reaches the performance \textcolor[rgb]{0.01,0.005,0}{level} of the batch learner, and it is argued that EWC overcomes catastrophic forgetting in some domains. The experimental details are similar to the disjoint MNIST experiment, except all models are allowed to use dropout regularization. In the experiment, the first dataset is the same as the original MNIST dataset. However, in the second and the third dataset, the input pixels of all images are shuffled with a fixed, random permutation\textcolor[rgb]{0.01,0,0}{, respectively.} Therefore, the difficulty of the three datasets is the same, though a different solution is required for each dataset. Table \ref{table:table1} (Bottom) and Figure \ref{fig:fig3} (Middle) shows the experimental results from the shuffled MNIST experiment. Notice that accuracy of drop-transfer ($p$ = 0.2) alone is 96.86 ($\pm$ 0.21) and L2-transfer ($\lambda$ = 1e-4) + drop-transfer ($p$ = 0.4) alone is 97.61 ($\pm$ 0.15). These results are competitive to EWC without dropout, whose performance is around 97.0. \textbf{ImageNet to CUB Dataset. } The third experiment is the ImageNet2CUB experiment \cite{li2016}, the continual learning problem from the ImageNet dataset to the Caltech-UCSD Birds-200-2011 fine-grained classification (CUB) dataset \cite{wah2011}. The number\textcolor[rgb]{0.01,0,0}{s} of classes of ImageNet and CUB dataset \textcolor[rgb]{0.01,0,0}{are} around 1K and 200, and the number\textcolor[rgb]{0.01,0,0}{s} of training instances \textcolor[rgb]{0.01,0,0}{are} 1M and 5K, respectively. In the ImageNet2CUB experiment, the last-layer is separated for the ImageNet and the CUB task. The structure of AlexNet is used for the trained model of ImageNet \cite{krizhevsky2012}. \textcolor[rgb]{0.01,0.005,0}{In our experiment, we match the moments of the last-layer fine-tuning model and the LwF model,} with mean-IMM and mode-IMM. Figure \ref{fig:fig3} (Right) shows that mean-IMM moderately balances the performance of two tasks between two networks. However, the balance\textcolor[rgb]{0.01,0,0}{d} \textcolor[rgb]{0.01,0,0}{hyperparameter} of mode-IMM is far from $\alpha$ = 0.5. \textcolor[rgb]{0.01,0,0}{We think that} \textcolor[rgb]{0.01,0.005,0}{it is because} the scale of the Fisher matrix $F$ is different between the ImageNet and the CUB task. \textcolor[rgb]{0.01,0,0}{Since} the number of training data of the two tasks is different, the mean of the square of the gradient, which is the definition of $F$, \textcolor[rgb]{0.01,0,0}{tends to be} different. This implies that the assumption of mode-IMM does not always hold for \textcolor[rgb]{0.01,0.005,0}{heterogeneous tasks.} See Appendix D.3 for more information including \textcolor[rgb]{0.01,0,0}{the} learning methods of IMM \textcolor[rgb]{0.01,0,0}{where} a different class output layer \textcolor[rgb]{0.01,0,0}{or} a different scale of \textcolor[rgb]{0.01,0,0}{the dataset is used}. Our results of IMM with LwF exceed the previous state-of-the-art performance, \textcolor[rgb]{0.01,0.005,0}{whose model is also LwF.} \textcolor[rgb]{0.01,0.005,0}{This is because, in the previous works, the LwF model is initialized by the last-layer fine-tuning model, not directly by the original AlexNet.} In this case, the performance loss of the old task is \textcolor[rgb]{0.01,0,0}{not only} decreased, but \textcolor[rgb]{0.01,0,0}{also} the performance gain of the new task is decreased. The accuracies of our mean-IMM ($\alpha$ = 0.5) are 56.20 and 56.73 for the ImageNet task and the CUB task, respectively. The gains compared to the previous state-of-the-art are +1.13 and -1.14. In the case of mean-IMM ($\alpha$ = 0.8) and mode-IMM ($\alpha$ = 0.99), the accuracies are 55.08 and 59.08 (+0.01, +1.12), and 55.10 and 59.12 (+0.02, +1.35), respectively. \textbf{Lifelog Dataset. } Lastly, we evaluate the proposed \textcolor[rgb]{0.01,0,0}{methods} on the Lifelog dataset \cite{lee2016}. The Lifelog dataset consists of 660,000 instances of egocentric video stream data, collected over 46 days from three participants using Google Glass \cite{lee2017}. Three class categories, location, sub-location, and activity, are labeled on each frame of video. In the Lifelog dataset, the class distribution changes continuously and new classes appear as the day passes. Table \ref{table:table2} shows that mean-IMM and mode-IMM are competitive to the dual-memory architecture, the previous state-of-the-art ensemble model, even though IMM uses \textcolor[rgb]{0.01,0,0}{single} network. \begin{table}[t] \caption{Experimental results on the Lifelog dataset among different classes (location, sub-location, and activity) and different subjects (A, B, C). Every IMM uses weight-transfer. } \centering \small \begin{tabular}{lccc C{1.15cm} C{1.15cm} C{1.15cm}} \hline & Location & Sub-location & Activity & A & B & C \\ \hline Dual memory architecture \cite{lee2016} & \textbf{78.11} & 72.36 & 52.92 & 67.02 & 58.80 & 77.57 \\ \hline \textbf{Mean-IMM} & 77.60 & 73.78 & 52.74 & 67.03 & 57.73 & \textbf{79.35} \\ \textbf{Mode-IMM} & 77.14 & \textbf{75.76} & \textbf{54.07} & \textbf{67.97} & \textbf{60.12} & 78.89 \\ \hline \label{table:table2} \end{tabular} \end{table} \section{Discussion} \textbf{A Shift of Optimal Hyperparameter of IMM. } The tuned setting shows there often exists some $\alpha$ which makes the performance of the mean-IMM close to the mode-IMM. However, in the untuned hyperparameter setting, mean-IMM performs worse when more transfer techniques are applied. \textcolor[rgb]{0.01,0,0}{Our Bayesian interpretation in IMM assumes that the SGD training of the $k$-th network $\mu_k$ is mainly affected by the $k$-th task and is rarely affected by the information of the previous tasks. However, transfer techniques break this assumption; thus the optimal $\alpha$ is shifted to larger than $1/k$.} Fortunately, mode-IMM works more robustly than mean-IMM where transfer techniques are applied. \textcolor[rgb]{0.01,0,0}{Figure \ref{fig:fig4} illustrates} the change of the test accuracy curve corresponding to the applied transfer techniques and \textcolor[rgb]{0.01,0,0}{the} following shift of the optimal $\alpha$ in mean-IMM and mode-IMM. \textbf{Bayesian Approach on Continual Learning. } Kirkpatrick et al. \cite{kirkpatrick2016} interpreted that the Fisher matrix $F$ as weight importance in explaining their EWC model. In the shuffled MNIST experiment, since a large number of pixels always \textcolor[rgb]{0.01,0,0}{have} \textcolor[rgb]{0.01,0.005,0}{a} value of zero, the corresponding element\textcolor[rgb]{0.01,0,0}{s} of the Fisher matrix \textcolor[rgb]{0.01,0,0}{are} also zero. Therefore, EWC does work by allowing weights to \textcolor[rgb]{0.01,0.005,0}{change, which} are not used in the previous task\textcolor[rgb]{0.01,0,0}{s}. On the other hand, mode-IMM also works \textcolor[rgb]{0.01,0.005,0}{by selectively balancing between two weights using variance information.} However, these assumptions on weight importance do not always hold, especially in the disjoint MNIST experiment. The most important weight in the disjoint MNIST experiment is the bias term in the output layer. Nevertheless, these \textcolor[rgb]{0.01,0,0}{bias parts} of the Fisher matrix are not guaranteed to be the highest value nor can they be used to balance the class distribution between the first and second task. We believe that using only the diagonal \textcolor[rgb]{0.01,0,0}{of} the covariance matrix in Bayesian neural networks is too na{\"i}ve in \textcolor[rgb]{0.01,0.005,0}{general and that this} is why EWC failed in the disjoint MNIST experiment. We think \textcolor[rgb]{0.01,0,0}{it} could be alleviated in future work by using a more complex prior, such as a matrix Gaussian distribution \textcolor[rgb]{0.01,0,0}{considering the} correlations between nodes in the network \cite{Louizos2016}. \textbf{Balancing the Information of an Old and a New Task. } The IMM procedure produces a neural network without a performance loss for $k$th task $\mu_k$, which is better than the final solution $\mu_{1:k}$ in terms of the performance of the $k$th task. Furthermore, IMM can easily weigh the importance of tasks in IMM models in real time. For example, $\alpha_t$ can be easily changed for the solution of mean-IMM $\mu_{1:k} = \sum^k_t \alpha_t \mu_t$ . \textcolor[rgb]{0.01,0.005,0}{In actual service situations of IT companies,} the importance of the old and the new task frequently changes in real time, and IMM can handle this problem. This property differentiates IMM \textcolor[rgb]{0.01,0,0}{from the} other continual learning methods using the regularization approach, including LwF and EWC. \section{Conclusion} Our contributions are four fold\textcolor[rgb]{0.01,0,0}{s}. First, we applied mean-IMM to the continual learning of \textcolor[rgb]{0.01,0.005,0}{modern} deep neural networks. Mean-IMM makes competitive results to comparative models and balances the information between an old and a new network. We also interpreted the success of IMM by the Bayesian framework with Gaussian posterior. Second, we extended mean-IMM to mode-IMM with the interpretation of mode-finding \textcolor[rgb]{0.01,0,0}{in} the mixture of Gaussian posterior. Mode-IMM outperforms mean-IMM and comparative models in \textcolor[rgb]{0.01,0,0}{various} datasets. Third, we introduced drop-transfer, a novel method \textcolor[rgb]{0.01,0,0}{proposed} in the paper. Experimental results showed that drop-transfer alone performs well and is similar to the EWC without dropout, in the domain \textcolor[rgb]{0.01,0,0}{where} EWC rarely forgets. Fourth, We applied various transfer techniques \textcolor[rgb]{0.01,0,0}{in} the IMM procedure to make our assumption of Gaussian distribution reasonable. We argued that not only the search space of the loss function among neural networks can \textcolor[rgb]{0.01,0.005,0}{easily be} nearly convex, but also regularizers, such as dropout, make the search space smooth\textcolor[rgb]{0.01,0,0}{,} and the point in the search space have \textcolor[rgb]{0.01,0,0}{good accuracy.} Experimental results showed that applying transfer techniques often boost the performance of IMM. Overall, we made state-of-the-art performance in \textcolor[rgb]{0.01,0,0}{various} datasets of continual learning and explored geometrical properties and a Bayesian perspective \textcolor[rgb]{0.01,0,0}{of deep} neural networks. \section*{\textcolor[rgb]{0.01,0.005,0}{Acknowledgments}} The authors would like to thank Jiseob Kim, Min-Oh Heo, Donghyun Kwak, Insu Jeon, Christina Baek, and Heidi Tessmer for helpful comments and editing. \textcolor[rgb]{0.01,0,0}{This work was supported by the Naver Corp. and partly by the Korean government (IITP-R0126-16-1072-SW.StarLab, IITP-2017-0-01772-VTT, KEIT-10044009-HRI.MESSI, KEIT-10060086-RISF). Byoung-Tak Zhang is the corresponding author.} \bibliographystyle{unsrt}
{'timestamp': '2018-01-31T02:05:29', 'yymm': '1703', 'arxiv_id': '1703.08475', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08475'}
arxiv
\section{Introduction}\label{intro} Maltese, the national language of the Maltese Islands and, since 2004, also an official European language, has a hybrid morphological system that evolved from an Arabic stratum, a Romance (Sicilian/Italian) superstratum and an English adstratum \cite{Brincat:11}. The Semitic influence is evident in the basic syntactic structure, with a highly productive non-Semitic component manifest in its lexis and morphology \cite{Fabri:10,Borg:97,Fabri:14}. Semitic morphological processes still account for a sizeable proportion of the lexicon and follow a non-concatenative, root-and-pattern strategy (or templatic morphology) similar to Arabic and Hebrew, with consonantal roots combined with a vowel melody and patterns to derive forms. By contrast, the Romance/English morphological component is concatenative (i.e. exclusively stem-and-affix based). Table \ref{1t_der_inf} provides an example of these two systems, showing inflection and derivation for the words \mten{eżamina}{to examine} taking a stem-based form, and \mten{gideb}{to lie} from the root \gherq{gdb} which is based on a templatic system. Table \ref{verbex} gives an examply of verbal inflection, which is affix-based, and applies to lexemes arising from both concatenative and non-concatenative systems, the main difference being that the latter evinces frequent stem variation. \begin{table}[htp] \caption[Examples of inflection and derivation in the two systems]{Examples of inflection and derivation in the concatenative and non-concatenative systems} \begin{center} \begin{tabular}{l|l|l} & \textbf{Derivation} & \textbf{Inflection}\\ \hline \textbf{Concat.} & & \\ \mt{eżamina} & \mt{eżaminatur} & \mtgram{eżaminatr-iċi}{sg.f} \\ \en{examine} & \en{examiner} & \mtgram{eżaminatur-i}{pl.}\\ \hline \textbf{Non-Con.} & & \\ \mten{gideb}{lie} & \mt{giddieb} & \mtgram{giddieb-a}{sg.f.} \\ \gherq{gdb} & \en{liar}& \mtgram{giddib-in}{pl.}\\ \hline \end{tabular} \end{center} \label{1t_der_inf} \end{table}% \begin{table}[htbp] \caption{Verbal inflections for the concatenative and non-concatenative systems.} \begin{center} \begin{tabular}{|c|c|c|} \hline & \mt{eżamina} & \mt{gideb} \gherq{gdb} \\ & \en{examine} & \en{lie} \\ \hline \textsc{1Sg} & n-eżamina & n-igdeb \\ \textsc{2Sg} & t-eżamina & t-igdeb \\ \textsc{3SgM} & j-eżamina & j-igdeb \\ \textsc{3SgF} & t-eżamina & t-igdeb\\ \textsc{1Pl} & n-eżamina-w & n-igdb-u\\ \textsc{2Pl} & t-eżamina-w & t-igdb-u\\ \textsc{3Pl} & j-eżamina-w & j-igdb-u\\ \hline \end{tabular} \end{center} \label{verbex} \end{table}% To date, there still is no complete morphological analyser for Maltese. In a first attempt at a computational treatment of Maltese morphology, \newcite{Farrugia:08b} used a neural network and focused solely on broken plural for nouns \cite{Schembri:06}. The only work treating computational morphology for Maltese in general was by \newcite{Borg:14}, who used unsupervised techniques to group together morphologically related words. A theoretical analysis of the templatic verbs \cite{Spagnol:11} was used by \newcite{Camilleri:13}, who created a computational grammar for Maltese for the Resource Grammar Library \cite{Ranta:11}, with a particular focus on inflectional verbal morphology. The grammar produced the full paradigm of a verb on the basis of its root, which can consist of over 1,400 inflective forms per derived verbal form, of which traditional grammars usually list 10. This resource is known as Ġabra and is available online\footnote{\url{http://mlrs.research.um.edu.mt/resources/gabra/}}. Ġabra is, to date, the best computational resource available in terms of morphological information. It is limited in its focus to templatic morphology and restricted to the wordforms available in the database. A further resource is the lexicon and analyser provided as part of the Apertium open-source machine translation toolkit \cite{apertium}. A subset of this lexicon has since been incorporated in the Ġabra database. This paper presents work carried out for Maltese morphology, with a particular emphasis on the problem of hybridity in the morphological system. Morphological analysis is challenging for a language like Maltese due to the mixed morphological processes existing side by side. Although there are similarities between the two systems, as seen in verbal inflections, various differences among the subsystems exist which make a unified treatment challenging, including: (a) stem allomorphy, which occurs far more frequently with Semitic stems; (b) paradigmatic gaps, especially in the derivational system based on semitic roots \cite{Spagnol:11}; (c) the fact that morphological analysis for a hybrid system needs to pay attention to both stem-internal (templatic) processes, and phenomena occurring at the stem's edge (by affixation). First, we will analyse the results of the unsupervised clustering technique by \newcite{Borg:14} applied on Maltese, with a particular focus of distinguishing the performance of the technique on the two different morphological systems. Second, we are interested in labelling words with their morphological properties. We view this as a classification problem, and treat complex morphological properties as separate features which can be classified in an optimal sequence to provide a final complex label. Once again, the focus of the analysis is on the hybridity of the language and whether a single technique is appropriate for a mixed morphology such as that found in Maltese. \section{Related Work}\label{background} Computational morphology can be viewed as having three separate subtasks --- segmentation, clustering related words, and labelling (see \newcite{Hammarstrom:11}). Various approaches are used for each of the tasks, ranging from rule-based techniques, such as finite state transducers for Arabic morphological analysis \cite{Beesley:96,Habash:05b}, to various unsupervised, semi- or fully-supervised techniques which would generally deal with one or two of the subtasks. For most of the techniques described, it is difficult to directly compare results due to difference in the data used and the evaluation setting itself. For instance, the results achieved by segmentation techniques are then evaluated in an information retrieval task. The majority of works dealing with unsupervised morphology focus on English and assume that the morphological processes are concatenative \cite{Hammarstrom:11}. \newcite{Goldsmith:01} uses the minimum description length algorithm, which aims to represent a language in the most compact way possible by grouping together words that take on the same set of suffixes. In a similar vein, Creutz and Lagus \shortcite{Creutz:05a,Creutz:07} use Maximum a Posteriori approaches to segment words from unannotated texts, and have become part of the baseline and standard evaluation in the Morpho Challenge series of competitions \cite{Kurimo:10}. \newcite{Kohonen:10} extends this work by introducing semi- and supervised approaches to the model learning for segmentation. This is done by introducing a discriminative weighting scheme that gives preference to the segmentations within the labelled data. Transitional probabilities are used to determine potential word boundaries \cite{Keshava:06,Dasgupta:07,Demberg:07}. The technique is very intuitive, and posits that the most likely place for a segmentation to take place is at nodes in the trie with a large branching factor. The result is a ranked list of affixes which can then be used to segment words. \newcite{vandenBosch:99} and Clark \shortcite{Clark:02,Clark:07} apply Memory-based Learning to classify morphological labels. The latter work was tested on Arabic singular and broken plural pairs, with the algorithm learning how to associate an inflected form with its base form. \newcite{Durrett:13} derives rules on the basis of the orthographic changes that take place in an inflection table (containing a paradigm). A log-linear model is then used to place a conditional distribution over all valid rules. \newcite{Poon:09} use a log-linear model for unsupervised morphological segmentation, which leverages overlapping features such as morphemes and their context. It incorporates exponential priors as a way of describing a language in an efficient and compact manner. \newcite{Sirts:13} proposed Adaptor Grammars (AGMorph), a nonparametric Bayesian modelling framework for minimally supervised learning of morphological segmentation. The model learns latent tree structures over the input of a corpus of strings. \newcite{Narasimhan:15} also use a log-linear model, and morpheme and word-level features to predict morphological chains, improving upon the techniques of \newcite{Poon:09} and \newcite{Sirts:13}. A morphological chain is seen as a sequence of words that starts from the base word, and at each level through the process of affixation a new word is derived as a morphological variant, with the top 100 chains having an accuracy of 43\%. It was also tested on an Arabic dataset, achieving an F-Measure of 0.799. However, the system does not handle stem variation since the pairing of words is done on the basis of the same orthographic stem and therefore the result for Arabic is rather surprising. The technique is also lightly-supervised since it incorporates part-of-speech category to reinforce potential segmentations. Schone and Jurafsky \shortcite{Schone:00,Schone:01} and \newcite{Baroni:02} use both orthographic and semantic similarity to detect morphologically related word pairs, arguing that neither is sufficient on its own to determine a morphological relation. \newcite{Yarowsky:00} use a combination of alignment models with the aim of pairing inflected words. However this technique relies on part-of-speech, affix and stem information. \newcite{Can:12} create a hierarchical clustering of morphologically related words using both affixes and stems to combine words in the same clusters. \newcite{Ahlberg:14} produce inflection tables by obtaining generalisations over a small number of samples through a semi-supervised approach. The system takes a group of words and assumes that the similar elements that are shared by the different forms can be generalised over and are irrelevant for the inflection process. For Semitic languages, a central issue in computational morphology is disambiguation between multiple possible analyses. \newcite{Habash:05} learn classifiers to identify different morphological features, used specifically to improve part-of-speech tagging. \newcite{Snyder:08} tackle morphological segmentation for multiple languages in the Semitic family and English by creating a model that maps frequently occurring morphemes in different languages into a single abstract morpheme. Due to the intrinsic differences in the problem of computational morphology between Semitic and English/Romance languages, it is difficult to directly compare results. Our interest in the present paper is more in the types of approaches taken, and particularly, in seeing morphological labelling as a classification problem. Modelling different classifiers for specific morphological properties can be the appropriate approach for Maltese, since it allows the flexibility to focus on those properties where data is available. \section{Clustering words in a hybrid morphological system} The Maltese morphology system includes two systems, concatenative and non-concatenative. As seen in the previous section, most computational approaches deal with either Semitic morphology (as one would for Arabic or its varieties), or with a system based on stems and affixes (as in Italian). Therefore, we might expect that certain methods will perform differently depending on which component we look at. Indeed, overall accuracy figures may mask interesting differences among the different components. The main motivation behind this analysis is that Maltese words of Semitic origin tend to have considerable stem variation (non-concatenative), whilst the word formation from Romance/English origin words would generally leave stems whole (concatenative)\footnote{Concatenative word formations would always involve a recognisable stem, though in some cases they may undergo minor variations as a result of allomorphy or allophomy.}. Maltese provides an ideal scenario for this type of analysis due to its mixed morphology. Often, clustering techniques would either be sensitive to a particular language, such as catering for weak consonants in Arabic \cite{DeRoeck:00}, or focus solely on English or Romance languages \cite{Schone:01,Yarowsky:00,Baroni:02} where stem variation is not widespread. The analysis below uses a dataset of clusters produced by \newcite{Borg:14}, who employed an unsupervised technique using several interim steps to cluster words together. First, potential affixes are identified using transitional probabilities in a similar fashion to \cite{Keshava:06,Dasgupta:07}. Words are then clustered on the basis of common stems. Clusters are improved using measures of orthographic and semantic similarity, in a similar vein to \cite{Schone:01,Baroni:02}. Since no gold-standard lexical resource was available for Maltese, the authors evaluated the clusters using a crowd-sourcing strategy of non-expert native speakers and a separate, but smaller, set of clusters were evaluated using an expert group. In the evaluation, participants were presented with a cluster which had to be rated for its quality and corrected by removing any words which do not belong to a cluster. In this analysis, we focus on the experts' cluster dataset which was roughly balanced between non-concatenative (NC) and concatenative (CON) clusters. There are 101 clusters in this dataset, 25 of which were evaluated by all 3 experts, and the remaining by one of the experts. Table \ref{3t_clusterspread} provides an overview of the 101 clusters in terms of their size. \begin{table}[!htbp] \caption{Comparison of non-concatenative and concatenative clusters in expert group} \begin{center} \begin{tabular}{|l|c|c|} \hline Size & NC & CON\\ \hline \textless 10 & 53\% (25) & 26\% (14)\\ 10--19 & 23\% (11) & 37\% (20)\\ 20--29 & 13\% (6) & 15\% (8)\\ 30--39 & 2\% (1) & 9\% (5) \\ \textgreater 40 & 9\% (4) & 13\% (7) \\ \hline Total & 47 & 53 \\ Evaluated by all experts & 13 & 13\\ Evaluated by one expert & 34 & 40\\ \hline \end{tabular} \end{center} \label{3t_clusterspread} \end{table}% Immediately, it is possible to observe that concatenative clusters tend to be larger in size than non-concatenative clusters. This is mainly due to the issue of stem variation in the non-concatenative group, which gives rise to a lot of false negatives. It is also worth noting that part of the difficulty here is that the vowel patterns in the non-concatenative process are unpredictable. For example \mten{qsim}{division} is formed from \mten{qasam}{to divide} \gherq{qsm}, whilst \mten{ksur}{breakage} is formed from \mten{kiser}{to break} \gherq{ksr}. Words are constructed around infixation of vowel melodies to form a stem, before inflection adds affixes. In the concatenative system there are some cases of allomorphy, but there will, in general, be an entire stem, or substring thereof, that is recognisable. \subsection{Words removed from clusters} As an indicator of the quality of a cluster, the analysis looks at the number of words that experts removed from a cluster --- indicating that the word does not belong to a cluster. Table \ref{3t_wordperremovedspread} gives the percentage of words removed from clusters, divided according to whether the morphological system involved is concatenative or non-concatenative. The percentage of clusters which were left intact by the experts were higher for the concatenative group (61\%) when compared to the non-concatenative group (45\%). The gap closes when considering the percentage of clusters which had a third or more of their words removed (non-concatenative at 25\% and concatenative at 20\%). However, the concatenative group also had clusters which had more than 80\% of their words removed. This indicates that, although in general the clustering technique performs better for the concatenative case, there are cases when bad clusters are formed through the techniques used. The reason is usually that stems with overlapping substrings are mistakenly grouped together. One such cluster was that for \mten{ittra}{letter}, which also got clustered with \mten{ittraduċi}{translate} and \mten{ittratat}{treated}, clearly all morphologically unrelated words. However, these were clustered together because the system incorrectly identified \mt{ittra} as a potential stem in all these words. \begin{table} \caption{Number of words removed, split by concatenative and non-concatenative processes} \begin{center} \begin{tabular}{|l|c|c|} \hline By Percentage & NC & CON \\ \hline 0\% & 45\% (33) & 61\% (49)\\ 1--5\% & 1\% (1) & 1\% (1) \\ 5--10\% & 7\% (5) & 4\% (3) \\ 10--20\% & 5\% (4) & 11\% (9) \\ 20--30\% & 17\% (12) & 4\% (3) \\ 30--40\% & 8\% (6) & 4\% (3) \\ 40--60\% & 7\% (5) & 3\% (2) \\ 60--80\% & 10\% (7) & 9\% (7) \\ over 80\% & 0\% (0) & 4\% (3)\\ \hline \end{tabular} \end{center} \label{3t_wordperremovedspread} \end{table}% \subsection{Quality ratings of clusters} Experts were asked to rate the quality of a cluster, and although this is a rather subjective opinion, the correlation between this judgement and the number of words removed was calculated using Pearson’s correlation coefficient. The trends are consistent with the analysis in the previous subsection; Table \ref{3t_qualityspread} provides the breakdown of the quality ratings for clusters split between the two processes and the correlation of the quality to the percentage of words removed. The non-concatenative clusters generally have lower quality ratings when compared to the concatenative clusters. But both groups have a strong correlation between the percentage of words removed and the quality rating, clearly indicating that the perception of a cluster's quality is related to the percentage of words removed. \begin{table}[htbp] \caption{Quality ratings of clusters, correlated to the percentage of words removed.} \begin{center} \begin{tabular}{|l|c|c|} \hline Quality & NC & CON \\ \hline Very Good & 17\% (12) & 28\% (22) \\ Good & 33\% (24) & 36\% (29) \\ Medium & 34\% (25) & 18\% (15) \\ Bad & 12\% (9) & 14\% (11) \\ Very Bad & 4\% (3) & 4\% (3) \\ \hline \hline Correlation: & 0.780 & 0.785 \\ \hline \end{tabular} \end{center} \label{3t_qualityspread} \end{table}% \subsection{Hybridity in clustering} Clearly, there is a notable difference between the clustering of words from concatenative and non-concatenative morphological processes. Both have their strengths and pitfalls, but neither of the two processes excel or stand out over the other. One of the problems with non-concatenative clusters was that of size. The initial clusters were formed on the basis of the stems, and due to stem variation the non-concatenative clusters were rather small. Although the merging process catered for clusters to be put together and form larger clusters, the process was limited to a maximum of two merging operations. This might not have been sufficient for the small-sized non-concatenative clusters. In fact, only 10\% of the NC clusters contained 30 or more words when compared to 22\% of the concatenative clusters. Limiting merging in this fashion may have resulted in a few missed opportunities. This is because there's likely to be a lot of derived forms which are difficult to cluster initially due to stem allomorphy (arising due to the fact that root-based derivation involves infixation, and in Maltese, vowel melodies are unpredictable). So there are possibly many clusters, all related to the same root. The problem of size with concatenative clusters was on the other side of the scale. Although the majority of clusters were of average size, large clusters tended to include many false positives. In order to explore this problem further, one possibility would be to check whether there is a correlation between the size of a cluster and the percentage of words removed from it. It is possible that the unsupervised technique does not perform well when producing larger clusters, and if such a correlation exists, it would be possible to set an empirically determined threshold for cluster size. Given the results achieved, it is realistic to state that the unsupervised clustering technique could be further improved using the evaluated clusters as a development set to better determine the thresholds in the metrics proposed above. This improvement would impact both concatenative and non-concatenative clusters equally. In general, the clustering technique does work slightly better for the concatenative clusters, and this is surely due to the clustering of words on the basis of their stems. This is reflected by the result that 61\% of the clusters had no words removed compared to 45\% of the non-concatenative clusters. However, a larger number of concatenative clusters had a large percentage of words removed. Indeed, if the quality ratings were considered as an indicator of how the technique performs on the non-concatenative vs the concatenative clusters, the judgement would be medium to good for the non-concatenative and good for the concatenative clusters. Thus the performance is sufficiently close in terms of quality of the two groups to suggest that a single unsupervised technique can be applied to Maltese, without differentiating between the morphological sub-systems. \section{Classifying morphological properties} In our approach, morphological labelling is viewed as a classification problem with each morphological property seen as a feature which can be classified. Thus, the analysis of a given word can be seen as a sequence of classification problems, each assigning a label to the word which reflects one of its morphological properties. We refer to such a sequence of classifiers as a `cascade'. In this paper, we focus in particular on the verb category, which is morphologically one of the richest categories in Maltese. The main question is to identify whether there is a difference in the performance of the classification system when applied to lexemes formed through concatenative or non-concatenative processes. Our primary focus is on the classification of inflectional verb features. While these are affixed to the stem, the principal issue we are interested in is whether the co-training of the classifier sequence on an undifferentiated training set performs adequately on both lexemes derived via a templatic system and lexemes which have a `whole', continuous stem. \subsection{The classification system}\label{class_sys} The classification system was trained and initially evaluated using part of the annotated data from the lexical resource Ġabra. The training data contained over 170,000 wordforms, and the test data, which was completely unseen, contained around 20,000 wordforms. A second dataset was also used which was taken from the Maltese national corpus (\textsc{mlrs} --- Malta Language Resource Server\footnote{\url{http://mlrs.research.um.edu.mt/}}). This dataset consisted of 200 randomly selected words which were given morphological labels by two experts. The words were split half and half between Semitic (non-concatenative) and Romance/English (concatenative) origin. The verb category had 94 words, with 76 non-concatenative, and 18 concatenative. This is referred to as the \textit{gold standard} dataset. A series of classifiers were trained using annotated data from Ġabra, which contains detailed morphological information relevant to each word. These are \textbf{person}, \textbf{number}, \textbf{gender}, \textbf{direct object}, \textbf{indirect object}, \textbf{tense}, \textbf{aspect}, \textbf{mood} and \textbf{polarity}. In the case of \textit{tense/aspect} and \textit{mood}, these were joined into one single feature, abbreviated to \textbf{TAM} since they are mutually exclusive. These features are referred to as \textit{second-tier} features, representing the morphological properties which the system must classify. The classification also relies on a set of \textit{basic} features which are automatically extracted from a given word. These are \textbf{stems}, \textbf{prefixes}, \textbf{suffixes} and \textbf{composite suffixes}, when available\footnote{Composite suffixes occur when more than one suffix is concatenated to the stem, usually with enclitic object and indirect object pronouns, as in \mten{qatil-hu-li}{he killed him for me}.}, \textbf{consonant-vowel patterns} and \textbf{gemination}. A separate classifier was trained for each of the second-tier features. In order to arrive at the ideal sequence of classifiers, multiple sequences were tested and the best sequence identified on the basis of performance on held-out data (for more detail see \newcite{Borg:16}). Once the optimal sequence was established, the classification system used these classifiers as a cascade, each producing the appropriate label for a particular morphological property and passing on the information learnt to the following classifier. The verb cascade consisted of the optimal sequence of classifiers in the following sequence: Polarity (Pol), Indirect Object (Ind), Direct Object (Dir), Tense/Aspect/Mood (TAM), Number (Num), Gender (Gen) and Person (Per). The classifiers were trained using decision trees through the \textsc{weka} data mining software \cite{weka}, available both through a graphical user interface and as an open-source java library. Other techniques, such as Random Forests, SVMs and Na\"{i}ve Bayes, were also tested and produced very similar results. The classifiers were built using the training datasets. The first evaluation followed the traditional evaluation principles of machine learning, using the test dataset which contained unseen wordforms from Ġabra, amounting to just over 10\% of the training data. This is referred to as the \textit{traditional} evaluation. However, there are two main aspects in our scenario that encouraged us to go beyond the traditional evaluation. First, Ġabra is made of automatically generated wordforms, several of which are never attested (though they are possible) in the {\sc mlrs} corpus. Second, the corpus contains several other words which are not present in \mt{Ġabra}, especially concatenative word formations. Thus, we decided to carry out a gold standard (GS) evaluation to test the performance of the classification system on actual data from the {\sc mlrs} corpus. The evaluation in this paper is restricted to the verb category. \subsection{Evaluation Results} We first compare the performance of the classification system on the test dataset collected from \mt{Ġabra} to the manually annotated gold standard collated from the \textsc{mlrs} corpus. These results are shown in Figure \ref{pGS_Trad}. The first three features in the cascade --- Polarity, Indirect Object and Direct Object --- perform best in both the traditional and gold standard evaluations. In particular, the indirect object has practically the same performance in both evaluations. A closer look at the classification results of the words reveals that most words did not have this morphological property, and therefore no label was required. The classification system correctly classified these words with a {\em null} value. The polarity classifier on the other hand, was expected to perform better --- in Maltese, negation is indicated with the suffix \mt{-x} at the end of the word. The main problem here was that the classifier could apply the labels \textit{positive}, \textit{negative} or \textit{null} to a word, resulting in the use of the null label more frequently than the two human experts. The errors in the classification of the morphological property TAM were mainly found in the labelling of the values \textit{perfective} and \textit{imperative}, whilst the label \textit{imperfective} performed slightly better. Similarly, the number and gender classifiers both had labels that performed better than others. Overall, this could indicate that the data representation for these particular labels is not adequate to facilitate the modelling of a classifier. As expected, the performance of the classifiers on the gold standard is lower than that of a traditional evaluation setting. The test dataset used in the traditional evaluation, although completely unseen, was still from the same source as the training data (Ġabra) --- the segmentation of words was known, the distribution of instances in the different classes (labels) was similar to that found in the training data. While consistency in training and test data sources clearly make for better results, the outcomes also point to the possibility of overfitting, particularly as Ġabra contains a very high proportion of Semitic, compared to concatenative, stems. Thus, it is possible that the training data for the classifiers did not cover the necessary breadth for the verbs found in the \textsc{mlrs} corpus. To what extent this is impacting the results of the classifiers cannot be known unless the analysis separates the two processes. For this reason, the analysis of the verb category in the gold standard evaluation was separated into two, and the performance of each is compared to the overall gold standard performance. This allows us to identify those morphological properties which will require more representative datasets in order to improve their performance. Figure \ref{pGS_RomSem} shows this comparison. \begin{figure*}[!] \begin{tikzpicture} \begin{axis}[ height=3.5cm, width=11cm, legend style={overlay, at={(1.2,0.5)}, anchor=center}, ylabel={Accuracy}, symbolic x coords={Pol,Ind,Dir,Tam,Num,Gen,Per}, xtick=data, x tick label style={rotate=35,anchor=east},] \addplot table[x = SemRom, y = PrevAvgACC] {pRomSemAcc.csv}; \addplot table[x = SemRom, y = Reg-Pred] {pRomSemAcc.csv}; \legend{GoldStandard,Traditional} \end{axis} \end{tikzpicture} \caption{Comparison of the classification system using traditional evaluation settings and a gold standard evaluation.} \label{pGS_Trad} \end{figure*} \begin{figure*}[h!tb] \begin{tikzpicture} \begin{axis}[ height=3.5cm, width=11cm, legend style={overlay, at={(1.2,0.5)}, anchor=center}, ylabel={Accuracy}, symbolic x coords={Pol,Ind,Dir,Tam,Num,Gen,Per}, xtick=data, x tick label style={rotate=35,anchor=east},] \addplot table[x = SemRom, y = PrevAvgACC] {pRomSemAcc.csv}; \addplot table[x = SemRom, y = AvgAccROM] {pRomSemAcc.csv}; \addplot table[x = SemRom, y = AvgAccSEM] {pRomSemAcc.csv}; \legend{GoldStandard,Concatenative,Non-concatenative} \end{axis} \end{tikzpicture} \caption{Comparison of the classifiers split between concatenative and non-concatenative words.} \label{pGS_RomSem} \end{figure*} The first three classifiers --- polarity, indirect object and direct object --- perform as expected, meaning that the concatenative lexemes perform worse than the non-concatenative. This confirms the suspicion that the coverage of Ġabra is not sufficiently representative of the morphological properties in the concatenative class of words. On the other hand, the TAM and Person classifiers perform better on the concatenative words. However, there is no specific distinction in the errors of these two classifiers. One overall possible reason for the discrepancy in the performance between the traditional and gold standard evaluation, and possibly also between the concatenative and non-concatenative words, is how the words are segmented. The test data in the traditional evaluation setting was segmented correctly, using the same technique applied for the training data. The segmentation for the words in the \textsc{mlrs} corpus was performed automatically and heuristically, and the results were not checked for their correctness, so the classification system might have been given an incorrect segmentation of a word. This would impact the results as the classifiers rely upon the identification of prefixes and suffixes to label words. \section{Conclusions and Future Work}\label{conc} This paper analysed the results of the clustering of morphologically related words and the morphological labelling of words, with a particular emphasis on identifying the difference in performance of the techniques used on words of Semitic origin (non-concatenative) and Romance/English origin (concatenative). The datasets obtained from the clustering technique were split into concatenative and non-concatenative sets, and evaluated in terms of their quality and the number of words removed from each cluster. Although generally, the clustering techniques performed best on the concatenative set, scalability seemed to be an issue, with the bigger clusters performing badly. The non-concatenative set, on the other hand, had smaller clusters but the quality ratings were generally lower than those of the concatenative group. Overall, it seems that the techniques were geared more towards the concatenative set, but performed at an acceptable level for the non-concatenative set. Although the analysis shows that it is difficult to find a one-size-fits-all solution, the resulting clusters could be used as a development set to optimise the clustering process in future. The research carried out in morphological labelling viewed it as a classification problem. Each morphological property is seen as a machine learning feature, and each feature is modelled as a classifier and placed in a cascade so as to provide the complete label to a given word. The research focussed on the verb category and two types of evaluations were carried out to test this classification system. The first was a traditional evaluation using unseen data from the same source as the training set. A second evaluation used randomly selected words from the \textsc{mlrs} corpus which were manually annotated with their morphological labels by two human experts. There is no complete morphological analyser available for Maltese, so this was treated as a gold standard. Since the classifiers were trained using data which is predominantly non-concatenative, the performance of the classification system on the \textsc{mlrs} corpus was, as expected, worse than the traditional evaluation. In comparing the two evaluations, it was possible to assess which morphological properties were not performing adequately. Moreover, the gold standard dataset was split into two, denoting concatenative and non-concatenative words, to further analyse whether a classification system that was trained predominantly on non-concatenative data could then be applied to concatenative data. The results were mixed, according to the different morphological properties, but overall, the evaluation was useful to determine where more representative data is needed. Although the accuracy of the morphological classification system are not exceptionally high for some of the morphological properties, the system performs well overall, and the individual classifiers can be retrained and improved as more representative data becomes available. And although the gold standard data is small in size, it allows us to identify which properties require more data, and of which type. One of the possible routes forward is to extend the grammar used to generate the wordforms in Ġabra and thus obtain more coverage for the concatenative process. However, it is already clear from the analysis carried out that the current approach is viable for both morphological systems and can be well suited for a hybrid system such as Maltese. \section{Acknowledgements} The authors acknowledge the insight and expertise of Prof. Ray Fabri. The research work disclosed in this publication is partially funded by the Malta Government Scholarship Scheme grant.
{'timestamp': '2017-03-28T02:04:19', 'yymm': '1703', 'arxiv_id': '1703.08701', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08701'}
arxiv
\section{Introduction} Under mild conditions, max-stable distributions and processes are useful for studying high-dimensional extreme events recorded in space and time \citep{Padoan.etal:2010,Davis.etal:2013b,Davison.etal:2013,deCarvalho.Davison:2014,Huser.Davison:2014a,Huser.Genton:2016}. This broad but constrained class of models may, at least theoretically, be used to extrapolate into the joint tail, hence providing a justified framework for risk assessment of extreme events. The probabilistic justification is that the max-stable property arises in limiting models for suitably renormalised maxima of independent and identically distributed processes; see, e.g., \citet{Davison.etal:2012}, \citet{Davison.Huser:2015} and \citet{Davison.etal:2018}. Because extremes are rare by definition, it is crucial for reliable estimation and prediction to extract as much information from the data as possible. Thus, efficient estimators play a particularly important role in statistics of extremes, and the maximum likelihood estimator is a natural choice thanks to its appealing large-sample properties. However, the likelihood function is excessively difficult to compute for high-dimensional data following a max-stable distribution. As detailed in \S\ref{inference}, likelihood evaluations require the computation of a sum indexed by all elements of a given set ${\mathcal{P}}_D$, the cardinality of which grows more than exponentially with the dimension, $D$. In a thorough simulation study, \citet{Castruccio.etal:2016} stated that current technologies are limiting full likelihood inference to dimension $12$ or $13$, and they concluded that without meaningful methodological advances, a direct full likelihood approach will not be feasible. To circumvent this computational bottleneck, several strategies have been advocated. \citet{Padoan.etal:2010} proposed a pairwise likelihood approach, combining the bivariate densities of carefully chosen pairs of observations. Although this method is computationally attractive and inherits many good properties from the maximum likelihood estimator, it also entails a loss in efficiency, which becomes more apparent in high dimensions \citep{Huser.etal:2016}. More efficient triplewise and higher-order composite likelihoods were investigated by \citet{Genton.etal:2011}, \citet{Huser.Davison:2013a}, \citet{Sang.Genton:2014} and \citet{Castruccio.etal:2016}. However, they are still not fully efficient, and it is not clear how to optimally select the composite likelihood terms. Furthermore, because composite likelihoods are generally not valid likelihoods \citep{Varin.etal:2011}, the classical likelihood theory cannot be blindly applied for uncertainty assessment, testing, model validation and selection, and so forth. Alternatively, \citet{Stephenson.Tawn:2005} suggested augmenting the componentwise block maxima data $z^n=(z_{1}^{n},\ldots,z_{D}^{n})^{\rm T}$, where $n$ is the block size, with their occurrence times. This extra information may be summarized by an observed partition $\pi^n$ of the set $\{1,\ldots,D\}$, which indicates whether or not these maxima occurred simultaneously. Essentially, the Stephenson--Tawn likelihood corresponds the limiting joint ``density'' of $z^n$ and $\pi^n$, as $n{\longrightarrow}\infty$, and it yields drastic simplifications and improved efficiency. However, \citet{Wadsworth:2015} and \citet{Huser.etal:2016} noted that this approach may be severely biased for finite $n$, especially in low-dependence scenarios. By fixing the limit partition, $\pi$, to the observed one, $\pi^n$, a strong constraint is imposed, creating model misspecification, to which likelihood methods are sensitive. In this paper, to mitigate the sub-asymptotic bias due to fixing the partition, we suggest returning to the original likelihood formulation, which integrates out the partition rather than treating it as known. By interpreting the limit partition $\pi$ as missing data, we show how to design a stochastic Expectation-Maximisation algorithm \citep{Dempster.etal:1977,Nielsen:2000} for efficient inference. The quality of the stochastic approximation to the full likelihood can be controlled and set to any arbitrary precision at a computational cost. We show that higher-dimensional max-stable models may be fitted in reasonable time. Importantly, our method is based solely on max-stable data and does not require extra information about the partition or the original processes, unlike the Stephenson--Tawn or related threshold-based methods. Our approach is based on the algorithm of \citet{Dombry.etal:2013} for conditional simulation of the partition given the data, and it is closely related to the recent papers of \citet{Thibaud.etal:2016} and \citet{Dombry.etal:2017}, who in a Bayesian setting developed a Markov chain Monte Carlo algorithm for max-stable processes by treating the partition as a latent variable to be resampled at each iteration. \section{Max-stable processes and distributions}\label{maxstable} \subsection{Definition, construction, and models} Consider a sequence of independent and identically distributed processes $Y_1(s),Y_2(s),\ldots,$ indexed by spatial site $s\in{\mathcal{S}}\subset\Real^d$, and assume that there exist sequences of functions $a_n(s)>0$ and $b_n(s)$, such that the renormalised pointwise block maximum process (with block size $n$) \begin{equation}\label{maximum} Z^n(s)=a_n(s)^{-1}\left[\max\{Y_1(s),\ldots,Y_n(s)\}-b_n(s)\right] \end{equation} converges in the sense of finite-distributional distributions, as $n{\longrightarrow}\infty$, to a process $Z(s)$ with non-degenerate marginal distributions, i.e., $Y(s)$ is in the max-domain of attraction of $Z(s)$. Then, the limit $Z(s)$ is max-stable (see, e.g., \citealp{deHaan.Ferreira:2006}, Chap.~9). That is, pointwise maxima of independent copies of the limit process $Z(s)$ have the same dependence structure as $Z(s)$ itself, while marginal distributions are in the same location-scale family and coincide with the generalized extreme-value distribution Consider now points of a unit rate Poisson point process, $P_1,P_2,\ldots$, and independent copies, $W_1(s),W_2(s),\ldots$, of a stochastic process $W(s)\geq0$ with unit mean. Then, the process \begin{equation}\label{representation} Z(s)=\sup_{j\geq 1} W_j(s)/P_j,\quad s\in{\mathcal{S}}, \end{equation} is max-stable with unit Fr\'echet marginal distributions, i.e., ${\rm Pr}\{Z(s)\leq z\}=\exp(-1/z)$, $z>0$ \citep{deHaan:1984,Schlather:2002}. In the remaining of the paper, we shall always consider max-stable processes $Z(s)$ with unit Fr\'echet marginal distributions. Representation \eqref{representation} is useful to build a wide variety of max-stable processes \citep{Smith:1990b,Schlather:2002,Kabluchko.etal:2009,Opitz:2013a,Xu.Genton:2016}, and to simulate from them \citep{Schlather:2002,Dombry.etal:2016}. Multivariate max-stable models can be constructed similarly. From \eqref{representation}, we deduce that the joint distribution at a finite set of sites ${\mathcal{S}}_D=\{s_1,\ldots,s_D\}\subset{\mathcal{S}}$ may be expressed as \begin{equation}\label{distribution} {\rm Pr}\{Z(s_1)\leq z_1,\ldots,Z(s_D)\leq z_D\}=\exp\{-V(z_1,\ldots,z_D)\}, \end{equation} where the exponent function $V(z_1,\ldots,z_D)=E\left[\max\left\{{W(s_1)/z_1},\ldots,{W(s_D)/z_D}\right\}\right]$ satisfies homogeneity and marginal constraints \citep[see, e.g.,][]{Davison.Huser:2015}. As an illustration, Fig.~\ref{Fig:simul} shows two independent realisations from the same \citet{Smith:1990b} model defined by taking $W_j(s)=\phi(s-U_j;\sigma^2)$, $s\in{\mathcal{S}}=\Real$, in \eqref{representation}, where $\phi(\cdot;\sigma^2)$ is the normal density with zero mean and variance $\sigma^2$, and the $U_j$s are points from a unit rate Poisson point process on the real line. \begin{figure}[t!] \centering \includegraphics[width=0.8\linewidth]{Simul.pdf} \caption{Two realisations (black) from the same \citet{Smith:1990b} max-stable process on the line defined by setting $W(s)=\phi(s-U;\sigma^2)$, $s\in{\mathcal{S}}=\Real$, in \eqref{representation}, with the latent profiles $W_j(s)/P_j$ (grey). Here, $\sigma^2=5$. When observed at sites $5,10,15,20,25$, the partitions are $\pi=\{\{1\},\{2\},\{3,4,5\}\}$ (left) and $\pi=\{\{1,2,3\},\{4,5\}\}$ (right).}\label{Fig:simul} \end{figure} \subsection{Underlying partition and extremal functions} At each site $s\in{\mathcal{S}}$, the pointwise supremum, $Z(s)$, in \eqref{representation} is realised by a single profile $W_j(s)/P_j$ almost surely. Such profiles are called extremal functions in \citet{Dombry.etal:2013}. As illustrated in Fig.~\ref{Fig:simul}, the extremal functions are only partially observed on ${\mathcal{S}}_D=\{s_1,\ldots,s_D\}$; they define a random partition $\pi=\{\tau_1,\ldots,\tau_{|\pi|}\}$ (of size $|\pi|$) of the set $\{1,\ldots,D\}$, called hitting scenario in \citet{Dombry.etal:2013} that identifies clusters of variables stemming from the same event. For example, the partition $\pi=\{\{1\},\{2\},\{3,4,5\}\}$ on the left panel of Fig.~\ref{Fig:simul} indicates that the max-stable process at these five sites came from three separate independent events; in particular, the maxima at $s_3=15$, $s_4=20$, and $s_5=25$ were generated from the same profile. Similarly, an observed partition $\pi^n$ of $\{1,\ldots,D\}$ may be defined for $Z^n(s)$ in \eqref{maximum} based on the original processes $Y_1(s),\ldots,Y_n(s)$. The knowledge of $\pi^n$ tells us if extreme events at different sites occurred simultaneously or not, so $\pi^n$ carries information about the strength of spatial extremal dependence. If the processes $Y_1(s),\ldots,Y_n(s)$ (suitably marginally transformed) are in the max-domain of attraction of $Z(s)$ in \eqref{representation}, then the partition $\pi^n$ converges in distribution to $\pi$, as $n{\longrightarrow}\infty$, on the space of all partitions ${\mathcal{P}}_D$ of $\{1,\ldots,D\}$ \citep{Stephenson.Tawn:2005}. We now describe likelihood inference for max-stable vectors: by exploiting the information on the partition $\pi$ (Stephenson--Tawn likelihood), or by integrating it out (full likelihood). \section{Likelihood inference}\label{inference} \subsection{Full and Stephenson--Tawn likelihoods} By differentiating the distribution \eqref{distribution} with respect to the variables $z_1,\ldots,z_D$, we can deduce that the corresponding density, or full likelihood for one replicate, may be expressed as \begin{equation}\label{density} g_{\rm Full}(z_1,\ldots,z_D)=\exp\{-V(z_1,\ldots,z_D)\}\sum_{\pi\in{\mathcal{P}}_D}\prod_{i=1}^{|\pi|}\{-V_{\tau_i}(z_1,\ldots,z_D)\}, \end{equation} where $V_{\tau_i}$ denotes the partial derivative of the function $V$ with respect to the variables indexed by the set $\tau_i\subset\{1,\ldots,D\}$ \citep{Huser.etal:2016,Castruccio.etal:2016}. The sum in \eqref{density} is taken over all elements of ${\mathcal{P}}_D$, the size of which equals the Bell number of order $D$, leading to an explosion of terms, even for moderate $D$. Each term in \eqref{density} corresponds to a different configuration of the profiles $W_j(s)/P_j$ in \eqref{representation} at the sites $s_1,\ldots,s_D$. Thus, \citet{Castruccio.etal:2016} argued that the computation of \eqref{density} is limited to dimension $12$ or $13$ with modern computational resources. As detailed in the Supplementary Material using a point process argument, and originally shown by \citet{Stephenson.Tawn:2005}, the joint density of the max-stable data $z=(z_1,\ldots,z_D)^{\rm T}$ and the associated partition $\pi=\{\tau_1,\ldots,\tau_{|\pi|}\}\in{\mathcal{P}}_D$ is simply equal to \begin{equation}\label{ST} g_{\rm ST}(z_1,\ldots,z_D,\pi)=\exp\{-V(z_1,\ldots,z_D)\}\prod_{i=1}^{|\pi|}\{-V_{\tau_i}(z_1,\ldots,z_D)\}, \end{equation} hence reducing the problematic sum to a single term, making likelihood inference possible in higher dimensions and simultaneously improving statistical efficiency. Because the asymptotic partition $\pi$ is not observed, \citet{Stephenson.Tawn:2005} suggested replacing it by the observed partition $\pi^n$ of occurrence times of maxima, which converges to $\pi$ provided the asymptotic model is well specified. However, \citet{Wadsworth:2015} and \citet{Huser.etal:2016} showed that lack of convergence of $\pi^n$ to $\pi$ may result in severe estimation bias, which is especially strong in low-dependence cases. To circumvent this problem, \citet{Wadsworth:2015} proposed a bias-corrected likelihood; alternatively, we show in the next section how to design a stochastic Expectation-Maximisation algorithm to maximise \eqref{density}, while taking advantage of the computationally appealing nature of \eqref{ST}. \subsection{Stochastic Expectation-Maximisation algorithm} It is instructive to rewrite the full likelihood \eqref{density} using \eqref{ST} as $g_{\rm Full}(z_1,\ldots,z_D)=\sum_{\pi\in{\mathcal{P}}_D}g_{\rm ST}(z_1,\ldots,z_D,\pi)$ because it highlights that the full likelihood simply integrates out the latent random partition $\pi$ needed for the Stephenson--Tawn likelihood. Interpreting $\pi$ as a missing observation and the Stephenson--Tawn likelihood as the completed likelihood, an Expectation-Maximisation algorithm \citep{Dempster.etal:1977} may be easily formulated. Assume that the exponent function $V(z_1,\ldots,z_D\mid \theta)$ is parametrised by a vector $\theta\in\Theta\subset\Real^p$. Starting from an initial guess $\theta_0\in\Theta$, the Expectation-Maximisation algorithm consists of iterating the following E- and M-steps for $r=1,\ldots,R$: \begin{itemize} \item[$\bullet$] E-step: compute the functional \begin{equation}\label{Estep} Q(\theta,\theta_{r-1})=E_{\pi\mid z,\theta_{r-1}}\left[\log \left\{g_{\rm ST}(z,\pi\mid \theta)\right\}\right]=\sum_{\pi\in{\mathcal{P}}_D}g(\pi\mid z,\theta_{r-1})\log\{g_{\rm ST}(z,\pi\mid \theta)\}, \end{equation} where the expectation is computed with respect to the discrete conditional distribution of $\pi$ given the data $z=(z_1,\ldots,z_D)^{\rm T}$ and the current value of the parameter $\theta_{r-1}$, i.e., \begin{equation}\label{conditionaldistribution} g(\pi\mid z,\theta_{r-1})={g_{\rm ST}(z,\pi\mid \theta_{r-1})/ g_{\rm Full}(z\mid \theta_{r-1})}. \end{equation} \item[$\bullet$] M-step: update the parameter as $\theta_{r}=\arg\max_{\theta\in\Theta}Q(\theta,\theta_{r-1})$. \end{itemize} \citet{Dempster.etal:1977} showed that the Expectation-Maximisation algorithm has appealing properties; in particular, the value of the log-likelihood increases at each iteration, which ensures convergence of $\theta_r$ to a local maximum, as $r{\longrightarrow}\infty$. In our case, however, the expectation in \eqref{Estep} is tricky to compute: it contains again the sum over the set ${\mathcal{P}}_D$, and \eqref{conditionaldistribution} relies on the full density $g_{\rm Full}(z\mid\theta_{r-1})$, which we try to avoid. To circumvent this issue, one solution is to approximate \eqref{Estep} by Monte Carlo as \begin{equation}\label{StEstep} \hat Q(\theta,\theta_{r-1})={1\over N}\sum_{i=1}^N \log \left\{g_{\rm ST}(z,\pi_i\mid \theta)\right\},\quad \pi_1,\ldots,\pi_N{\ {\sim}\ } g(\pi\mid z,\theta_{r-1}), \end{equation} where the partitions $\pi_1,\ldots,\pi_N$ are conditionally independent at best, or form an ergodic sequence at least. As $g(\pi\mid z,\theta_{r-1})\propto g_{\rm ST}(z,\pi\mid \theta_{r-1})$, see \eqref{conditionaldistribution}, it is possible to devise a Gibbs sampler to generate approximate simulations from $g(\pi\mid z,\theta_{r-1})$ without explicitly computing the constant factor $g_{\rm Full}(z\mid \theta_{r-1})$ in the denominator of \eqref{conditionaldistribution}. Thanks to ergodicity of the resulting Markov chain, the precision of the approximation \eqref{StEstep} may be set arbitrarily high by letting $N{\longrightarrow}\infty$ (and discarding some burn-in iterations). More details about the practical implementation of the Gibbs sampler are given in \citet{Dombry.etal:2013} and in the Supplementary Material. Although the number of iterations of the Gibbs sampler, $N$, will typically be much smaller than the cardinality of ${\mathcal{P}}_D$, the approximation \eqref{StEstep} to \eqref{Estep} will likely be reasonably good for moderate values of $N$ because only a few partitions $\pi\in{\mathcal{P}}_D$ may be plausible or compatible with the data $z=(z_1,\ldots,z_D)^{\rm T}$. The asymptotic properties of the stochastic Expectation-Maximisation estimator, $\hat\theta_{\rm SEM}$, were studied in details by \citet{Nielsen:2000} and compared with the classical maximum likelihood estimator, $\hat\theta$; see \S2--3 therein, in particular Theorem 2. \citet{Dombry.etal:2017b} showed that the maximum likelihood estimator $\hat\theta$ is consistent and asymptotically normal for the most popular max-stable models, including the logistic and Brown--Resnick models used in this paper. This suggests that these appealing asymptotic properties should also be satisfied for the estimator $\hat\theta_{\rm SEM}$, provided some additional rather technical regularity conditions detailed in \citet{Nielsen:2000} are satisfied. If so, then the asymptotic performance of $\hat\theta_{\rm SEM}$ is akin to that of $\hat\theta$, though with a larger asymptotic variance. Finally, the inherent variability of the stochastic Expectation-Maximisation algorithm may also be a blessing: unlike the deterministic Expectation-Maximisation algorithm, it is less likely to get stuck at a local maximum of the full likelihood. \section{Simulation study}\label{simul} To assess the performance of the stochastic Expectation-Maximisation estimator $\hat\theta_{\rm SEM}$, we simulated data from the multivariate logistic max-stable distribution with exponent function $V(z_1,\ldots,z_D\mid\theta)=(\sum_{j=1}^D z_j^{-1/\theta})^\theta$, $\theta\in\Theta=(0,1]$. Here, the parameter $\theta$ controls the dependence strength, with $\theta\to0$ and $\theta=1$ corresponding to perfect dependence and independence, respectively. This model was chosen for two main reasons: first, it is the simplest max-stable distribution, often used as a benchmark, that interpolates between perfect dependence and independence; and second, the full likelihood \eqref{density} can be efficiently computed in this case using a recursive algorithm \citep{Shi:1995a}, thus allowing us to compare $\hat\theta_{\rm SEM}$ and $\hat\theta$ in high dimensions. Further results for the popular and more realistic, but computationally demanding, spatial max-stable model known as Brown--Resnick model \citep{Kabluchko.etal:2009}, are reported in the Supplementary Material. All simulations presented below and in the Supplementary Material were performed in parallel on the KAUST Cray XC40 supercomputer Shaheen II. We first investigated the performance of the estimator $\hat\theta_{\rm SEM}$ under different scenarios. We considered dimensions $D=2,5,10,20$, with $20$ independent temporal replicates, and $\theta=0.1,\ldots,0.9$ (strong to weak dependence). Setting the initial value to $\theta_0=0.6$, we chose $R=30$ iterations for the Expectation-Maximisation algorithm, averaging the last $5$ iterations, and took $110\times D$ iterations for the underlying Gibbs sampler. Following simulations reported in the Supplementary Material, we discarded the first $10\times D$ iterations as burn-in, and thinned the Markov chain by a factor $D$, in order to keep $N=100$ roughly independent partitions $\pi_i$ to compute \eqref{StEstep}. We repeated the experiment $1024$ times to estimate the bias, ${\rm B}$, standard deviation, ${\rm SD}$, root mean squared error, ${\rm RMSE}=({\rm B}^2+{\rm SD}^2)^{1/2}$, and relative error with respect to the maximum likelihood estimator, ${\rm RE}=E|(\hat\theta_{\rm SEM}-\hat\theta)/\hat\theta|$. Figure~\ref{Fig:results1} reports the results. As expected, the bias is negligible compared to the standard deviation, and the latter decreases with increasing dimension $D$ but increases as the data approach independence ($\theta\to1$). The RMSE (not shown) is almost only determined by the standard deviation. The relative error is always very small (uniformly less than about $0.6\%$), and it decreases for the most part with $D$ and also with $N$ as suggested by further unreported simulations. \begin{figure}[t!] \centering \includegraphics[width=\linewidth]{Results1.pdf} \caption{Performance of the estimator $\hat\theta_{\rm SEM}$: bias (left), standard deviation (middle) and relative error in $\%$ (right), for the logistic model with $\theta=0.1,\ldots,0.9$ in dimension $D=2$ (thinnest black), $5$ (thin red), $10$ (thick green) and $20$ (thickest blue), based on $20$ independent temporal replicates. The number of iterations for the Expectation-Maximisation algorithm was set to $R=30$, averaging the last $5$ iterations, and the number of iterations of the underlying Gibbs sampler was set to $110\times D$ (thinned by a factor $D$, after a burn-in of $10\times D$). The initial value was set to $\theta_0=0.6$.}\label{Fig:results1} \end{figure} We now turn our attention to the computational efficiency of the stochastic Expectation-Maximisation algorithm. Considering dimensions up to $D=100$ under the exact same setting as before, the leftmost panel of Fig.~\ref{Fig:results2} shows that it takes on average $5$--$6$ minutes to compute $\hat\theta_{\rm SEM}$ (on a single core with 2.3GHz) when $D=100$ and $\theta=0.9$. Recall that, according to \citet{Castruccio.etal:2016}, a direct evaluation of the likelihood \eqref{density} is not possible in dimensions greater than $D=12$ or $13$, thus this result is a big improvement over the current existing methods. The computational time appears to be roughly linear with $D$, which is due to the number of iterations of the Gibbs sampler set proportional to $D$. However, for more complex models such as the Brown--Resnick model, the computational time is significantly larger; see the Supplementary Material. Therefore, it makes sense to seek strategies to reduce the computational burden. One possibility is to tune the number of iterations of the stochastic Expectation-Maximisation algorithm. To investigate its speed of convergence, the two middle panels of Fig.~\ref{Fig:results2} show the sample path $r\mapsto \theta_r$ for the logistic model as a function of the iteration $r=1,\ldots,50$, centred by the average over iterations $30$--$50$ for $100$ independent runs in dimension $D=10$. The true values were set to $\theta=0.3$ (second panel) and $0.9$ (third panel), and the initial value was set to $\theta_0=0.6$. The convergence is quite fast when $\theta=0.3$, requiring about $5$ iterations, but when $\theta=0.9$, it takes between $15$ and $25$ iterations. Simulations reported in the Supplementary Material suggest that although the Brown--Resnick has $p=2$ parameters, the number of iterations needed for the algorithm to converge is roughly the same. Another possibility to reduce the computational time is to play with the number of iterations of the underlying Gibbs sampler, which is the main computational bottleneck of this approach. The rightmost panel of Fig.~\ref{Fig:results2} displays estimated parameters in dimension $D=10$ with associated $95\%$ confidence intervals for $\theta=0.3,0.6,0.9$, using $30$ Expectation-Maximisation iterations and $(N+10)\times D$ iterations for the underlying Gibbs sampler with $N=2,5,10,20,50,100,200,500,1000$. Again, we discarded the first $10\times D$ iterations as burn-in and we thinned the resulting chain by a factor $D$. Surprisingly, the distribution of $\hat\theta_{\rm SEM}$ is almost stable for all $N\geq2$, suggesting that the number of Gibbs iterations does not need to be very large for accurate estimation. Overall, significant computational savings can be achieved without any loss of accuracy, by suitably choosing $R$ (Expectation-Maximisation iterations) and $N$ (Gibbs iterations). \begin{figure}[t!] \centering \includegraphics[width=\linewidth]{Results2.pdf} \caption{Left: Computational time for computing $\hat\theta_{\rm SEM}$ for the logistic model, as function of dimension $D$, for $\theta=0.3$ (thin), $0.6$ (medium), $0.9$ (thick). We used $20$ temporal replicates, $30$ Expectation-Maximisation iterations, and $110\times D$ iterations for the underlying Gibbs sampler. Middle panels: parameter values $\theta_r$ as function of iteration $r=1,\ldots,50$, centred by the average over iterations $30$--$50$, for $100$ independent runs in dimension $D=10$. True values were set to $\theta=0.3$ (second panel) and $0.9$ (third panel), and the initial value was set to $\theta_0=0.6$. Right: Mean of estimated parameters $\hat\theta_{\rm SEM}$ (red dots) with $95\%$ confidence intervals for $\theta=0.3,0.6,0.9$, dimension $D=10$, $30$ Expectation-Maximisation iterations, and $(N+10)\times D$ Gibbs sampler iterations with $N=2,5,10,20,50,100,200,500,1000$ (x-axis). In all simulations, we always thinned the underlying Markov chains by a factor $D$ after discarding a burn-in of $10\times D$ iterations.}\label{Fig:results2} \end{figure} \section{Discussion}\label{discussion} To resolve the problem of inference for max-stable distributions and processes, we have proposed a stochastic Expectation-Maximisation algorithm, which does not fix the underlying partition, but instead, treats it as a missing observation, and integrates it out. The beauty of this approach is that it combines statistical and computational efficiency in high dimensions, and it does not suffer from misspecification entailed by lack of convergence of the partition. As a proof of concept, we have validated the methodology by simulation based on the logistic model, and we have shown that in this case it is easy to make inference beyond dimension $D=100$ in just a few minutes. In the Supplementary Material, we have also provided results for the popular Brown--Resnick spatial max-stable model. In this case, our full likelihood inference approach can handle dimensions up to about $D=20$ in a reasonable amount of time. The difficulty resides in the computation of high-dimensional multivariate Gaussian distributions needed for $V$ and $V_{\tau_i}$. Unbiased Monte Carlo estimates of these quantities can be obtained, and \citet{Thibaud.etal:2016} and \citet{deFondeville.Davison:2018} suggest using crude approximations to reduce the computational time while maintaining accuracy; see also \citet{Genton.etal:2018}. Our method is not limited to these two models and could potentially be applied to any max-stable model for which the exponent function $V$ and its partial derivatives $V_{\tau_i}$ are available. The main computational bottleneck of our approach is that we need to generate a Gibbs sampler for each independent temporal replicate of the process. Fortunately, as this setting is embarrassingly parallel, we may thus easily take advantage of available distributed computing resources. Finally, there is a large volume of literature on the stochastic Expectation-Maximisation algorithm, and it might be possible to devise automatic stopping criteria and adaptive schemes for the Gibbs sampler to further speed up the algorithm \citep{Booth.Hobert:1999}. \section*{Supplementary material} Supplementary Material available online includes an alternative derivation of the Stephenson--Tawn likelihood based on a Poisson point process argument using the extremal functions, details on the calculation of the Poisson point process intensity for various max-stable models, details on the underlying Gibbs sampler, and further simulation results for the Brown--Resnick model \newpage
{'timestamp': '2018-07-17T02:01:02', 'yymm': '1703', 'arxiv_id': '1703.08665', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08665'}
arxiv
\section{Navigation Algorithm} In this section, we describe our navigation algorithm. Our algorithmic approach operates in four sequential stages, shown in Fig.~\ref{fig:pipeline}. First, a route is constructed over the space of roads in the environment. Secondly, a \emph{Guiding Path} that follows the current lane is computed that provides input to the collision-avoidance and optimization-based maneuver stages. The collision avoidance stage determines the set of feasible \emph{candidate controls} that represent dynamically feasible, collision-free controls for the vehicle. Finally, a new control is chosen for the vehicle based on the optimization-based maneuver function. \subsection{Route Choice and Behavior State} \label{sec:behavior_state} \begin{figure} \begin{center} \includegraphics[]{figures/FSM.pdf} \end{center} \vspace{-16pt} \caption{ {\bf Finite State Machine:} We highlight different behavior states that are determined by the routing and optimization algorithms. When executing turns, the routing algorithm transitions the behavior state to a turning state. When the optimization-based maneuver algorithm plans a lane change, the behavior state is transitioned to merging. } \label{fig:fsm} \end{figure} Our navigation algorithm performs several steps in a sequential manner. In the first step, a global route for the vehicle to follow to the goal is determined. This step is performed only once unless special conditions (e.g., missing a turn) force the vehicle to recompute a route. The ego-vehicle is provided a connected graph of roads in the environment from a GIS database. Each road in the graph contains information on the number and configuration of lanes in the road and the speed limits. When a destination is chosen, we use A* search to compute the shortest route to the goal and construct a route plan. Each step of the route plan encodes how the vehicle transitions from one road to the next. We denote these as \emph{road-transition maneuvers}. A road-transition maneuver consists of the valid source lanes, valid destination lanes, the position along the road at which the maneuver begins, denoted $\vec{p}_m$, and the behavior implied by the road transition. The set of behaviors includes merging, right turns, left turns, and driving straight. Once the road-change maneuver is completed, the vehicle navigates along the lanes of the new road until the next maneuver node is reached. Lane changes are not encoded in the maneuver nodes, but they are performed implicitly based on the optimization function described in \secref{sec:optimization}. The behavior state of the vehicle is described by a finite-state machine shown in \figref{fig:fsm}. It is used to restrict potential control decisions and adjust the weight of the cost-function for specific maneuvers, such as turning. This allows our algorithm to force the vehicle to be more conservative when performing delicate maneuvers. For example, the valid steering space is constrained in turns to guarantee that the vehicle moves closely along the center line. \subsection{Guiding Path} \label{sec:guiding_trajectory} \begin{figure} \centering \includegraphics[scale=0.8]{figures/arcs_in_3_panel.pdf} \caption{{\bf Guiding Path Computation:} The vehicle computes a guiding path to the center of its current lane based on a circular arc. {\bf (A):} When the vehicle tracks a path off the center of its current lane, the guiding path leads it smoothly back to center. {\bf (B):} In cases where the guiding path represents abrupt changes to heading, the center point is reflected about the axis formed by the car's position and the final waypoint. {\bf (C):} In the case of lane changes, the guiding path is computed by a weighted average of the waypoints on the departure and destination lanes.} \label{fig:arcs} \end{figure} In order to perform trajectory planning, the ego-vehicle computes a set of waypoints along the center-line of its current lane at fixed time intervals, and these waypoints represent the expected positions for a planning horizon, $\tau$. We represent these waypoints as $\vec{w}_1 - \vec{w}_k$. Using its own position, the median point, and the final waypoint ($\vec{p}, \vec{w}_{\frac{k}{2}}, \vec{w}_k$), we compute a circular arc on the road plane which sets the initial target speed and steering, $v'$ and $\phi'$ respectively, and acts as the guiding path for the next planning phase. We use circular arc approximations because they implicitly encode the radius of curvature needed for slip computation making it easy to check whether the dynamic constraints are violated. Absent discontinuities in the center-line of the lane, the guiding arcs exhibit first-order $C^1$ continuity. \Figref{fig:arcs}(a) demonstrates a guiding arc constructed for a sample lane. We constrain the arcs to lie within the first two quadrants of the circle that is represented by three waypoints. In cases when the vehicle's trajectory tracks away from the center of the lane, e.g. during collision avoidance maneuvers, this constraint may be violated as shown in \figref{fig:arcs}(b). In such cases, the point $\vec{w}_{\frac{k}{2}}$ is reflected about the axis formed between $\vec{p}$ and $\vec{w}_k$ to correct the arc angle. In case of lane changing, waypoints are constructed from a weighted average of points sampled ahead on both the departure lane and the destination lane. \Figref{fig:arcs}(c) demonstrates a set of lane-change arcs. Given a guiding path, a target steering, $\phi'$ is computed from \eqnref{eqn:motion:firstorder}. The radius of the arc, $r$, is substituted into \eqnref{eqn:latslip} to determine the maximum safe speed for the current road curvature. A target speed, $v'$, is computed from the minimum value of the current speed limit and the maximum safe speed. The target steering and speed form the basis of the control-obstacle exploration in the subsequent stage. \subsubsection{Traffic Rules} Traffic rules such as stopping at red lights are encoded in our algorithm. When choosing a target speed $v'$, the sensing system is referenced to determine if an intersection is being approached and whether the vehicle needs to stop at the intersection. In cases where the vehicle must stop, the edge of the intersection is used to compute a stopping point and $v'$ is set to the speed that will reach the stopping point at $\tau$ seconds. In case of stoplights, the green light signals $v'$ to return to its original value. In the case of stops with continuous cross-traffic, the vehicle waits until the collision-avoidance algorithm indicates safety. This is accomplished by limiting the potential speed controls the vehicle may choose. When waiting for cross-traffic, the vehicle will stop until its guiding path is determined to be safe. In the case of all-way stops, the vehicle maintains a queue of vehicle arrival order, but defers to other drivers if they enter the intersection out of turn. Although merges are not specifically encoded in transitions in the route plan, the vehicle is able to determine when merging is safe through the collision-avoidance and optimization stages of the algorithm. A merge is note determined safe and appropriate unless it provides collision-free guarantees and respects safety and comfort costs detailed in \secref{sec:optimization}. \subsection{Collision Avoidance} \label{sec:collision_avoidance} We leverage the theory of \emph{Control Obstacles} for collision avoidance~\cite{Bareiss2015}. Control Obstacles construct constraints in the control space and are an extension of acceleration-velocity obstacles~\cite{VanDenBerg2011a}. For each neighbor of the ego-vehicle, $n$, we define the control obstacle for the neighbor as the union of all controls that could lead to collisions with the neighbor within the time horizon, $\tau$. Given t, where $0 \leq t \leq \tau$, the relative position of the ego-vehicle and neighbor $\vec{p}_{en}$ must remain outside the Minkowski Sum given by the formulation, which is defined as \begin{equation} \mc{O}_{en} = \mc{O}_n \oplus -\mc{O}_e. \end{equation} The complete derivation for control obstacles can be found in \cite{Bareiss2015}. In order to adapt to the autonomous vehicles, we modify the original control obstacle formulation \cite{Bareiss2015} in the following manner: (1) We do not assume reciprocity in collision avoidance and the ego-vehicle must take full responsibility for avoiding collisions; (2) We do not assume the control inputs of other vehicles are observable, which is consistent with the first point; (3) We do not assume bounding discs for the neighboring entities, but rather a tight bounding rectangle. The Minkowski Sum for two convex polygons can be computed in linear time in the number of edges; (4) The new feasible control chosen does not correspond to the control that minimizes the deviation from $v'$ and $\phi'$. Rather it is the control that minimizes the objective function defined in \secref{sec:optimization}. The union of all control-obstacles and the set of dynamically infeasible controls form the boundary of the space of collision-free controls for the ego-vehicle. As long as a new control set is chosen from outside the union of the control obstacles, the ego-vehicle will be collision free for the next $\tau$ seconds. In \secref{sec:conclusion}, we detail how behavior prediction models can be incorporated to assume varying levels of reciprocity. This approach is conservative and it is possible that there may be no feasible solution. In that case, we reduce $\tau$ and search for a feasible solution. \subsection{Trajectory Sampling} \label{sec:sampling} Computing the exact boundary of the control obstacle is computationally expensive. Moreover, depending on the choice of $A$ and $\Phi$, the boundary computation will typically not have an analytical solution. In order to ensure that the vehicle can plan within a specific time bound, we use a sampling strategy around $\phi'$ and $v'$ to determine a feasible control that the vehicle will adopt for the next $\tau$ seconds. Each sample is referred to as a \emph{candidate control} and represented as $u_c$. First, the closest collision-free velocity to $v'$ is determined where $\phi = \phi'$ by forward projection. This represents the largest speed the vehicle could take without deviating from the center-line of its lane and is always included in the set of candidates. Next, we compute evenly spaced samples around the point $(v', \phi')$ in the control space. We also choose a set of samples around the prior step solution, $\phi_{t-1}$ and $v_{t-1}$, which allows the vehicle to explore minor deviations in trajectory. Samples near the prior solution facilitate lane-keeping and within-lane avoidance maneuvers. For each neighbor $n \in N$, we compute a set of states for that neighbor for the next $\tau$ seconds by forward integration of $q(X_n, \emptyset, t)$. We assume that the neighboring vehicle will follow its current lane at the current speed and acceleration during this time interval. Otherwise, the neighbor is assumed to move along its current velocity $\vec{v}_n$ with the current observed values of turning and acceleration, $\dot{\theta}$ and $\dot{v}_n$, respectively. For each candidate control, $u_c$, we determine whether \eqnref{eqn:latslip} is violated by the candidate control inputs and immediately discard it if that is the case. If not, the sample points are computed at even time intervals along $0 \leq t \leq \tau$ by forward integration of $q(X_t, u_c, t)$. For each position in time, $\vec{p}_t$, we compute the relative position with each neighboring position at that time and determine if the relative position lies inside the Minkowski Sum. If so, we discard the candidate controls. After all the candidates are evaluated, the new control sequence is chosen by minimizing the objective function described in the subsequent section. \subsection{New Trajectory Computation} \label{sec:optimization} \begin{figure*} \centering \includegraphics[scale=0.8]{figures/Results_4_2.png} \caption{{\bf Results:} {\bf (A) and (B)}: The ego-vehicle is forced to stop as a pedestrian enters the roadway during the {\bf Jaywalking} benchmark due to the proximity costs. Once the pedestrian has moved away, the vehicle resumes its course. {\bf (C) and (D)}: The ego-vehicle approaches a slower moving vehicle from behind. The path and maneuver costs drive the ego-vehicle to plan a lane-change around the slower vehicle. The trajectory of the ego-vehicle is shown in green. {\bf (E)}: The Hatchback ego-vehicle during the {\bf S-Turns} benchmark. The vehicle plans the highest speed it can safely maintain during the tight turns. Each ego-vehicle plans a different safe speed based on their data-driven vehicle dynamics functions. {\bf (F)}: An overview of the {\bf Simulated City} benchmark. The ego-vehicle navigates amongst typical traffic to a set of randomly assigned destinations. {\bf (G)}: The ego-vehicle (outlined in green) yields to an oncoming vehicle (outlined in red) during the {\bf Simulated City} benchmark. Once the vehicle clears the intersection, the ego-vehicle proceeds with a left turn. {\bf (H)}: The ego-vehicle (outlined in green) stops in traffic waiting for a stoplight to change during the {\bf Simulated City} benchmark. } \label{fig:results} \end{figure*} Once a set of suitable control candidates has been computed, the vehicle selects the valid controls that minimize the following cost function at each sample point $i \in I$: \begin{equation} C = \sum_{i=0}^{I} c_{path}(i) + c_{cmft}(i) + c_{mnvr}(i) + c_{prox}(i). \end{equation} This function corresponds to producing paths which are comfortable for passengers, provide safe passing-distances from other vehicles, and respect the constraints of upcoming maneuvers the vehicle must perform. Each term consists of several cost evaluation functions, each with its own weight $e \in W$, which are described in the following sections. \subsubsection{Path Cost} $c_{path}$ encodes costs associated with the vehicle's success at tracking its path and the global route. To compute this cost, we define two points. The target point, $\vec{p}_{tar}$, represents the relative position the vehicle would achieve following the spline defined by its guiding path exactly at $v'$. Given the final sample, we project the vehicle's expected position at the final sample point onto $\vec{p}_{tar}$, which we denote $\vec{p}_{I,tar}$. The path cost is given by: \begin{eqnarray} c_{path} &=& c_{vel} + c_{drift} + c_{prog}\\ c_{vel} &=& (v' - v)^2 \nonumber \\ c_{drift} &=& ||\vec{p} - \vec{l}_p||^2 \nonumber \\ c_{prog} &=& \frac{||p_{tar} - p_{I,tar}||}{||p_{tar}||}\nonumber \end{eqnarray} $c_{vel}$ is the squared difference between desired speed and current speed and $c_{drift}$ is the squared distance between the center line of the vehicle's lane and its current position. If the path crosses a lane boundary, $c_{drift}$ is computed with respect to the new lane. $c_{prog}$ represents the vehicle's desire to maximally progress along its current path. Candidates which reduce progress with respect to the guiding path are penalized. These terms drive the vehicle to choose trajectories that maximally progress the ego-vehicle along its computed route between steps. $c_{prog}$ is only computed at the final sample point. \subsubsection{Comfort Costs} Comfort costs are computed similar to \cite{Ziegler2014b} and penalize motions which are uncomfortable for passengers in the vehicle. $c_{accel}$ penalizes large accelerations and decelerations. $c_{yawr}$ penalizes large heading changes and discourages sharp turning. The comfort costs are given as: \begin{eqnarray} c_{cmft} &=& c_{accel} + c_{yawr} \\ c_{accel} &=& ||\dot{v}_i|| \nonumber \\ c_{yawr} &=& ||\dot{\theta}|| \nonumber \end{eqnarray} \subsubsection{Maneuver Costs} The novel maneuvering cost function discourages lane-changes without excluding them and guides the vehicle to occupy the necessary lane for its next maneuver. The formulation is given as: \begin{eqnarray} c_{mnvr} &=& c_{lane} + c_{mdist} \\ c_{lane} &=& 1 \cdot LaneChanged \nonumber\\ c_{mdist} &=& \frac{1}{\vec{p} - \vec{p}_{m}} \cdot WrongLane \nonumber \end{eqnarray} $LaneChanged$ is a boolean variable representing whether a candidate path crosses a lane boundary. $\vec{p}_{m}$ is the position of the next maneuver change, e.g. the beginning of a right turn. This position is determined by the point of maneuver and starts in the desired lane for the maneuver. $WrongLane$ is a boolean that evaluates to true if the vehicle's lane does not match the lane for the next maneuver. If a candidate control is chosen where for some point $i \in I$, $LaneChanged$ evaluates to true, a lane change behavior is initiated in the finite state machine. \subsubsection{Proximity Costs} While the collision avoidance stage prevents the vehicle from colliding with neighbors, the proximity cost term is designed to prevent the vehicle from passing close to neighboring entities based on the identified type of the neighbor, $T_n$. This cost is represented as a cost distance term with exponential decay based on the relative positions of the ego-vehicle and its neighbor. \begin{eqnarray} c_{prox} = \sum_{n=0}^{N} d(N_{j}, \vec{p}) \\ d(N_n, \vec{p}) = C_{type_{\mc{T}_n}}\cdot e^{-||\vec{p}_n - \vec{p}_e||} \nonumber \end{eqnarray} $C_{type}$ is a per-type constant cost value. $C_{type}$ is larger for pedestrians and bicycles than for vehicles, and guides the ego-vehicle to pass those entities with greater distance. \subsection{Data-driven Vehicle Dynamics Model} \label{subsec:profiling} In order to determine values for $A(v,u_t)$ and $\Phi(\phi, u_s)$, we use a data-driven approach to model the dynamics of the vehicle. For each ego-vehicle, data is collected by driving the vehicle from $v = 0$ to $v = v_{max}$ at the highest possible throttle without loss of traction. Similarly, for braking, the vehicle is decelerated from $v = v_{max}$ to $v = 0$ using the highest braking effort possible without loss of traction. Data is collected at $60$Hz for these values: current speed, acceleration, and throttle/braking values. From these data, piecewise quadratic functions are constructed by least squares fitting to represent the maximum available acceleration and braking given the current vehicle state. These values also define thresholds for the control safety function $S(u, X)$. We determine $\Phi(\phi,u_s)$ by fixing the vehicle's speed and collecting data for instantaneous changes to the steering angle for a given $u_s$. We construct a piecewise quadratic function by least-squares fitting to represent the vehicle's steering dynamics. Having the value of $\mu$ from the sensors, we determine the maximum feasible speed for a given curvature from the centripetal force equation: \begin{equation} \label{eqn:latslip} v = \sqrt{\mu r g} \end{equation} where $r$ is the radius of curvature that is computed from \eqnref{eqn:motion:firstorder}. By substituting \eqnref{eqn:motion:firstorder} into \eqnref{eqn:latslip}, and the angular velocity formula $v = \omega \cdot r$, we can determine feasible steering for a given speed as \begin{equation} \label{eqn:latslip_steering} \phi = tan^{-1}(\frac{(L_f + L_r) \cdot \mu \cdot g)}{v^2}) . \end{equation} Given the generated functions $S$, $A$, and $\Phi$, the future path of the vehicle can be evaluated quickly for planning future controls. \subsection{Control Input} Once a new set of controls is chosen, they are input to the vehicle using a pair of PID controllers. One of the PID controllers drives the current speed to match the target speed. The second PID controller drives the current steering angle to match the target steering angle chosen by the optimization function. By limiting the choice of candidate controls to kinematically and dynamically feasible controls using our data-driven vehicle dynamics model, the PID controllers are sufficient to achieve the desired values. \section{CONCLUSION AND LIMITATIONS} \label{sec:conclusion} \begin{figure} \begin{center} \includegraphics[width=.42\textwidth]{figures/Timing_CostEval.pdf} \end{center} \vspace{-16pt} \caption{ {\bf Cost Function Evaluation Timing:} The computational cost of computing the optimal trajectory for the vehicle varies linearly with the number of collision-free trajectories evaluated. } \label{fig:timing::CostEval} \end{figure} We present, AutonoVi, a navigation algorithm for autonomous vehicles. Our approach uses a data-driven vehicle dynamics model and optimization-based maneuver planning to compute safe, collision free trajectories with dynamic lane changes under typical traffic conditions. We have demonstrated our algorithm on a varied set of vehicles under varying dense and sparse traffic conditions with pedestrians and cyclists. We have also demonstrated that our vehicles follow traffic laws, and utilize both braking and steering simultaneously when avoiding collisions. We highlight many benefits over prior methods in our simulations. Our approach has some limitations. First, though our introduction of the data-driven dynamics functions $A$, $\Phi$, and $S$ generalize to arbitrary levels of underlying dynamics complexity, our current approach requires computing new vehicle dynamics functions for different values of $\mu$. We will address this limitation in future work by learning a transfer function between various road frictions to produce more general data-driven vehicle dynamics functions. In addition, we have assumed perfect sensing in the current technique and it would be useful to take into account sensing errors and uncertainty in our approach. These could be based on relying on predictive behavior models to overcome imperfect state estimations for neighboring entities \cite{Galceran2015,Sun2014}. With prediction, our control obstacles could anticipate levels of reciprocity from predictable vehicles. We will also explore whether the use of circular arcs may is appropriate for vehicles with substantially different geometries, such as trucks pulling large trailers. It is unclear if our kinematic models and data-driven profiles will navigate large vehicles safely. We will also like to incorporate real-world driving patterns and cultural norms to improve our navigation algorithm. This will include choosing optimal weights for the navigation algorithm using available training data. \section{Experimental Evaluation} \label{sec:experiment:setup} In this section, we detail the evaluation scenarios for our navigation algorithm. Each scenario is chosen to test different aspects of the algorithm including response time, safety, and handling different traffic situations. \subsection{Ego-Vehicles} To demonstrate the generality of our approach, we tested each experimental scenario on each of three vehicles. Vehicle 1, the hatchback, has a mass of $1365$~kg, a length of $3.8$m, and a maximum steering angle of $60^\circ$. Vehicle 2, the sports car, has a mass of $1750$~kg, a length of $4.6$m, and a maximum steering angle of $63^\circ$. Vehicle 3, the SUV, has a mass of $1866$~kg, a length of $4.8$m, and a maximum steering angle of $55^\circ$. \subsection{Benchmarks} We conducted a series of simulations with each vehicle representing a variety of the challenging traffic scenarios an ego-vehicle will face while navigating city roads and highways. \textbf{Passing a bicycle}: This scenario involves the ego-vehicle passing a bicycle on a four lane straight road. The vehicle should maintain a safe distance from the bicycle, changing lanes if possible to avoid the cyclist. We perform the evaluation twice, once featuring a vehicle in the adjacent lane preventing the vehicle from moving to avoid the cyclist without first adjusting its speed. \textbf{Jaywalking Pedestrian}: This scenario features a pedestrian stepping into the road in front of the vehicle. The vehicle must react quickly to safely decelerate or stop to avoid the pedestrian. \textbf{Sudden Stop at High Speed}: The vehicle must execute an emergency stop on a highway at high speeds when the vehicle in front of it stops suddenly. We evaluate this scenario in two conditions. First, we evaluate performance with no other traffic aside from the ego-vehicle and stopping vehicle. In this condition, swerving can be performed simply. Secondly, we evaluate this scenario with surrounding traffic, complicating any swerving maneuvers as the vehicle must account for nearby traffic. \textbf{High Density Traffic Approaching a Turn}: This scenario features a four lane road with the ego-vehicle starting in a heavily congested outer lane. The ego-vehicle must make a turn at a stoplight ahead in the outer lane. To make optimal progress, the ego-vehicle must execute a lane change to the inner lane, but must return to the outer lane with sufficient time to execute the turn. \textbf{Car Suddenly entering Roadway}: This scenario demonstrates the ego-vehicle traveling along a straight road at constant speed when a vehicle suddenly enters the roadway ahead of the vehicle and blocks the vehicle's path. The vehicle must decelerate and swerve to avoid colliding with the blocking vehicle. We demonstrate this scenario with the ego-vehicle travelling at 10, 30, and 50 mph and with the blocking vehicle obstructing either the right lane or both lanes. \textbf{S-turns}: We demonstrate the ego-vehicle navigating a set of tight alternating turns, or S turns. Each ego-vehicle computes a different safe speed depending on the specific kinematic and dynamic limits of the vehicle. \textbf{Simulated City}: We demonstrate the ego-vehicle navigating to several key points in a small simulated city. The vehicle must execute lane changes to perform various turns as it obeys traffic laws and navigates to its goals. The vehicle encounters bicycles, pedestrians, and other vehicles as it navigates to its waypoints. \section{Benchmark results} \label{sec:experiment:results} We evaluated our navigation algorithm in these simulated scenarios. The algorithm can avoid tens of vehicles at interactive rates. As expected, the sports-car and the hatchback were able to maintain their preferred speeds more effectively in turns, whereas our SUV was forced to reduce speed. Each of the vehicles was able to pass other vehicles, pedestrians, and bicycles safely. In {\bf Car Suddenly entering Roadway} scenario, we observed a greater tendency to swerve. We did not observe the ego-vehicle colliding with any of the simulated vehicles in traffic. \Figref{fig:results} details some of the interesting behaviors we observed while testing our navigation algorithm. As expected, the ego-vehicle utilizes lane-changes to pass slower vehicles when no traffic is imposing. In traffic, the ego-vehicle slows down until it is safe to pass in the adjoining lane. When interacting with pedestrians, the high proximity cost discourages the vehicle from changing lanes as the pedestrian passes, and the vehicle instead waits until the pedestrian has moved considerably. \subsection{Timing Results} \begin{figure} \begin{center} \includegraphics[width=.42\textwidth]{figures/Timing_CA.pdf} \end{center} \vspace{-16pt} \caption{ {\bf Collision Avoidance Timing:} We detail the relationship between the cost of collision checking for a trajectory and the number of nearby entities considered. We observe a linear relationship between collision checking and number of neighbors.} \label{fig:timing::CA} \end{figure} We collected data from a simulation designed to gradually increase the density of other vehicles encountered by our car. \Figref{fig:timing::CA} demonstrates the relationship between collision avoidance cost for a specific trajectory sample and the number of nearby vehicles and entities. We observe the cost of collision avoidance grows linearly in the number of neighbors. \Figref{fig:timing::CostEval} demonstrates the relationship between the number of trajectories sampled and the computational expense of optimization evaluation. The observed relationship is linear with greater variance than that of collision avoidance computation. The overall computation time for a typical navigation update including guiding path computation, control-obstacle sampling, collision-avoidance and cost evaluation is on the order of milliseconds, typically between 1 and 2 milliseconds. This suggests that the cost of the algorithm is dominated by the optimization time. \section{PROCEDURE FOR PAPER SUBMISSION} \subsection{Selecting a Template (Heading 2)} First, confirm that you have the correct template for your paper size. This template has been tailored for output on the US-letter paper size. It may be used for A4 paper size if the paper size setting is suitably modified. \subsection{Maintaining the Integrity of the Specifications} The template is used to format your paper and style the text. All margins, column widths, line spaces, and text fonts are prescribed; please do not alter them. You may note peculiarities. For example, the head margin in this template measures proportionately more than is customary. This measurement and others are deliberate, using specifications that anticipate your paper as one part of the entire proceedings, and not as an independent document. Please do not revise any of the current designations \section{MATH} Before you begin to format your paper, first write and save the content as a separate text file. Keep your text and graphic files separate until after the text has been formatted and styled. Do not use hard tabs, and limit use of hard returns to only one return at the end of a paragraph. Do not add any kind of pagination anywhere in the paper. Do not number text heads-the template will do that for you. Finally, complete content and organizational editing before formatting. Please take note of the following items when proofreading spelling and grammar: \subsection{Abbreviations and Acronyms} Define abbreviations and acronyms the first time they are used in the text, even after they have been defined in the abstract. Abbreviations such as IEEE, SI, MKS, CGS, sc, dc, and rms do not have to be defined. Do not use abbreviations in the title or heads unless they are unavoidable. \subsection{Units} \begin{itemize} \item Use either SI (MKS) or CGS as primary units. (SI units are encouraged.) English units may be used as secondary units (in parentheses). An exception would be the use of English units as identifiers in trade, such as Ò3.5-inch disk driveÓ. \item Avoid combining SI and CGS units, such as current in amperes and magnetic field in oersteds. This often leads to confusion because equations do not balance dimensionally. If you must use mixed units, clearly state the units for each quantity that you use in an equation. \item Do not mix complete spellings and abbreviations of units: ÒWb/m2Ó or Òwebers per square meterÓ, not Òwebers/m2Ó. Spell out units when they appear in text: Ò. . . a few henriesÓ, not Ò. . . a few HÓ. \item Use a zero before decimal points: Ò0.25Ó, not Ò.25Ó. Use Òcm3Ó, not ÒccÓ. (bullet list) \end{itemize} \subsection{Equations} The equations are an exception to the prescribed specifications of this template. You will need to determine whether or not your equation should be typed using either the Times New Roman or the Symbol font (please no other font). To create multileveled equations, it may be necessary to treat the equation as a graphic and insert it into the text after your paper is styled. Number equations consecutively. Equation numbers, within parentheses, are to position flush right, as in (1), using a right tab stop. To make your equations more compact, you may use the solidus ( / ), the exp function, or appropriate exponents. Italicize Roman symbols for quantities and variables, but not Greek symbols. Use a long dash rather than a hyphen for a minus sign. Punctuate equations with commas or periods when they are part of a sentence, as in $$ \alpha + \beta = \chi \eqno{(1)} $$ Note that the equation is centered using a center tab stop. Be sure that the symbols in your equation have been defined before or immediately following the equation. Use Ò(1)Ó, not ÒEq. (1)Ó or Òequation (1)Ó, except at the beginning of a sentence: ÒEquation (1) is . . .Ó \subsection{Some Common Mistakes} \begin{itemize} \item The word ÒdataÓ is plural, not singular. \item The subscript for the permeability of vacuum ?0, and other common scientific constants, is zero with subscript formatting, not a lowercase letter ÒoÓ. \item In American English, commas, semi-/colons, periods, question and exclamation marks are located within quotation marks only when a complete thought or name is cited, such as a title or full quotation. When quotation marks are used, instead of a bold or italic typeface, to highlight a word or phrase, punctuation should appear outside of the quotation marks. A parenthetical phrase or statement at the end of a sentence is punctuated outside of the closing parenthesis (like this). (A parenthetical sentence is punctuated within the parentheses.) \item A graph within a graph is an ÒinsetÓ, not an ÒinsertÓ. The word alternatively is preferred to the word ÒalternatelyÓ (unless you really mean something that alternates). \item Do not use the word ÒessentiallyÓ to mean ÒapproximatelyÓ or ÒeffectivelyÓ. \item In your paper title, if the words Òthat usesÓ can accurately replace the word ÒusingÓ, capitalize the ÒuÓ; if not, keep using lower-cased. \item Be aware of the different meanings of the homophones ÒaffectÓ and ÒeffectÓ, ÒcomplementÓ and ÒcomplimentÓ, ÒdiscreetÓ and ÒdiscreteÓ, ÒprincipalÓ and ÒprincipleÓ. \item Do not confuse ÒimplyÓ and ÒinferÓ. \item The prefix ÒnonÓ is not a word; it should be joined to the word it modifies, usually without a hyphen. \item There is no period after the ÒetÓ in the Latin abbreviation Òet al.Ó. \item The abbreviation Òi.e.Ó means Òthat isÓ, and the abbreviation Òe.g.Ó means Òfor exampleÓ. \end{itemize} \section{USING THE TEMPLATE} Use this sample document as your LaTeX source file to create your document. Save this file as {\bf root.tex}. You have to make sure to use the cls file that came with this distribution. If you use a different style file, you cannot expect to get required margins. Note also that when you are creating your out PDF file, the source file is only part of the equation. {\it Your \TeX\ $\rightarrow$ PDF filter determines the output file size. Even if you make all the specifications to output a letter file in the source - if your filter is set to produce A4, you will only get A4 output. } It is impossible to account for all possible situation, one would encounter using \TeX. If you are using multiple \TeX\ files you must make sure that the ``MAIN`` source file is called root.tex - this is particularly important if your conference is using PaperPlaza's built in \TeX\ to PDF conversion tool. \subsection{Headings, etc} Text heads organize the topics on a relational, hierarchical basis. For example, the paper title is the primary text head because all subsequent material relates and elaborates on this one topic. If there are two or more sub-topics, the next level head (uppercase Roman numerals) should be used and, conversely, if there are not at least two sub-topics, then no subheads should be introduced. Styles named ÒHeading 1Ó, ÒHeading 2Ó, ÒHeading 3Ó, and ÒHeading 4Ó are prescribed. \subsection{Figures and Tables} Positioning Figures and Tables: Place figures and tables at the top and bottom of columns. Avoid placing them in the middle of columns. Large figures and tables may span across both columns. Figure captions should be below the figures; table heads should appear above the tables. Insert figures and tables after they are cited in the text. Use the abbreviation ÒFig. 1Ó, even at the beginning of a sentence. \begin{table}[h] \caption{An Example of a Table} \label{table_example} \begin{center} \begin{tabular}{|c||c|} \hline One & Two\\ \hline Three & Four\\ \hline \end{tabular} \end{center} \end{table} \begin{figure}[thpb] \centering \framebox{\parbox{3in}{We suggest that you use a text box to insert a graphic (which is ideally a 300 dpi TIFF or EPS file, with all fonts embedded) because, in an document, this method is somewhat more stable than directly inserting a picture. }} \caption{Inductance of oscillation winding on amorphous magnetic core versus DC bias magnetic field} \label{figurelabel} \end{figure} Figure Labels: Use 8 point Times New Roman for Figure labels. Use words rather than symbols or abbreviations when writing Figure axis labels to avoid confusing the reader. As an example, write the quantity ÒMagnetizationÓ, or ÒMagnetization, MÓ, not just ÒMÓ. If including units in the label, present them within parentheses. Do not label axes only with units. In the example, write ÒMagnetization (A/m)Ó or ÒMagnetization {A[m(1)]}Ó, not just ÒA/mÓ. Do not label axes with a ratio of quantities and units. For example, write ÒTemperature (K)Ó, not ÒTemperature/K.Ó \section{CONCLUSIONS} A conclusion section is not required. Although a conclusion may review the main points of the paper, do not replicate the abstract as the conclusion. A conclusion might elaborate on the importance of the work or suggest applications and extensions. \addtolength{\textheight}{-12cm} \section*{APPENDIX} Appendixes should appear before the acknowledgment. \section*{ACKNOWLEDGMENT} The preferred spelling of the word ÒacknowledgmentÓ in America is without an ÒeÓ after the ÒgÓ. Avoid the stilted expression, ÒOne of us (R. B. G.) thanks . . .Ó Instead, try ÒR. B. G. thanksÓ. Put sponsor acknowledgments in the unnumbered footnote on the first page. \section{INTRODUCTION} Autonomous driving is a difficult and extremely complex task that has immense potential for impacting the lives of billions of people. In order to develop autonomous capabilities to perform the driving task, we need appropriate capabilities to sense and predict the traffic and road obstacles, as well as for planning, control, and coordination of the vehicle~\cite{Ziegler2014b,Pendleton2017}. There is considerable research in this area that borrows ideas from different disciplines including computer vision, machine learning, motion planning, mechanical engineering, intelligent traffic simulation, human-factors psychology, etc. Research into sensing and perception technologies has been progressing considerably and current vehicle sensors seem to have the capability to detect relevant obstacles, vehicles, and other traffic entities including bicycles and pedestrians. However, automatic planning in different scenarios and the computation of the appropriate response to vehicle and non-vehicle entities, such as bicycles and pedestrians, are still the subjects of ongoing research. A key issue is the development of an efficient navigation algorithm for autonomous driving that takes into account the vehicle dynamics, sensor inputs, traffic rules and norms, and the driving behaviors of other vehicles. Moreover, the uncertainties in the sensor data, capability, and response of the autonomous vehicle, typically referred to as the {\em ego-vehicle} \cite{Ziegler2014}, have led to the development of behavior and navigation algorithms that impose conservative limits on the acceleration, deceleration, and steering decisions. For example, algorithms tend to limit hazard responses to either steering \cite{Borrelli2005}, \cite{Eidehall2007} or braking \cite{Distner2009}. Few algorithms demonstrate combined control of throttle and steering and typically do so in constrained navigation scenarios \cite{Turri2013}. In terms of planning the routes and navigating the roads, current algorithms tend to limit the lane-changing behaviors, precluding their use for progressing more quickly to a goal or better utilization of the road conditions. These limitations have led to the perception that autonomous cars behave more like student drivers taking their driving test than actual skilled human drivers~\cite{Ziegler2014}. One of the goals is to extend the capabilities of current autonomous vehicles in terms of planning, control, and navigation, making them less conservative but still allowing safe performance during driving. \textbf{Main contributions}: We present a novel navigation algorithm for autonomous vehicles, AutonoVi, which utilizes a data-driven vehicle dynamics model and optimization-based maneuver planning to compute a safe, collision-free trajectory with dynamic lane-changes. Our approach is general, makes no assumption about the traffic conditions, and plans dynamically feasible maneuvers in traffic consisting of other vehicles, cyclists, and pedestrians. In order to develop an autonomous vehicle planning approach with these capabilities, we present four novel algorithms: \begin{itemize} \item {\bf Optimization-based Maneuvering:} We describe a novel multi-objective optimization approach for evaluating the dynamic maneuvers. Our algorithm encodes passenger comfort, safe passing distances, maneuver constraints in terms of dynamics, and global route progress in order to compute appropriate trajectories. \item {\bf Data driven Vehicle Dynamics:} We use a data-driven vehicle dynamics formulation that encodes feasible accelerations, steering rates, and decelerations into a set of per-vehicle profile functions, which can be quickly evaluated. These profiles are generated by simulating the ego-vehicle through a series of trials to obtain lateral and longitudinal slip profiles. This data-driven model generalizes to multiple vehicles and configurations. \item {\bf Collision avoidance with kinematic and dynamic constraints:} We present a collision avoidance algorithm that combines collision-free constraints with specific kinematic and dynamic constraints of the autonomous vehicle. Our approach allows the autonomous vehicle to steer away from collisions with other vehicles, pedestrians, and cyclists as well as to apply brakes, or use a combination of steering and braking. \item {\bf Trajectory Planning with Traffic Rules and Behaviors:} We present a trajectory planning algorithm that encodes traffic rules and road behaviors along with lane-following for computing safe trajectories. Our approach is based on computing arcs along the center-line of the current lane to generate an initial trajectory that satisfies all the constraints. This initial trajectory is computed and refined according to collision avoidance and maneuver optimization computations. \end{itemize} We evaluate our algorithm in a set of traffic scenarios generated using a physics-based traffic simulator in both sparse and dense traffic conditions with tens of other vehicles, pedestrians, and cyclists. We demonstrate collision-avoidance events including a vehicle suddenly driving into the road, traffic suddenly stopping ahead of the ego-vehicle while travelling at high speed, and a pedestrian jaywalking in front of the ego-vehicle, representing typical accident scenarios \cite{Eidehall2007}. Our approach enables advantageous of lane changes (e.g., overtaking) and adherence to traffic rules in typical traffic conditions. It also exhibits safe maneuvering in the presence of heavy traffic, pedestrians, and cyclists. To our knowledge, AutonoVi is the first approach that allows the ego-vehicle to follow an arbitrary route, determine appropriate lane changes dynamically during travel, and plan dynamically and kinematically feasible trajectories while following traffic norms and providing collision avoidance for vehicles, pedestrians, and cyclists. The rest of the paper is organized as follows: we detail relevant related work in section 2. In section 3, we introduce the vehicle kinematic model, define relevant assumptions, and introduce the terminology used in the rest of the paper. In section 4, we present our navigation algorithm, AutonoVi, and its components. We present the details of our simulation benchmarks in \secref{sec:experiment:setup} and highlight the results in \secref{sec:experiment:results}. \section{Problem Space} In this section, we introduce the notation, the kinematic and dynamics model of the car and the state space of the vehicle in terms of both physical configuration and behavior space. \subsection{Vehicle State Space} We represent the kinematic and dynamic constraints of the vehicle separately. In terms of trajectory planning, steering and throttle controls that could lead to skidding or a loss of control are first excluded in our dynamics model (see \secref{subsec:profiling}) and future trajectories are computed according to our vehicle kinematic model described in \eqnref{eqn:motionequations}. We extend the simple-car kinematic model \cite{LaValle2006Book,Laumond98guidelinesin}. The vehicle has three degrees of freedom in a planar coordinate space. These are the position of the center of mass $\vec{p} = (p_x, p_y)$, and the current heading or orientation $\theta$. We represent the speed of the vehicle as $v$ and steering as $\phi$. $L_f$ and $L_r$ represent the distance from the center of mass to the front and rear axles, respectively. The geometry of the ego-vehicle is represented as $\mathcal{O}_e$. The vehicle has two degrees of control, throttle ($u_t$) and steering ($u_\phi$). We define throttle $-1 \leq u_t \leq 1$, where $-1$ indicates maximum braking effort for the vehicle and $1$ represents maximum throttle. $-1 \leq\ u_\phi \leq 1$ describes the steering effort from $-\phi_{max}$ to $\phi_{max}$. We also use acceleration and steering functions, $A(v, u_t)$ and $\Phi(v, u_s)$, respectively, which describe the relationship between the vehicle's speed, steering, and control inputs and its potential for changes in the acceleration and steering (see \secref{subsec:profiling}). $A$ and $\Phi$ can be chosen to be constants in the simplest model, or may be represented using complex functions corresponding to tire dynamics and load transfer. We describe our choice for $A$ and $\Phi$ in \secref{subsec:profiling}. The vehicle's motion can be described by: \begin{subequations}\label{eqn:motionequations} \begin{align} \dot{p}_x &= v\cos(\theta) & \dot{p}_y &= v\sin(\theta) & \dot{\theta} &= \frac{\tan(\phi)}{L_f + L_r}v\label{eqn:motion:firstorder} \\ \dot{v} &= A(v, u_t) & \dot{\phi} &= \Phi(\phi, u_s) \label{eqn:motion:secondorder} \end{align} \end{subequations} In addition to the physical state of the vehicle, we describe its behavior $b$ as a label from a set of all behaviors $\mc{B}$, such as driving straight, turning left, merging right, etc. The behavior state is used to modify parameters of each stage of the algorithm. Each behavior state can encode a set of weights of the maneuver optimization function, bias the generation of a guiding path, and adjust the sampling bias of our control-obstacle approximation and acceleration when necessary (see \secref{sec:behavior_state}). The full state of a vehicle is defined as $X_e = \{p_x, p_y, v, \phi, u_t, u_\phi, b\}$. The vehicle updates its plan at a fixed planning rate $\Delta t$. At each planning step, the vehicle computes a target speed $v'$ and target steering $\phi'$ to be achieved by the control system. We refer to \eqnref{eqn:motionequations} compactly as the \emph{state evolution function} $X_{t+\Delta t} = q(X_t, u, t)$. We also define a function $S(u, X)$ which determines if a set of controls is feasible. Given the current state of the vehicle, $S(u, X)$ will return false if the given input $u$ will cause a loss of traction or control. We describe this function further in \secref{subsec:profiling}. \subsection{Sensing and Perception} We assume a sensing module is available for the vehicle that is capable of providing information regarding the surrounding environment. For each lane on a road, the sensing module provides an approximation of the center line of the lane, $l$. The sensing module also provides the closest point on the lane center to the ego-vehicle, $\vec{l}_p$, and a reasonable value of the friction coefficient $\mu$. Recent work has presented approaches to evaluate $\mu$ from sensor data \cite{Gustafsson1997}. Our navigation algorithm utilizes the set of nearby vehicles, pedestrians, bicycles, or other obstacles, collectively referred to as neighbors, $N$ within the sensing range. For each neighbor $n \in N$, the sensing system provides the neighbor's shape, $\mathcal{O}_n$, position, $\vec{p}_n$, and velocity $\vec{v}_n$. Moreover, the sensing module provides the lane $l_n$, acceleration $\dot{v}_n$, and rate of turn, $\dot{\theta}$ for the neighbor. We define a set of neighbor types, $\mc{T}_n$, including vehicle, pedestrian, cyclist, and obstruction. Each neighbor is assigned a type $\mc{T}_n$ corresponding to the detected neighbor type. The complete state of a neighbor is denoted as $X_n = \{\vec{p}_n, \vec{v}_n, l_n, \dot{v}_n, \dot{\theta}_n\}$ \section{RELATED WORK} The problem of autonomous driving has been widely studied in robotics, computer vision, intelligent transportation systems and related areas. In this section, we give a brief overview of prior methods which address motion planning and navigation, dynamics, behavior generation, and collision avoidance. More detailed surveys are given in~\cite{Pendleton2017,Katrakazas2015,Saifuzzaman2014}. \textbf{Vehicle Kinematics and Dynamics Modeling}: A number of approaches have been developed to model the motion of a moving vehicle. Different models offer a trade-off between simplicity or efficiency of the approach, and physical accuracy. Simpler models are typically based on linear dynamics and analytical solutions to the equations of motion~\cite{LaValle2006Book}. More accurate models provide a better representation of the physical motion, but require more computational power to evaluate and incorporate non-linear forces in the vehicle dynamics~\cite{Borrelli2005}. The Reeds-Shepp formulation is a widely used car model with forward and backward gears~\cite{Reeds1990}. Margolis and Asgari~\cite{Margolis1991} present several representations of a car including the widely used single-track bicycle model. Borrelli et al.~\cite{Borrelli2005} extend this model by including detailed tire-forces. Current planning and control algorithms leverage varying levels of detail in the model of the vehicle. \textbf{Path Planning and Collision Avoidance}: Prior approaches to path planning for autonomous vehicles are based on occupancy grids \cite{Kolski2006}, random-exploration~\cite{Kuwata2009}, driving corridors~\cite{Hardy2013}, potential-field methods~\cite{Galceran2015a}, etc. Recent approaches seek to incorporate driver behavior prediction in path planning using game-theoretic approaches~\cite{Sadigh2016} and Bayesian behavior modeling~\cite{Galceran2015}. In addition, a variety of algorithms have been proposed for planning paths for automobiles for navigation outside of road conditions and traffic rules ~\cite{Ziegler2008}. Several techniques have been proposed to specifically avoid hazards while remaining in a target lane. These techniques can be coupled with a path planner to avoid vehicles \cite{Fritz2004} and other hazards in the ego-vehicle's lane \cite{Turri2013}. Many continuous approaches for collision-avoidance have been proposed based on spatial decomposition or velocity-space reasoning. Berg et al.~\cite{VanDenBerg2011a} apply velocity-space reasoning with acceleration constraints to generate safe and collision-free velocities. Bareiss et al.~\cite{Bareiss2015} extend the concept of velocity obstacles into the control space to generate a complete set of collision free control inputs. Ziegler et al.~\cite{Ziegler2014b} utilize polygonal decomposition of obstacles to generate blockages in continuous driving corridors. Sun et al.~\cite{Sun2014} demonstrate the use of prediction functions and trajectory set generation to plan safe lane-changes. \textbf{Modeling Traffic Rules}: Aside from planning the appropriate paths to avoid collisions, autonomous vehicles must also follow applicable laws and traffic norms. Techniques have been proposed to simulate typical traffic behaviors in traffic simulation such as Human Driver Model \cite{Treiber2006} and data-driven models such as \cite{Hidas2005}. An extensive discussion on techniques to model these behaviors in traffic simulation can be found in \cite{Chen2010}. \begin{figure*} \centering \includegraphics{figures/pipeline.pdf} \caption{{\bf Algorithm Pipeline:} Our autonomous vehicle planning algorithm operates in several sequential steps. First, a route is planned using graph-search over the network of roads. Secondly, traffic and lane-following rules are combined to create a guiding trajectory for the vehicle for the next planning phase. This guiding trajectory is transformed to generate a set of candidate control inputs. These controls are evaluated for dynamic feasibility using our data driven vehicle dynamics modeling and collision-free navigation via extended control obstacles. Those remaining trajectories are evaluated using our optimization technique to determine the most-appropriate set of controls for the next execution cycle.} \label{fig:pipeline} \vspace*{-0.1in} \end{figure*} \textbf{Autonomous Driving Systems}: Many autonomous systems have been demonstrated that are able to navigate an autonomous vehicle in traffic along a specific route. Ziegler et al.~\cite{Ziegler2014} demonstrated an autonomous vehicle which drove the historic Bertha Benz route in southern Germany. They use a conservative navigation approach, which specifically encodes {\em lanelets} for lane changing and does not account for dynamic lane changes. In contrast, our algorithm allows the vehicle to change lanes when our maneuver optimization method deems it appropriate and does not rely on pre-encoded changes. Geiger et al.~\cite{Geiger2012} demonstrate a planning and control framework that won the Grand Cooperative Driving Challenge in 2011. This vehicle was designed for platooning and employed controls over acceleration only. Our navigation algorithm plans maneuvers using both steering and acceleration to operate in more generic traffic scenarios. The DARPA Urban Grand Challenge included a number of autonomous vehicle navigating examples of driving scenarios~\cite{Urmson2009,Bacha2008}. While overtaking was allowed as an intended capability in these systems, the vehicles were not evaluated in dense, high-speed traffic conditions where the benefits of lane changes could be demonstrated.
{'timestamp': '2017-03-30T02:10:19', 'yymm': '1703', 'arxiv_id': '1703.08561', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08561'}
arxiv
\section{Introduction} \label{sec:intro} Sequence-to-sequence models were recently introduced as a powerful new method for translation \cite{bahdanau2014neural, sutskever2014sequence}. Subsequently, the model has been adapted and applied to various tasks such as image captioning \cite{vinyals2015show,xu2015show}, pose prediction \cite{gkioxari2016chained}, and syntactic parsing \cite{vinyals2015grammar}. It has also led to a new state of the art in Neural Machine Translation (NMT) \cite{wu2016google}. The model has also recently achieved promising results on automatic speech recognition (ASR) even without the use of language models \cite{chorowski2015attention,chan2016listen, zhang2016very,chorowski16towards}. These successes have only been possible because the sequence-to-sequence (seq2seq) models can accurately model very complicated probability distributions. This makes it possible to apply this model even in situations where a precise analytical model is difficult to intuit. In this paper we show that a single sequence-to-sequence model is powerful enough to translate audio in one language directly into text in another language. Using a model similar to Listen Attend and Spell (LAS) \cite{chan2016listen,zhang2016very} we process log mel filterbank input features using a recurrent encoder. The encoder features are then used, along with an attention model, to build a conditional next-step prediction model for text in the target domain. Unlike LAS, however, we use the text in the translated domain as the target -- the source language text is not used. Conventionally, this task is performed by pipelining results from an ASR system trained on the source language with a machine translation (MT) system trained to translate text from the source language to text in the target language. However, we motivate an end-to-end approach from several different angles. First, by virtue of being an \emph{end-to-end} model, all the parameters are jointly adjusted to optimize the results on the final goal. Training separate speech recognition and translation models may lead to a situation where models perform well individually, but do not work well together because their error surfaces do not compose well. For example typical errors in the ASR system may be such that they exacerbate the errors of the translation model which has not been trained to see such errors in the \emph{input} during training. Another advantage of an end-to-end model is that, during inference, a single model can have lower latency compared to a cascade of two independent models. Additionally, end-to-end models have advantages in low resource settings since they can directly make use of corpora where the audio is in one language while the transcript is in another. This can arise, for example, in videos that have been captioned in other languages. It can also reduce labeling budgets since speech would only need to be transcribed in one language. In extreme cases where the source language does not have a writing system, applying a separate ASR system would require first standardizing the writing system -- a very significant undertaking~\cite{bird2014collecting,anastasopoulos2016unsupervised}. We make several interesting observations from experiments on conversational Spanish to English speech translation. As with LAS models, we find that the model performs surprisingly well without using independent language models in either the source or target language. While the model performs well without seeing source language transcripts during training, we find that we can leverage them in a multi-task setting to improve performance. Finally we show that the end-to-end model outperforms a cascade of independent % seq2seq ASR and NMT models. \section{Related work} Early work on \emph{speech translation} (ST) \cite{casacuberta2008recent} -- translating audio in one language into text in another -- used lattices from an ASR system as inputs to translation models \cite{ney1999speech,matusov2005integration}, giving the translation model access to the speech recognition uncertainty. Alternative approaches explicitly integrated acoustic and translation models using a stochastic finite-state transducer which can decode the translated text directly using Viterbi search \cite{vidal1997finite,casacuberta2004some}. In this paper we compare our integrated model to results obtained from cascaded models on a Spanish to English speech translation task \cite{post2013improved,kumar2014some,kumar2015coarse}. These approaches also use ASR lattices as MT inputs. Post et al.\xspace \cite{post2013improved} used a GMM-HMM % ASR system. Kumar et al.\xspace \cite{kumar2014some} later showed that using a better ASR model improved overall ST results. Subsequently \cite{kumar2015coarse} showed that modeling features at the boundary of the ASR and the MT system can further improve performance. We carry this notion much further by defining an end-to-end model for the entire task. Other recent work on speech translation does not use ASR. % Instead \cite{bansal2017towards} used an unsupervised model to cluster repeated audio patterns which are used to train a bag of words translation model. In \cite{duong2016attentional} seq2seq models were used to align speech with translated text, but not to directly predict the translations. Our work is most similar to \cite{berard2016listen} which uses a LAS-like model for ST on data synthesized using a text-to-speech system. In contrast, % we train on a much larger corpus composed of real speech. \section{Sequence-to-sequence model} \label{sec:model} We utilize a sequence-to-sequence with attention architecture similar to that described in \cite{bahdanau2014neural}. The model is composed of three jointly trained neural networks: a recurrent \emph{encoder} which transforms a sequence of input feature frames $x_{1..T}$ into a sequence of hidden activations, $h_{1..L}$, optionally at a slower time scale: \begin{equation} h_l = \text{enc}(x_{1..T}) \end{equation} The full encoded input sequence $h_{1..L}$ is consumed by a \emph{decoder} network which emits a sequence of output tokens, $y_{1..K}$, via next step prediction: emitting one output token (e.g.\xspace word or character) per step, conditioned on the token emitted at the previous time step as well as the entire encoded input sequence: \begin{equation} y_k = \text{dec}(y_{k-1}, h_{1..L}) \end{equation} The $\text{dec}$ function is implemented as a stacked recurrent neural network with $D$ layers, which can be expanded as follows: \begin{align} o^1_k,\, s^1_k &= d^1(y_{k-1}, s^1_{k-1}, c_{k-1}) \\ o^n_{k},\, s^n_k &= d^n(o^{n-1}_k, s^n_{k-1}, c_k) \end{align} where $d^n$ is a long short-term memory (LSTM) cell \cite{hochreiter1997long}, which emits an output vector $o^n$ into the following layer, and updates its internal state $s^n$ at each time step. The decoder's dependence on the input is mediated through an \emph{attention} network which summarizes the entire input sequence as a fixed dimensional context vector $c_k$ which is passed to all subsequent layers using skip connections. $c_k$ is computed from the first decoder layer output at each output step $k$: \begin{align} c_k &= {\textstyle\sum_l}\; \alpha_{kl} h_l \\ \alpha_{kl} &= \text{softmax}(a_e(h_l)^T a_d(o^1_k)) \label{eq:attention} \end{align} where $a_e$ and $a_d$ are small fully connected networks. The $\alpha_{kl}$ probabilities compute a soft alignment between the input and output sequences. An example is shown in Figure~\ref{fig:attention}. Finally, an output symbol is sampled from a multinomial distribution computed from the final decoder layer output: % \begin{align} y_k &\sim \text{softmax}(W_y [o^D_k, c_k] + b_y) \end{align} \subsection{Speech model} \label{sec:speech_model} We train seq2seq models for both end-to-end speech translation, and a baseline model for speech recognition. We found that the same architecture, a variation of that from \cite{zhang2016very}, works well for both tasks. We use 80 channel log mel filterbank features extracted from 25ms windows with a hop size of 10ms, stacked with delta and delta-delta features. The output softmax of all models predicts one of 90 symbols, described in detail in Section~\ref{sec:experiments}, that includes English and Spanish lowercase letters. The encoder is composed of a total of 8 layers. The input features are organized as a $T \times 80 \times 3$ tensor, i.e. raw features, deltas, and delta-deltas are concatenated along the 'depth' dimension. This is passed into a stack of two convolutional layers with ReLU activations, each consisting of 32 kernels with shape $3 \times 3 \times \text{depth}$ in time $\times$ frequency. These are both strided by $2 \times 2$, downsampling the sequence in time by a total factor of 4, decreasing the computation performed in the following layers. Batch normalization \cite{ioffe2015batch} is applied after each layer. This downsampled feature sequence is then passed into a single bidirectional convolutional LSTM \cite{xingjian2015convolutional,bogun2015convlstm,zhang2016very} layer using a $1 \times 3$ filter (i.e. convolving only across the frequency dimension within each time step). Finally, this is passed into a stack of three bidirectional LSTM layers of size 256 in each direction, interleaved with a 512-dimensional linear projection, followed by batch normalization and a ReLU activation, to compute the final 512-dimensional encoder representation, $h_l$. The decoder input is created by concatenating a 64-dimensional embedding for $y_{k-1}$, the symbol emitted at the previous time step, and the 512-dimensional attention context vector $c_k$. The networks $a_e$ and $a_d$ used to compute $c_k$ (see equation~\ref{eq:attention}) each contain a single hidden layer with 128 units. This is passed into a stack of four unidirectional LSTM layers with 256 units. Finally the concatenation of the attention context and LSTM output is passed into a softmax layer which predicts the probability of emitting each symbol in the output vocabulary. The network contains 9.8m parameters. We implement it with TensorFlow \cite{abadi2016tensorflow} and train using teacher forcing on minibatches of 64 utterances. We use asynchronous stochastic gradient descent across 10 replicas using the Adam optimizer \cite{kingma2014adam} with $\beta_1= 0.9$, $\beta_2 = 0.999$, and $\epsilon = 10^{-6}$. The initial learning rate is set to $10^{-3}$ and decayed by a factor of 10 after 1m steps. L2 weight decay is used with a weight of $10^{-6}$, and beginning from step 20k, Gaussian weight noise with std of 0.125 is added to all LSTM weights and decoder embeddings. We tuned all hyperparameters to maximize performance on the Fisher/dev\xspace set. We decode using beam search with rank pruning at 8 hypotheses and a beam width of 3, using the scoring function proposed in \cite{wu2016google}. We do not utilize any language models. For the baseline ASR model we found that neither length normalization nor the coverage penalty from \cite{wu2016google} were needed, however it was helpful to permit emitting the end-of-sequence token only when its log-probability was % 3.0 greater than the next most probable token. For speech translation we found that using length normalization of 0.6 improved performance by 0.6 BLEU points. \subsection{Neural machine translation model} We also train a baseline seq2seq text machine translation model following \cite{wu2016google}. To reduce overfitting on the small training corpus we significantly reduce the model size compared to those in \cite{wu2016google}. The encoder network consists of four encoder layers (5 LSTM layers in total). As in the base architecture, the bottom layer is a bidirectional LSTM and the remaining layers are all unidirectional. The decoder network consists of 4 stacked LSTM layers. All encoder and decoder LSTM layers contain 512 units. The attention network uses a single hidden layer with 512 units. We use the same character-level vocabulary for input and output as the speech model described above emits. As in \cite{wu2016google} we apply dropout \cite{srivastava2014dropout} with probability 0.2 during training to reduce overfitting. We train using SGD with a single replica. Training converges after about 100k steps using minibatches of 128 sentence pairs. \subsection{Multi-task training} \begin{figure*}[t] \centering \vskip-3ex \subfloat[Spanish speech recognition decoder attention.]{ % \includegraphics[height=0.33\paperheight] {attention_multitask_asr} \label{fig:attention-asr}} \hfill \subfloat[Spanish-to-English speech translation decoder attention.]{ % \includegraphics[height=0.33\paperheight] {attention_multitask_ast} \label{fig:attention-ast}} \caption{Example attention probabilities $\alpha_{kl}$ from a multi-task model with two decoders. % % % The ASR attention is roughly monotonic, whereas the translation attention contains an example of word reordering typical of seq2seq MT models, attending primarily to frames $l=58-70$ while emitting ``living here''. The recognition decoder attends to these frames while emitting the corresponding Spanish phrase ``vive aqui''. % The ASR decoder is also more confident than the translation attention, which tends to be smoothed out across many input frames for each output token. % This is a consequence of the ambiguous mapping between Spanish sounds and English translation. % % % % % % % % % % } \label{fig:attention} \end{figure*} Supervision from source language transcripts can be incorporated into the speech translation model by co-training an auxiliary model with shared parameters, e.g.\xspace an ASR model using a common encoder. This is equivalent to a multi-task configuration \cite{luong2015multi}. We use the models and training protocols described above with these modifications: we use 16 workers that randomly select a model to optimize at each step, we introduce weight noise after 30k steps, and decay the learning rate after 1.5m overall steps. \section{Experiments} \label{sec:experiments} We conduct experiments on the Spanish Fisher and Callhome corpora of telephone conversations augmented with English translations % from \cite{post2013improved}. We split training utterances according to the provided segment annotations and preprocess the Spanish transcriptions and English translations by lowercasing and removing punctuation. All models use a common set of 90 tokens to represent Spanish and English characters, containing lowercase letters from both alphabets, digits 0-9, space, punctuation marks,\footnote{Most are not used in practice since we remove punctuation aside from apostrophes from the training targets.} as well as special start-of-, end-of-sequence, and unknown tokens. % Following \cite{post2013improved,kumar2014some,kumar2015coarse}, we train all models on the 163 hour Fisher train set, and tune hyperparameters % on Fisher/dev\xspace. We report speech recognition results as word error rates (WER) and translation results using BLEU \cite{papineni2002bleu} scores computed with the Moses toolkit\footnote{\url{http://www.statmt.org/moses/}} \texttt{multi-bleu.pl} script, both on lowercase reference text after removing punctuation. We use the 4 provided Fisher reference translations and a single reference for Callhome. \subsection{Tuning decoder depth}% \begin{table}[t] \caption{Varying number of decoder layers in the speech translation model. BLEU score on the Fisher/dev\xspace set.} \label{tbl:vary_ast_decoder} \centering \begin{tabular}{ccccc} \toprule \multicolumn{5}{c}{Num decoder layers $D$} \\ 1 & 2 & 3 & 4 & 5 \\ \midrule 43.8 & 45.1 & 45.2 & 45.5 & 45.3 \\ \bottomrule \end{tabular} \end{table} It is common for ASR seq2seq models to use a shallow decoder, generally comprised of one recurrent layer \cite{chorowski2015attention,chan2016listen,zhang2016very}. In contrast, seq2seq NMT models often use much deeper decoders, e.g.\xspace 8 layers in \cite{wu2016google}. In analogy to a traditional ASR system, one may think of the seq2seq encoder behaving as the acoustic model while the decoder acts as the language model. The additional complexity of the translation task when compared to monolingual language modeling motivates the use of a higher capacity decoder network. We therefore experiment with varying the depth of the stack of LSTM layers used in the decoder for speech translation and find that performance improves as the decoder depth increases up to four layers, see Table~\ref{tbl:vary_ast_decoder}. Despite this intuition, we obtained similar improvements in performance on the ASR task when increasing decoder depth, suggesting that tuning the decoder architecture is worth further investigation in other speech settings. \subsection{Tuning the multi-task model} We compare two multi-task training strategies: one-to-many in which an \emph{encoder} is shared between speech translation and recognition tasks, and many-to-one in which a \emph{decoder} is shared between speech and text translation tasks. We found the first strategy to perform better. % We also found that performing updates more often on the speech translation task yields the best results. Specifically, we perform $75\%$ of training steps on the core speech translation task, and the remainder on the auxiliary ASR task. \begin{table}[t] \caption{Varying the number of shared encoder LSTM layers in the multi-task setting. BLEU score on the Fisher/dev\xspace set.} \label{tbl:mt_sharing} \centering \begin{tabular}{ccccc} \toprule \multicolumn{4}{c}{Num shared encoder LSTM layers} \\ 3 (all) & 2 & 1 & 0 \\ \midrule 46.2 & 45.1 & 45.3 & 44.2 \\ \bottomrule \end{tabular} \end{table} Finally, we vary how much of the encoder network parameters are shared across tasks. Intuitively we expect that layers near the input will be less sensitive to the final classification task, so we always share all encoder layers through the conv LSTM but vary the amount of sharing in the final stack of LSTM layers. As shown in Table~\ref{tbl:mt_sharing} we found that sharing all layers of the encoder yields the best performance. This suggests that the encoder learns to transform speech into a consistent interlingual subword unit representation, which the respective decoders are able to assemble into phrases in either language. \subsection{Baseline models}% \begin{table}[t] \caption{Speech recognition model performance in WER.} \label{tbl:asr_results} \centering \begin{tabular}{lccc@{\hskip1em}c@{\hskip1ex}c} \toprule % & \multicolumn{3}{c}{Fisher} & \multicolumn{2}{c}{Callhome} \\ & dev & dev2 & test & devtest & evltest \\ \midrule % Ours\tablefootnote{\label{note:average}Averaged over three runs.} & 25.7 & 25.1 & 23.2 & 44.5 & 45.3 \\ % % Post et al.\xspace \cite{post2013improved} & 41.3 & 40.0 & 36.5 & 64.7 & 65.3 \\ Kumar et al.\xspace \cite{kumar2015coarse} & 29.8 & 29.8 & 25.3 & -- & -- \\ \bottomrule \end{tabular} \end{table} \begin{table}[t] \caption{Translation BLEU score on ground truth % transcripts.} \label{tbl:mt_results} \centering \begin{tabular}{lccc@{\hskip1em}c@{\hskip1ex}c} \toprule & \multicolumn{3}{c}{Fisher} & \multicolumn{2}{c}{Callhome} \\ & dev & dev2 & test & devtest & evltest \\ \midrule % % % % % Ours & 58.7 & 59.9 & 57.9 & 28.2 & 27.9 \\ Post et al.\xspace \cite{post2013improved} & -- & -- & 58.7 & -- & 27.8 \\ Kumar et al.\xspace \cite{kumar2015coarse} % & -- & 65.4 & 62.9 & -- & -- \\ \bottomrule \end{tabular} \end{table} We construct a baseline % cascade of a Spanish ASR seq2seq model whose output is passed into a Spanish to English NMT model. Our seq2seq ASR model attains state-of-the-art performance on the Fisher and Callhome datasets compared to previously reported results with HMM-GMM \cite{post2013improved} and DNN-HMM \cite{kumar2015coarse} systems, as shown in Table~\ref{tbl:asr_results}. Performance on the Fisher task is significantly better than on Callhome since it contains more formal speech, consisting of conversations between strangers while Callhome conversations were often between family members. In contrast, our MT model slightly underperforms compared to previously reported results using phrase-based translation systems \cite{post2013improved,kumar2014some,kumar2015coarse} as shown in Table~\ref{tbl:mt_results}. This may be because the amount of training data in the Fisher corpus is much smaller than is typically used for training NMT systems. Additionally, our models used characters as training targets instead of word- and phrase-level tokens often used in machine translation systems, making them more vulnerable to e.g.\xspace spelling errors. \subsection{Speech translation} \begin{table}[t] \caption{Speech translation model performance in BLEU score.} \label{tbl:st_results} \centering \begin{tabular}{l@{\hskip1ex}ccc@{\hskip1.5ex}c@{\hskip1ex}c} \toprule & \multicolumn{3}{c}{Fisher} & \multicolumn{2}{c}{Callhome} \\ Model & dev & dev2 & test & devtest & evltest \\ \midrule End-to-end ST\textsuperscript{\ref{note:average}} % % & 46.5 & 47.3 & 47.3 & 16.4 & 16.6 \\ % % % % % % Multi-task ST / ASR\textsuperscript{\ref{note:average}} % % & 48.3 & 49.1 & 48.7 & 16.8 & 17.4 \\ % % % % \midrule ASR$\rightarrow$NMT cascade\textsuperscript{\ref{note:average}} % % % % % % & 45.1 & 46.1 & 45.5 & 16.2 & 16.6 \\ % % Post et al.\xspace \cite{post2013improved} & -- & 35.4 & -- & -- & 11.7 \\ Kumar et al.\xspace \cite{kumar2015coarse} & -- & 40.1 & 40.4 & -- & -- \\ \bottomrule \end{tabular} \end{table} Table~\ref{tbl:st_results} compares performance of different systems on the full speech translation task. Despite not having access to source language transcripts at any stage of the training, the end-to-end model outperforms the baseline cascade, which passes the 1-best Spanish ASR output into the NMT model, by about 1.8 BLEU points on the Fisher/test\xspace set. We obtain an additional improvement of 1.4 BLEU points or more on all Fisher datasets in the multi-task configuration, in which the Spanish transcripts are used for additional supervision by sharing a single encoder sub-network across independent ASR and ST decoders. The ASR model converged after four days of training (1.5m steps), while the ST and multitask models continued to improve, with the final 1.2 BLEU point improvement taking two more weeks. Informal inspection of cascade system outputs yields many examples of compounding errors, where the ASR model makes an insertion or deletion that significantly alters the meaning of the sentence and the NMT model has no way to recover. This illustrates a key advantage of the end-to-end approach where the translation decoder can access the full latent representation of the speech without first collapsing to an n-best list of hypotheses. A large performance gap of about 10 BLEU points remains between these results and those from Table~\ref{tbl:mt_results} which assume perfect ASR, indicating significant room for improvement in the % acoustic modeling component of the speech translation task. \section{Conclusion} \label{sec:conclusion} We present a model that directly translates speech into text in a different language. One of its striking characteristics is that its architecture is essentially the same as that of an attention-based ASR neural system. Direct speech-to-text translation happens in the same computational footprint as speech recognition -- the ASR and end-to-end ST models have the same number of parameters, and utilize the same decoding algorithm -- narrow beam search. The end-to-end trained model outperforms an ASR-MT cascade even though it never explicitly searches over transcriptions in the source language during decoding. While we can interpret the proposed model's encoder and decoder networks, respectively, as acoustic and translation models, it does not have an explicit concept of source transcription. The two sub-networks exchange information as abstract high-dimensional real valued vectors rather than discrete transcription lattices as in traditional systems. In fact, reading out transcriptions in the source language from this abstract representation requires a separate decoder network. We find that jointly training decoder networks for multiple languages regularizes the encoder and improves overall speech translation performance. An interesting extension would be to construct a multilingual speech translation system following \cite{johnson2016google} in which a single decoder is shared across multiple languages, passing a discrete input token into the network to select the desired output language. \bibliographystyle{IEEEtran}
{'timestamp': '2017-06-13T02:11:02', 'yymm': '1703', 'arxiv_id': '1703.08581', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08581'}
arxiv
\section{Introduction} The new emerging concept of smart cities applies concepts from the Internet of Things (IoT) to the management of diverse municipal infrastructure and assets~\citep{zanella2014internet}. Smart cities will involve large numbers of IoT devices installed in a range of settings from individual homes to critical infrastructure, potentially in a very dense deployment. As a result, their feasibility will require advances in efficiency and scalability of IoT communications. Additionally, smart cities will require strong guarantees of security: networked devices will handle large volumes of sensitive information and control valuable assets such as utility infrastructure, thus widening the attack surface for potential compromise. Thus, strong end-to-end security and privacy mechanisms between smart devices and the cloud are imperative. Recent literature suggests that Information-Centric Networking (ICN) is a more appropriate approach than Internet Protocol (IP) for IoT~\citep{baccelli2014information}. Named Data Networking (NDN)~\citep{zhang2010named}, in particular, is a strong architecture for creating scalable and efficient smart city networks, by employing features such as stateful forwarding and in-network caching. In addition, it offers security benefits such as enforced provenance through mandatory network-layer signatures. Several ICN-based IoT deployments have been announced in the literature, however no holistic NDN of Things (NDNoT) architecture and protocol suite has yet been proposed. In particular, existing literature tends to neglect concerns related to secure routing and onboarding, two of the most difficult problems in IoT. Works that do address routing or onboarding do so separately, neglecting the fact that they are closely coupled. As a result, the proposed disjoint schemes are either incompatible or inefficient when combined. Therefore, we propose in this paper a scalable and secure framework addressing both onboarding and routing in the NDNoT. The scalability of an IoT deployment is adversely affected by the low computational and memory capacities of IoT devices, as well as the characteristics of the low power lossy networks (LLNs) they use to communicate. Thus, we employ a hierarchical network structure, a design which has been recommended to achieve scalability in IoT~\citep{hong2013mobile}. Such an architecture allows us to offload the burden of routing onto a few less-constrained ``anchor'' nodes, while other devices need only form destination-oriented trees. In our framework, secure onboarding is made a prerequisite to routing, in order to help protect the network against routing attacks such as blackholes~\citep{kannhavong2007survey}. Each node in the network is authenticated prior to commencing routing, and in turn a node also authenticates the network it is joining. Since asymmetric cryptography is typically infeasible on IoT devices, we use symmetric cryptography. Our onboarding protocol is based on pre-shared keys between each node and a designated authentication manager in the infrastructure. We have combined our approaches to routing and onboarding into a single holistic framework for Lightweight Authentication \& Secured Routing (LASeR). The combined authentication and onboarding processes are very lightweight, requiring only three round trips and few cryptographic operations. In summary, the \textbf{contributions} of our work are: (1) We analyze the current state-of-the-art of routing and authentication in the NDNoT; (2) We propose LASeR, a holistic framework for efficient and secure onboarding and routing in NDN; and (3) We demonstrate LASeR's effectiveness and efficiency through analyses conducted in ndnSIM, the NDN module for ns-3. The remainder of this paper is organized as follows: Section~\ref{sec:related} reviews prior work on NDN and IoT; Section~\ref{sec:system} presents our model for the IoT network and reviews the primitives employed by NDN; Section~\ref{sec:crypto} describes the cryptographic materials and operations underlying LASeR's authentication mechanism; Section~\ref{sec:protocol} presents the protocols employed for onboarding and routing; Section~\ref{sec:results} offers a simulation-based validation of LASeR's effectiveness; and finally, Section~\ref{sec:conclusion} concludes the paper and gives an overview of our planned future work. \section{Related Work} \label{sec:related} Benefits and challenges related to the ICN-based IoT have been previously discussed in the literature~\citep{amadeo2014named,datta2016integrating,baccelli2014information}, and several architectures have been proposed for both general IoT~\citep{baccelli2014information} and specific applications~\citep{ravindran2013information, amadeo2015information, burke2012authenticated}. However, the majority of these designs focus on service discovery, data delivery, and similar application-centric concerns rather than the initial network bootstrapping or route discovery procedures and their security. Though most of the aforementioned works do not suggest novel routing protocols for IoT, \citep{baccelli2014information} recognized the routing-related challenges imposed by device constraints in the IoT and proposed a new opportunistic-reactive routing protocol. Under this model, forwarding tables are populated after observing the origins of downstream packets; a flooding-based approach is used as a fallback when no proper route is available. A similar approach was previously outlined in \citep{meisel2010ad}. Other approaches to ad-hoc routing in NDN were reviewed in \citep{amadeo2015forwarding}; the authors identified two broad classes of routing protocols: provider-blind and provider-aware. The provider-blind schemes solely employ controlled flooding to forward requests, while provider-aware schemes add a reactive mechanism like that in the two designs mentioned above. All these routing protocols employ reactive designs; however, we choose a proactive approach like that of the IPv6 Routing Protocol for Low-Power and Lossy Networks (RPL)~\citep{rfc6550}, which is currently favored for the IP-based IoT. Bootstrapping and onboarding for the ICN-based IoT have only recently been given serious consideration. Previous architectures such as \citep{burke2012authenticated} relied on the asymmetric authentication mechanisms used throughout the NDN stack, however \citep{enguehard2016cost} quantified the time and energy overheads of such schemes on constrained devices and ultimately concluded that their cost is too high. As a result, two designs based on symmetric cryptography were proposed in \citep{compagno2016onboardicng}: a basic implementation of the authenticated key exchange protocol (AKEP2)~\citep{bellare1993entity} over ICN, and an improved version which increases its efficiency. Though \citep{compagno2016onboardicng} efficiently addresses the initial authentication and key-distribution challenges for IoT, it does so without regard to the needs of a routing protocol. As a result, to employ it in conjunction with a separate routing framework would impose additional overhead; the two steps of authentication and routing will occur serially, increasing overhead in the network and overall onboarding latency. In light of this, we propose LASeR, wherein elements of authentication and routing can occur simultaneously to reduce their overall cost. \section{System and Threat Models and Assumptions} \label{sec:system} In this section, we present the system, network, and threat models and assumptions. For better understanding of our models and assumptions, we start with an overview of NDN. \subsection{Overview of NDN} The ``thin waist'' of the Named Data Networking (NDN) stack, as the name implies, is Named Data. In the NDN model, each chunk of data (typically referred to as a \textit{content object}) has a unique \textit{Name}, similar to a Uniform Resource Identifier (URI); the content associated with each Name is typically considered to be immutable. To retrieve a particular content object, a requester sends an \textit{Interest} packet into the network. At a minimum, the Interest contains the Name of the desired content object; it can also contain a signature to verify the requester's identity. The network then retrieves the appropriate content object and delivers it to the requester as a \textit{Data} packet. The Data contains, at a minimum, its Name, the actual content payload, and its publisher's signature. The requester can then verify the signature to ascertain the content object's authenticity. Both Interest and Data signatures typically (but optionally) include a \textit{KeyLocator} field, which contains the Name of the key used for the signature. Each router in NDN maintains three data structures: a Pending Interest Table (PIT), a Forwarding Information Base (FIB), and a Content Store (CS). The forwarding procedures for both Interests and Data are based around these tables. Upon receiving an Interest, a router first checks its CS for a match; the CS essentially serves as a cache of Data, indexed by Name. If a match is found in the CS, the Data is served and the request is considered satisfied. If no match is found in the CS, the router then checks its PIT, which indicates whether a previous Interest for the same Name has been forwarded but not yet satisfied. If a PIT entry exists, the router need not forward the Interest again; instead, it adds the identifier of the incoming interface (\textit{Face}, in the NDN nomenclature) to that PIT entry. If no PIT entry is found, the router consults its FIB (essentially a forwarding table) and employs a configurable \textit{forwarding strategy} to identify the correct Face on which to forward the Interest. The router then adds a new PIT entry indicate that the Interest was forwarded. Data packets are essentially forwarded following the reverse path as indicated by matching PIT entries. That is, a router receiving a Data checks its PIT to determine the correct Face(s) on which to forward the Data. Once the Data is forwarded, the PIT entry is cleared. The Data may then be added to the CS and used to satisfy future requests, depending on the policy employed for cache admission and eviction. Note that the configurability of the forwarding strategy is an important feature for the application of NDN in IoT. A different strategy can be employed for each Interest depending on its Name prefix, allowing, for example, enhanced Quality of Service (QoS) depending on the nature of the request. In LASeR, we employ a custom strategy to facilitate our hierarchical network design; more details on this strategy are given in Section~\ref{subsec:forwarding}. \subsection{System Model and Assumptions} We model the NDNoT as consisting of \textit{islands}, which exist at the edge of the greater Internet. The protocols employed within the island need not be influenced by those used in the wide-area network (WAN); therefore, this model is suitable for a local clean-slate deployment of NDN in smart cities prior to wide adoption. We distinguish between three types of nodes within each island: gateways, anchor nodes (ANs), and standard nodes (SNs). We assume that SNs have small memory, computation, and energy capacities, and employ LLN radios; on the other hand, gateways and ANs are essentially unconstrained. The connections between these entities are visualized in Fig.~\ref{fig:system}. Gateways serve as edge routers between the island and the WAN, and the ANs are a superset of the gateways and form a backbone or core for the island. Standard nodes wirelessly peer with ANs and use them as sinks to facilitate communication, thus creating trees, or \textit{clusters}, of constituent SNs around each AN. We assume each SN is assigned a flat identifier (ID), which could either be derived from its media access control (MAC) address or be chosen arbitrarily. For scalability, we will use these IDs to perform routing and forwarding. Nodes can also advertise arbitrary, application-specific Name prefixes; other requesters would then resolve these Names into IDs for the purpose of routing. Namespace creation and management is an NDN- and application-specific decision. This is outside the scope of this work. \begin{figure}[] \centering \includegraphics[height=2.4in]{figures/system.pdf} \caption{ \label{fig:system} In our hierarchical island, a gateway connects to the WAN, anchors form an island backbone, and standard nodes form trees rooted at the anchors. } \end{figure} In addition to network entities named above, we assume that there is a service capable of managing the authentication and registration of nodes in the network. We will refer to this entity as the Island Manager (IM); it may exist either in the cloud, within some particular node, or even as a synchronized database shared between anchors. We assume that the IM and ANs are synchronized to perform secure communication and routing. We do not discuss mechanisms to achieve this, however it is easy to design and implement. The placement of the IM is an implementation detail which should be made with consideration to the specific needs of a particular deployment. The IM will be responsible for node authentication, and will also serve Name-to-ID resolution requests to support hierarchical routing. \subsection{Threat Model and Assumptions} We assume that all the devices in the network are capable of performing symmetric key cryptography, such as advanced encryption standard (AES), and message authentication using keyed-hashed functions, such as hashed-MAC. As is standard, we assume that the encryption algorithms and the MAC functions cannot be compromised. In our system, there can be both inside and outside attackers. An outside attacker is not part of the network. It can passively capture data transmissions in the network to perform traffic analysis and also replay captured packets. It can also be an active attacker attempting to masquerade as a legitimate node, and can try to inject false data into the network. An inside attacker is a node that is already on-boarded into the network, it can also inject false data in the network. The false data can include fake route advertisements, enabling sinkhole or blackhole attacks. A compromised or colluding node's keying materials can be extracted and used by an adversary, not part of the system, to impersonate as a legitimate node. This is termed sybil attack; the compromised adversary can operate as a legitimate node in the network. Denial of service and channel jamming can also be threats in our system. \section{Cryptographic Materials and Primitives} \label{sec:crypto} \subsection{Overview} The key hierarchy of LASeR, visualized in Fig.~\ref{fig:keys}, is inspired by that of the Pre-Shared Key Extensible Authentication Protocol (EAP-PSK) \citep{rfc4764}. A session between an SN and an IM is identified by the respective IDs of the two parties as well as two nonces (one chosen by each). The SN and IM initially share a pre-shared key (PSK), from which two long-lived keys are derived (one for key derivation, one for authentication). With the exchange of nonces and establishment of a session, two additional transient keys are established (one for encryption, one for authentication). These transient keys can be intermittently refreshed simply by exchanging new nonces. \begin{figure}[] \centering \includegraphics[height=2.4in]{figures/keys.pdf} \caption{ \label{fig:keys} LASeR's key derivations are based around a pre-shared key, PIN\textsubscript{SN}. % Two permanent keys are shared, and two transient keys are derived per session. % } \end{figure} \subsection{Permanent Materials} Each SN is required to store at least two permanent pieces of information: its ID (ID\textsubscript{SN}) and its PSK (PIN\textsubscript{SN}), which could be installed at the time of manufacture. The IM is required to permanently store only its own ID (ID\textsubscript{IM}). The IDs may be arbitrary, and the PSK should be random. \begin{figure}[] \includegraphics[width=\columnwidth]{figures/proto_overview.pdf} \caption{ \label{fig:proto_overview} LASeR consists of three phases, each involving one round-trip to the IM. % The discovery phase can be iterated to obtain a desirable path. % } \end{figure} \subsection{Long-Lived Keys} \label{subsec:long_keys} As in EAP-PSK, we use a PSK (in this case, PIN\textsubscript{SN}) in order to derive two long-lived keys: the Authentication Key (AK\textsubscript{SN}), and the Key-Derivation Key (KDK\textsubscript{SN}). For ease of implementation, we use a password-based key derivation function (PBKDF2)~\citep{rfc2898}, rather than the modified counter mode block cipher used by EAP-PSK, to derive these keys from the PSK. Following the construction in EAP-PSK, we configure PBKDF2 with the following options: PIN\textsubscript{SN} as the password, ID\textsubscript{SN} as the salt, and an output length of 256 bits. The first 128 bits of output shall be used as AK\textsubscript{SN}, and the last 128 bits as KDK\textsubscript{SN}. We use HMAC-SHA256 as the pseudorandom function behind PBKDF2, due to its wide use and ease of implementation. The SN may optionally pre-generate and cache both AK\textsubscript{SN} and KDK\textsubscript{SN} permanently, though it is not required to. The IM cannot generate these keys until binding time, as it may not have prior knowledge of ID\textsubscript{SN}. To enable use of NDN's in-stack authentication features, AK\textsubscript{SN} should be registered on both nodes as \texttt{/keys/<ID\textsubscript{SN}>/AK}, and KDK\textsubscript{SN} registered as \texttt{/keys/<ID\textsubscript{SN}>/KDK}. \begin{figure*}[t!] \centering \includegraphics[width=.85\textwidth]{figures/proto_discovery.pdf} \caption{ \label{fig:proto_discovery} The first phase of LASeR involves SN\textsubscript{2} discovering a network through its neighbor SN\textsubscript{1}. % The IM authenticates the network to SN\textsubscript{2} using its knowledge of PIN\textsubscript{SN\textsubscript{2}}. % The AN (indicated by dotted line) is not involved in the protocol, however messages between SN\textsubscript{1} and IM will pass through it en route. % } \end{figure*} \subsection{Transient Keys} To enhance security, the static keys derived directly from the PSK are not used to transmit application data, but only to bootstrap the authentication process. As in EAP-PSK, two nonce-based ephemeral keys will be derived from the key-derivation key. In particular, KDK\textsubscript{SN} is used to derive two transient keys: a Transient Authentication Key (TAK\textsubscript{SN}), and a Transient Encryption Key (TEK\textsubscript{SN}). Again, we use PBKDF2 with HMAC-SHA256 to derive 256 bits of keying material. The key KDK\textsubscript{SN} is used as the password, and a pair of nonces (R\textsubscript{SN} and R\textsubscript{IM}) established during the handshake is used as the salt (details in Section~\ref{sec:protocol}). These keys are also registered within the local NFD for ease of use: TAK\textsubscript{SN} is registered as \texttt{/keys/<ID\textsubscript{SN}>/<R\textsubscript{SN}>/<R\textsubscript{IM}>/TAK}, and TEK\textsubscript{SN} as \texttt{/keys/<ID\textsubscript{SN}>/<R\textsubscript{SN}>/<R\textsubscript{IM}>/TEK}. \begin{figure}[b] \centering \includegraphics[width=.95\columnwidth,trim={0.5cm 0 0.5cm 0}, clip]{figures/proto_authentication.pdf} \caption{ \label{fig:proto_authentication} In the second stage of LASeR, SN\textsubscript{2} authenticates itself to the IM and obtains the RAK corresponding to its anchor. % } \end{figure} \subsection{Secure Channel} Once TAK\textsubscript{SN} and TEK\textsubscript{SN} are derived, a secure channel can be established. Messages are encrypted with AES128-CBC under TEK\textsubscript{SN}, while TAK\textsubscript{SN} is used for HMAC-SHA256 signing. These keys are used to deliver an additional symmetric key to used for route advertisement, namely the Routing Authentication Key (RAK). In the following sections, we use the notation \texttt{[~...~]\textsubscript{K}} to indicate that a message is signed under the key \texttt{K}, and \texttt{\{~...~\}\textsubscript{K}} to indicate that a message is encrypted under \texttt{K}. \section{The LASeR Protocol} \label{sec:protocol} \subsection{Overview} Onboarding and routing using LASeR occurs in three steps, depicted in Fig.~\ref{fig:proto_overview}: (1) network discovery and authentication, (2) SN authentication and key delivery, and (3) path advertisement. In the first phase, an SN discovers an already-onboarded neighbor, who then asks the IM for the information necessary to authenticate the network to the new SN. In the second phase, the SN authenticates itself to the IM and acquires the keys necessary to advertise a route. The final phase consists solely of the SN advertising its route; the route is then propagated hop-by-hop toward the anchor using SetNext messages. The anchor then notifies the IM of the SN's registration using a SetPrefix message. The full process can be performed in as little as three round trips between a joining SN and the IM. The resulting routes from SNs to ANs are similar to those which would be obtained by a scheme based on destination-oriented directed acyclic graphs (DODAGs) such as RPL~\cite{rfc6550}. However, each node chooses only one upstream path in LASeR and therefore the result is a forest of trees, each rooted at an AN (equivalent to sinks in RPL nomenclature). Routing between anchors and gateways is assumed to be handled by other means, e.g. a link-state protocol, and is beyond the scope of this work. \subsection{Network Discovery and Authentication} The first stage of LASeR is network discovery and authentication; that is, an SN discovers a path and verifies the legitimacy of the network it is connecting to. It involves three network entities: the node joining the island (SN\textsubscript{2}), its neighbor (SN\textsubscript{1}), and the island manager (IM). The discovery process may begin either when SN\textsubscript{2} first comes online, or at a later time when it receives a wakeup beacon (a notification from a newly-onboarded neighbor that a path to an AN is now available). The complete discovery protocol is presented in Fig.~\ref{fig:proto_discovery}. The first transmission in this phase is a \textit{Discovery Request} sent by SN\textsubscript{2}, which constitutes a request to join an island. This transmission is an Interest under the \texttt{/discover/} prefix, which is assumed to be broadcast-forwarded in order for SN\textsubscript{2} to identify an immediate neighbor. The Interest should have a relatively long PIT lifetime (likely on the order of minutes), as it may require human input at the IM (to enter PIN\textsubscript{SN\textsubscript{2}}, if it is not pre-shared) before a Data can be sent in response. This initial Interest sent by SN\textsubscript{2} contains its ID (ID\textsubscript{SN\textsubscript{2}}), a self-generated nonce (R\textsubscript{SN\textsubscript{2}}), and its current hop-distance from an anchor (AD\textsubscript{SN\textsubscript{2}}, initially $\infty$); the complete name is \texttt{/discover/<ID\textsubscript{SN\textsubscript{2}}>/<R\textsubscript{SN\textsubscript{2}}>/<AD\textsubscript{SN\textsubscript{2}}>}. Any neighbor (SN\textsubscript{1}) which receives this message, is fewer than AD\textsubscript{SN\textsubscript{2}}$ - 1$ hops from an anchor, and wishes to serve as a relay for SN\textsubscript{2} shall relay it to its AN along with its own MAC (MAC\textsubscript{SN\textsubscript{1}}), its hop-count distance from an anchor (AD\textsubscript{SN\textsubscript{1}}), and the ID of that anchor (ID\textsubscript{AN}). This message, an \textit{Onboarding Request}, essentially represents SN\textsubscript{1}'s assent to providing a route towards AN for SN\textsubscript{2}. To this end, SN\textsubscript{1} constructs a new Interest for \texttt{/<ID\textsubscript{IM}>/onboard} \texttt{/<ID\textsubscript{SN\textsubscript{2}}>/<R\textsubscript{SN\textsubscript{2}}>/<MAC\textsubscript{SN\textsubscript{1}}>/<AD\textsubscript{SN\textsubscript{1}}>/<ID\textsubscript{AN}>} and signs it under RAK\textsubscript{AN} (which is shared by all successfully-onboarded nodes under the AN, as well as by the IM). \begin{figure*}[t!] \centering \includegraphics[width=.98\textwidth,trim={1em 0 2em 0}]{figures/proto_advertisement.pdf} \caption{ \label{fig:proto_advertisement} In the final stage of LASeR, SN\textsubscript{2} notifies its neighbor SN\textsubscript{1} of its commitment to its path. % SN\textsubscript{1} then sends a similar notification to the next hop; this repeats until AN learns a route to SN\textsubscript{2}. % Then, AN informs IM that it is serving as the anchor for SN\textsubscript{2}. % Note that the IM may be co-located with the AN. % } \end{figure*} Upon receiving this Interest, the IM derives AK\textsubscript{SN\textsubscript{2}} and KDK\textsubscript{SN\textsubscript{2}} according to the procedure outlined in Section~\ref{subsec:long_keys}. It generates its nonce R\textsubscript{IM} and replies with a \textit{Network Authentication} (NA) message, which is a Data containing ID\textsubscript{SN\textsubscript{2}}, R\textsubscript{SN\textsubscript{2}}, ID\textsubscript{IM}, R\textsubscript{IM}, MAC\textsubscript{SN\textsubscript{1}}, AD\textsubscript{SN\textsubscript{1}}, and ID\textsubscript{AN}. The Data is signed under AK\textsubscript{SN\textsubscript{2}}. This Data authenticates IM to SN\textsubscript{2}, informs it of its next-hop neighbor (SN\textsubscript{1}), its distance from an anchor (AD\textsubscript{SN\textsubscript{1}} + 1), and its anchor (AN). Because SN\textsubscript{1} changed the Interest name in-flight, it must perform the corresponding reverse mapping in order to deliver the message to SN\textsubscript{2}; i.e., the application layer changes the Data's Name from that in the Onboarding Request to that in the original Discovery Request. After obtaining this Data, SN\textsubscript{2} may send a new discover Interest in order to attempt to locate a shorter path to an anchor (in the context of our example, a different node would then take on the role of SN\textsubscript{1}). To do so, it sends the same Interest as previously but with a new nonce and an updated AD field. This process may be iterated as many times as desired, or until SN\textsubscript{2} no longer receives a useful response. When SN\textsubscript{2} is content with its path, it notes its next hop toward the anchor as ID\textsubscript{SN\textsubscript{1}} and its anchor as ID\textsubscript{AN}, then proceeds to phase two as follows. \subsection{SN Authentication and Key Delivery} After completing the first phase, SN\textsubscript{2} trusts its island (via its trust for the IM) and is capable of forwarding Interests to any entity within. However, the island does not yet trust SN\textsubscript{2}. In order to establish this trust, SN\textsubscript{2} begins the second phase, which is illustrated in Fig.~\ref{fig:proto_authentication}. This phase begins with SN\textsubscript{2} sending its \textit{SN Authentication} (SA), a signed Interest to IM containing the previously exchanged nonces, R\textsubscript{SN\textsubscript{2}} and R\textsubscript{IM}, as well as ID\textsubscript{SN\textsubscript{2}}, ID\textsubscript{AN}, and ID\textsubscript{IM}. This Interest is to be routed using the next-hop information ascertained in the first phase. The IM, upon receiving the Interest, verifies the signature and content and produces a Data packet containing the anchor-specific RAK\textsubscript{AN} (shared secrets between IM and ANs are always synchronized). The key is encrypted under TEK\textsubscript{SN\textsubscript{2}} and signed under TAK\textsubscript{SN\textsubscript{2}}. At this point, SN\textsubscript{2} is authenticated and can move into the third phase to advertise its path. \subsection{Path Advertisement} \label{subsec:publish} All information necessary for SN\textsubscript{2} to route Interests to other nodes in the island was acquired in the first phase; however, no node is yet able to route interests to SN\textsubscript{2}. In order for Interests to be delivered to SN\textsubscript{2}, each node on the path between SN\textsubscript{2} and AN must know the next hop toward SN\textsubscript{2}. To update this routing state, SN\textsubscript{2} sends a notification called a \textit{SetNext} message upstream, signed under RAK\textsubscript{AN}. To keep track of downstream nodes, each SN and AN maintains a Downstream Forwarding Base (DFB), which maps a node ID to the next-hop MAC address. The strategy layer of each node uses the DFB and the FIB to make forwarding decisions regarding Interests with destinations in the same AN's cluster. To inform the next-hop node of its location, SN\textsubscript{2} creates the SetNext Interest with its neighbor's prefix (ID\textsubscript{SN\textsubscript{1}}) and the command \texttt{/set-next}, followed by its own ID (ID\textsubscript{SN\textsubscript{2}}) and the MAC address of SN\textsubscript{1}'s next-hop toward it (in this case, MAC\textsubscript{SN\textsubscript{2}}). This Interest is signed with RAK\textsubscript{AN}. SN\textsubscript{1} receives this interest, updates its DFB, then constructs a similar Interest informing the next upstream node that it is the next-hop to reach SN\textsubscript{2}. This process, illustrated in Fig.~\ref{fig:proto_advertisement}, continues until the packet reaches the AN. When the AN receives this Interest, it updates its DFB and sends a \textit{SetPrefix} notification to the IM to record that it serves as SN\textsubscript{2}'s anchor. This allows the IM to serve name resolution requests for SN\textsubscript{2}. The IM responds with a simple ACK message, which should be forwarded hop-by-hop to satisfy the PIT entries for these Interests, and ultimately notify SN\textsubscript{2} that it has been successfully onboarded. Upon receiving the ACK, SN\textsubscript{2} may send a wakeup Interest (Name \texttt{/wakeup}) to notify nearby nodes that it has been onboarded and can now facilitate their onboarding. This procedure can help expedite the initial onboarding process for an island. \subsection{Additional Considerations} The above protocols accomplish secure onboarding and routing. In what follows, we will discuss some additional maintenance procedures in LASeR, such as key refresh, prefix resolution, and routing between ANs. \subsubsection{Key Refresh} Both the SN's session keys and the AN's RAK may need to be periodically refreshed in order to maintain the security of the island. When the SN wants to change keys, it can either restart from the discovery process, or contact the IM directly to exchange new nonces. In the latter case, the same authentication procedure applies. In order to refresh RAK\textsubscript{AN}, the IM should generate the new key and send \texttt{[\{<RAK\textsubscript{AN}>\}\textsubscript{TEK\textsubscript{i}}]\textsubscript{TAK\textsubscript{i}}} to each node $i$ in the AN's cluster, as well as the AN itself. \subsubsection{Prefix Resolution} \label{subsec:prefix_res} To enable hierarchical forwarding based on ANs, after committing to a path, an SN assumes a new name-prefix rooted under its AN. This prefix is communicated to the IM at the end of the path-advertisement protocol (Section~\ref{subsec:publish}). The IM stores a mapping of IDs to prefixes, and can respond to Interests querying for the prefixes of registered nodes (e.g., respond to an Interest \texttt{/<ID\textsubscript{IM}>/get-prefix/<ID\textsubscript{SN}>)}. Similarly, the SNs and the ANs need to be able to remap Interests onto the appropriate prefixes. Additional arbitrary Name prefixes that a node wishes to serve should also be communicated to the IM. The IM also resolves requests for these arbitrary Names into routable Names, constructed from the corresponding IDs and AN prefixes. The processes for name registration and resolution are quite simple and can be done in various ways. Due to space constraints this discussion is omitted in this paper. \subsubsection{Routing Within and Between Clusters} \label{subsec:forwarding} In LASeR, anchors obtain routes to each other out-of-band, for example using a link-state algorithm such as NLSR~\citep{hoque2013nlsr}. By virtue of hierarchical naming and prefix-based forwarding, anchors need not advertise the constituent nodes in their clusters, only their own prefixes. We assume that the gateway is also a member of this link-state session, and therefore any standard node can reach the gateway just as easily as it can reach an anchor. In order to reach a node within the same cluster, forwarding nodes use their DFBs. However, each node only has DFB entries for those nodes that rely on it for a path to the anchor. Therefore, in our framework nodes route toward the anchor by default if the DFB lookup fails. As a result, packets between nodes in the same cluster (e.g., machine-to-machine flows) climb the tree toward the AN until the first common ancestor is reached; the packet is then forwarded down the tree to the destination. To reach a node in another cluster, the IM must first be queried to obtain the node's prefix, as mentioned in Section~\ref{subsec:prefix_res} (Prefix Resolution). This operation can be made transparent to applications by performing it in the strategy layer, and the prefix returned by the IM can be cached to reduce latency for future requests. \subsection{Security Analyses} The goal of LASeR is to secure routing in a smart city IoT network. Therefore, we focus on analyzing concerns related to the authenticity and provenance of obtained routes. We will also remark on privacy concerns where applicable. The authentication and key exchange procedures in LASeR are effectively equivalent to those of EAP-PSK and AKEP2, which have been proven in literature to be secure. However, the use of a shared RAK for securing routing messages between nodes in a cluster is a potential vulnerability. Though the RAK is always transmitted in an encrypted form, its compromise (through brute force or node takeover) would allow an attacker to publish fake routes on behalf of any node in the compromised cluster. The result of such an attack would essentially be denial of service of requests destined to that node (assuming the flow's own data is authenticated). This attack can cause blackhole, sinkhole, or wormhole attacks. The LASeR protocol could be augmented to report any changes in the topology to the IM, giving it complete knowledge of the network. Sophisticated algorithms for detecting blackholes, sinkholes, or wormholes can then be employed at the IM. Once detected, the compromised SNs can be revoked and the RAK can be securely refreshed for the remaining legitimate SNs. In many IoT onboarding protocols, the compromise of an already-trusted node can have major impacts. In LASeR, this would result only in the attacker gaining knowledge of the RAK and the node's own PSK, which it can use to inject fake routes as described above; any application-specific information obtained would not impact routing security. If the node is identified, its PSK can be de-authenticated by the IM and the RAK refreshed as usual. Any unencrypted data (such as IDs) collected by the compromised node do not undermine the security of the network; however, they may be used for traffic analysis and privacy attacks. Ephemeral IDs and pseudonyms can be used to prevent such information leakage. Some information about the network topology is leaked by LASeR---a passive attacker could determine the layout of the network by observing Onboarding Request packets en route to the IM. Though we have chosen not to prioritize the protection of this information, the Onboarding Request and its reply could easily be encrypted under an additional key derived from the KDK. Similarly, the RAK can be augmented with an additional key to enable the encryption of SetNext and SetPrefix messages. Node anonymity can also be compromised by observing IDs in transmission; however, because we allow IDs to be chosen arbitrarily they can be made ephemeral to thwart related attacks. Channel jamming and other link-layer or physical-layer denial-of-service attacks are beyond the scope of our framework. \section{Simulation Evaluation} \label{sec:results} \subsection{Scenario Configuration} Our initial validation of LASeR was done in ndnSIM~\citep{mastorakis2015ndnsim}, an ns-3 extension implementing NDN. The implementation of LASeR involves an application-level controller, a custom forwarding strategy, a modified PIT, and a modified Face which supports ad-hoc forwarding. We have also implemented a hop-by-hop fragmentation and reassembly protocol similar to that in NDNLP~\citep{shi2012ndnlp}. \begin{figure*}[] \centering \subfigure[ \label{fig:convergence_density} Empirical CDFs of node convergence time. ]{ \includegraphics[width=.3\textwidth,trim={0 0.185cm 0 0.125cm}, clip]{figures/convergence_density.pdf} } \quad \subfigure[ \label{fig:transmission_density} Transmission burdens by subtree size, with standard-error-of-mean. ]{ \includegraphics[width=.3\textwidth,trim={0 0.185cm 0 0.125cm}, clip]{figures/transmission_density.pdf} } \quad \subfigure[ \label{fig:subtree_density} Probability mass function of subtree sizes. ]{ \includegraphics[width=.3\textwidth,trim={0 0.185cm 0 0.125cm}, clip]{figures/subtree_density.pdf} } \caption{ Simulation results for the four scenarios with increasing deployment density within a $50\times50$ meter area. } \end{figure*} We used the LrWpanNetDevice to model 802.15.4 radios with slotted CSMA/CA, with the \textit{Log Distance Propagation Loss} and \textit{Constant Speed Propagation Delay} models to simulate the radio channel. Unfortunately, the practicality of executing large-scale wireless scenarios in ns-3 is limited (as interference calculations become prohibitively expensive), so we focus on a cluster of SNs around a single AN in each experiment. The cluster forms the building block of any IoT network, which is essentially composed of several such clusters. Onboarding in a single cluster is representative of that in all clusters, as they can happen in parallel. Therefore, we have not modeled the interconnections between anchors, nor a gateway to a WAN, and we assume that each anchor is capable of acting on behalf of the IM. We do not implement the IM's prefix resolution service for this validation study. In our evaluations, we explore two settings: increasing density of nodes within a fixed area, and decreasing density of a fixed number of nodes. Two sets of scenarios were created for these two settings; they will be detailed in their respective subsections. For each scenario, we will explore \textit{four statistics}: time for onboarding convergence, the transmission burden of each node, the size of each node's subtree, and the hop-count distances between nodes and their anchors. Convergence times and hop counts serve as indicators of scalability, while transmission burdens and subtree sizes correspond to the energy efficiency of the protocol. \subsection{Increasing Density} To study the effects of increasing node density, we created scenarios wherein varying numbers of SNs are placed uniformly at random in a $50\times50$ m$^2$ ($0.0025$ km$^2$), and a single AN is placed at the center. We evaluated scenarios of $40$ nodes, $60$ nodes, $80$ nodes, and $100$ nodes; this corresponds to densities ranging from $16,000$ to $40,000$ nodes/km$^2$. For each scenario, we averaged results over $20$ runs with different pseudo-random number generator (PRNG) seeds; note that the seed affects both node placement and network behavior. To simulate real-world deployments the SNs power-on at random times in the network. The time follows an exponential distribution with $\lambda^{-1} = 120$~seconds (2 minutes). An SN attempts to join the network after it is powered-on. \subsubsection{Convergence Time} Fig.~\ref{fig:convergence_density} depicts the empirical cumulative distribution functions (eCDFs) of network convergence times; the X-axis represents time, while the Y-axis gives the cumulative proportion of nodes that have been onboarded. As SNs power on randomly, we identified that congestion is not a big challenge to onboarding--new nodes get onboarded rapidly. No clear trend can be seen between the $40$, $60$, and $80$ node scenarios. However, the $100$-node scenario clearly converges slower, suggesting that as density increases, radio interference has increasingly adverse impact on onboarding. We believe that with greater densities, onboarding may not converge. The worst-case convergence time across all runs was $314.6$ seconds (5 minutes, 14.6 seconds), not much longer than the average case for $100$ nodes, $271.0$ seconds (4 minutes, 31.0 seconds). We believe this to be an acceptable convergence delay, as the process only occurs once. \subsubsection{Transmission Burden} The amount of energy consumed by a node is dominated by wireless transmissions. In LASeR, the transmission burden of an SN grows as it serves increasing number of other SNs as a forwarder in the onboarding process. Therefore, we evaluate the transmission burden observed for SNs of varying subtree sizes. Application-introduced bandwidth is not considered here; only LASeR traffic is measured. Anchor nodes are not included in this analysis, as we assume they are not subject to power constraints. Fig.~\ref{fig:transmission_density} summarizes our analysis of this transmission burden under increasing subtree size and network node density; subtree sizes are on the X-axis, and total KiB transmitted is on the Y-axis. A clear linear trend is visible under increasing subtree size; as expected, transmission burden is approximately proportional to the number of nodes being served in the subtree. Additionally, notice that increasing node density results in overall larger transmission burdens, a pattern resulting from interference-related retransmissions. In our simulations, a single node must transmit an average of $9.89$ kibibytes (KiB) throughout the onboarding process; while this is a reasonable burden, we notice that this burden is compounded by increasing the number of downstream SNs. For this reason, care must be taken to avoid creating large subtrees in a real IoT deployment. \subsubsection{Subtree Size and Distance from Anchor} Fig.~\ref{fig:subtree_density} depicts the empirical probabilities of each observed subtree size; the X-axis gives subtree sizes, and the Y-axis gives the likelihood that a node would host a subtree of that size. On average, 83.6\% of nodes served no children, and thus would experience the minimum transmission burden. In accordance with intuition, hop-count distance from an anchor was correlated to subtree size; on average, 79.2\% of nodes were only one hop away from the anchor. However, we observed that increasing node density increased the average subtree size and path length, even though the nodes' physical distances from the anchor were unchanged. This is because increased density increases interference, thus reducing the effective transmission range of nodes and increasing the chance of SNs to use intermediate forwarders to reach the AN. \begin{figure*}[] \centering \subfigure[ \label{fig:convergence_dist} Empirical CDFs of node convergence time. ]{ \includegraphics[width=.3\textwidth,trim={0 0.185cm 0 0.125cm}, clip]{figures/convergence_distance.pdf} } \quad \subfigure[ \label{fig:transmission_dist} Transmission burdens by subtree size, with standard-error-of-mean. ]{ \includegraphics[width=.3\textwidth,trim={0 0.185cm 0 0.125cm}, clip]{figures/transmission_distance.pdf} } \quad \subfigure[ \label{fig:subtree_dist} Probability mass function of subtree sizes. ]{ \includegraphics[width=.3\textwidth,trim={0 0.185cm 0 0.125cm}, clip]{figures/subtree_distance.pdf} } \caption{ Simulation results for the four scenarios of 100 nodes with increasing deployment area. } \end{figure*} \subsection{Increasing Distance} In the previous subsection, we focused on increasing the number of nodes deployed in a fixed $50\times50$ m$^2$ area. We now evaluate a second set of scenarios, wherein the node count is fixed at 100 and the deployment area is varied. This increases sparseness, causing creation of longer paths from SNs to the AN and bigger subtrees. We chose areas of $50\times50$ m$^2$ (0.0025 km$^2$), $100\times100$ m$^2$ (0.01 km$^2$), $200\times200$ m$^2$ (0.04 km$^2$), and $400\times400$ m$^2$ (0.16 km$^2$). Again, results are averaged over 20 runs. The time at which nodes come online is exponential with $\lambda^{-1} = 120$~seconds. With a few exceptions, trends are similar to those observed in the fixed-area scenario set. \subsubsection{Convergence Time} The convergence times under the 100-node scenarios are visualized as eCDFs in Fig.~\ref{fig:convergence_dist}. We again see that the densest scenario reaches final convergence slowest, however it is notable that the sparsest scenario ($0.16$ km$^2$) has a slower initial progression. An inflection point is visible between 100-120 seconds, suggesting that connectivity is poor prior to a sufficient number of nodes (which will serve as intermediate forwarders) being onboarded. \subsubsection{Transmission Burden} The transmission burdens for nodes with each observed subtree size are visualized in Fig.~\ref{fig:transmission_dist}. Again, there is a clear trend of increased burden under higher densities, when considering similarly-sized subtrees; this is due to interference-related retransmissions. However, we can see that in the sparsest scenario, some nodes host much larger subtrees and thus carry a greater burden. The available energy at these nodes serves as the bottleneck for communication from the downstream nodes. Thus, care must be taken in node placement: nodes' distances from anchors should be minimized. \subsubsection{Subtree Size and Distance from Anchor} The observed probability mass function of subtree sizes is given in Fig.~\ref{fig:subtree_dist}. Again, a majority of nodes host no children; however, in the sparsest case, a few nodes hosting large subtrees are observed. The emergence of large subtrees can be averted by careful node and anchor placement. The distributions of hop-counts in the three densest scenarios are similar to those observed in the fixed-area scenario set. However, in the sparsest scenario a majority of nodes are two hops from an anchor, rather than one hop. This increases latency; thus, it is best to have short paths from SNs to their corresponding AN. \section{Conclusions and Future Work} \label{sec:conclusion} In this paper, we have proposed LASeR, a secure onboarding and routing framework for NDN-based IoT networks. Scalability is achieved through a hierarchical network design, and very little cryptographic or computational burden. Evaluation by simulations confirmed that LASeR requires minimal network overhead and achieves acceptable onboarding convergence times. The current implementation of LASeR routes based on node IDs, however an extension is planned to support the advertisement of arbitrary name prefixes. A mechanism to address node mobility with low overhead is also in development. After further validating LASeR in ndnSIM, we intend to implement it on real IoT devices for a live testbed deployment. \small \balance \setlength{\bibsep}{1.86pt} \bibliographystyle{unsrtnat}
{'timestamp': '2017-03-27T02:08:10', 'yymm': '1703', 'arxiv_id': '1703.08453', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08453'}
arxiv
\section{Introduction} How should we represent concepts and how can they be composed to form new concepts, phrases and sentences? These questions are fundamental to cognitive science and thereby human-like artificial intelligence. \em Conceptual spaces theory \em gives a way of describing structured concepts~\citep{Gardenfors2004, Gardenfors2014}, not starting from linguistic assumptions, but from cognitive considerations about human reasoning. Conceptual spaces describe a ``semantics of the mind'', modelling mental descriptions of concepts. The key idea is that human beings represent concepts geometrically in certain fundamental domains of understanding such as space, motion, taste and colour. These domains are combined to form a~\emph{conceptual space} describing the features of interest. A concept is then described by convex subsets of the relevant domains. The convexity requirement can be seen as a means of identifying robust, meaningful concepts. For example, if two points in some space are considered to represent the colour red, then intuitively we would expect that every point ``in between'' would also be considered red. Conceptual spaces provide a middle ground between symbolic and connectionist representations of concepts, oriented towards tasks of interest in cognitive science, such as categorization and assessing similarity. \em Categorical compositional distributional models \em \citep{CoeckeSadrzadehClark2010} successfully exploit the compositional structure of natural language in a principled manner, and have outperformed other approaches in Natural Language Processing (NLP) \citep{GrefSadr, KartSadr}. The approach works as follows. A mathematical formalization of grammar is chosen, for example \em Lambek's pregroup grammars \em \citep{Lambek1999}, although the approach is equally effective with other categorial grammars~\citep{CoeckeGrefenstetteSadrzadeh2013}. Such a categorial grammar allows one to verify whether a phrase or a sentence is grammatically well-formed by means of a computation that establishes the overall grammatical type, referred to as \em a type reduction\em. The meanings of \em individual \em words are established using a distributional model of language, where they are described as vectors of co-occurrence statistics derived automatically from corpus data~\citep{Lund1996}. The categorical compositional distributional programme unifies these two aspects of language in a compositional model where grammar mediates composition of meanings. This allows us to derive the meaning of sentences from their grammatical structure, and the meanings of their constituent words. The key insight that allows this approach to succeed is that both pregroups and the category of vector spaces carry the same abstract structure~\citep{CoeckeSadrzadehClark2010}, and the same holds for other categorial grammars since they typically have a weaker categorical structure. The abstract framework of the categorical compositional scheme we discuss here is broader in scope than just NLP. It can be applied in other settings in which we wish to compose meanings in a principled manner, guided by structure. The outline of the general programme is as follows: \begin{enumerate} \label{item:compstruct} \item \begin{enumerate} \item Choose a compositional structure, such as a pregroup or any other categorial grammar. \item Interpret this structure as a category, the \define{grammar category}. \end{enumerate} \item \begin{enumerate} \label{item:meaningspace} \item Choose or craft appropriate meaning or concept spaces, such as spaces of propositions, vector spaces, density matrices~\citep{Piedeleu2015, Bankova2016} or conceptual spaces. \label{item:meaningcategory} \item Organize these spaces into a category, the \define{semantics category}, with the same abstract structure as the grammar category. \end{enumerate} \label{item:interpret} \item Interpret the compositional structure of the grammar category in the semantics category via a functor preserving the type reduction structure. \label{item:reduction} \item Bingo! This functor maps type reductions in the grammar category onto algorithms for composing meanings in the semantics category. \end{enumerate} In order to move away from vector spaces, we construct a new categorical setting for interpreting meanings which respects the important convex structure emphasized in conceptual spaces theory. We show that this category has the necessary abstract structure required by categorical compositional models. We then construct convex spaces for interpreting the types for nouns, adjective and verbs. Finally, this allows us to use the reductions of the pregroup grammar to compose meanings in conceptual spaces. We illustrate our approach with concrete examples, and go on to discuss directions for further research. \section{Categorical compositional meaning} In this section we describe the details of the categorical compositional approach to meaning. We provide examples of semantic categories and grammar categories, and show the general method by which the grammar category induces a notion of concept composition in the semantic category. \subsection{Monoidal categories} We begin by briefly reviewing some of the category theory underpinning categorical compositional models. \begin{dfn} A \define{monoidal category} is a tuple $(C, \otimes, I, \alpha, \lambda, \rho)$ where \begin{itemize} \item $C$ is a category \item $\otimes$, the \define{tensor}, is a functor $C\times C\rightarrow C$ where we write $A\otimes B$ for $\otimes (A,B)$ \item $I$, the \define{unit}, is an object of $C$ \end{itemize} The remaining data are natural isomorphisms, with components of type: \begin{itemize} \item $\alpha_{A,B,C} : ((A\otimes B) \otimes C) \rightarrow (A\otimes( B\otimes C))$ \item $\rho_A : A\otimes I \rightarrow A$ \item $\lambda_A : I\otimes A \rightarrow A$ \end{itemize} These natural isomorphisms, moreover, must be such that any formal and well-typed diagram made up from $\otimes, \alpha, \lambda, \rho, \alpha^{-1}, \rho^{-1}, \lambda^{-1}$ and identities commutes. Here \lq formal\rq \: means \lq not dependent on the structure of any particular monoidal category.\rq \end{dfn} For a precise statement and discussion of the above definition, we direct the reader to~\cite{MacLane1971}. A more gentle introduction can be found in~\cite{CoeckePaquette2011}. For the purpose of our paper, the objects of a monoidal category should be thought of as \textit{system types}. A morphism $f:A\rightarrow B$ is then a process taking inputs of type $A$ and giving outputs of type $B$. The object $A\otimes B$ represents the systems~$A$ and~$B$ composed in \textit{parallel}. Hence, a morphism $f\otimes g : A\otimes B\rightarrow C\otimes D$ is to be thought of as running the process $f:A\rightarrow C$ \emph{whilst} running the process $g:B\rightarrow D$. The object $I$ is thought of as the trivial system. \begin{example} The category $\mathbf{Rel}$ of sets and relations is monoidal. The tensor $\otimes$ is the Cartesian product and $I$ is any singleton set $\{ \star \}$. \end{example} \begin{example} The category $\mathbf{FdVect}_\mathbb{R}$ of finite dimensional real vector spaces and linear maps is monoidal. The tensor $\otimes$ is the tensor product, the trivial system $I$ is the one-dimensional real vector space $\mathbb{R}$. \end{example} Monoidal categories admit an elegant and powerful graphical notation that we will exploit heavily in later sections. In this notation, an object~$A$ is denoted by a wire: \begin{center} \input{wire.tikz} \end{center} A morphism $f:A\rightarrow B$ is represented by a box: \begin{center} \input{morphism1.tikz} \end{center} If $g:B\rightarrow C$, the composite $g\circ f : A\rightarrow C$ is given by: \begin{center} \input{morphism2.tikz} \end{center} If $h:A\rightarrow B$ and $k:C\rightarrow D$, the morphism $h\otimes k : A\otimes C \rightarrow B\otimes D$ is depicted by: \begin{center} \input{parallel.tikz} \end{center} The trivial system $I$ is the empty diagram. Morphisms $u:I\rightarrow A$ and $v: A\rightarrow I$ are drawn respectively as \begin{equation*} \begin{gathered} \input{effect.tikz} \end{gathered} \quad\text{and}\quad \begin{gathered} \input{effect_copy.tikz} \end{gathered} \end{equation*} These special morphisms are referred to as~\define{states} and~\define{effects}. \subsection{Compact closed categories} A specific class of monoidal categories, the compact closed categories, will be of particular importance. \begin{dfn} A monoidal category $(C,\otimes, I)$ is \define{compact closed} if for each object $A\in C$ there are objects $A^l,A^r\in C$ (the \define{left} and \define{right duals} of $A$) and morphisms \begin{align*} \eta_A^l : I\rightarrow A\otimes A^l \:&\:& \eta_A^r : I\rightarrow A^r\otimes A \\ \epsilon_A^l : A^l\otimes A \rightarrow I \:&\:& \epsilon_A^r : A\otimes A^r\rightarrow I \end{align*} satisfying the snake equations \begin{align*} &(1_A \otimes \epsilon^l )\circ (\eta^l \otimes 1_A) = 1_A &\:& (\epsilon^r \otimes 1_A) \circ (1_A \otimes \eta^r ) = 1_A \\ &(\epsilon^l \otimes 1_{A^l})\circ (1_{A^l} \otimes \eta^l)= 1_{A^l} &\:& (1_{A^r} \otimes \epsilon^r ) \circ (\eta^r \otimes 1_{A^r} ) = 1_{A^r} \end{align*} \end{dfn} The dual objects are also represented as wires. To distinguish objects and their duals, wires are \emph{directed}. The wire representing an object $A$ is directed down the page, and wires representing dual objects $A^r$ and $A^l$ are directed up the page. The $\epsilon$ and $\eta$ maps are called \define{caps} and \define{cups} respectively, and are depicted graphically as \begin{center} \input{cupscaps.tikz} \end{center} Graphically, the snake equations become \begin{center} \input{snaaaakes.tikz} \end{center} Compact closed categories are a convenient level of abstraction at which to work. Many of the categories one would think to use as either grammar or meaning categories have a compact closed structure. \begin{example} All objects in \textbf{Rel} are self-dual. Both caps are given by \begin{gather*} \epsilon_X : X\otimes X\rightarrow \{\star\} :: \{ \left(( x, x), \star\right) \mid x \in X \} \end{gather*} The associated cup $\eta_X$ is the converse of the above. The snake equations can be verified by direct calculation. \end{example} \begin{example} $\mathbf{FHilb}$ is the category of finite dimensional real inner product spaces. As in the case of \textbf{FdVect$_\mathbb{R}$}, the tensor $\otimes$ is the tensor product of vector spaces and $I$ is the one-dimensional space $\mathbb{R}$. In defining cups and caps, we make use of the fact that if $\{ v_i \}_i$ and $\{ u_j \}_j$ are bases for vector spaces $V$ and $U$ respectively, then $\{ v_i \otimes u_j \}_{i,j}$ is a basis for ${V\otimes U}$. Moreover, any linear map is fully determined by its action on a basis. Every finite-dimensional vector space is self-dual, and the cups and caps are given by \begin{gather*} \epsilon_V : V\otimes V \rightarrow \mathbb{R}::\sum_{i,j} c_{i,j} \: (v_i\otimes v_j )\mapsto \sum_{i,j} c_{i,j} \langle v_i | v_j \rangle \\ \\ \eta_V : \mathbb{R} \rightarrow V\otimes V::1\mapsto \sum_{i} (v_i\otimes v_i ) \end{gather*} Verifying that these maps satisfy the snake equations again follows from a straightforward calculation. \end{example} \begin{remark}\label{rem:collapse}\em The tensor in a compact closed category is \emph{not} necessarily a categorical product. Specifically, we cannot expect to describe every state of~$A \otimes B$ as a tensor of two states taken from~$A$ and~$B$. We can understand this as showing composite systems have interesting behaviour that cannot be explained in terms of the behaviour of their component parts. In fact, if the tensor of a compact closed category happens to be a categorical product, then that category must be trivial, in a precise mathematical sense~\cite{CKbook}. \end{remark} \subsection{Grammar categories} Many algebraic gadgets exist to model grammar, as detailed in~\cite{Coecke2013} for example. In the present work, we use Lambek's pregroup grammars, as many grammars have a pregroup structure~\citep{Sadrzadeh2007}. Moreover, pregroups can be viewed as compact closed categories. It should be emphasized though that our approach does not depend on pregroups, and can be applied to other grammatical models. \begin{dfn} A \define{pregroup} is a tuple $(A,\cdot , 1, \--^l,\--^r,\leq )$ where $(A,\cdot, 1, \leq)$ is a partially ordered monoid and $\--^r, \--^l$ are functions $A\rightarrow A$ such that $\forall x\in A$, \begin{align} \label{eq:pg1} x\cdot x^r \leq 1\\ \label{eq:pg2} x^l\cdot x\leq 1\\ \label{eq:pg3} 1 \leq x^r\cdot x\\ \label{eq:pg4} 1\leq x\cdot x^l \end{align} \end{dfn} The $\cdot$ will usually be omitted, writing $xy$ for $x\cdot y$. One interprets grammar by freely generating a pregroup from a set of atomic linguistic types. Words are then assigned an element of the pregroup depending on their linguistic function. A string of words is then mapped to an element of the pregroup by multiplying together the elements associated with its constituent words in their syntactic order. If $s_1\cdots s_n \leq t$, we say that the type $s_1\cdots s_n$ \define{reduces} to the type $t$. The pregroup freely generated by a set $A$ is denoted by $\freepreg A$. \begin{example} For simplicity, we only use the linguistic types~$n$, for noun, and~$s$, for sentence. Hence, we will work with $\freepreg{\{n,s\}}$. Consider the sentence \textit{`Chickens cross roads.'} The nouns \textit{chickens} and \textit{roads} are of type $n$, and the transitive verb \textit{cross} is assigned the type $n^r s n^l$. \textit{`Chickens cross roads'} therefore has type~$n(n^rsn^l)n$. Then we have the following type reductions: \begin{align*} n(n^rsn^l)n &= (nn^r)s(n^ln)\\ & \stackrel{(\ref{eq:pg1})}{\leq} s(n^ln) \\ & \stackrel{(\ref{eq:pg2})}{\leq} s \end{align*} Note that we could also have performed these two steps in the opposite order. The above reduction can be given a neat graphical interpretation as follows: \begin{center} \input{chickens.tikz} \end{center} where it is now very clear that the order of the reductions doesn't matter. This is a feature that is typical for pregroup grammars, while other categorial grammars such as Lambek's original categorial grammar~\citep{Lambek0} have more constraints on the order of the reductions. \end{example} A pregroup can be considered as a compact closed category. The objects of this category are the elements of the pregroup. The morphisms are given by the order structure of the pregroup. That is, there is a unique morphism~$p\rightarrow q$ if and only if~$p\leq q$. The tensor~$\otimes$ is the monoid multiplication and the monoidal unit is the element $1$. Unsurprisingly, the left and right duals of~$p$ are~$p^l$ and~$p^r$ respectively. The cups and caps are the unique morphisms given by the pregroup axioms~(\ref{eq:pg1})--(\ref{eq:pg4}). In the reduction diagram, note how the cups correspond to the cups of the compact closed structure. \subsection{Meaning categories} Distributional models of meaning use vector spaces to represent the meaning of words. In this paper we move away from this approach, choosing instead to work in \ensuremath{{\bf ConvexRel}}\xspace , the category of convex sets and convexity-respecting relations. Before describing this new setting, we first present the conventional vector space approach as a demonstration of the categorical compositional method. This will prepare the ground for detailed discussion of~\ensuremath{{\bf ConvexRel}}\xspace to later sections. One way to model meanings in a vector space is to use co-occurrence statistics~\citep{Bullinaria2007}. The meaning of a word is identified with the frequency with which it appears near other words. One first chooses a collection of \textit{context words}. These will be the basis vectors. One then analyses a large corpus of writing to determine how often words co-occur with the context words. For example, suppose the word \textit{dog} appears in the same context as \textit{cat}, \textit{companion}, and \textit{cuisine} respectively 19, 25, and 2 times. If our collection of context words is $\{ \mbox{\it cat}, \mbox{\it companion}, \mbox{\it cuisine} \}$, then \textit{dog} would be assigned the vector $(19,25,2)$. A drawback of the co-occurrence approach is that antonyms appear in similar contexts and, hence, words such as `win' and `lose' are indistinguishable (despite evidently being different in meaning). Another related difficulty is that vector spaces are notoriously bad for representing basic propositional logic. Nonetheless, the vector space model is highly successful in NLP. One can also use basis vectors to represent \textit{quality dimensions}. For example, \cite{rosch1975, tversky1977, hampton1987} all represent concepts as feature vectors, with basis dimensions representing attributes of the concept. So, for instance, one might represent the word \textit{dog} with certain values on the \textit{fluffy}, \textit{loyal}, and \textit{wolf-like}. This approach closely resembles ours in this paper, though we move away from the vector space setting. \subsection{Putting it all together} We now have all the necessary components: a grammar category and a meaning category. We used the examples of pregroup grammars and vector spaces, but we stress yet again that the abstract method applies equally well to any two compact closed categories. Suppose we have a string of words $w_1\cdots w_n$ and a pregroup $P$. Suppose further that $w_i\in W_i$, where $W_i$ is the vector space associated with $w_i$'s linguistic type. The meaning of $w_1\cdots w_n$ is computed as follows: \begin{enumerate} \item Assign a pregroup element $p_i$ to each word $w_i$ based on its linguistic type. \item Apply pregroup reduction rules (cups and caps) to the element $p_1p_2\cdots p_n$ to obtain a simpler type $x$ such that: \[ p_1p_2\cdots p_n\leq x. \] \item Thinking of the above reduction as a morphism in the pregroup built up from $\epsilon, \eta$ and identities (as given by its reduction diagram), apply the corresponding vector space morphism of type: \[ W_1\otimes \cdots \otimes W_n \rightarrow W_X \] to the string of word meanings represented as~$w_1\otimes \cdots \otimes w_n$. \end{enumerate} \begin{example} Consider again the sentence \textit{`chickens cross roads'}. The nouns \textit{chickens} and \textit{roads} have type $n$ and so are represented in some vector space $N$ of nouns. The transitive verb \textit{cross} has type $n^r s n^l$ and, hence, is represented by a vector in the vector space $N\otimes S \otimes N$ where $S$ is a vector space modelling sentence meaning. The meaning of \textit{`chickens cross roads'} is the image of \begin{equation}\label{eq:pgex1} \vect{\mathit{chickens}}\otimes\vect{\mathit{cross}}\otimes\vect{\mathit{roads}} \end{equation} under the map \begin{equation}\label{eq:pgex2} \epsilon_N \otimes 1_S \otimes \epsilon_N : N\otimes ( N\otimes S\otimes N ) \otimes N \rightarrow S \end{equation} \end{example} This nicely illustrates the general method. Our meaning category supplies the qualitative meanings of \textit{chickens}, \textit{cross}, and \textit{roads}. Our grammar category then tells us how to stitch these together. This corresponds to `telling us where to put cups and caps.' The essence of the method should be thought of as the diagram \begin{center} \input{chickens2.tikz} \end{center} where we think of the words as meaning vectors (\ref{eq:pgex1}) and the wires as the map (\ref{eq:pgex2}). In fact, rather than just using cups and identity wires, which are enough to account for the grammatical structure captured by pregroups, we can enrich the graphical language to directly account for meanings of functional words, such as relative pronouns. \subsection{Beyond standard categorial grammar} A first rather trivial example of a functional word is ``does", which can be accounted for by means of caps \cite{CoeckeSadrzadehClark2010}: \begin{center} \input{chickens3.tikz} \end{center} Things become more interesting when we introduce, rather than just wires, the idea of a \em multi-wire \em (also called \em spider \em \citep{CKbook}) which can have more than two ends, or fewer: \[ \mu_N := \begin{gathered}\input{spider2a.tikz}\end{gathered} \qquad\qquad\qquad\qquad\qquad\qquad \iota_S := \begin{gathered}\input{spider2b.tikz}\end{gathered} \] The way these behave is just like wires. The only thing that matters is: `either being connected by a multi-wire, or not'. As a consequence, multi-wires `fuse' together: \begin{center} \input{spider1.tikz} \end{center} These multi-wires can be defined in category-theoretic terms for any symmetric monoidal category, where they are called \em commutative special dagger Frobenius structures \em \citep{CPV, CKbook}. \begin{example} On each set $X$ in the category $\mathbf{Rel}$ one can take the relations \[ X\otimes \ldots \otimes X\rightarrow X\otimes \ldots \otimes X :: \{ \left(( x, \ldots ,x), ( x, \ldots ,x)\right) \mid x \in X \} \] to be the multi-wires, and note in particular that these include identities, cups and caps. \end{example} \begin{example} On each inner product space $V$ in the category $\mathbf{FdVect}_\mathbb{R}$, given any orthonormal basis $\{ v_i \}_i$ for $V$, one can take the linear maps \[ V\otimes \ldots \otimes V\rightarrow V\otimes \ldots \otimes V :: v_{i_1}\otimes \ldots \otimes v_{i_n}\mapsto \delta_{i_1\ldots i_n} v_{i_1}\otimes \ldots \otimes v_{i_1} \] to be the multi-wires, and again these include identities, cups and caps. \end{example} Using these multi-wires we can now express the meaning of relative pronouns \citep{FrobMeanI, FrobMeanII}: \begin{center} \input{chickens4.tikz} \end{center} Firstly, note that what we obtain is a noun rather than a sentence, and one that is closely related to `dead chicken'. Secondly, note that the use of the three-wire is mainly conjunction, conjoining `[is] chicken' and `crosses road'. In this paper we will use them to directly express conjunctions. The one-wire gets rid of the sentence type. \section{Conceptual spaces} \emph{Conceptual spaces} are proposed in \cite{Gardenfors2004} as a framework for representing information at the conceptual level. G\"{a}rdenfors contrasts his theory with both a symbolic approach to concepts, and an associationist approach where concepts are represented as associations between different kinds of information elements. Instead, conceptual spaces are structures based on quality dimensions such as weight, height, hue and brightness. Conceptual spaces have an internal structure based on how quality dimensions interact with each other. A pair (or set) of dimensions is called \emph{integral} if assignment of a value on one dimension requires assignment of a value on another dimension. For example, the dimensions of hue, saturation, and value in the HSV colour space are integral. Dimensions are called \emph{separable} if values on one dimension can be assigned independently from the others. For example, hue and height are separable. A set of integral dimensions is called a domain, and a conceptual space is composed of a number of domains linked in some way. A concept then corresponds to a convex region in a conceptual space. The way in which the interaction between quality dimensions is specified in G\"ardenfors's model is by using different distance metrics. Within a set of integral dimensions, distance is Euclidean, and between sets of integral dimensions, the city block metric is used. Concept composition within conceptual spaces has been formalized in~\cite{RickardAisbettGibbon2007, AdamsRaubal2009, LewisLawry2016} for example. All these approaches focus on noun-noun composition, rather than utilising any more complex structure, and the way in which nouns compose often focuses on correlations between attributes in concepts. Since then, G\"ardenfors has started to formalise verb spaces, adjectives, and other linguistic structures \citep{Gardenfors2014}. However, a systematic method for how to utilise grammatical structures within conceptual spaces has not yet been provided. In this sense, the category-theoretic approach to concept composition we describe below will introduce a more general approach to concept composition that can apply to varying grammatical types. \section{The category of convex relations} \label{sec:convexrel} In NLP applications, meanings are typically interpreted in categories of real vector spaces. For our intended cognitive application, we now introduce a category that emphasizes convex structure. The familiar definition of convex set is a subset of a vector space which is closed under forming convex combinations. In this paper we consider a more general setting that includes convex subsets of vector spaces, but also allows us to consider some further, more discrete, examples. We begin with some convenient notation. For a set~$X$ we write~$\sum_i p_i \ket{ x_i }$ for a finite formal convex sum of elements of~$X$, where $p_i \in \mathbb{R}^{\geq 0}$ and~$\sum_i p_i = 1$. We then write~$D(X)$ for the set of all such sums. Here we abuse the physicists ket notation to highlight that our sums are formal, following a convention introduced in~\cite{Jacobs2011b}. Equivalently, these sums can be thought of as finite probability distributions on the elements of~$X$. A \define{convex algebra} is a set~$A$ with a function~$\alpha : D(A) \rightarrow A$ satisfying the following conditions: \begin{equation} \label{eq:convexalg} \alpha(\ket{ a }) = a\qquad\text{ and }\qquad \alpha\left(\sum_{i,j} p_i q_{i,j} \ket{ a_{i,j} }\right) = \alpha\left(\sum_i p_i \ket{ \alpha(\sum_j q_{i,j} \ket{ a_{i,j} }) }\right) \end{equation} Informally, $\alpha$ is a \define{mixing operation} that allows us to form convex combinations of elements, and the equations in~\eqref{eq:convexalg} require the following good behaviour: \begin{itemize} \item Forming a convex combination of a single element~$a$ returns~$a$ as we would expect \item Iterating forming convex combinations interacts with flattening sums of sums in the way we would expect \end{itemize} We consider some examples of convex algebras. \begin{example} The closed real interval~$[0,1]$ has an obvious convex algebra structure. Similarly, every real or complex vector space has a natural convex algebra structure using the underlying linear structure. \end{example} \begin{example}[Simplices] For any set~$X$, the formal convex sums of elements of~$X$ themselves form the \define{free convex algebra} on~$X$, which can also be seen as a simplex with vertices the elements of~$X$. Mixtures are formed as follows: \begin{equation*} \sum_i p_i \ket{ \sum_j q_{i,j} \ket{ x_{i,j} } } \mapsto \sum_{i,j} p_i q_{i,j} \ket{ x_{i,j} } \end{equation*} \end{example} \begin{example} The convex space of density matrices provides another example, with the convex structure given by the usual vector space structure on linear operators. \end{example} \begin{example} \label{ex:fuzzy} For a set $X$, the functions of type $X \rightarrow [0,1]$ form a convex algebra pointwise, with mixing operation: \begin{equation*} \sum_i p_i \ket{ f_i } \mapsto (\lambda x. \sum_i p_i f_i(x)) \end{equation*} We can see this as a convex algebra of fuzzy sets. \end{example} \begin{example}[Semilattices] \label{ex:semilattices} As a slightly less straightforward example, every affine join semilattice (that is, one that has all finite \emph{non-empty} joins) has a convex algebra structure given by: \begin{equation*} \sum_i p_i \ket{ a_i } = \bigvee_i \{ a_i \mid p_i > 0 \} \end{equation*} Notice that here the scalars~$p_i$ are discarded and play no active role. These ``discrete'' types of convex algebras allow us to consider objects such as the Boolean truth values. \end{example} \begin{example}[Trees] \label{ex:concretesl} Given a finite tree, perhaps describing some hierarchical structure, we can construct an affine semilattice in a natural way. For example, consider a limited universe of foods, consisting of bananas, apples, and beer. Given two members of the hierarchy, their join will be the lowest level of the hierarchy which is above them both. For instance, the join of $\lang{bananas}$ and $\lang{apples}$ would be $\lang{fruit}$. \begin{equation*} \Tree [.\lang{food} [.\lang{fruit} \lang{apples} \lang{bananas} ] [.\lang{beer} ] ] \end{equation*} \end{example} When~$\alpha$ can be understood from the context, we abbreviate our notation for convex combinations by writing: \begin{equation*} \sum_i p_i a_i := \alpha(\sum_i p_i \ket{ a_i }) \end{equation*} Using this convention, we define a \define{convex relation} of type~$(A,\alpha) \rightarrow (B,\beta)$ as a binary relation $R : A \rightarrow B$ between the underlying sets that commutes with forming convex mixtures as follows: \begin{equation*} \left(\forall i. R(a_i, b_i)\right) \Rightarrow R\left(\sum_i p_i a_i, \sum_i p_i b_i\right) \end{equation*} We note that identity relations are convex, and convex relations are closed under relational composition and converse. \begin{example}[Homomorphisms] If~$(A,\alpha)$ and~$(B, \beta)$ are convex algebras, functions $f:A \rightarrow B$ satisfying: \begin{equation*} f(\sum_i p_i x_i) = \sum_i p_i f(x_i) \end{equation*} are convex relations. These functions are the \define{homomorphisms of convex algebras}. The identity function and constant functions are examples of homomorphisms of convex algebras. \end{example} The singleton set $\{ * \}$ has a unique convex algebra structure, denoted~$I$. Convex relations of the form~$I \rightarrow (A,\alpha)$ correspond to~\define{convex subsets}, that is, subsets of~$A$ closed under forming convex combinations. \begin{dfn} We define the category~\ensuremath{{\bf ConvexRel}}\xspace as having convex algebras as objects and convex relations as morphisms, with composition and identities as for ordinary binary relations. \end{dfn} Given a pair of convex algebras $(A,\alpha)$ and~$(B,\beta)$ we can form a new convex algebra on the cartesian product $A \times B$, denoted~$(A,\alpha) \otimes (B,\beta)$, with mixing operation: \begin{equation*} \sum_i p_i \ket{ (a_i, b_i) } \mapsto \left(\sum_i p_i a_i, \sum_i p_i b_i\right) \end{equation*} This induces a symmetric monoidal structure on~\ensuremath{{\bf ConvexRel}}\xspace. In fact, the category~\ensuremath{{\bf ConvexRel}}\xspace has the necessary categorical structure for categorical~compositional~semantics: \begin{thm} \label{thm:convexrel} The category~\ensuremath{{\bf ConvexRel}}\xspace is a compact closed category. The symmetric monoidal structure is given by the unit and monoidal product outlined above. The caps for an object $(A,\alpha)$ are given by: \[ \raisebox{-0.2cm}{\input{cap.tikz}} : I \rightarrow (A,\alpha) \otimes (A,\alpha):: \{ (*,(a,a)) \mid a \in A \} \] the cups by: \[ \raisebox{-0.2cm}{\input{cup2.tikz}} :(A,\alpha) \otimes (A,\alpha) \rightarrow I :: \{ ((a,a),*) \mid a \in A \} \] and more generally, the multi-wires by: \[ \raisebox{-0.7cm}{\input{spider.tikz}}: A\otimes \ldots \otimes A\rightarrow A\otimes \ldots \otimes A :: \{ \left(( a, \ldots ,a), ( a, \ldots ,a)\right) \mid a \in A \} \] \end{thm} Note that in the definition of the multi-wires and for the remainder of the paper, we abuse notation and leave the algebra $\alpha$ on $A$ implicit. \begin{remark}\em \label{rem:mergedel} In particular, the multi-wires $\mu_A$ and $\iota_A$ are defined as follows: \[ \mu_A:A \otimes A \rightarrow A ::\{((a, a), a)|a \in A\} \qquad \iota_A: A \rightarrow I :: \{(a, *)| a \in A\} \] \end{remark} \begin{remark}\em As observed in remark~\ref{rem:collapse}, as~\ensuremath{{\bf ConvexRel}}\xspace is compact closed, its tensor cannot be a categorical product. For example, there are convex subsets of~$[0,1]\otimes[0,1]$ such as the diagonal: \begin{equation*} \{ (x,x) \mid x \in [0,1] \} \end{equation*} that cannot be written as the cartesian product of two convex subsets of~$[0,1$]. This behaviour exhibits non-trivial \emph{correlations} between the different components of the composite convex algebra. \end{remark} \begin{remark}\em We have given an elementary description of~\ensuremath{{\bf ConvexRel}}\xspace. More abstractly, it can be seen as the category of relations in the Eilenberg-Moore category of the finite distribution monad. Its compact closed structure then follows from general principles~\citep{CarboniWalters1987}. \end{remark} \section{Noun, adjective, and verb concepts} We define a~\define{conceptual space} to be an object of~\ensuremath{{\bf ConvexRel}}\xspace. In order to match the structure of the pregroup grammar, we require two distinct objects: a noun space~$N$ and a sentence space~$S$. The \define{noun~space}~$N$ is given by a composite \[ N_\lang{colour} \otimes N_\lang{taste} \otimes ... \] describing different attributes such as colour and taste. A~\define{noun} is then a convex subset of such a space. In our examples, we take our sentence space to be a convex algebra in which the individual points are events. Our general scheme can incorporate other sentence space structures, such choices are generally specific to the application under consideration. A~\define{sentence} is then a convex subset of~$S$. We now describe some example noun and sentence spaces. We then show how these can be combined to form spaces describing adjectives and verbs. Once we have these types available, we show in section~\ref{sec:composing} how concepts interact within sentences. \subsection{Example: Food and drink} We consider a conceptual space for food and drink as our running example. The space~$N$ is composed of the domains $N_\lang{colour}$, $N_\lang{taste}$, $N_\lang{texture}$, so that \[ N = N_\lang{colour} \otimes N_\lang{taste} \otimes N_\lang{texture} \] The domain~$N_\lang{colour}$ is the RGB colour domain, i.e. triples $(R, G, B) \in [0,1]^3$ with $R$, $G$, $B$ standing for intensity of red, green, and blue light respectively. $N_\lang{taste}$ is defined as the simplex of combinations of four tastes: sweet, sour, bitter, and salt. We therefore have \begin{equation} \label{eq:taste_space} N_\lang{taste} = \{\vec{t} | \vec{t} = \sum_{i \in I} w_i \vec{t}_i\} \end{equation} where $I = \{\lang{sweet}, \lang{sour}, \lang{bitter}, \lang{salt}\}$, $\vec{t}_i$ is the vector in some chosen basis of $\mathbb{R}^4$ whose elements are all zero except for the $i$th element whose value is one, and $\sum_i w_i = 1$. $N_\lang{texture}$ is just the set $[0, 1]$ ranging from completely liquid (0) to completely solid (1). We define a property \property{property} to be a convex subset of a domain, and specify the following examples (see figures \ref{fig:colour_space} and \ref{fig:taste_space}): \begin{align*} \property{yellow} &= \{(R, G, B)|(R \geq 0.7), (G \geq 0.7), (B \leq 0.5)\}\\ \property{green} &= \{(R, G,B)|(R \leq G), (B \leq G), (R \leq 0.7), (B \leq 0.7), (G \geq 0.3)\}\\ \property{sweet} &= \{\vec{t}| t_\lang{sweet} \geq t_l \text{ for } l \neq \lang{sweet}\} \end{align*} The properties~$\property{sour}$ and~$\property{bitter}$ are defined analogously. \begin{figure} \begin{subfigure}[t]{0.3\textwidth} \includegraphics[width =\textwidth]{RGBcube.pdf} \caption{The RGB colour cube} \end{subfigure} \hfill \begin{subfigure}[t]{0.3\textwidth} \includegraphics[width = \textwidth]{RGB_Yellow.pdf} \caption{Property $\property{yellow}$} \end{subfigure} \hfill \begin{subfigure}[t]{0.3\textwidth} \includegraphics[width = \textwidth]{RGB_Green.pdf} \caption{Property $\property{green}$} \end{subfigure} \caption{The RGB colour cube and properties $\property{colour}$} \label{fig:colour_space} \end{figure} \begin{figure} \centering \begin{subfigure}[t]{0.35\textwidth} \includegraphics[width = \textwidth]{taste.pdf} \caption{The taste tetrahedron} \end{subfigure} \hfill \begin{subfigure}[t]{0.35\textwidth} \includegraphics[width = \textwidth]{sweet.pdf} \caption{The region corresponding to $\property{sweet} = \{\vec{t}| t_\lang{sweet} \geq t_l \text{ for } l \neq \lang{sweet}\}$} \end{subfigure} \caption{The taste space and the property \property{sweet}} \label{fig:taste_space} \end{figure} \subsubsection{Nouns} We define some nouns below. Properties in the colour domain are specified using sets of linear inequalities, and colours in the taste domain are specified using the convex hull of sets of points. We use $\ch{A}$ to refer to the convex hull of a set $A$. \begin{align*} \lang{banana} &= \{(R, G, B)|(0.9 R \leq G \leq 1.5 R), (R \geq 0.3), (B\leq 0.1)\} \\&\qquad \otimes \ch{\{t_\lang{sweet}, 0.25t_\lang{sweet}+0.75t_\lang{bitter}, 0.7t_\lang{sweet}+0.3t_\lang{sour}\}} \otimes [0.2, 0.5]\\ \lang{apple} &= \{(R, G, B)|R - 0.7 \leq G \leq R + 0.7), (G \geq 1-R), (B\leq 0.1)\} \\&\qquad \otimes [0.5, 1] \otimes \ch{\{t_\lang{sweet}, 0.75t_\lang{sweet}+0.25t_\lang{bitter}, 0.3t_\lang{sweet}+0.7t_\lang{sour}\}} \otimes [0.5, 0.8]\\ \lang{beer} &= \{(R, G, B)|(0.5 R \leq G \leq R), (G \leq 1.5 - 0.8R), (B\leq 0.1)\} \\&\qquad \otimes \ch{\{t_\lang{bitter}, 0.7t_\lang{sweet}+0.3t_\lang{bitter}, 0.6t_\lang{sour}+0.4t_\lang{bitter}\}} \otimes [0, 0.01] \end{align*} where $t_i$ are as given in \eqref{eq:taste_space}. The tensor product $\otimes$ used in these equations is the tensor product in \ensuremath{{\bf ConvexRel}}\xspace, and is therefore the Cartesian product of sets. The subsets of points representing tastes are explained as follows using the case of banana as an example. Bananas are not at all salty, and therefore $w_\lang{salt}$ is set to $0$. Bananas are sweet, and therefore the point $t_\lang{sweet}$ is chosen as an extremal point in the set of banana tastes. Bananas can also be somewhat but not totally bitter, and therefore the point $0.25t_\lang{sweet}+0.75t_\lang{bitter}$ is chosen as an extremal point. Similarly bananas can be a little sour, and therefore $0.7t_\lang{sweet}+0.3t_\lang{sour}$ is also chosen as an extremal point. Finally the convex hull of these points is formed giving a set of points corresponding to banana taste. Pictorially, we have: \begin{align*} \lang{banana} \ \ &=\ \ \begin{gathered} \includegraphics[width=0.2\textwidth]{RGB_Banana.pdf}\end{gathered} \ \ \otimes\ \ \begin{gathered} \includegraphics[width=0.2\textwidth]{banana_taste_amended.pdf}\end{gathered}\ \ \otimes\ \ \begin{gathered} \includegraphics[width=0.2\textwidth]{banana_texture.pdf}\end{gathered}\\ \lang{apple} \ \ &=\ \ \begin{gathered} \includegraphics[width=0.2\textwidth]{RGB_Apple.pdf}\end{gathered} \ \ \otimes\ \ \begin{gathered} \includegraphics[width=0.2\textwidth]{apple_taste_amended.pdf}\end{gathered}\ \ \otimes\ \ \begin{gathered} \includegraphics[width=0.2\textwidth]{apple_texture.pdf}\end{gathered}\\ \lang{beer} \ \ &=\ \ \begin{gathered} \includegraphics[width=0.2\textwidth]{RGB_Beer.pdf}\end{gathered} \ \ \otimes\ \ \begin{gathered} \includegraphics[width=0.2\textwidth]{beer_taste_amended.pdf}\end{gathered}\ \ \otimes\ \ \begin{gathered} \includegraphics[width=0.2\textwidth]{beer_texture.pdf}\end{gathered}\\ \end{align*} What is an appropriate choice of sentence space for describing food and drink? We need to describe the events associated with eating and drinking. We choose a very simple structure where the events are either positive or negative, and surprising or unsurprising. We therefore use a sentence space of pairs. The first element of the pair states whether the sentence is positive (1) or negative (0) and the second states whether it is surprising (1) or unsurprising (0). The convex structure on this space is the convex algebra on a join semilattice induced by element-wise max, as in example \ref{ex:semilattices}. We therefore have four points in the space: positive, surprising (1,~1); positive, unsurprising (1,~0); negative, surprising (0,~1); and negative, unsurprising (0,~0). Sentence meanings are convex subsets of this space, so they could be singletons, or larger subsets such as $\lang{negative} = \{(0,~1), (0,~0)\}$. \subsubsection{Adjectives} Recall that in a pregroup setting the adjective type is $n n^l$. In \ensuremath{{\bf ConvexRel}}\xspace, the adjective therefore has type $N\otimes N$. Adjectives are convex relations on the noun space, so can be written as sets of ordered pairs. We give two examples, $\lang{yellow}_\lang{adj}$ and $\lang{soft}_\lang{adj}$. The adjective~$\lang{yellow}_\lang{adj}$ has the simple form: \[ \{(\vect{x}, \vect{x}) | x_\lang{colour} \in \property{yellow} \} \] This simple form reflects the fact that $\lang{yellow}_\lang{adj}$ depends only on one area of the conceptual space, so it really just corresponds to the property $\property{yellow}$. An adjective such as `soft' behaves differently to this. We cannot simply define soft as one area of the conceptual space, because whether or not something is soft depends what it was originally. Using relations, we can start to write down the right type of structure for the adjective, as long as the objects are sufficiently distinct. Restricting our universe just to bananas and apples, we can write~$\lang{soft}_\lang{adj}$ as \begin{equation*} \{(\vect{x}, \vect{x}) | \vect{x} \in \lang{banana} \text{ and } x_\lang{texture} \leq 0.35 \text{ or } \vect{x} \in \lang{apples} \text{ and } x_\lang{texture} \leq 0.6\} \end{equation*} Note that here, we are using \lang{banana} and \lang{apple} as shorthand for specifications of convex areas of the conceptual space. These could be written out in longhand as sets of inequalities within the colour and taste spaces. An analysis of the difficulties in dealing with adjectives set-theoretically, breaking them down into (roughly) three categories, is given in~\cite{KampPartee1995}. Under this view, both adjectives and nouns are viewed as one-place predicates, so that, for example~$\lang{red} = \{ x | \text{$x$ is red}\}$ and~$\lang{dog} = \{ x |\text{$x$ is a dog}\}$. There are then three classes of adjective. For \define{intersective} adjectives, the meaning of $\lang{adj noun}$ is given by $\lang{adj} \cap \lang{noun}$. For \define{subsective} adjectives, the meaning of $\lang{adj noun}$ is a subset of $\lang{noun}$. For \define{privative} adjectives, however, $\lang{adj noun} \not\subseteq \lang{noun}$. Intersective adjectives are a simple modifier that can be thought of as the intersection between two concepts. We can make explicit the internal structure of these adjectives exploiting the multi-wires of theorem~\ref{thm:convexrel}. For example, in the case of $\lang{yellow banana}$, we take the intersection of $\lang{yellow}$ and $\lang{banana}$. We then show how to understand~$\lang{yellow}$ as an adjective. While the general case of adjectives is depicted as: \[ \begin{gathered}\input{ftall.tikz}\end{gathered}\ \ =\ \ \begin{gathered}\input{tall_bent.tikz}\end{gathered} \] in the case of intersective adjectives the diagrams specialise to: \begin{eqnarray*} \begin{gathered}\input{yellow_int.tikz}\end{gathered}\ \ &=&\ \ \begin{gathered}\input{yellow_adj.tikz}\end{gathered}\\ \ \ &=&\ \ \begin{gathered}\input{yellow_bent.tikz}\end{gathered} \end{eqnarray*} This shows us how the internal structure of an intersective adjective is derived directly from a noun. \subsubsection{Verbs} The pregroup type for a transitive verb is $n^r s n^l$, mapping to $N \otimes S\otimes N$ in \ensuremath{{\bf ConvexRel}}\xspace. To define the verb, we use concept names as shorthand, where these can easily be calculated. For example, is \lang{green} is considered to be an intersective adjective, \lang{green banana} can be calculated by taking the intersection of \lang{green} and \lang{banana} by combining the inequalities specifying the colour property, giving: \begin{align*} \lang{green banana} &= \{(R,G, B) | (R \leq G\leq 1.5R), (G \geq B), (0.3\leq R \leq 0.7), (G \geq 0.3)\}\\ &\qquad \otimes \ch{\{t_\lang{sweet}, 0.25t_\lang{sweet}+0.75t_\lang{bitter}, 0.7t_\lang{sweet}+0.3t_\lang{sour}\}} \otimes [0.2, 0.5]\\ \end{align*} Although a full specification of a verb would take in all the nouns it could possibly apply to, for expository purposes we restrict our nouns to just bananas and beer which do not overlap, due to the fact that they have different textures. We define the verb ${\lang{taste} : I \rightarrow N \otimes S \otimes N}$ as follows: \begin{align*} \lang{taste} &= (\lang{green banana} \otimes \{(0, 0)\} \otimes \lang{bitter}) \cup (\lang{green banana} \otimes \{(1, 1)\} \otimes \lang{sweet})\\ &\qquad \cup (\lang{yellow banana} \otimes \{(1, 0)\} \otimes \lang{sweet}) \cup (\lang{beer} \otimes \{(0, 1)\} \otimes \lang{sweet})\\ &\qquad \cup (\lang{beer} \otimes \{(1, 0)\} \otimes \lang{bitter}) \end{align*} \subsection{Example: Robot movement} We now present another example describing a simple formulation of robot movement. We will describe our choices of noun space~$N$ and sentence space~$S$, and show how to form nouns and verbs. \subsubsection{Nouns} The types of nouns we wish to describe are objects, such as \lang{armchair} and \lang{ball}, the robots \lang{Cathy} and \lang{David}, and places such as \lang{kitchen} and \lang{living room}. For shorthand, we call these nouns $a$, $b$, $c$, $d$, $k$, and $l$. These are specified in the noun space $N$ which is itself composed of a number of domains \[ N_\lang{location} \otimes N_\lang{direction} \otimes N_\lang{shape} \otimes N_\lang{size} \otimes N_\lang{colour}\otimes ... \] We firstly consider the kitchen and living rooms as being defined by convex subsets of points in the domain $N_\lang{location}$, defining properties in the location domain as: \begin{align*} p_\lang{kitchen location} &= \{(x_1, x_2) | x_1 \in [0, 5], x_2 \in [0, 10]\}\\ p_\lang{living room location} &= \{(x_1, x_2)| x_1 \in [5, 10], x_2 \in [0, 10]\} \end{align*} which can be depicted as follows: \begin{center} \input{rooms.tikz} \end{center} Then the nouns \lang{kitchen} and \lang{living room} are given by these properties together with other sets of characteristics in the shape domain, size domain, and so on, which we won't specify here. \begin{align*} \lang{kitchen} &= p_\lang{kitchen location} \otimes p_\lang{kitchen shape} \otimes p_\lang{kitchen size} \otimes ...\\ \lang{living room} &= p_\lang{living room location} \otimes p_\lang{living room shape} \otimes p_\lang{living room size} \otimes ... \end{align*} Similarly, the other nouns are defined by combinations of properties in the noun space. For this example, we do not worry too much about what they are, but assume that they allow us to distinguish between the objects. \subsubsection{Verbs} In order to define some verbs, we need consider what a suitable sentence space should look like. We want to give sentences of the form: \begin{center} The ball is in the living room\\ Cathy moves to the kitchen \end{center} In these sentences, an object or agent is related to a path through time and space. Note that in the case of the verb `is in', this path is in fact trivially just a point, however for `moves to', the path actually is a path through time and space, and we will need to use subsets of the time and location domains to specify one single event. We therefore define the sentence space to be comprised of the noun space $N$, a time dimension $T$, and the location domain $N_\lang{location}$: \[ S = N \otimes T \otimes N_\lang{location} \] The agent is represented by a point in the noun space $N$, and the path they take as described in the sentence is represented as a subset of the time and location domains. In what follows, we think of 0 on the time dimension $T$ as referring to `now', with negative values of $T$ referring to the past and positive values referring to the future. As in the food example, transitive verbs are of the form $N\otimes S \otimes N$. This means that in this example, they are of the form \[ N\otimes N \otimes T \otimes N_\lang{location} \otimes N, \] and can be thought of as sets of ordered tuples of the form \[ (n_1, n_2, t, l, n_3), \] where $n_i$ stands for points in the noun space, $t$ is a time, $l$ is a location. We will consider the following verbs: \lang{is\_in}, \lang{moves\_to} \footnote{It could be argued that these are not transitive verbs, but intransitive verbs plus preposition. However, we can parse the combination as a transitive verb, since a preposition has type $s^r s n^l$ and therefore the combination reduces to type of a transitive verb: \[ (n^r s)(s^r s n^l) \leq n^r s n^l \]}. The verb \lang{is\_in} can take any of the nouns $a$, $b$, $c$, or $d$ as subject, and any of $k$, $l$ as object. This verb refers to just one timepoint, i.e. now, or 0. The verb is as follows: \begin{equation} \label{eq:is} \lang{is\_in} = \{(\vec{n}, \vec{n}, t_\lang{now}, m_\lang{location}, \vec{m})| \vec{n} \in a\cup b \cup c \cup d, t_\lang{now} = 0, \vec{m} \in k\cup l\} \end{equation} The verb \lang{moves\_to} refers to more than one point in time. We need to talk about an object moving from being at one location at a past time, to another location at time 0, or now. This movement should be continuous, since the objects we are talking about do not teleport from one point to another. We will also restrict the subject of the sentence to being one of the nouns $a$, $b$, $c$, or $d$, as we don't want to talk about the kitchen and living rooms moving at this point. The object of the verb, however, can be any of the nouns, so we can say, for example, that `Cathy moves to the armchair', or `The ball moves to Dave' (presumably because Cathy kicked it). The most specific event that can be described in the space will track the exact path that an object takes through space and time. The meaning of a less specific sentence will be a convex subset of these trajectories. We now define the verb as follows: \begin{align} \lang{moves\_to} = \{&(\vec{n}, \vec{n}, [t,0], f([t, 0]), \vec{m}) \mid \nonumber \\ &\vec{n} \in a\cup b \cup c \cup d, t < 0, f \text{ continuous}, f(t) \in \vec{n}_\lang{location}, f(0) \in \vec{m}_\lang{location}\} \label{eq:moves} \end{align} The constraints on~$t$ ensure that the movement happened in the past, and the constraints on $f$ ensure that the movement is from the location of the subject to the location of the object of the verb. These definitions are a little complex, but we will see how they work in interaction. Note that the location nouns \lang{kitchen} and \lang{living room} might seem to be of a different type to the object and agent nouns \lang{armchair}, \lang{ball}, \lang{Cathy} and \lang{David}. For example, we have specified that \lang{kitchen} and \lang{living room} do not move around. In future research we will be extending to a richer type system which can take account of these sorts of differences, and which will in fact be closer to that proposed by G\"ardenfors in \citep{Gardenfors2014}. \section{Concepts in interaction} \label{sec:composing} We have given descriptions of how to form the different word types within our model of categorical conceptual spaces. In this section we show how to apply the type reductions of the pregroup grammar within the conceptual spaces formalism. \subsection{Sentences in the food space} The application of $\lang{yellow}_\lang{adj}$ to \lang{banana} works as follows. \begin{align*} \lang{yellow banana} &= (1_N \otimes \epsilon_N)(\lang{yellow}_\lang{adj} \otimes \lang{banana})\\ &=(1_N \otimes \epsilon_N)\{(\vect{x}, \vect{x}) | x_\lang{colour} \in \lang{yellow} \} \\ &\qquad\otimes (\{(R, G, B)|(0.9 R \leq G \leq 1.5 R), (R \geq 0.3), (B\leq 0.1)\} \\ &\qquad \otimes \ch{\{t_\lang{sweet}, 0.25t_\lang{sweet}+0.75t_\lang{bitter}, 0.7t_\lang{sweet}+0.3t_\lang{sour}\}} \otimes [0.2, 0.5])\\ &= \{(R, G, B)|(0.9 R \leq G \leq 1.5 R), (R \geq 0.7), (G \geq 0.7), (B\leq 0.1)\}\\ & \qquad \otimes \ch{\{t_\lang{sweet}, 0.25t_\lang{sweet}+0.75t_\lang{bitter}, 0.7t_\lang{sweet}+0.3t_\lang{sour}\}} \otimes [0.2, 0.5] \end{align*} Notice, in the last line, how the colour property has altered. This alteration restricts to yellow hues. This assumes that we can tell bananas and apples apart by shape, colour and so on. Then the same calculation gives us \begin{align*} \lang{soft apple} &= \{(R, G, B)|R - 0.7 \leq G \leq R + 0.7), (G \geq 1-R), (B\leq 0.1)\} \\ &\qquad \otimes \ch{\{t_\lang{sweet}, 0.75t_\lang{sweet}+0.25t_\lang{bitter}, 0.3t_\lang{sweet}+0.7t_\lang{sour}\}} \otimes [0.4, 0.6] \end{align*} Using the definition of \lang{taste} that we gave, we find that although sweet bananas are good: \begin{align*} &\lang{bananas taste sweet} = (\epsilon_N \otimes 1_S \otimes \epsilon_N)(\lang{bananas}\otimes\lang{taste}\otimes\lang{sweet})\\ &\qquad = (\epsilon_N \otimes 1_S)(\lang{banana} \otimes (\lang{green banana} \otimes \{(1, 1)\} \cup \lang{yellow banana} \otimes \{(1, 0)\})\\\nonumber &\qquad=\{(1,1), (1, 0)\} \\ &\qquad= \lang{positive} \end{align*} sweet beer is not so desirable: \begin{align*} \lang{beer tastes sweet} &= (\epsilon_N \otimes 1_S \otimes \epsilon_N)(\lang{beer}\otimes\lang{taste}\otimes\lang{sweet}) \\ &= \{(0, 1)\} \\ & = \lang{negative and surprising} \end{align*} \paragraph{Relative pronouns} The compositional semantics we use can also deal with relative pronouns, described in detail in \cite{KartsaklisSadrzadehPulmanCoecke2013}. Relative pronouns are words such as `which'. For example, we can form the noun phrase \lang{Fruit which tastes bitter}. This has the following structure: \[ \begin{gathered} \input{frob-sub-copy.tikz} \end{gathered} \] which simplifies to: \[ \begin{gathered} \input{frob-sub-copy-copy.tikz} \end{gathered} \] In our example, we find that $\lang{Fruit which tastes bitter} = \lang{green banana}$: \begin{align*} \lang{Fruit which tastes bitter} &= (\mu_N \otimes \iota_S \otimes \epsilon_N)(\ch{\lang{bananas} \cup \lang{apples}} \otimes \lang{taste} \otimes \lang{bitter})\\ &=(\mu_N\otimes \iota_S)(\ch{\lang{bananas} \cup \lang{apples}} \otimes (\lang{green banana} \otimes \{(0, 0)\}))\\ &=\mu_N(\ch{\lang{bananas} \cup \lang{apples}} \otimes (\lang{green banana})) \\ &= \lang{green banana} \end{align*} where $\mu_N$ is the Frobenius merge map on $N$ and $\iota_S$ is the delete map on~$S$ described in theorem~\ref{thm:convexrel} and remark~\ref{rem:mergedel}. \subsection{Sentences about robot movement} In this section we describe how to compute the meaning of sentences about robot movement. Our first example is the sentence `Cathy moves to the living room'. In order to compute the meaning of this sentence, we assume that Cathy has a location. \begin{align} &\lang{Cathy moves to the living room} \nonumber \\ &= (\epsilon_N \otimes 1_s \otimes \epsilon_N)(C \otimes \lang{moves\_to} \otimes L) \nonumber \\ & = (\epsilon_N \otimes 1_s \otimes)(C \otimes \{(\vec{n},\vec{n}, [t, 0], f([t, 0]))|f(0) \in L_\lang{location}\}\label{eq:moreconstraints}\\ & = \{C, [t, 0], f([t, 0])|f(t) \in C_\lang{location}, f(0) \in L_\lang{location}\} \nonumber \end{align} In line~\eqref{eq:moreconstraints} further constraints apply to~$t$ and~$f$ as described in equation~\eqref{eq:moves}. This calculation gives us a set of continuous line segments starting from Cathy's location at time $t$ and ending in the living room at time 0. We now need to check that this set of line segments is convex. We assume that Cathy can take any possible location, and her other attributes remain static. This means that the set of possible instantiations of Cathy is convex. The set of time segments $[t, 0]$ such that $t < 0$ forms a convex set. Consider two such time segments. We define a convex mixture of these segments pointwise: \[ p[t_1, 0] + (1 - p)[t_2, 0] = [pt_1 + (1 - p)t_2, p0 + (1 - p)0] =[pt_1 + (1 - p)t_2, 0] \] which clearly satisfies the condition that the start point is in the past and the end point is now. We then consider the convex mixture of two sets of locations $f_1([t_1, 0])$ and $f_2([t_2, 0])$. In order to carry this out, we first of all transform the intervals $[t_1, 0]$ and $[t_2, 0]$ to $[-1, 0]$ by dividing through by $-t_i$, renaming the rescaled functions $f_i^\prime$. We then form a convex combination: \[ pf_1^\prime + (1-p) f_2^\prime : [0,1] \rightarrow N_\lang{location} \] pointwise by taking: \[ (pf_1^\prime + (1-p) f_2^\prime)(\tau) = pf_1^\prime(\tau) + (1-p) f_2^\prime(\tau) = pf_1((-t_1)\tau) + (1-p) f_2((-t_2)\tau) \] Since both $f_1$ and $f_2$ are continuous in $T$, the result will be continuous in $T$. The constraints on these sets are that $f_1(t_1)$ and $f_2(t_2)$ are in $C_\lang{location}$ and that $f_1(0) $ and $f_2(0)$ are in $L_\lang{location}$, and we need that their convex combinations are also in these respective locations. We know that $C_\lang{location}$ and $L_\lang{location}$ are convex, meaning that \[ pf_1(t_1) + (1-p)f_2(t_2) \in C_\lang{location}\qquad\quad\mbox{and}\qquad \quad pf_1(0) + (1-p)f_2(0) \in L_\lang{location} \] as required. In this section, we have shown how we can use the interaction of words, represented by convex sets in conceptual spaces, to map sentence meanings down to a convex set in a conceptual space for sentences. \section{Discussion and related work} In this paper we have shown how grammar can be introduced to conceptual spaces theory by extending the categorical compositional scheme of \cite{CoeckeSadrzadehClark2010}. By using the kind of transformational compositionality that linguistic grammar introduces, we are able to extend compositional accounts beyond simply using variants of conjunction or disjunction that are seen in \cite{aerts2009, hampton1987, hampton1988con, hampton1988dis, LewisLawry2016}. This means that adjective-noun, verb-noun, and full sentence composition may be modelled, and the meanings of phrases and sentences are mapped into a shared meaning space. In the current work, we have restricted ourselves to grammatical composition, and in particular pregroup grammar. However, the categorical compositional scheme can be instantiated in a number of ways. The grammar can be changed from pregroup grammar to another categorial grammar, as in \cite{CoeckeGrefenstetteSadrzadeh2013}, or a compositional scheme that is not grammatically based may be used. Indeed, one of the challenges of this approach is to find a model of composition that accurately reflects human behaviour. One way of doing so would be to use an approach in which the syntactic scheme is generated by the semantics of the universe of discourse. Furthermore, since phrases and sentences are represented as sets equipped with a convex algebra, the model can in future work be extended to include logical composition. \subsection{Related work} Our general aim of integrating compositional and semantic aspects of cognition is a longstanding problem in AI. In the Integrated Connectionist-Symbolic framework \citep{smolensky2006}, the authors aim to integrate symbolic and connectionist reasoning, showing how symbolic reasoning can be instantiated in a neural network. One of the drawbacks of this approach is that sentence and phrase representations are dependent on the number of words in the phrase, so that it is difficult to directly compare noun phrases of different length, for example. That work inspired the development of the categorical compositional distributional semantic model of sentence meaning \citep{CoeckeSadrzadehClark2010} which the current work extends. Our research also has links to cognitive architectures which integrate compositional and semantic aspects of cognition. Examples of these are Nengo \citep{eliasmith2013}, neural blackboard architectures \citep{vandervelde2006}, and the previously mentioned \cite{smolensky2006}. Further, the use of conceptual spaces in cognitive architectures is an area of active research, as seen in, for example, \cite{forth2016,lieto2017}. Whilst the current work does not model key aspects of human cognition such as dynamics or action selection, it provides a model of compositionality that can be utilized by these architectures in representing inputs and how they may combine to form novel representations. There is a wide range of research into modelling meaning and compositionality within conceptual spaces to which the theory developed here relates. Conceptual spaces have been formalized in \cite{RickardAisbettGibbon2007, AdamsRaubal2009, lawry2009}, and recently in \cite{bechberger2017}. However the type of compositionality defined covers conjunction, disjunction, and correlations between domains, whereas the framework we propose covers a far more general type of compositionality. In \cite{warglien2012a}, the authors develop a theory of verbs within the conceptual spaces framework. That work presents a model of \emph{events} as consisting of at least a force vector and a result vector, together with a patient. It is also possible that an event has an agent, and an intention vector, amongst others. Verbs are then seen as being vectors that effect change, and which correspond only to one domain in the conceptual space. Our model has a similar goal in that it views a verb as a relation from one or more nouns to the sentence space. It therefore transforms nouns into sentences, which could be seen as events. However, rather than use a vector model of the verb, we use convex relations. \cite{derrac2015} use a data-driven approach to developing semantic relations within conceptual spaces. The relations obtained are modelled as directions within the conceptual space. \cite{mcgregor2016} develop a model of analogy within conceptual spaces, leveraging the geometrical properties of the meaning space. \section{Conclusion and future work} We have applied the categorical compositional scheme to cognition and conceptual spaces. In order to do this we introduced a new model for categorical compositional semantics, the category~\ensuremath{{\bf ConvexRel}}\xspace of convex algebras and binary relations respecting convex structure. We consider this model as a proof of concept that we can describe convex structures within our framework. Conceptual spaces are often considered to have further mathematical structure such as distance measures and notions of convergence or fixed points. It is also possible to vary the notion of convexity under consideration, for example by considering a binary betweenness relation on a space as primitive, rather than a mixing operation. On the theoretical side, identifying a good setting for rich conceptual spaces models, and incorporating those structures into a compositional framework is a direction for further work, building on \cite{MarsdenGenovese2017, CoeckeGenoveseLewisMarsdenToumi2017}. Other theoretical work to be done includes investigating the implementation of logic within \ensuremath{{\bf ConvexRel}}\xspace, specifically some form of negation, which in general does not preserve convexity. On the more practical side, future work includes implementation within a data-derived conceptual space. This could include linguistic data derived from a corpus, but the generality of the conceptual spaces framework may also encompass a wider range of inputs such as from visual stimuli. Following on from this, future work will investigate integration with a cognitive architecture that encompasses dynamics and action. \subsubsection*{Acknowledgements} This work was partially funded by AFSOR grant ``Algorithmic and Logical Aspects when Composing Meanings'', the FQXi grant ``Categorical Compositional Physics'', and EPSRC PhD scholarships. \bibliographystyle{apalike}
{'timestamp': '2017-10-02T02:06:35', 'yymm': '1703', 'arxiv_id': '1703.08314', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08314'}
arxiv
\section{Deferred proofs} \label{sec:app-proofs} \subsection{Utility curves and a characterization of optimal single-shot mechanisms.} The proofs in this section lead up to the conclusion of Theorem~\ref{thm:single-shot-opt}: both the optimal mechanism and the risk-averse utility that the buyer gets from it have a simple structure. \begin{numberedlemma}{\ref{lem:concaveUtil}} For any profile $\rprof$ and lottery $\lotteryp$, $\lrau{v}$ is a concave function of $v$. The slope of this function lies between $1 - \rprof(1-x)$ and $\rprof(x)$, where $x = \prob{\alloc = 1}$. \end{numberedlemma} \begin{proof} We assume that $\lotteryp$ satisfies $\prob{\paymt=0 \,\middle|\, \alloc=0} = 1$. Let $\dist_{\paymt}(p) = \prob{P \leq p \,\middle|\, \alloc=1}$. We further assume that $\dist_{\paymt}$ is differentiable, with p.m.f. $f_{\paymt}$. We make these assumptions for simplicity; both can be relaxed. By definition, \begin{align*} \lrau{v} = -\int_0^\infty \left(1-\rprof(\prob{vX-P \geq -z}) \right) dz + \int_0^\infty \rprof(\prob{vX-P \geq z}) dz. \end{align*} For $z \geq 0$, \begin{align*} \prob{vX-P \geq -z} &= 1 - \prob{X=1}\prob{P \geq v+z \,\middle|\, X=1} \\ &= 1 - x(1 - \dist_{\paymt}(v+z)), \intertext{and} \prob{vX-P\geq z} &= 1-\prob{X=1}\prob{P\geq v-z \,\middle|\, X=1} - \prob{X=0} \\ &= 1 - x(1 - \dist_{\paymt}(v-z)) - (1-x) \\ &= x\dist_{\paymt}(v-z). \end{align*} Therefore, \begin{align*} \drau{v} &= \int_0^\infty \rprof'\left(1 - x(1-\dist_{\paymt}(v+z))\right)xf_{\paymt}(v+z)dz \\ & \quad + \int_0^\infty \rprof'\left(x\dist_{\paymt}(v-z)\right)xf_{\paymt}(v-z)dz \\ &= \left.\rprof\big(1-x+x\dist_{\paymt}(v+z)\big)\right|_{z=0}^\infty \;-\; \left.\rprof\big(x\dist_{\paymt}(v-z)\big)\right|_{z=0}^\infty \\ &= 1 - \rprof(1-x+x\dist_{\paymt}(v)) + \rprof(x\dist_{\paymt}(v)). \end{align*} Note that when $\dist_{\paymt}(v) = 1$ (i.e., when $v$ is greater than the maximum price charged), $\drau{v} = \rprof(x)$. Similarly, when $\dist_{\paymt}(v) = 0$, $\drau{v} = 1-\rprof(1-x)$. In either case, $\drau{v} \geq 0$. Finally, to show concavity, we show $\ddrau{v} \leq 0$: \[ \ddrau{v} = xf_{\paymt}(v)\left[\rprof'(x\dist_{\paymt}(v))-\rprof'(1-x+x\dist_{\paymt}(v))\right]. \] The first term, $xf_{\paymt}(v)$, is always nonnegative. Note that $1-x + x\dist_{\paymt}(v) \geq x\dist_{\paymt}(v)$. Since $\rprof$ is convex and increasing, $\rprof'(1-x + x\dist_{\paymt}(v)) \geq \rprof'(x\dist_{\paymt}(v))$, and so $\ddrau{v} \leq 0$. \end{proof} \begin{lemma} \label{lem:util-dominance} Fix any (allocation, payment) pair $\lotteryp$. Let $(x,p)$ be the lottery that sells with probability $x = \prob{X=1}$ and charges $p = \expect{P}/x$. Then, assuming payments are non-negative, $\lrau{v}{x,p} \geq \lrau{v}$ for all $v$. \end{lemma} \begin{proof} First observe that $\expect{vX-P} = x(v-p)$, but we can also write it as \[ \expect{vX-P} = \int _0 ^\infty \prob{Z > z} dz - \int_{-\infty}^0(1-\prob{Z > z})dz \] where $Z = vX-P$ and it may range from $-\infty$ to $\infty$. Then \begin{align*} \lrau{v}{x,p} &= y(x)(v-p) \\ &= \frac{y(x)}{x} x(v-p) \\ &= \frac{y(x)}{x} \expect{vX-P}. \end{align*} Recall that $y(x)/x$ is non-decreasing in $x$ by convexity of $y$. As in the proof of Lemma~\ref{lem:concaveUtil}, we assume $\lotteryp$ satisfies $\prob{\paymt=0 \,\middle|\, \alloc=0} = 1$ (this can be relaxed). Then if $Z > 0$, it must be that $X = 1$, hence $\prob{Z > 0} \leq x$. Then for the positive values that $vX-P$ takes on, we have \begin{align*} \int _0 ^{\infty} \frac{y(x)}{x} \prob{Z > z} dz &\geq \int _0^\infty \frac{y(\prob{Z > z})}{\prob{Z > z}} \prob{Z > z} dz \\ &= \int _0 ^\infty y(\prob{Z > z}) dz. \end{align*} For the negative values that $Xv-P$ takes on, by monotonicity of $y(x)/x$ in $x$ and because the utility is negative, we have \begin{align*} -\frac{y(x)}{x} \int_{-\infty}^0(1-\prob{Z > z})dz &\geq - \int_{-\infty}^0 \frac{y(\prob{Z > z})}{\prob{Z > z}} (1-\prob{Z > z})dz \\ &\geq -\int_{-\infty}^0(1-\rprof(\prob{Z > z}))dz \end{align*} where the the second inequality follows from $-\frac{y(\prob{Z > z})}{\prob{Z > z}} \geq -1$. All together, \begin{align*} \lrau{v}{x,p} &\;=\; \frac{y(x)}{x} \expect{Xv-P} \\ &\;\geq\; \int_0^\infty y(\prob{Z > z})dz - \int_{-\infty}^0(1-\rprof(\prob{Z > z}))dz \\ &\;=\; \lrau{v}. \end{align*} \end{proof} \begin{lemma} \label{lem:rev-dominance} Fix $\rprof$, and let $\lotteryp$ be any (allocation, payment) pair. For any lottery $(x,p)$ such that there exists $v$ with $0 \leq \lrau{v}{x, p} \leq \lrau{v}$ and $x \geq \prob{\alloc = 1}$, the expected revenue of $(x,p)$ is at least as large as the expected revenue of $\lotteryp$. If $\lrau{v}{x, p} < \lrau{v}$, then the revenue is strictly larger. \end{lemma} \begin{proof} Let $x' = \prob{\alloc=1}$ and $p' = \expect{\paymt}/x'$. Note that the expected revenue from $(x',p')$ is exactly $\expect{\paymt}$. By Lemma~\ref{lem:util-dominance}, $\lrau{v} \leq \lrau{v}{x',p'}$. Since $0 \leq \lrau{v}{x,p} \leq \lrau{v}{x',p'}$, we have \begin{align*} \rprof(x')(v-p') &= \lrau{v}{x',p'} \\ &\geq \lrau{v}{x,p} \\ &= \rprof(x)(v-p). \end{align*} Since $x \geq x'$ by assumption, $\rprof(x) \geq \rprof(x')$. Therefore $p \geq p'$, and so $xp \geq x'p' = \expect{\paymt}$. Note that if $\lrau{v} > \lrau{v}{x,p}$, then $xp > \expect{\paymt}$. \end{proof} For any IC/IR mechanism $\lotteryp$ defined on the interval $[a, b]$, let $\ubar{u}(v)$ be the lower convex envelope of $\lrau{v}{\lottery[v]}$. That is, $\ubar{u}$ is the maximal convex function upper bounded by the utility curve. \begin{definition} \label{def:differentials} For any convex function $f : I \to \mathbb{R}$, the {\em subdifferential} of $f$ at $x \in I$ is \[ {\ubar{\partial}} f(x) = \{m : f(x') - f(x) \geq m(x' - x) \; \forall x' \in I\}. \] Likewise, for any concave function $g : I \to \mathbb{R}$, the {\em superdifferential} of $g$ at $x \in I$ is \[ {\bar{\partial}} g(x) = \{m : g(x') - g(x) \leq m(x' - x) \; \forall x' \in I\}. \] \end{definition} Let ${\ubar{\partial}}^*f(x) = \max\{m \in {\ubar{\partial}} f(x)\}$ be the maximal slope of a line tangent to $f$ at $x$. Similarly, define ${\bar{\partial}}^*g(x) = \min\{m \in {\bar{\partial}} g(x)\}$ to be the minimal slope of a line tangent to $g$ at $x$. \begin{lemma} \label{lem:util-conv-env} ${\ubar{\partial}}\ubar{u}(v) \subseteq [0, 1]$ for all $v \in [a, b]$. \end{lemma} \begin{proof} First, $\ubar{u}(v)$ is an nondecreasing function of $v$ because, by Lema~\ref{lem:concaveUtil}, $\lrau{v}$ is nondecreasing for all $\lotteryp$ in $\mathcal{M}$. So ${\ubar{\partial}}\ubar{u}(v) \subseteq [0,\infty)$ for all $v$. Let $v^*$ be any value in $[a,b]$. Since $\ubar{u}(v)$ is the lower convex envelope of $\lrau{v}{\lottery[v]}$, there exists $v_0 \leq v^*$ such that for all $v' > v^*$, \begin{align*} {\ubar{\partial}}^*\ubar{u}(v^*) &\leq \frac{\lrau{v'}{\lottery[v']} - \lrau{v_0}{\lottery[v_0]}}{v' - v_0} \\ & \leq \frac{\lrau{v'}{\lottery[v']} - \lrau{v_0}{\lottery[v']}}{v' - v_0} \\ & \leq \frac{v' - v_0}{v' - v_0} = 1 \end{align*} The second inequality follows by the definition of $\lotteryp[v_0]$, and the third follows from Lemma~\ref{lem:concaveUtil} together with the fact that $\rprof(\prob{\paymt[v']=1}) \leq 1$. \end{proof} \begin{numberedtheorem}{\ref{thm:single-shot-opt}} For any revenue optimal IC mechanism $(\mathbf{X}, \mathbf{P})$ in the single-shot setting, the buyer's utility function $\lrau{v}{\lottery[v]}$ is convex and nondecreasing. Furthermore, there exists an optimal ex-post IR mechanism that can be described as a menu of binary lotteries. \end{numberedtheorem} \begin{proof} First, we show that we can find a menu of lotteries $(x(v), p(v))$ which obtain a utility curve equal to $\ubar{u}$. Fix $v_0 \in [a,b]$. Let $m_0 = {\ubar{\partial}}^*\ubar{u}(v_0)$. Note that if $m_0 = 0$, then $\expect{\alloc[v_0]} = 0$ by Lemma~\ref{lem:concaveUtil}, and so $\expect{\paymt[v_0]} = 0$ by IR. So assume that $m_0 > 0$. Let $p = v_0 - \ubar{u}(v_0) / m_0$ and let $x = \rprof(m_0)$. Since $\ubar{u}(a) \leq a$ and $\ubar{u}(v)$ is convex and nondecreasing, $\ubar{u}(v_0) \leq m_0v_0$, so $p \geq 0$. By Lemma~\ref{lem:util-conv-env}, $m_0 \in [0, 1]$, so $x$ is a well-defined probability. So $(x,p)$ is a feasible lottery with utility curve tangent to $\ubar{u}$ at $v_0$: $\lrau{v_0}{x, p} = (v_0 - p)\rprof(x) = \ubar{u}(v_0)$ and $\dlrau{v_0}{x, p} = m_0$. It remains to show that $xp \geq \expect{\paymt[v_0]}$. For ease of notation, let $x_0 = \prob{\alloc[v_0] = 1}$. We will show that the conditions of Lemma~\ref{lem:rev-dominance} are satisfied: namely, that $x \geq x_0$ and there exists $v$ such that $0 \leq \lrau{v}{x, p} \leq \lrau{v}{\lottery[v_0]}$. The latter condition is satisfied at $v_0$ by construction, and the second inequality is strict if $\ubar{u}(v_0) < \lrau{v}{\lottery[v_0]}$. To show $x \geq x_0$, it suffices to show $m_0 \geq \rprof(x_0)$. Suppose $\ubar{u}(v_0) = \lrau{v_0}{\lottery[v_0]}$. It follows that \begin{align*} m_0 & = {\ubar{\partial}}^*\ubar{u}(v_0) \\ &\geq {\bar{\partial}}^*\lrau{v_0}{\lottery[v_0]} \\ &\geq \rprof(x_0). \end{align*} The first inequality holds because $\ubar{u}(v') \geq \lrau{v'}{\lottery[v_0]}$ for all $v' \geq v_0$. The second follows by Lemma~\ref{lem:concaveUtil}. Otherwise, if $\ubar{u}(v_0) < \lrau{v_0}{\lottery[v_0]}$, there exists a point\footnote{Possibly $v' = b$. Note that $\ubar{u}(b) = \lrau{b}{\lottery[b]}$.} $v' > v_0$ such that $\ubar{u}(v') = \lrau{v'}{\lottery[v_0]}$ and $\ubar{u}(v') = \ubar{u}(v_0) + m_0(v' - v_0)$. Thus, \begin{align*} \lrau{v'}{\lottery[v_0]} &= \ubar{u}(v_0) + m_0(v' - v_0) \\ &\leq \lrau{v_0}{\lottery[v_0]} + m_0(v' - v_0). \end{align*} Rearranging and appealing to Lemma~\ref{lem:concaveUtil}, we have \begin{align*} m_0 &\geq \frac{\lrau{v'}{X_{v_0}, P_{v_0}} - \lrau{v_0}{X_{v_0}, P_{v_0}}}{v' - v_0} \\ &\geq \rprof(x_0) \end{align*} \end{proof} \subsection{Monotonicity is required for Lemma~\ref{lem:rev-risk-monotonicity}.} \label{sec:app-monotone} The following example shows that the condition of monotonicity is necessary for Lemma~\ref{lem:rev-risk-monotonicity}. \begin{example} Suppose $F$ is a point mass at $v=1$, and $\mathcal{M}$ is a menu consisting of two lotteries: $x_1 = 1-2\epsilon/3$, $p_1 = 3/4$; and $x_2 = 1/2$, $p_2 = \epsilon$. Let $\rprof_1(x) = \max(3x/2 - 1/2, x^2)$ and $\rprof_2(x) = x^2$. Observe that $\rprof_1$ and $\rprof_2$ are non-crossing but not monotone. Under $y_1$, the buyer chooses the first lottery: \begin{align*} y_1(x_1)(1-p_1) &= \frac32(1-2\epsilon/3)\frac14 \\ &= (1/4)(1-\epsilon) \\ &= y_1(x_2)(1-p_2). \end{align*} The revenue under $y_1$ is therefore $\approx 3/4$. However, under $y_2$, the buyer chooses the second lottery: \begin{align*} y_2(x_1)(1-p_1) &= (1-3\epsilon/2)^2\frac14 \\ &< \frac14(1-\epsilon) \\ &= y_2(x_2)(1-p_2). \end{align*} The revenue under $y_2$ is therefore $\epsilon/2$. \end{example} \subsection{Lower bound for risk-robust approximation.} \label{sec:app-risk-robust} We will now prove Lemma~\ref{lem:lb-observations}. \begin{numberedlemma}{\ref{lem:lb-observations}} For the setting described in Section~\ref{sec:risk-robust-lb}, if $\left\{(p,\lp)\right\}_{p\in P}$ gives a risk-robust $c$-approximation, the following properties hold without loss of generality: \begin{enumerate} \item For all $p \in P$, $\lp \geq 1$. \item For any $\varepsilon$, $P_{\varepsilon} \supseteq [1,p_\varepsilon]$ where $p_\varepsilon$ is defined such that \begin{align*} 1 + \expect[v\sim F_1]{\min(v,p_{\varepsilon})} = \frac 1c \expect[v\sim F_1]{\min(v,\g_{\varepsilon}(0))}. \end{align*} \item For every $\varepsilon$, $p_\varepsilon = \alpha_c \g_{\varepsilon}(0)^{1/c}$ for some constant $\alpha_c > 0$ depending only on $c$. \item For every $\varepsilon$, the left derivative of $\g_{\varepsilon}(\lp)$ with respect to $p$ at $p=p_\varepsilon$ must be $\ge 1$. \end{enumerate} \end{numberedlemma} \begin{proof} We prove the statements in sequence: \begin{enumerate} \item Suppose there is a menu option $(p,\lp)$ for $p\in P$ with $\lp<1$. Consider replacing this menu option with the option $(p+1-\lp,1)$. Observe that the buyer's risk-averse utility under the two options is identical---relative to the original option, the buyer loses an additive amount of $1-\lp$ in his first-stage utility but gains the same additive amount of $1-\lp$ in his second-stage utility in the new menu option. On the other hand, the seller's revenue under the two options is also identical---the seller's first-stage revenue is higher by an additive $1-\lp$ amount under the new option, but his second-stage revenue is lower by the same additive $1-\lp$ amount. Therefore, without loss of generality, we may replace $(p,\lp)$ with the new option $(p+1-\lp,1)$ without affecting the buyer's utility or the seller's revenue. \item We show below that the effective menu $M_{\varepsilon}$ must be of the form $[1, p]$. Then, the revenue from such an effective menu is $1 + \expect[v\sim F_1]{\min(v,p)}$ because the buyer purchases the option with price $\min(v,p)$ in the first stage, and the mechanism gets a fixed revenue of $1$ in the second stage. In order to obtain a $c$-approximation, this quantity must be at least $\frac 1c \expect[v\sim F_1]{\min(v,\g_{\varepsilon}(0))}$, implying, by the definition of $p_\varepsilon$ that $p\ge p_\varepsilon$. \begin{itemize} \item First, for $\varepsilon<\varepsilon'$, $\mathcal{M}_{\varepsilon'}\subseteq\mathcal{M}_{\varepsilon}$. For any price $p$ in $\mathcal{M}_{\varepsilon'}$, and any $p' < p < 1/\varepsilon$, it must be the case that the effective price for $p'$ is at least as large: \[ p' - \g_{\varepsilon'}(\lp[p']) \geq p - \g_{\varepsilon'}(\lp). \] However, as $\g_{\varepsilon}(\lp) = \int _{\lp} ^{1/\varepsilon} \frac{1-F_2(v_2)-\varepsilon}{1-\varepsilon} dv_2$, then \begin{align*} \g_{\varepsilon}(\lp)-\g_{\varepsilon}(\lp[p']) &= \int_{\lp}^{\lp[p']} \frac{1-F_2(v_2)-\varepsilon}{1-\varepsilon} dv_2 \\ &\geq \int _{\lp} ^{\lp[p']} \frac{1-F_2(v_2)-\varepsilon'}{1-\varepsilon'} dv_2 \\ &= \g_{\varepsilon'}(\lp)-\g_{\varepsilon'}(\lp[p']) \\ &\geq p - p' \end{align*} Hence the effective price of $p - \g_{\varepsilon}(\lp)$ is preferable to any smaller first-stage price under $\varepsilon$; a buyer with value $p$ would prefer this menu option to all others. \item Second, we claim that without loss of generality effective menus are contiguous; adding missing points only improves revenue at all risk profiles in $\profiles$. Suppose not, and consider two first-stage prices in the effective menu, $p_1$ and $p_2 > p_1$, where no intermediate first-stage price is in the effective menu. Then $p_1 - \g(\lp[p_1]) \ge p_2 - \g(\lp[p_2])$. For every $\alpha \in (0,1)$, we can add a menu option $(p', \lp[p'])$ with first-stage price $p' = \alpha p_1 + (1-\alpha) p_2$. To have a non-increasing effective price, we note that it is possible to set $\lp[p'] = \g^{-1}(\alpha \g(\lp[p_1]) + (1-\alpha) \g(\lp[p_2])$ since $\lp[p_1] > \lp[p_2]$ and $\g(\lp[p_1]) < \g(\lp[p_2])$. Then a buyer with value $v \in (p_1, p_2)$ will pay $v$ instead of $p_1$, earning only more revenue for the seller. \item Finally, it is without loss of generality to assume that the effective menu is of the form $[1,p]$. From the first two observations we know that the menu is of the form $[l,h]$, earning revenue in the first stage equal to $\expect[v \sim F_1]{\min(v,h) \cdot \mathbbm{1}_{[v > l]}}$. Suppose that $h-l = p$. Because the revenue is the area above the c.d.f from $l$ to $h$, a window of width $p$, this is strictly increased by shifting the window to the left, at $[1, p]$. \end{itemize} \item This follows by recalling that for any $p$, $\expect[v\sim F_1]{\min(v,p)} = 1+\ln p$, and then solving for $p_\varepsilon$. \item For any $p < p_\varepsilon$, because $p_\varepsilon$ is in the effective menu, then for all $p < p_\varepsilon$, \begin{align*} & p_\varepsilon - \g_\varepsilon(\lp[p_\varepsilon]) \leq p - \g_\varepsilon(\lp). \\ \intertext{Therefore} & \lim _{p \rightarrow p_\varepsilon} \frac{\g_\varepsilon(\lp[p_\varepsilon]) - \g_\varepsilon(\lp)}{p_\varepsilon - p} \geq 1.\\ \end{align*}% \end{enumerate} \end{proof} \begin{proofof}{Lemma~\ref{lem:g0-lb}} For any $\varepsilon \ge e^{-n}$, \begin{align*} \g_\varepsilon(0) &= 1 + \int_1^{e^n}\wte(1/v)dv \\ &= 1 + \int_1^{1/\varepsilon}\left[\frac1v(1+\varepsilon) - \varepsilon\right]dv + \int_{1/\varepsilon}^{e^n}\frac1{v^2}dv \\ &= 1 + (1+\varepsilon)\ln 1/\varepsilon - \varepsilon(1/\varepsilon-1) + \varepsilon - e^{-n} \\ &= 2\varepsilon - e^{-n} + (1+\varepsilon)\ln 1/\varepsilon. \end{align*} Since $\varepsilon \ge e^{-n}$, this is at least $\ln 1/\varepsilon$. If $\varepsilon < e^{-n}$, a similar argument shows $\g_\varepsilon(0) \geq n$. \end{proofof} \section{Two-Stage Revenue Maximization} We now turn to a setting in which the seller has two items to sell to the buyer in succession. We will denote the buyer's values for the two items by $v_1$ and $v_2$. The values are drawn from independent distributions with c.d.f.s $F_1$ and $F_2$, and the buyer's value for receiving both of the items is $v_1+v_2$. The mechanism proceeds in two stages. In the first stage, the seller announces a mechanism by which to sell the first item and the buyer reveals $v_1$. At this time, neither the buyer nor the seller knows the buyer's value for the second item. The buyer must report his value to the first-stage mechanism before learning $v_2$. At the start of the second stage, the seller announces a second mechanism, which may depend on the buyer's first-stage decision, by which to sell the second item. \paragraph{Properties of two-stage mechanisms.} A two-stage mechanism is {\em incentive-compatible} if for any report $v_1$ during the first stage, the second-stage mechanism is incentive-compatible with respect to reporting $v_2$, and the combination of the first- and second-stage mechanisms is incentive-compatible with respect to reporting $v_1$. We further impose the constraint of {\em ex-post IR} which states that the price charged to the buyer in either stage cannot exceed the ex-post value obtained by the buyer in that stage. Recall that ${\normalfont\textsc{OPT}}(\rprof, F_1)$ and ${\normalfont\textsc{OPT}}(\rprof, F_2)$ denote the optimal revenue that the seller can obtain by selling items 1 and 2 respectively via independent mechanisms (such as posting a fixed price in each stage). We will denote by ${\normalfont\textsc{OPT}}(\rprof, F)$ the optimal revenue achievable by an incentive-compatible ex-post IR mechanism for the two stages combined, where $F=F_1\times F_2$ denotes the joint distribution over $(v_1, v_2)$. Of course, ${\normalfont\textsc{OPT}}(\rprof, F)\ge {\normalfont\textsc{OPT}}(\rprof, F_1)+{\normalfont\textsc{OPT}}(\rprof, F_2)$, but in fact, the former can be much larger than the latter sum. Observe that the second-stage mechanism can depend on the buyer's first-stage report. This gives the seller some flexibility in extracting more revenue in the first stage. \citet{ADH16} show, in particular, that for risk-neutral buyers the seller can charge a premium on the first stage in exchange for more utility in the second stage, which in some settings allows the seller to extract almost the entire second-stage social welfare as revenue. We will show that a similar result is achievable under our model of risk aversion. A two-stage mechanism can be described without loss of generality as a menu of options with each option being a three-tuple of random variables $(X,P,M)$, where $X$ is an indicator variable representing the allocation of item 1 to the agent, $P$ is the price to be paid in stage one, and $M$ is an incentive-compatible mechanism for the second stage. Let $U(v_2,M)$ be a random variable denoting the ex-post utility that the agent obtains from mechanism $M$ in stage two. Then, the buyer's risk-averse utility from the menu option $(X,P,M)$ in stage one is given by \[ \rae{v_1X - P + U(v_2,M)}, \] where the weighted expectation is taken over the randomness in the mechanisms as well as the randomness in the agent's second-stage value. In the first stage, the agent chooses the menu option that maximizes his risk-averse utility. Observe that once again $X, P,$ and $M$ can be arbitrarily correlated. In particular, the contribution of the second-stage mechanism $M$ to the buyer's risk-averse utility in stage one can depend not only on the chosen menu option and his expected $v_2$, but also on his actual value $v_1$. This makes it challenging to reason about the choices of the agent and account for the contribution of the agent's second-stage utility to the first-stage revenue, as we see in the following example. \begin{example} Consider a menu option that with probability $x$ allocates the first item to the bidder and charges him $p$, and then always gives the second item away for free. Then with probability $1-F_2(v_2)$, the buyer gets utility of at least $v_2$ from the second item. Suppose $v_2 \sim U\{1, 2\}$. Let $\rprof(x)=x^2$ for all $x$. We will compute the utility of the buyer from this menu option at different first-stage values. Observe that although the menu option, in particular the second-stage mechanism, stays the same, the contribution of the first- and second-stage mechanisms to the buyer's utility vary as $v_1$ varies. Case 1: $v-p \geq 2$. Getting the first item is worth more than any second-stage utility alone. Then the buyer's utility is \begin{align*} & y(1)1 + y((1-x)/2) (2-1) \\ & \quad \quad + y(x)(v-p - 2) + y(x/2)(2) \\ & = x^2(v-p) + 1 + \frac{(1-x)^2}{4} - \frac{3x^2}{2}. \end{align*} Case 2: $v-p \in (1,2)$. Getting the second item when his value is high is worth more than just getting the first item. His utility from this mechanism is \begin{align*} &y(1)1 + y((1-x)/2) (v-p-1) + y(1/2)(2-(v-p)) + y(x/2)(v-p) \\ &\qquad = \frac{x(x-1)}{2}(v-p) + \frac{3}{2} - \frac{(1-x)^2}{4} \end{align*} In the case where $p=1$, $x=1/2$, $y=x^2$, and $v$ is 4 in the first case and 2.5 in the second, we get that the first case has utility $12/16 + 11/16 = 23/16$ and the second case has utility $- 3/16+ 23/16 = 5/4$. \end{example} We focus on a simple and practical class of mechanisms, namely posted-price mechanisms, that in addition to ${\normalfont\textsc{OPT}}(\rprof, F_1)+{\normalfont\textsc{OPT}}(\rprof, F_2)$ can in some cases obtain an additional $\rae{v_2}$ in revenue, matching results known for the risk-neutral setting. \subsection{Posted-price mechanisms and their revenue properties.} A two-stage posted-price mechanism is specified by a menu, where each menu option is a pair of prices $(p_1, p_2)$. If the buyer selects this menu option, he is offered item 1 at a price of $p_1$ and promised item 2 at a price of $p_2$. Observe that the buyer makes this choice knowing $v_1$ but not knowing $v_2$. The buyer would potentially be willing to pay a higher price for item 1 if in return he is promised a lower price for item 2. Accordingly, the undominated menu options\footnote{A menu option is dominated by another if the buyer prefers the latter to the former regardless of his value for the first item.} correspond to higher first-stage prices being coupled with lower second-stage prices and vice versa. In the remainder of this section, we use the notation $\texttt{PP}_{\ell}$ to represent a two-stage posted-price mechanism that offers menu options $(p, \lp)$ for every price $p$ in some range, where $\lp[\cdot]$ is a non-increasing function mapping the first-stage price to the corresponding second-stage price.\footnote{Observe that this notation captures menus with a finite number of options. In particular, if the function $\lp$ is constant over a range of prices $p$, then all options other than the smallest price in that range are dominated, and effectively not present in the menu.} \paragraph{The buyer's optimization problem.} Fix a posted-price mechanism $\texttt{PP}_{\ell}$, and consider a buyer with probability weighting function $\rprof$ and first-stage value $v_1$. Observe that if the buyer purchases the menu option $(p,\lp)$, he gets utility of $v_1-p$ with probability 1, and expects to obtain some (random) utility from the second-stage posted price of $\lp$. The risk-averse expectation of the buyer's second-stage utility from posted price $p_2$ can be written as \begin{align*} \g(p_2) & := \rae{\max(0,v_2-p_2)} \\ &= \int_{0}^{\infty} \rprof(1-F_2(z+p_2)) dz \\ &= \int_{p_2}^{\infty} \rprof(1-F_2(z)) dz. \end{align*} Accordingly, the buyer's risk-averse utility in the first stage from purchasing option $(p,\lp)$ is \begin{align*} v_1-p+\g(\lp). \end{align*} The menu option $(p,\lp)$ gives the buyer the same utility as offering an ``effective price" of $p-\g(\lp)$ in a single-shot mechanism. Accordingly, the buyer chooses the menu option corresponding to the minimal $p - \g(\lp)$ over all prices that he can afford, that is, with $p\le v_1$. Then without loss of generality, the mechanism contains menu options with effective prices that are non-increasing in the first-stage price, as otherwise they would be dominated. We assume without loss of generality that the buyer breaks ties across menu options with equal effective prices in favor of the largest first-stage price. \begin{comment} The buyer chooses a menu option with the smallest effective price. Observe that this choice is independent of his first-stage value. Let $\mathcal{P}_{\textrm{eff}}$ denote the set of all first-stage prices corresponding to the smallest effective price. If $|\mathcal{P}_{\textrm{eff}}|>1$, we assume without loss of generality that the buyer purchases the option corresponding to the largest price $p\in\mathcal{P}_{\textrm{eff}}$ with $p\le v_1$. \end{comment} \begin{example} Consider a buyer with $v_1, v_2 \sim U[0,1]$ and probability weighting function $\rprof(x)=x^2$. Consider the mechanism that offers menu options $(0,1)$, $(\frac{1}{6}, \frac{1}{2})$, and $(\frac{1}{3}, 0)$. Note that $\g(\lp) = \int _{\lp} ^1 (1-v_2)^2 dv_2$. Then $\g(1) = 0$, $\g(0) = \frac{1}{3}$, and $\g(\frac{1}{2}) \approx 0.04$. This gives \begin{center} \renewcommand{\arraystretch}{1.3} \begin{tabular}{@{}M{2cm}M{5cm}@{}} \toprule Option & Utility \\ \midrule $\displaystyle\left(0,1\right)$ & $\displaystyle v-0+\g(1) = v$ \\ $\displaystyle\left(\tfrac16, \tfrac12\right)$ & $\displaystyle v-\tfrac16+\g\left(\tfrac12\right)\approx v-0.13$ \\ $\displaystyle\left(\tfrac13, 0\right)$ & $\displaystyle v - \tfrac13 + \g(0) = v$ \\ \bottomrule \end{tabular} \end{center} Then a buyer with $v \in [0, \frac{1}{3})$ will purchase the option $(0,1)$; a buyer with $v \in [\frac{1}{3}, 1]$ will purchase the option $(\frac{1}{3}, 1)$; and no buyer will purchase the option $(\frac{1}{6}, \frac{1}{2})$, as it is dominated by the other options with cheaper effective prices of $0 < 0.13$. \end{example} \subsubsection*{The seller's revenue.} We now present an upper bound on the revenue achievable via two-stage posted-price mechanisms. \begin{theorem} \label{lem:pp-ub} The revenue of any two-stage posted-price mechanism for a buyer with value distribution $F_1\times F_2$ and probability weighting function $\rprof$ is upper-bounded by \[{\normalfont\textsc{Mye}}(F_1) + {\normalfont\textsc{Mye}}(F_2) + \expect[v_1\sim F_1]{\min(v_1, \rae{v_2})}. \] \end{theorem} \begin{proof} We will account for the seller's revenue in the two stages separately. Observe first that regardless of the buyer's first-stage value, the revenue obtained by the seller in the second stage is no more than ${\normalfont\textsc{Mye}}(F_2)$. \begin{comment} Now let's consider the seller's first-stage revenue. Let $p_{\min}$ denote the smallest price in the set $\mathcal{P}_{\textrm{eff}}$. Observe that since the effective price at each first-stage price in $\mathcal{P}_{\textrm{eff}}$ is equal, for any $p\in\mathcal{P}_{\textrm{eff}}$, we have \begin{align*} p = p_{\min} - \g(\lp[p_{\min}]) + \g(\lp) \le p_{\min} + \g(0), \end{align*} where $\g(0) = \rae{v_2}$ is the risk-averse expectation of the buyer's second-stage value. \end{comment} Now let's consider the seller's first-stage revenue. Let $p_{\min}$ denote the smallest price offered in stage one. Because the ``effective price'' is non-increasing as a function of the first-stage price, we have $p - \g(\lp) \le p_{\min} - \g(\lp[p_{\min}])$, hence $$p \le p_{\min} - \g(\lp[p_{\min}]) + \g(\lp) \le p_{\min} + \g(0),$$ where $\g(0) = \rae{v_2}$ is the risk-averse expectation of the buyer's second-stage value. On the other hand, the buyer never pays more than $v_1$ in the first stage. Therefore, the seller's first-stage revenue, when the buyer's first-stage value is $v_1\gep_{\min}$, is bounded by $\min(v_1, p_{\min}+\g(0))$. We can now bound the seller's first-stage revenue by \begin{align*} & \expect[v_1\sim F_1]{\min(v_1, p_{\min}+\g(0))} \\ & \quad \le p_{\min}(1-F_1(p_{\min})) + \expect[v_1\sim F_1]{\min(v_1, \g(0))} \\ & \quad \le {\normalfont\textsc{Mye}}(F_1) + \expect[v_1\sim F_1]{\min(v_1, \g(0))} \end{align*} \end{proof} We will now show that there exists a simple posted-pricing mechanism that achieves a 2-approximation to the upper bound in Theorem~\ref{lem:pp-ub}. \begin{theorem} \label{lem:pp-lb} For the two-stage setting described above, there exists a posted-price mechanism $\texttt{PP}_{\ell}$ that obtains revenue at least \[\frac 12\left({\normalfont\textsc{Mye}}(F_1) + {\normalfont\textsc{Mye}}(F_2) + \expect[v_1\sim F_1]{\min(v_1, \rae{v_2})} \right). \] \end{theorem} \begin{proof} Charging the optimal single-shot posted-price in each stage already obtains revenue ${\normalfont\textsc{Mye}}(F_1) + {\normalfont\textsc{Mye}}(F_2)$. We will now describe a posted-price mechanism $\texttt{PP}_{\ell}$ that obtains revenue at least $\expect[v_1\sim F_1]{\min(v_1, \g(0))}$. The intuition that a mechanism can achieve this is as follows: if every menu option charges a price $p$ but guarantees utility equal to $p$ back in the next stage, then the buyer will be willing to pay any price subject to ex-post IR. The better of these two mechanisms achieves the bound stated in the lemma. The mechanism $\texttt{PP}_{\ell}$ offers menu options $(p,\lp)$ with $\lp = \g^{-1}(p)$ for all $p\in [0,\g(0)]$. Observe that since $\g$ is continuous and ranges from $\g(\infty)=0$ to $\g(0)$, for every $p$ in the range $[0,\g(0)]$, a second-stage price $\lp=\g^{-1}(p)$ exists, and therefore the mechanism is properly defined. Furthermore, for every menu option, $(p,\lp)$, we have $p - \g(\lp) = p-p=0$. So all menu options bring the same effective utility to the buyer on the first stage, and by default the buyer purchases the most expensive one that he can afford. Consequently, the seller's first-stage revenue is given by $\min(v_1, \g(0))$, and the theorem follows. \end{proof} \subsection{Risk-robust approximation.} \label{sec:risk-robust-lb} We now turn to risk-robust approximation in the two-stage setting. Observe that the results of Section~\ref{sec:single-shot} already imply that we can obtain a risk-robust approximation to the single-shot revenue achievable in each stage independently, when the buyer's weighting function is bounded (Definition~\ref{def:boundedness}). Can we obtain a risk-robust approximation to the last term in the bound given by Lemma~\ref{lem:pp-ub}, namely, $\expect{\min(v_1, \rae{v_2})}$? In this section we argue that this last term cannot be extracted via a posted-pricing mechanism in a risk-robust manner even if all of the possible weighting functions for the buyer are bounded.\footnote{Observe, of course, that if the risk averse expectation of the buyer's second-stage value does not differ much across the different weighting functions, then we can use ideas from Section~\ref{sec:single-shot} to extract the optimal revenue in a risk-robust manner.} This fact leads to Theorem~\ref{thm:2day-lb}. \begin{theorem} \label{thm:2day-lb} No posted-price mechanism can obtain a constant-factor risk-robust approximation to revenue in the two-stage dynamic setting. This holds even if all of the relevant weighting functions are $\Theta(1)$-bounded. \end{theorem} At a high-level, the idea behind our construction is as follows. We choose the family of weighting functions and the second-stage value distribution in such a way that although all of the weighting functions satisfy the boundedness property, they cover a large range of weighted expectations for the second-stage value, placing different constraints on the first-stage menu. Intuitively, in order to extract enough revenue, the seller must offer a menu with many different prices, indeed a continuum of first-stage prices. Then, to incentivize the buyer to pay as high a price as he can afford in the first stage, the seller must provide a discount over the second stage's price. The extent of discount provided depends on the most risk-averse weighting function for which the effective menu contains the corresponding option. As the buyer goes from being very risk-averse to almost risk-neutral, the seller needs to offer a bigger and bigger discount for higher and higher first-stage prices, and eventually runs out of discounts to offer. We now make this formal. Consider a two-stage mechanism design setting where the buyer's value for the first stage is distributed according to the unbounded equal revenue distribution, that is, $F_1(v_1) = 1-1/v_1$ for $v_1\ge 1$, and his second-stage value is distributed according to the equal revenue distribution bounded at $e^n$, that is, $F_2(v_2) = 1-1/v_2$ for $v_2\in [1,e^n]$. We will consider a family $\profiles$ of weighting functions parameterized by $\varepsilon\in[0, 1]$ as follows. \begin{align*} \wte(x) & = \begin{cases} x^2 &\text{for } x\in [0, \varepsilon] \\ (1+\varepsilon)x - \varepsilon &\text{for } x \in [\varepsilon,1] \end{cases} \end{align*} In words, $\wte(x)$ is equal to $x^2$ up to $\varepsilon$, and then rises linearly to $\wte(1)=1$. Observe that each function in this family is convex and at least $1/8$-bounded. Suppose that $\mathcal{M}=\{(p,\lp)\}_{p\in P}$ for some $P \subset \mathbb{R}_{\ge 0}$ is a menu that achieves a risk-robust $c$-approximation, $c > 1$, with respect to the family $\profiles$. Let $P_\varepsilon \subseteq P$ index the ``effective menu" when the buyer's weighting function is $\wte$, i.e., the set of first-stage prices corresponding to menu options that the buyer actually purchases at some value. Any option indexed by $p \in P \setminus P_\varepsilon$ is dominated. Recall that $\g_{\varepsilon}(\lp)$ is the risk-averse utility that a buyer with weighting function $\wte$ obtains from the second-stage mechanism when he chooses first-stage price $p$: \begin{equation*} \g_{\varepsilon}(\lp) = \begin{cases} \int_{\lp}^{e^n} \wte(1/v_2) dv_2 &\text{for } \lp \geq 1 \\ 1 - \lp + \int_1^{e^n}\wte(1/v_2) dv_2 &\text{otherwise.} \end{cases} \end{equation*} \noindent We make the following observations about effective menus. See Appendix~\ref{sec:app-risk-robust} for proofs. \begin{lemma} \label{lem:lb-observations} For the setting described above, if $\left\{(p,\lp)\right\}_{p\in P}$ gives a risk-robust $c$-approximation, the following properties hold without loss of generality: \begin{enumerate} \item \label{lem:lp-lb} For all $p \in P$, $\lp \geq 1$. \item \label{lem:peps} For any $\varepsilon$, $P_{\varepsilon} \supseteq [1,p_\varepsilon]$ where $p_\varepsilon$ is defined such that \[ \label{eq:peps} 1 + \expect[v\sim F_1]{\min(v,p_{\varepsilon})} \;=\; \frac1c \expect[v\sim F_1]{\min(v,\g_{\varepsilon}(0))}. \] \item \label{lem:pstar} For every $\varepsilon$, $p_\varepsilon = \alpha_c \g_{\varepsilon}(0)^{1/c}$ for some constant $\alpha_c > 0$ depending only on $c$. \item \label{lem:derivative} For every $\varepsilon$, the left derivative of $\g_{\varepsilon}(\lp)$ with respect to $p$ at $p=p_\varepsilon$ must be $\ge 1$. \end{enumerate} \end{lemma} Informally, the first property holds because second-stage prices below 1 lose as much second-stage revenue as they gain on the first stage; the second property is a consequence of minimizing the required second-stage discounts; the third follows by solving Equation~\eqref{eq:peps}; the fourth follows from the assumption that prices in $P_\varepsilon$ are undominated. We can now derive a differential equation for the function $\lp$. First, \begin{align} \notag \frac{d\, \g_\varepsilon(\lp)}{dp} &= \begin{cases} -\wte(1/\lp) \lpp &\text{when } \lp\ge 1 \\ -\lpp & \text{ otherwise.} \end{cases} \intertext{Then, Lemma~\ref{lem:lb-observations}~\eqref{lem:derivative} implies} \label{eq:DE} -\lpp &\ge \begin{cases} \frac{1}{\rprof_{\varepsilon_p}(1/\lp)} &\text{when } \lp\ge 1\\ 1 &\text{ otherwise,} \end{cases} \end{align} where, for any price $p$, $\varepsilon_p$ is the value of $\varepsilon$ for which $p=p_\varepsilon$ as given by Equation~\eqref{eq:peps}. We have the following two boundary conditions: \begin{align} \label{eq:boundary-low} \lp[1] & \le e^n & & \text{and} \\ \label{eq:boundary-high} \lp & > 1 & & \text{for } p < p_0. \end{align} The first enforces that the second-stage price at $p=1$ be no more than the maximum value that $v_2$ takes. The second follows from Lemma~\ref{lem:lb-observations}~\eqref{lem:lp-lb}. We use $\lpb$ to denote the solution to Equations~\eqref{eq:DE} and \eqref{eq:boundary-low}, each with inequality replaced by equality. So $\lpb$ gives an upper bound on $\lp$. We will show that, for large enough $n$, a solution to \eqref{eq:DE} which satisfies \eqref{eq:boundary-low} cannot also satisfy \eqref{eq:boundary-high}. The following claim will be useful; a proof appears in Appendix~\ref{sec:app-risk-robust}. \begin{lemma} \label{lem:g0-lb} For all $\varepsilon$, $\g_\varepsilon(0) \geq \min\{\ln1/\varepsilon, n\}$. \end{lemma} \noindent We are now ready to prove Theorem~\ref{thm:2day-lb}. \begin{proof}{Theorem~\ref{thm:2day-lb}} By Lemma~\ref{lem:lb-observations}~\eqref{lem:pstar}, $p_\varepsilon = \alpha_c \g_\varepsilon(0)^{1/c}$. Fix $\varepsilon^* = e^{-(2/\alpha_c)^c}$, and let $N = (2/\alpha_c)^c$. Then, by Lemma~\ref{lem:g0-lb}, for all $n > N$, \begin{equation*} p_{\varepsilon^*} \geq \alpha_c (\ln 1/\varepsilon^*)^{1/c} = 2. \end{equation*} Note that $\varepsilon^* \le \varepsilon_p \le 1$ for all $p \in [1,2]$. We now show that $\lpb[2]$ is at most $1/\varepsilon^*$ for all $n > N$. Suppose not. Then, for all $p \in [1,2]$, $\lpb \geq \lpb[2]$ and $\varepsilon_p \geq \varepsilon^*$ implies that $\lpb>1/\varepsilon_p$, or $1/\lpb<\varepsilon_p$. So by the definition of $\wte$ we have $\wte[\varepsilon_p](1/\lpb) = \lpb^{-2}$. Thus the differential equation~\eqref{eq:DE} simplifies to $-\lpbp = \lpb^2$ for $p\in [1,2]$. The solution, incorporating the boundary condition $\lpb[1]= e^n$, is \[ \lpb = \frac1{e^{-n} + p - 1}, \] and so $\lpb[2] = 1/(e^{-n} + 1) < 1$, a contradiction. But if $\lpb[2]$ is bounded above by $1/\varepsilon^*$, we can argue that $\lp\le\lpb = 1$ at some $p < p_0$, contradicting the boundary condition~\eqref{eq:boundary-high}. Specifically, Equation \eqref{eq:DE} gives $\lpbp \leq -1$ for all $\lpb \geq 1$, so $\lpb[1/\varepsilon^* + 1] \leq \lpb[2] - (1/\varepsilon^* - 1) \le 1$. On the other hand, by Lemma~\ref{lem:lb-observations}~\eqref{lem:pstar}, $p_0 \propto n^{1/c}$, so for large enough $n$ we have $p_0 > 1/\varepsilon^* + 1$. \end{proof} \section{Introduction} Most work in mechanism design is based on the assumptions that agents have quasilinear utilities and are expected utility maximizers. Owing to its linearity, this model of behavior is mathematically simple and allows for a number of beautiful characterizations of optimal and near-optimal mechanisms. The few exceptions to this line of work employ \citet{neumann44a}'s expected utility theory (EUT): assuming that agents are expected utility maximizers, although they may have a non-linear utility for money.\footnote{In particular, if the monetary value of the outcome of a process is (random variable) $v$, then the agent derives a utility $u(v)$, where $u$ is some non-linear function, and aims to maximize $\expect{u(v)}$. In the risk-neutral case, $u$ is the identity function.} Reality, however, is more complex. Numerous experiments, including the famous Allais paradox \citep{Allais53},\footnote{Subjects are asked to choose between two options: option A rewards \$1M with certainty; option B rewards \$1M with probability 89\%, increases the reward to \$5M with probability 10\%, but rewards nothing with the remaining 1\% probability. Most people prefer the certain reward to the small-probability risk of getting nothing, even though the latter is counterbalanced by the possiblity of a much larger reward. Subjects are then asked to choose between two other options that are modifications of the first two: option C has a reward of \$1M with 11\% probability and nothing otherwise; option D rewards \$5M with probability 10\%, or nothing with the remaining 90\% probability. Each of C and D are obtained from options A and B by reducing the probability of receiving the \$1M reward by a fixed amount and replacing it with no reward. The paradox is that in the second case, most people choose option D over option C. No assignment of utilities to the two amounts can explain this ``switch'' in preferences across the two experiments. This paradox can be explained through prospect theory, including the special case that we study.} have uncovered behavior that cannot be captured by EUT. Among the work in behavioral game theory that attempts to fit a mathematical model onto observed attitudes, the most accepted non-EUT theory is \citet{prospect}'s Prospect Theory (PT) and its extensions. Prospect theory hypothesizes that risk attitudes arise not only from a non-linear utility for money but also from agents' perception of random outcomes. For example, the risk attitude of a buyer who prefers \$50 with certainty over \$100 with probability 1/2 can be explained in two ways: as in EUT, the buyer may value \$100 at less than twice \$50; alternately, the buyer may value obtaining \$100 with probability 1/2 at less than half his value for \$100. Thus, {\em aversion to uncertainty}\footnote{In this paper, the term ``uncertainty'' refers to chance or randomness rather than Knightian uncertainty. We sometimes use the term ``uncertainty aversion'' to distinguish prospect-theoretic risk attitudes from EUT-style risk attitudes. Elsewhere in the paper, however, risk will refer to PT-style risk.} provides an alternate explanation for this example, with or without a concave utility for money. A basic premise of PT is that agents fundamentally misvalue random events. On the other hand, much of optimal mechanism design relies on the use of randomness, both in exploiting the agent's uncertainty about the environment and other agents' types, as well as in offering randomized outcomes or lotteries. As such, it is imperative to understand whether the main insights and results of mechanism design continue or fail to hold under risk attitudes described by prospect theory. In this paper we revisit some basic mechanism design questions for risk-averse agents who undervalue random outcomes. While PT has been studied extensively within behavioral economics, to our knowledge ours is the first work to consider its implications for mechanism design.\footnote{See a complete discussion of related work at the end of this section.} We consider the setting of selling one or two items to a single buyer, with the goal of maximizing the seller's revenue. \subsubsection*{A basic model for aversion to risk.} In general, prospect theory incorporates both an agent's non-linear utility for value and a non-linear attitude toward probability. The buyer's net utility from a random value is then the weighted (non-linearly over outcomes) expectation of the non-linear utility function applied to the value. We aim to isolate the effect of this non-linear weighting of probability on mechanism design, and therefore consider a simpler special case in which the utility function is linear but the buyer maximizes weighted expected utility. In our model, if the agent is offered a gain of $u$ with probability $x$, his utility from this random outcome is given by $u\times \rprof(x)$. The {\em weighting function} $\rprof$ maps probabilities to weighted probabilities, $\rprof:[0,1]\rightarrow [0,1]$, with $\rprof(0)=0$ and $\rprof(1)=1$. It encodes how strongly the agent dislikes randomness. If $\rprof$ is convex, the agent displays risk-averse behavior---the less likely an event is, the more the agent discounts his value. On the other hand, concavity captures risk-seeking behavior. We focus on risk aversion and assume throughout the paper that the weighting function is convex. More generally, we define the notion of weighted expectation, a.k.a. risk-averse expectation, of a random variable taking on many different values.\footnote{In the context of a multi-stage mechanism or protocol, we define the agent's utility as the risk averse expectation of the random variable that represents the agent's net earnings at the end of the process. Importantly, risk averse expectation is not linear, and so does not separate neatly into contributions from each step in the process.} Our definition has a clean mathematical formulation in terms of the random variable's distribution. For example, just as the expectation of a non-negative random variable with c.d.f. $F$ can be written as an integral over $1-F(x)$, the weighted expectation is an integral over $\rprof(1-F(x))$. This definition follows from requiring that certain events do not affect the agent's evaluation of random events. In particular, for a constant $c$ and random variable $X$, the weighted expectation of $c+X$ is just $c$ plus the weighted expectation of $X$. The useful implication for mechanism design is that the agent's wealth does not affect his preferences within the mechanism. \subsubsection*{Single-shot mechanism design.} We begin our investigation with the simplest mechanism design setting, namely a monopolist selling a single item to a single buyer. When the buyer is risk-neutral, it is well known that the revenue-optimal mechanism is a deterministic mechanism, namely a posted price. Relative to a risk-neutral buyer, a risk-averse buyer reacts to a deterministic posted price the same way, but undervalues mechanisms that employ randomness. Therefore one might expect that the optimal single-item mechanism for a risk-averse buyer continues to be a posted price. This turns out to not be the case --- by offering lotteries alongside certain outcomes, the mechanism can exploit the buyer's aversion to risk to extract more revenue for the sure outcomes. As risk-aversion grows, the seller can extract nearly all of the buyer's value.\footnote{Similar results are also known to arise from extreme aversion to risk within EUT, as in the work of \citet{Matthews83}, for example.} What do optimal mechanisms look like? We think of mechanisms as menus where each option corresponds to a (correlated) random allocation and random payment. We show that revenue-optimal menus are composed of {\em binary or two-outcome lotteries}, where each lottery sells the item at a certain price with some probability.\footnote{Note that in our model, in contrast to the risk-neutral setting, charging a price upfront for a randomized allocation and charging a price only when the item is allocated are not equivalent. The former is generally worse than the latter in terms of the revenue it generates.} In particular, it doesn't help the mechanism to offer menu options with multiple random outcomes. Given this format, we can express the payment as a function of the allocation rule in the form of a payment identity. Unfortunately, this payment identity is not linear in the allocation rule, and so does not permit a closed form solution for the optimal mechanism. \subsubsection*{Risk robustness.} The theory of optimal mechanism design is often criticized for being too detail-oriented, and consequently impractical. Designing optimal mechanisms in the settings we consider is even less practical and realistic in this regard---the seller needs to know not only the buyer's value distribution but also his weighting function exactly. Indeed it is difficult to imagine that a buyer can describe his own weighting function in any manner other than reacting to options presented to him. We therefore consider the problem of designing mechanisms that achieve revenue guarantees robust to the precise risk model. Formally, given a family of weighting functions, we ask for a single mechanism that for every weighting function in the family is approximately optimal with respect to the revenue-optimal mechanism specific to that weighting function. While it appears challenging to obtain a constant-factor risk-robust approximation\footnote{In Section~\ref{sec:risk-robust-oneshot} we give an $O(\log\log H)$ risk-robust approximation under certain assumptions, where $H$ is the ratio of the maximum to the minimum value in the buyer's value distribution.} for arbitrary families of weighting functions, we obtain a simple approximation under a boundedness condition on the buyer's risk attitude. Specifically, we show that such a result is possible under a certain boundedness condition on the buyer's risk attitude. As long as there is some probability $x = 1-\Theta(1)$ at which the buyer's weight is $y(x)=\Theta(1)$, then Myerson's optimal posted pricing mechanism achieves an $O(1)$ approximation to the optimal revenue. In other words, the only ``bad'' case for revenue maximization, where the optimal revenue is far greater than that achievable from a risk neutral buyer, is when the buyer values any event with probability bounded away from 1 at a weight arbitrarily close to 0. The implication for market design is that deterministic mechanisms continue to perform well as long as the buyer's aversion to risk is bounded. \subsubsection*{Dynamic mechanism design.} We next consider a sequential sale of two items to the buyer. Consider the following two-stage mechanism design problem. The seller has one item to sell in each stage. During the first stage, the buyer knows his value for the first item, but not for the second item. At this time, the seller may charge the buyer a higher or lower price for the first item in exchange for a second-stage mechanism that is more or less favorable, respectively, to the buyer. In the second stage, the buyer's value for the second item is realized. The seller follows through with his commitment and sells the second item according to the mechanism promised in the first stage. Several recent works have studied these kinds of dynamic mechanism design settings with risk-neutral buyers. The setting we consider is a special case of that introduced by~\citet{PPPR16} and subsequently studied by \citet{ADH16} and \citet{MLTZ16}. \citeauthor{ADH16} show that in the optimal mechanism the seller generally charges higher prices in the first stage in exchange for a higher expected utility promised to the buyer in the second stage. In fact in some cases it becomes possible to extract the smaller of the buyer's expected values for the two items\footnote{To be precise, if the buyer's values are denoted $v_1$ and $v_2$ respectively, these mechanisms can extract $\expect{\min(v_1, \expect{v_2})}$ plus the single-shot revenues in the two stages.}. \citeauthor{ADH16}'s mechanisms have an unusual format, however. The mechanisms offer a menu to the buyer in which the buyer's net utility from every menu option is zero (even accounting for future gains). Since the buyer is now indifferent between all of the menu options, he by default picks the most expensive one he can afford. Observe that the revenue guarantee of this mechanism is quite fragile with respect to the buyer's risk attitude. Since different menu options have different amounts of risk involved, if the buyer's risk attitude changes, the options are no longer all equivalent and the mechanism loses significant revenue. Is a risk-robust approximation achievable in the dynamic setting? We first show that the kinds of mechanisms and revenue guarantees that \citeauthor{ADH16} obtain in the risk-neutral setting continue to hold in risk-averse settings, when the seller knows the buyer's weighting function. We focus on the simple class of posted pricing mechanisms where each menu option offers the buyer a fixed price in each stage, but the second-stage price is a decreasing function of the first-stage price. Beyond the single-shot revenues in both stages, posted price mechanisms can obtain an additional revenue of $O(\expect{\min(v_1, \rae{v_2})})$, where $\rae{v_2}$ is the risk-averse or weighted expectation of $v_2$, but not much more. We then explore whether it is possible to extract a constant fraction of $\expect{\min(v_1, \rae{v_2})}$ via posted price mechanisms in a risk-robust manner. We construct a family of value distributions and a family of weighting functions such that the buyer's risk-averse expectation of his second-stage value exhibits a large range under different weighting functions, although all of the weighting functions satisfy the boundedness condition discussed previously. We then show that for any constant $\alpha>1$, there exists a value distribution in the family such that no posted pricing mechanism can obtain an $\alpha$ risk-robust approximation to revenue with respect to all of the weighting functions we consider. The moral of these results is that, in order to for a seller to increase her revenue by exploiting the buyer's lack of information and the inherent risk in future outcomes, she needs precise information about the buyer's attitude towards risk, without which such revenue extraction is not possible. \subsubsection*{A summary of our results.} Our main results can be summarized as follows. \begin{itemize}[leftmargin=*] \item Optimal mechanisms in the single-shot setting are menus of binary lotteries. See Theorem~\ref{thm:single-shot-opt}. \item In the single-shot setting, optimal mechanisms can obtain much more revenue than Myerson's mechanism; however, under a natural condition bounding the extent of risk-aversion, Myerson's mechanism extracts a constant fraction of the optimal revenue. See Theorems~\ref{thm:extract-sw} and \ref{thm:risk-robust-myer}. \item For the dynamic two-stage setting, we present an upper bound as well as a $2$-approximation to the revenue achievable using posted-price mechanisms. See Theorems~\ref{lem:pp-ub} and \ref{lem:pp-lb}. \item We exhibit an example that shows that it is impossible to obtain any constant factor risk-robust approximation to revenue in the two-stage setting, even if the buyer's risk aversion is bounded. See Theorem~\ref{thm:2day-lb}. \end{itemize} \subsubsection*{Related work.} Although empirically successful, prospect theory as defined by \citet{prospect} suffers from a number of weaknesses, rectified in a series of works subsumed by the cumulative prospect theory\footnote{In modern usage, ``prospect theory'' is understood to mean this improved theory and its extensions.} of \citet{Tversky1992}. Our model is readily seen to be a special case of \citet{KSW11}'s extension of cumulative prospect theory to continuous values.\footnote{Other than assuming that the utility $u$ is the identity function, we also assume that the probability weighting function for losses is related to the probability weighting function for gains in a manner that satisfies the additivity axiom. See Section~\ref{sec:model}. In general, PT allows these to be different functions.} See \citep{non-eut-survey} for a survey of non-EUT theories. Despite the success of prospect theory, expected utility theory remains the standard in mechanism design, where a large body of work studies revenue-optimal mechanism design. For example, \citet{HMZ10} compare different auction formats. More relevant, \citet{Matthews83} and \citet{MR84} characterize the optimal mechanism under certain expected-utility models; our Theorems~\ref{thm:single-shot-opt} and \ref{thm:extract-sw} (characterization of the optimal mechanism and full welfare extraction under extreme risk aversion, respectively) have close analogues in their work. Unsurprisingly, these characterizations are complex and work in limited settings. Non-EUT models have thus far attracted less attention in the mechanism design community. \citet{FP10} study existence and computation of equilibria in a variety of models, including special cases of prospect theory. \citet{EG15} explore the implications of a realistic, prospect-theoretic behavioral model in contract design. \citet{AG12} look at designing gambles for buyers with prospect-theoretic attitudes, but this is not relevant in problems where buyers have a type that must be elicited. To our knowledge, we are the first to consider revenue maximization within any non-EUT model. Much recent work in algorithmic mechanism design has explored revenue guarantees that are robust to finer details of the model. To our knowledge, however, only three works consider robustness to the buyer's risk attitude. \citet{DP12} show that truthful-in-expectation mechanisms can be implemented almost as-is in a manner robust to risk attitudes. \citet{FHH13} and \citet{CDKS16} provide risk-robust revenue guarantees in (different) stylized settings; \citeauthor{FHH13}'s mechanism is additionally independent of the buyers' value distributions. Their techniques are unrelated to ours.\footnote{\citet{CDKS16}'s guarantees work for any risk model where the utility drawn from a random outcome is no more than the expected value of the outcome. The other works consider EUT models of risk.} \section*{Acknowledgements} We thank Evdokia Nikolova for comments on our model of risk. \printbibliography \newpage \section{A Model for Risk Aversion} \label{sec:model} A major premise of prospect theory, inherited from the rank-dependent expected utility of \cite{Quiggin82}, is that the agent fundamentally misvalues random events. While prospect theory allows for both risk-averse and risk-seeking attitudes, we consider only risk-averse buyers. Thus, if the agent gains value $v$ with probability $x$, his {\em risk-averse utility} from this random event is $\rprof(x) v$ where $\rprof(x)\le x$. The function $\rprof$ is called a {\em probability weighting function}. Prospect theory requires that the weighting function satisfy the following properties: (1) $\rprof : [0,1] \to [0,1]$, and (2) $\rprof(0) = 0$ and $\rprof(1) = 1$. Because we are interested in risk-averse behavior, we additionally assume (3) $\rprof$ is weakly increasing and convex. Given such a weighting function $\rprof$, we next describe how to compute the {\em risk-averse expectation}, $\textrm{\bf E}_{\rprof}$, of a random variable $V$ that denotes the random value that an agent gains. Suppose, for example, that an agent gains a value of \$1 with probability $1/2$ and \$2 with probability $1/2$. Then we observe that the agent gets a value of \$1 with probability 1, and an increment of \$1 with probability $1/2$. So, the risk-averse expectation of his value, a.k.a. his risk-averse utility, ought to be $(\$1) + (\$1)\times \rprof(1/2)$, because he faces no risk over the first \$1. Our definition is therefore designed to satisfy the following {\em additivity axiom}: \begin{align*} \text{For any constant $c$,} \quad \rae{c+V} & = c+\rae{V}. \end{align*} The additivity axiom implies, in particular, that the utility of an agent from participating in a mechanism does not depend on the wealth of the agent, but rather only depends on how much the agent gains or loses in the mechanism. Accordingly, we express the risk-averse expectation in the form of increments from a base value. Formally, the risk-averse expectation of a non-negative random variable is defined as follows. \begin{definition} Let $Z$ be a random variable supported over $[0,\infty)$ with c.d.f. $F$. Then the {\em risk-averse expectation} of the random variable with respect to weighting function $\rprof$ is \label{def:rae} \[ \rae{Z} = \int_0^\infty \rprof(1-F(z)) dz. \] \end{definition} To understand this definition, observe that for any $z$, $dz$ is the difference between $z-dz$ and $z$, and this difference is earned with probability $1-F(z)$. Compare this against the standard definition of expectation: \[ \expect{Z} = \int_0^\infty z\, dF(z) = \int_0^\infty (1-F(z)) dz. \] \subsubsection*{The weighting function for losses.} When the random variable $Z$ takes on negative values, we need to take extra care in defining its risk-averse expectation. Once again, following the additivity axiom stated above, for $L = \inf\{z : F(z) > 0\}$, we define \begin{align*} \rae{Z} &= L + \rae{Z-L} \\ &= L + \int_0^\infty \rprof(1-F(z+L))dz \\ &= L + \int_L^\infty \rprof(1-F(z)) dz. \end{align*} It is convenient to express the contributions of the negative values that $Z$ takes to the risk-averse expectation in the form of decrements from the base value of $0$. Accordingly, we obtain the following equivalent definition: \begin{definition} Let $Z$ be a random variable supported over $(-\infty,\infty)$ with c.d.f. $F$. Then the {\em risk-averse expectation} of the random variable with respect to weighting function $\rprof$ is \label{def:rae-both} \begin{align} \label{eq:rae} \rae{Z} \;=\; & -\int_{-\infty}^0(1-\rprof(1-F(z)))dz \,+\,\int_0^\infty \rprof(1-F(z))dz. \end{align} \end{definition} See Figure~\ref{fig:exp_vs_wted} for an illustration of this definition. As an aside, it is well known that the quantile of a draw from a distribution is itself distributed uniformly between 0 and 1. We note that integrating \eqref{eq:rae} by parts shows our model can be interpreted as sampling the distribution by drawing a quantile according to the distribution with probability mass function $y'$. We skip the details. \begin{figure}[htbp] \begin{center} \scalebox{1}{\input{figures/expectedVsWeighted_a.pgf}}~ \scalebox{1}{\input{figures/expectedVsWeighted_b.pgf}} \caption{The transformation of a c.d.f. $F(z)$ by a weighting function $\rprof$ as described in Definition~\ref{def:rae-both}. {\em Left:} The expected value of a random variable $Z$ drawn from $F$ is equal to the difference between the shaded areas: the area above the curve on the positive axis adds to the expectation, and the area below the curve on the negative axis subtracts. {\em Right:} The risk-averse expectation is defined to be the expectation of the transformed curve. After transformation by $\rprof$, the positive area has decreased while the negative area has increased. The risk-averse expectation is therefore less than the true expectation. The original c.d.f. is shown as a dotted line for comparison.} \label{fig:exp_vs_wted} \end{center} \end{figure} \subsubsection*{Some examples.} \begin{example} If $\rprof(x) = x$ for all $x\in [0,1]$, then the risk-averse expectation is exactly the expectation of the distribution. I.e., the agent is risk-neutral. \end{example} \begin{example} If the distribution of $Z$ is a point mass at $z$, its risk-averse expectation is exactly $z$. \end{example} \begin{example} Suppose that $Z$ takes on the value $v$ with probability $1/2$ and $-v$ with probability $1/2$, then its risk averse expectation is $-v + (2v)\rprof(1/2) = -v(1-2\rprof(1/2))$. Since we assume $\rprof(1/2)\le 1/2$, this quantity is non-positive. More generally, if the distribution of $Z$ is symmetric around $0$, that is, for all $z>0$, $F(-z) = 1-F(z)$, then $\expect{Z}=0$. The risk-averse expectation, on the other hand, is non-positive: \begin{align*} \int_0^\infty (\rprof(1-F(z))+\rprof(1-F(-z)) -1) dz &\;=\; \int_0^\infty (\rprof(1-F(z))+\rprof(F(z)) -1) dz \\ &\;\le\; \int_0^\infty (1-F(z)+F(z) -1) dz \; = \; 0. \end{align*} \end{example} \subsubsection*{Quantifying risk aversion.} The buyer's risk attitude in our model is described by a function rather than by one (or a few) parameters. While this leads to a rich set of behaviors, it makes it challenging to understand, for example, whether one weighting function is more risk-averse than another. We argue that a natural measure for the extent of risk aversion is the gap between the function and the $x$ and $y$ axes. In other words, if the function ``hugs'' the axes $x=0$ and $y=1$, then the buyer heavily discounts all events that happen with probability bounded away from 1, and is highly risk-averse. On the other hand, if the function is bounded away from the axes, then the buyer is less risk-averse. See Figure~\ref{fig:beta-bounded}. \begin{figure}[htbp] \begin{center} \scalebox{1}{\input{figures/beta_bounded.pgf}} \caption{A $\beta$-bounded weighting function: the area of the shaded rectangle is $\beta$, which is the maximal area of any rectangle contained under the curve. This area gives a measure of the aversion to risk: a smaller $\beta$ corresponds to stronger aversion to risk.} \label{fig:beta-bounded} \end{center} \end{figure} \begin{definition} \label{def:boundedness} A weighting function is $\beta$-bounded if there exists an $x\in (0,1)$ such that $\rprof(x)(1-x)\ge \beta$. In other words, $\rprof$ is $\beta$-bounded if we can fit a rectangle with area $\beta$ under the curve. \end{definition} We will see in Section~\ref{sec:risk-robust-oneshot} that $\beta$-boundedness affects the revenue approximation achievable for the given weighting function. \section{Single-Shot Revenue Maximization} \label{sec:single-shot} We begin by considering the ``single-shot'' setting in which the seller wants to sell a single item to the buyer. The buyer's value $v$ for the item is drawn from a known distribution $F$. When the buyer is risk-neutral, it is well known that the optimal mechanism is deterministic, and in particular is a posted-price mechanism. Observe that a risk-averse buyer obtains the same utility from a posted-price as a risk-neutral one, so over the class of posted-price mechanisms, the optimal one remains the same regardless of the buyer's risk attitude. We will refer to the optimal posted price as the Myerson price, and to the corresponding mechanism as Myerson's mechanism. We denote the revenue obtained by Myerson's mechanism as \[{\normalfont\textsc{Mye}}(F) = \max_p\, \{p(1-F(p))\}.\] Given that a risk-averse buyer derives less utility from a randomized outcome than a risk-neutral buyer does, one might conclude that the optimal mechanism for a risk-averse buyer continues to be deterministic. Perhaps surprisingly, this is not the case, as our next example shows. The seller exploits the buyer's risk aversion to price higher allocations superlinearly. \begin{example} Suppose $v \sim U[0,1]$ and $y(x)=x^2$. The optimal deterministic mechanism offers a price of $1/2$ and earns revenue of $1/4$ in expectation. Suppose we offer an additional option: the binary lottery $(1/2, 3/8)$ allocates the item to the buyer with probability $1/2$ and if the item is allocated, charges the price $3/8$. The buyer chooses the deterministic option if $(v-1/2) \geq (v-3/8)(1/2)^2$; that is, if $v \geq \frac{13}{24}$. Otherwise, he chooses the second option as long as $v \geq 3/8$. The expected revenue is therefore \[ \frac12\left(1-\frac{13}{24}\right)(1) + \frac38\left(\frac{13}{24} - \frac38\right)\left(\frac12\right) = \frac{25}{96} > 1/4. \] \end{example} \subsection{Incentive Compatible Mechanisms.} Any single-shot mechanism can be described by the allocation it makes and the prices it charges to the buyer as a function of the buyer's value. Let $X(v)$ and $P(v)$ denote these functions, with $X(v)\in\{0,1\}$ and $P(v)\in \mathbb{R}_{\geq 0}$. Observe that $X(v)$ and $P(v)$ are random variables and may be correlated. Then, the buyer's risk-averse utility from the mechanism's outcome is given by $\rae{vX(v)-P(v)}$. We say that a mechanism with allocation and pricing functions $(X,P)$ is incentive compatible (IC) for a buyer with weighting function $\rprof$ if for all possible values $v, v'$ of the buyer, it holds that \begin{align*} \rae{vX(v)-P(v)} &\ge \rae{vX(v')-P(v')}. \end{align*} It is without loss of generality to express an incentive compatible mechanism in the form of a menu, $\mathcal{M}$, with each menu option, a.k.a. {\em lottery}, corresponding to a particular correlated random (allocation, payment) pair, $(X,P)$. Then, the allocation and payment of a buyer with value $v$ and weighting function $\rprof$ is given by the utility-maximizing menu option:\footnote{We assume that any ties are broken in favor of menu options with a higher expected price.} \[ (X_{\rprof}(v),P_{\rprof}(v)) = \operatorname{arg\,max}_{(X,P)\in\mathcal{M}} \rae{vX-P}. \] The revenue of the mechanism is therefore given by \[ {\normalfont\textsc{Rev}}_{\rprof,F}(\mathcal{M}) = \expect[v\sim F]{\expect{P_{\rprof}(v)}}, \] where $F$ denotes the distribution from which $v$ is drawn. Let ${\normalfont\textsc{OPT}}(\rprof, F)$ denote the optimal revenue achievable by an incentive compatible mechanism from selling an item to a buyer with weighting function $\rprof$ and value drawn from $F$: \[ {\normalfont\textsc{OPT}}(\rprof, F) = \max_{\mathcal{M}} {\normalfont\textsc{Rev}}_{\rprof,F}(\mathcal{M}). \] We will drop $\rprof$ from the above definitions when it is clear from the context. \subsubsection*{Utility functions and binary lotteries.} Lotteries in a mechanism may have many different outcomes---they may charge a random price when the item is not allocated, and a different random price when the item is allocated. When a buyer purchases such a lottery, his risk-averse utility as a function of his value depends on which of the outcomes of the lottery bring him negative utility and which ones bring positive utility. \begin{example} \label{ex:concave-utility} Consider a lottery with three outcomes and a buyer with weighting function $\rprof(x)=x^2$. With probability $1/2$, $X=P=0$; with probability $1/4$, $X=1$ and $P=1$; with probability $1/4$, $X=1$ and $P=2$. The risk-averse utility of this lottery is plotted on the left in Figure~\ref{fig:concave-utility}. At worst, a buyer pays 2 and has $v=0$, hence the buyer has a base value of $-2$ and measures increments from there. A buyer with value $v\in [0,1)$ gets a negative utility from both of the second and third outcomes. His risk-averse utility is \[ -2 + (v)\rprof(1) + (1)\rprof(3/4) + (1-v)\rprof(1/2) = \frac 34 v - \frac {19}{16}. \] A buyer with value $v\in [1,2)$ gets negative utility from the third outcome alone. His risk-averse utility is \[ -2 + (v) \rprof(1) + (2-v)\rprof(3/4) + (v-1)\rprof(1/4) = \frac 12 v - \frac{15}{16}. \] Finally, a buyer with value $v\ge 2$ gets positive utility from every outcome. His risk-averse utility is \[ (v-2)\rprof(1/2) + (1)\rprof(1/4) = \frac 14 v - \frac{7}{16}. \] \begin{figure}[htbp] \begin{center} \scalebox{1}{\input{figures/three_outcome_ex.pgf}} \qquad \caption{The risk-averse utility as a function of $v$ for a buyer evaluating the lottery described in Example~\ref{ex:concave-utility}. Notice that the utility is a concave function of $v$.} \label{fig:concave-utility} \end{center} \end{figure} \end{example} In general, the utility $\lrau{v}$ that a buyer derives from a lottery $(X,P)$ is a concave function. See Appendix~\ref{sec:app-proofs} for a proof. \begin{lemma} \label{lem:concaveUtil} For any $\rprof$ and lottery $\lotteryp$, $\lrau{v}$ is a concave function of $v$. The slope of this function lies between $1 - \rprof(1-x)$ and $\rprof(x)$, where $x = \prob{\alloc = 1}$. \end{lemma} We will make extensive use of a particularly simple lottery which has just two outcomes: with some probability the buyer is allocated the item and charged a deterministic price; with the remaining probability, both the allocation and price are $0$. We refer to such a lottery as a {\em binary lottery}, and denote it by the pair $(x, p)$ where $x\in [0,1]$ is the probability of allocation and $p$ is the price charged upon allocation. The buyer's utility function for a binary lottery has a convenient form---it is linear for $v\ge p$. In particular, when $v > p$, $\lrau{v}{x, p} = \rprof(x)(v-p)$. See Figure~\ref{fig:bin_lot}. \begin{figure}[htbp] \begin{center} \scalebox{1}{\input{figures/bin_lot.pgf}} \caption{The utility curve for a buyer with weighting function $y$ evaluating a binary lottery. The lottery allocates with probability $x$ and charges $p$ only when the item is allocated. Notice that the curve is linear above zero; the slope here is $y(x)$.} \label{fig:bin_lot} \end{center} \end{figure} \subsection{Optimal Mechanisms.} \label{sec:optOneShot} When the buyer is risk-neutral, the utility that the buyer receives as a function of his value in any IC mechanism is a concave function. This property allows for convenient analysis of optimal mechanisms. For a risk-averse buyer, this is no longer necessarily true. For example, if the mechanism offers a single lottery with more than two outcomes, as in Example~\ref{ex:concave-utility}, the buyer's utility function is concave on its support. In general, the buyer's utility function is the maximum over concave functions. We now study properties of revenue optimal mechanisms for a single buyer. We will show that revenue optimal mechanisms can be described by a menu composed of binary lotteries, and always induce a convex utility curve. We also observe that payment of such a mechanism is explicitly determined by the allocation, and that optimal revenue weakly increases with risk aversion. \begin{theorem} \label{thm:single-shot-opt} For any revenue-optimal IC mechanism $(\mathbf{X}, \mathbf{P})$ in the single-shot setting, the buyer's utility function $\lrau{v}{\lottery[v]}$ is convex and nondecreasing. Furthermore, there exists an optimal ex-post IR mechanism that can be described as a menu of binary lotteries. \end{theorem} \begin{figure*}[htbp] \begin{center} \scalebox{1}{\input{figures/cvx_env_a.pgf}}~ \scalebox{1}{\input{figures/cvx_env_b.pgf}} \caption{{\em Left:} The utility curve for a menu of lotteries as a function of the buyer's value is the pointwise maximum of the utility curves of the individual lotteries. {\em Right:} The lower convex envelope of the utility curve corresponds to a menu of binary lotteries which, by Theorem~\ref{thm:single-shot-opt}, obtains at least as much revenue as the original menu.} \label{fig:cvx_env} \end{center} \end{figure*} The proof of this theorem is defered to Appendix~\ref{sec:app-proofs}. At a high-level, our proof proceeds as follows. We start with an arbitrary IC mechanism, and consider the buyer's utility function induced by this mechanism. We then take the lower convex envelope of this function (see Figure~\ref{fig:cvx_env}). We show that every point on this curve can be supported by the utility curve of a binary lottery which has an expected payment as least that of the menu option it replaces in the original mechanism. At points where the lower convex envelope is strictly below the original utility curve, the new mechanism obtains strictly more revenue. \subsubsection*{Payment Identity.} Consider a mechanism that offers the buyer a menu of binary lotteries. The utility of a menu option $(x,p)$ for a buyer with value $v$ is $y(x)(v - p)$. This form permits a standard payment identity analysis, and gives the following identity for any IC mechanism: \begin{align} \label{eq:payment-id} y(x(v))p(v) = y(x(v))v - \int _0 ^v y(x(z)) \, dz. \end{align} Unfortunately, unlike the risk-neutral setting, this payment identity does not lead to an expression for the mechanism's revenue that is linear in the allocation function, and so does not allow a Myerson-type theorem characterizing optimal mechanisms. \subsection{Optimal Revenue Approaches Social Welfare.} As we observed earlier, the optimal revenue in general exceeds Myerson's revenue when the buyer is risk-averse. But to what extent? We now show that as long as the buyer is sufficiently risk-averse, the seller can extract nearly the entire expected value of the buyer as revenue, {\em regardless of the buyer's value distribution}. This stands in contrast to the risk-neutral setting where for some distributions (e.g. the equal revenue distribution), the revenue-welfare gap can be unbounded. More generally, Lemma~\ref{lem:rev-risk-monotonicity} in the following subsection shows that the revenue of {\em every} IC mechanism composed of binary lotteries increases weakly with increasing aversion to risk. \begin{theorem} \label{thm:extract-sw} For every $\varepsilon>0$ and $H>1$, if the buyer's weighting function satisfies $\rprof(1-\varepsilon)\le 2^{-H/\varepsilon}$, there exists a mechanism that for any value distribution $F$ supported over $[1,H]$ obtains revenue at least $1-O(\varepsilon)$ times the buyer's expected value $\expect[v \sim F]{v}$. \end{theorem} \begin{proof} Fix the parameters $\varepsilon$, $H$, and $\rprof$, as specified in the theorem statement. Consider a mechanism that has $H/\varepsilon$ menu options of the form $(x_i, y_i)=(y^{-1}(2^{-(i-1)}), H-i \varepsilon)$. We first claim that for any value $v$, among all of the menu options corresponding to prices $ H-i\varepsilon\le v-\varepsilon$, the buyer prefers the option with the maximum price. This follows from observing that $2^{-(i-1)}(v - (H-i \varepsilon)) \geq 2^{-(i'-1)}(v - (H-i' \varepsilon))$, or equivalently, $2^{i'-i} \geq 1 + ((i'-i) \varepsilon)/(v - (H-i\varepsilon))$. The last inequality follows from noting that $v - (H-i \varepsilon) \geq \varepsilon$, and therefore, $1 + \frac{(i'-i) \varepsilon}{v - (H-i\varepsilon)}\le 1+ i'-i$ which is at most $2^{i'-i}$ for $i' -i \geq 1$. Note that any menu option with a positive payment has allocation at least $y^{-1}(2^{-(H/\varepsilon - 1)})$. Then \begin{align*} {\normalfont\textsc{Rev}}(\mathcal{M}) &= \int _0 ^H f(v) x(v) p(v) dv \\ &\geq y^{-1}(2^{-(H/\varepsilon - 1)}) \int _0 ^H f(v) (v-2\varepsilon) dv. \end{align*} Then ${\normalfont\textsc{Rev}}(\mathcal{M}) \geq y^{-1}(2^{-(H/\varepsilon - 1)}) (\expect{v}- 2\varepsilon)$ where $\expect{v}$ is the social welfare. The theorem now follows by recalling that $y^{-1}(2^{-(H/\varepsilon - 1)}) \ge 1-\varepsilon$. \end{proof} We note that the extreme risk aversion required by the statement of Theorem~\ref{thm:extract-sw} is unrealistic; we address this in Section~\ref{sec:rr-myerson}. \subsection{Risk-Robust Approximations to Revenue.} \label{sec:risk-robust-oneshot} We now turn to the problem of designing near-optimal mechanisms without detailed knowledge of the buyer's weighting function. As discussed in the introduction, it is unreasonable to expect the seller to possess precise information about the buyer's risk attitude. We therefore ask whether it is possible to design a mechanism that simultaneously approximates the optimal revenue for any risk attitude. Theorem~\ref{thm:extract-sw} suggests that this is challenging: for some value distributions supported over $[1,H]$, as we vary the buyer's weighting function, the optimal revenue can vary by a factor as large as $\Theta(\log H)$. Formally, we say that a mechanism defined by menu $\mathcal{M}$ achieves {\em an $\alpha$ risk-robust approximation} to revenue for value distribution $F$ over class $\mathcal{Y}$ of weighting functions, if for all $\rprof\in\mathcal{Y}$, \[{\normalfont\textsc{Rev}}_{\rprof,F}(\mathcal{M})\ge \alpha\, {\normalfont\textsc{OPT}}(\rprof, F).\] Achieving a risk-robust approximation to revenue requires understanding how the revenue of a mechanism changes as the buyer's risk attitude changes. Ideally, since the optimal revenue tends to increase as the buyer gets more and more risk averse, we would require that the revenue of our robust mechanism also increases in tandem. We show that this is indeed true for mechanisms composed of binary lotteries under a certain assumption about how risk aversion increases. \subsubsection{An $O(\log \log H)$ risk-robust approximation to revenue.} Consider a family of weighting functions $\profiles$. We say that $\profiles$ is {\em non-crossing} if for all pairs of functions $\rprof_1$ and $\rprof_2$ in $\profiles$, for all $x_1, x_2\in [0,1]$, $\rprof_1(x_1)\ge \rprof_2(x_1)$ implies $\rprof_1(x_2)\ge \rprof_2(x_2)$. In other words, one function always lies above the other -- they never cross. We express this relationship between the functions as $\rprof_1\ge \rprof_2$. We say that the family $\profiles$ is {\em monotone} if for all pairs of functions $\rprof_1\ge\rprof_2$ in $\profiles$, $\rprof_2(x)/\rprof_1(x)$ is monotone non-decreasing in $x$. In other words, $\rprof_2$ is relatively more risk-averse at small probabilities than at large probabilities. \begin{lemma} \label{lem:rev-risk-monotonicity} Let $\profiles$ be a monotone non-crossing family of weighting functions, and let $\rprof_1\ge \rprof_2$ be any two weighting functions in $\profiles$. Then, for any IC mechanism $\mathcal{M}$ composed of binary lotteries, we have ${\normalfont\textsc{Rev}}_{\rprof_2,F}(\mathcal{M}) \geq {\normalfont\textsc{Rev}}_{\rprof_1, F}(\mathcal{M})$. \end{lemma} This lemma follows by observing that a buyer with weighting function $\rprof_2$ selects a menu option in $\mathcal{M}$ that is no cheaper than the menu option a buyer with the same value but weighting function $\rprof_1$ selects. We show in Appendix~\ref{sec:app-monotone} that the monotonicity property of the family $ \profiles$ is necessary to obtain this revenue monotonicity. \begin{proof} Fix a value $v$. We abuse notation and write $\rprof_1(v)$ to mean $\rprof_1(x(v))$, and similarly with $\rprof_2$ and bid $b$. By incentive compatibility of $\mathcal{M}$, $\rprof_1(v)(v-p(v)) \geq \rprof_1(b)(v-p(b))$ for all $b$. By assumption and monotonicity of $x(v)$ in $v$, for any $b < v$, $\rprof_2(v)/\rprof_1(v) \geq \rprof_2(b)/\rprof_1(b)$. Multiplying these inequalities gives \[ \frac{\rprof_2(v)}{\rprof_1(v)}\rprof_1(v) (v-p(v)) \geq \frac{\rprof_2(b)}{\rprof_1(b)}\rprof_1(b)(v-p(b)), \] or equivalently \[ \rprof_2(v)(v-p(v)) \geq \rprof_2(b)(v-p(b)). \] Therefore, a buyer $v$ will not underreport his value, and so the revenue of $\mathcal{M}$ can only increase under $\rprof_2$. \end{proof} An implication of this lemma is that if the optimal revenues under weighting functions $\rprof_1$ and $\rprof_2$ are close, then a mechanism that is approximately optimal for $\rprof_1$ continues to be approximately optimal for $\rprof_2$. This observation allows us to develop a mechanism that obtains a risk-robust $O(\log \log H)$ approximation to revenue over monotone non-crossing families of weighting functions. Observe that this approximation factor is exponentially smaller than the range of optimal revenues for the different risk attitudes. Our mechanism chooses $\log \log H$ representative weighting functions from the given family, and then picks a random one of the optimal menus from each family. We note that this is only an existential and not a computationally efficient result. \begin{theorem} \label{thm:log-log} Let $\profiles$ be a monotone non-crossing family of weighting functions and let $F$ be a value distribution supported on $[0,H]$. Then there exists a mechanism $\mathcal{M}$ that for any weighting function in $\profiles$ achieves an $O(\log\log H)$ approximation to revenue. Formally, for all $\rprof\in\profiles$, \[ {\normalfont\textsc{Rev}}_{\rprof,F}(\mathcal{M})\ge \Omega\left( \frac 1{\log\log H} \right) {\normalfont\textsc{OPT}}(\rprof, F). \] \end{theorem} \begin{proof} Since $\profiles$ is a non-crossing family of functions, the relation $\ge$ defines a total ordering over the functions. We say that $\rprof_1$ is larger than $\rprof_2$ if $\rprof_1\ge\rprof_2$. Let $n$ be a constant to be determined later. For $i\in \{0,\cdots, n\}$, let $k_i = \expect{v}/(\log H)^{i/n}$. Observe that $k_0$ is the buyer's expected value and $k_n$ is a lower bound on the revenue of Myerson's mechanism. Therefore, for all $\rprof\in\profiles$, we have $k_n\le {\normalfont\textsc{OPT}}(\rprof, F) \le k_0$. Let $\profiles_i = \{\rprof\in\profiles : k_i\le{\normalfont\textsc{OPT}}(\rprof,F)< k_{i-1}\}$, and let $\rprof_i$ be the largest (i.e. least risk-averse) weighting function in $\profiles_i$. Define $\mathcal{M}_i$ to be the revenue-optimal mechanism for $\rprof_i$, that is, ${\normalfont\textsc{Rev}}_{\rprof_i, F}(\mathcal{M}_i) = {\normalfont\textsc{OPT}}(\rprof_i,F)$. We now claim that a mechanism that randomly chooses one of the mechanisms $\mathcal{M}_i$ to offer to the agent achieves the desired risk robust approximation. Consider some $\rprof\in\profiles$ and suppose that this weighting function belongs to the set $\profiles_i$. With probability $1/n$, we choose to run the mechanism $\mathcal{M}_i$. Now we observe: \begin{align*} {\normalfont\textsc{OPT}}(\rprof,F) & \le (\log H)^{1/n}{\normalfont\textsc{OPT}}(\rprof_i,F) \\ & = (\log H)^{1/n}{\normalfont\textsc{Rev}}_{\rprof_i, F}(\mathcal{M}_i) & \text{(by definition of $\mathcal{M}_i$)}\\ & \le (\log H)^{1/n}{\normalfont\textsc{Rev}}_{\rprof, F}(\mathcal{M}_i) & \text{(by Lemma~\ref{lem:rev-risk-monotonicity})}\\ \end{align*} Therefore, we get an approximation factor of $n (\log H)^{1/n}$, which is minimized at $n=\log\log H$. \end{proof} \subsubsection{Risk-robust approximation via Myerson's mechanism.} \label{sec:rr-myerson} Theorem~\ref{thm:log-log} is unsatisfying for two reasons. One, finding the mechanism that achieves the revenue guarantee in the theorem appears challenging. Second, the theorem works only for certain families of weighting functions, and not for arbitrary ones. We now consider risk-robust approximation from a different viewpoint. We observe that obtaining the high revenue guaranteed by Theorem~\ref{thm:extract-sw} requires the buyer to heavily discount any probabilities that are bounded away from 1. Such extreme risk aversion is unrealistic. We therefore focus on weighting functions that map some probabilities bounded away from 1 (i.e. $x = 1-\Theta(1)$) to weights bounded away from 0 (i.e. $\rprof(x) = \Theta(1)$). In other words, the weighting function is $\beta$-bounded for some $\beta=\Theta(1)$ (Definition~\ref{def:boundedness}). We show that for such weighting functions, Myerson's mechanism already achieves an approximation to the optimal revenue. Of course, Myerson's mechanism is defined independently of the buyer's risk attitude. This therefore implies a risk-robust approximation. \begin{theorem} \label{thm:risk-robust-myer} For any $\beta$-bounded convex weighting function $\rprof$, and any value distribution $F$, we have \[{\normalfont\textsc{Mye}}(F) \ge \beta \, {\normalfont\textsc{OPT}}(\rprof,F).\] \end{theorem} To understand the intuition behind this theorem, consider a $\beta$-bounded convex weighting function $\rprof$, and let $\mathcal{M}=(x(v),p(v))$ denote any mechanism composed of binary lotteries. We now make two observations. First, this mechanism cannot obtain too much revenue from low-probability allocations. Intuitively, this is because if most of its revenue came from buyers who purchase the low-probability allocations, it could extract much more revenue from these buyers by selling to them with higher probability. Second, when the allocation probability is large, the buyer faces less risk, and so the mechanism behaves nearly like the optimal risk-neutral mechanism. We now formalize this intuition. \begin{lemma} \label{lem:small-x-bound} Let $\mathcal{M}=(x(v),p(v))$ denote an IC mechanism composed of binary lotteries for value distribution $F$ and weighting function $\rprof$. Then, for any type $t$, \[ \int_0^t f(v)x(v)p(v)dv \leq x(t) {\normalfont\textsc{OPT}}(\rprof, F). \] \end{lemma} \begin{proof} We examine an alternate mechanism that increases the probability of allocation to types below $t$ by a factor of $\frac{1}{x(t)}$. Consider the alternate mechanism $\hat{\mathcal{M}}$ with allocation rule $\hat{x}(b) = \frac{x(b)}{x(t)} $ if $b<t$, and $1$ otherwise, and payment rule $\hat{p}(b) = p(b)$. Note that this mechanism is not truthful; in particular, an agent with value $v$ may choose a menu option $(\hat{x}(b), \hat{p}(b))$ for $b\ne v$. We will show, however, that an agent will never deviate to a bid below his true value, and will continue to pay a price at least as high as in $\mathcal{M}$. For convenience, we abuse notation and write $\rprof(x(v))$ as $\rprof(v)$ and $\rprof(\hat{x}(v))$ as $\hat{\rprof}(v)$. Because $\mathcal{M}$ is incentive compatible, for any $v$ and $w < v$, we have that $u(v,v) = (v-p(v))y(v) \geq (v-p(w))y(w) = u(v,w)$. The weighting function $\rprof$ is positive, increasing, and convex as a function of $x$, and so $\frac{\hat{y}(v)}{y(v)} = \frac{\rprof(x(v)/x(t))}{\rprof(x(v))}$ is nondecreasing in $v$ for $v\le t$. Therefore \begin{align*} \frac{\hat{y}(w)}{\hat{y}(v)}(v-p(w)) &\leq \frac{y(w)}{y(v)}(v-p(w)) \leq (v-p(v)), \end{align*} so $\hat{u}(v,w) = \hat{y}(w)(v-p(w)) \leq \hat{y}(v)(v-p(v)) = \hat{u}(v,v)$, and the buyer will not underreport. Let $b(v)$ be the optimal bid for buyer $v$ in mechanism $\hat{\mathcal{M}}$; then \begin{align*} {\normalfont\textsc{Rev}}(\hat{\mathcal{M}}) &\ge \int_0^tf(v)\hat{x}(b(v))p(b(v))dv \\ &\geq \frac{1}{x(t)}\int_0^tf(v)x(v)p(v)dv, \end{align*} and the lemma follows. \end{proof} \begin{lemma} \label{lem:large-x-bound} Let $\mathcal{M}=(x(v),p(v))$ denote an IC mechanism composed of binary lotteries for value distribution $F$ and weighting function $\rprof$. Then, for any type $t$, \[ \int_t^\infty f(v)x(v)p(v)dv \leq \frac{1}{y(t)}{\normalfont\textsc{Mye}}(F) \] \end{lemma} \begin{proof} Let $\tilde{p}(v) = p(v)y(x(v))$. Then the payment identity in Equation~\eqref{eq:payment-id} implies that the mechanism $(\rprof(x(v)),\tilde{p}(v))$ is IC for a risk-neutral buyer. Therefore, noting that $x(v)\le 1$ and $\rprof(v)\ge\rprof(t)$ for all $v\ge t$, we have \begin{align*} \int_t^\infty f(v)x(v)p(v)dv &= \int_t^\infty f(v)\frac{x(v)}{\rprof(v)}\tilde{p}(v)dv \\ &\leq \frac{1}{\rprof(t)}\int_t^\infty f(v)\tilde{p}(v)dv \\ &\leq \frac{1}{\rprof(t)} \int_0^\infty f(v)\tilde{p}(v)dv \\ &\leq \frac{1}{\rprof(t)} {\normalfont\textsc{Mye}}(F). \end{align*} \end{proof} We can now combine the two lemmas into a proof for Theorem~\ref{thm:risk-robust-myer}. \begin{proof}{Theorem~\ref{thm:risk-robust-myer}} Let $\mathcal{M} = (x(v), p(v))$ be an optimal mechanism for value distribution $F$ and weighting function $\rprof$. Let $t$ be any type at which $(1-x(t))y(x(t)) \ge \beta$. By the definition of $\beta$-boundedness, such a type exists. By Lemma~\ref{lem:small-x-bound}, we have \begin{align*} {\normalfont\textsc{OPT}} &\leq \left(\frac{1}{1-x(t)}\right) \int_t^\infty f(v)x(v)p(v)dv, \intertext{which, using Lemma~\ref{lem:large-x-bound}, gives} \leq \frac{1}{(1-x(t))y(t)} {\normalfont\textsc{Mye}}(F) \le \frac{1}{\beta}{\normalfont\textsc{Mye}}(F). \end{align*} \end{proof}
{'timestamp': '2018-03-13T01:17:47', 'yymm': '1703', 'arxiv_id': '1703.08607', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08607'}
arxiv
\section{Introduction} Several approaches in the literature aim at partitioning a graph into communities that share some sets of properties (see~\cite{coscia2011classification} for a survey). Most criteria for defining communities in networks are based on topology and focus on specific features of the network structure, such as the presence of dense subgraphs or other edge-driven characteristics. However, real world graphs such as the World Wide Web and Social Networks are more than just their topology. A formal representation that is gaining popularity for describing such networks is the \emph{attributed graph}~\cite{bothorel2015clustering,diestel2005graph,gunnemann2011db,zhou2010clustering}.% An attributed graph is a graph where each node is assigned values on a specified set of attributes. Attribute domains may be either categorical (e.g., sex) or quantitative (e.g., age). Clustering attributed graphs consists in partitioning them into disjoint communities of nodes that are both well connected and similar with respect to their attributes. State of the art algorithms for clustering attributed graphs have several limitations~\cite{zhou2010clustering}: they are too slow to be compatible with big-data scenarios, both in terms of asymptotic time complexity and in terms of running times; they use data-structures that need to be completely rebuilt if the input graph changes; and they ask the user to specify the number of clusters to be produced. Moreover, they only work with categorical attributes, forcing the user to discretize the domains of quantitative attributes, leading to a loss of information in distance measures. We offer a new perspective on the composition of heterogeneous distance measures. Based on this, we present a distance-based clustering algorithm for attributed graphs that allows the user to tune the relative importance of the semantic and structural information of the input data and only requires to specify as input qualitative parameters of the desired partition rather than quantitative ones (such as the number of clusters). This approach is so effective that can be used to directly produce a set of similar nodes that form a community with a specified input node without having to cluster the whole graph first. We rely on state-of-the-art approximation techniques, such as {bottom-k} sketches for approximating similarity between sets~\cite{cohen2007summarizing} and the Hoeffding bound (see~\cite{crescenzi2011comparison}) to maintain high performance while keeping the precision under control. Regarding efficiency, our approach has an expected time complexity of $O(m \log n)$, where $n$ and $m$ are the number of nodes and edges in the graph, respectively. This performance is achieved via the adoption of a distance function that can be efficiently computed in sublinear time. Experimental results demonstrate the ability of our algorithm to produce high-quality partitions of large attributed graphs. The paper is structured as follows. Section~\ref{sec:related} describes related work. Section~\ref{sec:contributions} summarizes our contributions. Section~\ref{sec:problem} formally states the addressed problem. Section~\ref{sec:distance} introduces the notion of distance, essential for cluster definition. The algorithm and its data structures are described in Section~\ref{se:algorithm}. Section~\ref{sec:tuning} describes the tuning phase which selects suitable parameter values for the input graph according to the user's needs. The results of our experimentation are discussed in Section~\ref{sec:experiments}. Finally, Appendix~\ref{apx:model} and~\ref{apx:sctoc} contain a validation of our attribute model and combined distance function. \section{Related work}\label{sec:related} Graph clustering, also known as community discovery, is an active research area (see~e.g.,~the survey \cite{coscia2011classification}). While the overwhelming majority of the approaches assign nodes to clusters based on topological information only, recent works address the problem of clustering graphs with semantic information attached to nodes or edges (in this paper, we restrict to node-attributed graphs). In fact, topological-only or semantic-only clustering approaches are not as effective as approaches that exploit both sources of information \cite{ding2011community}. A survey of the area \cite{bothorel2015clustering} categorizes the following classes for node-attributed graphs (here we recall only key references and uncovered recent papers). \emph{Reduction-based} approaches translate the semantic information into the structure of the graph (for example adding weights to its edges) or vice versa (for example encoding topological information into new attributes), then perform a traditional clustering on the obtained data. They are efficient, but the quality of the clustering is poor. \emph{Walk-based} algorithms augment the graph with dummy nodes representing categorical only attribute values and estimate node distance through a neighborhood random walk~\cite{zhou2010clustering}. The more attributes two nodes shares the more paths connect them the more the nodes are considered close. A traditional clustering algorithm based on these distances produces the output. \emph{Model-based} approaches statistically infer a model of the clustered attributed graphs, assuming they are generated accordingly to some parametric distribution. The \textbf{BAGC} algorithm \cite{xu2012model} adopts a Bayesian approach to infer the parameters that best fit the input graph, but requires the number of clusters to be known in advance and does not handle quantitative attributes. The approach has been recently generalized to weighted attributed graphs in \cite{xu2014gbagc}. The resulting \textbf{GBAGC} algorithm is the best performing of the state-of-the-art (in Section~\ref{sec:experiments} we will mainly compare to this work). A further model-based algorithm is \textbf{CESNA}~\cite{yang2013community}, which addresses the different problem of discovering overlapping communities. \emph{Projection-based} approaches focus on the reduction of the attribute set, omitting attributes are irrelevant for some clusters. A recent work along this line is \cite{sanchez2015efficient}. Finally, there are some approaches devoted to variants of attributed graph clustering, such as: \textbf{I-Louvain} \cite{combe2015louvain}, which extends topological clustering to maximize both modularity and a newly introduced measure called `inertia'; \textbf{PICS} \cite{akoglu2012pics}, which addresses a form of co-clustering for attributed graphs by using a matrix compression-approach; \textbf{FocusCO} \cite{perozzi2014focused} and \textbf{CGMA} \cite{cao2016user}, which start from user-preferred clusters; \textbf{M-CRAG} \cite{Guy2009PersonalizedRecommendation}, which generates multiple non-redundant clustering for exploratory analysis; \textbf{CAMIR} \cite{papadopoulos2015clustering}, which considers multi-graphs. Overall, state-of-the-art approaches to partition attributed graphs are affected by several limitations, the first of which is efficiency. Although, the algorithm in~\cite{zhou2010clustering} does not provide exact bounds, our analysis assessed an $\Omega(n^2)$ time and space complexity, which restricts its usability to networks with thousands of nodes. The algorithm in~\cite{xu2014gbagc} aims at overcoming these performance issues, and does actually run faster in practice. However, as we show in Section~\ref{sec:experiments}, its time and space performances heavily rely on assuming a small number of clusters. Second, similarity between elements is usually defined with exact matches on categorical attributes, so that similarity among quantitative attributes is not preserved. Further, data-structures are not maintainable, so that after a change in the input graph they will have to be fully recomputed. Finally, most of the approaches require as input the number of clusters that have to be generated~\cite{kanungo2002efficient,von2007tutorial,zhou2010clustering,xu2014gbagc}. In many applications it is unclear how to choose this value or how to evaluate the correctness of the choice, so that the user is often forced to repeatedly launching the algorithm with tentative values. \section{Contributions}\label{sec:contributions} We propose an approach to partition attributed graphs that aims at overcoming the limitations of the state of the art discussed in Section~\ref{sec:related}. Namely: (i) We propose a flexible concept of distance that can be efficiently computed and that is both tailorable (allowing the user to tune the relative importance of the semantic and structural information) and robust (accounting for both categorical and quantitative attributes). Further, our structures can be maintained when entities are added or removed without re-indexing the whole dataset. (ii) We present the \textbf{SToC} algorithm to compute non-overlapping communities. \textbf{SToC} allows for a declarative specification of the desired clustering, i.e.,~the user has to provide the sensitivity with which two nodes are considered close rather than forecast the number of clusters in the output. (iii) We describe an experimental comparison with state-of-the-art approaches showing that \textbf{SToC} uses less time/space resources and produces better quality partitions. In particular, in addition to good quality metrics for the obtained clusters, we observe that \textbf{SToC} tends to generate clusters of homogeneous size, while most partitioning algorithms tend to produce a giant cluster and some smaller ones. \section{Problem statement}\label{sec:problem} Intuitively, attributed graphs are an extension of the structural notion of graphs to include attribute values for every node. Formally, an \emph{attributed graph} $G(V,E,F)$ consists of a set $V = \{v_1, \ldots,v_n\}$ of \emph{nodes}, a set $E=\{e_1,\ldots,e_m\} \subseteq V \times V$ of \emph{edges}, and a set of mappings $F=\{f_1,\ldots,f_A\}$ such that, for $i \in [1..A]$, $f_i: V \rightarrow dom(a_i)$ assigns to a node $v$ the value $f_i(v)$ of attribute $a_i$, where $dom(a_i)$ is the domain of attribute $a_i$. Notice that the definition is stated for directed graphs, but it readily applies to undirected ones as well. A \emph{distance function} $d: V \times V \rightarrow \mathbb{R}_{\geq 0}$ quantifies the dissimilarity between two nodes through a non-negative real value, where $d(v_1, v_2) = d(v_2, v_1)$, and $d(v_1, v_2) = 0$ iff $v_1 = v_2$. Given a threshold $\tau$, the \emph{ball centered at node~$v$}, denoted $B_{d}(v, \tau)$, consists of all nodes at distance at most~$\tau$: $B_{d}(v, \tau) = \{ v' \in V \ |\ d(v, v') \leq \tau \}.$ We distinguish between \emph{topological distances}, that are only based on structural properties of the graph $G(V, E)$, \emph{semantic distances}, that are only based on node attribute values $F$, and \emph{multi-objective distances}, that are based on both~\cite{deza2009encyclopedia}. Using on distance functions, a \emph{cluster} can be defined by considering nodes that are within a maximum distance $\tau$ from a given node. Namely, for a distance function $d()$ and a threshold $\tau$, a \emph{$\tau$-close cluster} $C$ is a subset of the nodes in $V$ such that there exists a node $v \in C$ such that for all $v' \in C$, $d(v, v') \leq \tau$. The node $v$ is called a \emph{centroid}. Observe that $C \subseteq B_d(v, \tau)$ is required but the inclusion may be strict. In fact, a node $v' \in B_d(v, \tau)$ could belong to another $\tau$-close cluster $C'$ due to a lower distance from the centroid of $C'$. A \emph{$\tau$-close clustering} of an attributed graph is a partition of its nodes into $\tau$-close clusters $C_1, \ldots, C_k$. Notice that this definition requires that clusters are disjoint, i.e.,~non-overlapping. \newcommand{gray!50}%{MidnightBlue}{gray!50 \newcommand{white}%{Magenta}{white \begin{figure*} \centering % \scalebox{0.9}{ % \parbox{.55\textwidth}{ \noindent \scalebox{0.7}{ \begin{tikzpicture} \begin{axis}[ hide axis, scale only axis, height=0pt, width=0pt, colormap/jet, colorbar sampled, colorbar horizontal, point meta min = 0, point meta max = 1, colorbar style = { samples = 10, height = 0.2cm, width = 10cm, xtick style={draw=none}, xticklabel style = { text width = 2.5em, align = center, /pgf/number format/.cd, fixed, fixed zerofill, precision = 1, /tikz/.cd } } ] \addplot [draw=none] coordinates {(0,0)}; \end{axis} \def5mm{5mm} \definecolor{leftcolor}{RGB}{191, 191, 191} \definecolor{rightcolor}{RGB}{102, 102, 102} \foreach \i/\j in {south east/a,east/b,north east/c,north west/e,west/f,south west/g} {\coordinate (\j) at (current colorbar axis.\i);} \end{tikzpicture} } \scalebox{0.85}{ \begin{tikzpicture}[baseline=(B.base), shorten >=1pt, auto, thick,node distance=1cm, main node/.style={circle,draw,font=\sffamily\small\bfseries,minimum size=0.1cm}, male node/.style={diamond,draw,font=\sffamily\footnotesize\bfseries,minimum size=0.05cm,fill=gray!50}%{MidnightBlue}, female node/.style={regular polygon,regular polygon sides=9,draw,font=\sffamily\footnotesize\bfseries, minimum size=0.05cm,fill=white}%{Magenta}] \coordinate (B) at (0,0.8); \coordinate (XY0) at (-1,-1); \coordinate (X1) at (7,-1); \coordinate (Y1) at (-1,3); \draw [ -> ] (XY0) -- (X1) node [right] {x}; \draw [ -> ] (XY0) -- (Y1) node [right] {y}; \coordinate (Node0) at (0,1); \coordinate (Node1) at (0,0); \coordinate (Node2) at (1,1); \coordinate (Node3) at (2,0); \coordinate (Node4) at (4,0); \coordinate (Node5) at (5.5,1); \coordinate (Node6) at (6,0); \coordinate (Node7) at (7,0.9); \node[main node,fill=gray!50}%{MidnightBlue] (0) at (Node0) {$v_0$}; \node[main node,fill=gray!50}%{MidnightBlue] (1) at (Node1) {$v_1$}; \node[main node,fill=gray!50}%{MidnightBlue] (2) at (Node2) {$v_2$}; \node[main node,fill=white}%{Magenta] (3) at (Node3) {$v_3$}; \node[main node,fill=white}%{Magenta] (4) at (Node4) {$v_4$}; \node[main node,fill=white}%{Magenta] (5) at (Node5) {$v_5$}; \node[main node,fill=white}%{Magenta] (6) at (Node6) {$v_6$}; \node[main node,fill=gray!50}%{MidnightBlue] (7) at (Node7) {$v_7$}; \path [line width=1mm] (0) edge [cyan] node {} (1); \path [line width=1mm] (0) edge [NavyBlue] node {} (2); \draw [color=Orange,line width=1mm] (0) to [out=50, in=130] (7); \path [line width=1mm] (1) edge [NavyBlue] node {} (2); \path [line width=1mm] (1) edge [Goldenrod] node {} (3); \path [line width=1mm] (3) edge [Goldenrod] node {} (4); \path [line width=1mm] (4) edge [cyan] node {} (5); \path [line width=1mm] (4) edge [cyan] node {} (6); \path [line width=1mm] (5) edge [blue] node {} (6); \path [line width=1mm] (5) edge [cyan] node {} (7); \path [line width=1mm] (6) edge [cyan] node {} (7); \end{tikzpicture} }} \scalebox{0.85}{ \begin{tabular}{|l|l|l|l|} \hline ID&sex&x&y\\ \hline \hline 0&1&0&0.1\\ 1&1&0&0\\ 2&1&0.1&0.1\\ 3&0&0.2&0\\ 4&0&0.4&0\\ 5&0&0.55&0.1\\ 6&0&0.6&0\\ 7&1&0.7&0.09\\\hline \end{tabular} \begin{tabular}{|l|l|} \hline $d_S(v_0, v_i)$&$d_T(v_0, v_i)$\\ \hline \hline 0&0\\ 0.00471&0.4\\ 0.0066&0.25\\ 0.3427&0.6\\ 0.3521&0.86\\ 0.3596&1\\ 0.3616&1\\ 0.3327&0.86\\ \hline \end{tabular}} % % \caption{A sample attributed graph. Attributes include: sex (categorical) and spatial coordinate $x$, $y$ (quantitative). Edges are colored by topological distance between the connected nodes. Topological distance $d_T()$ considers $1$-neighborhoods.} \label{fig:smallGraph} \end{figure*} \section{A multi-objective distance}\label{sec:distance} In this section we introduce a multi-objective distance function that will be computable in sublinear time (Section~\ref{subsec:stoQuery}) and that allows for tuning the semantic and topological components (Section~\ref{sec:tuning}). Regarding semantic distance, we assume that attributes can be either categorical or quantitative. For clarity, we assume that attributes $1, \ldots, Q$ are quantitative, and attributes $Q+1, \ldots, A$ are categorical. Thus, the attribute values $(f_1(v), \ldots, f_A(v))$ of a node $v$, boil down to a relational tuple, which we denote by~$\mathbf{t}_v$. Semantic distance $d_S()$ can then be defined as: \begin{equation}\label{eq:hybridDistance} d_S(v_1, v_2)= f( \mathbf{t}_{v_1}, \mathbf{t}_{v_2}) \end{equation} where $f()$ is any distance function over relational tuples (see e.g.,~\cite{HanKamber11}). In our implementation and in experiments, we first normalize quantitative attributes in the $[0, 1]$ interval using min-max normalization~\cite{mohamad2013standardization}. Then, we adopt the following distance: \begin{equation} \tiny d_s(v_1,v_2) = \frac{\sqrt{\sum_{i=1}^{Q} ((f_i(v_1) - f_i(v_2))^2} \cdot \sqrt{Q} + \sum_{i=Q+1}^{A} J(f_i(v_1),f_i(v_2))}{A} \label{equ:semanticDistance} \end{equation} Quantitative attributes are compared using Euclidean distance, and categorical attributes are compared using Jaccard distance ($J(X, Y) = 1 - \frac{|X \cap Y|}{|X \cup Y|}$). The scaling factor $\sqrt{Q}$ balances the contribution of every quantitative attribute in the range $[0,1]$. The overall distance function ranges in $[0, 1]$. Regarding topological distance, we assume it is defined as a distance of the node neighborhoods. Let us recall the notion of $l$-neighborhood from~\cite{gunnemann2011db}: the $l$-neighborhood $N_l(v)$ of $v$ is the set of nodes reachable from $v$ with a path of length at most~$l$. $N(v)$ is a shorthand for $N_1(v)$, namely the nodes linked by $v$. Topological distance $d_T()$ can then be defined as: \begin{equation}\label{eq:structuralDistance} d_T(v_1, v_2)= g( N_l(v_1), N_l(v_2)) \end{equation} where $g()$ is any distance function over sets of nodes, e.g.,~Dice, Jaccard, Tanimoto \cite{deza2009encyclopedia}. In particular, we adopt the Jaccard distance. Fig.~\ref{fig:smallGraph} shows an example on distances. Fix node $v_0$, and consider distances (semantic and topological) between $v_0$ and the other nodes in the graph. For topological distance (with $l=1$), e.g.,~we have $d_T(v_0,v_2) = J(\{v_0,v_1,v_2,v_7\}, \{v_0,v_1,v_2\}) = 1-\frac{|\{v_0,v_1,v_2\}|}{|\{v_0,v_1,v_2,v_7\}|} = 0.25$. Thus, $v_0$ is closer to $v_2$ than to $v_1$, since $d_T(v_0,v_1) = 0.4$. For semantic distance (Equ.~\ref{equ:semanticDistance}), instead, it turns out that $v_0$ is closer to $v_1$ than to $v_2$. In fact, all three of them have the same sex attribute, but $v_1$ is spatially closer to $v_0$ than to $v_2$. Finally, semantic and topological distance can be combined into a multi-objective distance $d_{ST}()$ as follows \cite{bothorel2015clustering}: \begin{equation}\label{eq:combinedDistance} d_{ST}(v_1, v_2) = h( d_S(v_1, v_2) , d_T(v_1, v_2) ) \end{equation} where $h: \mathbb{R}_{\geq 0} \times \mathbb{R}_{\geq 0} \rightarrow \mathbb{R}_{\geq 0}$ is such that $h(x, y) = 0$ iff $x = y = 0$. This and the assumptions that $d_S()$ and $d_T()$ are distances imply that $d_{ST}()$ is a distance. \cite{combe2012combining,villa2013carte,zhou2010clustering} set $h(x, y) = x + y$ as the sum of semantic and topological distances. If $x \gg y$ then $h(x, y) \approx x$, so the largest distance weights more. However, if $x \approx y$ then $h(x, y) \approx 2x$, which doubles the contribution of the equal semantic and topological distances. In this paper, we consider instead $h(x, y) = max(x,y)$. If $x \gg y$ then $h(x, y) \approx x \approx y$, as before. However, when $x \approx y$ then $h(x, y) \approx x$, which agrees with the distance of each component. \section{The \textbf{SToC} Algorithm}\label{se:algorithm} For a given distance threshold $\tau$, \textbf{SToC} iteratively extracts $\tau$-close clusters from the attributed graph starting from random seeds. This is a common approach in many clustering algorithms~\cite{bothorel2015clustering,coscia2011classification}. Nodes assigned to a cluster are not considered in the subsequent iterations, thus the clusters in output are not overlapping. The algorithm proceeds until all nodes have been assigned to a cluster. This section details the \textbf{SToC} algorithm. We will proceed bottom-up, first describing the \textbf{STo-Query} procedure which computes a $\tau$-close cluster with respect to a given seed $s$, and the data structures that make its computation efficient. Then, we will present the main \textbf{SToC} procedure. \subsection{The STo-Query Procedure} \label{subsec:stoQuery} The \textbf{STo-Query} procedure computes a connected $\tau$-close cluster $C$ for a given seed $s$ and threshold $\tau$. With our definition of $d_{ST}()$, it turns out that $C \subseteq B_{d_{ST}}(s, \tau) = B_{d_{S}}(s, \tau) \cap B_{d_{T}}(s, \tau)$. We define $C$ as the set of nodes in $B_{d_{ST}}(s, \tau)$ that are connected to $s$. Computing $C$ is then possible through a partial traversal of the graph starting from $s$. This is the approach of the \textbf{STo-Query} procedure detailed in Algorithm~\ref{alg:stoq}. The efficiency of \textbf{STo-Query} relies on two data structures, $S$ and $T$, that we adopt for computing semantic and topological distances respectively and, a fortiori, for the test $d_{ST}(s, x) \leq \tau$ at line 7. Recall that $d_{ST}(s, x) = max( d_{S}(s, x), d_{T}(s, x) )$. Semantic distance is computed by directly applying (Equ.~\ref{equ:semanticDistance}). We store in a dictionary $S$ the mapping of nodes to attribute values. Thus, computing $d_{S}(s, x)$ requires $O(A)$ time, where $A$ is the number of attributes. For topological distance, instead, a na\"ive usage of (Equ.~\ref{eq:structuralDistance}) would require to compute online the $l$-neighborhood of nodes. This takes $O(n)$ time for medium-to-large values of $l$, e.g.,~for small-world networks. We overcome this issue by approximating the topological distance with a bounded error, by using \textit{bottom-k} sketch vectors~\cite{cohen2007summarizing}. A sketch vector is a compressed representation of a set, in our case an $l$-neighborhood, that allows the estimation of functions, in our case topological distance, with bounded error. The bottom-$k$ sketch $S(X)$ consists in the first $k$ elements of a set $X$ with respect to a given permutation of the domain of elements in $X$. The Jaccard distance between $N_l(v_1)$ and $N_l(v_2)$ can be approximated using $S(N_l(v_1))$ and $S(N_l(v_2))$ in their place, with a precision $\epsilon$ by choosing $k = \frac{\log{n}}{\epsilon^2}$ (see~\cite{crescenzi2011comparison}). We store in a dictionary $T$ the mappings of nodes $v$ to the sketch vector of $N_l(v)$. $T$ allows for computing $d_{T}(s, x)$ in $O(\log{n})$ time. \begin{algorithm}[t] \SetKwData{G}{G} \SetKwData{GG}{G(V,E)} \SetKwData{V}{V} \SetKwData{info}{$\mathbf{A}$} \SetKwData{thresh}{$\tau$} \SetKwData{lsh}{$S$} \SetKwData{bbls}{$T$} \SetKwData{comms}{C} \SetKwData{com}{$C_{s}$} \SetKwData{node}{s} \SetKwData{cnode}{v} \SetKwData{buck}{B} \SetKwData{cand}{y} \SetKwData{enq}{\textsc{enqueue}} \SetKwData{deq}{\textsc{dequeue}} \SetKwFunction{dist}{$d_{ST}$} \DontPrintSemicolon \SetKwInOut{Input}{Input} \SetKwInOut{Output}{Output} \SetKwInOut{Global}{Global} \Input{$G$, $\tau$, $\node$} \Output{$C$, a $\tau$-close connected cluster} \Global{\lsh and \bbls data structures (described in Section~\ref{subsec:stoQuery}, used to compute $d_{ST}$)} \BlankLine $Q \leftarrow$ empty queue\; $C \leftarrow \{s\} $\; $\enq(Q,s)$\; \While{$Q \neq \emptyset$}{ $v \gets \deq(Q)$\; \ForEach{$x \in N(v)$}{ \If{$x\not\in C$ and $d_{ST}(s,x) \leq \tau$}{ $C \gets C \cup \{x\}$\; $\enq(Q,x)$\; } } } \Return $C$; \BlankLine \caption{\textbf{STo-Query} algorithm.} \label{alg:stoq}\vspace{-0.2cm} \end{algorithm} \subsection{The SToC Procedure} The algorithm consists of repeated calls to the \textbf{STo-Query} function on selected seeds. $\tau$-close clusters returned by \textbf{STo-Query} are added to output and removed from the set of active nodes $V'$ in Algorithm~\ref{alg:clustering} (lines 7--9). We denote by $G[V']$ the subgraph of $G$ with only the nodes in $V'$. Seeds are chosen randomly among the active nodes through the \texttt{select\_node} function (line 6). This philosophy can be effective in real-world networks (see, e.g.,~\cite{Conte:2016:CCL:2851613.2851816}), and is inherently different from selecting a set of random seeds in the beginning (as in k-means), since it guarantees that each new seed will be at a significant distance from previously chosen ones. Calls to \textbf{STo-Query} return non-overlapping clusters, and the algorithm terminates when all nodes have been assigned to some cluster, i.e.,~$V' = \emptyset$. \begin{algorithm}[t] \SetKwData{G}{G} \SetKwData{GG}{G(V, E, F)} \SetKwData{V}{V} \SetKwData{info}{F} \SetKwData{thresh}{$\tau$} \SetKwData{lsh}{$S$} \SetKwData{bbls}{$T$} \SetKwData{clust}{R} \SetKwData{parent}{parent} \SetKwData{com}{$C$} \SetKwData{node}{s} \SetKwData{cnode}{v} \SetKwData{id}{id} \SetKwFunction{dist}{$d_{ST}$} \SetKwFunction{sel}{select\_node} \SetKwFunction{query}{STo-Query} \DontPrintSemicolon \SetKwInOut{Input}{Input} \SetKwInOut{Output}{Output} \Input{\GG attributed graph, \thresh distance threshold} \Output{\clust, a $\tau$-close clustering of $G$} \BlankLine \lsh $\gets$ global dictionary of the semantic vectors\; \bbls $\gets$ global topological similarity table of \G\; \clust $\gets \emptyset$\; $V' \gets V$\; \While{$V' \neq \emptyset$}{ \node $\gets \sel{G}$\; \com $\gets $ \query{$G$, $\tau$, $\node$} \; $V' \gets V' \setminus C$\; $G \gets G[V']$\; $\clust \gets \clust \cup \{ \com \}$\; } \Return \clust\; \BlankLine \caption{ \textbf{SToC} algorithm.} \label{alg:clustering}\vspace{-0.2cm} \end{algorithm} \begin{figure*} \centering \includegraphics[width=.55\columnwidth]{fig/directors_dt.png} \includegraphics[width=.45\columnwidth]{fig/directors_ds.png} \includegraphics[width=.55\columnwidth]{fig/dblp_dt.png} \includegraphics[width=.45\columnwidth]{fig/dblp_ds.png} \caption{Cumulative distributions of $d_{T}()$, for varying $l$-neighborhoods, and of $d_S()$ for datasets DIRECTORS (left) and DBLP (right). \label{fig:ddists}} \end{figure*} \subsection{Time and space complexity}\label{sec:cost} Let us consider time complexity first. For a seed $s$, \textbf{STo-Query} iterates over nodes in $C \subseteq N_l(s)$ through queue $Q$. For each node $v \in C$, the distance $d_{ST}(v, x)$ is calculated for all neighborhoods $x$ of $v$. Using the data structures $S$ and $T$, this takes $O(\log n + A)$. \textbf{SToC} iterates over seeds $s$ by removing from the graph nodes that appear in the cluster $C$ returned by \textbf{STo-Query}. This implies that a node is enqued in $Q$ exactly once. In summary, worst-case complexity of \textbf{SToC} is $O(\sum_{x\in V} |N(x)|(\log n + A)) = O(m(\log n + A))$. According to related work, we consider $A$ to be constant in real world datasets. This leads to an overall time complexity of $O(m \log n)$. The initialization of the data structures $S$ and $T$ has the same cost. In fact, $S$ can be filled in linear time $O(n)$ through a scan of the input attributed graph. Moreover, bottom-k sketches can be computed in $O(m k)$ time \cite{boldi2011hyperanf}, hence, for $k \in O(\log{n})$, building $T$ requires $O(m \log n)$. Regarding space usage, the dictionary $S$ requires $O(nA) = O(n)$ space, assuming $A$ constant. Moreover, since each sketch vector in $T$ has size $O(\log{n})$, $T$ requires $O(n\log{n})$ space. Thus, \textbf{SToC} requires $O(n \log{n})$ space, in addition to the one for storing the input graph. \section{Auto-tuning of parameters}\label{sec:tuning} The \textbf{SToC} algorithm assumes two user parameters\footnote{The error threshold $\epsilon$ is more related to implementation performance issues rather than to user settings.} in input: the value $l$ to be used in topological distance (Equ.~\ref{eq:structuralDistance}), and the distance threshold $\tau$ tested at line 7 of \textbf{STo-Query}. The correct choice of such parameters can be critical and non-trivial. For example, consider the cumulative distributions of $d_S()$ and $d_T()$ shown in Fig.~\ref{fig:ddists} for the datasets that will be considered in the experiments. Small values of $l$ make most of the pairs very distant, and, conversely, high values of $l$ make most of the pairs close w.r.t.~topological distance. Analogously, high values of threshold $\tau$ may lead to cluster together all nodes, which have semantic and topological distance both lower than $\tau$. E.g.,~almost every pair of nodes has a semantic distance lower than $0.4$ for the DIRECTORS dataset in Fig.~\ref{fig:ddists}. Another issue with parameters $l$ and $\tau$ is that they are operational notions, with no clear intuition on how they impact on the results of the clustering problem. In this section, we introduce a declarative notion, with a clear intuitive meaning for the user, and that allows to derive optimal values for $l$ and $\tau$. We define the \emph{attraction ratio} $\alpha$ as a value between 0 and 1, as a specification of the expected fraction of nodes similar to a given one. Extreme values $\alpha = 1$ or $\alpha = 0$ mean that all nodes are similar to each other and all nodes are different from each other respectively. In order to let the user weight separately the semantic and the topological components, we actually assume that a semantic attraction ratio $\alpha_S$ and a topological attraction ratio $\alpha_T$ are provided by the user. We describe next how the operational parameters $l$ and $\tau$ are computed from the declarative ones $\alpha_S$ and $\alpha_T$. \emph{Computing $\tau$.} We approximate the cumulative distribution of $d_S()$ among all the $n^2$ pairs of nodes by looking at a sample of $\frac{2 \log n}{\epsilon^2}$ pairs. By the Hoeffding bound~\cite{crescenzi2011comparison}, this guarantees error $\epsilon$ of the approximation. Then, we set $\tau = \hat{\tau}$ as the $\alpha_S$-quantile of the approximated distribution. By definition, $d_S()$ will be lower or equal than $\hat{\tau}$ for the fraction $\alpha_S$ of pairs of nodes. Fig.~\ref{fig:ddists} (second and fourth plots) show the approximated distributions of $d_S()$ for the DIRECTORS and DBLP datasets. E.g.,~an attraction ratio $\alpha_S = 0.4$ can be reached by choosing $\tau = 0.2$ for DIRECTORS and $\tau = 0.45$ for DBLP. \emph{Computing $l$.} In the previous step, we fixed $\tau = \hat{\tau}$ using the semantic distance distribution. We now fix $l$ using the topological distance distribution. The approach consists in approximating the cumulative distribution of $d_T()$, as done before, for increasing values of $l$ starting from $l=1$. For each value of $l$, we look at the quantile of $\hat{\tau}$, namely the fraction $\alpha_l = Pr( d_T \leq \hat{\tau})$ of pairs of nodes having topological distance at most $\hat{\tau}$. We choose the value $l$ for which $|\alpha_l - \alpha_T|$ is minimal, namely for which $\alpha_l$ is the closest one to the attraction ratio $\alpha_T$. Since $\alpha_l$ is monotonically decreasing with $l$, we stop when $|\alpha_{l+1} - \alpha_T| > |\alpha_l - \alpha_T|$. Fig.~\ref{fig:radius_lines} shows an example for $\alpha_T=0.3$ and $\hat{\tau}=0.6$. The value $l=6$ yields the quantile $\alpha_l$ closest to the expected attraction ratio $\alpha_T=0.3$. We now show that the cost of the auto-tuning phase is bounded by $O(m\log n)$, under the assumptions that both $\epsilon^{-1}$ and $l$ are $O(1)$. Such assumption are realistic. In fact, values for $\epsilon$ cannot be too small, otherwise the performance improvement of using bottom-$k$ sketches would be lost~\cite{cohen2007summarizing}. Regarding $l$, it is bounded by the graph diameter, which for real-world networks, can be considered bounded by a constant~\cite{backstrom2012four,ugander2011anatomy}. Let us consider then the computational cost of auto-tuning. Computing $\tau$ requires calculating semantic distance among $\frac{2 \log n}{\epsilon^2}$ pairs of nodes, which requires $O(\log^2 n)$, and in sorting the pairs accordingly, which requires $O( (\log n)(\log \log n) )$. Overall, the cost is $O(\log^2 n)$. Computing $l$ requires a constant-bounded loop. In each iteration, we need to build an approximate cumulative distribution of the topological distance $d_T()$, which, as shown before, is $O(\log^2 n)$. In order to compute $d_T()$ we also have to construct the data structure $T$ for the value $l$ at each iteration, which requires $O(m\log n)$. In summary, computing $l$ has a computational cost that is in the same order of the \textbf{SToC} algorithm. \begin{figure} \centering \includegraphics[width=0.9\columnwidth]{fig/tuning_final_cut.png} \caption{Computing the $l$ value for $\alpha_T=0.3$ and $\tau=0.6$ on the DBLP dataset.} \label{fig:radius_lines} \end{figure} \section{Experiments}\label{sec:experiments} We first present the evaluation metrics and the experimental datasets, and then show the results of our experiments, which aim at showing the effectiveness of the approach and at comparing it with the state of the art. \subsection{Evaluation metrics} According to existing approaches~\cite{duong2013filtering,xu2014gbagc,zhou2010clustering we adopt both a semantic and a topological metric. % The semantic metric is the \emph{Within-Cluster Sum of Squares} (WCSS) also called \emph{Sum of Squared Error} (SSE), widely used by widespread approaches such as the $k$-means~\cite{lloyd1982least}: % \begin{equation} WCSS = \sum_{i=1}^{k} \sum_{ v \in C_i} \left\| v - \mu_i \right\|^2 \label{equ:WCSS} \end{equation} where $C_1, \ldots, C_k$ is the clustering of the graph, and, for $i \in [1, k]$, $\mu_i$ is the centroid of nodes in $C_i$ w.r.t.~the semantics distance $d_S()$~\cite{protter1977college}. WCSS ranges over non-negative numbers, with lower values denoting better clusterings. Alternative semantic metrics, such as entropy \cite{xu2014gbagc,zhou2010clustering}, are suitable for categorical/discretized attributes only. The topological metric is the \emph{modularity}~\cite{clauset2004finding}, a de-facto standard for graph clustering evaluation~\cite{xu2014gbagc,zhou2010clustering}: \begin{equation} Q = \frac{1}{2m} \sum_{v,w\in V} \left[ A_{vw} - \frac{k_v k_w}{2m} \right] \delta (c_v,c_w) \label{equ:modularity} \end{equation} where $A$ is the adjacent matrix of the graph, $k_v$ is the degree of node $v$, $c_v$ is the cluster ID of node $v$, and $\delta$ is the identity function ($\delta(i,j) = 1$ if $i=j$ and 0 otherwise). $Q$ is defined in $[-\frac{1}{2},1]$, with a random clustering expected to have $Q=0$, and a good clustering $Q>0$~\cite{clauset2004finding}. \subsection{Experimental datasets} We will run experiments on two datasets, whose summaries are shown in Table~\ref{tab:data}. \emph{DIRECTORS: A social network of directors.} A \emph{director} is a person appointed to serve on the board of a company. We had a unique access to a snapshot of all Italian boards of directors stored in the official Italian Business Register. The attributed graph is build as follows: nodes are distinct directors, and there is an (undirected) edge between two directors if they both seat in a same board. In other words, the graph is a bipartite projection of a bipartite graph directors-companies. In the following we distinguish the whole graph (DIRECTORS) from its giant connected component (DIRECTORS-gcc). Node attributes include quantitative characteristics of directors (age, geographic coordinates of birth place and residence place) and categorical characteristics of them (sex, and the set of industry sectors of companies they seats in the boards of -- e.g.,~such as IT, Bank, etc.). \begin{table}[t] \centering \scalebox{0.85}{ \begin{tabular}{|r|r|l|l|} \hline \multicolumn{2}{|c|}{\rule{0pt}{2ex}\emph{Topology}} & \multicolumn{2}{c|}{\emph{Attributes}}\\ \hline \multicolumn{4}{|l|}{\rule{0pt}{2ex}\textbf{DBLP}}\\\hline \rule{0pt}{2ex} \emph{Nodes} & \emph{Edges} & \emph{Categorical} & \emph{Quantitative} \\ \hline \rule{0pt}{2ex} 60,977 & 774,162 & topic & prolific \\ \hline \multicolumn{4}{|l|}{\rule{0pt}{2ex}\textbf{DIRECTORS}}\\ \hline \rule{0pt}{2ex} \emph{Nodes} & \emph{Edges} & \emph{Categorical} & \emph{Quantitative} \\ \hline \rule{0pt}{2ex} 3,609,806 & 12,651,511 & sectors, sex & age, birthplace, residence \\\hline \multicolumn{4}{|l|}{\rule{0pt}{2ex}\textbf{DIRECTORS-gcc}}\\ \hline \rule{0pt}{2ex} \emph{Nodes} & \emph{Edges} & \emph{Categorical} & \emph{Quantitative} \\ \hline \rule{0pt}{2ex} 1,390,625 & 10,524,042 & sectors, sex & age, birthplace, residence \\\hline \end{tabular} } \vspace{5pt} \caption{Summary of experimental datasets.} \label{tab:data} \end{table} Clustering this network means finding communities of people tied by business relationships. A combined semantic-topological approach may reveal patterns of structural aggregation as well as social segregation~\cite{baroni2015segregation}. For example, clusters may reveal communities of youngster/elderly directors in a specific sub-graph. \emph{DBLP: Scientific coauthor network.} This dataset consists of the DBLP bibliography database restricted to four research areas: databases, data mining, information retrieval, and artificial intelligence. The dataset was kindly provided by the authors of~\cite{zhou2010clustering}, where it is used for evaluation of their algorithm. Nodes are authors of scientific publications. An edge connect two authors that have co-authored at least one paper. Each node has two attributes: \emph{prolific} (quantitative), counting the number of papers of the author, and \emph{primary topic} (categorical), reporting the most frequent keyword in the author's papers. Fig.~\ref{fig:ddists} shows the cumulative distributions of semantic and topological distances for the datasets. In particular, the 1\textit{st} and 3\textit{rd} plots show the impact of the $l$ parameter on the topological distance. The smaller (resp. larger) $l$, the more distant (resp. close) are nodes. This is in line with the small-world phenomenon in networks~\cite[Fig.2]{watts1999networks}. \subsection{Experimental results} We will compare the following algorithms: \begin{itemize} \item \textbf{Inc-C}: the \emph{Inc-Clustering} algorithm by Zhou et al.~\cite{zhou2010clustering}. It requires in input the number $k$ of clusters to produce. Implementation provided by the authors. \item \textbf{GBAGC}: the \emph{General Bayesian framework for Attributed Graph Clustering} algorithm by Xu et al.~\cite{xu2014gbagc}, which is the best performing approach in the literature. It also takes $k$ as an input. Implementation provided by the authors. \item \textbf{SToC}: our proposed algorithm, which takes in input the attraction ratios $\alpha_S$ and $\alpha_T$, and the error threshold $\epsilon$. \item \textbf{ToC}: a variant of \textbf{SToC} which only considers topological information (nodes and edges). It takes in input $\alpha_T$ and the error threshold $\epsilon$ ($\tau$ and $l$ are computed as for \textbf{SToC}, with a dummy $\alpha_S = \alpha_T$). \item \textbf{SC}: a variant of \textbf{SToC} which only considers semantic information (attributes). It takes in input $\alpha_S$ and the error threshold $\epsilon$. \end{itemize} \begin{table} \centering \scalebox{0.9}{ \begin{tabular}{ |p{0.05\columnwidth |p{0.15\columnwidth |p{0.13\columnwidth |p{0.12\columnwidth |p{0.12\columnwidth |p{0.1\columnwidth} } \hline \rule{0pt}{2ex} $\alpha$& $k$ & Q&$WCSS$&Time (s)&Space (GB)\\ \hline \multicolumn{6}{|l|}{\rule{0pt}{2ex}\textbf{DBLP}}\\ \hline \rule{0pt}{2ex} 0.1 &25,598 (1,279) & 0.269 (0.014) & 5,428 (520) & 0.627 (0.21) & 0.65\\\rule{0pt}{2ex} 0.2 &26,724 (1,160) & 0.270 (0.015) & 5,367 (534) & 0.616 (0.214)& 0.64\\\rule{0pt}{2ex} 0.4 &6,634 (5,564)& 0.189 (0.12) & 23,477 (3,998)& 0.272 (0.151)& 0.67\\\rule{0pt}{2ex} 0.6 &9,041 (7,144)& 0.153 (0.08) & 21,337 (5,839)& 0.281 (0.1) & 0.7 \\\rule{0pt}{2ex} 0.8 &11,050 (4,331) & 0.238 (0.1) & 20,669 (3,102)& 0.267 (0.11) & 0.69\\\rule{0pt}{2ex} 0.9 &15,041 (5,415) & 0.188 (0.045) & 16,688 (4,986)& 0.28 (0.05) & 0.64\\ \hline \multicolumn{6}{|l|}{\rule{0pt}{2ex}\textbf{DIRECTORS}}\\ \hline 0.1&2,591,184 (311,927)&0.1347 (0.0237)&7,198 (5,382)&3,698 (485)& 9 \\ 0.2&2,345,680 (162,444)&0.1530 (0.0084)&9,793 (1,977)&3,213 (167.3)&8.2\\ 0.4& 1,891,075 (34,276)& 0.22 (0.023)&26,093 (1,829)&2,629 (178.6)&8.6\\ 0.6& 1,212,440 (442,011) & 0.28 (0.068) & 72,769 (4,129) & 17,443 (2,093) &8.7\\ 0.8& 682,800 (485,472)& 0.1769 (0.066)&49,879 (8,581)& 8,209 (12,822)&9.5\\ \hline \multicolumn{6}{|l|}{\rule{0pt}{2ex}\textbf{DIRECTORS-gcc}}\\ \hline 0.1&886,427 (123,420) & 0.102 (0.016)&6158 (2886)&278.4 (44.7)&10\\\rule{0pt}{2ex} 0.2&901,306 (47,486) & 0.103 (0.02)&4773 (2450)&274 (14.1)&10.4\\\rule{0pt}{2ex} 0.4&811,152 (28,276) &0.1257 (0.0164) &8,050 (1450)&239.1 (11.6)&4.3\\\rule{0pt}{2ex} 0.6&664,882 (63,334) & 0.248 (0.0578)&13,555 (3,786)&181.6 (24.4)&4.2\\\rule{0pt}{2ex} 0.8& 584,739 (408,725)& 0.189 (0.0711)&49,603 (9,743) &5,979 (10,518)&8.8\\\hline \end{tabular} } \vspace{5pt} \caption{\textbf{SToC} results (mean values over 10 runs, StDev in brackets).} \label{tab:SToC} \end{table} \begin{table}[t] \centering \scalebox{0.9}{ \begin{tabular}{|r|r|r|r|r|} \hline $k$ & Q & $WCSS$ & Time (s) & Space (GB)\\ \hline \rule{0pt}{2ex} 15 & -0.499 & 38,009 & 870 & 31.0 \\\rule{0pt}{2ex} 100 & -0.496 & 37,939 & 1,112 & 31.0 \\\rule{0pt}{2ex} 1,000 & -0.413 & 37,051 & 1305 & 31.1 \\\rule{0pt}{2ex} 5,000 & -0.136 & 32,905 & 1,273 & 32.1 \\\rule{0pt}{2ex} 15,000 & 0.083 & 13,521 & 1,450 & 32.2 \\ \hline \end{tabular} } \vspace{5pt} \caption{\textbf{Inc-C} results for the DBLP dataset.} \label{tab:IncC} \end{table} \begin{table} \centering \scalebox{0.9}{ \begin{tabular}{|r|r|r|r|r|} \hline \rule{0pt}{2ex} $k$ (actual) & Q&$WCSS$&Time (s)&Space (GB)\\ \hline \multicolumn{5}{|l|}{\rule{0pt}{2ex}\textbf{DBLP}}\\ \hline \rule{0pt}{2ex} 10 (10) & 0.0382 &27,041 & 17 &0.5 \\\rule{0pt}{2ex} 50 (14) & 0.0183 &27,231 & 25 & 0.6 \\\rule{0pt}{2ex} 100 (2)~ & $1\cdot 10^{-7}$ &27,516 & 13 & 0.7 \\\rule{0pt}{2ex} 1,000 (3)~ & $6\cdot 10^{-4}$ &27,465 & 37 & 3 \\\rule{0pt}{2ex} 5,000 (2)~ & $2\cdot 10^{-5}$ &27,498 & 222 &14.2 \\\rule{0pt}{2ex} 15,000 (1)~ & 0 &27,509 & 663 &50.182 \\ \hline \multicolumn{5}{|l|}{\rule{0pt}{2ex}\textbf{DIRECTORS}}\\ \hline \rule{0pt}{2ex} 10 (8)~ & 0.0305 &198797&18 &4.3 \\\rule{0pt}{2ex} 50 (10) & 0.0599 &198792&63 &12.4 \\\rule{0pt}{2ex} 100 (8)~ & 0.1020 &198791&120 &22.4\\\rule{0pt}{2ex} 500 (5)~ & 0.0921 &198790&8,129 &64.3 \\\rule{0pt}{2ex} 1000 (--)~ &-&-&-&out of mem\\ \hline \multicolumn{5}{|l|}{\rule{0pt}{2ex}\textbf{DIRECTORS-gcc}}\\ \hline \rule{0pt}{2ex} 10 (8)~ & 0.1095&75103&94&3.02\\\rule{0pt}{2ex} 50 (14)&0.0563&75101&161&5.47\\\rule{0pt}{2ex} 100 (15)&0.0534&75101&234&9.34\\\rule{0pt}{2ex} 500 (5)~ &0.0502&75101&1,238&40.3\\\rule{0pt}{2ex} 1000 (7)~ &0.0569&75101&3,309&59\\\rule{0pt}{2ex} 1500 (--)~ &--&--&--&out of mem\\ \hline \end{tabular} } \vspace{5pt} \caption{\textbf{GBAGC} results.} \label{tab:GBAGC} \end{table} All tests were performed on a machine with two Intel Xeon Processors E5-2695 v3 (35M Cache, 2.30 GHz) and 64 GB of main memory running Ubuntu 14.04.4 LTS. \textbf{SToC}, \textbf{ToC} and \textbf{SC} are implemented in Java 1.8, \textbf{Inc-C} and \textbf{GBAGC} are developed in MatLab. Table~\ref{tab:SToC} shows the results of \textbf{SToC} for $\alpha_S = \alpha_T = \alpha$ varying from 0.1 to 0.9, and a fixed $\epsilon = 0.9$. For every dataset and $\alpha$, we report the number of clusters found ($k$), the evaluation metrics $Q$ and $WCSS$, the running time, and the main memory usage. As general comments, we can observe that $k$ and $WCSS$ are inversely proportional to $\alpha$, $Q$ is always non-negative and in good ranges, memory usage is limited, and running times are negligible for DBLP and moderate for DIRECTORS and DIRECTORS-gcc. For every $\alpha$, we executed 10 runs of the algorithm, which uses random seeds, and reported mean value and standard deviation. The low values of the standard deviations of $Q$ and $WCSS$ show that the random choice of the seeds does not impact the stability of the results. The results of \textbf{ToC} and \textbf{SC} can be found in in Appendix~\ref{apx:sctoc}: in summary, the exploitation of both semantic and topological information leads to a superior performance of \textbf{SToC} w.r.t.~both $Q$ and $WCSS$. Tables~\ref{tab:IncC} and~\ref{tab:GBAGC} report the results for \textbf{Inc-C} and \textbf{GBAGC} respectively. Due to the different input parameters of such algorithms, we can compare the results of \textbf{SToC} only by looking at rows with similar $k$. Let us consider \textbf{Inc-C} first. Running times are extremely high, even for the moderate size dataset DBLP. It was unfeasible to obtain results for DIRECTORS. Space usage is also high, since the algorithm is in $O(n^2)$. Values of $Q$ are considerably worse than \textbf{SToC}. $WCSS$ tends to generally high. Consider now \textbf{GBAGC}. Quality of the results is considerably lower than \textbf{SToC} both w.r.t.~$Q$ and $WCSS$. The space usage and elapsed time increase dramatically with $k$, which is non-ideal for large graphs, where a high number of cluster is typically expected. On our experimental machine, \textbf{GBAGC} reaches a limit with $k = 500$ for the DIRECTORS dataset by requiring 65GB of main memory. Even more critical is the fact that the number of clusters actually returned by \textbf{GBAGC} is only a fraction of the input $k$, e.g.,~it is 1 for $k=15,000$ for the DBLP dataset. The user is not actually controlling the algorithm results through the required input. \newcommand{.6\columnwidth}{.49\columnwidth} \begin{figure}[!t] \centering \includegraphics[width=.6\columnwidth]{fig/stoc-dblp.png} \includegraphics[width=.6\columnwidth]{fig/stoc-comp.png} \\\vspace*{1pt} \includegraphics[width=.6\columnwidth]{fig/bagc-dblp.png} \includegraphics[width=.6\columnwidth]{fig/bagc-comp.png} \\\vspace*{1pt} \includegraphics[width=.6\columnwidth]{fig/inc-dblp.png} \caption{Size distribution of clusters found by \textbf{SToC}, \textbf{GBAGC} and \textbf{Inc-C} for some of the tests in Tables~\ref{tab:SToC}, \ref{tab:IncC}, \ref{tab:GBAGC}.} \label{fig:sdist} \end{figure} Figure~\ref{fig:sdist} clarifies the main limitation of \textbf{Inc-C} and \textbf{GBAGC} over \textbf{SToC}. It reports for some of the executions the size distributions of clusters found. \textbf{Inc-C} (bottom plot) tends to produce a single giant cluster including most of the nodes. \textbf{GBAGC} (middle plots) produces a small number of clusters regardless of the input parameters. Instead, \textbf{SToC} (top plots) produces more balanced results, typically expected in sociology \cite{bruhn2011sociology,mcmillan1986sense}, with a size distribution in line with common power-laws found in real-world network and with the input graphs in particular (see \cite{baroni2015segregation} for the DIRECTORS graph). \section{Conclusions}\label{sec:conclusions} We proposed \textbf{SToC}, a clustering algorithm for large attributed graphs. It extracts non-overlapping clusters using a combined distance that accounts for network topology and semantic features, based on declarative parameters (attraction ratios) rather than on operational ones (number of clusters) typically required by other approaches. Experimental results showed that \textbf{SToC} outperforms the state of the art algorithms in both time/space usage and in quality of the clustering found. \section*{Acknowledgements} The authors would like to thank Andrea Marino and Andrea Canciani for useful conversations. \bibliographystyle{abbrv}
{'timestamp': '2017-08-29T02:07:23', 'yymm': '1703', 'arxiv_id': '1703.08590', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08590'}
arxiv
\section{Introduction} \label{introduction} Consider a physical system that is being observed with a set of sensors. The time series of raw sensor measurements contains information about the evolution of the system of interest, mixed with information about the nature of the sensors. For example, video pictures contain information about the evolution of the scene of interest, but they are also influenced by sensor-dependent factors such as the position, angular orientation, field of view, and spectral response of the camera. Likewise, audio measurements may describe the evolution of an acoustic source, but they are also influenced by extrinsic factors such as the positions and frequency responses of the microphones. Calibration procedures can be used to transform measurements created with one set of sensors so that they can be compared to measurements made with a different set of sensors (\cite{Elbert},\cite{Morain},\cite{Bottomley}). However, there are situations in which it is inconvenient, awkward, or impossible to calibrate a measurement apparatus. For example: 1) the calibration procedure may take too much time; 2) the calibration process may interfere with the evolution of the system being observed; 3) the observer may not have access to the measuring device (e.g., because it is at a remote location). This paper describes how a time series of measurements can be processed to derive a purely sensor-independent description of the evolution of the underlying physical system. Specifically, consider an evolving physical system with $N$ degrees of freedom ($N \geq 1$), and suppose that it is being observed by $N$ sensors, whose output is denoted by $x(t)$ ($x_{k}(t) \mbox{ for } k = 1, \ldots ,N$). For simplicity, assume that the sensors' output is invertibly related to the system states. In other words, assume that the sensor measurements represent the system's state in a coordinate system defined by the nature of the sensors. Section \ref{conclusion} describes how measurements can be chosen to have this invertibility property. Now, suppose that the same system is also being observed by another set of sensors, whose output, $x'(t)$, is invertibly related to the system states and, therefore, is invertibly related to $x(t)$. For example, $x(t)$ and $x'(t)$ could be the outputs of calibrated and uncalibrated sensors, respectively, as they simultaneously observe the same system. Or, they could be the outputs of sensors that detect different types of energy (e.g., infrared light vs ultraviolet light). Under these conditions, we show how to process $x(t)$ in order to derive an ''inner" time series, $w(t)$ ($w_{k}(t) \mbox{ for } k = 1, \ldots ,N$). We then demonstrate that the same inner time series will result if the other set of sensor outputs, $x'(t)$, is subjected to the same procedure. Because of its sensor-independence, an inner time series may produce fewer false negatives when it is used to detect events in the presence of sensor drift. In mathematical terms, $x(t)$ and $x'(t)$ represent the evolving system's state in different coordinate systems on state space, and the inner time series is a coordinate-system-independent description of the system's velocity in state space. To derive this sensor-independent time series, the time series of sensor measurements, $x(t)$, is statistically processed in order to construct $N$ local vectors at each point in state space. The system's path through state space can then be described by a succession of small displacement vectors, each of which is a weighted superposition of the local vectors. The inner time series is comprised of these time-dependent weights, $w(t)$, which are coordinate-system-independent and, therefore, sensor-independent. Thus, any two observers will describe the system's evolution with the same inner time series, even though they utilize different sensors to monitor the system. Essentially, an inner time series is a ''canonical" form of a measurement time series, created by normalizing the measurements with respect to their own statistical properties. No matter what linear or nonlinear transformation has been applied to a sequence of measurements, its canonical form (i.e., its inner time series) is the same. An inner time series is roughly analogous to the principal components of a data set, which represent the data in the same ''canonical" way, no matter what rotation and/or translation has been applied to them. There are many ways of using a time series of measurements to define local vectors on the system's state space, and each of these methods can be used to create a sensor-independent description of the system's evolution. However, the local vectors described in this paper have an unusually attractive property: namely, they produce \textit{separable} sensor-independent descriptions of systems that are composed of non-interacting subsystems. Specifically, consider a system that is composed of two statistically independent subsystems, and suppose that the raw measurements of it are linear or nonlinear mixtures of the state variables of its non-interacting subsystems. It can be shown that each component of the inner time series of the composite system is also a component of the inner time series of an isolated subsystem. In other words, each component of the inner time series of the composite system is a stream of information about just \textit{one} of the subsystems, even though it may have been derived from measurements sensitive to several subsystems. Because of this property, an inner time series can be used to detect a specific behavior of one subsystem, which is evolving in the presence of other subsystems. In contrast to blind source separation procedures (\cite{Comon Jutten}, \cite{Jutten}, \cite{Almeida}), this is done without finding the mixing function, which relates the raw measurements of the composite system to the states of its subsystems. Reference \cite{Levin ci-JAP} describes a different way of creating sensor-independent representations of evolving systems. First, the second-order correlations of the system's local velocity distributions are used to define a Riemannian metric and affine connection on the manifold of measurements. Then, each incremental displacement along the system's path through state space is described as a superposition of reference vectors, parallel transferred from the beginning of the path. Such a description will be coordinate-system-independent (and, therefore, sensor-independent), if it includes a coordinate-system-independent way of identifying the reference vectors at the initial point of each path of interest. In contrast, the method proposed in the current paper does not require reference vectors; instead it utilizes local vectors that are properties of the local velocity distributions of the system's past trajectory. Furthermore, the methodology in \cite{Levin ci-JAP} does not provide a simple description of composite systems. In contrast, the method proposed here always creates a sensor-independent description of a composite system, consisting of a collection of the sensor-independent descriptions of the independent subsystems. The next section describes the procedure for computing an inner time series from a time series of raw measurements. It also demonstrates that the inner time series of a composite system consists of a collection of the inner time series of its constituent parts. Section \ref{examples} illustrates the method by applying it to: 1) an analytic example; 2) the audio waveform of one speaker; 3) video images from a moving camera; 4) mixtures of audio waveforms of two speakers. The last section discusses the implications of this approach. \section{Method} \label{method} The following subsection outlines how a time series of sensor measurements can be processed in order to derive local vectors at each point in the state space of the observed system. This procedure is only presented in outline form here, because detailed descriptions can be found in \cite{Levin arXiv} and \cite{Levin LVA-ICA}. It is then shown how these vectors can be used to create an inner description of the system's path through state space. In the second subsection, the system is assumed to be composed of two statistically independent subsystems. It is shown that the inner time series of the composite system is a simple collection of the inner time series of its subsystems. \subsection{Derivation of inner time series} \label{derivation} The first step is to construct second-order and fourth-order local correlations of the data's velocity ($\dot{x}$) \begin{equation} \label{C2 definition} C_{kl}(x) = \, \langle (\dot{x}_k-\bar{\dot{x}}_k) (\dot{x}_l-\bar{\dot{x}}_l) \rangle_{x} \end{equation} \begin{equation} \label{C4 definition} C_{klmn}(x) = \, \langle (\dot{x}_k-\bar{\dot{x}}_k) (\dot{x}_l-\bar{\dot{x}}_l) (\dot{x}_m-\bar{\dot{x}}_m) (\dot{x}_n-\bar{\dot{x}}_n) \rangle_{x} \end{equation} where $\bar{\dot{x}} = \langle \dot{x} \rangle_x$, where the bracket denotes the time average over the trajectory's segments in a small neighborhood of $x$, and where all subscripts are integers between $1$ and $N$ with $N \geq 1$. Next, let $M(x)$ be any local $N \times N$ matrix, and use it to define $M \mbox{-transformed}$ velocity correlations, $I_{kl}$ and $I_{klmn}$ \begin{equation} \label{I2 definition} I_{kl}(x) = \sum_{1 \leq k', \, l' \leq N} M_{kk'}(x) M_{ll'}(x) C_{k'l'}(x) , \end{equation} \begin{equation} \label{I4 definition} I_{klmn}(x) = \sum_{1 \leq k', \, l', \, m', \, n' \leq N} M_{kk'}(x) M_{ll'}(x) M_{mm'}(x) M_{nn'}(x) C_{k'l'm'n'}(x) . \end{equation} Because $C_{kl}(x)$ is generically positive definite at any point $x$, it is almost always possible to find a particular form of $M(x)$ that satisfies \begin{equation} \label{M definition 1} I_{kl}(x) = \delta_{kl} \end{equation} \begin{equation} \label{M definition 2} \sum_{1 \leq m \leq N} I_{klmm}(x) = D_{kl}(x) , \end{equation} where $D(x)$ is a diagonal $N \times N$ matrix (\cite{Levin arXiv}, \cite{Levin LVA-ICA}). As long as $D$ is not degenerate, $M(x)$ is unique, up to arbitrary \textit{local} permutations and/or reflections. In almost all applications of interest, the velocity correlations will be continuous functions of $x$. Therefore, in any neighborhood of state space, there will always be a continuous solution for $M(x)$, and this solution is unique, up to arbitrary \textit{global} permutations and/or reflections. In any other coordinate system $x'$, the most general solution for $M'$ is given by \begin{equation} \label{M'} M'_{kl}(x') = \sum_{1 \leq m, \, n \leq N} P_{km} M_{mn}(x) \frac{\partial x_n}{ \partial x'_l} , \end{equation} where $M$ is a matrix that satisfies (\ref{M definition 1}) and (\ref{M definition 2}) in the $x$ coordinate system and where $P$ is a product of permutation, reflection, and identity matrices (\cite{Levin arXiv}, \cite{Levin LVA-ICA}). By construction, $M$ is not singular. Notice that (\ref{M'}) shows that the rows of $M$ transform as local covariant vectors, up to a global permutation and/or reflection. Likewise, the same equation implies that the columns of $M^{-1}$ transform as local contravariant vectors (denoted as $V_{(i)}(x) \mbox{ for } i = 1, \ldots N$), up to a global permutation and/or reflection. Because these vectors are linearly independent, the measurement velocity at each time ($\dot{x}(t)$) can be represented by a weighted superposition of them \begin{equation} \label{xDot rep} \dot{x}(t) = \sum_{1 \leq i \leq N} w_{i}(t) V_{(i)}(x) , \end{equation} where $w_{i}$ are time-dependent weights. Because $\dot{x}$ and $V_{(i)}$ transform as contravariant vectors (except for a possible global permutation and/or reflection), the weights $w_{i}$ must transform as scalars or invariants; i.e., they are independent of the coordinate system in which they are computed (except for a possible permutation and/or reflection). Therefore, the time-dependent weights, $w_{i}(t)$, provide an inner (coordinate-system-independent) description of the system's velocity in state space. Two observers, who use different sensors (and, therefore, different state space coordinate systems), will derive the same inner time series, except for a possible global permutation and/or reflection. This equation can be integrated over the time interval $[t_{0},t]$ to give an expression for the system's state during that time interval \begin{equation} \label{x rep} x(t) = x(t_0) + \int_{t_0}^{t} \sum_{1 \leq i \leq N} w_{i}(t) V_{(i)}[x(t)] dt , \end{equation} This is an integral equation for constructing $x(t)$ on the interval $[t_{0}, t]$ from the weight time series, $w_{i}(t)$, on the same time interval. Note that, given a set of local vectors, there is a many-to-one correspondence between the set of measurement time series and corresponding inner time series. Specifically, (\ref{xDot rep}) shows that each measurement time series maps onto just one weight time series. However, as shown by (\ref{x rep}), one weight time series maps onto multiple time series of sensor measurements, differing by the choice of the initial point, $x(t_0)$. It should also be mentioned that it may be difficult to use this equation to numerically compute the measurement time series, corresponding to a given weight time series, because errors will tend to accumulate as one integrates the right side. \subsection{Inner time series of composite systems} \label{composite systems} Now, consider the special case in which the observed system is composite (or separable) in the sense that it consists of two statistically independent subsystems. Specifically, assume that there is a state space coordinate system, $s$, in which the state components, $s_{k}(t) \mbox{ for } k = 1, \ldots ,N$, can be partitioned into two groups, $s_{(1)} = (s_{k} \mbox{ for } k = 1, \ldots ,N_1)$ and $s_{(2)} = (s_{k} \mbox{ for } k = N_{1} + 1, \ldots ,N)$, that are statistically independent in the following sense (\cite{Levin arXiv}, \cite{Levin LVA-ICA}). Let $\rho_S(s,\dot{s})$ be the PDF in $(s,\dot{s}) \mbox{-space}$. Namely, $\rho_S(s,\dot{s}) ds d\dot{s}$ is the fraction of total time that the location and velocity of $s(t)$ are within the volume element $ds d\dot{s}$ at location $(s,\dot{s})$. The subsystem state variables, $s_{(1)}$ and $s_{(2)}$, are assumed to be statistically independent in the sense that the density function of the system variable is the product of the density functions of the two subsystem variables; i.e., \begin{equation} \label{phase space factorization} \rho_S(s,\dot{s}) = \prod_{a=1,2}{\rho_{a}(s_{(a)},\dot{s}_{(a)})} . \end{equation} This separability criterion in $(s,\dot{s}) \mbox{-space}$ is stronger than the conventional formulation in $s \mbox{-space}$, and references \cite{Levin arXiv} and \cite{Levin LVA-ICA} argue that this makes it preferable to the conventional criterion. In the following paragraphs, it is shown that, if the data are separable in the above sense, the components of the inner time series of the composite system can be partitioned into two groups, each of which provides an inner description of one of the subsystems. Although these results are demonstrated here for systems with two independent subsystems, they can be easily generalized to systems with any number of subsystems. To show this, the first step is to transform (\ref{xDot rep}) into the $s$ coordinate system, by multiplying each side by $ds/dx$. Because the $V_{(i)}$ transform as contravariant vectors (up to a possible permutation and/or reflection), it follows that \begin{equation} \label{sDot rep} \dot{s}(t) = \sum_{1 \leq i, \, j \leq N} w_{i}(t) P_{ij} V_{S(j)} , \end{equation} where $V_{S(j)}$ is $V_{(j)}$ in the $s$ coordinate system and $P$ is a possible permutation and/or reflection. By definition, the $V_{S(i)}$ are the local vectors, which are derived from the local distribution of $\dot{s}$ in the same way that the $V_{(i)}$ were derived from the local distribution of $\dot{x}$. Specifically, $V_{S(i)}$ is the $i^{th}$ column of $M^{-1}_S$, where $M_S$ is the $M$ matrix that is derived from the second- and fourth-order velocity correlations in the $s$ coordinate system. The next step is to show that the matrix $M_S$ has a simple block-diagonal form. In particular, \cite{Levin arXiv} and \cite{Levin LVA-ICA} show that $M_S$ is given by \begin{equation} \label{block-diagonal MS} M_S(s) = \left( \begin{array}{ccc} M_{S1}(s_{(1)}) & 0 & \\ 0 & M_{S2}(s_{(2)}) & \end{array} \right) . \end{equation} where each submatrix, $M_{Sa}$ for $a = 1,2$, satisfies (\ref{M definition 1}) and (\ref{M definition 2}) for correlations between components of $s_{(a)}$. Observe that each vector $V_{S(i)}$ vanishes except where it passes through one of the blocks of $M^{-1}_S$. Therefore, equation (\ref{sDot rep}) is equivalent to a pair of equations, which are formed by projecting it onto each block corresponding to a subsystem state variable. For example, projecting both sides of (\ref{sDot rep}) onto block $a$ gives the result \begin{equation} \label{s(a)Dot rep} \dot{s}_{(a)}(t) = \sum_{\substack{1 \leq i \leq N \\ j \, \in \, block \, a}} w_{i}(t) P_{ij} V_{S(ja)} . \end{equation} Here, $V_{S(ja)}$ is the projection of $V_{S(j)}$ onto block $a$; i.e., it is the column of $M_{Sa}^{-1}$ that coincides with column $j$ of $M^{-1}_S$, as it passes through block $a$. This means that the vectors, $V_{S(ja)}$ for $j \in block \, a$, are the local vectors on the $s_{(a)}$ manifold, which are derived from the local distribution of $\dot{s}_{(a)}$ in the same way that the $V_{(i)}$ were derived from the local distribution of $\dot{x}$. Notice that each time-dependent weight, $w_{i}(t)$, describes the evolution of \emph{just one} subsystem. In other words, the weights do not contain a mixture of information about the evolution of the two subsystems. This is true despite the fact that they can be derived from raw measurements that may be complicated unknown mixtures of the state variables of both subsystems. Next, define group $1$ (group $2$) to be the set of weights appearing in the expression \begin{equation} \sum_{1 \leq i \leq N} w_{i} P_{ij} \end{equation} for $j \in block \, 1$ (for $j \in block \, 2$). Equation (\ref{s(a)Dot rep}) shows that the weights in group $1$ (group $2$) comprise a sensor-independent description of the velocity of subsystem $1$ (subsystem $2$). Equation (\ref{s(a)Dot rep}) also suggests that the weights in group 1 must be statistically independent of the weights in group 2. Specifically, (\ref{s(a)Dot rep}) implies that the weights in each group can be computed from: 1) the time course of the state variable of the corresponding subsystem; 2) the local vectors of the corresponding subsystem, which themselves are constructed from the time course of the state variable of the corresponding subsystem. Because the weights in group 1 and group 2 are derived from $s_{1}(t)$ and $s_{2}(t)$, respectively, and because the latter are statistically independent, it is likely that the former are also statistically independent. \section{Analytic and Experimental Examples} \label{examples} In this section, the methodology of Section \ref{method} is illustrated by applying it to: 1) an analytic example (namely, a time series equal to a sine wave); 2) the audio waveform of a single speaker; 3) video data from a camera moving with two degrees of freedom; 4) nonlinear mixtures of the waveforms of two speakers. \subsection{Analytic example: a sine wave} \label{analytic example} In this subsection, the proposed methodology is applied to a measurement time series, simulated by a sine wave. Its inner time series is derived analytically, before and after it is transformed by an arbitrary monotonic function. The transformed data, which simulate the output of a second sensor, are shown to have the same inner time series as the untransformed data from the first sensor. Suppose the measured sensor signal is \begin{equation} \label{x analytic} x(t) = a \sin(t) \end{equation} where $a$ is any real number and $- \infty \leq t \leq \infty$. Because of the periodicity of the signal, the local second-order velocity correlation can be shown to be \begin{equation} C_{11}(x) = a^{2} - x^{2} . \end{equation} The $1 \times 1$ ``matrix", $M$, is \begin{equation} \label{M analytic} M_{11}(x) = \pm 1/ \sqrt{a^{2} - x^{2}} , \end{equation} and the one-component local vector, $V_{(1)}(x)$, is \begin{equation} \label{V analytic} V_{(1)1}(x) = \pm \sqrt{a^{2} - x^{2}} . \end{equation} Either sign can be chosen in (\ref{M analytic}) and (\ref{V analytic}) because $M$ is only determined up to a global reflection. Substituting (\ref{x analytic}) and (\ref{V analytic}) into (\ref{xDot rep}) shows that the weight time series is \begin{equation} \label{w analytic} w_{1}(t) = \pm sgn \left[a \cos(t) \right] . \end{equation} Thus, for this simple periodic signal, the inner time series is the sign of the signal's time derivative. As shown in the following subsections, a much larger amount of information is contained in the inner time series of more complex one-component signals. The sensor-independence (or coordinate-system-independence) of the inner time series can be demonstrated explicitly by computing it from measurements that have been transformed by a monotonic function, $f(x)$, which simulates the relative response of a different sensor. Specifically, consider the transformed measurements given by \begin{equation} \label{x' analytic} x'(t) = f\left[a \sin(t)\right] , \end{equation} where $f$ is monotonic. The local second-order correlation of the velocity of these measurements is \begin{equation} \label{C' analytic} C'_{11}(x') = \left[ \frac{df}{dx} a \cos(t_{x'}) \right]^2 , \end{equation} where $df/dx$ is evaluated at $x = a \sin(t_{x'})$ and where $t_{x'}$ is any solution of $f \left[a \sin(t_{x'}) \right] = x'$. Because the measurements have just one component, the $1 \times 1$ ''matrix" $M'$ is equal to \begin{equation} \label{M' analytic} M'_{11}(x') = \pm 1 / \sqrt{C'_{11}(x')} , \end{equation} and the local vector is \begin{equation} \label{V' analytic} V'_{(1)1}(x') = \pm \sqrt{C'_{11}(x')} . \end{equation} Substituting (\ref{x' analytic}) and (\ref{V' analytic}) into (\ref{xDot rep}) shows that the weight function is \begin{equation} \label{w analytic} w'_{1}(t) = \pm sgn \left[a \cos(t) \right] = w_{1}(t) . \end{equation} Thus, the transformed and untransformed measurements ((\ref{x' analytic}) and (\ref{x analytic})) have the same inner time series (up to a reflection), This shows that the weights are sensor-independent (and coordinate- system-independent), a fact that was proved in Section \ref{method}. \subsection{The audio signal of a single speaker} \label{audio signal} In this subsection, the proposed method is applied to the audio waveform of a single speaker, before and after it has been transformed by a nonlinear monotonic function, which simulates the relative response of another sensor. The inner time series of the untransformed and transformed signals are shown to be almost the same. The male speaker's audio waveform, $x(t)$, was a 31.25 s excerpt from an audio book recording. This waveform was sampled 16,000 times per second with two bytes of depth. The thin black line in Figure \ref{fig_xXPrimeOfT} shows the speaker's waveform during a short (31.25 ms) interval. The thick gray line in Figure \ref{fig_xXPrimeOfT}, $x'(t)$, simulates the output of another sensor, which is related to $x(t)$ by the monotonic nonlinear transformation in Figure \ref{fig_xPrimeOfX}. \begin{figure} \centering \subfloat{\includegraphics[width=0.35\textwidth]{fig_xXPrimeOfT.eps}% } \caption{ The thin black line shows a 31.25 ms excerpt of $x(t)$, the audio waveform of a speaker. The thick gray line shows $x'(t)$, the same waveform, after it has been transformed by the monotonic nonlinear transformation shown in Figure \ref{fig_xPrimeOfX}.} \label{fig_xXPrimeOfT} \end{figure} \begin{figure} \centering \subfloat[]{\includegraphics[width=0.35\textwidth]{fig_xPrimeOfXGlobal.eps \label{fig_xPrimeOfXGlobal}} \subfloat[]{\includegraphics[width=0.35\textwidth]{fig_xPrimeOfXLocal.eps \label{fig_xPrimeOfXLocal}} \caption{The left panel shows the monotonic nonlinear transformation, $x'(x)$, which was applied to the sensor measurements, $x(t)$, in order to create $x'(t)$ (Figure \ref{fig_xXPrimeOfT}). The latter time series simulates the output of a different sensor. The right panel is a magnified view of the central portion of the left panel.} \label{fig_xPrimeOfX} \end{figure} The technique in Subsection \ref{derivation} was applied to 500,000 samples of $x(t)$ and $x'(t)$, in order to derive the one-component vectors, $V_{(1)}(x)$ and $V'_{(1)}(x')$, in an array of 128 bins on the $x$ and $x'$ manifolds, respectively. These vectors are displayed in Figure \ref{fig_VOfXVPrimeOfXPrime}. \begin{figure} \centering \subfloat[]{\includegraphics[width=0.35\textwidth]{fig_VOfX.eps \label{fig_VOfX}} \subfloat[]{\includegraphics[width=0.35\textwidth]{fig_VPrimeOfXPrime.eps \label{fig_VPrimeOfXPrime}} \caption{The left and right panels show the local vectors, $V_{(1)}(x)$ and $V'_{(1)}(x')$, which were derived from 500,000 samples of $x(t)$ and $x'(t)$, respectively.} \label{fig_VOfXVPrimeOfXPrime} \end{figure} Then, these vectors and equation (\ref{xDot rep}) were used to compute the inner time series, $w_{1}(t)$ and $w'_{1}(t)$, corresponding to the two measurement time series, $x(t)$ and $x'(t)$, respectively. The resulting time series of weights are shown in Figure \ref{fig_wWPrimeOfT}. Notice that the two inner time series are almost the same, despite the fact that they were derived from sensor measurements, which differed by a nonlinear transformation. This demonstrates the sensor-independence of the weights, a property that was proved in general in Subsection \ref{derivation}. \begin{figure} \centering \subfloat{\includegraphics[width=0.35\textwidth]{fig_wWPrimeOfT.eps}% } \caption{The thin black line and thick gray line show the inner time series, $w_{1}(t)$ and $w'_{1}(t)$, respectively, during the 31.25 ms time interval depicted in Figure \ref{fig_xXPrimeOfT}.} \label{fig_wWPrimeOfT} \end{figure} When either inner time series was played as an audio file, it sounded like a completely intelligible version of the original audio waveform, $x(t)$. No semantic information was lost, although the prosody of the signal may have been modified. Therefore, in this experiment, almost all of the signal's information content was preserved by the process of deriving its inner time series. \subsection{Video data from a moving camera} \label{video signal} In this subsection, the procedure in Subsection \ref{derivation} is used to derive the inner time series of a sequence of video images, recorded by a camera moving in an office. We also computed the inner time series of the same image sequence, after each image was subjected to a nonlinear transformation, thereby simulating the output of a different sensor (i.e., a different video camera). The two inner time series were almost the same, despite the fact that they were derived from the outputs of dramatically different sensors. The original (i.e., untransformed) images were recorded by a cell phone video camera as it was moved in an irregular fashion over a portion of a spherical surface, having a radius of approximately 25 cm. The plane of the camera was oriented so that it was always tangential to the surface, and the camera's lower edge was kept parallel to the floor at all times. In this way, the camera was moved with two degrees of freedom; i.e., it was moved through a series of configurations (positions and orientations) that formed a two-dimensional manifold. The camera recorded thirty frames per second over the course of approximately 70 minutes, producing a total of 126,036 frames. Each frame consisted of a $320 \times 240$ array of pixels, in which the RGB responses were measured with one byte of depth. The top row of Figure \ref{fig_frames} displays a typical series of images, subsampled at 1.67 s intervals over the course of 17 s. \begin{figure} \begin{center}$ \begin{array}{cccccccccc} \includegraphics[width=0.1\textwidth]{fig_untrans1.eps}& \includegraphics[width=0.1\textwidth]{fig_untrans2.eps}& \includegraphics[width=0.1\textwidth]{fig_untrans3.eps}& \includegraphics[width=0.1\textwidth]{fig_untrans4.eps}& \includegraphics[width=0.1\textwidth]{fig_untrans5.eps}& \includegraphics[width=0.1\textwidth]{fig_untrans6.eps}& \includegraphics[width=0.1\textwidth]{fig_untrans7.eps}& \includegraphics[width=0.1\textwidth]{fig_untrans8.eps}& \includegraphics[width=0.1\textwidth]{fig_untrans9.eps}& \includegraphics[width=0.1\textwidth]{fig_untrans10.eps} \\ \includegraphics[width=0.1\textwidth]{fig_trans1.eps}& \includegraphics[width=0.1\textwidth]{fig_trans2.eps}& \includegraphics[width=0.1\textwidth]{fig_trans3.eps}& \includegraphics[width=0.1\textwidth]{fig_trans4.eps}& \includegraphics[width=0.1\textwidth]{fig_trans5.eps}& \includegraphics[width=0.1\textwidth]{fig_trans6.eps}& \includegraphics[width=0.1\textwidth]{fig_trans7.eps}& \includegraphics[width=0.1\textwidth]{fig_trans8.eps}& \includegraphics[width=0.1\textwidth]{fig_trans9.eps}& \includegraphics[width=0.1\textwidth]{fig_trans10.eps} \end{array}$ \end{center} \caption{The top row shows sample images, which were recorded by a moving video camera at 30 frames per second and then subsampled at 1.67 s intervals. The bottom row show the images in the top row, after they were subjected to the nonlinear transformation depicted in Figure \ref{fig_hVOfHPrimeVPrime}} \label{fig_frames} \end{figure} The second time series of images was created by subjecting each recorded image to a nonlinear transformation. Specifically, each pixel with image coordinates $(h,v)$ in a given recorded frame was mapped to the location with image coordinates $(h'(h),v'(v))$ in the corresponding transformed frame, where $h(h')$ and $v(v')$ are shown in Figure \ref{fig_hVOfHPrimeVPrime}. It is evident that this transformation turns each image upside down and backwards, in addition to stretching or compressing each image near its borders. The bottom row of Figure \ref{fig_frames} shows the images that were produced by nonlinearly transforming the corresponding recorded frames in the top row. These images simulate the output of a different sensor (e.g., a video camera, which was "wearing" goggles having inverting/distorting lenses). \begin{figure} \centering \subfloat[]{\includegraphics[width=0.35\textwidth]{fig_hOfHPrime_video.eps } \subfloat[]{\includegraphics[width=0.35\textwidth]{fig_vOfVPrime_video.eps } \caption{The nonlinear transformation between $(h,v)$, the coordinates of a pixel in each recorded image, and $(h',v')$, the coordinates of the corresponding pixel in the transformed image.} \label{fig_hVOfHPrimeVPrime} \end{figure} Because the video was recorded as the camera moved through a two-dimensional manifold of configurations, the resulting images were expected to form a two-dimensional manifold in which each frame was represented by a point. A coordinate system, $x$, was imposed on this manifold in the following manner. First, we computed six numbers consisting of the centroids of the R, G, and B components for each recorded image. Then, we did a principal components analysis of the collection of six-dimensional multiplets for all recorded video frames. This showed that these multiplets were in or close to a two-dimensional planar subspace, which contained $99\%$ of their variance. Because this subspace did not self-intersect, its points were invertibly related to the configurations of the camera. The $x$ coordinates of each image were taken to be the first two variance-normalized principal components of the corresponding multiplet. The same procedure was applied to the collection of transformed images in order to assign a two-component coordinate, $x'$, to each one. The thin black lines in Figure \ref{fig_xXPrimeOfT_video} show the measurement time series, $x(t)$, derived from the images recorded during a typical 17 s time interval. The thick gray lines in the same figure show the sensor measurements, $x'(t)$, derived from the sequence of transformed images during the same time interval. The $x(t)$ and $x'(t)$ time series can be considered to be the measurements that were produced by two observers who were watching the same physical system with different sensors (i.e., with an ordinary video camera and with a camera having distorting/inverting lenses, respectively). Alternatively, $x'(t)$ can be considered to be the measurements $x(t)$, after they have been transformed to another coordinate system ($x'$) on the two-dimensional manifold of images. \begin{figure} \centering \subfloat[]{\includegraphics[width=0.35\textwidth]{fig_xXPrimeOneOfT_video.eps } \subfloat[]{\includegraphics[width=0.35\textwidth]{fig_xXPrimeTwoOfT_video.eps } \caption{The thin black lines and the thick gray lines show the sensor measurements, $x(t)$ and $x'(t)$, derived from the sequences of untransformed and transformed images, respectively, during a 17 s time interval.} \label{fig_xXPrimeOfT_video} \end{figure} The 126,036 measurements, $x(t)$, derived from the sequence of untransformed images, were assigned to bins in a $4 \times 4$ array. Then, the procedure in Subsection \ref{derivation} was used to compute the local vectors in each bin ($V_{(i)}(x)$ for $i=1,2$). The same procedure was applied to measurements $x'(t)$, derived from the transformed images, in order to compute the local vectors, $V'_{(i)}(x')$. These local vectors are shown in the left and right panels of Figure \ref{fig_VOfXVPrimeOfXPrime_video}. \begin{figure} \centering \subfloat[]{\includegraphics[width=0.35\textwidth]{fig_VOfX_video.eps } \subfloat[]{\includegraphics[width=0.35\textwidth]{fig_VPrimeOfXPrime_video.eps } \caption{The thin black lines and the thick gray lines in the left panel show the local vectors, $V_{(1)}$ and $V_{(2)}$, respectively, derived from the sequence of untransformed images. The right panel shows the local vectors derived from the transformed images. The black points in each panel show the coordinates of a random sample of the measurements, $x(t)$ and $x'(t)$, derived from the recorded and transformed images, respectively.} \label{fig_VOfXVPrimeOfXPrime_video} \end{figure} The measurement time series, $x(t)$, and the corresponding local vectors, $V_{(i)}$, were substituted in (\ref{xDot rep}) in order to derive the inner time series, $w_{i}(t)$, corresponding to the sequence of untransformed images. Likewise, the measurement time series, $x'(t)$, and the corresponding local vectors, $V'_{(i)}$, were used to derive the inner time series, $w'_{i}(t)$, corresponding to the sequence of transformed images. The thin black lines and the thick gray lines in Figure \ref{fig_wWPrimeOfT_video} show the weights, $w_{i}(t)$ and $w'_{i}(t)$, respectively, during the time interval depicted in Figure \ref{fig_xXPrimeOfT_video}, after $w'_{i}(t)$ was multiplied by a global permutation and reflection. Notice that the inner time series are nearly the same, despite the fact that they were derived from the outputs of dramatically different sensors. In other words, the inner time series are sensor-independent, as proved in Subsection \ref{derivation}. These results loosely mimic the findings of the well-known psychophysical experiments (\cite{Held}) in which subjects, who wore inverting/distorting goggles, eventually learned to perceive the world as it was perceived before wearing the goggles. Similarly, Figure \ref{fig_wWPrimeOfT_video} shows that the observer, whose camera was ''wearing" goggles, perceived the inner properties of the image time series to be the same (thick gray lines) as they were perceived before wearing the goggles (thin black lines). \begin{figure} \centering \subfloat[]{\includegraphics[width=0.35\textwidth]{fig_wWPrimeOneOfT_video.eps } \subfloat[]{\includegraphics[width=0.35\textwidth]{fig_wWPrimeTwoOfT_video.eps } \caption{The thin black lines and the thick gray lines show the inner time series, $w_{i}(t)$ and $w'_{i}(t)$, derived from the sequences of untransformed and transformed images, respectively, during the 17 s time interval depicted in Figure \ref{fig_xXPrimeOfT_video}.} \label{fig_wWPrimeOfT_video} \end{figure} \subsection{Nonlinear mixtures of two audio waveforms} \label{two audio signals} In this subsection, the system consists of two speakers, whose utterances are statistically independent and are observed in two ways: 1) as a pair of unmixed signals, each one being one speaker's waveform; 2) as a pair of nonlinear mixtures of the unmixed signals. The unmixed and mixed pairs of signals simulate measurements made by two observers who were using different sensors. The procedure in Subsection \ref{derivation} was applied to derive the inner time series, corresponding to the unmixed and mixed signals. These inner time series are shown to be almost the same, thereby demonstrating their sensor independence. Furthermore, the time series of each weight component, derived from the signal mixtures, is almost the same as the time series of a weight component, derived from one of the unmixed signals. This demonstrates that the inner time series of a composite system is simply a collection of the inner time series of its statistically independent subsystems, as proved in Subsection \ref{composite systems}. The unmixed signals were excerpts from audio book recordings of two male speakers, who were reading different texts. The two audio waveforms, denoted $x_{k}(t)$ for $k=1,2$, were 31.25 s long and were sampled 16,000 times per second with two bytes of depth. Figure \ref{fig_xOfT_audio} shows the two speakers' waveforms during a short (31.25 ms) interval. These waveforms were then mixed by the nonlinear functions \begin{equation} \label{mixing} \begin{split} \mu_{1}(x) &= 0.763 x_1 + (958 - 0.0225 x_2)^{1.5} \\ \mu_{2}(x) &= 0.153 x_2 + (3.75 * 10^7-763 x_1 - 229 x_2)^{0.5} , \end{split} \end{equation} where $-2^{15} \leq s_1, s_2 \leq 2^{15}$. This is one of a variety of nonlinear transformations that were tried with similar results. The mixed measurements, $x'_{k}(t)$, were taken to be the variance-normalized, principal components of the waveform mixtures, $\mu_{k}[x(t)]$. Figure \ref{fig_warpedGrid_audio} shows how this nonlinear mixing function mapped an evenly-spaced Cartesian grid in the $x$ coordinate system onto a warped grid in the $x'$ coordinate system. Notice that the mapped grid does not ''fold over" onto itself, showing that it is an invertible mapping. The lines in Figure \ref{fig_xPrimeOfT_audio} show the time course of $x'(t)$. When either waveform mixture ($x'_{1}(t)$ or $x'_{2}(t)$) was played as an audio file, it sounded like a confusing superposition of two voices, which were quite difficult to understand. \begin{figure} \centering \subfloat[]{\includegraphics[width=0.35\textwidth]{fig_xOneOfT_audio.eps } \subfloat[]{\includegraphics[width=0.35\textwidth]{fig_xTwoOfT_audio.eps } \caption{The unmixed audio waveforms of the two speakers during a 31.25 ms time interval.} \label{fig_xOfT_audio} \end{figure} \begin{figure} \centering \subfloat{\includegraphics[width=0.35\textwidth]{fig_warpedGrid_audio.eps } \caption{A warped grid in the $x'$ coordinate system, obtained by applying the nonlinear mixing function in (\ref{mixing}) to a regular Cartesian grid in the $x$ coordinate system.} \label{fig_warpedGrid_audio} \end{figure} \begin{figure} \centering \subfloat[]{\includegraphics[width=0.35\textwidth]{fig_xPrimeOneOfT_audio.eps } \subfloat[]{\includegraphics[width=0.35\textwidth]{fig_xPrimeTwoOfT_audio.eps } \caption{The mixed audio waveforms of the two speakers, obtained by applying the nonlinear mixing function in (\ref{mixing}) to the unmixed waveforms in Figure \ref{fig_xOfT_audio}.} \label{fig_xPrimeOfT_audio} \end{figure} The method in Section \ref{method} was then applied to these data as follows: \begin{enumerate} \item The 500,000 measurements of the first unmixed waveform, consisting of $x_1$ and $\dot{x}_1$ at each sampled time, were sorted into an array of 16 bins in $x_1 \mbox{-space}$. Then, the $\dot{x}$ distribution in each bin was used to compute local velocity correlations, and these were used to derive the one-component local vector, $V_{(1)}(x_1)$, in each bin in $x_1 \mbox{-space}$. The left panel of figure \ref{fig_VVPrimeOFXXPrime_audio} shows these local vectors at each point. These vectors and the $\dot{x}_1$ time series were substituted in (\ref{xDot rep}) in order to compute the inner time series, $w_{1}(t)$, for the first unmixed waveform, The result is shown by the thin black line in the left panel of Figure \ref{fig_wWPrimeOfT_audio}. \item The same procedure was applied to the second unmixed waveform in order to compute its inner time series, $w_{2}(t)$. The result is shown by the thin black line in the right panel of Figure \ref{fig_wWPrimeOfT_audio}. \item The 500000 samples of the mixed waveform, $x'(t)$, were sorted into a $16 \times 16$ array of bins in $x' \mbox{-space}$, and the distribution of velocities, $\dot{x'}$, in each bin was used to compute the local vectors, $V'_{(i)}(x')$, at each point. These are shown in the right panel of Figure \ref{fig_VVPrimeOFXXPrime_audio}. These vectors and the velocity time series, $\dot{x}'(t)$, were substituted in (\ref{xDot rep}) to compute the inner time series, $w'_{i}(t)$, of the mixed waveforms. These are depicted by the thick gray lines in Figure \ref{fig_wWPrimeOfT_audio}, after they had been multiplied by an overall permutation/reflection matrix. \end{enumerate} \begin{figure} \centering \subfloat[]{\includegraphics[width=0.25\textwidth]{fig_VOneOfXOne_audio.eps } \subfloat[]{\includegraphics[width=0.25\textwidth]{fig_VTwoOfXTwo_audio.eps } \subfloat[]{\includegraphics[width=0.25\textwidth]{fig_VPrimeOfXPrime_audio.eps } \caption{The left and middle panels show the one-component local vectors derived from the unmixed waveforms, $x_{1}(t)$ and $x_{2}(t)$, excerpts of which are illustrated in Figure \ref{fig_xOfT_audio}. The line segments in the right panel show the local vectors derived from the mixed waveforms, $x'(t)$, excerpts of which are illustrated in Figure \ref{fig_xPrimeOfT_audio}. These line segments have been uniformly rescaled for the purpose of display. The small black points in the right panel show the distribution of randomly chosen samples of the mixed waveforms, $x'(t)$.} \label{fig_VVPrimeOFXXPrime_audio} \end{figure} \begin{figure} \centering \subfloat[]{\includegraphics[width=0.35\textwidth]{fig_wWPrimeOneOfT_audio.eps } \subfloat[]{\includegraphics[width=0.35\textwidth]{fig_wWPrimeTwoOfT_audio.eps } \caption{The thin black lines and the thick gray lines show the inner time series, $w_{i}(t)$ and $w'_{i}(t)$, derived from the unmixed and mixed waveforms, respectively, during the 31.25 ms time interval depicted in Figure \ref{fig_xOfT_audio} and \ref{fig_xPrimeOfT_audio}.} \label{fig_wWPrimeOfT_audio} \end{figure} It is evident that the unmixed and mixed waveforms have inner time series that are almost the same. This demonstrates that an inner time series is not affected by transformations of the measurement time series. In other words, the inner time series encodes sensor-independent information. When each inner time series was played as an audio file, it sounded like a completely intelligible recording of one of the speakers. In each case, the other speaker was not heard, except for a faint buzzing sound in the background. Thus, each inner time series contained all of the semantic information in the unmixed waveform. Notice that this composite system has an inner time series, $w'_{i}(t)$, which is equal to the collection of the inner time series of its statistically independent subsystems, $w_{1}(t)$ and $w_{2}(t)$. This demonstrates the separability property of the inner time series of a composite system, which was proved in Subsection \ref{composite systems}. Also, notice that the correlation between the time series, $w'_{1}(t)$ and $w'_{2}(t)$, is quite low (-0.0016). As discussed in Subsection \ref{composite systems}, this is expected because these are inner time series of two statistically independent subsystems. \section{Conclusion} \label{conclusion} This paper describes how a time series of sensor measurements can be processed in order to create an inner time series, which is unaffected by the nature of the sensors. Specifically, if a system is observed by two sets of sensors, each set of measurements will lead to the same inner time series if the two sets of measurements are related by any instantaneous, invertible, differentiable transformation. In effect, an inner time series encodes information about the intrinsic nature of the observed system's evolution, without depending on extrinsic factors, such as the observer's choice of sensors. An inner time series is created by statistically processing the local distributions of measurement velocities in order to derive vectors at each point in measurement space. The system's velocity can then be described as a weighted superposition of the local vectors at each point. These time-dependent weights comprise the inner time series. Because they are independent of the coordinate system in measurement space, they represent sensor-independent information about the system's velocity in state space. The inner time series may be useful in certain practical applications. For instance, it may be used to reduce false negatives in the detection of events of interest. To see this, imagine that the objective is to detect certain ''targeted" movements of a system as it moves through state space, and suppose that this is being done by using a pattern recognition technique to monitor the output of sensors that are observing the system. If the pattern recognition software is trained on the output of calibrated sensors, subsequent sensor drift will cause false negatives to occur. This can be avoided if the pattern recognition algorithm is trained on the inner time series, instead of the time series of raw measurements. As long as the local vectors are computed from recent data from the drifted sensors, the inner time series will be unaffected by sensor drift, and this procedure will sensitively detect the targeted movements. However, it should be noted that this procedure may be accompanied by some false positives. This is because a given inner time series corresponds to multiple measurement time series, which describe trajectories in different regions of the measurement space, as mentioned in Subsection \ref{derivation}. As an example, consider the output of the moving camera in Subsection \ref{video signal}, and suppose that our objective is to detect camera movements that produce the sensor output shown by the thin black lines in Figure \ref{fig_xXPrimeOfT_video}. Imagine that a pattern recognition algorithm is trained to detect this particular trajectory segment. However, suppose that the camera's lens subsequently ''drifts" so that the targeted camera movements produce the signal shown by the thick gray line in Figure \ref{fig_xXPrimeOfT_video}. In that case, the drifted data will not be recognized, and false negatives will occur. Now, suppose that the pattern recognition software was trained to recognize the inner time series (Figure \ref{fig_wWPrimeOfT_video}) corresponding to the targeted camera movements. Then, sensor drift will not cause false negatives, as long as the time series to be recognized is processed with local vectors, computed from recently acquired data from the drifted sensors. As described in Subsection \ref{composite systems}, an inner time series has another attractive property, in addition to its sensor independence. Namely, it automatically provides a separable description of the evolution of a system that is composite in the sense of (\ref{phase space factorization}). To see this, consider the sensors, which observe such a composite system. They may be sensitive to the movements of many subsystems, causing the raw sensor outputs to be unknown, possibly nonlinear, mixtures of many subsystem state variables. Now, suppose that we compute the time series of multi-component weights derived from such mixture measurements. As proved in Subsection \ref{composite systems}, each component of the inner time series of the composite system is the same as a component of the inner time series of one of its subsystems. In other words, the inner time series of a composite system can be partitioned into groups of components, with each group being equal to the inner time series that would have been derived from a subsystem, if it were possible to observe it alone. Because of this separability property, the inner time series may be useful for detecting a targeted movement of one particular subsystem, in the presence of other independent subsystems. In particular, a pattern recognition procedure can be trained to determine if the components of the inner time series of the targeted movement can be found among the components of the inner time series derived from the mixed measurements of the entire system. An advantage of this procedure is that it is not necessary to use blind source separation (\cite{Comon Jutten}, \cite{Jutten}, \cite{Almeida}, \cite{Levin arXiv}, \cite{Levin LVA-ICA}) to disentangle the measurement time series into its independent components. On the other hand, false positive detections can complicate any such attempt to recognize a targeted signal by its inner time series (instead of its time series of sensor measurements). These errors may occur because multiple different measurement time series may have the same inner time series, as described in Subsection \ref{derivation}. As an illustrative example, consider the system comprised of two independent audio signals, described in Subsection \ref{two audio signals}, and imagine that our objective is to detect an utterance of the first speaker (left panel of Figure \ref{fig_xOfT_audio}), in the presence of the second speaker (right panel of Figure \ref{fig_xOfT_audio}). It is difficult to determine if this targeted signal is present in the mixtures that are actually measured (Figure \ref{fig_xPrimeOfT_audio}). However, notice that the inner time series of the movement of interest, derived from the unmixed waveforms of a subsystem (the thin black lines in Figure \ref{fig_wWPrimeOfT_audio}), is almost the same as one of the inner time series components, derived from the mixed signals of the composite system (thick gray lines in Figure \ref{fig_wWPrimeOfT_audio}). Therefore, a pattern recognition procedure, which is trained on the inner time series of the unmixed signal, is likely to recognize the targeted signal, even in the presence of signals from other subsystems. Some comments on these results: \begin{enumerate} \item As stated in Section \ref{introduction}, we have assumed that the sensors produce measurements that are invertibly related to the state variables of the underlying system. This invertibility property can almost be guaranteed by observing the system with a sufficiently large number of independent sensors: specifically, by utilizing at least $2N+1$ independent sensors, where $N$ is the dimension of the system's state space. In this case, the sensors' output lies in an $N \mbox{-dimensional}$ subspace embedded within a space of at least $2N+1$ dimensions. Because an embedding theorem asserts that this subspace is very unlikely to self-intersect (\cite{Sauer}), the points in this subspace are almost certainly invertibly related to the system's state space. Then, dimensional reduction techniques (e.g., \cite{Roweis}) can be used to find the subspace coordinates ($x$) that are invertibly related to the state space points, as desired. An example was presented in Subsection \ref{video signal}. There, the camera configurations formed a two-dimensional subspace, embedded in a six-dimensional space of raw sensor measurements. This subspace was very unlikely to self-intersect, given that $6 > 2N+1 = 5$. Then, principal components analysis was used to dimensionally reduce the description of each subspace point from six-dimensional coordinates to two-dimensional coordinates ($x$). \item An inner time series contains information that is intrinsic to the evolution of the observed system, in the sense that it is independent of extrinsic factors, such as the type of sensors used to observe the system. In other words, an inner time series contains information about what is happening ''out there in the real world", independent of how the observer chooses to describe it or experience it. Mathematically speaking, an inner time series is a coordinate-system-independent property of the measurement time series; i.e., its values are the same no matter what measurement coordinate system is used on the system's state space. The local vectors ($V_{(i)}$) also represent a kind of intrinsic structure on state space. These vectors ''mark" state space in a way that is analogous to directional arrows, which mark a physical surface and which can be used as navigational aids, no matter what coordinate system is being used. \item It is interesting to speculate about the role of inner time series in speech perception. By definition, two people, who understand the same language, tend to perceive the same semantic content of an utterance in that language. Remarkably, this \textit{listener-independence} occurs despite the fact that the listeners may be using significantly different sensors to make measurements of that utterance (e.g., different outer, middle, and inner ears; different cochleas; different neural architectures of the acoustic cortex). This sensor-independence of speech perception suggests that the semantic content of speech may be an inner property; i.e., it may be encoded in the inner time series of speech ($w_{i}(t)$). Specifically, assume that the two listeners have past exposure to statistically similar collections of speech-like sounds. Then, they will perceive the speech-sound manifold to be ``marked" by the same local vectors ($V_{(i)}(x)$), even though they may represent those vectors in different coordinate systems on the speech-sound manifold. Therefore, when the two listeners use (\ref{xDot rep}) to decode an utterance, they will derive the same inner time series, and they will perceive the same semantic content. \item It is equally remarkable that speech perception is largely \textit{speaker-independent}. Namely, a single listener will instantly recognize that two speakers are uttering the same text. This is true despite the fact that the two sounds were produced by significantly different vocal tracts and may have traversed different regions of the speech-sound manifold. This speaker-independence will occur as long as long as each speaker and the listener have past exposure to statistically similar collections of speech sounds. In that case, because of the above-mentioned listener-independence, each speaker and the listener will derive the same inner time series when they listen to the speaker's utterance. Therefore, if the two speakers have encoded the same semantic content (i.e., the same inner time series) in their utterances, the listener will immediately perceive that they are saying the same thing. Notice that two speakers' utterances, which have the same semantic content, may correspond to two different speech-sound trajectories, which have the same inner time series. Thus, in this speculative scenario, the fact that the same inner time series may be encoded in many measurement time series (see the discussion following (\ref{x rep})) corresponds to the fact that the same semantic content can be expressed by many different voices. \end{enumerate} \bibliographystyle{IEEEtran}
{'timestamp': '2017-03-28T02:01:58', 'yymm': '1703', 'arxiv_id': '1703.08596', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08596'}
arxiv
\section{Introduction} \label{section:Introduction} Evolutionary algorithms mimic real life evolution to develop solutions to difficult problems. Such algorithms allow teams of agents to develop complex, specialized behavior in evolutionary robotics, video games, and other agent-based simulations. Past research has studied the effects of selection pressures \cite{waibel:ieeetec09}, coevolution \cite{rawal:cig10,yong:ieeetamd10}, modular neural networks \cite{schrum:tciaig12,schrum:tciaig16}, and multiple objectives \cite{schrum:aiide08,vanhoorn:cig2009} in the evolution of complex agent behavior, but none of this research studies all at once. This paper explores how these concepts work in tandem. Various combinations of different types of selection (using multiple objectives) and different numbers of network output modules show how these components interact in the evolution of cooperative behavior. The concept of selection pressures in this research stems from prior research focusing on the rewarding of individual vs.\ team behavior \cite{waibel:ieeetec09}. For instance, if agents were part of a basketball team and their goal was to score as many points as possible, individual selection would reward each individual player based on the number of points that the individual scored, while team selection would reward each individual player based on the number of points that the entire team scored. So if the whole team performed poorly, but the individual player being assessed performed comparatively well, individual selection would grant that player higher fitness, while team selection would grant lower fitness. Multiple objectives are applied with the use of Pareto-based multiobjective optimization \cite{deb:tec02}. This framework allows both individual and team fitness functions to be used, thus going beyond the simple either/or comparison explored previously \cite{waibel:ieeetec09}. One goal of this research is to compare and contrast the effects of various types of selective pressures (individual, team, and both). Studying the effects of modular networks is another goal. Networks with multiple output modules can more easily generate multimodal behavior \cite{schrum:tciaig12, schrum:tciaig16}. Such modules can also make up for bad sensors \cite{schrum:tciaig16}, and similarly, this paper shows that these modules can also make up for bad fitness functions, allowing success for a team of agents even with less effective selection pressures. This research utilizes cooperative coevolution, with separate and distinct sub-populations for each of the evolved agents. The sub-populations are evolved together, allowing them to develop specialized teamwork behaviors. This is in contrast to past research \cite{schrum:tciaig12}, which used multimodal networks with homogeneous teams. The next Section (\ref{section:Background}) describes related work and some background information that is relevant to this research. Section \ref{subsection:predPrey} describes the specifics of the predator/prey domain used. Section \ref{section:Evolution} describes the components of the evolutionary algorithm used. Section \ref{section:ExperimentalSetup} describes the experimental setup, while Section \ref{section:Results} provides and analyzes the results of the experiments. Section \ref{section:Discussion} discusses interesting discoveries as well as some ideas for future experiments. Finally, Section \ref{section:Conclusion} summarizes and concludes. \section{Background} \label{section:Background} This research tests the effects of different selective pressures, multiple objectives, and modular networks on cooperatively coevolved agent behavior in a predator/prey domain. Each of these individual components has been studied in domains requiring intelligent agent behavior before, but they have not all been combined in one study. Some of the most relevant past research explored the connections between the evolution of team work, different types of team composition, and different types of selection pressures \cite{floreano:altruisticrobots2008,waibel:ieeetec09}. Specifically the effects of individual vs.\ team selection were explored using heterogeneous and homogeneous teams. One major finding was that heterogeneous teams performed poorly in cooperative tasks, but did better with individual selection. However, only single-objective evolution was used in these experiments, and teams were selected from a single population rather than separate isolated populations. Both of these distinctions have a meaningful impact in this paper. Many domains have multiple objectives, so it is natural to apply Pareto-based evolutionary methods \cite{deb:tec02}. However, it is still common to use single objectives instead, even if this means creating a complicated fitness function that takes various different components into account \cite{rawal:cig10,rajagopalan:cig11}. However, most team tasks have objectives that measure individual performance as well as objectives that measure team performance, which begs the question of which combination of such objectives will lead to the best results. Although the merits of individual vs.\ team selection with multiple objectives have not been directly studied before, researchers are increasingly applying multiobjective approaches to the kind of agent-based domain (mostly video games) that this paper focuses on~\cite{schrum:aiide08,vanhoorn:cig2009,schrum:tciaig12, schrum:tciaig16}. Some of this work has also focused on how to develop multimodal agent behavior using both multiple objectives and modular neural network controllers \cite{schrum:tciaig12, schrum:tciaig16}. There are many different concepts of modularity that are relevant to the evolution of neural networks \cite{clune:royal2013,kashtan:nasusa2005,verbancsics:gecco2011,schrum:tciaig16}. This research utilizes networks with explicit output modules that can be selected by an agent on each time step. This technique has been applied in situations similar to the predator/prey domain used in this paper (Section~\ref{subsection:predPrey}): teams of homogeneous agents were evolved to alternately attack/flee a scripted vulnerable/threatening opponent in a domain called Fight or Flight \cite{schrum:tciaig12}, as were skilled Ms.\ Pac-Man controllers that could both catch edible ghosts and flee threatening ghosts \cite{schrum:tciaig16}. The need for multimodal behavior in these domains came from the need to handle different dynamics when enemy agents switched roles (attack vs.\ flee and catch vs.\ flee). In the predator/prey domain of this paper, the need for multimodal behavior emerges from the tension between selfish and cooperative actions, which may be promoted in different ways by different types of fitness functions. Because this paper coevolves separate sub-populations that contribute members to a single cooperating team, it is possible for the available fitness functions to influence each sub-population differently. Therefore, the teams in this paper are heterogeneous, in contrast to those from the Fight or Flight study \cite{schrum:tciaig12}. However, the previously mentioned research indicating that heterogeneous teams from a single population perform poorly in cooperative tasks \cite{floreano:altruisticrobots2008,waibel:ieeetec09} does not apply to these teams, because selecting individual team members from specific sub-populations allows them to specialize in a way that actually promotes cooperation \cite{gomez:ab97,potter:ec2000,Nitschke:2012,Nitschke:2013}. Such cooperation is necessary for a team of evolved predator agents to capture fleeing prey agents in the domain described next. \section{Predator/Prey Domain} \label{subsection:predPrey} Predator/prey scenarios have been used by researchers in many ways \cite{gomez:ab97,rawal:cig10,tan:icml93,Haynes1996,yong:ieeetamd10}. A survey by Stone and Veloso \cite{stone:MASsurvey} describes many variants of the simple predator/prey domain. Additionally, there are more complex domains that are essentially extensions of the predator/prey dynamic, such as the previously mentioned Fight or Flight domain \cite{schrum:tciaig12} and Ms.\ Pac-Man \cite{schrum:tciaig16}. However, even in a basic predator/prey domain, agents must exhibit intelligent cooperative behavior to succeed. The predator/prey domain of this paper is a torus-shaped grid world comprised of three predator agents attempting to catch two prey agents. The torus shape allows agents to wrap around from one edge of the world to the opposite edge. This design allows for infinite movement within a finite space. Consequently, even though the grid world has a fixed size the agents are always allowed to move in any direction. This makes catching the prey a difficult task for predator agents, as prey cannot be cornered or walled in. Distance in the grid world is measured by Manhattan Distance. The grid world itself consists of a 100 by 100 space square grid where agents each occupy a space; thus, the maximum horizontal or vertical distance from one agent to another is 50, and the maximum diagonal distance is 100. Agents can be located in the same space simultaneously, and if this is the case for a predator and a prey agent then the predator has caught the prey and the prey disappears. The domain also has a time limit of 1,000 time steps, where one time step is a single action for all agents (all actions happen simultaneously). The available actions are up, down, left, and right movements, as well as a null action (staying still). Each predator wants to maximize the number of prey it catches, but rewarding only this result will not be successful against competent prey. Therefore, use of other shaping objectives is common. The objectives in this paper are loosely based on Rawal et al.~\cite{rawal:cig10}, except that the complicated single objective from that work was split into simple components for multiobjective optimization. Predators must work together in order to herd and capture prey. Selfishly chasing the prey generally leads to all agents going in circles around the torus. The success of the individual at least partially relies on the success of the team and the development of complex specialization. Predators develop jobs as valuable members of the team. Some common roles that emerge in successful teams are \emph{blocker}, \emph{herder}, and \emph{aggressor}. The blockers do not move very much but just align themselves at a distance with the side to side movement of the more aggressive predators so that they can force the prey to run toward the blocker. The herders work to keep the prey in front of the aggressors by running parallel to the prey's direction of movement, so that is does not slip by to one side. The job of the aggressor is to simply close the gap on the prey as quickly as it can. Though simple to describe, success in this domain is not trivial, which is why it has been widely studied by so many researchers. Therefore, sufficiently sophisticated methods are needed to evolve agents worth studying for this domain. The evolutionary methods used in this paper are described next. \section{Evolutionary Algorithm} \label{section:Evolution} Predator agents were evolved using Modular Multiobjective Neuro-Evolution of Augmenting Topologies (MM-NEAT \cite{schrum:tciaig16}), which combines the multiobjetive evolutionary algorithm Non-Dominated Sorting Genetic Algorithm-II (NSGA-II \cite{deb:tec02}) and standard NEAT \cite{stanley:ec02}. MM-NEAT also allows for the evolution of networks with multiple output modules. MM-NEAT has been extended in this paper to support cooperative coevolution of separate sub-populations. \subsection{Multiobjective Evolution} \label{subsection:nsgaII} When evolving intelligent agents, researchers typically use a single objective, but the objective is often complex and consists of several components. It is simpler and generally more effective to specify multiple objectives. Pareto-based multiobjective optimization provides a principled way of using multiple objectives that can discover trade-offs between objectives that are not attainable by the common alternative of using a weighted sum. Even in comparison with single objectives that are not weighted sums \cite{rawal:cig10}, the Pareto-based approach makes objectives easier to define, and can also help evolution avoid local optima \cite{knowles:emo01}. This approach depends on the concepts of Pareto Dominance and Pareto Optimality: \noindent {\bf Pareto Dominance:} Assuming a maximization problem, vector $\vec{v}=(v_{1},\ldots,v_{n})$ dominates vector $\vec{u}=(u_{1},\ldots,u_{n})$ iff 1.\ $\forall i \in \{1, \ldots, n\}: v_{i} \geq u_{i}$, and 2.\ $\exists i \in \{1, \ldots, n\}: v_{i} > u_{i}$. \noindent Each vector is a collection of objective scores that an agent received during evaluation. \noindent {\bf Pareto Optimality:} A set of points $\mathcal{A}\subseteq\mathcal{F}$ is Pareto optimal iff it contains all points such that $\forall \vec{x} \in \mathcal{A}$: $\neg\exists \vec{y} \in \mathcal{F}$ such that $\vec{y}$ dominates $\vec{x}$. The points in $\mathcal{A}$ are non-dominated, and make up the non-dominated Pareto front of $\mathcal{F}$. The above definitions indicate that one agent is better than (i.e. dominates) another agent if it is strictly better in at least one objective and no worse in the others. The best agents are not dominated by any other agents, and make up the Pareto front of the search space. The next best individuals are those that would be in a recalculated Pareto front if the actual Pareto front were removed first. Layers of Pareto fronts can be defined by successively removing the front and recalculating it for the remaining individuals. Solving a multiobjective optimization problem involves approximating the first Pareto front as well as possible. The multiobjective optimization algorithm used in this work is Non-Dominated Sorting Genetic Algorithm-II (NSGA-II \cite{deb:tec02}) which uses ($\mu + \lambda$) elitist selection favoring individuals in higher Pareto fronts (i.e. closer to the true Pareto front) over those in lower fronts. In the ($\mu + \lambda$) paradigm, a parent population of size $\mu$ is evaluated, and then used to produce a child population of size $\lambda$. Selection is performed on the combined parent and child population to give rise to a new parent population of size $\mu$. NSGA-II typically uses $\mu = \lambda$. When performing selection based on which Pareto layer an individual occupies, a cutoff is often reached such that the layer under consideration holds more individuals than there are remaining slots in the next parent population. These slots are filled by selecting individuals from the current layer based on a metric called \emph{crowding distance}, which encourages the selection of individuals in less-explored areas of the trade-off surface between objectives. By combining the notions of non-dominance and crowding distance, a total ordering of the population is obtained: individuals in different layers are sorted based on the dominance criteria, and individuals in the same layer are sorted based on crowding distance. The resulting comparison operator for this total ordering is also used by NSGA-II: Child populations are derived from parent populations via binary tournament selection based on this comparison operator. Applying NSGA-II to a problem results in an approximation to the true Pareto front. This approximation set potentially contains multiple solutions, which must be analyzed in order to determine which solutions fulfill the needs of the user. In this paper, the primary objective of interest is the number of prey captured. However, NSGA-II is indifferent as to how solutions are represented. In this paper, NSGA-II was used to evolve artificial neural networks to control the predators. The process of evolving these networks is called neuroevolution. \subsection{Neuroevolution} \label{subsection:NEAT} Neuroevolution is the use of evolutionary algorithms to evolve artificial neural networks \cite{floreano2008neuroevolution}. The evolved networks can be used to control agents in sequential decision making tasks by feeding in sensory input on every time step and interpreting the output for each time step as an action. This approach has been useful in many domains \cite{vanhoorn:cig2009, schrum:tciaig16,waibel:ieeetec09,gomez:ab97,Verbancsics:gecco11,huizinga:gecco2016} The specific algorithm used in this work is a variant of Neuro-Evolution of Augmenting Topologies (NEAT \cite{stanley:ec02}) known as Modular Multiobjective NEAT (MM-NEAT \cite{schrum:tciaig16}). MM-NEAT combines the selection mechanism of NSGA-II with the network representation of NEAT, and adds additional features discussed in Section \ref{subsection:MM}. NEAT evolves artificial neural networks with arbitrary topologies. The networks begin with empty hidden layers and fully connected inputs and outputs, then evolution adds hidden neurons and new (potentially recurrent) links gradually via mutation in a process known as \emph{complexification}. Mutations can also change the weights of existing links. Furthermore, every new link and neuron introduced by mutation is given a unique innovation number to identify it. The genotype that encodes each neural network stores these innovations linearly in a consistent order across all members of the population. NEAT can perform efficient topological crossover by aligning genotypes based on these innovation numbers. Standard NEAT has been used to solve many challenging problems, but the resulting networks only define single control policies. The next section describes how MM-NEAT allows networks to have multiple policies, encouraging multimodal behavior. \subsection{Modular Networks} \label{subsection:MM} Some of the networks in this paper can have multiple output modules. Each such module defines a different control policy. Arbitration between modules is discovered using special preference neurons that allow evolution to discover how to use the modules. An output module is a collection of all output neurons needed to define the agent's behavior. These neurons are called \emph{policy neurons}. Each module also has one \emph{preference neuron}. Each module's preference neuron outputs the network's relative preference for using that module. Whenever inputs are presented to the network, the module whose preference neuron output is the highest is used to define the output of the network. For example, the domain of this work requires 5 outputs to designate the behavior of an agent. Let us assume a given network has 2 modules. Then the network has 12 outputs: 5 policy neurons and 1 preference neuron for Module 1, and 5 policy neurons and 1 preference neuron for Module 2. Whenever the output of Preference Neuron 1 is higher than the output of Preference Neuron 2, the 5 policy neurons of Module 1 define the behavior of the agent. Otherwise, the policy neurons of Module 2 are used. It is important for evolution to have the freedom to discover its own task division in the predator/prey domain due to the complex relationship between catching prey and closing in on the prey, and finding the right balance between the two. This means that an agent can have one specialized job as a part of the team at one time, and it can have completely different specialization at another time, and the system develops these behavioral responses situationally. Support for preference neuron networks is one of the major innovations of MM-NEAT, but previous work with MM-NEAT only ever evolved a single population. MM-NEAT is extended in this work to support cooperative coevolution of multiple sub-populations as described next. \subsection{Cooperative Coevolution} \label{subsection:coevolution} Coevolution is when the fitness of agents depends on other evolved agents. There are several models of coevolution, but the one used in this paper is cooperative coevolution with distinct sub-populations \cite{potter:ec2000, gomez:ab97}. Specifically, each team of agents is created by taking each team member from a separate sub-population, which makes it easier for specific team members to specialize into specific roles \cite{Campbell2011}. The coevolutionary process groups each genotype with random genotypes from the other populations to form different randomized teams. Having each genotype participate in several randomized teams addresses the structural credit-assignment problem \cite{agogino:aamas04} and ensures a more reliable evaluation of each individual. The structural credit-assignment problem arises when the success of a team could be the result of improved individual behavior or improved team behavior, and it is difficult to ascertain the source of the success. Consequently, it is uncertain how to best reward any particular individual vs.\ the entire team for the outcome. Having all individuals participate in multiple random teams means that individual's performance can be assessed more accurately. So, a bad agent is less likely to profit from getting lucky by being randomly placed with a good team and achieving good scores since this is unlikely to happen repeatedly. Noisy evaluations are also relevant to this research, partly because the starting locations of agents are randomized. It is therefore even more important that each genotype be evaluated multiple times to assure reliable results. \section{Experimental Setup} Predators are evolved against scripted prey agents using several combinations of individual and team fitness functions, and numbers of output modules. The input sensors for the predators and most parameter settings remain constant across experimental runs. These details are discussed below. \label{section:ExperimentalSetup} \subsection{Agent Behavior} \label{subsection:agent behavior} Predators were allowed to do nothing (as an action) in addition to the four movement actions (up, down, left, right), but prey were restricted to the four movement actions. Predators could better act as the blocker when they did not have to learn to jump back and forth between the same location and could instead just stand still. This design decision is in line with previous work~\cite{rawal:cig10}. Predators act in accordance with their controlling neural networks. In contrast, prey controllers are hard-coded to flee the nearest predator. These controllers first find which predator is the closest in terms of Manhattan Distance, then they calculate which of the four actions would result in the prey being the farthest possible distance from the current closest predator. The controller breaks ties randomly (another source of evaluation noise). So, if there are predators who tie as the closest in distance, the chosen predator is randomized among the set of the tying closest predators. Additionally, if multiple available movement locations are equally distant from the closest predator, then the specific movement is randomly chosen. The static controller for the prey was simple to implement, but difficult for predators to learn to capture. Therefore, effective fitness functions are needed in order for the predators to succeed. \subsection{Fitness Functions} \label{subsection:fitness} The goal of the predator teams is to maximize the number of prey captured across all evaluations, which means consistently capturing both prey within the time limit of each evaluation. However, because the scripted prey behavior is fairly challenging (Section \ref{subsection:agent behavior}), predator agents evolved using only an objective that takes captures into account will not have a fitness gradient to follow when they fail to catch any prey, which is likely in the early stages of evolution when neural network genotypes are both simple and random. Therefore, predators need at least some reward for \emph{almost} capturing a prey agent. Such shaping can be accomplished with a distance fitness function, based on minimizing the final Manhattan Distances between predators and prey. Such concerns have influenced \emph{components} of a single-objective fitness functions used by others \cite{rawal:cig10,yong:ieeetamd10}. This paper splits these types of objectives up into separate fitness functions, and also establishes individual and team versions of these objectives to evaluate a variety of different types of selection pressures. Predators can be evaluated by how many prey they personally catch, or the number the team catches. They can also be evaluated based on how close they are to prey when an evaluation ends, or by how close all predators are to the prey. Finally, multiobjective optimization makes it easy to combine all of these objectives as well. Using only individual fitness functions applies different types of selective pressures than using only team fitness functions. Team fitness functions would seem more likely to promote team behavior, but perhaps some degree of selfish individual selection can actually lead to better overall group behavior. The concept of group selection is quite controversial in the realm of naturalistic evolution \cite{leigh:jeb2010}, but in a computer simulation it is straight-forward to test the effectiveness of such an approach without any concern as to its biological plausibility. Lastly, combining both types of selection seems as though it would be likely to provide the benefits of both. However, multiobjective optimization methods like NSGA-II are known to struggle when the number of objectives grows, since a higher-dimensional space is more likely to contain non-dominated points, making it difficult to make meaningful distinctions between candidate solutions. It is thus not obvious which scheme will be most effective in evolving effective behavior in the predator/prey domain. The specific fitness functions used are defined as follows. First recall that each evaluation contains three predators and two prey. Then define $c_{i,j}$ to be $1$ if predator $i$ caught prey $j$ within the time limit, and $0$ otherwise. Also, define $d_{i,j}$ to be the final Manhattan Distance from predator $i$ to prey $j$, or $0$ if prey $j$ was ever caught by any predator. These definitions are used to define the fitness functions used in this paper. The IndCatch objective defines how many prey are caught by a particular predator. Note that it is technically possible for two predators to catch the same prey simultaneously. For predator $i$, \begin{equation} \text{IndCatch}(i) = c_{i,0} + c_{i,1} \label{eqn:IndCatch} \end{equation} A single objective, called TeamCatch, is also defined for the whole team to indicate how many prey were caught by predators overall. \begin{equation} \text{TeamCatch} = \sum_{j=0}^{1} \max_{i \in \{0,1,2\}} c_{i,j} \label{eqn:TeamCatch} \end{equation} The IndDist objective is defined for each combination of one predator and one prey. If a predator cannot catch a prey, it should at least decrease its distance from that prey by the end of the evaluation. The best possible score in this objective is zero, indicating that the prey was eaten. Specifically, for predator $i$ with respect to prey $j$, \begin{equation} \text{IndDist}(i,j) = -d_{i,j} \label{eqn:IndDist} \end{equation} The team equivalent of this objective is TeamDist, which is actually a set of objectives defined for each prey agent. The objective measures the average distance of all predators from one prey agent. Specifically, for prey $j$, \begin{equation} \text{TeamDist}(j) = - \frac{ \sum_{i=0}^{2} d_{i,j} }{3} \label{eqn:TeamDist} \end{equation} These individual fitness functions were combined in three ways summarized in Table~\ref{tab:fitnesses}. The three specific groups of fitness functions used focus either entirely on individual selection, entirely on team selection, or on both: \begin{enumerate} \item Individual: There are three total fitness functions. For the population corresponding to predator $i$, the fitness functions used are $\text{IndCatch}(i)$, $\text{IndDist}(i,0)$, and $\text{IndDist}(i,1)$. \item Team: There are three total fitness functions. Each population uses the same fitness functions: $\text{TeamCatch}$, $\text{TeamDist}(0)$, and $\text{TeamDist}(1)$. \item Both: There are six total fitness functions. For the population corresponding to predator $i$, the fitness functions used are $\text{IndCatch}(i)$, $\text{IndDist}(i,0)$, $\text{IndDist}(i,1)$, $\text{TeamCatch}$, $\text{TeamDist}(0)$, and $\text{TeamDist}(1)$. Note that the final three of these do not actually depend on $i$. \end{enumerate} \setlength\tabcolsep{1.5pt} \begin{table}[tb] \caption{\small \label{tab:fitnesses} {\bf Objectives For Each Sub-population}} \begin{small} \begin{tabular}{| l || l | l | l | l |} \hline & IndCatch & IndDist & TeamCatch & TeamDist \\ \hline \hline Individual Selection & {\tt 1} & {\tt 2} & {\tt 0} & {\tt 0} \\ \hline Team Selection & {\tt 0} & {\tt 0} & {\tt 1} & {\tt 2} \\ \hline Both Selection & {\tt 1} & {\tt 2} & {\tt 1} & {\tt 2} \\ \hline \end{tabular} \end{small} \\ {\small This table shows the number of fitness functions for each individual sub-population in each type of experiment. These numbers are the same for experiments where networks have either one or two modules. Ind stands for Individual Selection, and Team stands for Team Selection. Catch indicates the maximization of the number of prey caught. Dist indicates the minimization of distances between predators and prey (two distinct fitness functions of this type measure distances to the two distinct prey agents). The specific fitness functions used are defined in Equations \ref{eqn:IndCatch}, \ref{eqn:TeamCatch}, \ref{eqn:IndDist}, and \ref{eqn:TeamDist}.} \end{table} In summary, the number of prey caught is the primary metric of interest, but distance provides a fitness gradient when no prey are caught. Specifically, we care most about the number of prey caught by the team, but it is unclear whether rewarding team behavior, individual behavior, or both is the best way to achieve this goal. The use of modular networks can also have an influence on a team's ability to achieve this goal. \subsection{Numbers of Modules} \label{subsection:numModules} \begin{figure}[t!] \centering \subfloat[One Module Network]{ \label{fig:1M} \includegraphics[width=0.18\textwidth]{1MNet-Big}} \subfloat[Two Module Network]{ \label{fig:2M} \includegraphics[width=0.27\textwidth]{2MNet-Big}} \caption{\small {\bf Starting Network Configurations.} Both network configurations used by evolved predators are shown. New populations start with no hidden neurons, but each output is fully connected to all inputs. \protect\subref{fig:1M} Networks with one module have outputs for moving up, down, left, and right, as well as an output for staying still. Whenever inputs are fed into the network, the agent it controls picks the action with the highest output. The inputs are the x/y offsets to each other agent in the grid world, followed by a constant bias of 1.0. The agent inputs are grouped into predators and prey, and sorted according to proximity in terms of Manhattan Distance. \protect\subref{fig:2M} Networks with two modules use the same inputs, but have two distinct output modules. Each module has all of the outputs possessed by the one module network, as well as a preference neuron. For each set of inputs, the two module network will pick the action from the module whose preference neuron output is higher. The additional module makes learning multimodal behavior easier.} \label{fig:networks} \end{figure} Each experimental setup in this paper utilizes either one or two modules, as shown in Figure~\ref{fig:networks}. Preliminary experiments were also conducted with more modules, but results indicated that any additional modules beyond two ended up being unnecessary, and were mostly ignored. Networks with one module (1M) are standard neural networks with a single behavior developed through evolution. Networks with two modules (2M) use preference neurons to switch between output modules, as described in Section \ref{subsection:MM}. Although these network types have different output configurations, they both use the same input sensors, described next. \subsection{Sensors} \label{subsection:sensors} Each predator's sensors are the normalized x and y distance offsets (in the range [-1.0, 1.0]) to each other agent. Since the predators are given the ability to sense teammates, the sensors include every agent (not just the prey), except the sensing agent. There is also a single constant bias input which always has a value of one. This means that there will be twice the number of sensor values as there are sensed agents, plus one for the bias, for a total of nine sensor values (x/y coordinates for each of two prey, and two predators besides the sensing predator). The sensor values become inputs into the network on each time step. The sensors are organized first by type (predator vs.\ prey) of agent being sensed, and secondly in ascending order of distance to each agent of that type. So within the predator and prey groups, the sensors begin with the closest agent in terms of overall Manhattan Distance, followed by the second closest, and so on. Also, when a prey is eaten, the distance to that prey from every other agent is set to the maximum distance (sensor value of 1.0), meaning that the other prey instantly becomes the priority. \subsection{Experimental Parameters} \label{subsection:exp params} Combinations of the three different types of selection pressures discussed (Individual, Team, and Both) and the two different numbers of modules (1M or 2M) yield six experiments total. These experimental runs have the following labels: Individual1M, Individual2M, Team1M, Team2M, Both1M, Both2M. The following settings were consistent across experiments. Each experimental setup was run 30 times. There were three predators chosen from separate sub-populations, and two scripted prey. Every predator from each sub-population is evaluated in exactly ten randomly chosen teams. Since each team results in a separate trial, this design decision mitigates both the effects of noisy evaluations, and makes fitness values more reliable in the face of the structural credit assignment problem. Ten trials/teams were found to be enough to provide reliable evaluations for each genotype. Each experimental run lasts for $300$ generations. A population size of $\mu = \lambda = 200$ is used, so selection is performed across $400$ individuals. When offspring are produced, each network link has a 5\% chance of Gaussian perturbation. Additionally, each network has a 40\% chance of having a new random link added between existing neurons, and a 20\% chance of a new neuron being spliced along a randomly chosen link. Finally, topological network crossover has a 50\% chance of being applied when offspring are produced, with parents chosen via binary tournament selection. These settings lead to the results discussed next. \section{Results} \label{section:Results} \begin{figure}[t!] \centering \includegraphics[width=\columnwidth]{FINAL-GECCO-2017} \caption{\small {\bf Average Number of Prey Caught For Each Approach.} Average prey caught by champions across 30 runs of each method are plotted by generation with 95\% confidence intervals shown. All 2M variants are superior to their 1M counterparts. Among 1M configurations, Both1M and Individual1M are superior to Team1M.} \label{fig:Results} \end{figure} The results show that two modules is better than one module and that individual selection and combination setups are better than the purely team selection setup. Results during evolution are presented, followed by a discussion of the resulting behaviors. \subsection{Evolution} \label{subsection:evolution} Fitness plots of the average number of prey caught by the champion of each generation across 30 runs for each method are shown in Figure~\ref{fig:Results}. By comparing all 1M experiments to each other, results indicate that team selection is significantly inferior to other selection methods for this task ($p < 0.05$). Curiously enough, the performance of individual selection and the combination of individual and team selection were almost identical, and greatly superior to team selection. However, the final 1M performance is slightly short of perfect even for these two successful approaches. Every 2M variant is superior to its 1M counterpart. The starkest difference is for team selection, whose 1M variant is awful, but whose 2M variant is great (significantly better, $p < 0.05$). Every single predator team with two modules was able to reach a successful ceiling, capturing nearly all the prey on nearly every trial. The teams were even able to reach this point of optimization incredibly quickly, becoming almost completely leveled out by generation 150. Although the final performance levels of 2M runs are not significantly different from Individual1M and Both1M, they are better, and differences are significant ($p < 0.05$) for roughly the first 100 generations. The reasons for the success of 2M methods can be understood by analyzing the behaviors of evolved champions, discussed next. \subsection{Behavior} \label{subsection:behavior} Behaviors of the champion agents are observed to see what kinds of behaviors predators develop to capture the prey. Additionally, for the 2M champions, movement paths were colored in a accordance with the modules being used in order to identify how behaviors were split up across modules. Videos of representative behaviors can be seen at \url{southwestern.edu/~schrum2/SCOPE/predprey.html}. The ability to easily switch between a more selfish Aggressor module and a more cooperative Support module is what allows 2M runs to succeed with all fitness combinations. In contrast, 1M champion teams tend to confine their specializations more to specific sub-populations and are unable to switch between different modes of behavior, which makes them less flexible, although Individual1M and Both1M teams eventually overcome this restriction because of effective selection pressures. Some complexity is witnessed in the behavior of agents in even the worst of runs (i.e.\ Team1M). In both good and bad runs, all predators focus on the closest prey agent at the same time. One predator usually behaves as a \emph{blocker}. This behavior is essential in a torus world, because the prey needs to be surrounded and trapped in order to be captured. Successful teams included at least one agent which had this specialization. This predator typically moved in just a vertical or a horizontal line while the other predators performed the more complicated movements to force the prey to run towards/into the blocker. Other predators herd the prey towards the blocker. This \emph{herding} behavior typically developed in each of the predator populations to at least some extent, though it was seldom the primary specialization. Rather, herding behavior was more of an auxiliary behavior that could be used as needed, at least within the more skilled populations, but it is still true that one predator will typically focus on herding behaviors more than the other two. This job includes chaotic, often side to side movements in relation to the targeted prey. Essentially, the herder moves parallel to the path of the prey's movement so that it will not escape in that direction. Simultaneously, this predator closes in on the prey whenever the movement does not sacrifice any of its herding positioning surrounding the prey. So, this second predator is a mix between the blocker and an aggressor, which is discussed next. The role of \emph{aggressor} is the most prominent one across runs, likely because this behavior most obviously improves the distance fitness functions for an agent exhibiting this role. For some teams, this predator simply takes the movement action that will get it as close to the target prey as possible. In skilled populations, the aggressor is able to switch to a herding behavior when necessary, and will try to pick movements that help with the herding process (parallel to the prey). None of these specializations are strictly tied to one population. Predators can sometimes learn to take on different specializations at different times, as the need arises. For example, a predator could sometimes take on the roll of the blocker, and at other times be the aggressor. Such behavior is particularly prominent in agents with two preference modules. The most prominent result from the fitness scores is the poor performance of Team1M. Therefore, it is not surprising that Team1M included more observable bad behaviors than the other setups. The most clearly visible example is that the predator team did not evolve specializations quite as strongly. These teams of predators did not develop particularly focused blocking agents, as the closest thing to a blocker was much more active in attempting to capture the prey, which made it harder for the other predators to herd and definitively surround the prey. Instead of confining the prey, these teams often let it slip through their grasp, which would then cause them to scatter before eventually homing in on the prey again. In contrast, the Individual1M teams had clear blockers that made movements that corresponded to its teammates and stopped or slowed down a lot more often to allow its teammates to re-position and re-surround the prey. Since Team1M's closest thing to a blocker was moving so much, predators had to have more precise timing as they were closing in so that the prey wouldn't slip by them. This extra need for precise timing was avoided altogether by the Individual1M teams which ensured capture much more often with clear blocking behavior. The best teams consisted of agents with two preference modules, and the reasons for their success can be seen in their behavior, and how they use their modules. The predators regularly switch between the two modules in useful ways in every final champion 2M team. The two modules also appear to be dedicated to similar roles in each 2M run. One module is used when the predators are attempting to surround, herd, or block the prey, so this module will be referred to as the Support module. The other module is used when the predators are aggressively chasing the prey, so it will be called the Aggressive module. The Support module enacts long stretches of horizontal or vertical movements, without many changes in direction, since the predator is using the module to re-position. In contrast, the Aggressive module is used more often when the predators are closing in on the prey, so the predators' movements are as chaotic as those of the prey, with many changes in direction. \section{Discussion and Future Work} \label{section:Discussion} The results clearly demonstrate the effectiveness of using multiple modules. This is due to the ability of agents to utilize two distinct behaviors whenever they are most helpful, specifically the effectiveness of having both selfish and cooperative behaviors at various times for this task. The predators were able to use one module (Support module) to re-position, surround, and be the blocker (supportive behavior) and one module (Aggressor module) to close in aggressively on the prey for the capture (selfish behavior). Interestingly, the supportive behaviors may still lead directly to individual fitness increases. Whether a predator is chasing the prey, or blocking it, there will come a point when multiple predators are equi-distant from the prey. At this point, due to how prey agents randomly break ties when fleeing the nearest predator, it is up to chance to determine whether the aggressive or supportive predator captures the prey. Results showed that one module team selection was quite ineffective for this task. Although, it is interesting that this ineffectiveness is overcome through the usage of multiple modules. Figure \ref{fig:Results} shows that even though team fitness functions are by far the least successful, they are still able to perform incredibly well when the networks are given two modules. It seems that with only one module available, team fitness functions will push agent behavior in a direction that makes the more complex blocking and herding behaviors more difficult to develop. However, given two modules, behaviors that provide only a marginal benefit early in evolution can be retained in a less used module until they have time to flourish in later generations. The multimodal network capitalizes on only the positive effects from each of the selection pressures by not activating that particular behavior when it could perform better with the other one. However, it is surprising that team fitness, which would seemingly focus on supportive behaviors and cooperation, would be less effective at developing blocking and herding behaviors. The TeamDist fitness functions are perhaps to blame, because in assessing the whole team they are encouraging all predators to be close to the prey at the end of an evaluation. As a result, any blocking agents that were distant from the prey at the end of the evaluation would have lower fitness. Furthermore, predators that are close to the prey would be punished by teammates attempting to take on a blocking role, which would encourage even more aggressive behavior overall. In contrast, the IndDist functions at least allow aggressors to not be punished by the behavior of blockers. Furthermore, since a population that tends toward blocking early in evolution will only be competing within its own niche, such a population would be pushed less strongly toward aggressive behaviors. There would still be a slight pressure toward such behaviors because of the IndDist functions, but since blocking behavior does eventually lead to more prey being caught, and therefore optimal IndDist values, a lessening of this selection pressure could provide enough generations for effective cooperation to emerge before blocking behavior is replaced with aggressive behavior. Modular networks have already been frequently studied in conjunction with multiple objectives \cite{schrum:tciaig12,schrum:tciaig16}, but it would be interesting to see more work done combining these attributes with coevolution and various selection pressures, as is done in this paper. In particular, it would be interesting to see if the results regarding team selection are strongly tied to the specific fitness functions used in this paper, or are more general. Additionally, the effects of coevolution could be further studied by using competitive coevolution to also evolve the prey, in hopes of establishing an evolutionary arms race, as was done by Rawal et al.~\cite{rawal:cig10}. An alternative way of expanding this research would be to expand it to more complex domains, such as Ms.\ Pac-Man. Although MM-NEAT has already been used to generate successful Ms.\ Pac-Man behavior, it has not yet been used to generate behavior for the ghosts. Since the ghosts function as a team, cooperative coevolution could be applied. Furthermore, the role of different selection pressures would likely be important. It would also be interesting to try a similar experiment with and without the sensing of teammates. This paper allowed the sensing of teammates, but past research \cite{yong:ieeetamd10} indicates that lacking such sensors can sometimes improve performance. According to this work, predators can coordinate effectively despite not sensing each other through \emph{stigmergy}, meaning that predators are able to take actions that complement the behaviors of fellow teammates by observing how the prey agents respond to all predators. That is, if a prey agent is approaching a predator despite being close, it stands to reason that it is being chased in that direction by a fellow predator. We have conducted our own preliminary experiments that indicate the potential of stigmergy within our experimental setup as well. Another means of changing the sensor configuration to adjust the challenge of the domain would be to organize the sensors with respect to particular agents rather than in terms of which agents are closest. \section{Conclusion} \label{section:Conclusion} The predator/prey task is an interesting domain requiring teamwork and specialization. Results demonstrate that multimodal networks are extremely helpful. Additionally, this research indicates the superiority of individual selection in a teamwork oriented domain when coevolution across distinct sub-populations is used. This research also demonstrates the potential benefit of a mixture of individual and team selection. A combination is not only more flexible, but could also be the key to the full optimization of agent behavior. The usage of multiple objectives, multiple modules, coevolution, and the situationally appropriate selection pressures could be useful in more complex domains in the future. \section*{Acknowledgments} This work is supported in part by the Howard Hughes Medical Institute through the Undergraduate Science Education Initiative Program under Grant No.:~52007558.
{'timestamp': '2017-03-28T02:01:05', 'yymm': '1703', 'arxiv_id': '1703.08577', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08577'}
arxiv
\section{Conclusion and Future Work} We have presented a new approach for simulating reconfigurable physical objects via tangible holograms. The combination of holograms, created by a Microsoft HoloLens, and a pair of wearable robotic arms with spherical controllers enables innovative ways of interacting with tangible holograms and experiencing their numerous physical variables (e.g.~shape, texture or temperature). While we are currently developing our own body-mounted robotic arm solution, in the future we might also investigate alternative mobile solutions for physical feedback, such as small drones that could carry our interaction spheres~\cite{Gomes2016}. We further plan to experiment with different sensors and actuators in our spheres for simulating different physical features. The proposed tangible hologram solution also differs from other systems for simulating programmable matter in the sense that we offer a self-contained and mobile solution that can be used anywhere, within as well as across environments. The automatic repositioning of the spheres based on a user's hand movements and the underlying digital model in combination with the superimposed projected holograms further enables the simulation of arbitrary physical shapes and features. While we have illustrated the potential of our approach in two multi-user usage scenarios, we see various opportunities how our tangible hologram system can be used in data physicalisation. The realisation of our tangible holograph prototype is ongoing work, but we hope that the presentation of the basic ideas of our novel mobile approach for the physical augmentation of virtual objects and the presented usage scenarios will lead to some constructive discussions among HCI researchers working on mixed reality, tangible interaction as well as data physicalisation. \section{Introduction and Related Work} In their seminal work on Tangible Bits~\cite{Ishii1997}, Ishii and Ullmer presented a vision on bridging the gap between the digital and physical worlds via tangible user interfaces~(TUIs). Various subsequent projects, including the work on \mbox{Cartouche} by Ullmer~et~al.~\cite{Ullmer2010}, introduced new frameworks and conventions for building tangible user interfaces. However, in this first wave of research on tangible human-computer interaction, TUIs mainly acted as input controls for digital information and services while output was mainly provided via traditional computer screens. \begin{marginfigure} \begin{minipage}{\marginparwidth} \vspace{-4cm} \includegraphics[width=0.9\marginparwidth]{hololens.png} \caption{Microsoft HoloLens} \label{fig:hololens} \end{minipage} \end{marginfigure} The recent work on Radical Atoms by Ishii~et~al.~\cite{Ishii2012} plans to overcome the limitation that Tangible Bits are mainly used as handles for tangible input by moving towards transformable materials and shape-changing interfaces. A user can no longer just update the underlying digital model by interacting with a physical object, but changes in the underlying digital model are also communicated to the user by updating and changing the physical material (e.g.~shape). In their vision-driven design research, Ishii~et~al.~assume that future Radical Atoms will provide some form of sensing, actuation and communication at a molecular level. They introduce the hypothetical, reprogrammable and clay-like Perfect Red material which enables digital information to have its synchronised physical manifestation. Since the envisioned programmable matter is not currently available, a number of prototypes, simulating certain aspects of these envisioned materials have been realised, allowing for early exploration. For example, prototypes such as inFORM~\cite{Follmer2013} and TRANSFORM~\cite{Ishii2015} enable experimentation with shape-changing interfaces and dynamic physical affordances~\cite{Follmer2015}. The digital model underlying any dynamic physical representation can of course not only represent simple objects but also complex data sets. In this case we are no longer talking about simple physical UI components but are rather dealing with data physicalisation where the underlying data can not only be explored visually but also via other physical properties. While the reprogrammable Perfect Red material proposed by Ishii~et~al.~is mainly about changing the shape of a physical artefact, Jansens~\cite{Jansen2015} proposes the use of other physical properties, called physical variables, such as smoothness, hardness or sponginess for providing additional feedback in data physicalisation. She further discusses some of the data physicalisation opportunities and challenges including the reconfigurability of physicalisations. A drawback of many existing prototypes dealing with the simulation shape-changing materials (e.g.~inFORM and TRANSFORM) is their lack of mobility which means that they can only be used in situ at fixed places. Other solutions only work in virtual reality environments and again can only be used at fixed locations~\cite{Araujo2016}. On the other hand, we recently see the emergence of mobile devices such as the Microsoft HoloLens\footnote{https://www.microsoft.com/microsoft-hololens/} shown in Figure~\ref{fig:hololens}, enabling the development of realistic augmented reality environments. These solutions support the perfect embodiment of holograms (virtual objects) in physical space but when interacting with these environments it immediately becomes clear that the visual perception is not enough and something is missing since we cannot touch any embodied virtual object. As stated by Jansen:~\emph{\dquote{The perceived congruence concerns both visual as well as tactile perception. A perfect hologram will appear embodied but trying to touch it will destroy the illusion.}}\cite{Jansen2014}. We present an alternative approach for simulating programmable matter based on the physical augmentation of virtual objects. Thereby we provide the missing physical features of holograms in mixed reality environments by proposing a wearable system that can be used to produce tangible holograms. In the remainder of this paper, we provide some details about the proposed wearable solution for tangible holograms, outline our ongoing work on a first prototype of the system and illustrate the potential of our solution based on two usage scenarios. \section{Usage Scenarios} In order to illustrate the potential of the described solution for tangible holograms we present a number of possible future usage scenarios. \textbf{Automotive Designer Scenario:} Two automotive designers are working on a 1/4 scale physical clay model of a car and wish to explore some refinements and design alternatives at full scale. Both designers are wearing our system and one makes a spatial mapping of the model using the head mounted unit, which is then presented to the user as a hologram---ready for manipulation. The first designer places the hologram in the centre of the room and then, from a short distance back, scales the model up to full size. This hologram is shared with the other designer and both begin to work on the model through natural, touch-based interactions as illustrated in Figure~\ref{fig:automotiveDesign}. The model can seem to take on the physical properties of clay, allowing it to be worked on and manipulated in the same manner as with the original physical medium but with the added benefit of having full control over properties such as plasticity. \begin{figure}[htb] \centering \includegraphics[width=0.9\columnwidth]{automotiveDesigners.png} \caption{Collaborative work on a tangible car hologram} \label{fig:automotiveDesign} \end{figure} After some time one designer decides to work on the model in another part of the studio and so they make a scaled-down copy of the hologram to bring with them. Both designers can now work on the model remotely and see each others manipulations as they happen, interacting, in effect, with two separate tangible holograms sharing the same underlying digital model. \textbf{Interior Designer Scenario:} An interior designer wishes to discuss some design options with clients at an apartment in a block still under development. She and her two clients are wearing the system. In a given room they decide to explore some options and, accordingly, the interior designer performs a spatial mapping scan of the room, producing a mesh which is then overlayed with the room itself. This overlay may then be textured with any material (e.g.~a wallpaper pattern) and the resulting view is presented to both the designer and her clients. The designer then begins to realise the design options by scrolling through furnishings and placing items throughout the room as required. The designer and her clients can explore and experience the current design choices through the sense of touch as well as through vision. The clients can feel the texture of the seating, curtains and other furnishings. After the elements are initially positioned, the designer can make adjustments by directly touching and manipulating items. \section{Tangible Holograms} As described in the previous section, there are currently a number of research prototypes for simulating programmable matter in order to investigate the future potential of shape-changing interfaces and interactions. Existing solutions start with the physical object and try to make the physical material and interfaces more configurable in order to enable dynamic physical affordances and support dynamic data physicalisation. We take an alternative approach and start with holograms that are perfectly embedded in physical environments. Rather than making physical objects more configurable, our challenge is therefore to add physical features to the already perfectly configurable digital holograms, without introducing too many limiting constraints in terms of mobility and other factors. The setup of our proposed solution for mobile tangible holograms is shown in Figure~\ref{fig:setup}. First, the user has to wear some special glasses which will not only augment the user's view of the physical environment with the necessary digital holograms but also offer the possibility to track the spatial layout of the environment as well as any physical objects via depth and environmental cameras. The glasses can further track a user's hand in order to control any interaction with a hologram and to physically augment the hologram. \begin{figure}[htb] \centering \includegraphics[width=0.85\columnwidth]{setup.png} \caption{Tangible hologram system setup} \label{fig:setup} \end{figure} A second major component is a wearable vest or harness with two mounted robotic arms which are operated in front of a user's chest, similar to the body-attached robotic components described in other projects~\cite{Parietti2016,Leigh2016}. The end of each of the two robot arms carries a sphere which is used to capture the input from as user's hand or finger but also serves as an output device for different physical features. \begin{figure}[htb] \centering \includegraphics[width=\columnwidth]{mockup.png} \caption{Interaction with a tangible graph hologram} \label{fig:mockup} \end{figure} As previously mentioned, the central idea is to physically augment holograms in a mixed reality environment. In order to do so, the spheres on the two robotic arms will be aligned with specific parts of the holograms in the environment based on the tracking of the cameras in the glasses. A first-person view mockup of a user interacting with a graph hologram is shown in Figure~\ref{fig:mockup}. The user's hands are positioned on the spheres and by moving the spheres the user can interact with the graph. Of course the user is free to move around in the room and can interact with any other parts of the graph since continuous tracking ensures that the spheres are re-aligned with other parts of the graph in real time. The spheres can not only be used as input devices but the robotic arms may also apply some directional force to the spheres in order to provide some additional computer-generated haptic force feedback based on the underlying digital model---as seen in other projects~\cite{Hurmuzlu1998}. In addition to the haptic feedback via the robot arms, the spheres can provide non-visual supplemental feedback about the underlying digital model or data via physical variables such as shape, texture or temperature as detailed later. Furthermore, other users wearing the same system might join the scene and collaboratively interact with the graph hologram. The interaction of one user may change the underlying digital model and thereby result in visual as well as physical feedback for the other users interacting with the same graph. Note that this represents a classical model-view-control~(MVC) design pattern with the peculiarity that views can no longer only be digital but also have a physical manifestation. We see our solution as a modular platform for research on shape-changing interfaces, programmable matter and different physical variables. This platform can be customised with different interaction endpoints (spheres) depending on the application domain and the necessary feedback. Thereby, each sphere may be equipped with various sensors and actuators as realised in other tangible user interfaces~\cite{Poupyrev2007,Araujo2016}. While the spheres will act as simulators for various physical features of programmable matter, in the future they might even be built out of the Radical Atoms envisioned by Ishii~et~al. A number of different interactions can be supported by different spheres as shown in Figure~\ref{fig:sphere}. While the spheres have been introduced as tangible handles that can be used to interact with an underlying digital model and get physical feedback, Figure~\ref{fig:pointing} shows an alternative use where a sphere is used to simulate an arbitrarily shaped hologram. If a user moves their finger towards any part of a hologram, the tracking system in the glasses tracks the finger and quickly re-positions the sphere in order that its surface matches the surface of the point where the user's finger will touch the hologram. If we further ensure that the holographic projection occludes the shape of the sphere then the user experiences the illusion of a physical and tangible hologram. When the user moves their hand or finger, the sphere will continuously be repositioned to the next possible touch point and the resulting tangible hologram ensures that a touch can no longer destroy the illusion of the hologram. A similar solution for the simulation of tangible objects has been realised in the non-mobile VR Haptic Feedback Prototype\footnote{https://www.youtube.com/watch?v=iBWBPbonj-Q} for virtual reality environments. Another potential sphere interaction and interaction with a tangible hologram is shown in Figure~\ref{fig:weighting} where a user is trying to get an idea of the weight of a holographic vase. Again, the sphere is occluded by the holographic projection and the robot arm ensures that the sphere is producing the right level of pressure against the user's hand in order that they get a feeling about the vase's weight. Note that in addition the sphere might provide feedback about other physical features of the vase including its texture. \begin{marginfigure} \begin{minipage}{\marginparwidth} \vspace{1cm} \begin{subfigure}{.9\marginparwidth} \includegraphics[width=0.9\marginparwidth]{pointing.png} \subcaption{Pointing} \label{fig:pointing} \end{subfigure} \\ \vspace{0.4cm} \begin{subfigure}{.9\marginparwidth} \includegraphics[width=0.72\marginparwidth]{weight.png} \subcaption{Weighting} \label{fig:weighting} \end{subfigure} \\ \vspace{0.4cm} \begin{subfigure}{.9\marginparwidth} \centering \includegraphics[width=0.9\marginparwidth]{squeezing.png} \subcaption{Squeezing} \label{fig:squeezing} \end{subfigure} \caption{Potential sphere interactions} \label{fig:sphere} \end{minipage} \end{marginfigure} Figure~\ref{fig:squeezing} shows a third possible interaction with one of the spheres where the user is squeezing the sphere and thereby producing some detailed input for the interaction with a tangible hologram. In addition, by squeezing a specific part they might get some feedback about the tangible hologram's physical variables such as elasticity or sponginess. We are currently developing a first working prototype of the proposed system for tangible holograms. For the holographic glasses and the tracking of the environment as well as physical objects we are using a developer version of the Microsoft HoloLens discussed in the previous section. The realisation of the robotic arm prototype is based on Lego Mindstorms\footnote{https://www.lego.com/en-us/mindstorms} since this platform provides a flexible space within which to develop. A number of small serial link manipulators have been prototyped using this platform thus far, allowing us to begin evaluating several programming options. These include leJOS\footnote{http://www.lejos.org}, which allows for programming in Java, and a number of MATLAB toolboxes including the Robotics System Toolbox\footnote{https://www.mathworks.com/products/robotics.html}. Our final prototype will see a lightweight 3D~printed outer body replace most of the structural Lego elements and this structure will house the original Lego gear trains and servo motors. Note that this lightweight solution will add to the system's mobility.
{'timestamp': '2017-03-27T02:03:54', 'yymm': '1703', 'arxiv_id': '1703.08288', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08288'}
arxiv
\section{Introduction} The objective of this project (Redynis) is to design a shared-something distributed architecture atop an existing key-value store that dynamically repartitions tuples based on traffic metrics.\\ Redynis takes its roots in intelligent data placement, and in essence, attempts to delegate the data ownership to the distributed key-value store instance that is closest to the most frequent sources of a request, by implementing a web-service as an intermediary layer to the key-value store on each node.\\ \section{Problem Statement} The aim is to solve the problem of having to make frequency remote requests for local node cache misses. This needs to be solved in a manner that allows for a more usage-heuristic based dynamic repartitioning of the tuples, and build a framework that intelligently repartitions tuples for a distributed key-value store.\\ The motivation of Redynis is three-fold: \begin{itemize} \item Reduce the network latency by dynamic repartitioning of the key-value tuples based on usage-traffic heuristics i.e. maximize the number of hits on the local data store. \item Leveraging the same usage-traffic heuristics to selectively purge stale data. \item Optimizations need to be non-blocking so as to not interfere with the regular execution of fetch requests. \end{itemize} Redynis is built with the purpose of implementing these features to reduce cross-node request latency. \section{Similar Work} This section lists the previous work done to solve the same or a similar problem to the one described in the previous section.\\ Attempts to identify ideal methods to dynamically partition data already exist. Two of them, SWORD\cite{quamar2013sword} and AdaptCache\cite{asad2016adaptcache}, rely on hyper-graphs to model the database workloads, and base the repartitioning decisions off this model. SCHISM\cite{curino2010schism} relies on graph partitioning to find a predicate-based explanation for the ideal partitioning strategy. E-store\cite{taft2014store} relies of a strategy of skewed placement, where the data placement decision is taken based on usage heuristics, while avoiding replication. \\ Redynis, however, is implemented in a manner that avoids expensive graph traversals and is able to log usage heuristics and perform a usage analysis for a key in constant time. In addition, since Redis is widely used in a lot of industrial tech stacks\cite{redis-popularity}, it makes for an easier deployment strategy, compared to switching over to a new system. Also included, is a web API for ease of data access, which minimizes the development overhead of having to implement a language specific client to interact with the key-value store. Any other key-value store can be also swapped in, in place of Redis, without any changes to the client's view of the architecture.\\ \section{Model Assumptions} The following assumptions are made, with respect to the system architecture and the problem statement: \begin{itemize} \item The load balancing layer on the application servers hosting the web-service ensures that the request from clients is served by the application server closest to the client. This problem has already been solved by host resolution techniques by a DNS setup\cite{pan2003overview}. \item The nature of the workload, as is the case with most key-value stores, is predominantly read requests. \item The network of nodes is geo-distributed \item Minimal memory usage on each of the nodes is a desirable property \item $\displaystyle size(value) \gg size(key)$ \end{itemize} \section{System Architecture} This section elaborates on the components the system is comprised of, and explains the points of interaction between them. \textbf{Figure \ref{fig:sysarch}} shows a graphical representation of the architecture.\\ \begin{figure*} \centering \includegraphics[width=\textwidth]{SystemArchitecture.png} \caption{System Architecture} \label{fig:sysarch} \end{figure*} \subsection{Components} The components of the architecture are listed below: \begin{itemize} \item \textbf{Web service layer:} This layer of abstraction over the key-value store, is deployed on the application server nodes. It receives requests, reads placement details from the metadata layer and acts accordingly. \item \textbf{Data Layer:} This is the underlying in-memory datastore which the objects are primarily stored in. There is a single key-value store instance running on each of the nodes. \item \textbf{Metadata Layer:} This is a smaller key-value store for metadata, which is a separate cluster running on the same nodes as the actual key-value stores. It stores the key metadata, like current placement, usage heuristics and recency of access. \item \textbf{Placement Daemon:} This continuous process keeps running offline in periodic intervals to repartition the keys, based on the placement strategy described in \textbf{Algorithm \ref{algo-place}}. \end{itemize} \subsection{Component Interaction} Component Interaction can be enumerated as below: \begin{itemize} \item The web service deployment instances are agnostic of each other. \item The metadata layer and the caching layer are agnostic of each other. \item A given web-service on node can initiate a key-value store request call on any of the instances in the cluster of nodes. \item The data placement daemon is agnostic of the web-server layer. It merely reads from the metadata layer and enforces changes to the key-value store instances. \end{itemize} \section{Key concepts} This section contains a description of the key concepts that the dynamic repartitioning strategy, is heavily dependant on, including the `Ownership coefficient' and the data format in which metadata for each key is maintained.\\ \subsection{Ownership coefficient} \label{Ownership-coefficient} The ownership coefficient (H) determines which nodes need to have a local copy of a particular key/object.\\ During the analysis phase of the data placement daemon, the key usage for each node is calculated using equation \ref{eq:1}: \begin{equation*}g(O, x) = count(accesses\ on\ object\ O)\ by\ node\ x \end{equation*} \begin{equation} \label{eq:1} f(O,x) = \frac{g(O, x)}{g(O, \forall nodes)} \end{equation} If equation \ref{eq:2} holds true, then node `x' is deemed eligible to possess a replicated copy of object O. \begin{equation} \label{eq:2} f(O, x) - H \geq 0 \end{equation} The above conditions operate under the constraint defined in equation \ref{eq:3} \begin{equation} \label{eq:3} H - \frac{1}{n} \leq 0 \end{equation} where `n' is the number of nodes in the architecture. This constraint is defined to avoid host starvation of key ownership, especially for cases in which hosts might have close to equivalent access metrics, and result in undesired deletion of keys from nodes.\\ \subsection{Metadata format} The data object used to store the metadata for each tuple is given below. \begin{lstlisting} { `totalAccessCount': 17, `hosts': [ `node-1', `node-3' ], `hostAccesses': { `node-1': 9, `node-2': 3, `node-3': 5 }, `lastAccessedDate': 1480725771235 } \end{lstlisting} \textit{hosts} is a hashed set, \textit{hostAccesses} is a data-dictionary, and the numeric values are positive integers. \textit{lastAccessedDate} denotes when the key in question was last accessed, in terms of milliseconds elapsed since the epoch.\\ \section{Algorithmic Approach} This section describes the algorithms being used to implement the architecture, including fetching, storing and repartitioning tuples.\\ \subsection{Fetching tuples} Described in \textbf{Algorithm \ref{algo-fetch}}.\\ \begin{algorithm} \KwData{key} \KwResult{value/null} \DontPrintSemicolon \; query metadata data for key\; \uIf{$metadata == null$}{ return null; } \uElse{ $owner\_hosts = metadata.hosts$\; \uIf{$current\_host \in owner\_hosts$}{ make local request to get data\; } \uElse{ make remote request\\ (incurring additional latency)\; } spawn async thread and collect access metrics\; return value to user\; } \; \label{algo-fetch} \caption{Fetching values} \end{algorithm} \begin{algorithm} \KwData{key, value} \KwResult{success = true/false} \DontPrintSemicolon \; query metadata data for key;\\ \uIf{metadata == null}{ store new key and value locally\; generate metadata object\; post metadata object to metadata layer\; } \uElse{ $owner\_hosts = metadata.hosts$\; \uIf{$current\_host \in owner\_hosts\ \land$\;$length(owner\_hosts) == 1$}{ key is only present at current-host\; post value locally\; } \uElseIf{current-host == write-serializer}{ post value to owner-hosts\; } \Else{ relay store request to write-serializer node\; } } \; \uIf{no-exception-thrown}{ return true\; } \uElse{ return false\; } \; \label{algo-store} \caption{Storing values} \end{algorithm} \subsection{Storing tuples} Described in \textbf{Algorithm \ref{algo-store}}.\\ \subsection{Repartitioning tuples} Described in \textbf{Algorithm \ref{algo-place}}.\\ \begin{algorithm} \KwData{master-metadata-host} \KwResult{null} \DontPrintSemicolon \; initialize $H = ownership.coefficient$\; initialize $owner\_hosts$\; initialize $delete\_hosts$\; \; \For{$key \in all\_keys$}{ $keyaccesses = key.metadata.totalaccesses$\; $current\_hosts = key.metadata.hosts$\; $owner.accessmap = key.metadata.accessmap$\; \uIf{$now > (key.metadata.hosts - expirytime)$}{ delete $key$ from $current\_hosts$\; delete $key$ from metadata\; } \; \For{$hostaccess\_pair \in owner.accessmap$}{ $ \displaystyle f = \frac{hostaccess\_pair.accesses}{keyaccesses}$\; \uIf{$f \geq H$}{ add $hostaccess\_pair.host$ to $owner\_hosts$\; } \uElse{ add $hostaccess\_pair.host$ to $delete\_hosts$\; } } \; $new\_hosts = owner\_hosts - current\_hosts$\; $obsolete\_hosts = current\_hosts \cap delete\_hosts$\; \; add new hosts and delete obsolete hosts\ from metadata\; } \label{algo-place} \caption{Placement Algorithm} \end{algorithm} \section{Test Setup} This section describes the details of the test setup, including the test bed and the nature of the experiments conducted. \subsection{Testbed} \subsubsection{Service Infrastructure} \label{Service-Infrastructure} The testing for this experiment was done on a cluster of 3 nodes, with 12 CPU cores and 16 GB of main memory. Each of these nodes contains a deployment setup as follows: \begin{itemize} \item RedynisService \cite{redynis-svc} \item Redis instance (as the actual key-value store) \item Redis instance (as the metadata store) \end{itemize} Of these, one of these nodes is configured to be the master propagator, in order to serialize write transactions and ensure correctness of value data across the Redis instances.\\ \subsubsection{Placement Infrastructure} A single node will be running a continuous execution for RedynisDaemon \cite{redynis-daemon} The node's hardware specifications the same as the nodes running the service infrastucture (\ref{Service-Infrastructure}).\\ \subsection{Workloads} YCSB workloads for RESTful web-services was used to benchmark this experimental setup.\\ The tests run were permutations of the below configurations: \begin{itemize} \item Workload Read requests (\%) ranging from 100(all reads) to 50(write-heavy) \item Uniform key-value access distribution vs Skewed key-value access distribution \end{itemize} The uniform distribution workload accesses all the tuples an equal amount of times, whereas the skewed distribution workload accesses is a zipfian distribution that requests 10\% of the data items 90\% of the time.\\ All of the workloads have been run on a uniform set of 100,000 total requests. To simulate a widely geo-distributed network of nodes, the incurred latency for making a request to a remote node is simulated to be 100ms\cite{latency-stats}, whereas there is no incurred penalty for making a local request.\\ \begin{figure*}[ht] \centering \includegraphics[width=\textwidth]{Uniform-dist-throughput.png} \caption{Uniform Object Access Distribution} \label{fig:res-unif} \end{figure*} \begin{figure*}[ht] \centering \includegraphics[width=\textwidth]{Uniform-dist-throughput.png} \caption{Skewed Object Access Distribution} \label{fig:res-skew} \end{figure*} \section{Experimental Results} The experimental results for uniform distribution of object access and skewed distribution are indicated in \textbf{Figure \ref{fig:res-unif}} and \textbf{Figure \ref{fig:res-skew}} respectively.\\ Each of the bars plotted for throughput have additional error bars to indicate the 99\% confidence interval for the distribution across the multiple iterations of the experiment performed. \\ The different scenarios enumerated in the graphs are described below: \begin{itemize} \item \textbf{Local:} All requests for keys made are served by the key-value store on the local node. This is the theoretically ideal scenario. \item \textbf{Remote:} All requests for keys made are served not available on the local key-value store, and for each request, the penalty of having to retrieve the key's value from a remote node, is incurred. \item \textbf{Optimized:} All requests for keys made are served not available on the local key-value store. However, as the requests keep being made, the usage statistics are logged, and the Redynis daemon, following the Ownership coefficient policy detailed in \textbf{section \ref{Ownership-coefficient}}, replicates the keys to the local key-value store on the fly, to mitigate the penalty incurred by having to make remote requests for a frequently accessed key. \end{itemize} The hypothesis being tested by the experiment is to examine if the optimized option is a good-enough alternative to a naive global replication of all keys across all nodes in the key-value cluster. The experimental results corroborate this hypothesis.\\ \section{Conclusions} The performance of the system designed for the experiment is approximately ten-fold better than the scenario in which all the requests made are re-routed to remote nodes. It is also nearly comparable to the theoretical ideal key-value store that contains all the keys, which could prove to be a helpful alternative to having a fully-replicated Redis cluster. The experimental results point to the hypothesis being proven true. \\ The Redynis system expands the feature set of an already widely used key-value store, and permits usage of a shared-nothing, independent set of Redis nodes as a shared-something cluster, to enable intelligent partitioning of data. This is particularly helpful in use-cases that require a widely geo-distributed set of key-value store nodes, and there are main memory constraints on the hardware specifications for the nodes the key-value stores are deployed on. The experimental performance is indicative of what the system has to offer. All of the above is offered while still maintaining strong serializability guarantees for the write operations on the distributed cluster.\\ \section{Future Work} This section lists the threads of future work that are envisioned for Redynis. \begin{itemize} \item The current architecture doesn't respond well to a failure of the master propagator, on which the write serialization depends upon. Future work would primarily be focused on implementing failure handling mechanisms. These mechanisms can be introduced into the existing framework using a heartbeat mechanism to detect when the master propagator goes offline, and electing another node to take it's place. \item The data placement strategy that is currently in use is fairly trivial. A more sophisticated placement computation model can be plugged into RedynisDaemon, in it's stead, for more accurate placement decision strategies. \item The RESTful web-service wrapper in the existing implementation is only responsible to aggregating metrics and directing client requests. It can be extended to form a framework for additional data-collection, which can, in turn be used to build predictive models that can identify patterns in data accesses, and pre-emptively move data based on the features of the model learnt.\\ \end{itemize} \section{Acknowledgments} The author would like to thank Dr. Khuzaima Daudjee for his guidance, suggestions and feedback during the conceptualization of this research project.\\ \bibliographystyle{abbrv}
{'timestamp': '2017-03-27T02:07:37', 'yymm': '1703', 'arxiv_id': '1703.08425', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08425'}
arxiv
\section{Acknowledgment} \begin{abstract} It is proved that approximating the capacity of a time-invariant Markov channel with perfect feedback is PSPACE hard. \end{abstract} \maketitle \section{Introduction} In this paper, it is proved that approximating the capacity of a Markov channel with perfect feedback is PSPACE-hard. By `approximating,' we mean, computing the capacity within a certain given additive error $e$. A class of channels will be constructed for which it will be proved that approximating the capacity to within $0.1$ bits of the correct capacity is PSPACE-hard. The observation that approximating the capacity of a Markov channel with perfect feedback can be formulated as a stochastic dynamic programming problem with partial observations thereby connecting it to the work of Tsitsiklis and Papadimitriou on the complexity of Partially Observed Markov decision processes \cite{TsPaCo} is what is novel here along with the result. The authors of \cite{TsPaCo} demonstrate that the complexity of Markov decision processes with partially observed states is PSPACE-hard. The constructions and arguments in our paper depend significantly on, and are in many cases, the same as the arguments in \cite{TsPaCo}. The output of the channel in this paper is the partial state information in \cite{TsPaCo}. By carefully chosing the reset probabilities from the final decision states, we are able to map the complexity result about Markov decision process in \cite{TsPaCo} to result concerning the hardness of capacity approximation in this paper. The utter simplicity with which a result in control theory can be `transported' into a result in communication theory can be seen. For the relevant background on complexity theory, see \cite{TsPaCo} and references therein. An understanding of Section 4 in \cite{TsPaCo}, in particular, the statement of Theorem 6 and its proof is needed to understand the proof here. Once this is understood, and the reader has an understanding of information theory and basic probability theory, the proofs presented here can be understood. \section{Literature survey} In \cite{TsPaCo}, the complexity of Markov decision processes and partially observed Markov decision processes has been considered and in \cite{TsPaIn}, the Witsenhausen and team decision problems have been considered. In both these papers, it is proved that there are problems in each category which are hard. See further references therein for problems which have been proved to be hard, especially in a control setting. There are various papers in information theory demostrating hardness of source and channel coding algorithms and code constructions, see, for example \cite{Wit}, \cite{Ber}, and \cite{Lang}. In \cite{Wit}, it has been proved that the generalized Lloyd-Max algorithm is NP-complete. In \cite{Ber}, it has been proved that general decoding problem for linear codes and the general problem of finding the weights of a linear code are both NP-complete. In \cite{Lang}, the problem of encoding complexity of network coding is considered, and one of the results in this paper is that approximating the minimum number of encoding nodes required for the design of multicast coding networks is NP-hard. In this paper, it is proved that even just approximately calculating the capacity to within a constant additive positive number is PSPACE-hard for the problem of Markov channel with perfect feedback, and thus, for a general network, the problem of approximating the capacity region is PSPACE-hard. \section{The result} This section contains the channel construction, lemmas and the theorem. For literature on Markov channels with feedback, the reader is referred to \cite{Tat} and references therein, though this paper is not particularly needed to understand our paper. \subsection{Channel construction and reliable communication} Starting from any quantified formula $Q \!=\! \exists x_1 \forall x_2 \exists x_3 \ldots \forall x_n F(x_1, x_2, \ldots, x_n)$ with $n$ variables and $m$ clauses $C_1, C_2, \ldots, C_m$, where $F$ is in conjunctive normal form, we construct a channel as follows: Channel states $s_0, A_{ij}$, $A'_{ij}$, $T_{ij}$, $T'_{ij}$, $F_{ij}$, $F'_{ij}$; sets $A_j$, $A'_j$, $T_j$, $T'_j$, $F_j$, $F'_j$ $1 \leq i \leq m, 1 \leq j \leq n$ are the same as those in \cite{TsPaCo}. The states $A_{i,n+1}$ are lumped into a single state $A_{n+1}$ and the states $A'_{i,n+1}$ are lumped into a single state $A'_{n+1}$. Also, there is no terminating state, and from $A_{n+1}$, the channel goes back to itself or to $s_0$, and from $A'_{n+1}$, the channel goes back to itself or to $s_0$, in a way described later. The state transitions, which as stated above, are exactly the same as in \cite{TsPaCo} (but for the exception stated above). In order to make the paper self-contained, we reproduce the same here. Based on each clause $C_i$ of $Q$ and variable $x_j$ there are $6$ states, $A_{ij},$ $A'_{ij},$ $T_{ij},$ $T'_{ij},$ $F_{ij},$ $F'_{ij}$. There are also $2$ additional states $A_{n+1}$ and $A'_{n+1}$. The initial state $s_0$ should be thought of as a set. For each variable $j$, the states $A_{ij}, 1 \leq i \leq m$ form a set $A_i$, and the states $A'_{ij}, 1 \leq j \leq m$ form a set $A'_{ij}$ and similarly, the sets $T_i, T'_i$, $F_i, F'_i$ are defined (this will be the partial state information, as we shall see below). The channel can transition from $s_0$ to states $A'_{i1}, 1 \leq i \leq m$ with equal probability. If $x_j$ is an existential variable, there are two possible state transitions out of the set $A_j$ leading with certainty from $A_{ij}$ to $T_{ij}$ and $F_{ij}$ respectively, and similarly, there are two transitions out of the set $A'_j$ leading with certainty from $A'_{ij}$ to $T'_{ij}$ and $F'_{ij}$ respectively. If $x_j$ is a universal variable, there is one transition out of the set $A_j$ leading with equal probability from $A_{ij}$ to $T_{ij}$ and $F_{ij}$ and similarly, there is one transition out of the set $A'_j$ leading with equal probability from $A'_{ij}$ to $T'_{ij}$ and $F'_{ij}$. From the sets $T_j, F_j, T'_j, F'_j$ sets, there is only one transition which leads with certainty from $T_{ij}, F_{ij}, T'_{ij}$ and $F'_{ij}$ to (respectively) $A_{i,j+1}, A_{i, j+1}, A'_{i, j+1}, A'_{i,j+1}$ with two exceptions: If $x_j$ appears positively in $C_i$, the transition from $T'_{ij}$ is to $A_{i,j+1}$ instead of $A'_{i,j+1}$ and if $x_j$ appears negatively, the transition from $F'_{i,j}$ is to $A_{i,j+1}$. When the channel reaches the state $A_{i,n+1}$, as stated above, the states $A_{i,n+1}$ are lumped into a single state $A_{n+1}$, and the channel stays in $A_{n+1}$ with probability $1-p$ and transitions back to the state $s_0$ with probability $p$ for a value of $p$ stated later. Similarly, when the channel reaches state $A'_{i,n+1}$, as stated previously, the states $A'_{i,n+1}$ are lumped into a single state $A'_{n+1}$, and the channel stays at state $A'_{n+1}$ with probability $1-q$ and transitions to the state $s_0$ with probability $q$, for a value of $q$ stated later. The state $A_{n+1}$ will be called `good' state and the rest of the states will be called `bad' states. The reason for this will become clear below. The output of the channel is the partial state information, that is, one of $s_0, A_i,A'_i,T_i,T'_i,F_i,F'_i$, $1 \leq i \leq n$, and $A_{n+1}$, $A'_{n+1}$ along with an output bit either $0$ or $1$ depending on channel input and channel functioning. Thus, the output space of the channel is $\mathbb O \triangleq \{s_0, \{T_i\}, \{T'_i\},\{F_i\}, \{F'_i\}\{A_{i}\}, \{A'_{i}\}, 1 \leq i \leq n, A_{n+1}, A'_{n+1}\} \} \times \{0,1\}$. The output of the channel is `fed back' directly to the encoder \emph{without} delay. The input to the channel is $\{D_1, D_2\} \times \{0, 1\}$. Intuitively, this should be thought of as a bit being transmitted through $0$ or $1$ and $D_1$ and $D_2$ determine the state transition (note that there are at most 2 possible state transitions out of a state). Of course, another policy can be used instead of transmitting the information bit and the state transition information; the above is just an intuitive way of thinking about the channel input. The input to the encoder is a sequence of bits, each bit taking a value of $1$ with probability $\frac{1}{2}$ and $0$ with probability $\frac{1}{2}$, along with the output of the channel, which, as stated above, is `fed back' directly to the encoder without delay. At each time, the bit input to the encoder should be thought of as a single bit, the bit which has not yet been communicated. Thus, the input space of the encoder is $\{0, 1\} \times \mathbb O$ $=$ $\{0, 1\} \times \{s_0, \{T_i\}, \{T'_i\},\{F_i\}, \{F'_i\}\{A_{i}\},\allowbreak \{A'_{i}\}, 1 \leq i \leq n, A_{n+1}, A'_{n+1} \} \times \{0,1\}$. Based on all past inputs (a bit stream and all past feedback from the channel output), the encoder makes an encoding and `feeds it' into the channel. It will be assumed that the channel starts in state $s_0$. Note that if the channel starts in state $s_0$, in $2n+1$ units of time, it reaches either state $A_{n+1}$ or state $A'_{n+1}$. For the purpose of understanding, it is best to think of the problem as a sequential problem where a set of bits `enter' the encoder at a certain rate $R$ which causes an encoding and the channel produces the outputs from which a decoding needs to happen. A rate $R$ is achievable if, for every $\delta$, $\exists t_{\delta}$ such that for $t > t_{\delta}$, $Rt$ bits can be communicated and the average error, that is, $\Pr(\hat B_{tR} \neq B_{tR})$ is less than $\delta$, where $B_{tR}$ denotes the bit input upto time $t$ and $\hat B_{tR}$ is the corresponding decoding. Let $p=2^{-(mn)^{100}}$ and $q = 2^{-(mn)^{200}}$. \subsection{Lemmas, theorem and proofs} As has been stated previously, assume, in what follows, that the channel starts in state $s_0$. \begin{lemma} Given $\epsilon > 0$. Then, $\exists m_0, n_0$, depending only on $\epsilon$ such that for $m>m_0, n>n_0$, if $Q$ is true, capacity of the channel corresponding to $Q$ is larger than $1-\epsilon$. \end{lemma} \begin{proof} By \cite{TsPaCo}, $Q$ is true implies that we can choose the channel input (decisions in \cite{TsPaCo}) so that we always end up in $A_{n+1}$, not $A'_{n+1}$. The transitions from $s_0$ to $A_{n+1}$ takes $2n+1$ units of time where at worst, no bits can be communicated, and the channel stays in state $A_{n+1}$ for an average of order of magnitude $2^{(mn)^{100}}$ number of transitions, where $1$ bit is transmitted noiselessly per channel use. By these considerations, it follows that given any $\kappa > 0$, $\exists$ $m_1, n_1$ such that for $m>m_1$, $n>n_1$, the stationary distribution of the state $A_{n+1}$ of the Markov chain with the above chosen channel inputs is $>1-\kappa$. By use of the ergodic theory for Markov chains, the lemma follows. \end{proof} \begin{lemma} Given $\alpha > 0$. Then, $\exists m_0, n_0$ sufficiently large, depending only on $\alpha$ such that for $m>m_0, n>n_0$, the capacity of the channel corresponding to the formula $Q$ is larger than $\alpha$ implies that $Q$ is true. \end{lemma} \begin{proof} If there was some way for the channel to enter the state $A'_{n+1}$ irrespective of the decisions, this would happen with probability at least $\frac{2^{-n}}{m}$ (see \cite{TsPaCo}), and then, the channel stays in this state for an average of an order of magnitude of $2^{(mn)^{200}}$ amount of time (1 unit of time refers to one state transition). Note that there is no transmission of information possible in state $A'_{n+1}$. Even if the channel ended in $A_{n+1}$ with the rest of the probability $1-\frac{2^{-n}}{m}$, the average order of magnitude amount of time the channel stays in state $A_{n+1}$ is $2^{(mn)^{100}}$ which is `much less' than $2^{(mn)^{200}}\frac{2^{-n}}{m}$. Also, there is the $2n+1$ units of time when the channel transitions from $s_0$ to $A_{n+1}$ or $A'_{n+1}$, which is `negligible'. It follows that given any $\lambda > 0$, $\exists m_2, n_2$ such that for $m > m_2$, $n > n_2$, the fraction of time the channel spends in states $A'_{n+1}$ is $>(1-\lambda)$ with high probability. Finally, note that the amount of transmission of information during the $(2n+1)$ units of time when the channel transitions from $s_0$ to $A_{n+1}$ or $A'_{n+1}$ is at most $\log \lceil 6mn+3 \rceil$. This is because the output space to the channel has cardinality $6mn+3$. By taking into account the above numbers, it follows, then, that if the channel could enter $A'_{n+1}$, there exist $m_0, n_0$ sufficiently large such that the capacity of the channel will be less than $\alpha$ which will contradict the assumption on the channel. It follows, then, that there is a set of decisions (channel inputs) for which the channel never enters the state $A'_{n+1}$ which implies, by \cite{TsPaCo}, that the formula is true. \end{proof} \begin{thm} \label{TheoremMain} Computing the capacity of this set of Markov channels (the set of channels formed by taking a channel corresponding to each formula $Q$ where $m,n$ and the particular formula can be any positive integers) when perfect feedback is available, to within an accuracy of 0.1 bits per channel use, is PSPACE hard. \end{thm} \begin{proof} If the capacity of this set of Markov channels with feedback could be computed to within an accuracy of $0.1$, it would be known whether the capacity of the channel is less than $0.2$ or larger than $0.8$. This would imply, from the previous lemmas, that we would know, for sufficiently large $m,n$, whether $Q$ is true or not, and this problem is PSPACE hard. \end{proof} \section{Comments} \begin{comment} It has been assumed that the channel starts in state $s_0$. This is only for simplicity of presentation. Minor modifications can be made in order to make the channel start in any state. \end{comment} \begin{comment} In addition, a transition from state $A_{i,n+1}$ to $A'_{i,n+1}$ with a probability $2^{-(mn)^{500}}$ could be added, and thus, from state $A_{i,n+1}$ to state $s_0$ with probability $1-2^{-(mn)^{500}} - 2^{-(mn)^{100}}$ to make the picture a little more realistic. Also, the bound in Lemma 2 concerning the information transmission from input to output, is $\log \lceil 6nm + 3 \rceil$; however, a bound should also be possible on the cardinality of the input space of the channel. \end{comment} \begin{comment} There is nothing special about the number $0.1$ in Theorem~\ref{TheoremMain}. Also, $p$ and $q$ need not be doubly exponential. Doubly exponentials work, and for that reason, they have been chosen this way. \end{comment} \begin{comment} \emph{PSPACE} hardness implies \emph{NP} hardness and thus, the problem dealt with in this paper is also \emph{NP} hard. \end{comment} \begin{comment} A block-coding model can be considered instead of a sequential model. For the purpose of intuition, it is best to think of a sequential model. \end{comment} \section{Importance of the result} In information theory, one important research direction is to find single-letter characterizations, appropriately defined, for capacity regions of networks. However, it is not concretely known whether single letter characterizations exist in general. An example is the two-way channel \cite{S2way}. In order to prove that in general, there is no single letter characterization, all one needs is an example for which it is not possible to get one. This paper takes a different view-point and firmly establishes a limit from the view-point of complexity theory by providing an example for which approximating the capacity of a general network is indeed hard in the sense of PSPACE-hardness. \section{Recap and research directions} A class of Markov channels with perfect feedback was constructed for which it was proved that approximating the capacity to within 0.1 bits is PSPACE hard. It would be worthwhile exploring the application of this proof idea to other channels with potentially noisy feedback, channels with perfect state information, and networks in general. It would be helpful to see whether this result puts restrictions on the kind of single-letter characterizations there may exist for capacity regions of networks; for example, this paper will rule out certain characterizations which can be approximated in a way that is not PSPACE-hard. The simplicity with which a result in which a result in control theory has been used to prove a result in information theory may be noted and further possibilities of the same may be explored. \section{Acknowledgments} The author thanks Prof. John Tsitsiklis for suggesting his paper \cite{TsPaCo} which led to proving the result in this paper. The author also thanks Dr. Tom Richardson for carefully reviewing this paper and suggesting extensive changes in the writing of the proof and encouraging the author to submit the paper. The author thanks Prof. Vincent Tan for helpful discussions. Finally, the author thanks Prof. Sanjoy Mitter for suggesting that the author talk to Prof. John Tsitsiklis and Dr. Tom Richardson, for looking through the first version of this paper, and for general encouragement.
{'timestamp': '2018-03-23T01:02:44', 'yymm': '1703', 'arxiv_id': '1703.08625', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08625'}
arxiv
\section{Introduction} Robot-assisted Minimally Invasive Surgery (RMIS) overcomes many of the limitations of traditional laparoscopic Minimally Invasive Surgery (MIS), providing the surgeon with improved control over the anatomy with articulated instruments and dexterous master manipulators. In addition to this, 3D-HD visualization on systems such as da Vinci enhances the surgeon's depth perception and operating precision~\cite{bhayani2005three}. However, complications due to the reduced field-of-view provided by the surgical camera limit the surgeon's ability to self-localize. Traditional haptic cues on tissue composition are lost through the robotic control system~\cite{okamura2009haptic}. Overlaying pre- and intra-operative imaging with the surgical console can provide the surgeon with valuable information which can improve decision making during complex procedures~\cite{taylor2008medical}. However, integrating this data is a complex task and involves understanding spatial relationships between the surgical camera, operating instruments and patient anatomy. A critical component of this process is segmentation of the instruments in the camera images which can be used to prevent rendered overlays from occluding the instruments while providing crucial input to instrument tracking frameworks \cite{pezzementi2009articulated,allan2014d}. \begin{figure}[!tbp] \centering \begin{minipage}[b]{0.49\textwidth} \centering \includegraphics[width=\textwidth, trim={5cm 0cm 5cm 0cm},clip, height=6.85cm]{img/img1_c.png} \caption{\label{fig:all_seg_frames} Example frames from RMIS procedures demonstrating the complex lighting and color distributions which make instrument segmentation an extremely challenging problem.} \end{minipage} \hfill \begin{minipage}[b]{0.49\textwidth} \centering \includegraphics[trim={12cm 6cm 13cm 0cm},clip, height=4cm]{img/resnet_block.pdf} \caption{\label{fig:resnet_blk}Architecture of a "bottleneck" residual block which is composed of three convolution layers. The first convolutional layer performs dimensionality reduction, leaving the middle layer with smaller input/output dimensions and the third convolutional layer expands the dimension back to the original size. The output of the third convolutional layer is the residual, which is added to the input features. Batch normalization was omitted for simplicity.} \end{minipage} \vspace{-4ex} \end{figure} Segmentation of surgical tools from tissue backgrounds is an extremely difficult task due to lighting challenges such as shadows and specular reflections, visual occlusions such as smoke and blood, and due to complex background textures (see Fig.~\ref{fig:all_seg_frames}). Early methods attempted to simplify the problem by modifying the appearance of the instruments \cite{tonet2005tracking}. However, this complicates clinical application of the technique as sterilization can become an issue. Segmentation of the instruments using natural appearance is a more desirable approach as it can be applied directly to pre-existing clinical setups. However, this defines a more challenging problem. To solve it, previous work has relied on machine learning techniques to model the complex discriminative boundary. The instrument-background segmentation can be modeled as a binary segmentation problem to which discriminative models, such as Random Forests \cite{bouget2015detecting}, maximum likelihood Gaussian Mixture Models \cite{pezzementi2009articulated} and Naive Bayesian classifiers \cite{speidel2006tracking}, all trained on color features, have been applied. A more recent work, showing state-of-the-art performance~\cite{garciareal}, applies Fully Convolutional Networks (FCNs), more specifically FCN-8s model~\cite{long2015fully} for the task of binary segmentation of robotic tools. Although most approaches treat the problem as a binary segmentation problem, for different applications of instrument tracking, it is important to discriminate between different parts of the instrument, particularly the rigid shaft and the metallic clasper \cite{allan2014d}. To the best of our knowledge, no previous work has performed multi-class robotic tool segmentation on the MICCAI Endoscopic Vision Challenge Robotic Instruments dataset \cite{med_segm_dataset}. In this work, we adopt the state-of-art residual image classification Convolutional Neural Network (CNN)~\cite{he2016deep} for the task of semantic image segmentation by casting it into Fully Convolutional Network (FCN)~\cite{long2015fully}. However, the transformed model delivers prediction map of significantly reduced dimension compared to the input image~\cite{long2015fully}. To account for that and recover full resolution feature map, we reduce in-network downsampling, employ dilated (atrous) convolutions to enable initialization with the parameters of the original classification network, and perform simple bilinear interpolation of the feature maps to obtain the original image size~\cite{chen2016deeplab}~\cite{yu2015multi}. This approach is a powerful alternative to using deconvolutional layers and ``skip architecture" as in FCN-8s model~\cite{long2015fully}. By employing it, we advance the state-of-the-art in binary segmentation of tools in the aforementioned dataset and extend our approach for multi-class tool segmentation. \section{Method} The goal of this work is to label every pixel of an image $\textbf{I}$ with one of $C$ semantic classes, representing surgical tool part or background. In case of binary segmentation, the goal is to label each pixel into $C=2$ classes, namely surgical tool and background. In this work, we also consider a more challenging multi-class segmentation with $C=3$ classes, namely tool's shaft, tool's manipulator and background. Each image $\textbf{I}_i$ is a three-dimensional array of size $h \times w \times d$, where $h$ and $w$ are spatial dimensions, and $d$ is a channel dimension. In our case, $d=3$ because we use RGB images. Each image $\textbf{I}_i$ in the training dataset has corresponding annotation $\textbf{A}_i$ of a size $h \times w \times C$ where each element represents one-hot encoded semantic label $a \in \{0, 1\}^C$ (for example, if we have classes 1, 2, and 3, then the one-hot encoding of label 2 is $(0, 1, 0)^{T}$). We aim at learning a mapping from $\textbf{I}$ to $\textbf{A}$ in a supervised fashion that generalizes to previously unseen images. In this work, we use CNNs to learn a discriminative classifier which delivers pixel-wise predictions given an input image. Our method is built upon state-of-the-art deep residual image classification CNN (ResNet-101, Section \ref{sec:residual}), which we convert into fully convolutional network (FCN, Section \ref{sec:FCN}). CNNs reduce the spatial resolution of the feature maps by using pooling layers or convolutional layers with strides greater than one. However, for our task of pixel-wise prediction we would like dense feature maps. We set the stride to one in the last two layers responsible for downsampling, and in order to reuse the weights from a pre-trained model, we dilate the subsequent convolutions (Sec. \ref{sec:dilated}) with an appropriate rate. This enables us to obtain predictions that are downsampled only by a factor of $8\times$ (in comparison to the original downsampling of $32\times$). We then apply bilinear interpolation to regain the original spatial resolution. With an output map of the same resolution as an input image, we perform end-to-end training by minimizing the normalized pixel-wise cross-entropy loss~\cite{long2015fully}. \subsection{Deep Residual Learning} \label{sec:residual} Traditional convolutional networks learn filters that process the input $x_l$ and produce a filtered response $x_{l+1}$, as shown below \begin{gather} y_l = g(x_l, w_l), \\ x_{l+1} = f(y_l). \end{gather} Here, $g(.,.)$ is a standard convolutional layer with $w_l$ being the weights of the layer's convolutional filters and biases, $f(.)$ is a non-linear mapping function such as the Rectified Linear Unit (ReLU). Many state of the art CNNs employ such convolutional layer followed by a non-linear rectification as a basic building block (AlexNet, VGG16, etc.). However, He et al. \cite{he2016deep} recently showed that significant gains in performance can be obtained by employing ``residual units" as a building block of a deep CNN, and called such networks Residual Networks (ResNets). In this work, we use a residual network to perform image segmentation. Deep residual networks (ResNets)~\cite{he2016deep} consist of many stacked “Residual Units”. Fig. \ref{fig:resnet_blk} shows the architecture of a residual unit. Each unit can be expressed in the following general form, \begin{gather} y_l = h(x_l) + F(x_l , W_l), \\ x_{l+1} = f(y_l), \end{gather} where $x_l$ and $x_{l+1}$ are input and output of the $l$-th unit, and $F(.,)$ is a residual function to be learnt. In~\cite{he2016deep}, the function $h(.)$ is a simple identity mapping, $h(x_l) = x_l$ and $f(.)$ is a rectified linear unit activation (ReLU) function. Because $h(x_l)$ is chosen to be an identity mapping, it is easily realized by attaching an identity skip connection (also known as a ``shortcut” connection). Assuming that the desired underlying mapping for $y_l$ is $H(x_l)$, a residual block fits a mapping of $F(x_l) = H(x_l)-x_l$, which is called a residual function. The original mapping is recast into $F(x_l)+x_l$. It was experimentally shown in \cite{he2016deep} that learning residual functions with reference to the layer inputs, instead of learning unreferenced functions allows to train deeper models which gain accuracy from considerably increased depth. ResNets that are over 100-layers deep have shown to produce state-of-the-art accuracy for several challenging Image Classification and Image Segmentation tasks~\cite{he2016deep}~\cite{chen2016deeplab}. This motivates our choice of using ResNet architecture over others. In our work, we adopt ResNet-101 architecture for Image Segmentation and apply it for the task of tool segmentation. \subsection{Fully Convolutional Networks} \label{sec:FCN} \begin{figure*}[!htb] \centering \includegraphics[width=1\textwidth]{img/final_test_main_pic.png} \caption{\label{fig:fcn_and_dilated}A simplified CNN before and after being converted into an FCN (illustrations \textbf{(a)} and \textbf{(b)} respectively), after reducing downsampling rate with integration of dilated convolutions into its architecture with subsequent bilinear interpolation (illustration \textbf{(c)}). Illustration \textbf{(a)} shows an example of applying a CNN to an image patch centered at the red pixel which gives a single vector of predicted class scores (manipulator, shaft, and background). Illustration \textbf{(b)} shows the fully connected layer being converted into $1 \times 1$ convolutional layer, making the network fully convolutional, thus enabling a dense prediction. Illustration \textbf{(c)} shows network with reduced downsampling and dilated convolutions that produces outputs that are being upsampled to acquire pixelwise predictions.} \vspace{-5ex} \end{figure*} Deep CNNs (e.g. AlexNet, VGG16, ResNets, etc.) are primarily trained for the task of image classification. Hence, they are originally designed to solve recognition problems on the scale of entire image, by assigning one of many class labels to it. However, to obtain the output granularity required for a task such as image segmentation the network should be modified. This modification consists of converting fully connected layers into convolutions with kernels that are equal to their fixed input regions~\cite{long2015fully}. Such a network is called a Fully Convolutional Network (FCN). FCN operates on inputs of any size, and produces an output with reduced spatial dimensions~\cite{long2015fully}. The reduction in the spatial dimension is due to the presence of either pooling (VGG16) or convolutional (ResNets) layers with a stride greater than one pixel. In order to convert our Image Classification CNN (ResNet-101) into FCN we follow the recent line of work by Long et al.~\cite{long2015fully} and Chen et al.~\cite{chen2016deeplab} by removing the final average pooling layer and replacing the fully connected layer with a $1 \times 1$ convolutional layer. Doing so casts the network into FCN that takes input of any size and produces an output with predictions over a spatial grid of smaller resolution. This transformation is illustrated in Fig.~\ref{fig:fcn_and_dilated}b. Fully convolutional models deliver prediction maps with significantly reduced dimensions (for both VGG16 and ResNets, the spatial dimensions are reduced by a factor of $32$). In the previous work~\cite{long2015fully}, it was shown that adding a deconvolutional layer to learn the upsampling with factor $32$ provides a way to get the prediction map of original image dimension, but the segmentation boundaries delivered by this approach are usually too coarse. To tackle this problem, two approaches were recently developed which are based on modifying the architecture. (i) By fusing features from layers of different resolution to make the predictions~\cite{long2015fully}. (ii) By avoiding downsampling of some of the feature maps~\cite{chen2016deeplab}~\cite{yu2015multi} (removing certain pooling layers in VGG16 and by setting the strides to one in certain convolutional layers responsible for the downsampling in ResNets). However, since the weights in the subsequent layers were trained to work on a downsampled feature map, they need to be adapted to work on the feature maps of a higher spatial resolution. To this end,~\cite{chen2016deeplab} employs dilated convolutions. In our work, we follow the second approach: we mitigate the decrease in the spatial resolution by using convolutions with strides equal to one in the last two convolutional layers responsible for downsampling in ResNet-101 and by employing dilated convolutions for subsequent convolutional layers (Sec. \ref{sec:dilated}). \subsection{Dilated Convolutions} \label{sec:dilated} In order to account for the problem stated in the previous section, we use dilated (atrous) convolution. Dilated convolution\footnote{We follow the practice of previous work and use simplified definition without mirroring and centering the filter~\cite{chen2016deeplab}.} in one-dimensional case is defined as $$ y[i] = \sum_{k=1}^{K}x[i + rk]w[k] $$ where, $x$ is an input 1D signal, $y$ output signal and $w$ is a filter of size $K$. The rate parameter $r$ corresponds to the dilation factor. The dilated convolution operator can reuse the weights from the filters that were trained on downsampled feature maps by sampling the unreduced feature maps with an appropriate rate. In our work, since we choose not to downsample in some convolutional layers (by setting their stride to one instead of two), convolutions in all subsequent layers are dilated. This enables initialization with the parameters of the original classification network, while producing higher-resolution outputs. This transformation follows~\cite{chen2016deeplab} and is illustrated in Fig.~\ref{fig:fcn_and_dilated}c. \subsection{Training} \label{Training} Given a sequence of images $\{ \textbf{I}_t \}^{n_t}_{t=0}$, and sequence of ground-truth segmentation annotations $\{ \textbf{A}_t \}^{n_t}_{t=0}$, we optimize normalized pixel-wise cross-entropy loss~\cite{long2015fully} using Adam optimization algorithm~\cite{kingma2014adam} with learning rate set to $10^{-4}$ ($n_t$ stands for the number of training examples). We choose the learning rate of $10^{-4}$ after performing a grid search over five different learning rates and found that $10^{-4}$ helps produce the best score on the validation dataset. Other parameters of Adam optimization algorithm were set to the values suggested in \cite{kingma2014adam}. \section{Experiments and Results} \begin{table} \centering \begin{tabular}{c|c|c|c} \toprule & Sensitivity & Specificity & \shortstack{Balanced \\ Accuracy}\\ \hline FCN-8s \cite{garciareal} & $87.8 \%$ & $88.7 \%$ & $88.3 \%$ \\ Our work & $85.7 \%$ & $98.8 \% $ & $\textbf{92.3\%}$ \end{tabular} \caption{\label{tab:comparison_table}Shows comparison of our results with previous state-of-the art~\cite{garciareal} in binary segmentation of robotic tools. Our method provides a 4\% improvement in balanced accuracy.} \end{table} We test our method on the MICCAI Endoscopic Vision Challenge's Robotic Instruments dataset. This dataset consists of four $45$-second 2D stereo image sequences with Large Needle Driver (LND) instruments in an ex-vivo setup that is used for training. Each pixel is labeled as either background, shaft or articulated head. The test data consists of four $15$-second sequences with similar background to training sequence. Two $1$-minute 2D image sequences of $2$ instruments in an ex-vivo setup are also in the test dataset. These sequences also contain tool that is not present in the training dataset. The sequences contain occlusions and articulations. \vspace{-4ex} \begin{figure} \centering \begin{subfigure}{0.24\linewidth}% \includegraphics[width=\linewidth]{img/binary_img_updated.png}% \vspace{0.9ex} \caption{}% \end{subfigure}% \begin{subfigure}{0.24\linewidth} \includegraphics[width=\linewidth]{img/binary_segmentation_updated.png} \vspace{-2ex} \caption{} \end{subfigure}% \begin{subfigure}{0.24\linewidth} \includegraphics[width=\linewidth]{img/multi_class_img_updated.png} \vspace{-2ex} \caption{} \end{subfigure}% \begin{subfigure}{0.24\linewidth} \includegraphics[width=\linewidth]{img/multi_class_segmentation_updated.png} \vspace{-2ex} \caption{} \end{subfigure} \vspace{-2ex} \caption{Figure shows some qualitative results from our method. (a) and (c) show example image frames from the dataset. (b) shows the binary segmentation output of the image in (a). (d) shows the multi-class segmentation output of the image in (c).} \label{fig:qual} \vspace{-5ex} \end{figure} \subsection{Results} \begin{table} \centering \begin{tabular}{c|c|c|c|c} \toprule & C1 & C2 & C3 & \shortstack{Overall\\Mean}\\ \hline Video 1 & 79.6 & 68.2 & 96.5 & 81.4 \\ Video 2 & 82.2 & 70.2 & 98.6 & 83.7 \\ Video 3 & 80.4 & 66.4 & 98.0 & 81.6 \\ Video 4 & 75.0 & 44.9 & 97.1 & 72.3 \\ Video 5 & 72.3 & 56.0 & 96.3 & 74.9 \\ Video 6 & 70.7 & 50.2 & 95.7 & 72.2 \end{tabular} \caption{\label{tab:iou} Table reports IoU results for the task of multi-class image segmentation. C1, C2 and C3 corresponds to Manipulator, Shaft, and Background, respectively.} \end{table} We report our results in Tab. \ref{tab:comparison_table} using standard metrics such as sensitivity and specificity and compare with the previous state-of-the-art \cite{garciareal} for the task of binary segmentation. We can see that our method outperforms the previous work by 4\%. We also report results using the Intersection Over Union (IoU) metric for the task of multi-class segmentation in Tab. \ref{tab:iou}. IoU is a standard metric used for quantifying segmentation results \cite{everingham2010pascal}. To the best of our knowledge, we are the first to report segmentation results on the multi-class segmentation task on this dataset. Fig. \ref{fig:qual} shows some qualitative results for both the binary segmentation and the multi-class segmentation tasks. \section{Discussion and Conclusion} In this work, we propose a method to perform robotic tool segmentation. This is an important task, as it can be used to prevent rendered overlays from occluding the instruments or to estimate the pose of a tool~\cite{allan2014d}. We use deep network to model the mapping from the raw images to the segmentation maps. Our use of a state-of-the-art deep network (ResNet-101) with dilated convolutions helps us achieve 4\% improvement in binary tool segmentation over the previous stat-of-the-art. In addition, we extend the binary segmentation task to multi-class segmentation task (segmenting out tool parts). We are the first to do this on the MICCAI Endoscopic Vision Challenge's Robotic Instruments dataset. Our results show the benefit of using deep residual networks for this task and also provide a solid baseline for future work on multi-class segmentation. \bibliographystyle{plain}
{'timestamp': '2017-03-28T02:01:16', 'yymm': '1703', 'arxiv_id': '1703.08580', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08580'}
arxiv
\subsection{The \sigsel/ problem} \label{sec:sigsel} \begin{definition} In the problem \sigsel/, one is given a decision problem $u$ and information structure on $n$ signals $A_1,\dots,A_n$; and also a family $\mathcal{F}$ of feasible subsets of signals $S \subseteq \{1,\dots,n\}$. The goal is to select an approximately optimal $S \in \mathcal{F}$, \emph{i.e.} to \[ \max_{S \in \mathcal{F}} ~~ \V\left(\bigjoin_{i \in S} A_i \right) . \] \end{definition} For instance, suppose that an agent has a budget constraint of $B$ and each piece of information has a price tag; how to select the set that maximizes utility subject to the budget constraint? (This is also known as a knapsack constraint.) The \sigsel/ problem is not yet well-defined because we have not described how the input is represented. In general, the decision problem may be hard to optimize, and the prior distribution may have support $2^{\Omega(n)}$. Because we want to abstract out the complexity of \sigsel/ independently of the difficulty of these problems, we will assume an efficiently-queryable input. The outline for our approach is as follows, pictured in Figure \ref{fig:sigsel-approach}. \begin{itemize} \item For positive results, we require an input representation that allows efficient computation of $\V\left(\bigjoin_{i\in S} A_i \right)$ for some subset $S$ of signals. In Section \ref{sec:computing-V}, we will discuss several such representations. The most natural of these we call the \emph{oracle model}. \item For negative results, we will reduce a hard problem -- maximization of arbitrary monotone set functions given a value oracle -- to \sigsel/. The reduction will produce instances of \sigsel/ having a very concise and tractable input representation: The signals $A_1,\dots,A_n$ will be independent uniformly random bits, the event $E$ will be the vector $(A_1,\dots,A_n)$, and the decision problem will be immediately computable, just requiring transparent calls to the value oracle of the original maximization problem. This implies that any algorithm that can solve \sigsel/, under any ``reasonable'' model of input (particularly the oracle model and others we describe), can solve the instances produced by our reduction. \end{itemize} Note that an oracle-based approach is very general because, if we do have an instance where the input is concise and given explicitly, for example, the decision-problem optimizer is given as a small circuit, then we can just run our algorithms treating this input as an oracle, evaluating it when necessary. We next discuss input representations for positive results, including describing the oracle model. We will then give our positive and negative results. \paragraph{Monotone set function maximization.} Our results will involve relating complexity of \sigsel/ to that of maximizing some $f: 2^N \to \mathbb{R}$ where $N = \{1,\dots,n\}$ is a finite ground set. The fact that $\V$ is increasing, \emph{i.e.} more information always helps, implies that we restrict to monotone increasing $f$: If $S \subseteq T$, then $f(S) \leq f(T)$. Recall that submodular $f$ correspond to substitutable items, while supermodular $f$ correspond to complements. In set function maximization, the input is often given as a \emph{value oracle} that, when given a subset $S \subseteq N$, returns in one time step $f(S)$. When $f$ is submodular, it is known that polynomial-time constant-factor approximation algorithms exist for many types of constraints. For instance, there are efficient $(1-1/e)$-approximation algorithms under the knapsack constraint described above~\citep{sviridenko2004note,krause2005note} and more general \emph{matroid} constraints~\citep{calinescu2011maximizing}. On the other hand, in general set function maximization is known to be difficult information-theoretically, requiring exponentially-many oracle queries to obtain a nontrivial approximation factor even when restricting to monotone supermodular functions; we give an example in Proposition \ref{prop:max-monotone-supermodular}. \begin{figure}[ht] \caption{Input representations and structure of results.} \label{fig:sigsel-approach} \centering \begin{subfigure}{0.9\linewidth} \includegraphics[width=\linewidth]{fig-algpos} \caption{The structure of our positive algorithmic results. Black arrows represent logical implication. Given input represented in the oracle model, or some similar models, $\V$ can be efficiently computed. We then show that this, along with the substitutes assumption, implies efficient algorithms for \sigsel/ for a variety of types of constraints, such as knapsack constraints.} \end{subfigure} \vspace{3em} \begin{subfigure}{0.9\linewidth} \includegraphics[width=\linewidth]{fig-algneg} \caption{The structure of our negative algorithmic results: a reduction to \sigsel/ from maximizing a monotone set function, given as a value oracle, under a set of constraints. Black arrows represent an algorithmic reduction. Given the value oracle, we construct a utility function and information structure. These are very concise and simple, allowing immediate computation of $\V$. Any algorithm for \sigsel/ that can accept this kind of input representation will then give a solution to the original maximization problem.} \end{subfigure} \end{figure} \subsubsection{The oracle model and computing \texorpdfstring{$\V$}{V}} \label{sec:computing-V} Here, we investigate the computation of $\V$, the value function. We restrict attention to evaluating $\V$ at a set of signals, \emph{i.e.} the join $\bigjoin_{i\in S} A_i$ of a subset $S$ of signals. The reason is that this case is sufficient for our positive results and is most compelling for \sigsel/. Furthermore, no difficulty arises in how the input signal is represented, as it can always be given by a subset $S$ of $\{1,\dots,n\}$. We begin with a case where the decision problem is specified by an oracle, but the prior $p$ is given explicitly. Because $p$ may be exponentially large in $n$, the number of signals, we will later introduce an oracle model for $p$ as well. \begin{proposition} \label{prop:compute-V-big} For any decision problem and set of signals $A_1,\dots,A_n$, given an oracle for computing the associated convex $G$, we can compute $\V(\bigjoin_{i \in S} A_i)$ in time polynomial in $n$, $\prod_i |\text{Support}(A_i)|$ and $|\text{Support}(E)|$. (This is the size of the problem in general, as the prior distribution ranges over this many outcomes $(e,a_1,\dots,a_n)$.) \end{proposition} \begin{proof} We assume an oracle that computes $G(q)$ for any distribution $q$ on $E$. Note that $G(q) = \max_d \E \left[ u(d,e) \mid e \sim q\right]$, so this is equivalent to assuming an oracle for the utility of the optimal decision for a given distribution on $E$. We need to calculate \[ \V\left(\bigjoin_{i\in S} A_i\right) = \E_{\{a_i : i \in S\}} G(p_{a_i : i \in S}) . \] Here, the expectation is over all realizations $\{a_i : i \in S\}$ of the set of signals $\{A_i : i \in S\}$, and $p_{a_i : i \in S}$ is the posterior distribution on $E$ conditioned on that set of realizations. There are at most $\prod_{i\in S} |\text{Support}(A_i)|$ terms in the sum, and each posterior $p_{a_i : i \in S}$ can be computed as follows: \[ p(e | a_i : i \in S) = \frac{p(e, a_i : i \in S)}{p(a_i : i \in S)} , \] for each $e$ in the support of $E$. This can be computed in time polynomial in the products of the support sizes. \end{proof} In general, the running time of Proposition \ref{prop:compute-V-big} is exponential in $n$, the number of signals. This is unavoidable in general as the input itself may be this large (the prior distribution ranges over exponentially many events). Thus, it is natural to suppose that the input is given as an oracle in some fashion, making the input succinct. We define a natural model, give the associated positive result, and discuss possible variants or weakenings. \begin{definition} In the \emph{oracle model} for representing a decision problem $u$ and prior $p$, one is given: \begin{enumerate} \item An oracle computing the prior probability of any realization of any subset of signals. \item Access to independent samples from the prior distribution. \item An oracle computing, for a distribution $q$ on $E$, the expected optimal utility obtainable given belief $q$, namely $G(q)$. \end{enumerate} \end{definition} \begin{proposition} \label{prop:compute-V-small} In the oracle model, we can approximate $\V(\bigjoin_{i\in S} A_i)$ to arbitrary (additive) accuracy with arbitrarily high probability in time polynomial in $n$, $\sum_i \log |\text{Support}(A_i)|$, and $|\text{Support}(E)|$. \end{proposition} \begin{proof} For any given $S$, we would like to approximate \[ \V\left(\bigjoin_{i\in S} A_i\right) = \E_{\{a_i : i \in S\}} G(p_{a_i : i \in S}) \] up to an additive $\epsilon$ error with probability $1-\delta$. We can abstract this problem as computing $\E Z$, with $Z$ is distributed as $G(p_{a_i : i \in S})$ where $\{a_i : i \in S\}$ is drawn from the prior. Letting $K = \max_q G(q) - \min_q G(q)$ over all $\{q = p_{a_i : i \in S} : S \subseteq \{1,\dots,n\}\}$, we can apply a standard Hoeffding bound: The average of $m$ i.i.d. realizations of $Z$ is within $\epsilon$ of the true average with probability $1-\delta$ as long as $m$ exceeds $\frac{K^2\ln(2/\delta)}{2\epsilon^2}$. To see that we can in fact sample $Z$: We simply draw one sample from the prior, giving us $\{a_i : i \in S\}$. We compute the posterior conditioned on this sample as follows: For each outcome $e$ of $E$, we have \[ p_{a_i : i \in S}(e) = \frac{p(e, \{a_i : i \in S\})}{p(\{a_i : i \in S\})} . \] This requires two calls to the prior computation oracle; then a call to the oracle for $G$ completes the calculation. The running time analysis simply observes that each signal realization $a_i$ requires only $\log|\text{Support}(A_i)|$ bits to represent, and there are $n$ of them; similarly for outcomes of $E$. \end{proof} One would like to make weaker assumptions. However, dropping either the assumption of independent samples or the oracle seems problematic. Without samples, evaluating $\E G(p_{a_i : i \in S})$ seems difficult because this is a sum over exponentially many terms, and we cannot \emph{a priori} guess which terms are ``large'' or where to query the oracle for the prior. With independent samples but no oracle for marginal probabilities, na\"{i}ve approaches break down because of the difficulty of accurately estimating conditional probabilities $p(e | \{a_i : i \in S\})$. For instance, it may be that each outcome $\{a_i : i \in S\}$ is very unlikely, so that one cannot draw enough samples to accurately estimate the desired conditional probability using the ratio $p(e, \{a_i : i \in S\}) / p(\{a_i : i \in S\})$. It is also of note that any distribution over the possible outcomes of the signals and of $E$, including the prior itself, in general has size $|\text{Support}(E)| \cdot \prod_{i=1}^n |\text{Support}(A_i)|$, which is exponential in $n$. So one must avoid writing down such distributions; and any small sketch seems to quickly lose accuracy in estimating the conditional probability, which is computed from probabilities on events (and again, these probabilities may all be exponentially small even while conditional probabilities are large). We give two further examples of how to overcome this difficulty. The first is to assume that the prior is tractable in some way; in our case, sparse. The second is to push the difficulties mentioned into an oracle of a different sort. \begin{proposition} \label{prop:compute-V-small-sparse} Suppose we are given access to an oracle for $G$ explicitly given the prior $p$; and suppose that the prior is \emph{sparse}, supported on $k$ possible outcomes $(e, a_1,\dots, a_n)$. Then we can compute $\V(\bigjoin_{i\in S} A_i)$ in time polynomial in $n$ and $k$. \end{proposition} \begin{proof} We can now assume that the prior is explicitly given as part of the input. The expectation in the definition of $\V$ is now a sum that ranges over only at most $k$ terms. For each term, corresponding to some subset $\{a_i : i \in S\}$, we can efficiently look up $p(a_i : i \in S)$, as well as (for each $e$) $p(e,\{a_i : i \in S\})$, allowing us to compute the conditional probability $p(e \mid a_i : i \in S)$. (Recall that our notation $p_{a_i : i \in S}$ is simply the vector of these probabilities, ranging over outcomes $e$ of $E$.) These are all the ingredients we need to evaluate each term in the sum, which is $p(a_i : i \in S) \cdot G(p_{a_i : i \in S})$. \end{proof} \begin{proposition} \label{prop:compute-V-small-oracle} Suppose we are given access to the following: \begin{enumerate} \item A \emph{decisionmaking oracle} that, given a subset of signal realizations, returns an optimal decision $d^*$; and \item an oracle for evaluating the utility $u(d,e)$ of decision $d$ when nature's event $E=e$; and \item access to independent samples of $(e,a_1,\dots,a_n)$ from the prior distribution. \end{enumerate} Suppose that $u(d,e)$ is bounded. Then we can approximate $\V(\bigjoin_{i\in S} A_i)$ to arbitrary (additive) accuracy with arbitrarily high probability in time polynomial in $n$ and $\sum_i \log |\text{Support}(A_i)|$ and $\log |\text{Support}(E)|$. \end{proposition} \begin{proof} Again, given $S$, we wish to approximate $f(S)$, which is equal to \[ \V(\bigjoin_{i\in S} A_i) = \E_{e,a_1,\dots,a_n} u(d^*(a_i : i \in S), e) , \] where $d^*(a_i : i \in S)$ is the optimal decision conditioned on observing signals $\{a_i : i \in S\}$. Again, assuming that $u(d,e)$ lies in a bounded range of size $K$, the same Hoeffding bound applies: By drawing $m$ i.i.d. samples from the prior and then calling the oracles to obtain $d^*$ and $u$, we can approximate this expectation to arbitrary additive error with arbitrarily high probability, for a suitable (polynomial-sized) $m$. \end{proof} This range of results gives some evidence that in general, if the decision problem has some sort of succinct representation outside of the oracle model, then we may still hope to compute $\V$. In fact, the problem we will construct for our negative result, Theorem \ref{thm:f-to-sigsel}, will fit the model of Proposition \ref{prop:compute-V-small-oracle}, where it is trivial to find and evaluate the optimal decision. \subsubsection{Positive and negative results via reductions} \paragraph{Positive results.} As a corollary of the above reductions, we are able to reduce \sigsel/ to set function maximization, netting positive results especially in the case of substitutes. \begin{theorem} \label{thm:alg-subs-pos} \thmalgsubspos \end{theorem} \begin{proof} Given an instance of \sigsel/ with signals $A_1,\dots,A_n$, we construct a monotone increasing set function $f: 2^{\{1,\dots,n\}} \to \mathbb{R}$ via $f(S) = \V(\bigjoin_{i\in S} A_i)$. If signals are weak substitutes, then $\V$ is submodular on the signal lattice, and hence $f$ is submodular (as well as monotone). We can therefore apply known algorithms for submodular maximization, in particular, \citet{nemhauser1978analysis, sviridenko2004note, calinescu2011maximizing}. Now, there is a subtlety: Under some of the models we propose, particularly the oracle model, we do not compute $f$ exactly but instead can only guarantee arbitrarily high accuracy with arbitrarily high probability. However, it is well known (\emph{e.g.} \citet{kempe2003maximizing}) and proven (\emph{e.g.} \citet{krause2005note}), that these algorithms still give guarantees when we have a high-probability, high-accuracy guarantee on evaluations of $f$. The key point is that we can still evaluate, with arbitrary accuracy, the gradient or marginal contributions of each element\footnote{Recent work (in preparation) considers the question of how much accuracy in evaluating $f$ is required, showing negative results when (roughly) accuracy is worse than $\frac{1}{\sqrt{n}}$; but under the oracle model we can evaluate $f$ with error an arbitrary inverse polynomial with only an exponentially-small probability of error (simply via a Hoeffding bound), in which regime it is well-known that this problem does not arise.}. \end{proof} \paragraph{Discussion of approximate oracles.} One would like a robustness guarantee of the following sort: Even if we do not have an oracle that exactly optimizes the decision problem, suppose we do have an oracle returning, say, a decision whose expected utility is within a constant factor of optimal. Then give a good algorithm for \sigsel/ in the substitutes case, with an appropriately-decreased guarantee. Unfortunately, it seems that this kind of result is unlikely without deeper investigation and further work. To see the challenge, imagine that an adversary is allowed to design the oracle subject to a constraint of some approximation ratio. Then our problem essentially reduces to submodular maximization with noisy or approximate value oracles, where the noise may be adversarially chosen subject to this approximation constraint. Unfortunately, recent work on these kinds of problems have shown them to be difficult in general~\citep{singer2015information,balkanski2015limitations,hassidim2016submodular}. This seems like a very difficult barrier, but perhaps future work can leverage the structure of decision problems in some way to make progress in this direction. \paragraph{Negative results.} We show that in general, \sigsel/ is as difficult as optimizing general monotone set functions subject to constraints. In fact, this holds even for an easy special case of \sigsel/ where all signals are independent uniformly-random bits and the decision problem is trivial to optimize (the solution is essentially to list all of the outcomes of signals you have observed). To do so, we give a reduction in the opposite direction: Given $f$, we construct a decision problem and prior distribution such that $\V(\bigjoin_{i\in S} A_i) = f(S)$. Hence, any algorithm for \sigsel/ gives an algorithm for optimizing $f$. In terms of input representation, while $f$ may require exponential space to represent explicitly, our reduction is essentially as useful as one could hope for in this respect, creating a trivial wrapper around a value oracle for $f$. It seems that any reasonable algorithm one might propose for optimally selecting sets of signals should be able to handle such a tractable input. Hence, this is a strong negative result that, in general, optimization over signal sets is just as hard as over item sets. \begin{theorem} \label{thm:f-to-sigsel} \thmftosigsel \end{theorem} \begin{proof} Each signal $A_i$ will be a uniform independent bit, and the event $E$ of nature will consist of the vector of realized $a_i$s (a binary string of length $n$). Intuitively, the idea is that having observed $A_i$, regardless of whether its realization is $0$ or $1$, corresponds to having item $i$ in the set $S$, while not having observed $A_i$ (hence having a uniform belief over $A_i$) corresponds to $i \not\in S$. The decision problem will look like a scoring rule, but it will be for predicting the \emph{mean} of $E$ rather than predicting a probability distribution over $E$. This is good news in terms of the representation size: predicting the mean of $E$ requires only reporting a vector in $[0,1]^n$, while a general probability distribution over all outcomes of $E$ has support size up to $2^n$. Formally, it turns out that the scoring rule characterization applies equally well to constructing proper rules for predicting the mean of a random variable such as $E$. Specifically, given any convex function $F: \mathbb{R}^n \to \mathbb{R}$, one can construct a scoring rule $R: \mathbb{R}^n \times \mathbb{R}^n \to \mathbb{R}$. Using the notation $R(r;q) = \E_{e\sim q} R(r,e)$, we have the key scoring rule property that $R(r;q)$ is maximized at $r = \E_{e\sim q} e$, where it equals $F(\E_{e\sim q} e)$. A quick proof: Given $F$, define $R(r,e) = F(r) + \langle F'(r), e-r \rangle$ where $F'(r)$ is a subgradient at $r$. We have $R(\E_{e\sim q} e; q) = F(\E_{e\sim q} e)$ as desired. Now, note that $D_F(\E_{e\sim q} e;r) = F(\E_{e\sim q}) - R(r;q)$, where $D_F$ is the Bregman divergence of $F$; since Bregman divergences are nonnegative, this proves that $R(r;q)$ is maximized at $R(r;q) = R(\E_{e\sim q}; q) = F(\E_{e\sim q})$. Hence, the roadmap is as follows. \begin{enumerate} \item Construct a function $F: [0,1]^n \to \mathbb{R}$. \item Verify that $F$ is convex. This implies that there is a decision problem (namely, predicting the mean of $E$) where the expected utility for predicting $\mu$ when one's true expectation is $\mu$ equals $F(\mu)$. \item Verify that, for any subset $S$ of $\{1,\dots,n\}$ and for any set of realizations $\{a_i : i\in S\}$, we have $F(\E[e \mid a_i : i \in S]) = f(S)$. \item Note this implies that, for any $S$, we have $\V(\bigjoin_{i \in S} A_i) = f(S)$. \item Check that, given a value oracle for $f$, we can efficiently compute any quantities of interest (the posterior distribution on $E$, the posterior expectation of $E$, $F(\E[ e \mid a_i : i \in S])$, $\V(\bigjoin_{i \in S} A_i)$). \end{enumerate} \paragraph{(1)} The construction of $F$ is recursive on the dimension $n$. It is ugly, being discontinuous at its boundary. However, drawing some pictures should convince the reader that $F$ can be ``smoothed'' to a more reasonable, continuous convex function. For a base case of $n=1$, on $[0,1]$ we let $F(r) = f(\emptyset)$ on the interior where $r \in (0,1)$, and $F(0) = F(1) = f(\{1\})$. (That is, $f$ evaluated at the set consisting of the item.) Note that, because $f$ is monotone increasing, \emph{i.e.} $f(\{1\}) \geq f(\emptyset)$, $F$ is convex. The discontinuity implies that, for the associated proper scoring rule for the mean $R$, we must have $R(\mu,e) = -\infty$ whenever $\mu$ lies at an endpoint and $e$ is in the interior. But again, any smoothing of $F$ to be continuous will remove this property. On $[0,1]^n$, we let $F(r) = f(\emptyset)$ for $r$ in the interior of the hypercube. That is, $F$ is constant on its interior. Furthermore, we have $F(\E_{e\sim p} e) = f(\emptyset)$, where $p$ is the prior, hence $\V(\bot) = f(\emptyset)$. Now we define $F$ on its boundary. Consider any face of the $n$-dimensional hypercube. Each face corresponds to a particular setting of some $A_i$, either to $0$ or $1$, by the coordinate whose value is constant on that face. For instance, $A_i=1$ corresponds to the face consisting of the set of $r \in [0,1]^n$ where $r$'s $i$th coordinate equals one. On both of the faces corresponding to $A_i$, $F(r)$ is defined to be $F(r) = F_{\{i\}}(r_{-i})$, where $r_{-i}$ is $r$ with the $i$th coordinate removed, and the function $F_{\{i\}}$ is defined recursively as follows. Consider the set function $f_{\{i\}}: 2^{\{1,\dots,n\}\setminus\{i\}} \to \mathbb{R}$ with $f_{\{i\}}(S) = f(S \cup \{i\})$. Then let $F_{\{i\}}$ be the result of our construction applied to $f_{\{i\}}$. This completes the definition of $F$. Verbally, for each face of the hypercube, we have fixed some $i$ to be in the set $S$ passed to $f$, and considered the resulting submodular function $f_{\{i\}}$ on the remainder of $\{1,\dots,n\}$. The value of $F$ on the interior of that face will be $f(\{i\})$, by the recursive construction. To picture $F$ and convince ourselves that it is well-defined, consider the intersection of the faces corresponding to, say, $A_i = 1$ and $A_j = 0$. This is a lower-dimensional face consisting of all points on the hypercube whose $i$th bit equals $1$ and $j$th bit equals $0$. On the interior of this face (\emph{i.e.} no other bits are equal to $0$ or $1$), $F$ has value $f(\{i,j\})$. And so on all the way ``out'' to the corners $r$ of the hypercube, where $r \in \{0,1\}^n$; at all of these, $F(r) = f(\{1,\dots,n\})$. \paragraph{(2)} We prove $F$ is convex on the hypercube by induction on $n$, with the base case $n=1$ already observed above. For the inductive step, note again the key point: by monotonicity of $f$, if $r$ is on the boundary of the hypercube and $s$ is in the interior then $F(r) \geq F(s)$. Consider any two points $r,s \in [0,1]^n$, and break into cases. If both points lie in the interior, then because $F$ is constant there, $F(\alpha r + (1-\alpha)s) = \alpha F(r) + (1-\alpha)F(s)$ for any $0 \leq \alpha \leq 1$. If one point lies in the interior and one on the boundary, then any convex combination of the two lies in the interior. $F$ is constant in the interior and weakly larger on the boundary, so the convexity inequality is satisfied. If the points lie in different faces, then again any convex combination lies in the interior. Finally, if the points lie in the same face, then $F$ coincides with some $F_{\{i\}}$ on $r$ and $s$, and $F_{\{i\}}$ is convex by inductive hypothesis. \paragraph{(3)} We now verify that $F$, when applied to the expected value of $E$ given the realizations of signals corresponding to $S$, is equal to $f(S)$. Consider any set of realizations $\{a_i : i \in S\}$ and let $\mu = \E[e \mid a_i : i \in S]$. If $S = \emptyset$, then by construction $\mu = (0.5,\dots,0.5)$ and $F(\mu) = f(\emptyset)$. Otherwise, $\mu$ is the vector where each entry $i$ is equal to $a_i$ if $i \in S$ and $0.5$ otherwise; this follows from the i.i.d. distribution of the $A_i$. Hence, $\mu$ lies in the interior of the (low-dimensional) face of the hypercube corresponding to the realizations $\{a_i : i \in S\}$, hence $F(\mu) = F_{S}(\mu_{-S}) = f_S(\emptyset) = f(S)$. Here the notation $f_S$ is the function obtained from $f$ by fixing $S$; $F_S$ is the corresponding recursively constructed function on $[0,1]^{n-|S|}$; and $\mu_{-S}$ is $\mu$ obtained by removing all coordinates. \paragraph{(4)} Use the notation $\mu_{a_i : i \in S} = \E_e \left[ e \mid a_i : i \in S\right]$. Since step (3) holds for all realizations of a given set of signals, in particular (where $R$ is the scoring rule corresponding to $F$): \begin{align*} \V\left(\bigjoin_{i \in S} A_i\right) &= \E_{a_i : i \in S} \max_{d \in [0,1]^n} \E_e \left[ R(d,e) \mid a_i : i \in S \right] \\ &= \E_{a_i : i \in S} \max_{d \in [0,1]^n} R(d ; p_{a_i : i \in S}) & \text{definition of notation $R(d;q)$} \\ &= \E_{a_i : i \in S} R(\mu_{a_i : i \in S} ; p_{a_i : i \in S}) & \text{properness of $R$} \\ &= \E_{a_i : i \in S} F(\mu_{a_i : i \in S}) & \text{construction of $F$ and $R$} \\ &= \E_{a_i : i \in S} f(S) & \text{step (3) of proof} \\ &= f(S) . \end{align*} \paragraph{(5)} Given any set of signals $S$, one can immediately compute $\V(S) = f(S)$ by a call to the value oracle for $f$. Given their realizations $\{a_i : i \in S\}$, the posterior distribution is simply uniform on those $A_j$ with $j \not\in S$ (and of course has each $A_i = a_i$ with probability one for $i \in S$). This induces the posterior distribution over $E$ (which can thus be concisely represented, even though there are $2^n$ possible outcomes in general), as well as the posterior expectation of $E$. Evaluating $F(r)$ at an arbitrary point $r$ can be done quickly: Let $S$ be the subset of coordinates on which $r$ is equal to either $0$ or $1$; then $F(r) = f(S)$, as $r$ lies on the interior of a face corresponding to $S$. This requires just a single call to the oracle for $f$. Evaluating $R(d,e)$ can thus be done in time polynomial in $n$ as well; the only additional step required is picking a subgradient of $F$ at each point $d \in [0,1]^n$, and there is only one choice at each point (as noted above, unless $F$ is smoothed, this construction does require $R(\mu,e) = -\infty$ if $\mu$ lies on a face and $e$ in the interior). Finally, the optimal decision for a given expectation of $e$ is just that expectation. \end{proof} \paragraph{Explicit negative results.} First, our reduction has implications even for the substitutes case. Monotone submodular maximization to a better factor than $1-1/e$, even under a simple cardinality constraint, requires an exponential number of value-oracle calls~\citep{nemhauser1978best} and, even given a concise explicit input, is NP-hard~\citep{feige1998threshold}. Because our reduction preserves marginal values, a submodular set function reduces via Theorem \ref{thm:f-to-sigsel} to weak substitutes. This implies that our $(1-1/e)$ approximation cannot be improved without a stronger assumption than substitutability (or \emph{e.g.} a polynomial-time algorithm for SAT). \begin{corollary} \label{cor:subs-better-approx-hard} Even when signals are weak substitutes with a cardinality constraint, achieving a strictly better approximation than $1-1/e$ to \sigsel/ requires an exponential number of oracle queries. \end{corollary} Without the substitutes/submodularity condition, it is well known that maximizing general monotone set functions is difficult given only a value oracle, although such negative results are not always explicit in the literature. For instance and for concreteness, one can even restrict to monotone supermodular functions and the simple problem of maximizing $f$ subject to a cardinality constraint (select any set $S$ of at most $k$ elements, for some given $0 \leq k \leq n$). In this case, there does not seem to be a negative result in the literature despite this hardness being well-known (see \citep{usul2016maximizing}), so we give an explicit one here to illustrate the challenge. \begin{proposition} \label{prop:max-monotone-supermodular} For any algorithm for monotone supermodular maximization subject to a cardinality constraint, if the algorithm makes a subexponential number of value queries, then it cannot have a nonzero approximation ratio. \end{proposition} \begin{proof} We construct a simple family of supermodular functions. Let $k$ be the cardinality constraint, \emph{i.e.} maximum cardinality of any feasible set. Let $f(S) = 0$ if $|S| \leq k$ and otherwise let $f(S) = |S| - k$. Pick one special set $S^*$ of size $k$, uniformly at random from such sets, and let $f(S^*) = 0.5$. Hence the optimal solution to the problem is to pick $S^*$ with solution value $0.5$. This function is supermodular: Given any element $i$, the marginal contribution of $i$ to $S$ is $0$ if $|S| < k-1$, then either $0.5$ or $0$ for $|S|=k-1$, then either $0.5$ or $1$ for $|S|=k$, then $1$ for $|S| > k$. Because this marginal contribution is increasing, $f$ is supermodular. Now any algorithm making subexponentially (in $k$) many queries cannot, except with vanishing probability, guess which set of size $k$ is $S^*$, so it will with probability tending to $1$ select some other set of size $\leq k$, which has solution value $0$. \end{proof} \begin{corollary} \label{cor:comps-alg-hard} \corcomplementsalghard \end{corollary} \subsubsection{Adaptive \sigsel/} We now define an adaptive version of the problem and show that substitutability implies positive results here as well. This problem has already been studied in very similar settings with a very similar approach by \citet{asadpour2008stochastic,golovin2011adaptive}. There is a significant difference in that these works aimed to maximize a set function over items in tandem with observations about those items. Our model is a significant generalization in that it considers arbitrary kinds of observations and an arbitrary decision problem. However, the goal of this section is not to claim originality or generality of solution, but only to demonstrate that this problem can also be viewed through the lens of substitutability. \begin{definition} In Adaptive \sigsel/, one is given a decision problem $u$ and information structure on $n$ signals $A_1,\dots,A_n$; and also a family $\mathcal{F}$ of feasible subsets of signals $S \subseteq \{1,\dots,n\}$. An algorithm for this problem is a policy that first selects a signal $i_1$ to inspect; then observes the realization of $A_{i_1}$; then depending on that realization, selects a signal $i_2$ to inspect, observing the realization of $A_{i_2}$, and so on. The algorithm must guarantee that the total set $S = \{i_1,i_2,\dots\}$ of signals selected is in $\mathcal{F}$. After ceasing all inspections, the algorithm outputs some decision $d$. The goal is to maximize $\E\left[ u(d,e) \right]$ over the distribution of signals and $E$ as well as any randomness in the algorithm. \end{definition} We note that the definition of \sigsel/ abstracted out the process of deciding an action $d$ given the realizations of the signals, as we assumed that it was known how to optimize the utility function. Here, it seems cleaner to integrate the choice of the decision with the algorithm; but this is not the fundamental difference between the two settings. The fundamental difference is adaptivity: In Adaptive \sigsel/, the algorithm may observe the outcome of the first selected signal before deciding which signal to select next, and so on. Here we need a somewhat stronger substitutes condition. \begin{definition} \label{def:ptwise-subs} A set of signals on a subsets lattice $\Lat$ are \emph{pointwise weak substitutes} if, for each $A' \preceq A$ and $B$ in $\Lat$, and for each of the outcomes $a' \in A',a \in A$ in the support of the prior, letting $Q',Q$ be the posterior distributions conditioned on $A'=a'$ and $A=a$ respectively, \[ \V^{u,Q'}(B) - \V^{u,Q'}(\bot) \geq \V^{u,Q}(B) - \V^{u,Q}(\bot) . \] In other words, the left side is the marginal value of $B$ given the observation $a'$, and the right is its marginal value given observation $a$. \end{definition} Verbally, signals are pointwise substitutes if having observed more information never increases the expected marginal value of a signal. The key difference is that for ``regular'' substitutes, the condition can be written as follows: \[ \E_{a'} \left[ \V^{u,Q'}(B) - \V^{u,Q'}(\bot) \right] \geq \E_a \left[ \V^{u,Q}(B) - \V^{u,Q}(\bot) \right]. \] In other words, signals are substitutes if \emph{expecting} to observe more information never increases the expected marginal value; they are pointwise substitutes if observing more information never increases expected marginal value. Our goal here is to illustrate that techniques from submodular maximization extend naturally. We focus on the simple cardinality constraint case and show that the greedy algorithm for monotone submodular maximization~\citep{nemhauser1978analysis} also gives good guarantees in this adaptive setting, when we have a strong substitutes condition. \begin{algorithm} \caption{Greedy algorithm for Adaptive \sigsel/ under cardinality constraints.} \label{alg:adaptive-greedy} \begin{algorithmic}[1] \State{\textbf{Input:} Decision problem $u,E,A_1,\dots,A_n,p$, in oracle model; cardinality constraint $k$} \State{Let $S_0 = \emptyset$} \State{Let $q_0 = p$, the prior} \For{$t \in \{1,\dots,k\}$} \State{Let $i_t = \arg\max_{j\not\in S} \V^{u,q_{t-1}}(A_j)$} \State{Let $S_t = S_{t-1} \cup \{i_t\}$.} \State{Select $A_{i_t}$ and observe $a_{i_t}$} \State{Let $q_t$ equal the Bayesian posterior $p_{a_j : j \in S_t}$} \EndFor \State{\textbf{Output:} $\arg\max_d \E_{e\sim q_t} u(d,e)$} \end{algorithmic} \end{algorithm} \begin{theorem} \label{thm:adaptive-subs-pos} When signals are pointwise weak substitutes, Algorithm \ref{alg:adaptive-greedy} (Adaptive Greedy) obtains a $(1-1/e)$-approximation algorithm for Adaptive \sigsel/ under cardinality constraints in the oracle model. \end{theorem} \begin{proof} The usual proof essentially goes through. We utilize notation from Algorithm \ref{alg:adaptive-greedy} (adaptive greedy). The expected performance of $S_t$, the set constructed at time $t$, is $\V^{u,P}(S_t)$ (we use this notation as shorthand for evaluation at the join of all signals in $S_t$). Let $V^*$ be the expected performance of the optimal policy. We will upper-bound $V^*$ for each $t$ by the performance of a hypothetical algorithm that first selects $S_t$, then selects all $k$ of the signals selected by the optimal policy. For a fixed $S_t$, such a hypothetical algorithm can obtain, in expectation, at most the performance of $S_t$ plus $k$ times the maximum expected marginal contribution of any signal to $S_t$. This follows from pointwise substitutes: as the algorithm acquires more information, the expected marginal contribution of a signal does not increase. So, taking the expectation over this condition, which holds for each realization of $S_t$: \[ V^* \leq \V^{u,P}(S_t) + k \Big(\V^{u,P}(S_{t+1}) - \V^{u,P}(S_t)\Big) . \] This is exactly the inequality that produces the approximation ratio in submodular set function case. The inequality implies by induction that $\V^{u,P}(S_k) \geq \left(1 - \left(1-\frac{1}{k}\right)^k \right)V^*$, and this approximation ratio is always better than $1-1/e$. \end{proof} \subsection{Contributions and discussion} This paper makes two types of contributions. One type is to propose definitions of informational substitutes and complements and provide evidence that these definitions are natural, useful, and tractable. The other type is to prove concrete results for game-theoretic and algorithmic problems. These two contributions are interrelated: The concrete results rely on the definitions and characterizations of S\&C, while evidence in favor of the definitions comes from their utility in proving the concrete results. We begin with a summary of the contributions in terms of concrete results, then summarize the evidence in favor of our proposed definitions of informational S\&C. We then discuss future work in a variety of directions. \paragraph{Contributions independent of S\&C} The first application in this paper was to identify essentially necessary and sufficient conditions for the two types of prediction market equilibria that have been most studied: The ``good'' case where all traders rush to reveal information as soon as possible, and the ``bad'' case where all traders delay all revelation as long as possible. This result broadly generalizes previously-known special cases~\cite{chen2010gaming,gao2013jointly}. These conditions corresponded respectively to our definitions of informational substitutes and complements. Our other results regarding these definitions have implications and applications for the market setting. We gave some tools and approaches for identifying and designing substitutability, which (we showed) corresponds to the main goal of a market designer: encouraging immediate information revelation. We also gave some additional game-theoretic applications in other settings involving strategic information revelation and aggregation. We hope that future work can explore more connections. The second main application was to the algorithmic problem of information acquisition, which we formalized as the \sigsel/ problem. This is a very natural and general problem, capturing any sort of information acquisition scenario. We showed that substitutes imply efficient approximation algorithms via submodular maximization, offering a unifying lens or perspective on a variety of literature utilizing this approach. We also saw matching hardness in general when substitutability is not present. These results give hope that substitutable structure may be leveraged in future algorithmic investigations of related problems. \paragraph{Evidence for informational S\&C} Informational substitutes require much more background and work to define than their counterparts for goods, as discussed in Section \ref{sec:develop}. This leads to many ways in which the definition can ``get it wrong''. However, there are several reasons to believe that the definitions proposed in this paper are substantially on the right track. The three goals we address are showing that they are \emph{natural}, \emph{useful}, and \emph{tractable}. The evidence for these is summarized below; however, there is room for further investigation and discussion on the subtleties of the proposed definitions. As additional future applications are investigated, it may be found that tweaks in the definition improve it along these axes. \paragraph{Natural.} The following evidence suggests that the definitions of informational S\&C presented in this paper are natural. \begin{itemize} \item They are defined in terms of sub- and super-modular lattice functions, sharing this property with widely accepted definitions of S\&C for items. The weak, moderate, and strong versions of the definitions correspond to lattices have natural interpretations both game-theoretically -- strategies that are binary, deterministic, or randomized -- and algorithmically, optimizing over subsets, deterministic ``poolings'', or randomized ``garblings''. \item They can be alternatively characterized information-theoretically, by diminishing (increasing) amount of information revealed by a signal. \item They can be alternatively characterized geometrically, by the distance a belief is moved by a posterior update on one signal given the other. \item S\&C respectively characterize ``all-rush'' and ``all-delay'' equilibria in prediction markets. Hence, our definitions (or very close variants) seem unavoidable when studying equilibria of these basic models of strategic play. \item The algorithmic complexity mirrors the now-familiar story in the case of items: approximately optimizing over substitutes can be done efficiently (at least in the case of weak substitutes), while for the general case or complements the problem is difficult. \end{itemize} \paragraph{Useful.} The usefulness of the definitions, so far, is reflected by the results summarized above. In particular, they allowed resolving an open problem on strategic aggregation in prediction markets that was previously solved only for particular cases. \paragraph{Tractable.} Our definition of informational S\&C refers to a very general setting of decision problems and information structures. It is not initially clear that a definition that broadly captures S\&C can also be amenable to analysis or intuition. This particularly presents a challenge for our definitions because they depend on both the decision problem and the information structure, each of which can be a very complicated object. We presented a convexity-based approach, namely, studying the convex \emph{expected-utility} function $G$, and showed that it both captures geometric intuitions for understanding S\&C and gives useful analytic tools. One of these is prediction and the theory of proper scoring rules, which gives a way to construct a decision problem from any such convex $G$. We used these tools to give some example broad classes of informational S\&C as well as positive and negative results on designing decision problems to encourage substitutability or complementarity. We also gave intuitive definitions of informational S\&C from the perspectives of information theory (generalized entropies) and geometry (divergences). These found some formal applications already in this paper, \emph{e.g.} a convexity condition on the divergence definition of substitutes implies that all independent signals are substitutes. \subsection{Future work: game theory} An immediate direction is to extend our results to broader models of financial markets. We believe that analogous results are likely to hold. It would also be ideal, albeit esoteric, to understand the distinction between when Bayes-Nash equilibria and perfect Bayesian equilibria exist or are essentially unique. In a Bayes-Nash equilibrium that is not perfect Bayesian, some trader essentially makes a ``threat'' that is ``not credible''. Can such scenarios exist when signals are substitutes or complements? Many broader questions about S\&C have a direct implication on markets via our results, and we outline some of these directions below. For more general Bayesian games, the implications of our results are not yet clear. With multiple players, for instance, it is no longer true that more information always helps. It may be most tractable to look at special cases such as auctions or signaling games, although those seem to have a significant component of \emph{strategic} substitutes as well. One natural direction is common-value auctions, where in one case~\citep{milgrom1982value} informational substitutes have been explicitly used. \subsection{Future work: algorithms} There are many potential algorithmic questions raised by these definitions. One is to consider existing problems, such as algorithmic Bayesian persuasion~\citep{dughmi2015algorithmic} or signalling in auctions, through the lens of substitutability. However, such problems are already significantly more complex because of the interaction between the players, which is largely absent or abstracted out so far in this work. We hope that further investigation will uncover the connections to such settings. Meanwhile, one might ask whether, for instance, variants of \sigsel/ on the discrete or continuous lattice are well-motivated in any settings and, if so, whether they are tractable. More specifically and technically, one might ask whether the oracle model presented in this paper the best way to represent a decision problem, or if there is some other natural alternative beyond those we presented. Perhaps it is possible to obtain positive results with weaker or substantially different assumptions on the oracles. Another group of algorithmic questions relates to better understanding the definitions themselves. One concrete question is the following: Given a decision problem, perhaps in the oracle model (or some other well-justified model), determine whether signals are substitutes, complements, or neither. Or more strongly, given a decision problem and two signals $A,B$, find \[ \arg\min_{Q \preceq A} \V(Q \smallvee B) - \V(Q) . \] An algorithm for this problem and multi-signal generalizations would help identify substitutes or complements, and would more generally solve \emph{e.g.} the problem of how to trade in general prediction markets where signals are neither substitutes nor complements, but something in between. Many more possible algorithmic questions are likely to arise as investigation continues. \subsection{Future work: structure of S\&C} A straightforward direction for future work is to identify further classes of substitutes and complements, including natural classes of decision problems and information structures that together produce S\&C. This question also bears directly on the design of prediction markets. The second straightforward direction is how to ``design for substitutability''. We believe that our results give a good start in this direction, but many questions remain. For instance, can we characterize all universal substitutes and complements? (This characterizes cases where we cannot design for substitutability or complementarity.) And, in cases where we can make signals strict substitutes, can we design some natural and computationally efficient method for doing so? We hope that the geometric intuitions in this paper provide a starting point for addressing such questions. Finally, one could be interested in exploring variants of the definitions taking the same approach but with some piece of the puzzle substantially altered. Concretely, one could imagine a very risk-averse agent with an adversarial view of nature and some more combinatorial representation of information. Can one formulate analogous definitions in cases like these? \subsection{Setting: information structure and decision problems} \label{sec:setting} We now formally present the setting and definitions. Motivation for the choices made and relation to prior work, particularly \citet{borgers2013signals}, are described in depth in Section \ref{sec:develop}. \subsubsection{Model of information and decision problems} \paragraph{Information structure.} We take a standard Bayesian model of probabilistic information. There is a random event $E$ of interest to the decisionmaker, \emph{e.g.} $E \in \{\text{rain},\text{no rain}\}$. There are also $n$ ``base signals'' $A_1,\dots,A_n$, modeled as random events. These represent potential information obtained by a decision-maker, \emph{e.g.} $A_i \in \{\text{cloudy}, \text{sunny}\}$. An \emph{information structure} is given by $E$, $A_1,\dots,A_n$, and a prior distribution $P$ on outcomes $(e,a_1,\dots,a_n)$. For simplicity, we assume that all $A_i$ and $E$ have a finite set of possible outcomes. In addition to the base signals, there will be other signals that intuitively represent combinations of base signals. Formally, there is a set $\Lat$ of signals, with a generic signal usually denoted $A$ or $B$. Any subscripted $A_i$ always refers to a base signal, while $A$ may in general be any signal in $\Lat$. We will describe how $\Lat$ is generated from $A_1,\dots,A_n$ momentarily, in Section \ref{sec:lattices}. We will use lower-case $p$ to refer to probability distributions on $E$, the event of interest. The notation $p(e)$ refers to the probability that $E=e$, while $p(a_i,e) = \Pr[A_i=a_i, E=e]$, and so on. The notation $p(e | a_i)$ refers to the probability that $E=e$ conditioned on $A_i=a_i$, obtained from the prior via a Bayesian update: $p(e | a_i) = P(e,a_i) / P(a_i)$. We will sometimes use the shorthand notation $p_a$ to refer to the posterior distribution on $e$ conditioned on $A = a$, similarly for $p_{a,b}$ when $A=a$ and $B=b$, and so on. We will abuse notation and write $E$ to represent a set of outcomes, so for instance we may write $e \in E$; similarly for signals. We also sometimes write $\E_{a\sim A}\left[ \dots \right]$ for the expectation over outcomes $a$ of $A$. \paragraph{Decision problems and value function.} A single-agent \emph{decision problem} consists of a set of event outcomes $E$, a decision space $\D$, and a utility function $u: \D \times E \to \mathbb{R}$, where $u(d,e)$ is the utility for taking action $d$ when the event's outcome is $E=e$. This decision problem, in the context of an information structure, will be how signals derive their value. Specifically, given the prior $P$, the decision that maximizes expected utility is \mbox{$\arg\max_{d\in \D} \E_e u(d,e)$}. But now suppose a Bayesian, rational agent knows $P$ and will first observe the signal $A$, then update to the posterior $p_{a}$ on $E$, and then choose a decision maximizing expected utility for this posterior belief. In this case, her utility will be given by the following ``value'' function: \begin{equation} \V^{u,P}(A) := \E_a \left[ ~ \max_{d \in \D} ~ \E_e \left[ u(d,e) \mid A=a\right] ~ \right]. \label{eqn:def-value} \end{equation} We will use $\bot$ to denote a null signal, so that $\V^{u,p}(\bot)$ is the expected utility for deciding based only on the prior distribution. Where the decision problem and information structure are evident from context, we will omit the superscripts $u,P$. Intuitively, $\V^{u,P}$ is analogous to a valuation function $v: 2^{\{1,\dots,n\}} \to \mathbb{R}$ over subsets of items. However, inputs to $\V$ may not only represent subsets of $A_1,\dots,A_n$, but also signals that give partial information about them. \subsubsection{Signal lattices} \label{sec:lattices} We will consider three kinds of signal sets $\Lat$, leading to ``weak'', ``moderate'', and ``strong'' substitutes and complements. In each case, the set of signals $\Lat$ will form a lattice. \begin{definition} \label{def:lattice} A \emph{lattice} $(U,\preceq)$ is a set $U$ together with a partial order $\preceq$ on it such that for all $A,B \in U$, there are a \emph{meet} $A \smallwedge B$ and \emph{join} $A \smallvee B$ in $U$ satisfying: \begin{enumerate} \item $A \smallwedge B \preceq A \preceq A \smallvee B$ and $A \smallwedge B \preceq B \preceq A \smallvee B$; and \item the meet and join are the ``highest'' and ``lowest'' (respectively) elements in the order satisfying these inequalities. \end{enumerate} In a lattice, $\bot$ denotes the ``bottom'' element and $\top$ the ``top'' element, \emph{i.e.} $\bot \preceq A \preceq \top$ for all $A \in U$, if they exist. \end{definition} The following definition illustrates one very common lattice, that of subsets of a ground set. \begin{definition} \label{def:subsets-lattice} The \emph{subsets signal lattice} generated by $A_1,\dots,A_n$ consists of an element $A_S$ for each subset $S$ of $\{A_1,\dots,A_n\}$, where $A_S$ is the signal conveying all realizations $\{A_i = a_i : i \in S\}$. Its partial order is $A_S \preceq A_{S'}$ if and only if $S \subseteq S'$. Hence, its meet operation is given by set intersection and join by set union. \end{definition} The bottom element $\bot$ of the subsets lattice exists and is a null signal corresponding to the empty set (we will use this notation somewhat often), while the top element also exists and corresponds to observing all signals. Also, the partial ordering $\preceq$ denotes \emph{less informative}. These facts will continue to hold for the other two signal lattices we define. For the other two lattices, we utilize the main idea from the classic model of information due to \citet{aumann1976agreeing}. Let the set $\Gamma \subseteq A_1 \times \cdots \times A_n$ consist of all signal realizations $(a_1,\dots,a_n)$ in the support of the prior distribution. Now, a \emph{partition} is a collection of subsets of $\Gamma$ such that each $\gamma \in \Gamma$ is in exactly one subset. Each signal $A_i$ corresponds to a partition of $\Gamma$ with one subset for each outcome $a_i$, namely, the set of realizations $\gamma = (\cdots, a_i, \cdots)$. Example \ref{ex:aumann-partition}, given after the definition of discrete signal lattice, illustrates the partition model. As in Aumann's model, the partitions of $\Gamma$ form a lattice, each partition corresponding to a possible signal. The partial ordering is that $A \preceq B$ if the partition of $A$ is ``coarser'' than that of $B$. One partition is \emph{coarser} than another (which is \emph{finer}) if each element of the former is partitioned by elements of the latter. The join of two partitions is the coarsest common refinement (the coarsest partition that is finer than each of the two), while the meet is the finest common coarsening. Example \ref{ex:aumann-coarse}, given after the definition, illustrates coarsenings and refinements. \begin{definition} \label{def:discrete-lattice} The \emph{discrete signal lattice} generated by $A_1,\dots,A_n$ consists of all signals corresponding to partitions of $\Gamma$, where $\Gamma$ is the subset of $A_1 \times \cdots \times A_n$ with positive probability. Its partial order has $A \preceq B$ if the partition associated to $A$ is coarser than that of $B$. \end{definition} \begin{example}[Signals modeled as partitions] \label{ex:aumann-partition} \textit{(a)} We have two independent uniform bits $A_1$ and $A_2$. In this case $\Gamma = \{(0,0), (0,1), (1,0), (1,1)\}$. Here $A_1$ is modeled as the partition consisting of two elements: $\{(0,0),(0,1)\}$ and $\{(1,0),(1,1)\}$. The first element of the partition is the set of realizations where $A_1 = 0$, while the second is the set of realizations where $A_1 = 1$. \textit{(b)} Now modify the example so that $A_1$ and $A_2$ are perfectly correlated: with probability $0.5$, $A_1 = A_2 = 0$, and with probability $0.5$, $A_1 = A_2 = 1$. Here, $\Gamma = \{(0,0), (1,1)\}$ and $A_1$ corresponds to the partition consisting of $\{(0,0)\}$ and $\{(1,1)\}$. \textit{(c)} Now revisit the first case where $A_1$ and $A_2$ are independent. Imagine an agent who observes both base signals and wishes to reveal only the XOR $A_1 \oplus A_2$ of the bits. This new signal released by the agent, call it $A$, may also be modeled as a partition of $\Gamma$, where the elements of the partition are $\{(0,0),(1,1)\}$ and $\{(0,1),(1,0)\}$. \end{example} \begin{example}[The order given by coarsenings] \label{ex:aumann-coarse} \textit{(a)} We have a single signal $A_1$ which is distributed uniformly on $\{1,2,3,4,5,6\}$. Then $\Gamma = \{1, 2, 3, 4, 5, 6\}$ and $A_1$'s partition contains these six subsets: $\{1\},\{2\},\{3\},\{4\},\{5\},\{6\}$. \textit{(b)} Given the above information structure, suppose that an agent holding $A_1$ will commit to releasing some deterministic function of $A_1$. In terms of information revealed, the agent may map each realization $a_1 \in \{1,\dots,6\}$ to a different report -- this is the same as just revealing $a_1$ -- or she may map some realizations to the same report. Suppose that she reports ``small'' whenever $a_1 \in \{1,2,3\}$ and reports ``large'' whenever $a_1 \in \{4,5,6\}$. The information revealed by this report is captured by a binary signal $A$ corresponding to the partition with two elements: $\{1,2,3\}$ and $\{4,5,6\}$. The partition of $A$ is coarser than that of $A_1$, so $A \preceq A_1$ on the discrete lattice. \textit{(c)} Given the same information structure, imagine that the agent will commit to releasing ``even'' whenever $a_1 \in \{2,4,6\}$ and ``odd'' whenever $a_1 \in \{1,3,5\}$. This corresponds to a signal $B$ whose partition has these two elements and is again coarser than that of $A_1$. \textit{(d)} Consider the above two signals $A$ and $B$. They are incomparable: Neither is coarser nor finer than the other. The meet $A \smallwedge B$ will be the null signal\footnote{Formally, this is the signal whose partition contains a single element: all of $\Gamma$.} $\bot$, intuitively because given $A$, one cannot guarantee anything about the outcome of $B$. The join $A \smallvee B$ intuitively corresponds to observing both signals. Let $C = A \smallvee B$. The partition corresponding to $C$ has the following four elements: $\{1,3\}$, $\{2\}$, $\{4,6\}$, $\{5\}$. These each correspond to a realization of the signal $C$; call the realizations respectively $c_1,c_2,c_3,c_4$. Here, when for example $A =$ ``small'' and $B =$ ``even'', then $C = c_2$ and an observer of $C$ would know that $A_1 = 2$. When $A =$ ``large'' and $B =$ ``even'', then $C = c_3$ and an observer of $C$ would know that $A_1 \in \{4,6\}$, updating to a posterior on these possibilities. \end{example} \vspace{1em} For the third and strongest notion, we extend the model by, intuitively, appending randomness to the signals on the discrete lattice. Given any signal $A$ on the discrete lattice, a ``garbling'' of $A$ can be captured by a randomized function of $A$; but this may be modeled as a \emph{deterministic} function $s(A,r)$ where $r$ is a uniform $[0,1]$ random variable\footnote{In some applications, it may be more desirable to use an infinite string of independent uniform bits.}. This observation allows us to ``reduce'' to the deterministic case, but where each possible signal carries extra information in the form of some independent randomness. Specifically, let $\Gamma$ be defined as above (the subset of $A_1 \times \cdots \times A_n$ with positive probability) and, for each partition $\Pi$ of $\Gamma$, let $R_{\Pi} \in [0,1]$ drawn independently from the uniform distribution. Let $\Gamma' = \Gamma \times \mathbf{R}$ where $\mathbf{R} = \bigtimes_{\Pi} R_{\Pi}$. Now, we proceed as before, but using $\Gamma'$.\footnote{To be precise, we should restrict to measurable subsets using the Lebesgue measure on $[0,1]$. We will omit this discussion for simplicity; if concerned, the reader may alternatively assume that each $R_{\Pi}$ is drawn uniformly from a massive but finite set, with some tiny $\epsilon$ approximation carried through our results.} \begin{definition} \label{def:continuous-lattice} The \emph{continuous signal lattice} consists of a signal corresponding to each partition of $\Gamma'$. Its partial order has $A \preceq B$ if the partition associated to $A$ is coarser than that of $B$. \end{definition} \begin{example}[Modeling garblings via the continuous lattice] \label{ex:continuous-strategy} Consider a uniformly random bit $A_1$ as the only base signal; the resulting $\Gamma$ is $\{0, 1\}$. Now consider the garbling where, if $A_1 = 0$, then output ``happy'' with probability $q_0$ and ``sad'' otherwise; if it equals $1$, then output ``happy'' with probability $q_1$ and ``sad'' otherwise. Call the output of the garbling $A$. Then $A$ can be modeled as a partition of $\Gamma \times [0,1]$ with the following two subsets: $\{(0,x): 0 \leq x \leq q_0\} \cup \{(1,x): 0 \leq x \leq q_1\}$, and $\{(0,x) : q_0 < x \leq 1\} \cup \{(1,x) : q_1 < x \leq 1\}$. Here the first realization of $A$ corresponds to the output ``happy'', while the second corresponds to output ``sad''. To see this, note for instance that the first realization contains all the elements of $\Gamma \times [0,1]$ where $A_1 = 0$ and the randomness variable $x \leq q_0$. So when $A_1 = 0$, assuming $x$ is drawn uniformly and independently from $[0,1]$, then the outcome of $A$ is ``happy'' with probability $q_0$. On the continuous lattice, $A_1$ corresponds to the partition of singletons such as $\{(0,0.35142)\}$, $\{(1,0.92241)\}$, and so on. That is, it corresponds to observing both the original binary bit as well as the random real number $x$. Because this partition is finer than that corresponding to $A$, we have $A \preceq A_1$ on the continuous lattice. \end{example} The use of ``happy'' and ``sad'' for the outputs in the above example illustrates that it is not important, when considering the information conveyed by signal $A$, to consider what its realizations were \emph{named}. All that matters is their distributions, e.g. the partitions they represent. \begin{example}[Modeling garblings, continued] \label{ex:continuous-strategy-2} Again let $A_1$ be a uniformly random bit, and now suppose $A$ is obtained by adding to $A_1$ independent Gaussian noise with mean $0$ and variance $1$. In this case, intuitively, each outcome of $A$ (say $A=0.3$) represents two possibilities (such as $A_1 = 0$ and the Gaussian is $0.3$, or $A_1 = 1$ and the Gaussian is $-0.7$). $A$ can be modeled as a partition of $\Gamma \times [0,1]$ where $x \in [0,1]$ is interpreted as the quantile of the outcome of the Gaussian. Each member of the partition has two elements. These can be written $(0,x_0)$ and $(1,x_1)$ with $x_0 = \Phi(A)$ and $x_1 = \Phi(A-1)$, using the standard normal CDF $\Phi$. Given the realization $A=0$, the posterior distribution on $A_1$ is given by a Bayesian update depending on the probability density of the Gaussian at $0$ and at $-1$. \end{example} \subsection{The definitions of substitutes and complements} \label{sec:defs-subs-comps} We utilize a common notion of diminishing and increasing marginal value. For example, the idea of submodularity is that a lattice element $B$'s marginal contribution to $A$ should be smaller that to some $A' \preceq A$. \begin{definition} \label{def:sub-super-modular} \defsubsupermodular \end{definition} \begin{definition}[Weak Informational S\&C] \label{def:subs-comps} \defsubscompsweak \end{definition} For moderate and strong substitutes, we will use a strengthening of submodularity by requiring diminishing marginal value with respect to, respectively, all deterministic and randomized functions of a signal.\footnote{Previous versions of this paper used submodularity on the discrete and continuous signal lattices, which is a more restrictive definition. We only need this weaker definition for results in this paper, but in general both are interesting and the right choice may be context-dependent; or there could be other interesting variations.} \begin{definition}[Moderate and Strong Informational S\&C] \label{def:mod-strong-subs-comps} \defsubscompsmodstrong \end{definition} Verbally, S\&C capture that the more pieces of information one has, the less valuable (respectively, more valuable) $B$ becomes. The levels of weak, moderate, and strong capture the senses in which ``pieces of information'' is interpreted. Weak substitutes satisfy diminishing marginal value whenever a whole signal is added to a subset of signals. However, they do not give guarantees about marginal value with respect to partial information about signals. Moderate and strong substitutes respectively satisfy diminishing marginal value when deterministic (randomized) partial information about a signal is revealed. \begin{observation} Strong substitutes imply moderate substitutes, which imply weak substitutes. The same holds for complements. \end{observation} \begin{proof} The respective lattices are supersets, i.e. the continuous signal lattice is a superset of the discrete lattice which is a superset of the subsets lattice, and the partial orderings agree. So each substitutes definition requires $\V^{u,P}$ to satisfy a set of inequalities at various points, and in going from weak to moderate to strong substitutes, we simply increase the set of required inequalities that signals must satisfy. \end{proof} \begin{example}[Substitutes] \label{ex:one-bit-subs} The event $E$ is a uniformly random bit and the two signals $A_1 = E$ and $A_2 = E$. That is, both signals are always equal to $E$. The decision problem is to predict the outcome of $E$ by deciding either $0$ or $1$, with a payoff of $1$ for correctness and $0$ otherwise. In this case, one can immediately see that $A_1$ and $A_2$ are \emph{e.g.} weak substitutes, as a second signal never gives marginal benefit over the first. \end{example} \begin{example}[Complements] \label{ex:one-bit-comps} The event $E$ and decision problem are the same as in Example \ref{ex:one-bit-subs}, but this time $A_1$ and $A_2$ are uniformly random bits with $E = A_1 \oplus A_2$, the XOR of $A_1$ and $A_2$. In this case, $A_1$ and $A_2$ are immediately seen to be \emph{e.g.} weak complements, as a first signal never gives marginal benefit over the prior. \end{example} \begin{example}[Weak vs moderate] \label{ex:weak-but-not-moderate} Here is an example of weak substitutes that are not moderate substitutes. Intuitively, we will pair the previous two examples. The event $E$ consists of a pair $(E_b,E_c)$ of independent uniformly random bits. The decision problem is to predict both components of $E$, getting one point for each correct answer. Let the random variable $B_1 = E_b$ and $B_2 = E_b$. Let the random variables $C_1$ and $C_2$ be uniformly random bits such that $E_c = C_1 \oplus C_2$. Now, consider the signals $A_1 = (B_1,C_1)$ and $A_2 = (B_2,C_2)$. Intuitively, the first component of each signal completely determines $E_b$, while the second component gives no information about $E_c$ until combined with the other signal. Hence these signals intuitively have both substitutable and complementary internal structure. Consider the subsets lattice $\{\emptyset, \{A_1\}, \{A_2\}, \{A_1,A_2\}\}$. If we modify the decision problem such that predicting the first component of $E$ is worth $1+\epsilon$ points, then these signals are weak substitutes: Each alone is worth $1+\epsilon$ points, while together they are worth $2+\epsilon$ points. On the other hand, if we modify the decision problem such that the second component of $E$ is worth $1+\epsilon$ points, then these signals become weak complements for analogous reasons. On the other hand, these signals are neither moderate substitutes nor moderate complements. One way to see this is to consider ``coarsening'' $A_1$ into the signal $B_1$; this has diminishing marginal value when added to $A_2$. However, we could also coarsen $A_1$ into the signal $C_1$, which has increasing marginal value when added to $A_2$. \end{example} \subsection{Scoring rules and a revelation principle} \label{sec:revelation} We now introduce proper scoring rules and prove a useful ``revelation principle''. A \emph{scoring rule} for an event $E$ is a function $S: \Delta_E \times E \to \mathbb{R}$, so that $S(\hat{q},e)$ is the score assigned to a prediction (probability distribution) $\hat{q}$ when the true outcome realized is $E=e$. Define the useful notation $S(\hat{q};q) = \E_{e\sim q} S(\hat{q},e)$ for the expected score under true belief $q$ for reporting $\hat{q}$ to the scoring rule. The scoring rule is \emph{(strictly) proper} if for all $E,q$, setting $\hat{q} = q$ (uniquely) maximizes the expected score $S(\hat{q};q)$. In other words, if $E$ is distributed according to $q$, then truthfully reporting $q$ to the scoring rule (uniquely) maximizes expected score. A fundamental characterization of scoring rules is as follows: \begin{fact}[\cite{mccarthy1956measures,savage1971elicitation,gneiting2007strictly}] \label{fact:scoring-char} For every (strictly) proper scoring rule $S$, there exists a (strictly) convex function $G: \Delta_E \to \R$ with (1) $G(q) = S(q;q)$ and (2) \[ S(\hat{q},e) = G(\hat{q}) + \langle G'(\hat{q}), \delta_e - \hat{q} \rangle \] where $G'(\hat{q})$ is a subgradient of $G$ at $\hat{q}$ and $\delta_e$ is the probability distribution on $E$ putting probability $1$ on $e$ and $0$ elsewhere. Furthermore, for every (strictly) convex function $G: \Delta_E \to \R$, there exists a (strictly) proper scoring rule $S$ such that (1) and (2) hold. \end{fact} \begin{proof} Given any (strictly) convex $G$, we first check that the induced $S$ is (strictly) proper. Select a subgradient $G'(p)$ at each point $p$. The expected score for reporting $\hat{q}$ when $E$ is distributed according to $q$ is \begin{align*} S(\hat{q};q) &= \E_{e\sim q} S(\hat{q},e) \\ &= G(\hat{q}) + \langle G'(\hat{q}), q - \hat{q}\rangle \\ &\leq G(q) & \text{by convexity of $G$} \\ &= S(q;q) . \end{align*} Note that the inequality follows simply because, for any convex $G$, if we take the linear approximation at some point $\hat{q}$ and evaluate it at a different point $q$, this lies below $G(q)$. Furthermore, if $G$ is strictly convex, then this inequality is strict, implying strict properness. Now, given a (strictly) proper $S$, we show that it has the stated form. Define $G(q) = S(q;q)$. Note that $S(\hat{q};q) = \E_{e\sim q} S(\hat{q},e)$ is a linear function of $q$. By properness, each $G(q) = S(q;q) = \max_{\hat{q}} S(\hat{q};q)$. Since $G(q)$ is a pointwise maximum over a set of linear functions of $q$, $G$ is convex. If $S$ was strictly proper, then $G(q)$ was the unique maximum at every point, implying that $G$ is strictly convex. Now we claim that $S(q; \cdot)$ is a subtangent of $G$ at $q$: it is linear, equal to $G$ at $q$, and everywhere below $G$ by definition of $G$. So in particular $S(q,e) = S(q;\delta_e) = G(q) + \langle G'(\hat{q}), \delta_e - q\rangle$, as promised. \end{proof} \begin{figure}[ht] \centering \includegraphics[width=0.8\textwidth]{fig-scoringrule} \caption{Illustration of the connection between a scoring rule $S$ and $G$, its associated convex expected score function, for a binary event $E$ (Fact \ref{fact:scoring-char}). The $x$-axis is the probability that $E=1$. $S(\hat{q},e)$ is the score obtained for predicting $\hat{q}$ when $E=e$, while $S(\hat{q};q)$ is the expected score for predicting $\hat{q}$ when the believed distribution over $E$ is $q$. By the characterization, $S(\hat{q};q) = G(\hat{q}) + \langle G'(\hat{q}), q-\hat{q}\rangle$, which is pictured by taking the linear approximation to $G$ at $\hat{q}$ and evaluating it at $q$. Convexity of $G$ implies that this linear approximation is always below $G$, hence reporting truthfully is optimal. We return to this picture when discussing the relationship to Bregman divergences.} \label{fig:scoringrule} \end{figure} \begin{example} \label{ex:def-log-scoring-rule} The $\log$ scoring rule is $S(p,e) = \log p(e)$, \emph{i.e.} the logarithm (usually base $2$) of the probability assigned to the realized event. The expected score function is $\sum_e p(e) \log p(e) = -H(p)$, where $H$ is the Shannon entropy function. \end{example} Notice that a scoring rule is a special case of a decision problem: The utility function is the scoring rule $S$, $E$ is the event picked by nature, and the decision space $\D = \Delta_E$. We now show that in a sense, scoring rules capture \emph{all} decision problems. This is not surprising or difficult, and may have been observed prior to this work; but we formalize it because it captures a very nice and useful intuition. \begin{theorem}[Revelation principle] \label{thm:revelation} \theoremrevelation \end{theorem} \begin{proof} The idea of the proof, as suggested by the name, is simply for the agent to report her belief $q$ about $E$ to the scoring rule and for the scoring rule to simulate the optimal decision for this belief, paying the agent according to the utility derived from that decision. For a given distribution (``belief'') $q$ on $E$, let $d^*_q$ be the optimal decision, \emph{i.e.} $d^*_q = \arg\max_{d\in\D} \E_{e\sim q} u(d,e)$. Now, given $u,\D,E$, let \[ S(\hat{q},e) = u(d^*_{\hat{q}}, e). \] First let us show properness, \emph{i.e.} $S(\hat{q};q) \leq S(q;q)$. We have \begin{align*} S(\hat{q};q) &= \E_{e\sim q} S(\hat{q},e) \\ &= \E_{e\sim q} u(d^*_{\hat{q}}, e) \\ &\leq \E_{e\sim q} u(d^*_q, e) \\ &= \E_{e\sim q} S(q,e) \\ &= S(q;q) \end{align*} using the definition of $d^*_q$. Now let us check equivalence to the original problem. Let $q_a$ be the distribution on $E$ conditioned on $A=a$. We have \begin{align*} \V^{u,P}(A) &= \E_a \max_{d \in \D} \E_{e\sim q_a} u(d,e) \\ &= \E_a \E_{e\sim q_a} u(d^*_{q_a}, e) \\ &= \E_a \E_{e\sim q_a} S(q_a, e) \\ &= \E_a \max_{\hat{q}} \E_{e \sim q_a} S(\hat{q}, e) & \text{by properness} \\ &= \V^{S,P}(A) . \end{align*} \end{proof} This reduction is not necessarily computationally efficient, because the input $\hat{q}$ to the scoring rule is a probability distribution over $E$ which may have a large number of outcomes. We note two positives, however. First, the reduction does not necessarily need to be computationally efficient to be useful for proofs and analysis. Second, in any case where it seems reasonable to assume that the agent can solve her decision problem, which involves an expectation over possible outcomes of $E$, it seems reasonable to suppose that she can efficiently represent or query her beliefs. In this case we may often expect a computationally efficient reduction and construction of $S$. This is a direction for future work. The revelation principle (Theorem \ref{thm:revelation}) and scoring rule characterization (Fact \ref{fact:scoring-char}) together imply the following extremely useful fact about general decision problems. We do not claim originality for it; the idea can be found in \citet{savage1971elicitation} and similar ideas or statements are present in \emph{e.g.} \citet{frongillo2014general} and \citet{babaioff2012optimal}. But it is worth emphasizing because we will put it to extensive use in this paper. \begin{corollary} \label{cor:decision-captured-by-G} \cordecisioncapturedbyG \end{corollary} As an example of usefulness, we provide a concise proof of the following classic theorem. \begin{fact}[More information always helps] \label{fact:more-info-helps} In any decision problem, for any signals $A,B$, $\V(A \smallvee B) \geq \V(A)$. In other words, more information always improves the expected utility of a decision problem. In other words, $\V$ is a monotone increasing function on the signal lattices. \end{fact} \begin{proof} Recall that we are using the notation $p_{a_1}$ for the distribution on $E$ conditioned on $A_1=a_1$, and so on. In particular, $p_{a_1}$ is a vector, \emph{i.e.} $p_{a_1} = (p(e_1 | A_1=a_1), \dots)$. By the revelation principle, for some convex $G$ we have $\V(A_1) = \E_{a_1} G(p_{a_1})$, and \begin{align*} V(A_1 \smallvee A_2) &= \E_{a_1} \left[ \sum_{a_2} p(a_2|a_1) G(p_{a_1a_2}) \right] \\ &\geq \E_{a_1} G\left(\sum_{a_2} p(a_2|a_1) p_{a_1a_2}\right) & \text{by Jensen's inequality} \\ &= \E_{a_1} G(p_{a_1}) \\ &= \V(A_1) . \end{align*} To obtain the last equality: Each term in the sum consists of the scalar $p(a_2 | a_1)$ multiplied by the vector $p_{a_1a_2}$, and for each coordinate $e$ of the vector, we have $p(a_2|a_1)p(e|a_1,a_2) = p(e,a_2|a_1)$. Then $\sum_{a_2} p(e,a_2|a_1) = p(e|a_1)$. \end{proof} \subsection{Characterizations} \label{sec:characterizations} In this section, we show how the substitutes and complements conditions can be phrased using the convexity connection just derived. We will leverage this structure to identify characterizations or alternative definitions of substitutes and complements. For brevity, we will focus on substitutes, but in all cases the extension to complements is immediate. From Corollary \ref{cor:decision-captured-by-G}, we also get immediately the following characterization: \begin{definition}[Substitutes via convex functions] \label{def:subs-G} \defsubsG \end{definition} To be clear, our use of parentheses here means that we are giving three definitions: one for weak substitutes, where the condition must hold for all $A'$ on the subsets lattice; and analogously for moderate substitutes with the discrete lattice and strong substitutes with the continuous lattice. We view Definition \ref{def:subs-G} mostly as a tool, although it may convey some intuition on its own as well. Definition \ref{def:subs-G} will be pictured in Figure \ref{fig:divergencesubs} along with the final characterization. \subsubsection{Generalized entropies} \label{sec:defs-entropy} Here, we seek an alternative interpretation of the definitions of S\&C in terms of information and uncertainty. To this end, for any decision problem, consider the convex expected score function $G$ and define $h = -G$. Then $h$ is concave, and we interpret $h$ as a \emph{generalized entropy} or measure of information. The justification for this is as follows: Define the notation $h(E | A) = \E_{a\sim A} h(p_a)$, where $p_a$ is the distribution on $E$ conditioned on $A=a$. Then concavity of $h$ implies via Jensen's inequality that for all $E,A$, we have $h(E) \geq h(E|A)$. In other words, more information always decreases uncertainty/entropy. We propose that this is the critical axiom a generalized entropy must satisfy: If more information always decreases $h$, then in a sense it measures uncertainty, while if more information sometimes increases $h$, then it should not be considered a measure of uncertainty. However, admittedly, the appeal of this definition may increase by adding additional axioms as are common in the literature, such as maximization at the uniform distribution and value zero at degenerate distributions. Another very intriguing axiom would be a relaxation of the ``chain rule'' in either direction: $h(E | A)$ is restricted to be either greater than or less than $h(E,A) - h(A)$. (Note that the chain rule itself, $h(E|A) = h(E,A) - h(A)$, along with concavity, uniquely characterizes Shannon entropy.) Such axioms may have interesting consequences for informational S\&C. Examining the structure of S\&C under such axioms represents an intriguing direction for future work. \begin{figure}[ht] \centering \includegraphics[width=0.8\textwidth]{fig-entropysubs} \caption{Illustration of marginal improvement of signal $A$ over the prior, $\V(A) - \V(\bot)$, via the \emph{generalized entropy} definition used to characterize S\&C in Definition \ref{def:subs-entropy}. Here, the generalized entropy function $h$ captures a measure of uncertainty in a distribution over the binary event $E$. The marginal value of $A$ is $\V(A) - \V(\bot) = h(E) - h(E \mid A)$, the expected amount of information revealed about $E$ by $A$ (illustrated by the curly brace).} \label{fig:entropysubs} \end{figure} Under this interpretation, Definition \ref{def:subs-G} can be restated: \begin{definition}[Substitutes via generalized entropies] \label{def:subs-entropy} \defsubsentropy \end{definition} Intuitively, Definition \ref{def:subs-entropy} says this: Consider the expected amount of information about $E$ that is revealed upon learning $B$, given that some information will already be known. Use the generalized entropy $h$ to measure this information gain. Then substitutes imply that, the more information one has, the less information $B$ reveals. On the other hand, complements imply that, the more information one has, the \emph{more} information $B$ reveals. \begin{example} \label{ex:def-subs-entropy} Revisiting Example \ref{ex:one-bit-subs}, where $E$ was a uniform bit and $A_1=A_2=E$, imagine predicting $E$ against the $\log$ scoring rule. Our previous observations imply that here the generalized entropy function is Shannon entropy $H(q) = \sum_e q(e) \log \frac{1}{q(e)}$. We have $H(p) = 1$ and $H(E|A_1) = H(E|A_2) = H(E|A_1,A_2) = 0$, which already shows that $A_1$ and $A_2$ are weak substitutes. If we instead revisit Example \ref{ex:one-bit-comps}, where $A_1 \oplus A_2 = E$ with $A_1,A_2$ uniformly random bits, and again consider predicting $E$ according to the $\log$ scoring rule, then we see that $H(E) = H(E|A_1) = H(E|A_2) = 1$, while $H(E|A_1,A_2) = 0$, already proving that $A_1$ and $A_2$ are weak complements. \end{example} \subsubsection{Bregman divergences} \label{sec:defs-bregman} Given a convex function $G$, the \emph{Bregman divergence} of $G$ is defined as \[ D_G(p,q) = G(p) - \left(G(q) + \langle G'(q), p-q\rangle\right). \] In other words, it is the difference between $G(p)$ and the linear approximation of $G$ at $q$, evaluated at $p$. (See Figure \ref{fig:divergencesubs}.) Another interpretation is to consider the proper scoring rule $S$ associated with $G$, by Fact \ref{fact:scoring-char}, and note that $D_G(p,q) = S(p;p) - S(q;p)$, the difference in expected score when reporting one's true belief $p$ versus lying and reporting $q$. The defining property of a convex function is that this quantity is always nonnegative. This can be observed geometrically in Figure \ref{fig:scoringrule} as well; there $D_G(q,\hat{q}) = G(q) - S(\hat{q};q)$. This notion is useful to us because, it turns out, all marginal values of information can be exactly characterized as Bregman divergences between beliefs. \begin{lemma} \label{lemma:marginal-contribution-bregman} \lemmamarginalcontributionbregman \end{lemma} \begin{proof} \begin{align*} \V(A \smallvee B) - \V(A) &= \E_{a,b} G(p_{ab}) ~ - ~ \E_a G(p_a) \\ &= \E_{a,b} \left(G(p_{ab}) - G(p_a)\right) \\ &= \E_{a,b} \left(D_G(p_{ab}, p_a) - \langle G'(p_a), p_{ab} - p_a \rangle \right) \\ &= \E_{a,b} D_G(p_{ab}, p_a) ~ + ~ \E_a \langle G'(p_a), \sum_b p(b|a) \left(p_{ab} - p_a \right) \rangle \\ &= \E_{a,b} D_G(p_{ab}, p_a) \end{align*} because $\sum_b p(e|a,b) p(b|a) = p(e|a)$, so $\sum_b p(b|a) p_{ab} = p_a$. \end{proof} \begin{figure}[ht] \centering \includegraphics[width=0.8\textwidth]{fig-divergencesubs} \caption{Illustration of marginal improvement of signal $A$ over the prior, $\V(A) - \V(\bot)$, via two equivalent definitions used to characterize S\&C. Definition \ref{def:subs-G} is that $\V(A) - \V(\bot) = \E_a G(p_a) - G(p)$. Here, the blue curly brace measures the distance between $\E_a G(p_a)$ and $G(p)$. Definition \ref{def:subs-bregman} is that $\V(A) - \V(\bot) = \E_a D_G(p_a,p)$ where $D_G(p_a,p)$ is the Bregman divergence. The Bregman divergences $D_G(p_0,p)$ and $D_G(p_1,p)$ are measured by the two red curly braces. Another way of stating the equivalence of (1) and (2) is that the average size of the red braces is equal to the size of the blue brace (where the average is weighted by the probabilities of $A=0,1$).} \label{fig:divergencesubs} \end{figure} \begin{definition}[Substitutes via divergences] \label{def:subs-bregman} \defsubsbregman \end{definition} This can be interpreted as a characterization of S\&C where $D_G$ serves as a \emph{distance measure} of sorts (although it is not in general a distance metric). The characterization says that, if we look at how ``far'' the agent's beliefs move upon learning $B$, on average, then for substitutes this distance is decreasing in how much other information is available to the agent. But for complements, the more information the agent already has, the \emph{farther} she expects her beliefs to move on average upon learning $B$. \begin{example} \label{ex:def-subs-divergence} For the $\log$ scoring rule, $D_G(p,q)$ is exactly the \emph{KL-divergence} or \emph{relative entropy} $KL(p,q)$ between distributions on $p$ and $q$. If we recall Example \ref{ex:one-bit-subs}, in which $E$ was a random bit and $A_1 = A_2 = E$, we can consider the decision problem of prediction $E$ against the $\log$ scoring rule. In this case, the prior $p = \left(\frac{1}{2},\frac{1}{2}\right)$, while the posteriors $p_{a_1=0} = (1,0)$, $p_{a_1=1} = (0,1)$, and the same for $A_2$. Hence $\E_{a_1} KL(p_{a_1},p) = 1$. But the posteriors conditioned on both signals are the same, \emph{e.g.} $p_{a_0=a_2=0} = (1,0) = p_{a_0=0}$. Hence $\E_{a_1,a_2} KL(p_{a_1,a_2},p_{a_1}) = 0$. This already shows that $A_1$ and $A_2$ are weak substitutes. And in fact, if $A_1 = A_2$, then this argument extends to show that $A_1$ and $A_2$ are substitutes in \emph{any} decision problem (as they should be), because given $A_1$, an update on $A_2$ moves the posterior belief a distance $0$. \end{example} \subsubsection{Defining the value of information} Defining informational S\&C turns out to be significantly more work than defining substitutes and complements for valuation functions over items, starting from the very beginning: How does \emph{value} arise in the first place? It is generally accepted to model a valuation function over a set $U$ of goods as some $f: 2^U \to \mathbb{R}$, without justifying how $f(S)$ arises (perhaps the items are yummy, shiny, or have other desirable qualities). However, outside of curiosity, it seems that information's innate value is more questionable; and furthermore, should depend on its probabilistic structure. For instance, two signals may be independent or may be highly correlated. How does this relate to their value? A solution arises from the observation that information's value is often determined by the \emph{use} to which the information may be put. As in \cite{howard1966information,borgers2013signals}, for us the value of information arises from its utility in the context of a decision problem. We consider a Bayesian model of information in which there is a prior distribution on the event $E$ of interest and on the possible pieces of information, called \emph{signals}. In a decision problem, the agent observes some signals and then makes a decision $d \in \D$, after which the outcome $E=e$ is revealed and the agent's utility is $u(d,e)$. Thus (following \cite{borgers2013signals}), we define a \emph{value function} $\V^{u,P}$ on signals, for a given decision problem $u$ and prior $P$, by the expected utility of the agent given that she first observes $A$, then takes the optimal action based on that information. Formally, \[ \V^{u,P}(A) = \E_{a\sim A} \left[ \max_{d\in\D} \E_{e\sim E} \left[ u(d,e) \mid A=a\right] \right] . \] Thus, one can compare, for instance, the value $\V^{u,P}(A_1)$ for observing signal $A_1$ alone versus the value $\V^{u,P}(A_2)$ for observing signal $A_2$ alone. Note that the \emph{marginal value} for observing signal $A_2$, given that the agent will already observe signal $A_1$, is $\V^{u,P}(A_2 \smallvee A_1) - \V^{u,P}(A_1)$, where the notation $A_2 \smallvee A_1$ means to observe both signals (this notation will be explained shortly). \subsubsection{The approach of B\"{o}rgers et al.} \citet{borgers2013signals} proposes the following definition: Given an event $E$, two signals $A_1$ and $A_2$ are substitutes if for \emph{every decision problem} (and associated value function $\V^{u,P}$), \[ \V^{u,P}(A_1) + \V^{u,P}(A_2) \geq \V^{u,P}(A_1 \smallvee A_2) + \V^{u,P}(\bot) , \] where $A_1 \smallvee A_2$ denotes observing both signals, while $\bot$ denotes not observing any signal and deciding based on the prior. This definition has two properties that might seem attractive, but turn out to be fatal in many cases of interest: (a) it does not depend on the particular decision problem, but only on how $A_1$, $A_2$, and $E$ are correlated; (b) it depends only on the values $\V^{u,P}(A_1)$, $\V^{u,P}(A_2)$, of both, and of neither, and does not depend on any internal structure of $A_1$ and $A_2$. We explain why these properties are problematic and how our definition will differ. \paragraph{a. Lack of dependence on the decision problem.} The problem here is that in a majority of cases, two signals can turn out to be either substitutes or complements depending on the decision problem at hand. For example, whether two weather observations are substitutes or complements depends on what decision is being made. Temperature and dew point might be considered complements when deciding whether to bring one's umbrella.\footnote{Accepting the proposition that knowledge of both gives a much better prediction of rain than knowledge of either alone.} But when deciding, for instance, how warmly to dress, these two measurements might be considered substitutes since, given one of them, the other gives relatively less information about the comfort level of warm or cool clothing. For another example: To a trader deciding whether to invest in a technology index fund (that is, a stock whose value follows that of the general tech sector), the share prices of two given tech companies may be substitutable information, since each gives some indication of the current value of tech stocks. But to a trader deciding which of these two specific companies to invest in, these prices may be complements, since the decision can be made much more effectively with both pieces of information than with either alone. The definition of \cite{borgers2013signals} cannot capture such scenarios because it requires two signals to be substitutes for \emph{every} possible decision problem. Our solution is to define S\&C relative to both the particular information structure and the particular decision problem. \paragraph{b. Lack of dependence on the internal structure of the signals.} The other concern with the definition of \citet{borgers2013signals} is that it only depends on ``extreme'' values: $\V^{u,P}(A_1), \V^{u,P}(A_2), \V^{u,P}(A_1 \smallvee A_2),$ and $\V^{u,P}(\bot)$. Hence, it ignores the internal structure of $A_1$ and $A_2$, which can lead to incongruous predictions. For example, suppose that $B_1$ and $B_2$ are substitutes while $C_1$ and $C_2$ are complements. Now consider the signals $A_1 = (B_1,C_1)$ and $A_2 = (B_2,C_2)$. For some decision problems, it may be that the $B$ signals are slightly more important and so $A_1$ and $A_2$ seem to be substitutes. For other decision problems, it may be that the $C$ signals are slightly more important and $A_1$ and $A_2$ seem to be complements. This is formalized in Example \ref{ex:weak-but-not-moderate}. To see why this could be problematic for a predictive or useful theory, suppose that an agent will be able to observe $A_1$, and a seller wishes to sell to that agent the opportunity to observe $A_2$ as well. As just argued, one might have defined $A$ and $B$ to be ``substitutes'' or ``complements'' depending on very small fluctuations in the decision problem. But the seller, by ``hiding'' or ``forgetting'' either the $B_2$ or the $C_2$ component of his signal, can force the signals to become either substitutes or complements as she desires. A definition that does not account for internal structure may get such examples completely wrong, \emph{e.g.} classifying the signals as substitutes when the seller can make them behave as complements. We will introduce definitions that account for the internal structure of signals. \subsubsection{Our approach: dependence on context and internal structure} \paragraph{Context.} As mentioned above, we will allow the definitions of S\&C to depend on the particular decision or value function $\V^{u,P}$. That is, while \citet{borgers2013signals} defined a particular information structure $P$ to be substitutes on pairs of signals if $\V^{u,P}$ satisfied a condition for all $u$, we will define a pair $(u,P)$ to be substitutes if $\V^{u,P}$ satisfies a similar condition. This will turn out to be crucial in all of our applications. The potential drawback is that it might be difficult to say anything \emph{general} about when signals are substitutes or complements; it might seem that one must take things completely on a case-by-case basis. We make two counterpoints. First, a universal approach may be the wrong goal or ``too much to hope for''. For instance, in the case of items, there is no such optimistic analogue; one does not consider items that are always substitutes for every valuation function. Despite this, there are many successful theories leveraging substitutable goods. These approaches start by assuming a context (\emph{e.g.} valuation functions) for which the goods are substitutes; similarly, we can consider a set of signals and only those decision problems for which they are substitutes. Second, we later give some evidence that we need not take things completely case-by-case. We seek classes of signals that can be considered substitutes or complements in a broad class of decision problems. For example, we show that if signals are independent, then they are complements for \emph{any} decision problem satisfying a smoothness condition. Our work also gives intuition for which kinds of signals are more likely to be substitutable or are substitutable in more contexts. And indeed, one of the exciting questions raised by our work is how the context of a decision problem and internal structure combine to produce substitutable or complementary features. \paragraph{Probabilistic structure.} We will allow definitions of S\&C to depend on the internal structure of signals. But how? Two signals may be related in complex ways by correlations with each other and with the event $E$ of interest. Therefore, a more natural analogy than substitutability of two items may be substitutability of two \emph{subsets} of items. Consider \citet{lehmann2001combinatorial}, which studied valuation functions over sets of items. There, the authors identified a natural ``no complementarities'' condition where two sets of items, $A_1$ and $A_2$, could only be substitutes if all ``pieces'' of those subsets were substitutes: no subset of set $A_1$ could be complementary to the set $A_2$, and vice versa. This turned out to be exactly a requirement that the valuation function be \emph{submodular}: that it exhibit diminishing marginal value. We would also like to capture diminishing marginal value. The challenge that arises is, what is a marginal ``unit'' of information? The answer actually may vary by application. \begin{enumerate} \item In some applications, a ``marginal unit'' may be an entire signal: Given the current subset of $\{A_1,\dots,A_n\}$, one can either add another $A_i$, or not. This would be appropriate for cases where our above arguments about internal structure may not apply. For example, perhaps the seller in an auction does not have the ability, for whatever reason, to process her signals in any way; she can just choose between allowing each of them to be either broadcast or kept private. In this paper, we utilize this notion, which will correspond to ``weak substitutes'', in the context of discrete optimization problems where an algorithm must choose between acquiring different signals. In many contexts, it is impossible to acquire partial signals, so this is the natural marginal unit. While they may be useful, they also are subject to the criticisms given above; in many contexts that allow ``pieces'' of signals, they may not behave as substitutes or may even behave as complements. \item Sometimes, a ``marginal unit'' may be some partial information about a signal, in the form of a ``fact'' about its realization. For instance, imagine a commuter learns something about the barometer reading but not the exact reading; \emph{e.g.}, whether it is above or below $30$, or the measurement rounded to the nearest integer. This application arises when considering pure strategies in a game, or deterministic ``post-processings'' of a signal in algorithmic contexts. The effect of such processing is always to ``coarsen'' a signal by pooling multiple outcomes together under one announcement. In the barometer example, all realizations of the signal below $30$ map to the same result, and all realizations above map to the other result; similarly when rounding to the nearest integer. If a set of signals exhibits diminishing marginal value with respect to this notion, we will term them ``moderate substitutes''. We actually do not provide an application for moderate substitutes in this paper, but expect them to be useful in contexts such as those just described. \item Finally, a ``marginal unit'' may be partial information in the form of a noisy ``signal about the signal''. For instance, the commuter may learn the barometer reading plus Gaussian noise. To see that this notion may be much more fine-grained than the previous one, imagine starting from the binary barometer example, where the commuter learns whether or not the barometer is below $30$; and now imagine that, with some probability $p$, this observation is ``flipped'' from the correct one. When $p=0$, the commuter can be certain that she learns correctly which outcome is the case (above or below $30$). But as $p \to \frac{1}{2}$, the commuter learns less from the signal. If a set of signals exhibits diminishing marginal value even with respect to such partial information -- for instance, diminishing marginal value as $p$ decreases from $\frac{1}{2}$ to $0$ -- then we term them ``strong substitutes''. In applications where, for instance, the barometer observation is controlled by a strategic agent whose strategy consists of a ``garbling'' of that observation, this will be a useful notion of marginal information. \end{enumerate} We formalize these marginal units of information using \emph{lattices} of signals: sets of signals with a partial order $\preceq$ corresponding to ``informativeness'' and satisfying some natural conditions. While our proposed uses for them here are quite new, the lattices we use, or closely related concepts, are relatively classical. For weak substitutes, we consider the lattice of subsets of signals, with partial order given by set containment; this corresponds directly to subsets of goods and the notion of substitutes is essentially the same. For moderate substitutes, we utilize a variant of Aumann's classic model of information in Bayesian games~\citep{aumann1976agreeing}, in which signals correspond to partitions on a ground state of the world. To our knowledge, although it is known that Aumann's signals form a lattice (because the space of partitions do), they have not been used to formalize marginal units of information. One difference in the variant we propose is that the ground states only determine the signals, not the event $E$ or any other pieces of information; this makes our model much more useful for formalizing marginal pieces of information because the ground states only contain information about the signals. For strong substitutes, we extend Aumann's model to capture randomized ``garblings'' of signals. Although this is not the model normally used in that context, the idea and intuition is extremely similar to Blackwell's criterion or partial ordering on signals~\citep{blackwell1953equivalent}. One major difference is that in our model, there is a particular event $E$ of interest and signals are ordered according to informativeness \emph{about that event}, rather than pure informativeness. Also, the use of Aumann's partition model allows our signals to form a lattice. \subsubsection{Capturing ``diminishing'' marginal value} Luckily, once we have placed a lattice structure on signals, we can apply a now-classic criterion for diminishing marginal value: submodularity. Often, submodularity is a condition for functions on subsets, \emph{e.g.} $f: 2^{\{1,\dots,n\}} \to \R$, which is submodular if an element $i$'s ``marginal contribution'' to $S$, $f(S \cup \{i\}) - f(S)$, is decreasing as elements are added to $S$. This is a widely-used model for substitutability of discrete, indivisible items~\citep{lehmann2001combinatorial}. The same goes for supermodularity, increasing marginal value, and complementary items. The final piece of our puzzle will be to utilize submodularity and supermodularity, and extensions, to capture diminishing marginal value and increasing marginal value respectively. This is formalized in Section \ref{sec:defs}. \subsection{Universal substitutes and complements} \label{sec:universal} An ideal starting point would be characterizing information structures that are always substitutable or complementary; we term these ``universal''. We note that \citet{borgers2013signals} investigated a two-signal variant of this problem, with a definition essentially corresponding to weak substitutes on those two signals, with some results of the same flavor. Intuitively, there are ``trivial'' cases that satisfy this universality criterion, at least for weak S\&C. An example of trivial weak substitutes is the case where $A_1 = A_2 = \cdots = A_n$. Here, after observing any one signal, all of the others do not change the posterior belief at all. An example of trivial weak complements is the case where each $A_i$ is an independent uniformly random bit and $E = A_1 \oplus A_2 \oplus \cdots \oplus A_n$, the XOR of all the bits. Here, any subset of $n-1$ signals does not change the posterior belief at all compared to the prior, but the final signal completely determines $E$. \begin{definition} \label{def:universal} Given an information structure $E,A_1,\dots,A_n$ with prior $P$, we term $A_1,\dots,A_n$ \emph{universal weak substitutes} if they are weak substitutes for every decision problem. Universal moderate/strong substitutes and weak/moderate/strong complements are defined analogously. We term the signals \emph{trivial substitutes} if for every realization of $a_1,\dots,a_n$ in the prior's support, $p_{a_i} = p_{a_1,\dots,a_n}$ for all $i$ and \emph{trivial complements} if for all realizations $a_1,\dots,a_n$ in the support, $p_{\{a_j : j \neq i\}} = p$ for all $i$. We term them \emph{somewhat trivial} if the prior is a mixture distribution that is equal to a trivial structure with some probability, and some other arbitrary other structure with the remaining probability. \end{definition} \begin{figure}[ht] \caption{\textbf{Universal substitutes and complements.} In each plot, there are two binary signals $A_1,A_2$ and a binary event $E$. The $x$-axis is the probability of $E$. $G$ is the expected utility function for some decision problem (different in each plot). The circles correspond to the value of no signals (black), one signal (blue), and two signals (red). The blue braces measure the distance from the prior to posteriors on one signal; red measure additional distance to the posterior on two.} \label{fig:universal} \begin{subfigure}{1.0\textwidth} \centering \includegraphics[width=0.6\textwidth]{fig-univ-comps-curvy} \caption{\textbf{Curvature increases complementarity.} Here $A_1,A_2$ are i.i.d. noisy bits and $E = A_1 \oplus A_2$, the XOR. Because $G$ is convex, it is more extreme at more extreme beliefs, which tend to correspond to having multiple signals. Here the marginal value of a second signal is much higher than that of a first; complementarity.} \end{subfigure} \vspace{24pt} \begin{subfigure}{1.0\textwidth} \centering \includegraphics[width=0.6\textwidth]{fig-univ-comps-flat} \caption{\textbf{Flattening $G$ cannot remove complementarity.} For these signals (the same as in (a)), the Bayesian update on the second signal is always larger than on the first. Intuitively, even for flat $G$, this structure will always exhibit complementarity. These signals are universal complements.} \end{subfigure} \vspace{24pt} \begin{subfigure}{1.0\textwidth} \centering \includegraphics[width=0.6\textwidth]{fig-univ-subs} \caption{\textbf{Curvature destroys substitutability.} Here $E$ is a uniform bit conditioned on which each $A_i = E$ independently with large probability. These are often substitutes, but by introducing high curvature at an extreme point, we create a problem where useful decisions can only be made with access to multiple signals. The first signal has no marginal value over the prior, while the second signal has some marginal value, so they are now complements. In general, this argument shows that universal substitutes must involve a ``triviality'' ruling out this construction.} \label{subfig:univ-subs} \end{subfigure} \end{figure} \begin{proposition} \label{prop:subs-mix-trivial} If $A_1,\dots,A_n$ are universal weak substitutes, then they are somewhat trivial. Furthermore, their ``trivial'' component is more informative than the nontrivial component, in the following sense. Let $X_i \subseteq \Delta_E$ be the convex hull of $\{p_{a_i} : a_i \in A_i\}$, and let $Y \subseteq \Delta_E$ be the convex hull of $\{p_{a_1,\dots,a_n} : a_1 \in A_1,\dots,a_n \in A_n\}$. If $A_1,\dots,A_n$ are universal substitutes, then $X_i = Y$ for all $i$. \end{proposition} \begin{proof} Consider any information structure that does have $X_i = Y$ for all $i$. We give a decision problem for which it sometimes satisfies strictly increasing marginal value. To do so, by Corollary \ref{cor:decision-captured-by-G}, it is enough to construct a convex function $G$ with appropriate structure, for which we then know a decision problem (namely, a scoring rule, Fact \ref{fact:scoring-char}) exists. The idea is pictured in Figure \ref{subfig:univ-subs}. Let $X$ be the convex hull of $\{p_{a_i} : i=1,\dots,n; a_i \in A_i\}$, that is, of all possible posterior beliefs conditioned on one signal. Let $G(q)$ be zero for $q$ in the convex hull of that set of beliefs (note that the prior $p$ must be in the convex hull) and $G(q)$ be increasing outside of this convex hull. Then for any one signal $A_i$, we must have $\V(A_i) = \V(\bot) = 0$ as $\V(A_i) = \E_{a_i} G(p_{a_i})$. But by assumption, there exist posterior beliefs for multiple signals that fall outside this convex hull. This follows because each $p_{a_i} = \E_{a_j} p_{a_ia_j}$ for any $j \neq i$, so unless $p_{a_ia_j} = p_{a_i}$ for all $j$, there are cases where some posterior belief falls outside the convex hull mentioned. (And if $p_{a_ia_j} = p_{a_i}$ always, then repeat the argument for triples of signals $a_i,a_j,a_k$, and so on; by nontriviality, the argument will succeed at some point.) Now for these posterior beliefs falling outside the convex hull, they occur with positive probability and have a positive value of $G$, hence the marginal value of additional signals because strictly positive at some point, while the marginal value of the first signal was $0$. To see that this implies a mixture containing trivial substitutes, note that the convex hulls $X_i = X_j$ for all $i,j$, so in particular the corners of these convex hulls must be points where $p_{a_i}$ is equal, in the case where $A_i = a_i$, to every posterior belief conditioned on any number of signals. \end{proof} \begin{theorem} \label{thm:no-universal-moderate-subs} All universal moderate substitutes are trivial. (Hence, the same holds for universal strong substitutes.) \end{theorem} \begin{proof} Any universal moderate substitutes must be universal weak substitutes as well; so we know via the proof of Proposition \ref{prop:subs-mix-trivial} that any candidates must have a mixture with trivial substitutes. However, we can let $A'$ be a signal determining whether that component of the mixture has occurred. Then one implication of moderate substitutes is that, conditioned on $A'$, all signals are weak substitutes. Therefore, universal substitutes implies that even conditioned on $A'$, the prior is a mixture containing a trivial component. Repeating the argument gives that the entire prior must consist only of trivial components. \end{proof} \begin{proposition} \label{prop:universal-comps} Consider a binary event $E \in \{0,1\}$ prior probability $p = \Pr[E=1]$, and signals $A_1,A_2$ with posterior probabilities $p_{a_1} = \Pr[E=1|A_1=a_1]$, and so forth. Suppose that: \begin{enumerate} \item $\max_{a_1} \|p-p_{a_1}\| \leq r$ and $\max_{a_2} \|p-p_{a_2}\| \leq r$; and \item $\min_{a_1,a_2} \|p - p_{a_1,a_2}\| \geq 2r$. \end{enumerate} Then $\{A_1,A_2\}$ are universal moderate complements. \end{proposition} \begin{proof} The idea is that posterior beliefs on multiple signals usually tend to lie ``farther'' from the prior than those on single signals, because at least in some cases, more information leads to more certain (hence extreme) beliefs. Convex functions already tend to give larger marginal value to more extreme cases. Hence, convexity of the decision problem encourages complementarity; and it cannot discourage complementarity very much because a convex function can only be ``so flat''. This is pictured in Figure \ref{fig:universal}. By moving the posteriors $p_{a_1,a_2}$ all very far from the prior, compared to the posteriors $p_{a_1},p_{a_2}$, we get increasing marginal returns. Pick any convex $G$ on $[0,1]$ and let all probability distributions on $E$ be represented as scalars $q \in [0,1]$. This includes the prior $p$ and posteriors such as $p_{a_1}$. It suffices to show that $\E G(p_{a_1a_2}) + G(\bot) \geq \E G(p_{a_1}) + \E G(p_{a_2})$. Let $p^*$ be the minimizer of $G$ on $[0,1]$. Then $G(p_{a_1a_2}) \geq G(p_{a_1}) + G'(p_{a_1}) (p_{a_1a_2} - p_{a_1})$. Now we claim that $G'(p_{a_1})(p_{a_1a_2} - p_{a_1}) \geq G(p_{a_1}) - G(p)$. This implies $G(p_{a_1a_2}) + G(p) \geq 2G(p_{a_1})$, and after taking the analogous case reversing $a_1$ and $a_2$ and expectations, we get that the desired inequality must hold. To prove the claim, consider the case $p_{a_1a_2} > p_{a_1}$. Then $(p_{a_1a_2} - p_{a_1}) \geq r$, and we want to show $G'(p_{a_1}) \geq \frac{G(p_{a_1})-G(p)}{r}$. This holds by definition of a subgradient as the right side is at most the slope of a line connecting $p$ and $p_{a_1}$. The analogous argument holds for the case $p_{a_1a_2} < p_{a_1}$. \end{proof} \begin{corollary} \label{cor:univ-comps-example} An example of universal complements are the signals $A_1,A_2$ each independently equal to $1$ with probability $q \in [0.25,0.75]$ and $E = A_1 \oplus A_2$ (the XOR operation). \end{corollary} We note that these may be universal complements for larger ranges of $q$ as well, and a very interesting question for future work is to characterize the set of universal complements. This seems to require more work particularly for $E$ with a larger number of outcomes. For binary $E$ which are equal to a deterministic function of $A_1,\dots,A_n$, it seems possible to relate complementarity to the \emph{sensitivity} of a function in Boolean analysis. \subsection{Identifying complements} Our main result here is to identify the following very broad class of complements. \begin{proposition} \label{prop:indep-comps-bregman} Independent signals are strong complements in any decision problem where $G$ has a \emph{jointly convex} Bregman divergence $D_G(p,q)$. \end{proposition} \begin{proof} $D_G(p,q)$ is termed jointly convex if it is a convex function on the domain $\Delta_E \times \Delta_E$ (as opposed to the case where it is convex in each argument separately, for instance). Assume signals are independent; consider any $A,B$ on the subsets signal lattice (incomparable to each other) and any $A'$ on the continuous lattice with $A' \preceq A$. By Lemma \ref{lemma:marginal-contribution-bregman}, showing strong substitutes is equivalent to showing that \[ \E_{a',b} D_G(p_{a'b},p_{a'}) \leq \E_{a,b} D_G(p_{ab},p_{a}) . \] Use independence and rewrite to this convenient form: \[ \E_{b} ~\E_{a'} D_G(p_{a'b},p_{a'}) \leq \E_{b} \E_{a'} \E_{a|a'} D_G(p_{ab},p_{a}) . \] Note that if $b$ were not independent of $a,a'$, then the inner expectations would require conditioning the distributions of $a$ and $a'$ on the outcome of $b$. Now, it suffices to prove the following for all $b,a'$: \[ D_G(p_{a'b},p_{a'}) \leq \E_{a|a'} D_G(p_{ab},p_{a}) . \] Now, since $D_G$ is jointly convex, Jensen's inequality will imply this fact if we can just show that $p_{a'b} = \E_{a|a'} p_{ab}$ and $p_{a'} = \E_{a|a'} p_{a}$. We prove the first equality; the second is exactly analogous but easier. \begin{align*} p(e \mid a',b) &= \frac{p(e,a',b)}{p(a',b)} \\ &= \sum_a \frac{p(e,a,a',b)}{p(a',b)} \\ &= \sum_a \frac{p(e|a,a',b) p(a,a',b)}{p(a',b)} \\ &= \sum_a p(e|a,b) \frac{p(a,a')p(b)}{p(a')p(b)} \\ &= \sum_a p(e|a,b) p(a|a') . \end{align*} We used Bayes rule and the law of total probability, then eventually used the fact that $p(e|a,a',b) = p(e|a,b)$ (because $a'$ and $e$ are independent conditioned on $a$) and that $a$ and $a'$ are independent of $b$. \end{proof} A corollary is that independent signals are complements for the $\log$ scoring rule and the quadratic scoring rule, as their divergences ($KL$-divergence and $L_2$ distance squared) are jointly convex. On the other hand, some form of this restriction on the decision problem is needed: \begin{claim} If $D_G$ is not convex in its second argument, then independent signals are not necessarily complements. \end{claim} \begin{proof} We consider a binary event $E$ and $G(q)$ where $q \in [0,1]$ is a probability that $E = 1$. A counterexample is to let $G(q) = 0$ for $q \leq 0.75$ and $G(q) = q-0.75$ for larger $q$. Consider any decision problem associated with this $G$ (for instance, predicting against a proper scoring rule derived from $G$). The two signals $A$ and $B$ are independent uniform random bits, and $E$ is equal to the binary OR of the bits. In this case, one can check that $\V(A) = \V(B) = \frac{1}{8}$, but $\V(\bot) = 0$ and $\V(A \smallvee B) = \frac{3}{16}$. Thus in particular $\V(A) + \V(B) \geq \V(A \smallvee B) + \V(A \smallwedge B)$, so they are not complements. Note that $G$ may be modified to be strictly convex while preserving the counterexample. Also note that the sharp ``kink'' in the graph of $G$ at $q=0.75$ forces $D_G$ to be non-convex in its second argument (one can take the first argument to be the prior on $E$, $q=0.75$, choosing the subgradient $G'_{0.75}(q) = q-0.75$). \end{proof} \subsection{Identifying substitutes} It was previously known~\citep{chen2010gaming} for prediction markets under the $\log$ scoring rule that conditionally independent signals induced players to reveal their information as early as possible. The result in a different guise was shown in an algorithmic context, namely, that for conditionally independent signals, . Both of these turn out to correspond to the fact that signals are always substitutable in the context of the $\log$ scoring rule: \begin{theorem} \label{thm:log-CI-subs} For the $\log$ scoring rule, signals that are conditionally independent upon the event $E$ are strong substitutes. \end{theorem} \begin{proof} Suppose signals $A_1,\dots,A_n$ are conditionally independent on $E$. Let $A,B$ on the subsets signal lattice and $A'$ on the continuous lattice with $A \smallwedge B \preceq A' \preceq A$. We are to show that $\V(A' \smallvee B) - \V(A') \geq \V(A \smallvee B) - \V(A)$. Recall that, using the entropy characterization, $\V(A) = -H(E|A) = H(A) - H(E,A)$ by the properties of the entropy function. \begin{align*} \V(A' \smallvee B) - \V(A') &= H(A', B) - H(E, A', B) - H(A') + H(E, A') \\ &= H(B | E, A') - H(B | A'). \end{align*} Similarly, $\V(A \smallvee B) - \V(A) = H(B | E,A) - H(B | A)$. Now because $A' \succeq A \smallwedge B$, by conditional independence, $H(B|E,A') = H(B|E,A)$. Meanwhile, by conditional independence, $H(B|A') \leq H(B|A)$, which completes the proof. \end{proof} However, this fact is apparently quite special to the $\log$ scoring rule. \begin{proposition} \label{prop:quad-ci-not-subs} Conditionally independent signals are not necessarily substitutes for the quadratic scoring rule (which has a jointly convex Bregman divergence). \end{proposition} \begin{proof} The quadratic scoring rule has expected score function $G(p) = \|p\|_2^2$, and therefore $S(p,e) = 2p(e) - \|p\|_2^2$. Let $E$ be binary with $p(E=1) = r > 0.5$ and let each of $A,B$ be i.i.d. conditioned on $E$, each equal to $E$ with probability $s > 0.5$ and equal to the bit-flip of $E$ otherwise. One can check that for cases where $r$ is large compared to $s$, for instance $r = 0.9$ and $s = 0.8$, we have $\V(A) + \V(B) \leq \V(A \smallvee B) + \V(A \smallwedge B)$ (recall that $\V(A) = \E_a G(p_a)$). Hence substitutability is strongly violated. For instance, an agent observing $A$ would prefer to report second in a prediction market after an agent observing $B$, even when both agents are constrained to report truthfully. Intuitively, what happens in this information structure is that neither the realization of $A$ nor of $B$ on its own is enough to change the rather strong prior on $E$. However, sometimes, observing both $A$ and $B$ (if they are both $0$) can cause a large change in beliefs about $E$, which means that observing both can sometimes be very valuable. \end{proof} \subsection{Designing to create substitutability} \label{sec:surrogate} We now briefly consider the question of designing a decision problem or scoring rule so as to enforce substitutability of information. In a game-theoretic setting such as prediction markets, one would like to design mechanisms where information is aggregated quickly; as we have seen, this is essentially equivalent to making information more substitutable. In an algorithmic setting, the decision problem with which one is faced may be difficult to optimize due to non-substitutability of information. One would like to construct a ``surrogate'' decision problem for which the information at hand is substitutable, then use algorithms for (Adaptive) \sigsel/ to approximately maximize that surrogate, with some guarantee for the original problem. This is the approach of \emph{submodular surrogates} in the literature~\citep{chen2015submodular}. We do not directly consider this problem in this paper, but we hope that these techniques may yield insights or tools that are useful in these problems for future work. \begin{figure}[ht] \caption{\textbf{Encouraging information to be substitutes.} Here, $E$ is binary, and the $x$-axis plots the probability $q$ that $E=1$, with the black curve plotting $G(q)$, the expected score function corresponding to a proper scoring rule. Illustrates an informal case with two signals $A$ and $B$, each of which may be ``lo'' or ``hi'', together with some distributions on $E$: the prior, the posterior conditioned on one of the signals being ``lo'' or ``hi'', and the posterior conditioned on both signals being ``lo'' or ``hi''.} \label{fig:good-bad-G} \begin{subfigure}{1.0\textwidth} \centering \includegraphics[width=0.7\textwidth]{fig-badsubsG} \caption{\textbf{A ``bad'' choice of $G$.} Here, many information structures will be complements because the value of any new information is very small, yet additional information on top of that becomes valuable. In particular, for each signal, say $A$, $\E_a G(p_a) = G(p)$ where $p$ is the prior (purple points). Yet the expected value of both signals, $\E_{ab} G(p_{ab})$ (blue points), is larger than $G(p)$.} \end{subfigure} \vspace{16pt} \begin{subfigure}{1.0\textwidth} \centering \includegraphics[width=0.7\textwidth]{fig-goodsubsG} \caption{\textbf{A ``good'' choice of $G$.} Here, many information structures will be substitutes because the value of new information is initially high around the prior. One way to see this is that the Bregman divergence becomes low far from the prior; recalling that $\E_{a,b} D_G(p_{ab},p_a)$ is the expected difference in score between predicting $p_{ab}$ versus just predicting $p_a$, this implies that there is a small expected gain from observing $B$ once one knows $A$ (in other words, substitutability).} \end{subfigure} \end{figure} An important conclusion of this paper is that substitutability, or lack thereof, tends to arise from a combination of two factors: \begin{enumerate} \item The \emph{distances between beliefs} due to the information structure. If updating on additional information tends to spread beliefs farther apart, then that information tends to be complementary. If it tends to make smaller changes in beliefs, it tends to be substitutable. \item The \emph{curvature} of the expected utility function $G: \Delta_E \to \R$ associated to the decision problem. Highly-curved regions correspond to high marginal value of information to beliefs in those regions. \end{enumerate} We illustrate some of this intuition, with an eye toward design of substitute-encouraging $G$, in Figure \ref{fig:good-bad-G}. By designing a $G$ that is highly curved close to the prior, then gradually less curved farther from the prior, one increases marginal value of information near the prior and decreases it (relatively) further away; this increases substitutability. \paragraph{A formalization of the problem.} Given an information structure consisting of a prior $E$ and signals $A_1,\dots,A_n$, (when) can we construct a decision problem $u$ such that the signals are substitutes? Noting that a trivial decision problem, \emph{e.g.} with one action, technically satisfies substitutes, we will seek decision problems that satisfy a ``nontriviality property''. \begin{definition} \label{def:somewhat-strict} Substitutes are \emph{somewhat strict} if the marginal value is always diminishing on the corresponding lattice, and sometimes strictly diminishing. Analogously, complements are \emph{somewhat strict} if marginal value is always increasing and sometimes strictly increasing. \end{definition} Unfortunately, our results on universal S\&C in Section \ref{sec:universal} essentially imply that this is not always achievable. \begin{proposition} \label{prop:always-design} For some information structures, it not possible to design a decision problem giving rise to weak, somewhat strict substitutes; the same holds for complements. However, if the information structure does not contain a mixture of trivial substitutes, then it is possible to design a decision problem under which signals are weak, somewhat strict complements. \end{proposition} \begin{proof} We showed in Corollary \ref{cor:univ-comps-example} that nontrivial universal complements exist; for these structures, for every decision problem, they are weak complements, which implies that they cannot be somewhat strict substitutes. Meanwhile, in Proposition \ref{prop:subs-mix-trivial}, we showed that unless the information structure contained a mixture with trivial substitutes, one can construct a decision problem satisfying weakly and sometimes strictly increasing marginal value. \end{proof} A crucial direction for future work is to better characterize for what information structures it is always possible to design for substitutability. . \subsection{Other game-theoretic applications} \label{sec:game-other} We will now examine a few game-theoretic contexts in which our results have immediate applications or implications. Instead of developing full formal proofs and theorem statements, we focus on illustrating the intuition of how to extend our results and the conceptual lens of informational S\&C to those settings. \subsubsection{Crowdsourcing and contests} In the study of crowdsourcing from a theoretical perspective, the ``crowd'' is a group of agents who hold valuable information and the goal is to design mechanisms that elicit this information. Specifically, here we are interested in ``wisdom of the crowd'' settings where the total information available to the crowd is greater than that of the most-informed individual, and the goal is to aggregate this information. Before describing how informational S\&C apply in such settings, we would like to contrast with approaches to crowdsourcing that models each user's contribution as a monolithic submission that has some endogenous quality, such as \citet{dipalantino2009crowdsourcing,archak2009optimal,chawla2015optimal} There, it is impossible to integrate or aggregate user contributions and the problem is to incentivize and select one of the highest possible quality. In these models, \emph{information} plays no role and the model is equally well-suited to incentivizing production of a high-quality \emph{good} of which only one is required; sometimes this is explicit in the motivation or model of the literature~\citep{cavallo2012efficient}. Here, we consider cases where users have heterogeneous information and we would like to aggregate it into a final form that is more useful than any one user. The question is how users behave strategically in revealing this information in the contest. \paragraph{Collaborative, market-based contests for machine learning.} \citet{abernethy2011collaborative} proposes a mechanism for machine learning contests with a prediction market structure. This mechanism was later extended to elicit data points and to more general problems in \citet{waggoner2015market}. While these mechanisms have appealing structure, seeming to align participants' incentives with finding optimal machine-learning hypotheses, the authors did not give results on equilibrium performance or behavior of strategic agents. Here, we briefly describe the framework of this mechanism and how our results can apply. In a machine learning problem, we are given a \emph{hypothesis class $\D$}. There is some true underlying distribution $e$ of data, which is initially unknown. In our setting we assume there is a prior belief on this distribution $e$, which distributed as a random variable $E$. The goal is to select a hypothesis $d$ with minimum \emph{risk} $R(d,e)$ on the true data distribution. Here, $R(d,e) = \E_{z\sim e} \ell(d,z)$ for a \emph{loss function} $\ell(d,z)$ on hypothesis $h$ and a datapoint $z$ drawn from $e$. In the contest mechanism of \citet{abernethy2011collaborative,waggoner2015market}, the mechanism selects an initial market hypothesis $d^{(0)}$. As in the prediction market model of Section \ref{sec:markets}, participants iteratively arrive and propose a new hypothesis $d^{(t)}$ at each time $t$. At the end of the contest, the mechanism draws a test data point $z \sim e$ from the true distribution and rewards each participant by their improvement to the loss of the market hypothesis, \emph{i.e.} if $i$ updated the hypothesis at time $t$ from $d^{(t-1)}$ to $d^{(t)}$, then $i$ is rewarded $\ell(d^{(t-1)},z) - \ell(d^{(t)},z)$ for that update. We observe that prediction markets are a special case of this framework: Each $e$ corresponds to some fixed observation, for instance, for a given $e$ the data point drawn is always the same $z_e$. The risk $R(d,e)$ is therefore always equal to $\ell(d,z_e) = -S(d,e)$ for the proper scoring rule $S$ used in the market. Thus, the above framework captures prediction markets as a special case. However, we now show that prediction markets capture the essential strategic features of this setting. Now, notice that in expectation over the test data $z$, this reward is equal to $R(d^{(t-1)},e) - R(d^{(t)},e)$. Furthermore, we can define the \emph{utility} of the designer to be $u(d,e) = - R(d,e)$, that is, the negative of the risk of that hypothesis on that data distribution. Hence, by the revelation principle, there is some proper scoring rule $S$ that is payoff-equivalent to $u$. A prediction market with proper scoring rule $S$ is strategically identical to the above contest. Thus, with a few small caveats, our above results apply: in a Bayesian game setting where traders have signals $A_1,\dots,A_n$ and a common prior on the distribution of signals and $E$, substitutes characterize ``all-rush'' equilibria with immediate aggregation, while complements characterize ``all-delay'' equilibria. The caveats are (1) that the scoring rule obtained by the revelation principle will not in general be strictly proper if two beliefs about $E$ map to the same optimal hypothesis $d$; and (2) it is not guaranteed that traders can infer others' information from their trades without a condition analogous to the \emph{distinguishability} criterion of Section \ref{sec:markets}. While these hurdles are surmountable, our purpose here is only to mention the key ideas for how the above results on prediction markets will generalize. This connection immediately presents several questions for future work: When, in a machine-learning setting, should we expect contest participants to have substitutable or complementary information? In particular, if agents hold \emph{data sets} and the goal is to elicit these data sets using this structure (as explored in \citet{waggoner2015market}), when should we expect data sets to be substitutable? Furthermore, how can we \emph{design} loss functions so as to encourage substitutability and hence early participation? This last question is discussed in Section \ref{sec:surrogate}. \paragraph{Question-and-answer forums.} \citet{jain2009designing} propose a model for analyzing strategic information revelation in the context of \emph{question-and-answer forums}. Initially, some question is posed. Participants have private pieces of information $A_1,\dots,A_n$ as in the prediction market model, and they arrive iteratively to post answers. Unlike in the prediction market model, rather than arriving multiple times, participants may only post a single answer; however, they may be strategic about \emph{when} they post this answer. By waiting until later, a participant may be able to aggregate information from others' answers, allowing her to post a better response. Unlike in the prediction market setting, participants cannot ``garble'' their information. However these are not essential differences as compared to the substitutes or complements cases of prediction markets, where in equilibrium participants do not want to garble or participate multiple times, but instead fully reveal at the time that is optimal for them (as early or as late as possible, respectively). In the model of \citet{jain2009designing}, the asker of the question has a valuation function $\V(S)$ over subsets of the pieces of information. \citet{jain2009designing} does not justify how such a valuation function may arise, but we can now justify this modeling decision because \emph{any} decision problem faced by the asker gives rise to some such valuation function. In one case of \citet{jain2009designing}, the asker draws a uniform ``stopping threshold'' $t$ on $[\V(\bot), \V(A_i \smallvee \cdots \smallvee A_n)]$ (using our notation), and selects as the ``winning answer'' the one whose information raises her value above this threshold. For instance, if the first two users to post are $i,j$ with signals $A_i,A_j$, and then the third user $k$ posts with signal $A_k$, and we have $\V(A_i \smallvee A_j) < t \leq \V(A_i \smallvee A_j \smallvee A_k)$, then user $k$ is declared the winner. From this model, the expected reward of a participant, which is an indicator for being declared the winner, is exactly proportional to the marginal value of her information to the information collected so far. Thus, substitutes imply that participants' dominant strategy is to rush to participate as early as possible, while complements imply that it is dominant to wait as long as possible. This follows from diminishing (increasing) marginal value of information. And indeed, \citet{jain2009designing} identify substitutes and complements conditions on the information which are exactly diminishing and increasing marginal returns, with the main result as stated above. (The paper also considers several other methods of selecting the winner with more complex features, which we will avoid discussing here for simplicity.) We would like to emphasize that, while the above discussion intentionally highlights the similarities between that work and this one, the authors do not provide any endogenous model of the information, \emph{e.g.} whether it be probabilistic and if so how it is structured, nor of the utility of the asker of the question and how this utility might arise or be related to the structure of the information. Without such models, it does not justify why a structure might satisfy their substitutes or complements conditions (nor when/if one could expect the conditions to hold). Our work provides answers to all of these questions. Information may be modeled as Bayesian signals and the asker may face any decision problem. This gives rise to a valuation function over signals that can capture the model in \citet{jain2009designing}. Furthermore, under this model, that papers' substitutes and complements conditions used in \citet{jain2009designing} are subsumed by those proposed here. Hence, we are able to bring this work under the same umbrella as prediction markets, the crowdsourcing contests discussed above, and the algorithmic and structural results to be discussed later. An example of substitutes for any of these problems is an example for all of them. \subsection{Motivation and challenge} An agent living in an uncertain world wishes to make some decision (whether to bring an umbrella on her commute, how to design her company's website, \dots). She can improve her expected utility by obtaining pieces of information about the world prior to acting (a weatherman's forecast or a barometer reading, market research or automated A/B testing, \dots). This naturally leads her to assign \emph{value} to different pieces of information and combinations thereof. The value of information arises as the expected improvement it imparts to her optimization problem. We would like to generally understand, predict, or design algorithms to guide such agents in acquiring and using information. Consider the analogous case where the agent has value for \emph{items} or goods, represented by a valuation function over subsets of items. A set of items are substitutes if, intuitively, each's value decreases given more of the others; they are complements if it increases. Here, we have rich game-theoretic and algorithmic theories leveraging the structure of substitutes and complements (S\&C). For instance, in many settings, foundational work shows that substitutability captures positive results for existence of market equilibria, while complements capture negative results~\citep{kelso1982job,roth1984stability,gul1999walrasian,hatfield2005matching,ostrovsky2008stability}. When substitutes are captured by submodular valuation functions~\citep{lehmann2001combinatorial}, algorithmic results show how to efficiently optimize (or approximately optimize) subject to constraints imposed by the environment (\emph{e.g.} \citet{calinescu2011maximizing}). For example, an agent wishing to select from a set of costly items with a budget constraint has a $(1-\frac{1}{e})$-approximation algorithm if her valuation function is submodular~\citep{sviridenko2004note}. Can we obtain similar structural and algorithmic results for information? Here, a piece of information is modeled as a \emph{signal} or random variable that is correlated in some way with the state of the world that the agent cares about (whether it will rain, how profitable are different website designs, \dots). Intuitively, one might often expect information to satisfy substitutable or complementary structure. For instance, a barometer reading and an observation of whether the sky is cloudy both yield valuable information about whether it will rain to an umbrella-toting commuter; but these are substitutable observations for our commuter in that each is probably worth less once one has observed the other. On the other hand, the dew point and the temperature tend to be complementary observations for our commuter: Rain may be only somewhat correlated with dew point and only somewhat correlated with temperature, but is highly correlated with cases where temperature and dew point are close (\emph{i.e.} the relative humidity is high). Despite this appealing intuition, there are significant challenges to overcome in defining informational S\&C. Pieces of information, unlike items, may have complex probabilistic structure and relationships. But on the other hand, this structure alone cannot capture the value of that information, which (again unlike items) seemingly must arise from the context in which it is used. Next, even given a measure of value, it is unclear how to formalize an intuition such as ``diminishing marginal value''. Finally, it remains to demonstrate that the definitions are tractable and have game-theoretic and/or algorithmic applications. These challenges seem to have prevented a successful theory of informational S\&C thus far. \vfill \break \subsection{This paper: summary and contributions} This paper has four components. \vspace{1em} \noindent$1$.~~ We propose a definition of informational substitutes and complements (S\&C). Beginning from the very general notion of \emph{value of information} in the context of any specific decision or optimization problem, we define S\&C in terms of diminishing (increasing) marginal value for that problem. This requires a definition of ``marginal unit'' of information. We consider a hierarchy of three kinds of marginal information: learning another signal, learning some deterministic function of another signal, and learning some randomized function (``garbling'') of another signal. These correspond respectively to \emph{weak}, \emph{moderate}, and \emph{strong} versions of the definitions, formalized by strengthenings of \emph{submodularity} and \emph{supermoduarity}. We also investigate some useful tools and equivalent definitons. From an information-theoretic perspective, substitutes can be defined as signals that reveal a diminishing amount of information about a particular event, where the measure of information is some generalized entropy function. From a geometric perspective, substitutes can be defined using a measure of distance, namely some Bregman divergence, on the space of \emph{beliefs} about the event; signals are substitutes if the average change in one's belief about the event is dimininishing in the amount of information already known. \vspace{1em} \noindent$2$.~~ We give game-theoretic applications of these definitions, primarily on information aggregation in prediction markets. When strategic agents have heterogeneous, valuable information, we would like to understand when and how their information is revealed and aggregated in an equilibrium of strategic play. Prediction markets, which are toy models of financial markets, are possibly the simplest setting capturing the essence of this question. However, although the efficient market hypothesis states that information is quickly aggregated in financial markets~\citep{fama1970efficient}, despite much research on this question in economics (\emph{e.g.} \citet{kyle1985continuous,ostrovsky2012information}) and computer science (\emph{e.g.} \citet{chen2007bluffing,dimitrov2008non,gao2013jointly}), very little was previously known about how quickly information is aggregated in markets except in very special cases. We address the main open question regarding strategic play in prediction markets: When and how is information aggregated? We show that informational substitutes imply that all equilibria are of the ``best possible'' form where information is aggregated immediately, while complements imply ``worst possible'' equilibria where aggregation is delayed as long as possible. Furthermore, the respective converses hold as well; \emph{e.g.}, if an information structure guarantees the ``best possible'' equilibria, then it must satisfy substitutes. \begin{theorem*}[Informal] In a prediction where trader's signals are strict, strong substitutes with respect to the market scoring rule, in \emph{all} equilibria, traders rush to reveal and aggregate information immediately. Conversely, if signals are not strong substitutes, then there are arrival orders for traders where \emph{no} equilibrium has immediate aggregation. \end{theorem*} \begin{theorem*}[Informal] In a prediction market where trader's signals are strict, strong complements with respect to the market scoring rule, in \emph{all} equilibria, traders delay revealing and aggregating information as long as possible. Conversely, if signals are not strong complements, then there are arrival orders where \emph{no} equilibrium exhibits full delaying. \end{theorem*} Informational S\&C thus seem as fundamental to equilibria of (informational) markets as substitutable items are in markets for goods. We believe that informational S\&C have the potential for broad applicability in other game-theoretic settings involving strategic information revelation, and toward this end, give some additional example applications. We show that S\&C characterize analogous ``rush/delay'' equilibria in some models of machine-learning or crowdsourcing contests~\citep{abernethy2011collaborative,waggoner2015market} and question-and-answer forums~\citep{jain2009designing}. \vspace{1em} \noindent$3$.~~ We give algorithmic applications, focusing on the complexity of approximately-optimal information acquisition. Namely, we define a very broad class of problems, termed \sigsel/, in which a decision maker wishes to acquire information prior to making a decision, but has constraints on the acquisition process. For instance, a company wishes to purchase heterogeneous, pricey data sets subject to a budget constraint, or to place up to $k$ sensors in an environment. We show that substitutes imply efficient approximation algorithms in many cases such as a budget constraint; this extends to an adaptive version of the problem as well. We also show that the problem is hard in general and in the complements case, even when signals are independent uniform bits. \begin{theorem*}[Informal] For the \sigsel/ problem with e.g. cardinality or budget (``knapsack'') constraints, in the \emph{oracle model} of input: If signals are weak substitutes, then polynomial-time $1-1/e$ approximation algorithms exist; but in general, or even if signals are assumed to be complements, no algorithm can achieve nonzero approximation with subexponentially many oracle queries. \end{theorem*} These results offer a unifying perspective on a variety of similar ``submodularity-based'' solutions in the literature~\citep{krause2005optimal,guestrin2005near,krause2009optimal,golovin2011adaptive}. \vspace{1em} \noindent$4$.~~ We investigate the structure of informational S\&C. We give a variety of tools and insights for both identifying substitutable structure and \emph{designing} for it. For instance, we provide natural geometric and information-theoretic definitions of S\&C and show they are equivalent to the submodularity-based definitions. We address two fundamental questions: Are there (nontrivial) signals that are substitutes for \emph{every} decision problem? Second, given a set of signals, can we always design a decision problem for which they are substitutes? In the game-theoretic settings above, this corresponds to design of mechanisms for immediate aggregation, somewhat of a holy grail for prediction markets. In algorithmic settings, it has relevance for the design of \emph{submodular surrogates}~\citep{chen2015submodular}. Unfortunately, we give quite general negative answers to both questions. Surprisingly, more positive results arise for complements. We give the geometric intuition behind these results and point toward heuristics for substitutable design in practice. \vspace{1em} In summary, the contributions of this paper are twofold: (a) in the definitions of informational S\&C, along with a body of evidence that they are natural, tractable, and useful; and (b) in the applications, in which we resolve a major open problem on strategic information revelation as well as give a unifying and general framework for a broad algorithmic problem. Our results on structure and design of informational S\&C points to potential for these very general definitions and results to have concrete applications. Taken all together, we believe these results give evidence that informational S\&C, in analogy with the successful theories of substitutable goods, have a natural and useful role to play in game theory, algorithms, and in connecting the two. \section{Introduction and Overview} \label{sec:intro} \input{intro} \input{outline} \clearpage \section{Definitions and Foundations} \label{sec:defs} \input{defs} \clearpage \section{Game-Theoretic Applications} \label{sec:game-theoretic} \input{markets} \input{game-other} \clearpage \section{Algorithmic Applications} \label{sec:algorithmic} \input{algorithm} \clearpage \section{Structure and Design} \label{sec:structural} \input{extras} \clearpage \section{Discussion, Conclusion, and Future Work} \label{sec:conclusion} \input{conclusion} \clearpage \bibliographystyle{plainnat} \subsection{Prediction markets} \label{sec:markets} A prediction market is modeled as a Bayesian extensive-form game. The market's setting is specified by a strictly proper scoring rule $S$ and an information structure with prior $P$ and event $E$, and set of signals $A_1,\dots,A_m$. We assume these signals are ``nontrivial'' in that, given all signals but $A_i$, the distribution of $E$ changes conditioned on $A_i$. An instantiation of the market is specified by a set of $n$ traders, each trader $i$ observing some subset of the signals (call the resulting signal $B_i$), and an order of trading $i_1,\dots,i_T$, where at each time step $t=1,\dots,T$, it is the turn of agent $i_t \in \{1,\dots,n\}$ to trade. We assume that no trader participates twice in a row (if they do, it is without loss to delete one of these trading opportunities). The market proceeds as follows. First, each trader $i$ simultaneously and privately observes $B_i$, updating to a posterior belief. Then the market sets the initial prediction $p^{(0)} \in \Delta_E$, which we assume to be the prior distribution $p$ on $E$. We will also refer to a market prediction as the market prices. Then, for each $t=1,\dots,T$, trader $i_t$ arrives, observes the current market prediction $p^{(t-1)}$, and may update it to (``report'') any $p^{(t)} \in \Delta_E$. After the last trade step $T$, the true outcome $e$ of $E$ is observed and each trader $i$ receives payoff $\sum_{t: i=i_t} S(p^{(t)}, e) - S(p^{(t-1)}, e)$. Thus, at each time $t$, trader $i_t$ is paid according to the scoring rule applied to $p^{(t)}$, but must pay the previous trader according to the scoring rule applied to $p^{(t-1)}$. The total payment made by market ``telescopes'' into $S(p^{(T)},e) - S(p^{(0)},e)$. At any given time step $t$, trader $i_t$ is said to be \emph{reporting truthfully} if she moves the market prediction to her current posterior belief on $E$. In other words, she makes the myopically optimal trade. The natural solution concept for Bayesian games is that they be in \emph{Bayes-Nash equilibrium}, where for every player, her (randomized) strategy --- specifying how to trade at each time step as a function of her signal and all past history of play --- maximizes expected utility given the prior and others' strategies. Because this is a broad class of equilibria and can in general include undesirable equilibria involving ``non-credible threats'', it is often of interest in extensive-form games to consider the refinement of \emph{perfect Bayesian} equilibrium. Here, at each time step and for each past history, a player's strategy is required to maximize expected utility given her beliefs at that time and the strategies of the other players. (Note the difference to Bayes-Nash equilibrium in which this optimality is only required \emph{a priori} rather than for every time step.) Here, at any time step and history of play, players' beliefs are required to be consistent with Bayesian updating wherever possible. (It may be that one player deviates to an action not in the support of her strategy; in this case other players may have arbitrary beliefs about the deviator's signal.) To be clear, every perfect Bayesian equilibrium is also a Bayes-Nash equilibrium. Hence, we note that an existence result is strongest if it guarantees existence of perfect Bayesian equilibrium. Meanwhile, a uniqueness or nonexistence result is strongest if it refers to Bayes-Nash equilibrium. \paragraph{Distinguishability criterion.} For most of our results, we will need a condition on signals equivalent or similar to those used in prior works \citep{chen2010gaming,ostrovsky2012information,gao2013jointly} in order to ensure that traders can correctly interpret others' reports. Formally, we say that signals are \emph{distinguishable} if for all subsets $S \subseteq \{1,\dots,m\}$ and realizations $\{a_i : i \in S\}$, $\{a_i' : i \in S\}$ of the signals $\{A_i : i \in S\}$ such that, for some $i \in S$, $a_i \neq a_i'$, \[ \Pr[e \mid a_i : i \in S] \neq \Pr[e \mid a_i' : i \in S] . \] We believe it may be possible to relax this criterion and/or interpret such criteria within the S\&C framework, and this is a direction for future work. \paragraph{Our notation in prediction markets.} Note that, for the proper scoring rule $S$ with associated convex $G$, along with the prior $P$, we have the associated ``signal value'' function $\V$: \[ \V(A) = \E_{a,e} S(p_{a},e) = \E_{a} G(p_{a}) . \] In other words, $\V(A)$ is the expected score for reporting the posterior distribution conditioned on the realization of $A$. A second key point is that, to a trader whose current information is captured by a signal $A$, the set of strategies available to that trader can be captured by the space of signals $A' \preceq A$ on the continuous lattice. This follows because any strategy is a randomized function of her information, so the outcomes of the strategy can be labeled as outcomes of a signal $A'$. \subsubsection{Substitutes and ``all-rush''} We now formally define an ``all-rush'' equilibrium and show that it corresponds to informational substitutes. The naive definition would be that each trader reports truthfully at their first opportunity, or (hence) at every opportunity. This turns out to be correct except for one subtlety. Consider, for example, the final trader to enter the market. Because all others have already revealed all information, this last trader will be indifferent between revealing immediately or delaying. Similarly, consider three traders $i,j,k$ and the order of trading $i,j,i,j,k$. If trader $i$ truthfully reports at time $1$, then trader $j$ is not strictly incentivized to report truthfully at time $2$. She could also delay information revelation until time $4$. \begin{definition} An \emph{all-rush} strategy profile in a prediction market is one where, if the traders are numbered $1,2,\dots$ in order of the first trading opportunity, then each trader $i$ reports truthfully at some time prior to $i+1$'s first trading opportunity (with the final trader reporting truthfully prior to the close of the market). \end{definition} Before presenting the main theorem of this section, we give the following useful lemma (which is quite well known): \begin{lemma} \label{lemma:bne-last-truthful} In every Bayes-Nash equilibrium, every trader reports truthfully at her final trading opportunity. \end{lemma} \begin{proof} Consider a time $t$ at which trader $i = i_t$ makes her final trade. Fix all strategies and any history of trades until time $t$; then $i$'s total expected payoff from all previous time steps is fixed as well and cannot be changed by any subsequent activity. Meanwhile, $i$'s unique utility-maximizing action at time $t$ is to report truthfully, by the strict properness of the scoring rule. If $i$ does not take this action, then her entire strategy is not a best response: She could take the same strategy until time $t$ and modify this last report to obtain higher expected utility. Therefore, in Bayes-Nash equilibrium, $i$ reports her posterior on her final trading opportunity. \end{proof} \begin{theorem} \label{thm:subs-rush-equilibrium} \thmsubsrushequilibrium \end{theorem} \begin{proof} Let the traders be numbered in order of their first trading opportunity $1,2,\dots,n$ and let $B_i$ be the signal of trader $i$. Before diving in, we develop a key idea. In equilibrium, we can view the market prediction $p^{(t)}$ at time $t$ as a random variable. Then, construct a ``signal'' $C^{(t)}$ capturing the information contained in $p^{(t)}$. This can be pictured as the information conveyed by $p^{(t)}$ to an ``outside observer'' who knows the prior distribution and the strategy profile, but does not have any private information. Furthermore, if traders $1,\dots,k$ have participated thus far, then $C^{(t)}$ is an element of the continuous signal lattice with $C^{(t)} \preceq B_1 \smallvee \cdots \smallvee B_k$, because $p^{(t)}$ is a well-defined, possibly-randomized function of $B_1 \smallvee \cdots \smallvee B_k$. Finally, if all participating traders have been truthful, then $C^{(t)}$ is a member of the subsets signal lattice $\Lat$, as it exactly reveals the subset of the signals held by those traders. Now, let $t_i^*$ be $i$'s final trading opportunity prior to $i+1$'s first trading opportunity. We prove by backward induction on $t$ that, in BNE and for any participant $i$ participating at some time $t \geq t_i$, the following holds: if $C^{(t)}$ is an element of the subsets lattice $\Lat$, then $i$ reports truthfully at $t$. Now, suppose we have successfully proven this claim by backward induction; let us finish the proof. The claim implies that $C^{(t)}$ really is in $\Lat$ and $i$ really is truthful at all such time steps for the following reason: $C^{(0)}$ is the null signal and is an element of $\Lat$, so trader $1$ participates truthfully, which implies that $C^{(t_2)} \in \Lat$, which implies that $2$ participates truthfully, and so on. So in any BNE, all participants play all-rush strategies. Now let us prove the statement. For the base case $t=T$, the trader participating at the final time step is truthful by Lemma \ref{lemma:bne-last-truthful}. Now for the inductive step, consider any $t = t_i$ for some $i$. If $t$ is $i$'s final trading opportunity, then by Lemma \ref{lemma:bne-last-truthful}, in BNE $i$ reports truthfully at $t$. If $t < t_i^*$, then there is nothing to prove. Otherwise, let $t'$ be $i$'s next trading opportunity after $t$. By inductive hypothesis, $i$ is truthful at time $t'$ and thereafter. We compute $i$'s expected utility for any strategy, and show that if $i$ is not truthful at $t$, she can improve by deviating to the following strategy: Copy the previous strategy up until $t$, report truthfully at $t$, and make no subsequent updates. At $t'$, $i$'s strategy can be described as reporting truthfully according to $C^{(t')} = C^{(t'-1)} \smallvee B_i$. For this trade, $i$ obtains expected profit $\V(C^{(t')}) - \V(C^{(t'-1)})$, and $i$ obtains no subsequent profit once her information is revealed. Meanwhile, consider $i$'s strategy at time $t$, which induces some signal $C^{(t)} \preceq B_i \smallvee C^{(t-1)}$. For this trade, $i$ obtains expected profit at most $\V(C^{(t)}) - \E G(p^{(t-1)})$. This follows because a trade conveying signal $C^{(t)}$ obtains at most $\V(C^{(t)})$.\footnote{Although we don't explicitly use it here, this implies that in equilibrium, every $p^{(t)} = p_{c^{(t)}}$, that is, the price at time $t$ equals the posterior distribution on $E$ conditioned on all information that has been revealed so far, including at time $t$.} Let $U$ be $i$'s total expected utility at time $t$ and greater. Once $i$ reports truthfully at $t'$, she expects to make no further profit in equilibrium. So \[ U \leq \V\left(C^{(t)}\right) - \E G\left(p^{(t-1)}\right) + \V\left(C^{(t'-1)} \smallvee B_i\right) - \V\left(C^{(t'-1)}\right) . \] Now suppose $C^{(t'-1)}$ is in $\Lat$ and $i$ is not reporting truthfully at $t$. This implies that $B_i \not\preceq C^{(t'-1)}$. By strong, strict substitutes, $B_i$ gives higher marginal benefit to $C^{(t)}$ than to $C^{(t'-1)}$: \[ \V(C^{(t'-1)} \smallvee B_i) - \V(C^{(t'-1)}) < \V(C^{(t)} \smallvee B_i) - \V(C^{(t)}) . \] So \[ U < \V(C^{(t)} \smallvee B_i) - \E G(p^{(t-1)}) . \] But $i$ can achieve this by deviating to being truthful at time $t$, then not participating at any subsequent times. (This follows because if $i$ is truthful at time $t$, she reveals the signal $C^{(t-1)} \smallvee B_i$, which is exactly the same as $C^{(t)} \smallvee B_i$.) This deviation does not affect $i$'s utility from any previous times, so it is a strategy with higher total expected utility. So $i$'s only BNE strategy can be to be truthful at $t$. \end{proof} \begin{theorem} \label{thm:subs-nonrush} \thmsubsnonrush \end{theorem} \begin{proof} The assumptions imply that there signals on the subsets lattice $A,B$ and some $A'$ on the continuous lattice with $A' \preceq A$ and \[ \V(A' \smallvee B) - \V(A') < V(A \smallvee B) - \V(A) . \] Then in particular, we can consider the scenario with two traders where ``Alice'' has signal $A$ (i.e. she observes the corresponding subset of signals) and Bob has $B$, with a trading order Alice-Bob-Alice. In perfect Bayesian equilibrium (PBE), Bob must be truthful at his trading opportunity according to his beliefs even if Alice deviates from her strategy. By distinguishability, Alice can infer his signal from this truthful report, so in any PBE, Alice is truthful and correct in predicting $p_{ab}$ at the second opportunity. Hence the two traders' expected utilities sum to the constant amount $\V(A \smallvee B) - \V(\bot)$, even when Alice deviates. If Alice reports truthfully at her first opportunity (the all-rush strategy), then Bob's expected utility is $\V(A \smallvee B) - \V(A)$. But if Alice reports according to $A' \preceq A$, then Bob's expected utility is at most $\V(A' \smallvee B) - \V(A')$, which by assumption of non-substitutes is strictly smaller. This implies that Alice prefers the deviation, so truthful reporting (and thus all-rush) could not have been an equilibrium. \end{proof} \subsubsection{Complements and ``all-delay''} We begin by defining an ``all-delay'' strategy profile, analogous to all-rush. \begin{definition} An \emph{all-delay} strategy profile in a prediction market is one where, when the traders are numbered $1,\dots,n$ in order of their final trading opportunity, each trader $i \geq 2$ reveals no information until after trader $i-1$'s final trading opportunity. \end{definition} \begin{theorem} \label{thm:comps-delay-equilibrium} \thmcompsdelayequilibrium \end{theorem} \begin{proof} The ideas will be substantially the same as in Theorem \ref{thm:subs-rush-equilibrium}, but the deviation argument is somewhat trickier. In the substitutes ``rush'' case, an agent could deviate to immediate truth-telling and ignore all subsequent consequences. Now, we will need agents to deviate to delaying all information revelation, relying on their opponents' response to ensure this becomes profitable later. This is also the reason that we restrict to perfect Bayesian equilibrium. The proof is by backward induction. We show that in any perfect Bayesian equilibrium: at each time $t$, if $C^{(t)}$ is on the subsets lattice, then players play an all-delay strategy from time $t$ onward. (As in the proof of Theorem \ref{thm:subs-rush-equilibrium}, let $C^{(t)}$ be the signal induced by the random variable $p^{(t)}$ in equilibrium. Because in PBE strategies are well-defined in every subgame, $C^{(t)}$ is also well-defined off the equilibrium path.) As in Theorem \ref{thm:subs-rush-equilibrium}, this will prove the statement, because $C^{(0)}$ is on the subsets lattice, corresponding to $\emptyset$, so the first trader plays all-delay at time $1$, implying that $C^{(1)}$ is on the subsets lattice, etc. For the base case, at $t=T$, this is the trader's final opportunity, so she is truthful by Lemma \ref{lemma:bne-last-truthful}, which constitutes an all-delay strategy from $T$ onward. Now consider any trading time $t=T$ and participant $i$ trading at time $t$. First suppose $t$ is $i$'s final trading opportunity; then by Lemma \ref{lemma:bne-last-truthful}, she reports truthfully at this time. By induction, traders play all-delay at all times after $t$, so this shows that they play all-delay from time $t$ onward. If $t$ is not a trader's final trading opportunity, but is after $i-1$'s final trading opportunity, then there is nothing to prove for this time step. So suppose trader $i$ is trading at time $t$ with $i-1$'s final opportunity coming at some $t_{i-1} > t$. The inductive assumption implies that in any subgame starting at time $t+1$ in PBE, $i$ does not make any update until some $t' > t_{i-1}$. It also implies that no other trader participates between $t_{i-1}$ and $t'$. Finally, it implies that all traders participating between time $t$ and $t'$ (exclusive) report truthfully\footnote{In a trading order such as $i,j,k,j,k$, it is possible that $j$ reports something nontrivial at time $2$, then reports truthfully at time $4$. But $k$ does not participate at time $3$, so $j$'s multiple reports WLOG telescope into a single truthful report.}. Let $B$ denote the join of their signals. Then $i$'s total utility from time $t$ onward is \[ U = \V\left(C^{(t)}\right) - \E G\left(p^{(t-1)}\right) + \V\left(C^{(t)} \smallvee B \smallvee B_i\right) - \V\left(C^{(t) \smallvee B}\right) . \] Now suppose for contradiction that $i$ reveals some nontrivial information at time $t$, \emph{i.e.} $C^{(t)} \neq C^{(t-1)}$. Then $i$ can deviate to revealing nothing at time $t$, reporting according to $C^{(t-1)}$, and being truthful at time $t'$. In this case, by assumption of PBE, others continue to best-respond. By inductive assumption, in any subgame of a PBE (which itself must be in PBE), others who participate between $t$ and $t'$ therefore continue to report truthfully, implying that $B$ is still revealed between time $t$ and $t'$. Now, strong, strict complements imply \[ \V\left(C^{(t)}\right) - \V\left(C^{(t-1)}\right) < \V\left(C^{(t)} \smallvee B\right) - \V\left(C^{(t-1)} \smallvee B\right) . \] So \[ U < \V\left(C^{(t-1)}\right) - \E G\left(p^{(t-1)}\right) + \V\left(C^{(t)} \smallvee B \smallvee B_i\right) - \V\left(C^{(t-1)} \smallvee B\right) . \] But this is $i$'s utility for the deviation above (note that $C_t \smallvee B \smallvee B_i = C_{t-1} \smallvee B \smallvee B_i$). Since the deviation is profitable, this gives a contradiction, implying that $i$ (and all players) must play all-delay starting from time $t$ in any PBE. \end{proof} \begin{theorem} \label{thm:comps-nondelay} \thmcompsnondelay \end{theorem} \begin{proof} Analogous to the substitutes case (Theorem \ref{thm:subs-nonrush}). The assumptions imply that there are subsets-lattice signals $A,B$ and continuous-lattice signal $A' \preceq A$ such that \[ \V(A' \smallvee B) - \V(A') > V(A \smallvee B) - \V(A) . \] Then in particular, we can consider the scenario where ``Alice'' has signal $A$ and Bob has $B$, with a trading order Alice-Bob-Alice. In PBE, Bob is truthful even if Alice deviates. By distinguishability, Alice can infer his signal from this truthful report, so in any PBE, Alice is truthful and correct in predicting $p_{ab}$ at the second opportunity. So utilities have the constant sum $\V(A \smallvee B) - \V(\bot)$ even when Alice deviates. If Alice reports nothing at her first opportunity, then Bob's expected utility is $\V(B) - \V(\bot)$. But if Alice deviates to reporting to $A' \preceq A$, then Bob's expected utility is at most $\V(A' \smallvee B) - \V(A')$, which is strictly smaller. This implies that Alice prefers the deviation, so truthful reporting (and thus all-rush) could not have been an equilibrium. Hence, in perfect Bayesian equilibrium, trader $1$ cannot play all-delay. \end{proof} \paragraph{Discussion.} These results show that informational S\&C are in a sense unavoidable in the study of settings such as prediction markets. However, the result raises many interesting questions for future work. Two major questions are: How can we identify structures that are substitutes or complements? and How can we \emph{design} markets to encourage substitutability? We give some initial steps toward answering these questions in Section \ref{sec:structural}. \subsection{Outline} Two sections have been placed in the appendix for convenience. Appendix \ref{sec:related} gives a detailed survey of related work in a variety of areas. In Appendix \ref{sec:develop}, we overview and justify our general approach to defining informational S\&C, including historical context, tradeoffs, and intuition. We particularly focus on a comparison to the proposed definitions of \citet{borgers2013signals}, which we build on in this paper. In Section \ref{sec:defs}, we concisely and formally define informational S\&C. We show that prediction problems, and the modern convex analysis understanding of them, can be used to analyze general decision problems. Leveraging these tools, we give three equivalent definitions from seemingly-disparate perspectives. In Section \ref{sec:game-theoretic}, we present game-theoretic applications. Primarily, we show that informational substitutes (complements) characterize best-case (worst-case) information aggregation in prediction markets. In Section \ref{sec:algorithmic}, we present algorithmic applications. We define \sigsel/, a class of information acquisition problems, and show that substitutes correspond to efficient approximation algorithms while there are strong hardness results in general. In Section \ref{sec:structural}, we investigate informational S\&C themselves with an eye toward the previous applications. We give some results on general classes of S\&C and on the design of prediction or optimization problems for which a given information structure is substitutable, with both game-theoretic and algorithmic implications. Section \ref{sec:conclusion} summarizes and discusses future work. \subsubsection{Substitutes and complements} The notion that pieces of information may exhibit substitutable or complementary features is certainly not a new intuition; but up until this work, it seems to have remained mainly an intuition. There seem to be few attempts at formalizing a general definition or even special cases. The only work we know of in this direction is \citet{borgers2013signals}, which inspires our approach but also has significant drawbacks and limitations. We extensively discuss \citet{borgers2013signals} in in Section \ref{sec:develop}, where we contrast it with our definitions. Two works in (algorithmic) game theory touching on informational S\&C are \citet{jain2009designing} and \citet{milgrom1982value}; however, these do not propose general definitions. They are discussed below. Somewhat related is the game-theoretic notion of \emph{strategic substitutes and complements}~\citep{bulow1985multimarket}. Roughly, these concepts refer to cases where a change in action by one player in a game results in a response from another that is similar to the first player's (in the case of complements) or offsetting (in the case of substitutes). This notion seems relatively unrelated to our definitions of informational S\&C. For one, our definitions focus on the case of a single decisionmaker or single optimization problem. Also, strategic S\&C can be defined in complete-information games, where there are no signals or information of any kind. However, perhaps future work can discover classes of games in which the notions are more closely related. \paragraph{Valuations for items.} In contrast to the lack of literature on informational S\&C, in the case of valuation functions for \emph{items}, substitutability and complementarity have been put on firm formal foundations, with strong connections between substitutes and existence of equilibria in markets for goods or matching markets~\citep{kelso1982job,roth1984stability,gul1999walrasian,hatfield2005matching,ostrovsky2008stability}. In computer science, the literature on optimization has produced strong positive results leveraging substitutable structure. The main example of this is submodularity, which has been connected to computational tractability throughout theoretical computer science and machine learning~\citep{krause2012submodular}. Submodularity, in addition to having nice algorithmic properties, is also recognized as a natural model of substitutes in (algorithmic) game theory~\citep{lehmann2001combinatorial}. This paper draws parallels to such research because our definition of informational substitutes turns out to correspond formally to submodular valuation functions. We show market equilibrium results of a similar flavor, but for ``information markets''; and we also show algorithmic results of a similar flavor for the problem we call \sigsel/, which is the problem of selecting an optimal set of signals subject to constraints. However, we emphasize that informational S\&C pose challenges that do not arise in the item setting: \begin{itemize} \item Items are modeled as having an \emph{a priori} innate value. Information is not; its value must arise from context. \item Items are modeled as being \emph{atomic} or indivisible, with no inner structure. In contrast, information, modeled as \emph{e.g.} random variables, is defined by inner structure: the probability distributions from which it is drawn. \item The relationship between items is completely determined by the valuation function in the context of interest. Concretely, when modeling a set function $f:2^{\{1,\dots,n\}} \to \R$, it is usually not the case in the model that items $3$, $7$, and $k$ have a special relationship that has an impact on allowable forms of $f$. In contrast, in a value-of-information setting, the value of observing a triple of signals cannot be completely arbitrary; it must depend somehow on correlations between these signals. \end{itemize} We give an in-depth description of how our definitions overcome these challenges in Section \ref{sec:develop}. \subsubsection{Information in markets} The ``efficient markets hypothesis'' (EMH) refers to a large set of informal conjectures about how quickly information is revealed and incorporated into the prices of financial instruments in markets. For our purposes, a ``financial instrument'' may be formalized as a \emph{security} with an uncertain value, which will be revealed after the close of the market; each share purchased of that security may then be redeemed for a payout equal to this revealed true value of the security. Concretely, one can picture a binary security that has value $1$ if a certain event occurs and $0$ otherwise. \citet{fama1970efficient} discussed formalizations of the EMH with varying levels of strength. \citet{kyle1985continuous} defined a formal model of financial traders in markets, involving both informed traders and ``noise'' traders who are uninformed and essentially trade randomly; this is the current most common model of such trading in the economics literature. However, formal progress on this question was very slow until \citet{ostrovsky2012information} showed that, in equilibrium of this model, information is always \emph{eventually} aggregated under a certain condition on securities. Formally, this means that the price of a security converges to its \emph{ex post} expected value conditioned on the information held by all traders. \citet{ostrovsky2012information} considered both finite-round and infinite-round markets (with and without discounting), and considered \emph{prediction markets} (described below) as well as Kyle's model. One subtlety that may be worth pointing out is that, in an infinite-round market without discounting, it is not known that a Bayes-Nash equilibrium always exists, while this is known for the other cases. \citet{ostrovsky2012information} showed in all cases that aggregation occurs in any equilibrium, under his ``separability'' condition on securities. The condition essentially ensures that, if information is not yet aggregated, then some participant has information that can be used to make a ``useful'' trade, \emph{i.e.} one that makes money and (therefore) intuitively makes ``progress'' toward aggregation. This showed that information is eventually aggregated; but \emph{how} is it aggregated? It would be ideal if traders rush to reveal their information, but very bad if they ``delay'' as long as possible. Such questions are difficult to address in the economic model of financial markets of \citet{kyle1985continuous,ostrovsky2012information}. Research on the dynamics of strategic trading has made some progress in the model of prediction markets. These are simplified financial markets in which there are no uninformed ``noise'' traders and in which participants generally interact one-at-a-time with a centralized market maker, who sets prices via a transparent mechanism and subsidizes the market. Specifically, research on strategic play focuses, as does this paper, on the \emph{market scoring rule} design of prediction markets~\citep{hanson2003combinatorial}, which are based on proper scoring rules (see \emph{e.g.}~\citet{savage1971elicitation,gneiting2007strictly}). However, we note that market scoring rule markets are equivalent, in a strategic sense, to more traditional-looking ``cost function'' based prediction markets~\cite{abernethy2013efficient}. The following was known about equilibrium in such markets prior to this work, in addition to \citet{ostrovsky2012information}. \citet{chen2007bluffing} studied the $\log$ scoring rule and a particular type of information structure among the traders, namely, that each trader's ``signal'' (information) was distributed independently of all others' conditional on the true value of the security. (For a simple example of such a structure, suppose that the true value of the security is distributed randomly in some way; then each trader observes this true value plus independent noise.) In this conditionally-independent case, \citet{chen2007bluffing} showed that the ``ideal'' outcome does indeed occur in equilibrium: Traders all rush to reveal their information as early as possible. Subsequently, \citet{dimitrov2008non} also studied the $\log$ scoring rule but considered other signal structures, particularly independent signals (that is, unconditionally independent). For a simple example, suppose each trader observes an i.i.d. random variable, and the true value of the security equals the sum of all the traders' observations. \citet{dimitrov2008non} showed that, in this case, the ``ideal'' outcome does not occur. However, when assuming discounting and an infinite number of trading rounds, \citet{dimitrov2008non} showed that information is ``eventually'' aggregated. This result was generalized to any scoring rule (not just $\log$) by \citet{ostrovsky2012information}. \citet{chen2007bluffing} and \citet{dimitrov2008non} were combined and extended in \citet{chen2010gaming}. Then, \citet{gao2013jointly} revisited the $\log$ scoring rule in finite-round markets and considered the information structure where all traders signals are unconditionally independent. In this case, \citet{gao2013jointly} showed that the ``worst possible'' outcome occurs in equilibrium: Traders all delay as long as possible before making any trades based on their information. This casts doubt on the efficient markets hypothesis and suggests, taken in tandem with \citet{chen2007bluffing}, that structure of information is crucial to determining strategic behavior. \subsubsection{Other game-theoretic settings.} In almost any Bayesian extensive-form game, the question of information revelation is relevant. While we hope that future work may expand the set of topics to which informational substitutes and complements may apply, in this section, we will focus on the most closely related works, those that directly touch on S\&C, or those for which we show results in Section \ref{sec:game-other}. The model of prediction markets is in some sense the simplest model of strategic information revelation in dynamic settings. Thus, it is natural that settings such as crowdsourcing contests are closely related. One such model of crowdsourcing and machine-learning contests appears in \citet{abernethy2011collaborative,waggoner2015market}. In that framework, participants iteratively provide data sets or propose updates to a central machine-learning hypothesis, being rewarded for the improvement they make to performance on a test set of data. A prediction market can be seen as a special case. Those works did not address strategic equilibria of the mechanisms they proposed. Another related setting is the model of question-and-answer forums in \citet{jain2009designing}. That paper introduced a model where an asker has some value function for ``pieces of information'', which are not modeled directly. Participants can strategically choose when to reveal information. \citet{jain2009designing} identified ``substitutes'' and ``complements'' cases in which participants rush (respectively, delay) to provide answers. However, \citet{jain2009designing} did not provide any endogenous model for asker utility or information; the information was modeled almost as discrete items without structure. Hence, it was not clear from that work under what circumstances (if any) pieces of information would satisfy their substitutes and complements conditions. In Section \ref{sec:game-other}, we describe implications of our work for results in the above two settings. More broadly, there are large literatures dealing with signalling in games~\citep{spence1973job}, or the more recent Bayesian persuasion literature~\citep{kamenica2011bayesian,gentzkow2011competition,dughmi2015algorithmic}. While the models and questions in this area are related, to our knowledge there is no immediate connection. It may be that future work uncovers connections of informational S\&C to this field, but the literature on persuasion and signalling in games does not seem to have developed notions of informational substitutes nor tools for addressing the applications considered in this paper. Another significant line of work has considered signalling in auctions, \emph{e.g.} \citet{milgrom1981rational,milgrom1982value}. The only paper in this literature that we know to explicitly formalize a notion of substitutable information is \citet{milgrom1982value}, which considers a common-value auction with two bidders, one informed and one uninformed, with two signals, each a real-valued random variable with some positive affiliation with the item's value. The authors define a notion of substitutes specific to their context and show that it implies intuitive properties for this asymmetric-information auction setting. In future work, it would be interesting to see if there is a formal connection of our definitions to their setting. \subsubsection{Algorithms for information acquisition.} The value of information to a decision problem was formally introduced by \citet{howard1966information} and is also closely related to the classic problem in statistics of Bayesian experimental design~\citep{lindley1956measure}. Given this perspective, it is natural to consider the problem of acquiring information under constraints. This problem has historically been investigated from many different angles, \emph{e.g.}~\citep{mookerjee1997sequential}. It is known to be very computationally difficult in some general settings~\citep{krause2009optimal}. A successful recent trend in this area is to leverage submodular structure to apply efficient approximation algorithms. For instance, an approximation ratio of $(1-1/e)$ is obtained by the greedy algorithm for maximizing a monotone submodular function subject to a cardinality constraint. This algorithm or related submodular maximization algorithms were utilized by \citet{krause2005optimal,guestrin2005near}, and a variety of literature since; see \citet{krause2012submodular} for a survey. In cases where the information is acquired not in a batch but adaptively over time, based on the information observed so far, the problem (and/or solution) is known as \emph{adaptive submodularity}~\citep{asadpour2008stochastic,golovin2011adaptive}.
{'timestamp': '2017-03-28T02:02:50', 'yymm': '1703', 'arxiv_id': '1703.08636', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08636'}
arxiv
\section*{Abstract} Near all-sky imaging photometry was performed from a boat on the Gulf of Aqaba to measure the night sky brightness in a coastal environment. The boat was not anchored, and therefore drifted and rocked. The camera was mounted on a tripod without any inertia/motion stabilization. A commercial digital single lens reflex (DSLR) camera and fisheye lens were used with ISO setting of 6400, with the exposure time varied between 0.5 s and 5 s. We find that despite movement of the vessel the measurements produce quantitatively comparable results apart from saturation effects. We discuss the potential and limitations of this method for mapping light pollution in marine and freshwater systems. This work represents the proof of concept that all-sky photometry with a commercial DSLR camera is a viable tool to determine light pollution in an ecological context from a moving boat. \section{Introduction} Artificial light at night (ALAN) allows humans to extend activities up to a 24 hour-a-day period. While indoor use of ALAN can affect human health as it disrupts the natural circadian rhythm and suppresses melatonin production \cite{Stevens:2015}, the direct photo-related environmental consequences are usually small as the light is mainly confined in buildings. Outdoor lighting on the other hand may have less dramatic consequences on human health \cite{Stevens:2015}, but ALAN can spill into the naturally nocturnal landscapes and cause light pollution (LP). The increase of outdoor ALAN is a global phenomenon with growth rates of 3-6 $\%$ per year in industrialized countries and higher in developing regions \cite{book:Narisada, Hoelker:2010_b}. Sustainable lighting technology may help to reduce the overall LP \cite{Lyyti:2015}. Several studies have investigated the impact of ALAN on the environment \cite{book:rich_longcore} and there is a growing concern that LP affects biodiversity \cite{Hoelker:2010_a, Gaston:2015_ptb}. Until recently, the main focus of studies about ecological LP was on terrestrial animals \cite{book:rich_longcore, rowse2016dark, robert2015artificial, macgregor2015pollination} and plants \cite{macgregor2015pollination, bennie2016plants}. However, because human settlements concentrate along freshwater reservoirs and coastlines, research on ecological LP has shifted towards aquatic systems \cite{davies2014marine, Perkin:2011, Moore:2000, bruening2015spotlight, Jechow2016}. Historically, the first evaluations of the night sky brightness (NSB) in the context of LP were performed by astronomers \cite{Riegel1973, berry1976light}. They concentrated their investigations on clear sky conditions and the ability to observe celestial objects. However, illumination conditions due to LP and artificial skyglow (the backscattered portion of the upwelling ALAN) vary dramatically with meteorological conditions, especially clouds \cite{Kyba:2011_sqm, Kocifaj:2014_cloud_theory, jechowALAN, Ribas2016clouds}. Recent work on clouds was linking NSB data with laser ceilometer measurements \cite{Ribas2016clouds}. The combination of satellite data and radiative transfer modelling can provide accurate estimates of the NSB for clear skies \cite{falchi2016WA}, but is not (yet) applicable to overcast situations. Ground based NSB measuring methods can provide information in overcast conditions. These include single sensors such as inexpensive handheld sky brightness meters \cite{Cinzano_sqm:2005} with the advantage of providing data from citizen scientists, hobby astronomers and researchers on a local to global scale \cite{Jechow2016, Kyba:2015_isqm, Pun:2014}. The drawback of this method is that no spatial and no spectral information is available, and most devices only measure the NSB at zenith, potentially missing out higher fractions of LP near the horizon \cite{Jechow2016, jechowALAN, kocifaj2015zenith}. Photometry with DSLR cameras and fisheye-lenses \cite{Jechow2016, Kollath:2010} or mosaics \cite{Duriscoe:2007} can provide this spatial information about the NSB, and have become available for the public at reasonable prices since consumer electronics has become a mass phenomenon. Usually all-sky photometry as part of astro-photometry is done in a terrestrial context using special filters, long exposure times and fixed tripods or mounts, potentially involving even compensation for the Earth’s rotation \cite{Duriscoe:2007}. In astro-photometry, well known objects are used as references for extinction measurements and the studies very often concern single stars and very dark sites \cite{romanishin2006introduction}. A very interesting and powerful device in this context is the ASTMON (All-Sky Transmission MONitor) making use of all-sky imaging in several spectral bands with a filter wheel \cite{aceituno2011all}, which was also used in areas with LP \cite{aube2016spectral}. For the measurement of the NSB in the context of ecological LP and to compare different sites this precision is not necessary. The effects of ALAN can vary by orders of magnitudes within a radius of several tens of kilometers \cite{jechowALAN, Pun:2014} or by weather conditions \cite{Jechow2016, Ribas2016clouds}. For most species, the amount of light is the important parameter rather than single celestial objects. However, visual animals might react on the directionality that cannot be observed by single sensor devices like lux meters. NSB measurements with either single sensors or all-sky photometry are only sparsely done in an aquatic or even in a marine context \cite{Kyba:2015_isqm}. We have recently quantified the NSB at a freshwater lake in Germany from a floating platform using both methods \cite{Jechow2016}. However, the platform was anchored and rocking only slightly. Here we demonstrate that (near) all-sky photometry can also be done from a moving boat in a marine context by using a commercial DSLR camera with a fisheye lens. The camera was mounted on a tripod, without using motion-compensation. Despite this, we obtained NSB measurements with spatial information from almost the whole hemisphere. In this proof-of-concept study, we discuss the limitations and the potential of this method in the context of applying it to investigate the spread of LP, and in particular skyglow, from coastal towns into unpolluted areas across open waters. \section{Methods} \subsection{The study site} The measurements were performed during astronomical night on the 5th of March 2016 near the city of Eilat in Israel on the Gulf of Aqaba close to the Interuniversity Institute for Marine Sciences (IUI) at 29$^{\circ}$29'33.0"N, 34$^{\circ}$55'54.8"E (see Fig. 1) from an 6.7 m long and 3.45 m wide single engine boat. Parts of the western shoreline north of the IUI are a marine protected area: Eilat's Coral Beach Nature Reserve and Conservation area, a nature reserve and national park in the Red Sea. It covers 1.2 kilometers of shore, and is the northernmost coral reef in the world. \begin{figure}[h] \centering \includegraphics[width=160mm]{Fig1.jpg} \caption{NSB measurement site. Left image: the Gulf of Aqaba with the Sinai Peninsula on the left and Jordan and Saudi Arabia on the right. Red circle marks the measurement region. Right image – the northern tip of the Gulf of Aqaba where the fisheye lens observations were made. The blue arrow represents the measurement location near the border of Egypt, Jordan and Israel. The red arrow and circle indicate the city of Aqaba, the white arrow and circle indicate the city of Eilat and the yellow arrow shows the position of the Interuniversity Institute for Marine Science (IUI).} \label{site} \end{figure} \subsection{Digital single lens reflex camera with fisheye lens} NSB measurements can be performed with calibrated DSLR cameras that allow saving images in an unaltered raw format \cite{Kollath:2010, KybaLonne2015, RibasLonne2017}. After calibration, it is possible to convert the camera’s radiance observations in digital numbers to photopic luminance, and to produce false color images that show spatially resolved NSB in units of cd/m$^2$, mag$_{SQM}$/arcsec$^2$ or natural sky units (NSU), respectively. If carefully calibrated, it is possible to reach 10 percent precision with a commercial DSLR camera \cite{Kollath:2010}. The NSU is a useful translation of NSB into a relative unit, comparing how much a site differs from a relatively unpolluted site defined to have a value of 1 NSU. It was introduced to allow non-astronomers to quickly rate the amount of LP at different locations (see e.g. \cite{Kyba:2015_isqm}) using values from the widely used sky quality meter (SQM, Unihedron, Canada). NSU = 1 is defined at 21.6 mag$_{SQM}$/arcsec$^2$, and 254µcd/m$^2$, respectively. It can be transformed by using the equation: NSU=(10)$^{0.4(21.6-X)}$, where X is the NSB in mag$_{SQM}$/arcsec$^2$. Please note that the NSU is not arbitrary but based on a real photometric quantity “magnitudes” dating back to Pogsons recommendation in 1856 \cite{pogson1856magnitudes} and that there is a deviation between Johnson V-band (used for magnitudes in astronomy), the photopic response curve of the human eye, the response curve of the SQM and the DSLR cameras spectral response \cite{haenel2017}. We used a Canon EOS 6D camera with a Sigma EX DG circular fish-eye lens. The lens has a focal length of 8 mm and an aperture of F3.5. The camera has a 20.2 Megapixel full frame (36 mm x 24 mm) CMOS sensor and an integrated GPS tracker. The camera was cross-calibrated with a thoroughly calibrated camera during an earlier measurement campaign \cite{KybaLonne2015} and several DSLR cameras in a recent intercomparison campaign \cite{RibasLonne2017}. Pictures were obtained in full format (5472 pixel x 3648 pixel), with ISO setting of 6400, and a varied exposure time between 0.5 seconds and 5 seconds. All images were saved in raw format. The images were processed using ``DiCaLum Ver. 0.9'' \cite{kollath2017} an open source code based on the free software GNU Octave \cite{eaton1997gnu}. \section{Results and discussion} \subsection{Fisheye-lens images} In Figure 2, (near all-sky) fisheye-lens pictures taken from the slightly rocking and turning boat are shown for different exposure times a) 5 seconds (image $\#$1517), b) 2 seconds (image $\#$1518), c) 1 second (image $\#$1519) and d) 0.5 seconds (image $\#$1520). All four pictures were taken at 21:42 pm local time (19:42 pm GMT). The camera was orientated approximately towards the northeast/southwest axis of the Gulf, with the lower part of the image pointing to the northeast. The camera was not aimed directly towards zenith in order to illustrate the light reflected from the water surface. Therefore, it is not exactly all-sky imaging. The two distinct light domes that are visible at the bottom in Fig 2 a) are from the center of Eilat (white arrow with black filling on the lower left) and Aqaba (red arrow without filling on the lower right). The rocking of the boat was relatively strong and is apparent by a distinct ``smearin'' of the stars in the pictures. To illustrate the possible impact of this rocking on the NSB measurements, Fig. 3 a)-d) shows zoom in pictures from the same images as in Fig 2 a)-d). The upper left area of the images was chosen, which is pointing to the southwest and included Sirius (magnitude -1.46, marked with a red circle) and the constellation of Orion (indicated with a light blue circle). The constellation Orion is best visible in Fig. 3 c) and d) with low smearing. Here, the belt of three stars (Alnitak, Alnilam and Mintaka) aligned on an axis with Sirius can be seen. In all four images, the smearing can be tracked best with Sirius. In Fig. 3 a) and b), the smearing is strong and spiral, while in Fig. 3 c) the smearing is less strong and linear. In Fig. 3 d), the smearing is lowest but still perceptible by a linear distortion of the stars that should be point sources. As expected, the longer the exposure time, the more susceptible to smearing by rocking and drifting. From the movement of the constellation between the different images, it can also be seen that the boat was slowly rotating clockwise. The zoomed in sections also show that the signal to noise ratio was slightly decreased when the exposure times were reduced. However due to the smearing the signal to noise improvement by increased exposure time is not as pronounced as with still images, as the signal now spreads over several different pixels instead of summing up on one pixel. \begin{figure}[htbp!] \centering \includegraphics[width=143mm]{RGB_pics_Eilat_new_img.jpg} \caption{Near all-sky pictures of the night sky above the study site obtained from a non-anchored, rocking boat using a commercial DSLR camera (Canon EOS 6D) with a fisheye lens (Sigma EX DG 8 mm). An ISO setting of 6400 was used with different exposure times of a) image $\#$1517 with 5 seconds exposure b) image $\#$1518 with 2 seconds exposure time c) image $\#$1519 with 1 second exposure time and d) image $\#$1520 with 0.5 seconds exposure time. Black and white arrow points to Eilat and red arrow to Aqaba.} \vspace{2mm} \centering \includegraphics[width=143mm]{Bild1.png} \caption{Zoom in of the pictures of Figure 2 showing the detail of constellation of Orion (blue circle) and Sirius (red circle).} \label{zoom} \end{figure} \subsection{Luminance maps} The fisheye images have been converted to luminance maps that are shown in Figure 4 a)-d) on a scale ranging from 0.5 to 1000 NSU. The four luminance maps look relatively similar to each other. The zenith brightness was on the order of about 5 NSU and increased towards the horizon with peak brightness values exceeding 1000 NSU at the horizon, which is attributed to direct city lights. The light domes above the cities near the horizon reach NSB values of several hundred NSU. These large values indicate the night sky in this region was affected by skyglow. Despite the qualitative similarities, there are some obvious differences in the luminance maps: First, the exposure time resulted in different distortion of the images due to the smearing as discussed above, and only slightly better signal to noise ratio for longer exposure times. The smearing leads to an “analog binning” effect that in conjunction with the better signal to noise ratio makes Fig. 4 a) appear most homogeneously or smoother than the other luminance maps. Fig. 4 d) is less smeared and has a lower signal to noise ratio, and therefore appears grainier. Second, for longer exposure times some pixels were overexposed, leading to saturation and loss of information about certain particularly bright regions near the horizon. This is most notable when comparing the light emission from the two cities in Fig. 4 a) and b). The high values in the range of 1000 NSU are resolved in b) but not in a). Third, the rotation of the boat resulted in a slightly different pointing for the luminance maps. This is most notable when comparing the brightness distribution at the water surface in the lower part of the luminance maps. \begin{figure}[h] \centering a)\includegraphics[width=80mm]{00_img_1517.jpeg} b)\includegraphics[width=80mm]{00_img_1518.jpeg}\\ c)\includegraphics[width=80mm]{00_img_1519.jpeg} d)\includegraphics[width=80mm]{00_img_1520.jpeg} \caption{Luminance maps calculated from the fisheye images of Fig. 2. The color bar represents NSU values. Note that NSU = 1 represents approximately a natural sky without light pollution (0.25 mcd/m$^2$).} \label{images} \end{figure} \subsection{Angular luminance distribution} As can be seen from the luminance maps, there is a brightness gradient from the zenith towards the horizon. To understand the limits of the method, it is useful to plot the angular brightness distribution. Figure 5 shows the luminance as a function of the angle with respect to the normal vector of the imaging plane (which is not exactly the zenith in our case, but for typical all-sky images normal vector should point to the zenith) for a) the full angular range and b) values up to 70$^{\circ}$. To obtain the angular luminance distribution, the brightness values for a specific angle have been averaged by integrating over the azimuth with DiCaLum \cite{kollath2017} using a 2$^{\circ}$. resolution in altitude (averaging over rings around the imaging normal vector, or zenith in true all-sky photometry). The average brightness near the zenith is in the range of 6.0-6.4 NSU and increases to values of several tens of NSU towards the horizon. For angles up to 74$^{\circ}$, the luminance distribution is very similar between the measurements with different exposure times. Differences become apparent at higher angles, where saturation effects result in plateauing of the luminance values for the three longer exposure times due to overexposure. At overly long exposure times, the pixels saturate and therefore the average luminance is underestimated. With a static all-sky camera, this can be avoided by using the high dynamic range method (combining images with different exposure times). From a drifting and rocking boat, this is more complicated, but could be achieved by using the brightest stars for image co-registration. We judge that the short exposure time produces very good results, at least for this LP situation in the range of 5 NSU. \begin{figure}[h] \centering a)\includegraphics[width=80mm]{Lum_scalar_err.png} b)\includegraphics[width=80mm]{Lumscalarzoomerr.png} \caption{Luminance as a function of the angle with respect to the imaging normal vector for, a) the full angular and dynamic range b) zoom in to angles below 70$^{\circ}$,where the values for different exposure times show very good agreement.} \label{anglu} \end{figure} \subsection{Horizontal and scalar illuminance} A common measure for the light incident at a specific site is the horizontal illuminance $E_{V,hor}$, usually obtained with lux meters. Assuming a homogeneous sky brightness, $E_{V,hor}$ can be inferred from NSB values in units of cd/m$^2$ (homogeneous luminance $L_{V,hom}$) by multiplying with $\pi$ \cite{kocifaj2015zenith}: \begin{equation} E_{V,hor} = L_{V,hom} \cdot \pi. \end{equation} However, this is not valid for most scenarios, as usually the NSB is not uniform \cite{duriscoe2016photometric, Jechow2016, jechowALAN, Kollath:2010}. Therefore, the horizontal illuminance can only be roughly approximated from narrow angle zenith measurements alone \cite{kocifaj2015zenith, duriscoe2016photometric}. From all-sky brightness maps, the horizontal illuminance (incident at the imaging plane of the camera) can be obtained when incorporating a cosine correction \cite{duriscoe2016photometric}. The cosine corrected angular luminance distribution is shown in Fig. 6 a) in NSU. The contribution of the NSB at the horizon is reduced and this results in a reduction of the impact of saturation effects for this particular LP situation. The cosine corrected NSB yields similar results for 0.5 s, 1 s and 2 s exposure times. Now only the long exposure time of 5 s differs significantly from the rest. For comparison, the mean luminance values in NSU obtained from the luminance maps (Fig. 3), are plotted in Fig. 6 b). Without cosine correction and using all the data, the mean values of the (scalar) illuminance range from 16.4 $\pm$ 1.6 NSU to 21.6 $\pm$ 2.2 NSU, while with cosine correction the values of the (horizontal) illuminance vary only between 6.2 $\pm$ 0.6 NSU and 6.9 ± 0.7 NSU. Two cut-off zenith angles are also shown without cosine correction: only NSB values up to angles of 74$^{\circ}$ and 20$^{\circ}$ from the normal vector have been used. The 20$^{\circ}$ angle is considered because it is similar to the opening angle of the SQM, a commonly used device in NSB measuring networks. The 74$^{\circ}$ was chosen to show up to what angle the NSB in this particular site is relatively homogeneous. The values are summarized in Table 1. In addition to all-sky images, handheld SQM measurements were taken at the same sites. These observations gave values of 6.3 $\pm$ 0.6 NSU (19.6 $\pm$ 0.1 magSQM/arcsec²). This is in good agreement with the values obtained for the 20$^{\circ}$ cut off using the DSLR camera. \begin{figure}[h] \centering a)\includegraphics[width=80mm]{Coscorlum.png} b)\includegraphics[width=80mm]{Meanlum.png} \caption{Luminance as a function of the angle with respect to the imaging normal vector for, a) the full angular and dynamic range b) zoom in to angles below 70$^{\circ}$,where the values for different exposure times show very good agreement.} \label{anglu2} \end{figure} The error bars and margins in the plots and in the table were chosen to be 10$\%$ due to the error stemming from the calibration procedure. This error and the systematic error from the pointing differences between the images (shaking and rotating boat) is certainly higher than any statistical error in the image analysis. An evaluation of the error between exposure times can only be done with stable illumination conditions in the laboratory. So far we have observed that inter camera values are relatively consistent by comparing many cameras in the field \cite{KybaLonne2015, RibasLonne2017}. Apart from the obvious saturation effects near the horizon especially for image 1517 (5s exposure time), it can be stated that neither shaking of the camera nor change in exposure time does cause an error higher than from the calibration. Considering this, we judge that the spread between the measurements in between the individual images is not very large and that the noise level is acceptable for the short exposure time. The differences mainly originate from the turning of the boat and from saturation effects. Surprisingly, the relatively short exposure time of 0.5 s at an ISO setting of 6400 can produce reasonable information of the NSB at a site with a luminance of about 6 NSU at zenith and non cosine corrected luminance mean values of 16.4 - 21.6 NSU, while capturing a dynamic range up to 1000 NSU. \begin{table}[h!] \centering \caption{List of the locations along the transect from Balaguer to Port d' Àger. Stationary observations were performed during the entire period of the transect from the final location (Parc Astronòmic Montsec, PAM-COU).} \label{table_sites} \begin{tabular}{cccccc} \toprule Image $\#$ & Exposure time & &Luminance [NSU]& &\\ & & Total & Cos. corr. & 74$^{\circ}$ cut off & 20$^{\circ}$ cut off \\ \toprule 1517 (a) & 5 s & 16.4 $\pm$ 1.6 & 6.2 $\pm$ 0.6 & 10.4 $\pm$ 1.0 & 6.6 $\pm$ 0.7\\ 1518 (b) & 2 s & 19.7 $\pm$ 2.0 & 6.7 $\pm$ 0.7 & 10.8 $\pm$ 1.1 & 6.7 $\pm$ 0.7\\ 1519 (c) & 1 s & 21.6 $\pm$ 2.2 & 6.9 $\pm$ 0.7 & 10.6 $\pm$ 1.1 & 6.6 $\pm$ 0.7\\ 1520 (d) & 0.5 s & 19.4 $\pm$ 2.0 & 6.4 $\pm$ 0.6 & 9.9 $\pm$ 1.0 & 6.2 $\pm$ 0.6\\ \toprule \end{tabular} \end{table} Our data also shows that a zenith measurement (here mimicked with a 20$^{\circ}$ cut off and confirmed with an SQM) has the main drawback that it can underestimate the overall NSB. When inferring the scalar and horizontal illuminance from the zenith NSB, the deviation between the near zenith values and the non cosine corrected integration over the whole hemisphere is up to a factor of three, while the cosine corrected values match for this particular brightness distribution. \section{Conclusion and outlook} We have conducted NSB measurements with a commercial DSLR camera from a moving boat. Despite smearing effects, the overall NSB distribution could be obtained from near all-sky brightness maps. This proof of concept study shows that the method is well applicable for investigation of skyglow in marine and also freshwater environments. By undertaking quick measurements from moving vessels it is possible to acquire NSB data that provides spatial information about the LP. By varying the exposure time, it was shown that saturation effects hamper the measurements more than noise. The data demonstrates, that exposure times as low as 0.5 s produce reasonable results, at least for this site and with this camera lens combination, which is commonly used by amateur astronomers. We want to point out, that averaging of many images acquired with short exposure times could improve signal to noise even further, like in the “lucky imaging” technique is used to correct for a turbid and rapidly changing atmosphere \cite{law2006lucky}. While the image quality does not satisfy the standards of conventional astro-photography, this precision is not necessary in the context of ecological LP. For this application, quick data acquisition at many sites and comparability between them is more important than absolute precision. The spatial information is in our opinion needed to infer the propagation of the light and the possible perception of different animals. A simple measurement of the zenith NSB using e.g. an SQM might misinterpret the portion of light at the horizon, and therefore the overall scalar illuminance. Another potentially interesting application of the method discussed here is the investigation of the propagation of skyglow from single sources into a dark environment. This could be done from an isolated coastal town out into open waters. In contrast to land-based studies, the measurement on the water has the advantage of the absence of obstacles, and the ability to perform a straight transect. For this particular task a more rigid construction, a larger vessel less prone to rocking and drifting, and motion stabilization of the camera are recommended. \section{Acknowledgements} This work was supported by ESSEM COST Action ES1204 - Loss of the Night Network (LoNNe). The survey was designed and executed during a COST LoNNe meeting in Israel. AJ, FH and CCMK acknowledge funding by the ILES of the Leibniz Association, Germany (SAW-2015-IGB-1), and the Verlust der Nacht project funded by the Federal Ministry of Education and Research, Germany (BMBF-033L038A).
{'timestamp': '2017-03-27T02:08:50', 'yymm': '1703', 'arxiv_id': '1703.08484', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08484'}
arxiv
\section{0pt}{12pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt} \setlength{\abovecaptionskip}{0pt plus 2pt minus 2pt} \setlength{\belowcaptionskip}{0pt plus 2pt minus 2pt} \begin{document} \title{Learning to Predict: A Fast Re-constructive Method to Generate Multimodal Embeddings} \author{Guillem Collell\inst{1} \and Ted Zhang\inst{2} \and Marie-Francine Moens\inst{3}} \institute{Computer Science Department, KU Leuven, Belgium\inst{1}\inst{2}\inst{3}\\ \email{[email protected], [email protected], [email protected]} } \maketitle \begin{abstract} Integrating visual and linguistic information into a single multimodal representation is an unsolved problem with wide-reaching applications to both natural language processing and computer vision. In this paper, we present a simple method to build multimodal representations by learning a language-to-vision mapping and using its output to build multimodal embeddings. In this sense, our method provides a cognitively plausible way of building representations, consistent with the inherently re-constructive and associative nature of human memory. Using seven benchmark concept similarity tests we show that the mapped vectors not only implicitly encode multimodal information, but also outperform strong unimodal baselines and state-of-the-art multimodal methods, thus exhibiting more ``human-like" judgments---particularly in zero-shot settings. \end{abstract} \section{Introduction} \label{sect:intro} Convolutional neural networks (CNN) and distributional-semantic models have provided breakthrough advances in representation learning in computer vision (CV) and natural language processing (NLP) respectively \cite{lecun2015deep}. Lately, a large body of research has shown that using rich, multimodal representations created from combining textual and visual features instead of unimodal representations (a.k.a. embeddings) can improve the performance of semantic tasks. In other words, a single multimodal representation that captures information from two modalities (vision and language) is semantically richer than those from a single modality or unimodal (either vision or language). Building multimodal representations has become a popular problem in NLP that has yielded a wide variety of methods \cite{lazaridou2015combining,kiela2014learning,silberer2014learning}. Additionally, the use of a mapping to bridge vision and language has also been explored, typically with the goal of zero-shot image classification \cite{lazaridou2014wampimuk,socher2013zero}. \begin{figure} \begin{center} \includegraphics[scale=0.56]{diagram_conc} \end{center} \caption{Overview of our multimodal method.} \label{diagram} \end{figure} Here, we propose a cognitively plausible approach to concept representation that consists of: (1) learning a language-to-vision mapping; and (2) using the outputs of the mapping as multimodal representations---with the second step being the main novelty of our approach. By re-constructing visual knowledge from textual input, our method behaves similarly as human memory, namely in an associative \cite{anderson2014human,reijmers2007localization} and re-constructive manner \cite{vernon2014artificial,hawkins2007intelligence,loftus1981reconstructive}. Concretely, our method does not seek the perfect recall of visual representations but rather its re-construction and association with language. We leverage the intuitive fact that, by learning to predict, the mapping necessarily encodes information from both modalities---and in turn discards noise and irrelevant information from the visual vectors during the learning phase. Thus, given a word embedding as input, the mapped output is not purely a visual representation but rather a multimodal one. By using seven concept similarity benchmarks, we show that our representations not only are multimodal but they improve performance over strong unimodal baselines and state-of-the-art multimodal approaches---inclusive in a zero-shot setting. In turn, the fact that our evaluation tests are composed of human ratings of similarity supports our claim that our method provides more ``human-like" judgments. Further details and insight can be found at the extended version of the present paper \cite{collell2017imagined}. The rest of the paper is organized as follows. In the next section, we introduce related work. Next, we describe and provide insight on our method. Afterwards, we describe our experimental setup. Finally, we discuss our results, followed by conclusions. \section{Related work and background} \label{sect:related} \subsection{Cognitive grounding} \label{sect:cognitive} A large body of research evidences that human memory is inherently re-constructive \cite{vernon2014artificial,hawkins2007intelligence,loftus1981reconstructive}. That is, memories are not ``static" exact copies of reality, but are rather re-constructed from their essential elements each time they are retrieved, triggered by either internal or external stimuli. Arguably, this mechanism is, in turn, what endows humans with the capacity to imagine themselves in yet-to-be experiences and to re-combine existing knowledge into new plans or structures of knowledge \cite{hawkins2007intelligence}. Moreover, the associative nature of human memory is also a widely accepted theory in experimental psychology \cite{anderson2014human} with identifiable neural correlates involved in both learning and retrieval processes \cite{reijmers2007localization}. In this respect, our method employs a retrieval process analogous to that of humans, in which the retrieval of a visual output is triggered and mediated by a linguistic input (Fig. \ref{diagram}). Effectively, visual information is not only retrieved (i.e., mapped), but also associated to the textual information thanks to the learned cross-modal mapping---analogous to a mental model that associates semantic and visual components of concepts, acquired through lifelong experience. Since the retrieved (mapped) visual information is often insufficient to completely describe a concept, it is of interest to preserve the linguistic component. Thus, we consider the concatenation of the ``imagined" visual representations to the text representations as a comprehensive way of representing concepts. \subsection{Multimodal representations} \label{sect:multimodal} It has been shown that visual and textual features capture complementary attributes \cite{collell2016is}, and the advantages of combining both modalities have been largely demonstrated in a number of linguistic tasks \cite{lazaridou2015combining,kiela2014learning,silberer2014learning}. Based on current literature, we suggest a classification of the existing strategies to build multimodal embeddings. Broadly, multimodal representations can be built by learning from raw input enriched with both modalities (\textbf{\textit{simultaneous}} learning), or by learning each modality separately and integrating them afterwards (\textbf{\textit{a posteriori}} combination). \begin{enumerate} \item \textbf{\textit{A posteriori}} combination. \begin{itemize} \item \emph{Concatenation}. That is, the fusion of pre-learned visual and text features by concatenating them \cite{kiela2014learning}. Concatenation has been proven effective in concept similarity tasks \cite{bruni2014multimodal,kiela2014learning}, yet suffers from an obvious limitation: multimodal features can only be generated for those words that have images available. \item \emph{Autoencoders} form a more elaborated approach that do not suffer from the above problem. Encoders are fed with pre-learned visual and text features, and the hidden representations are then used as multimodal embeddings. This approach has shown to perform well in concept similarity tasks and categorization (i.e., grouping objects into categories such as ``fruit", ``furniture", etc.) \cite{silberer2014learning}. \item A \emph{mapping} between visual and text modalities (i.e., our method). The outputs of the mapping themselves are used to build multimodal representations. \end{itemize} \item \textbf{\textit{Simultaneous}} learning. Distributional semantic models are extended into the multimodal domain \cite{lazaridou2015combining,hill2014learning} by learning in a skip-gram manner from a corpus enriched with information from both modalities and using the learned parameters of the hidden layer as multimodal representations. Multimodal skip-gram methods have been proven effective in similarity tasks \cite{lazaridou2015combining,hill2014learning} and in zero-shot image labeling \cite{lazaridou2015combining}. \end{enumerate} With this taxonomy, the gap that our method fills becomes more clear, with it being aligned with a re-constructive and associative view of knowledge representation. Furthermore, in contrast to other multimodal approaches such as skip-gram methods \cite{lazaridou2015combining,hill2014learning}, our method directly learns from pre-trained embeddings instead of training from a large multimodal corpus, rendering it thus simpler and faster. \subsection{Cross-modal mappings} \label{sect:crossmodalmap} Several studies have considered the use of mappings to bridge modalities. For instance, \cite{socher2013zero} and \cite{lazaridou2014wampimuk} use a linear vision-to-language projection in zero-shot image classification. Analogously, language-to-vision mappings have been considered, generally to generate missing perceptual information about abstract words \cite{hill2014learning,johns2012perceptual} and in zero-shot image retrieval \cite{lazaridou2015combining}. In contrast to our approach, the methods above do not aim to build multimodal representations to be used in natural language processing tasks. \section{Proposed method} In this section we describe the three main steps of our method (Fig. \ref{diagram}): (1) Obtain visual representations of concepts; (2) Build a mapping from the linguistic to the visual space; and (3) Generate multimodal representations. \subsection{Obtaining visual representations} \label{sect:visrep} We employ raw, labeled images from ImageNet \cite{russakovsky2015imagenet} as the source of visual information, although alternatives such as the ESP game data set \cite{von2004labeling} can be considered. To extract visual features from each image, we use the forward pass of a pre-trained CNN model. The hidden representation of the last layer (before the softmax) is taken as a feature vector, as it contains higher level features. For each concept $w$, we \textit{average} the extracted visual features of individual images to build a single visual representation $\overrightarrow{v_w}$. \subsection{Learning to map language to vision} \label{sect:mapping} Let $\mathcal{L} \subset \mathbb{R}^{d_l}$ be the linguistic space and $\mathcal{V} \subset \mathbb{R}^{d_v}$ the visual space of representations, where $d_l$ and $d_v$ are their respective dimensionalities. Let $\overrightarrow{l_w} \in \mathcal{L}$ and $\overrightarrow{v_w} \in \mathcal{V}$ denote the text and visual representations for the concept $w$ respectively. Our goal is thus to learn a mapping (regression) $f:\mathcal{L}\rightarrow \mathcal{V}$. The set of $N$ visual representations along with their corresponding text representations compose the training data $\{ (\overrightarrow{l_i},\overrightarrow{v_i})\}^{N}_{i=1}$ used to learn $f$. In this work, we consider two different mappings $f$. \textbf{(1) Linear:} A simple perceptron composed of a $d_l$-dimensional input layer and a linear output layer with $d_v$ units. \textbf{(2) Neural network:} A network composed of a $d_l$-unit input layer, a single hidden layer of $d_h$ Tanh units and a linear output layer of $d_v$ units. For both mappings, a mean squared error (MSE) loss function is employed: $Loss(y,\hat{y}) = \frac{1}{2} ||\hat{y} - y||^2_2 $, where $y$ is the actual output and $\hat{y}$ the model prediction. \subsection{Generating multimodal representations} \label{sect:mapped} Finally, the mapped representation $\overrightarrow{m_w}$ of each concept $w$ is calculated as the image $f(\overrightarrow{l_w})$ of its linguistic embedding $\overrightarrow{l_w}$. For instance, $\overrightarrow{m_{dog}} = f(\overrightarrow{l_{dog}})$. We henceforth refer to the mapped representations as \textit{MAP}$_{f}$, where $f$ indicates the mapping function employed ($lin$ = linear, $NN$ = neural network). As argued below, the mapped representations are effectively multimodal. However, since $f(\overrightarrow{l_w})$ formally belongs to the visual domain, we also consider the concatenation of the $\ell_2$-normalized mapped representations $f(\overrightarrow{l_w})$ with the textual representations $\overrightarrow{l_w}$, namely $\overrightarrow{l_w}\oplus f(\overrightarrow{l_w})$, where $\oplus$ denotes the concatenation operator. We denote these concatenated representations as \textit{MAP-C}$_{f}$. Since the outputs of a text-to-vision mapping are strictly speaking, ``visual predictions", it might not seem readily obvious that they are also grounded with textual knowledge. To gain insight, it is instructive to refer to the training phase where the parameters $\theta$ of $f$ are learned as a function of the training data $\{(\overrightarrow{l_i},\overrightarrow{v_i})\}^{N}_{i=1}$. E.g., in gradient descent, $\theta$ is updated according to: $\theta \leftarrow \theta - \eta \frac{\partial}{\partial \theta } Loss( \theta ; \{(\overrightarrow{l_i},\overrightarrow{v_i})\}^{N}_{i=1}).$ Hence, the parameters $\theta$ of $f$ are effectively a function of the training data points $\{(\overrightarrow{l_i},\overrightarrow{v_i})\}^{N}_{i=1}$ and it is therefore expected that the outputs $f(\overrightarrow{l_w})$ are grounded with properties of the input data $\{\overrightarrow{l_i}\}^{N}_{i=1}$. It can be additionally noted that the output of the mapping $f(\overrightarrow{l_w})$ is a (continuous) transformation of the input vector $\overrightarrow{l_w}$. Thus, unless the mapping is completely uninformative (e.g., constant or random), the input vector $\overrightarrow{l_w}$ is still ``present"---yet transformed. Thus, the output of the mapping necessarily contains information from both modalities, vision and language, which is essentially the core idea of our method. Further insight is provided at the extended version of the article \cite{collell2017imagined}. \section{Experimental setup} \subsection{Word embeddings} We use 300-dimensional GloVe\footnote{\tt http://nlp.stanford.edu/projects/glove} vectors \cite{pennington2014glove} pre-trained on the Common Crawl corpus consisting of 840B tokens and a 2.2M words vocabulary. \subsection{Visual data and features} We use ImageNet \cite{russakovsky2015imagenet} as our source of labeled images. ImageNet covers 21,841 WordNet synsets (or meanings) \cite{fellbaum1998wordnet} and has 14,197,122 images. We only keep synsets with more than 50 images, and an upper bound of 500 images per synset is used to reduce computation time. With this selection, we cover 9,251 unique words. To extract visual features from each image, we use a pre-trained VGG-m-128 CNN \cite{Chatfield14} implemented with the Matlab MatConvNet toolkit \cite{vedaldi15matconvnet}. We take the 128-dimensional activation of the last layer (before the softmax) as our visual features. \subsection{Evaluation sets} We test the methods in seven benchmark tests, covering three tasks: \textbf{(i) General relatedness}: \textit{MEN} \cite{bruni2014multimodal} and \textit{Wordsim353-rel} \cite{agirre2009study}; \textbf{(ii) Semantic or taxonomic similarity}: \textit{SemSim} \cite{silberer2014learning}, \textit{Simlex999} \cite{hill2015simlex}, \textit{Wordsim353-sim} \cite{agirre2009study} and \textit{SimVerb-3500} \cite{gerz2016simverb}; \textbf{(iii) Visual similarity}: \textit{VisSim} \cite{silberer2014learning} which contains the same word pairs as \textit{SemSim}, rated for visual instead of semantic similarity. All tests contain word pairs along with their human similarity rating. The tests \textit{Wordsim353-sim} and \textit{Wordsim353-rel} are the similarity and relatedness subsets of \textit{Wordsim353} \cite{finkelstein2001placing} proposed by \cite{agirre2009study} who noted that the distinction between similarity (e.g., ``tiger" is similar to ``cat") and relatedness (e.g., ``stock" is related to ``market") yields different results. Hence, for being redundant with its subsets, we do not count the whole \textit{Wordsim353} as an extra test set. A large part of words in our tests do not have a visual representation $\overrightarrow{v_w}$ available, i.e., they are not present in our training data. We refer to these words as zero-shot (ZS). \subsection{Evaluation metric and prediction} We use Spearman correlation $\rho$ between model predictions and human similarity ratings as evaluation metric. The prediction of similarity between two concept representations, $\overrightarrow{u_1}$ and $\overrightarrow{u_2}$, is computed by their cosine similarity: $\cos(\overrightarrow{u_1},\overrightarrow{u_2}) = \frac{\overrightarrow{u_1} \cdot \overrightarrow{u_2}}{\| \overrightarrow{u_1} \|\cdot\| \overrightarrow{u_2} \|}$. \subsection{Model settings} Both, neural network and linear models are learned by stochastic gradient descent and nine parameter combinations are tested (learning\_rate = [0.1, 0.01, 0.005] and dropout\_rate = [0.5, 0.25, 0.1]). We find that the models are not very sensitive to parameter variations and all of them perform reasonably well. We report a linear model with learning rate of 0.1 and dropout rate of 0.1. For the neural network we use 300 hidden units, dropout rate of 0.25 and learning of 0.1. All mappings are implemented with the scikit-learn toolkit \cite{scikit-learn} in Python 2.7. \section{Results and discussion} \label{sect:results} In the following we summarize our main findings. For clarity, we refer to the concatenation of \textit{CNN}$_{avg}$ and GloVe as \textit{CONC}. \textbf{\textit{Overall}}, a post-hoc Nemenyi test including all disjoint regions (ZS and VIS) shows that both \textit{MAP-C} methods (\textit{lin} and \textit{NN}) perform significantly better than GloVe (p $\approx$ 0.03) and than \textit{CNN}$_{avg}$ (p $\approx$ 0.06). Hence, our multimodal representations \textit{MAP-C} clearly accomplish one of their foremost goals, namely to improve the unimodal representations of GloVe and \textit{CNN}$_{avg}$. Clearly, the consistent improvement of \textit{MAP}$_{lin}$ and \textit{MAP}$_{NN}$ over \textit{CNN}$_{avg}$ in all seven test sets supports our claim that the \textit{imagined} visual representations are more than purely visual representations and contain multimodal information---as argued in subsection \ref{sect:mapped}. Moreover, the \textit{MAP-C} method generally performs better than the\textit{MAP} vectors alone, implying that even though the \textit{MAP} vectors are indeed multimodal, they are still predominantly visual and their concatenation with textual representations helps. Using the \textit{\textbf{concreteness}} ratings of \cite{brysbaert2014concreteness} in a 1-5 scale (with 5 being the most concrete and 1 the most abstract) we find that the average concreteness is larger than 4.4 in all VIS regions, while it is lower than 3.3 in all ZS regions except in \textit{MEN} and \textit{VisSim}/\textit{SemSim} test sets which average 4.2 and 4.8 respectively. Therefore, with the exceptions of \textit{MEN}, \textit{VisSim} and \textit{SemSim}, the inclusion of multimodal information in the ZS regions is arguably less beneficial than in the VIS regions, given that visual information can only sensibly enrich representations of words that are to some extent visual. \begin{table*}[ht] \footnotesize \centering \caption{Spearman correlations between model predictions and human ratings. For each test set, ALL is the whole set of word pairs, VIS are those pairs with both visual representations available, and ZS denotes its complement, i.e., zero-shot words. Boldface indicates best results per column and \# inst. the number of word pairs in ALL, VIS or ZS. It must be noted that the VIS region of the compared methods is only approximated, as they do not report the exact evaluated instances.} \begin{adjustbox}{max width=\textwidth} \begin{tabular}{lcccccccccccc} \multicolumn{1}{l|}{} & \multicolumn{3}{c|}{Wordsim353} & \multicolumn{3}{c|}{MEN} & \multicolumn{3}{c|}{SemSim} & \multicolumn{3}{c|}{VisSim} \\ \cline{2-13} \multicolumn{1}{l|}{} & ALL & VIS & \multicolumn{1}{c|}{ZS} & ALL & VIS & \multicolumn{1}{c|}{ZS} & ALL & VIS & \multicolumn{1}{c|}{ZS} & ALL & VIS & \multicolumn{1}{c|}{ZS} \\ \hline \multicolumn{1}{l|}{Silberer \& Lapata 2014} & & & \multicolumn{1}{c|}{} & & 0.7 & \multicolumn{1}{c|}{} & & 0.64 & \multicolumn{1}{c|}{} & & & \multicolumn{1}{c|}{} \\ \multicolumn{1}{l|}{Lazaridou et al. 2015} & & & \multicolumn{1}{c|}{} & 0.75 &0.76 & \multicolumn{1}{c|}{} & 0.72 & 0.72 & \multicolumn{1}{c|}{} & 0.63 & 0.63 & \multicolumn{1}{c|}{} \\ \multicolumn{1}{l|}{Kiela \& Bottou 2014} & & 0.61 & \multicolumn{1}{c|}{} & & 0.72 & \multicolumn{1}{c|}{} & & & \multicolumn{1}{c|}{} & & & \multicolumn{1}{c|}{} \\ \hline \multicolumn{1}{l|}{GloVe} & \textbf{0.712} & 0.632 & \multicolumn{1}{c|}{\textbf{0.705}} & 0.805 & 0.801 & \multicolumn{1}{c|}{0.801} & 0.753 & 0.768 & \multicolumn{1}{c|}{0.701} & 0.591 & 0.606 & \multicolumn{1}{c|}{0.54} \\ \multicolumn{1}{l|}{\textit{CNN}$_{avg}$} & - & 0.448 & \multicolumn{1}{c|}{-} & - & 0.593 & \multicolumn{1}{c|}{-} & - & 0.534 & \multicolumn{1}{c|}{-} & - & 0.56 & \multicolumn{1}{c|}{-} \\ \multicolumn{1}{l|}{\textit{CONC}} & - & 0.606 & \multicolumn{1}{c|}{-} & - & 0.8 & \multicolumn{1}{c|}{-} & - & 0.734 & \multicolumn{1}{c|}{-} & - & 0.651 & \multicolumn{1}{c|}{-} \\ \hline \multicolumn{1}{l|}{\textit{MAP}$_{NN}$} & \multicolumn{1}{l}{0.443} & \multicolumn{1}{l}{0.534} & \multicolumn{1}{l|}{0.391} & \multicolumn{1}{l}{0.703} & \multicolumn{1}{l}{0.761} & \multicolumn{1}{l|}{0.68} & \multicolumn{1}{l}{0.729} & \multicolumn{1}{l}{0.732} & \multicolumn{1}{l|}{0.718} & \multicolumn{1}{l}{\textbf{0.658}} & \multicolumn{1}{l}{\textbf{0.659}} & \multicolumn{1}{l|}{\textbf{0.655}} \\ \multicolumn{1}{l|}{\textit{MAP}$_{lin}$} & \multicolumn{1}{l}{0.402} & \multicolumn{1}{l}{0.539} & \multicolumn{1}{l|}{0.366} & \multicolumn{1}{l}{0.701} & \multicolumn{1}{l}{0.774} & \multicolumn{1}{l|}{0.674} & \multicolumn{1}{l}{0.738} & \multicolumn{1}{l}{0.738} & \multicolumn{1}{l|}{0.74} & \multicolumn{1}{l}{0.646} & \multicolumn{1}{l}{0.644} & \multicolumn{1}{l|}{0.651} \\ \multicolumn{1}{l|}{\textit{MAP-C}$_{NN}$} & 0.687 & 0.644 & \multicolumn{1}{c|}{0.673} & \textbf{0.813} & \textbf{0.82} & \multicolumn{1}{c|}{\textbf{0.806}} & 0.783 & \textbf{0.791} & \multicolumn{1}{c|}{0.754} & 0.65 & 0.657 & \multicolumn{1}{c|}{0.626} \\ \multicolumn{1}{l|}{\textit{MAP-C}$_{lin}$} & 0.694 & \textbf{0.649} & \multicolumn{1}{c|}{0.684} & 0.811 & 0.819 & \multicolumn{1}{c|}{0.802} & \textbf{0.785} & \textbf{0.791} & \multicolumn{1}{c|}{\textbf{0.764}} & 0.641 & 0.647 & \multicolumn{1}{c|}{0.623} \\ \hline \multicolumn{1}{l|}{\# inst.} & 353 & 63 & \multicolumn{1}{c|}{290} & 3000 & 795 & \multicolumn{1}{c|}{2205} & 6933 & 5238 & \multicolumn{1}{c|}{1695} & 6933 & 5238 & \multicolumn{1}{c|}{1695} \\ \multicolumn{13}{l}{} \\ \multicolumn{1}{l|}{} & \multicolumn{3}{c|}{Simlex999} & \multicolumn{3}{c|}{Wordsim353-rel} & \multicolumn{3}{c|}{Wordsim353-sim} & \multicolumn{3}{c|}{SimVerb-3500} \\ \cline{2-13} \multicolumn{1}{l|}{} & ALL & VIS & \multicolumn{1}{c|}{ZS} & ALL & VIS & \multicolumn{1}{c|}{ZS} & ALL & VIS & \multicolumn{1}{c|}{ZS} & ALL & VIS & \multicolumn{1}{c|}{ZS} \\ \hline \multicolumn{1}{l|}{Silberer \& Lapata 2014} & & & \multicolumn{1}{c|}{} & & & \multicolumn{1}{c|}{} & & & \multicolumn{1}{c|}{} & & & \multicolumn{1}{c|}{} \\ \multicolumn{1}{l|}{Lazaridou et al. 2015} & 0.4 & \textbf{0.53} & \multicolumn{1}{c|}{} & & & \multicolumn{1}{c|}{} & & & \multicolumn{1}{c|}{} & & & \multicolumn{1}{c|}{} \\ \multicolumn{1}{l|}{Kiela \& Bottou 2014} & & & \multicolumn{1}{c|}{} & & & \multicolumn{1}{c|}{} & & & \multicolumn{1}{c|}{} & & & \multicolumn{1}{c|}{} \\ \hline \multicolumn{1}{l|}{GloVe} & 0.408 & 0.371 & \multicolumn{1}{c|}{\textbf{0.429}} & \textbf{0.644} & 0.759 & \multicolumn{1}{c|}{\textbf{0.619}} & \textbf{0.802} & 0.688 & \multicolumn{1}{c|}{\textbf{0.783}} & 0.283 & 0.32 & \multicolumn{1}{c|}{0.282} \\ \multicolumn{1}{l|}{\textit{CNN}$_{avg}$} & - & 0.406 & \multicolumn{1}{c|}{-} & - & 0.422 & \multicolumn{1}{c|}{-} & - & 0.526 & \multicolumn{1}{c|}{-} & - & 0.235 & \multicolumn{1}{c|}{-} \\ \multicolumn{1}{l|}{\textit{CONC}} & - & 0.442 & \multicolumn{1}{c|}{-} & - & 0.665 & \multicolumn{1}{c|}{-} & - & 0.664 & \multicolumn{1}{c|}{-} & - & 0.437 & \multicolumn{1}{c|}{-} \\ \hline \multicolumn{1}{l|}{\textit{MAP}$_{NN}$} & \multicolumn{1}{l}{0.322} & \multicolumn{1}{l}{0.451} & \multicolumn{1}{l|}{0.296} & \multicolumn{1}{l}{0.33} & \multicolumn{1}{l}{0.606} & \multicolumn{1}{l|}{0.267} & \multicolumn{1}{l}{0.536} & \multicolumn{1}{l}{0.599} & \multicolumn{1}{l|}{0.475} & \multicolumn{1}{l}{0.213} & \multicolumn{1}{l}{\textbf{0.513}} & \multicolumn{1}{l|}{0.21} \\ \multicolumn{1}{l|}{\textit{MAP}$_{lin}$} & \multicolumn{1}{l}{0.322} & \multicolumn{1}{l}{0.412} & \multicolumn{1}{l|}{0.286} & \multicolumn{1}{l}{0.28} & \multicolumn{1}{l}{0.553} & \multicolumn{1}{l|}{0.243} & \multicolumn{1}{l}{0.505} & \multicolumn{1}{l}{0.569} & \multicolumn{1}{l|}{0.477} & \multicolumn{1}{l}{0.212} & \multicolumn{1}{l}{0.338} & \multicolumn{1}{l|}{0.21} \\ \multicolumn{1}{l|}{\textit{MAP-C}$_{NN}$} & 0.405 & 0.404 & \multicolumn{1}{c|}{0.417} & 0.623 & 0.778 & \multicolumn{1}{c|}{0.589} & 0.769 & 0.696 & \multicolumn{1}{c|}{0.745} & \textbf{0.286} & 0.49 & \multicolumn{1}{c|}{0.284} \\ \multicolumn{1}{l|}{\textit{MAP-C}$_{lin}$} & \textbf{0.41} & 0.388 & \multicolumn{1}{c|}{0.422} & 0.629 & \textbf{0.797} & \multicolumn{1}{c|}{0.601} & 0.781 & \textbf{0.698} & \multicolumn{1}{c|}{0.766} & \textbf{0.286} & 0.371 & \multicolumn{1}{c|}{\textbf{0.285}} \\ \hline \multicolumn{1}{l|}{\# inst.} & 999 & 261 & \multicolumn{1}{c|}{738} & 252 & 28 & \multicolumn{1}{c|}{224} & 203 & 45 & \multicolumn{1}{c|}{158} & 3500 & 41 & \multicolumn{1}{c|}{3459} \end{tabular} \end{adjustbox} \label{tab:results} \end{table*} Both \textit{MAP}$_{NN}$ and \textit{MAP}$_{lin}$ exhibit an overall gain in \textit{MEN} and in the VIS region of \textit{Wordsim353-rel}. It might seem counter-intuitive that vision can help to improve \textbf{\textit{relatedness}} understanding. However, a closer look reveals that visual features generally account for object co-occurrences, which is often a good indicator of their relatedness (e.g., between ``car" and ``garage" in Fig. \ref{car-garage}). For instance, in \textit{MEN}, the human relatedness rating between ``car" and ``garage" is 8.2 while GloVe's score is only 5.4. However, \textit{CNN}$_{avg}$'s rating is 8.7 and that of \textit{MAP}$_{lin}$ is 8.4---closer to the human score. \begin{figure} \begin{center} \includegraphics[scale=0.1]{car_garage_large} \end{center} \caption{Sample images from ``car" (top row) and ``garage" (bottom row) synsets of ImageNet.} \label{car-garage} \end{figure} Crucially, \textit{MAP-C}$_{NN}$ and \textit{MAP-C}$_{lin}$ significantly improve the performance of GloVe in all seven \textit{\textbf{VIS regions}} (p $\approx$ 0.008), with an average improvement of 4.6$\%$ for \textit{MAP-C}$_{NN}$. Conversely, the concatenation of GloVe with the original visual vectors (\textit{CONC}) does not improve GloVe (p $\approx$ 0.7)---worsening it in 4 out of 7 test sets---suggesting that simple concatenation without seeking the association between modalities might be suboptimal. Moreover, the concatenation of the mapped visual vectors with GloVe (\textit{MAP-C}$_{NN}$) outperforms the concatenation of the original visual vectors with GloVe (\textit{CONC}) in 6 out of 7 test sets (p $\approx$ 0.06), which supports our claim that the mapped visual vectors are semantically richer than the original visual vectors. \section{Conclusions} We have presented a cognitively-inspired method capable of generating multimodal representations in a fast and simple way. In a variety of similarity tasks and seven benchmark tests, our method generally outperforms unimodal baselines and state-of-the-art multimodal methods. Moreover, the performance gain in zero-shot settings indicates that the method generalizes well and learns relevant cross-modal associations. Finally, the overall performance supports the claim that our approach builds more ``human-like" concept representations. Ultimately, the present work sheds light on fundamental questions of natural language understanding such as whether the nature of the knowledge representation obtained by the fusion of vision and language should be static and additive (e.g., concatenation without associating modalities) or rather re-constructive and associative. \bibliographystyle{ieeetr}
{'timestamp': '2017-03-28T02:05:16', 'yymm': '1703', 'arxiv_id': '1703.08737', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08737'}
arxiv
\section{Introduction}\label{sec:intro} Many longitudinal studies focus on investigating how individuals change over time with respect to a characteristic that is measured repeatedly for each participant. Conventional random effect growth modeling has provided a number of tools for modeling intra-individual change and inter-individual differences in change \citep[e.g.,][]{laird82,bryk87,bryk92,mcardle87,singer03}, where within-class changes are described as a function of time and between-class changes are described by random effects and coefficients. Conventional random effects models provide a basis for formulating growth mixture models (GMMs) for longitudinal data. In the latent variable framework, a quadratic random effects growth model with a continuous outcome $y_{it}$ for individual $i$ at time $t$, and time-invariant covariates $x_i$, is specified according to \begin{align} \label{eqn:quadgrowth1} y_{it} &= \eta_{0i}+\eta_{1i}(a_t - a_0)+\eta_{2i}(a_t - a_0)^2+\epsilon_{it},\\ \eta_{0i} &= \alpha_0 + \mbox{\boldmath$\gamma$}_0'\mathbf{x}_i +\zeta_{0i},\nonumber\\ \label{eqn:quadgrowth2} \eta_{1i} &= \alpha_1 + \mbox{\boldmath$\gamma$}_1'\mathbf{x}_i +\zeta_{1i},\\ \eta_{2i} &= \alpha_2 + \mbox{\boldmath$\gamma$}_2'\mathbf{x}_i +\zeta_{2i},\nonumber \end{align} where $a_t$ are time scores ($t=1,2,\ldots,T$) centred at $a_0$, $\eta_{0i}$ is the random intercept, $\eta_{1i}$ is the random linear slope, $\eta_{2i}$ is the quadratic growth rate, and $\mbox{\boldmath$\epsilon$}_i$ and $\mbox{\boldmath$\zeta$}_i$ are normally distributed residuals, i.e., $\mbox{\boldmath$\epsilon$}_i \sim \mathcal{N}(\mathbf{0},\mbox{\boldmath$\Theta$})$ and $\mbox{\boldmath$\zeta$}_i \sim \mathcal{N}(\mathbf{0},\mathbf\Psi)$. Formally, $\eta_{0i}$, $\eta_{1i}$, and $\eta_{2i}$ are continuous latent variables (called the growth factors) representing the growth patterns, the $\alpha_k$ are the mean parameters for the growth factors if there are no covariates $\mathbf{x}_i$, and the $\mbox{\boldmath$\gamma$}_k$ are the effects of covariates $\mathbf{x}_i$ on the growth factors. In conventional growth modeling applications, the individual growth parameters (e.g., individual intercept and slope factors) are usually assumed to be identically distributed, i.e., drawn from a single homogeneous population. However, we are often interested in and deal with samples from multiple populations and, in most cases, the class memberships are either unknown or unobserved. Simultaneous modeling of change over time and unobserved multiple populations (heterogeneity) in the data can be accommodated using GMMs and latent class growth analysis (LCGA), wherein parameters describing growth patterns are estimated and each individual's most likely class membership is obtained via maximum \emph{a~posteriori} (MAP) probabilities. GMMs were introduced by \citet{verbeke96} and then extended by \citet{muthen99}, \citet{muthen04}, and \citet{muthen08}. For convenience, define $c_{ik}$ so that $c_{ik} = 1$ if individual $i$ falls in class $k$ and $c_{ik} = 0$ otherwise. The quadratic growth model in \eqref{eqn:quadgrowth1} and~\eqref{eqn:quadgrowth2} can be extended to a simple GMM in class $k$ ($k=1,2,\ldots,K$) via \begin{align} \label{eqn:quadmixturegrowth1} Y_{it} \mid {c_{ik}=1} &= \eta_{0i}+\eta_{1i}(a_t - a_0)+\eta_{2i}(a_t - a_0)^2+\epsilon_{it},\\ \eta_{0i}\mid {c_{ik}=1} &= \alpha_{0k} + \mbox{\boldmath$\gamma$}_0'\mathbf{x}_i +\zeta_{0i},\nonumber\\ \label{eqn:quadmixturegrowth2} \eta_{1i}\mid {c_{ik}=1} &= \alpha_{1k} + \mbox{\boldmath$\gamma$}_1'\mathbf{x}_i +\zeta_{1i},\\ \eta_{2i} \mid {c_{ik}=1} &= \alpha_{2k} + \mbox{\boldmath$\gamma$}_2'\mathbf{x}_i +\zeta_{2i},\nonumber \end{align} where $\mbox{\boldmath$\alpha$}_k = (\alpha_{0k},\alpha_{1k},\alpha_{2k})$ parameters vary across classes to capture different trajectories; the parameters $\mbox{\boldmath$\gamma$}_0, \mbox{\boldmath$\gamma$}_1$, and $\mbox{\boldmath$\gamma$}_2$ remain the same across classes but this could be relaxed to allow variation across classes with respect to how a covariate affects the growth factors; and $\mbox{\boldmath$\epsilon$}_i$ and $\mbox{\boldmath$\zeta$}_i$ are still normally distributed residuals but with class-specific covariance matrices, i.e., $\mbox{\boldmath$\epsilon$}_i \sim \mathcal{N}(\mathbf{0},\mbox{\boldmath$\Theta$}_k)$ and $\mbox{\boldmath$\zeta$}_i \sim \mathcal{N}(\mathbf{0},\mathbf\Psi_k)$. The latent class growth analysis (LCGA) developed by Nagin and Land \citep{nagin93,nagin99,nagin05} can be thought of as one special case of GMMs in the sense that it assumes zero within-class growth factor variances, i.e., $\mathbf\Psi_k=\mathbf{0}$ for $k=1,2,\ldots,K$. One common fundamental assumption for GMMs is that model errors are normally distributed. However, simulation studies in \citet{bauer03} show that, when the data are drawn from a single non-Gaussian distribution, a two-class Gaussian GMM is preferred when fitting the data. In such cases, the within-class parameter estimates become uninterpretable because there are too many groups. \citet{muthen15} give an example of strongly non-normal outcomes, i.e., body mass index (BMI) development over age, and show that more than one latent class is required to capture the observed variable distribution --- interpreting mixture components as subpopulations will lead to overestimation of the number of subpopulations. In general, non-elliptical distributions are used in multivariate analysis for the study of asymmetric data; such distributions can have a concentration parameter to account for heavy tailed data. Intuitively, in the two-dimensional case, the joint distribution forms a non-elliptical shape in the iso-density plot. Relaxing the normality assumption for asymmetry and skewness, \citet{muthen15} develop a GMM with a normally distributed model error and ``classical" multivariate skew-t (cMST) random effects, i.e., $\mbox{\boldmath$\epsilon$}_i \sim \mathcal{N}(\mathbf{0},\mbox{\boldmath$\Theta$}_k)$ and $\mbox{\boldmath$\zeta$}_i \sim \text{MST}(\mathbf{0},\mathbf\Psi_k)$. An alternative specification of GMMs (called nonlinear mixed effect mixture models) was developed by \citet{lu14} within a Bayesian framework, wherein $\mbox{\boldmath$\epsilon$}_i$ is assumed to follow a cMST while $\mbox{\boldmath$\zeta$}_i$ remains normally distributed. Note that the ``classical" formulation of the multivariate skew-t distribution is that given by \cite{azzalini96} and \cite{azzalini99}. In this paper, we outline a more general extension of GMMs to the generalized hyperbolic distribution while also considering the formulation of the multivariate skew-t distribution that arises as its special and limiting case (Section~\ref{sec:back}). The advantage of the generalized hyperbolic distribution is its flexibility. Many other well-known distributions are special or limiting cases of the generalized hyperbolic distribution; please refer to \citet[][]{mcneil05} for details on a variety of limiting cases of the generalized hyperbolic distribution. The remainder of this article is laid out as follows. In Section~\ref{sec:back}, we go through some important background material on the generalized hyperbolic distribution as well as a special and limiting case that gives a formulation of the multivariate skew-t distribution. In Section~\ref{sec:method}, we outline the extension of GMMs to generalized hyperbolic and multivariate skew-t distributions, respectively. Section~\ref{sec:parameter} presents an expectation-maximization (EM) algorithm for obtaining maximum likelihood estimates of model parameters. Then, our approach is illustrated on simulated and real data (Section~\ref{sec:illustration}). The paper concludes with some discussion and suggestions for future work (Section~\ref{sec:discussion}). \section{Background}\label{sec:back} \subsection{Generalized hyperbolic distribution}\label{sec:backghyp} A multivariate generalized hyperbolic distribution arises from a multivariate mean-variance mixture where the weight function $h(w\mid\omega,\eta,\lambda)$ is the density of a generalized inverse Gaussian (GIG) distribution. The density of the GIG distribution is given by \begin{equation} \label{eqn:gig} h(w\mid\omega,\eta,\lambda) = \frac{(w/\eta)^{\lambda-1}}{2\eta K_\lambda(\omega)}\text{exp}\left\{-\frac{\omega}{2}\left(\frac{w}{\eta}+\frac{\eta}{w}\right)\right\} \end{equation} for $w>0$, where $\eta>0$ is a scale parameter, $\omega>0$ is a concentration parameter, $K_{\lambda}$ denotes the modified Bessel function of the third kind with index $\lambda$, and $\lambda$ characterizes certain subclasses and considerably influences the size of tail weights. Write $W \sim \mathcal{I} (\omega,\eta, \lambda)$ to denote that the random variable $W$ has the density in \eqref{eqn:gig}. The GIG distribution has some attractive features, including tractable expected values. Consider $W \sim \mathcal{I} (\omega,\eta, \lambda)$, then the following expected values hold: \begin{align} \label{eqn:expectedvalue} \E [W] &= \eta \frac{K_{\lambda+1}(\omega)}{K_{\lambda}(\omega)},\nonumber\\ \E [1/W] &= \frac{1}{\eta}\frac{K_{\lambda+1}(\omega)}{K_\lambda(\omega)}-\frac{2\lambda}{\omega\eta},\\ \E [\log W] &= \log\eta+\frac{1}{K_\lambda(\omega)}\frac{\partial }{\partial \lambda}K_\lambda(\omega).\nonumber \end{align} Extensive details on GIG distribution can be found in \citet{Jorgensen82}. \cite{browne15} show that a $p$-dimensional generalized hyperbolic random variable $\mathbf{Y}$ can be generated using the relationship \begin{equation} \label{eqn:ghstochastic} \mathbf{Y} = \mbox{\boldmath$\mu$} + W \mbox{\boldmath$\beta$} + \sqrt{W} \mathbf{Z}, \end{equation} where $W \sim \mathcal{I} (\omega,1, \lambda)$, $\mbox{\boldmath$\mu$}$ and $\mbox{\boldmath$\alpha$}$ are $p$-vectors that play the role of location and skewness parameters, respectively, and $\mathbf{Z}\sim\mathcal{N}(\mathbf{0},\mSigma)$. From \eqref{eqn:ghstochastic}, it follows that $\mathbf{Y} \mid w \sim \mathcal{N}(\mbox{\boldmath$\mu$}+w\mbox{\boldmath$\beta$},w\mSigma)$. Now, recalling that $W \sim \mathcal{I}(\omega,1,\lambda)$ and that the unconditional distribution of $\mathbf{Y}$ is a generalized hyperbolic, Bayes' theorem gives \begin{equation}\label{eqn:elegant} W\mid\mathbf{y} \sim \text{GIG}( \omega +\mbox{\boldmath$\beta$}^{'}\mSigma^{-1}\mbox{\boldmath$\beta$}, \omega +\delta (\mathbf{y},\mbox{\boldmath$\mu$}\mid\mSigma),\lambda-p/2 ). \end{equation} Under this parameterization, a $p$-dimensional multivariate generalized hyperbolic distribution has density \begin{equation} \label{eqn:ghd} f(\mathbf{y} \mid \mbox{\boldmath$\vartheta$}) = \left[\frac{\omega +\delta (\mathbf{y},\mbox{\boldmath$\mu$}\mid\mSigma)}{\omega +\mbox{\boldmath$\beta$}^{'}\mSigma^{-1}\mbox{\boldmath$\beta$}} \right]^{(\lambda-p/2)/2} \frac{K_{\lambda-p/2}\left(\sqrt{\left[ \omega +\mbox{\boldmath$\beta$}^{'}\mSigma^{-1}\mbox{\boldmath$\beta$}\right]\left[\omega +\delta (\mathbf{y},\mbox{\boldmath$\mu$}\mid\mSigma) \right]}\right)}{(2\pi)^{p/2}\mid\mSigma\mid^{1/2}K_\lambda(\omega) \text{exp}\{-(\mathbf{y}-\mbox{\boldmath$\mu$})^{'}\mSigma^{-1}\mbox{\boldmath$\beta$}\}}, \end{equation} with index parameter $\lambda $, concentration parameter $\omega$, skewness parameter $\mbox{\boldmath$\beta$}$, mean vector $\mbox{\boldmath$\mu$}$, and scale matrix $\mSigma$. Here, $\delta (\mathbf{y}, \mbox{\boldmath$\mu$}\mid\mSigma)$ is the squared Mahalanobis distance between $\mathbf{y}$ and $\mbox{\boldmath$\mu$}$, i.e., $\delta (\mathbf{y}, \mbox{\boldmath$\mu$}\mid\mSigma) = (\mathbf{y} - \mbox{\boldmath$\mu$})^{'}\mSigma^{-1}(\mathbf{y} - \mbox{\boldmath$\mu$})$, $K_{\lambda-{p}/{2}}$ and $K_\lambda$ are modified Bessel functions of the third kind with indices $\lambda-{p}/{2}$ and $\lambda$, respectively, and $\mbox{\boldmath$\vartheta$}= (\lambda, \omega, \mbox{\boldmath$\mu$}, \mSigma,\mbox{\boldmath$\beta$})$ denotes the model parameters. Herein, let $\mathbf{Y} \sim \text{GHD}_p (\lambda, \omega, \mbox{\boldmath$\mu$}, \mSigma,\mbox{\boldmath$\beta$})$ represent a $p$-dimensional generalized hyperbolic random variable $\mathbf{Y}$ with density as per \eqref{eqn:ghd}. Note that the parameterization in \eqref{eqn:ghd} is one of several available for multivariate generalized hyperbolic distributions \citep[see][]{mcneil05, browne15}. There are a number of special and limiting cases that can be derived from the generalized hyperbolic distribution. However, the presence of the index parameter $\lambda$ enables a flexibility that is not found in its special and limiting cases. Figure~\ref{fig:densityplot} illustrates the Gaussian distribution as well as a skew-t distribution with $\nu=5$ degrees of freedom and the generalized hyperbolic distribution for two different values of $\lambda$; clearly, the different values of $\lambda$ lead to very different densities. \begin{figure}[htb] \centering \includegraphics[width=0.975\textwidth]{DensityPlotGHD.png} \caption{{\small Density plot for the Gaussian distribution (blue), skew-t distribution with $\nu=5$ (purple), and the generalized hyperbolic distribution with $\lambda=2$ (red) and $\lambda=-2$ (green), respectively. }}\label{fig:densityplot} \end{figure} \subsection{Multivariate skew-t distribution}\label{sec:mvskewt} Several alternative formulations of the multivariate skew-t distribution have appeared in the literature, e.g., \cite{azzalini96}, \cite{sahu03}, and \cite{arellano05}. Some recent discussion about some of these formulations is given by \cite{azzalini16}. \citet{muthen15} developed a GMM with the SDB version of the restricted multivariate skew-t distribution, i.e., the version of \cite{sahu03}. The formulation of the multivariate skew-t distribution used herein arises as a special and limiting case of the generalized hyperbolic distribution by setting $\lambda=-\nu/2$ and $\chi=\nu$ while also letting $\psi \to 0$. This formulation of the multivariate skew-t distribution has been used by \citet{murray14a} to develop a mixture of skew-t factor analyzer models and by \citet{murray14b} to develop a mixture of common skew-t factor analyzers. A $p$-dimensional skew-t random variable $\mathbf{Y}$, with this formulation, has the density function \begin{equation} \label{eqn:skewt} f(\mathbf{y} \mid \mbox{\boldmath$\vartheta$}) = \left[\frac{\nu+\delta (\mathbf{y},\mbox{\boldmath$\mu$}\mid\mSigma)}{\mbox{\boldmath$\beta$}^{'}\mSigma^{-1}\mbox{\boldmath$\beta$}} \right]^{(-\nu-p)/4} \frac{\nu^{\nu/2}K_{(-\nu-p)/2}(\sqrt{\left[ \mbox{\boldmath$\beta$}^{'}\mSigma^{-1}\mbox{\boldmath$\beta$}\right]\left[\nu +\delta (\mathbf{y},\mbox{\boldmath$\mu$}\mid\mSigma) \right]})}{(2\pi)^{p/2}\mid\mSigma\mid^{1/2} \Gamma(\nu/2)^{\nu/2} \text{exp}\{-(\mathbf{y}-\mbox{\boldmath$\mu$})^{'}\mSigma^{-1}\mbox{\boldmath$\beta$}\}}, \end{equation} where $\mbox{\boldmath$\mu$}$ is the location parameter, $\mSigma$ is the scale parameter, $\mbox{\boldmath$\beta$}$ is the skew parameter, $\nu$ is the degree of freedom parameter, and $K_{(-\nu-p)/2}$ and $\delta (\mathbf{y},\mbox{\boldmath$\mu$}\mid\mSigma)$ are as defined in \eqref{eqn:ghd}. We write $\mathbf{Y} \sim \text{GST}(\mbox{\boldmath$\mu$},\mSigma,\mbox{\boldmath$\beta$},\nu)$ to denote that the random variable $\mathbf{Y}$ follows the skew-t distribution with the density in \eqref{eqn:skewt}. Now, $\mathbf{Y} \sim \text{GST}(\mbox{\boldmath$\mu$},\mSigma,\mbox{\boldmath$\beta$},\nu)$ can be obtained through the relationship in \eqref{eqn:ghstochastic} with $W \sim \text{IG}(\nu/2,\nu/2)$, where $\text{IG}(\cdot)$ denotes the inverse-gamma distribution. We have $\mathbf{Y} \mid w \sim \mathcal{N}(\mbox{\boldmath$\mu$}+w\mbox{\boldmath$\beta$},w\mSigma)$, and so, from Bayes's theorem, $W \mid \mathbf{y} \sim \text{GIG}( \mbox{\boldmath$\beta$}^{'}\mSigma^{-1}\mbox{\boldmath$\beta$}, \nu +\delta (\mathbf{y},\mbox{\boldmath$\mu$}\mid\mSigma),-(\nu+p)/2 )$. \subsection{The EM algorithm and its convergence criterion} The EM algorithm \citep{dempster77} is an iterative algorithm for finding maximum likelihood estimates when data are incomplete or treated as such, and is widely used to estimate model parameters in the context of model-based clustering.~The E-step computes the expected value of the complete-data log-likelihood given the current model parameters, and the M-step maximizes this expected value with respect to the model parameters. After each E- and M-step, the log-likelihood is driven uphill, and the method iterates towards a maximum until some convergence criterion is satisified. Many variants of the EM algorithm have been proposed over the years, such as the expectation-conditional-maximization (ECM) algorithm \citep{meng93}, the alternating ECM (AECM) algorithm \citep{meng97}, and the Fisher-EM algorithm \citep{bouveyron12}. Herein, we will make use of the EM algorithm for parameter estimation and a stopping criterion based on the Aitken acceleration \citep{aitken26} is used to determine the convergence. The Aitken acceleration at iteration $s$ is \begin{equation} a^{(s)} = \frac{l^{(s+1)}-l^{(s)}}{l^{(s)}-l^{(s-1)}}, \end{equation} where $l^{(s)}$ is the (observed) log-likelihood value at iteration $s$. This yields an asymptotic estimate of the log-likelihood at iteration $s+1$, given by $$l_{\infty}^{(s+1)} = l^{(s)} + \frac{1}{1-a^{(s)}}(l^{(s+1)}-l^{(s)})$$ \citep{bohning94, lindsay95}, and the EM algorithm is stopped when $l_{\infty}^{(s+1)}-l^{(s)} < \epsilon$, provided this difference is positive \citep{mcnicholas10}. Note that this criterion is at least as strict as the lack of progress criterion in the neighbourhood of a maximum. \subsection{Model selection} In model-based clustering, a penalized log-likelihood-based criterion is typically used to determine the ``best'' fitting model among a family of models. The most popular such criterion is the Bayesian information criterion \citep[BIC;][]{schwarz78}, which can be motivated as an approximation to a Bayes factor \citep[see][]{kass95,kasswass95}. The BIC is defined as \begin{equation} \label{eqn:bic} \text{BIC} = 2l(\hat{\mbox{\boldmath$\vartheta$}}) - \rho \log n, \end{equation} where $\hat{\mbox{\boldmath$\vartheta$}}$ is the maximum likelihood estimate of model parameters $\mbox{\boldmath$\vartheta$}$, $l(\hat{\mbox{\boldmath$\vartheta$}})$ is the maximized log-likelihood, $\rho$ is the number of free parameters, and $n$ is the number of observations. Some theoretical support for use of the BIC in mixture model selection is given by \citet{leroux92} and \citet{keribin00}. \section{Methodology}\label{sec:method} \subsection{Conventional GMM with Gaussian random effects}\label{sec:gmm} Suppose a longitudinal study features $n$ subjects and $T$ time points or measurement occasions. For subject $i$ ($i = 1, \ldots, n$), let $\mathbf{y}_i$ be a $T \times 1$ vector $\mathbf{y}_i = (y_{i1}, y_{i2},\ldots,y_{iT})'$ where $y_{it}$ represents the outcome on occasion $t$ ($t = 1, \ldots, T$), let $\mathbf{x}_i = (x_{i1}, x_{i2}, \ldots, x_{im})^{'}$ be an $m \times 1$ vector of observed time-invariant covariates, let $\mbox{\boldmath$\eta$}_i$ be a $q \times 1$ vector containing $q$ continuous latent variables, and note that $\mathbf{C}_i = (C_{i1},\ldots,C_{iK})'$ has a multinomial distribution, where $C_{ik} = 1$ if individual $i$ is in class $k$ and $C_{ik} = 0$ otherwise. The conventional GMM with Gaussian random effects can be represented using a hierarchical three-level formulation as follows. At level 1 of the GMM, the continuous outcome variables $\mathbf{Y}_1,\ldots,\mathbf{Y}_n$ are related to the continuous latent variables $\mbox{\boldmath$\eta$}_1,\ldots,\mbox{\boldmath$\eta$}_n$ via \begin{equation} \label{eqn:yeta} \mathbf{Y}_i\mid (c_{ik}=1) = \mbox{\boldmath$\Lambda$}_y\mbox{\boldmath$\eta$}_i+\mbox{\boldmath$\epsilon$}_i \end{equation} for $i=1,\ldots,n$, where $\mbox{\boldmath$\epsilon$}_i$ is a $T \times 1$ vector of residuals or measurement errors that is assumed to follow a multivariate normal distribution, i.e., $\mbox{\boldmath$\epsilon$}_i \sim \mathcal{N}(\mathbf{0}, \mbox{\boldmath$\Theta$}_k)$, and $\mbox{\boldmath$\Lambda$}_y$ is a $T \times q$ design matrix consisting of factor loadings with each column corresponding to specific aspects of change. The matrix $\mbox{\boldmath$\Lambda$}_y$ and the vector $\mbox{\boldmath$\eta$}_i$ determine the growth trajectory of the model. For instance, when $q=3$, $\mbox{\boldmath$\eta$}_i = (\eta_{0i}, \eta_{1i}, \eta_{2i})$, and $\mbox{\boldmath$\Lambda$}_y$ is a $T \times 3$ matrix. Assuming $a_t$ are age-related time scores $(t = 1,2,\dots,T)$ centred at age $a_0$, the design matrix $\mbox{\boldmath$\Lambda$}_y$ is given by $$\mbox{\boldmath$\Lambda$}_y = \begin{pmatrix} 1 & a_1 - a_0 & (a_1 - a_0)^2\\ 1 & a_2 - a_0 & (a_2 - a_0)^2\\ \vdots & \vdots&\vdots\\ 1 & a_{T-1} - a_0 & (a_{T-1} - a_0)^2 \end{pmatrix}.$$ At level 2 of the GMM, the continuous latent variables $\mbox{\boldmath$\eta$}_i$ are related to the latent categorical variables $\mathbf{c}_i$ and to the observed time-invariant covariate vector $\mathbf{x}_i$ by the relation \begin{equation} \label{eqn:etacx} \mbox{\boldmath$\eta$}_i\mid (c_{ik}=1) = \mbox{\boldmath$\alpha$}_k + \mbox{\boldmath$\Gamma$}_{k} \mathbf{x}_i +\mbox{\boldmath$\zeta$}_i, \end{equation} where $\mbox{\boldmath$\alpha$}_k$ $(k=1,\ldots,K)$ denotes the intercept parameter for class $k$, $\mbox{\boldmath$\zeta$}_i$ is a $q$-dimensional vector of residuals assumed to follow a multivariate normal distribution $\mbox{\boldmath$\zeta$}_i \sim \mathcal{N}(\mathbf{0}, \mathbf\Psi_k)$, and $\mbox{\boldmath$\Gamma$}_{k}$ is a $q\times m$ parameter matrix representing the effect of $\mathbf{x}_i$ on the latent continuous variables $\mbox{\boldmath$\eta$}_i$ and assumed to be different among classes. Note that the level 2 errors $\mbox{\boldmath$\zeta$}_i$ are uncorrelated with the measurement errors $\mbox{\boldmath$\epsilon$}_i$. We may allow for class-specific effects $\mbox{\boldmath$\Gamma$}_{k}$ in \eqref{eqn:etacx} that are equal across classes. By combining the first two levels of the GMM, we have \begin{equation} \label{eqn:gmm} p (\mathbf{y}_i \mid \mathbf{x}_i) = \sum_{k=1}^{K} \pi_k \phi(\mathbf{y}_i ; \mbox{\boldmath$\mu$}_k, \mSigma_k), \end{equation} where $\pi_k = \text{Pr}(C_{ik} = 1)$ is the $k$th class probability or mixing proportion satisfying $\pi_k \in (0, 1]$ and $\sum_{k=1}^{K}\pi_k=1$, and $\phi(\cdot; \mbox{\boldmath$\mu$}_k, \mSigma_k)$ is a multivariate Gaussian density with mean $\mbox{\boldmath$\mu$}_k = \mbox{\boldmath$\Lambda$}_y(\mbox{\boldmath$\alpha$}_k + \mbox{\boldmath$\Gamma$}_k\mathbf{x}_i)$ and covariance matrix $\mSigma_k = \mbox{\boldmath$\Lambda$}_y\mathbf\Psi_k\mbox{\boldmath$\Lambda$}_y^{'}+\mbox{\boldmath$\Theta$}_k$. Notice that the GMM in \eqref{eqn:gmm} assumes that class probability $\pi_k$ is constant for each class. At level 3 of the GMM, we assume that the class probabilities are not constant for each class, but depend on the observed covariates. In other words, we want to know how $\pi_k$ is related to an individual's background variables, e.g., gender and income. At this level, the categorical latent variables $\mathbf{C}_{i}$ represent membership of mixture components that are related to $\mathbf{x}_i$ through a multinomial logit regression for unordered categorical responses. Define $\pi_{ik} = \text{Pr}(C_{ik}=1\mid\mathbf{x}_i)$, i.e., the probability that subject $i$ falls into the $k$th class depending on the covariates $\mathbf{x}_i$. Let $\mbox{\boldmath$\pi$}_i=(\pi_{i1},\pi_{i2},\ldots,\pi_{iK})'$ and $$\text{logit}(\mbox{\boldmath$\pi$}_i) = \left(\,\mbox{log}\left(\frac{\pi_{i1}}{\pi_{iK}}\right),\,\mbox{log}\left(\frac{\pi_{i2}}{\pi_{iK}}\right),\dots,\,\mbox{log}\left(\frac{\pi_{i K-1}}{\pi_{iK}}\right)\right)'.$$ Then, \begin{equation} \label{eqn:cx} \text{logit}(\mbox{\boldmath$\pi$}_i) = \mbox{\boldmath$\alpha$}_c + \mbox{\boldmath$\Gamma$}_c \mathbf{x}_i, \end{equation} where $\mbox{\boldmath$\alpha$}_c$ is a $(K-1)$-vector of parameters and $\mbox{\boldmath$\Gamma$}_c$ is a $(K-1) \times q$ parameter matrix. By combining these three levels of the GMM, we have \begin{equation} \label{eqn:egmm} p (\mathbf{y}_i \mid \mathbf{x}_i) = \sum_{k=1}^{K} \pi_{ik} \phi(\mathbf{y}_i ; \mbox{\boldmath$\mu$}_k, \mSigma_k), \end{equation} where $\phi(\cdot; \mbox{\boldmath$\mu$}_k, \mSigma_k)$ is defined as in \eqref{eqn:gmm}. Note that the right hand side of \eqref{eqn:egmm} is not a finite mixture model because the class probabilities are not constant with resect to $i$. \subsection{GMM with generalized hyperbolic random effects}\label{sec:ghypgmm} The conventional GMM assumes that the residuals $\mbox{\boldmath$\epsilon$}_i$ and $\mbox{\boldmath$\zeta$}_i$ have multivariate Gaussian distribution with zero means and within-class covariance matrices, respectively. We are interested in constructing a GMM with generalized hyperbolic distribution model errors, denoted by GHD-GMM. The generalized hyperbolic distribution can be represented as a normal mean-variance mixture, where the mixing weight has a GIG distribution (see Section~\ref{sec:backghyp}). To this end, we introduce a latent continuous variable $W_{ik}$ with $W_{ik}\mid c_{ik}=1\sim \mathcal{I} (\omega_k, 1, \lambda_k)$. Accordingly, conditional on $c_{ik}$ and $w_{ik}$, we assume that model errors $\mbox{\boldmath$\epsilon$}_i$ and $\mbox{\boldmath$\zeta$}_i$ are non-centered Gaussian error terms with distinct covariance matrices: \begin{align} \label{eqn:epsilon} \mbox{\boldmath$\epsilon$}_i \mid w_{ik},c_{ik}&=1 \sim \mathcal{N}(w_{ik}\mbox{\boldmath$\beta$}_{yk},w_{ik}\mbox{\boldmath$\Theta$}_k), \\ \label{eqn:zeta} \mbox{\boldmath$\zeta$}_i \mid w_{ik},c_{ik}&=1 \sim \mathcal{N}(w_{ik}\mbox{\boldmath$\beta$}_{\eta k},w_{ik}\mathbf\Psi_k), \end{align} where $\mbox{\boldmath$\Theta$}_k$ is the diagonal covariance matrix for $\mbox{\boldmath$\epsilon$}_i$, and $\mathbf\Psi_k$ is the covariance matrix for $\mbox{\boldmath$\zeta$}_i$. The $T$-dimensional vector $\mbox{\boldmath$\beta$}_{yk}$ is a vector of skewness parameters, which we refer to as the skewness parameter for the measurement errors. The $q$-dimensional vector $\mbox{\boldmath$\beta$}_{\eta k}$ is the vector of skewness parameters for the continuous latent variables $\mbox{\boldmath$\eta$}_i$. Then, based on \eqref{eqn:etacx} and \eqref{eqn:epsilon}, the observed random variables $\mathbf{Y}_i$, conditional on $\mbox{\boldmath$\eta$}_i$, $c_{ik}$, and $w_{ik}$, follow a conditional Gaussian distribution of the form \begin{equation} \label{eqn:observedyeta} \mathbf{Y}_i \mid\mbox{\boldmath$\eta$}_i,w_{ik},c_{ik}=1 \sim \mathcal{N}(\mbox{\boldmath$\Lambda$}_y \mbox{\boldmath$\eta$}_i + w_{ik} \mbox{\boldmath$\beta$}_{yk}, w_{ik}\mbox{\boldmath$\Theta$}_k ). \end{equation} Based on \eqref{eqn:etacx} and \eqref{eqn:zeta}, \begin{equation} \label{eqn:eta} \mbox{\boldmath$\eta$}_i \mid\mathbf{x}_i,w_{ik},c_{ik}=1 \sim \mathcal{N}(\mbox{\boldmath$\alpha$}_k+\mbox{\boldmath$\Gamma$}_{k} \mathbf{x}_i + w_{ik}\mbox{\boldmath$\beta$}_{\eta k}, w_{ik}\mathbf\Psi_k) \end{equation} and, from the preceding equations, we have the conditional distribution \begin{equation} \label{eqn:observedy} \mathbf{Y}_i \mid \mathbf{x}_i, w_{ik}, c_{ik} = 1 \sim \mathcal{N} (\mbox{\boldmath$\mu$}_k + w_{ik}(\mbox{\boldmath$\Lambda$}_y\mbox{\boldmath$\beta$}_{\eta k} + \mbox{\boldmath$\beta$}_{yk}), w_{ik}\mSigma_k), \end{equation} where $\mbox{\boldmath$\mu$}_k=\mbox{\boldmath$\Lambda$}_y(\mbox{\boldmath$\alpha$}_k+\mbox{\boldmath$\Gamma$}_{k}\mathbf{x}_i)$ and $\mSigma_k=\mbox{\boldmath$\Lambda$}_y\mathbf\Psi_k\mbox{\boldmath$\Lambda$}_y^{'}+\mbox{\boldmath$\Theta$}_k$. From \eqref{eqn:elegant}, we obtain the conditional distributions \begin{align} \mbox{\boldmath$\eta$}_i\mid\mathbf{x}_i,c_{ik} = 1 &\sim \text{GHD}_q(\lambda_k,\omega_k,\mbox{\boldmath$\alpha$}_k+\mbox{\boldmath$\Gamma$}_{k}\mathbf{x}_i,\mathbf\Psi_k,\mbox{\boldmath$\beta$}_{\eta k}),\\ \mathbf{Y}_i\mid\mathbf{x}_i,c_{ik} = 1 &\sim \text{GHD}_T(\lambda_k,\omega_k,\mbox{\boldmath$\mu$}_k,\mSigma_k,\mbox{\boldmath$\Lambda$}_y\mbox{\boldmath$\beta$}_{\eta k} + \mbox{\boldmath$\beta$}_{yk}). \end{align} By combining the preceding setup and level 3 of the GMM from Section~\ref{sec:gmm}, we arrive at a GMM with density \begin{equation} \label{eqn:ghdgmm} p (\mathbf{y}_i \mid \mathbf{x}_i) = \sum_{k=1}^{K} \pi_{ik} f_{\text{GHD}_T}(\mathbf{y}_i ; \lambda_k, \omega_k, \mbox{\boldmath$\mu$}_k, \mSigma_k, \mbox{\boldmath$\Lambda$}_y\mbox{\boldmath$\beta$}_{\eta k} + \mbox{\boldmath$\beta$}_{yk}), \end{equation}where $f_{\text{GHD}_T}(\cdot)$ is the density of a $T$-dimensional random variable following a generalized hyperbolic distribution. Note that the overall skewness for $\mathbf{Y}_i$ is $\mbox{\boldmath$\Lambda$}_y\mbox{\boldmath$\beta$}_{\eta k} +\mbox{\boldmath$\beta$}_{yk}$. Note also that, within this setup, the dependent observed variable $\mathbf{Y}_i$, the latent growth factors $\mbox{\boldmath$\eta$}_i$, and residual variables $\mbox{\boldmath$\epsilon$}_i$ and $\mbox{\boldmath$\zeta$}_i$ all have generalized hyperbolic distributions. Note that the distribution of the covariates $\mathbf{x}_i$ is not modelled; please refer to \citet{muthen15} for detailed explanations. \subsection{GMM with multivariate skew-t random effects}\label{sec:skewtgmm} In this section, we are interested in extending the conventional GMM to have multivariate skew-t distribution model errors, denoted by GST-GMM. As in the case for the generalized hyperbolic distribution, the formulation of the multivariate skew-t distribution we use has a convenient representation as a normal mean-variance mixture; this time, the weight has an inverse-gamma distribution (see Section~\ref{sec:mvskewt}). In analogous fashion to the GHD-GMM, a latent continuous random variable $W_{ik}$ is first introduced, where $W_{ik} \mid c_{ik} = 1 \sim \text{IG}(\nu_k/2,\nu_k/2)$. Accordingly, we assume that $\mbox{\boldmath$\epsilon$}_i$ and $\mbox{\boldmath$\zeta$}_i$ are non-centered Gaussian error terms with their own covariance matrices as in \eqref{eqn:epsilon} and \eqref{eqn:zeta}, and $\mathbf{y}_i$ and $\mbox{\boldmath$\eta$}_i$ are conditionally normally distributed as in \eqref{eqn:observedyeta} and \eqref{eqn:eta}. Form this characterization of the multivariate skew-t distribution, the following conditional distributions are obtained: \begin{align} \mbox{\boldmath$\eta$}_i\mid\mathbf{x}_i,c_{ik} = 1 &\sim \text{GST}_q(\mbox{\boldmath$\alpha$}_k+\mbox{\boldmath$\Gamma$}_{k}\mathbf{x}_i,\mathbf\Psi_k,\mbox{\boldmath$\beta$}_{\eta k}, \nu_k),\\ \mathbf{Y}_i\mid\mathbf{x}_i,c_{ik} = 1 &\sim \text{GST}_T(\mbox{\boldmath$\mu$}_k,\mSigma_k,\mbox{\boldmath$\beta$}_{yk} + \mbox{\boldmath$\Lambda$}_y\mbox{\boldmath$\beta$}_{\eta k}, \nu_k), \end{align} where $\mbox{\boldmath$\mu$}_k$ and $\mSigma_k$ are as described above and $\nu_k$ is a concentration parameter (i.e., the degrees of freedom). Similarly, we arrive at a GMM with a multivariate skew-t distribution \begin{equation} \label{eqn:gstgmm} p(\mathbf{y}_i\mid\mathbf{x}_i) = \sum_{k=1}^K \pi_{ik} f_{\text{GST}_T}(\mathbf{y}_i;\mbox{\boldmath$\mu$}_k,\mSigma_k,\mbox{\boldmath$\beta$}_{yk}+\mbox{\boldmath$\Lambda$}_y\mbox{\boldmath$\beta$}_{\eta k},\nu_k). \end{equation} In this setup, the random variable $\mathbf{Y}_i$, the latent growth factors $\mbox{\boldmath$\eta$}_i$, and the residual variables $\mbox{\boldmath$\epsilon$}_i$ and $\mbox{\boldmath$\zeta$}_i$ all follow multivariate skew-t distributions. \subsection{Comments on the GHD-GMM and GST-GMM} Recalling that the overall skewness for $\mathbf{Y}_i$ is $\mbox{\boldmath$\Lambda$}_y\mbox{\boldmath$\beta$}_{\eta k} +\mbox{\boldmath$\beta$}_{yk}$, there are a total of $T+q$ skewness parameters in our GMM extensions. Hence, the skewness parameters $\mbox{\boldmath$\beta$}_{yk}$ and $\mbox{\boldmath$\beta$}_{\eta k}$ are subject to identifiability issues because no more than $T$ skewness parameters can be identified from $T$-dimensional $\mathbf{Y}_i$. Therefore, two special formulations are considered in this paper. The first formulation is where $\mbox{\boldmath$\beta$}_{yk} = \mathbf{0}$. In this formulation, the residuals for $\mathbf{Y}_i$ or the measurement errors are not skewed, i.e., $\mbox{\boldmath$\epsilon$}_i \mid w_{ik},c_{ik} =1 \sim \mathcal{N}(\mathbf{0},w_{ik}\mbox{\boldmath$\Theta$}_k)$, and all of the skewness in the data is assumed to come from the distribution of latent factors. The second special formulation is the case where $\mbox{\boldmath$\beta$}_{\eta k} = \mathbf{0}$. In this formulation, the residuals for the latent factors $\mbox{\boldmath$\eta$}_i$ are symmetric, i.e., $\mbox{\boldmath$\zeta$}_i \mid w_{ik},c_{ik} =1 \sim \mathcal{N}(\mathbf{0},w_{ik}\mathbf\Psi_k)$. Accordingly, all of the skewness in the data is assumed to come from the residuals of $\mathbf{Y}_i$ or the measurement errors. In practice, we would want as much of the skewness as possible in the observed data $\mathbf{Y}_1,\ldots,\mathbf{Y}_n$ to be explained through the latent factors. There appears to be no optimal strategy with respect to which skewness parameter to estimate. Accordingly, four statistical models, differing with respect to the distributions of measurement errors and random effects for the first two levels of the GMM, are employed and compared. These models are as follows: \begin{itemize} \item \textbf{Model I:} A model with independent multivariate generalized hyperbolic random effects and measurement errors while assuming all of the skewness in the data comes from the distribution of latent factors (i.e., GHD-GMM under $\mbox{\boldmath$\beta$}_{yk} = \mathbf{0}$). \item \textbf{Model II:} A model with independent multivariate generalized hyperbolic random effects and measurement errors while assuming all of the skewness in the data comes from the residuals of $\mathbf{Y}_i$ (i.e., GHD-GMM under $\mbox{\boldmath$\beta$}_{\eta k} = \mathbf{0}$). \item \textbf{Model III:} A model with independent multivariate skew-t random effects and measurement errors while assuming all of the skewness in the data comes from the distribution of latent factors (i.e., GST-GMM under $\mbox{\boldmath$\beta$}_{yk} = \mathbf{0}$). \item \textbf{Model IV:} A model with independent multivariate skew-t random effects and measurement errors while assuming all of the skewness in the data comes from the residuals of $\mathbf{Y}_i$ (i.e., GST-GMM under $\mbox{\boldmath$\beta$}_{\eta k} = \mathbf{0}$). \end{itemize} Take Model I (i.e., GHD-GMM under $\mbox{\boldmath$\beta$}_{yk}=\mathbf{0}$) as an example. For different trajectory classes, the parameters $\lambda_k, \omega_k, \mbox{\boldmath$\alpha$}_k, \mbox{\boldmath$\beta$}_{\eta k}, \mbox{\boldmath$\Theta$}_k, \mathbf\Psi_k$, and $\mbox{\boldmath$\Gamma$}_{k}$ may be different across classes, or may be the same across the classes. By imposing constraints on all these parameters (different or the same across classes), we obtain a family of GHD-GMM models. In this paper, we only consider two models, one model assumes that the parameters $\lambda_k, \omega_k, \mbox{\boldmath$\alpha$}_k, \mbox{\boldmath$\beta$}_{\eta k}, \mbox{\boldmath$\Theta$}_k, \mathbf\Psi_k$,~and $\mbox{\boldmath$\Gamma$}_{k}$ are different across classes, we call this model the general model. The second model assumes that only the parameter $\mbox{\boldmath$\beta$}_{\eta k}$ is different across classes while all the other parameters are the same across classes, i.e., $\lambda_k = \lambda$, $\omega_k = \omega$, $\mbox{\boldmath$\alpha$}_{k} = \mbox{\boldmath$\alpha$}_{c}$, $\mbox{\boldmath$\Theta$}_k = \mbox{\boldmath$\Theta$}$, $\mathbf\Psi_k=\mathbf\Psi$, and $\mbox{\boldmath$\Gamma$}_k=\mbox{\boldmath$\Gamma$}_{c}$ for $k = 1, 2, \ldots, K$; we call this model the most constrained model. To this end, eight parameterizations in Table~\ref{nparmodels} are considered. Models~II and~IV allow a more general representation of the class skewness parameters (i.e., $\mbox{\boldmath$\beta$}_{yk}$). However, in terms of model complexity, Models~II and~IV have $K(T-q)$ more parameters than Models~I and~III. Hence, Models~II and~IV need larger sample sizes as small class sizes can create problems, such as singularity of the covariance matrix and slow or non-convergence of the EM algorithm. In addition, Model~III is the most parsimonious and it may be useful when the number of classes $K$ is large. \begin{table}[!ht] \caption{Key characteristics and the associated number of free parameters for the general and constrained varieties of Models~I--IV.} \label{nparmodels} \centering \small{ \begin{tabular*}{1.0\textwidth}{@{\extracolsep{\fill}}lrrrr} \hline \multicolumn{2}{c}{Model}&Dist.&Skewness&Number of free parameters\\ \hline \multirow{2}{*}{Model I}&General&GHD&Latent $\mbox{\boldmath$\eta$}_i$&$K T+3K-1+K q [(q+1)/{2}+2+m]$\\ &Constrained&GHD&Latent $\mbox{\boldmath$\eta$}_i$ &$T+K+1+q [({q+1})/{2}+K+1+m]$\\ \multirow{2}{*}{Model II}&General&GHD&Observed $\mathbf{Y}_i$&$2 T K +3K-1+K q [({q+1})/{2}+1+m]$\\ &Constrained&GHD&Observed $\mathbf{Y}_i$&$T+2K+1+q[({q+1})/{2}+K+m]$\\ \multirow{2}{*}{Model III}&General&Skew-t&Latent $\mbox{\boldmath$\eta$}_i$&$K T+2K-1+K q [({q+1})/{2}+2+m]$\\ &Constrained&Skew-t&Latent $\mbox{\boldmath$\eta$}_i$&$T+K+q [({q+1})/{2}+K+1+m]$\\ \multirow{2}{*}{Model IV}&General&Skew-t&Observed $\mathbf{Y}_i$&$2 T K+2K-1+K q [({q+1})/{2}+1+m]$\\ &Constrained&Skew-t&Observed $\mathbf{Y}_i$&$T+2K+q [({q+1})/{2}+K+m]$\\ \hline \end{tabular*}} \end{table} \subsection{Parameter estimation}\label{sec:parameter} To fit the models, we adopt the well-known EM algorithm. In our case, the missing data comprise the latent categorical variables $\mathbf{c}_1,\ldots,\mathbf{c}_n$, the latent growth factors $\mbox{\boldmath$\eta$}_1,\ldots,\mbox{\boldmath$\eta$}_n$, and the latent weight parameter $w_{ik}$. Therefore, the complete-data consist of the observed outcome data $\mathbf{y}_1,\ldots,\mathbf{y}_n$, the covariates $\mathbf{x}_1,\ldots,\mathbf{x}_n$ together with the $\mathbf{c}_{i}$, $\mbox{\boldmath$\eta$}_{i}$, and $w_{ik}$, and complete-data likelihood is given by \begin{equation*} \mathcal{L}_{\text{c}}(\mbox{\boldmath$\vartheta$}) = \prod_{i=1}^n\prod_{k=1}^K[\pi_{ik}\phi(\mathbf{y}_i\mid\mbox{\boldmath$\Lambda$}_y\mbox{\boldmath$\eta$}_i,w_{ik}\mbox{\boldmath$\Theta$}_k)\phi(\mbox{\boldmath$\eta$}_i\mid\mbox{\boldmath$\alpha$}_k+\mbox{\boldmath$\Gamma$}_{k}\mathbf{x}_i+w_{ik}\mbox{\boldmath$\beta$}_{\eta k},w_{ik}\mathbf\Psi_k)h(w_{ik})]^{c_{ik}}, \end{equation*} where $W_{ik}\sim \mathcal{I} (\omega_k,\lambda_k)$ for GHD-GMM and $W_{ik}\sim \text{IG}(\nu_k/2,\nu_k/2)$ for GST-GMM. In the E-step, we compute the expected value of the complete data log-likelihood, denoted $\mathcal{Q}$, conditional on the current model parameters. Then, in the M-step, we obtain the updated model parameters by maximizing $\mathcal{Q}$. Detailed parameter updates for Models~I, II and~III are outlined in Appendix~B. \section{Illustrations}\label{sec:illustration} \subsection{Performance assessment}\label{sec:assessment} Although all of our illustrations are treated as genuine clustering analysis, i.e., no prior knowledge of labels is assumed, the true labels are known in each case and can be used to evaluate the performance of our GHD-GMM and GST-GMM models. We use misclassification rates (ERR) and the adjusted Rand index \citep[ARI;][]{hubert85} to assess classification performance. The ERR is simply the proportion of misclassified observations. The ARI indicates the pairwise agreement between true and predicted group memberships while also accounting for the fact that random classification would classify some observations correctly by chance. An ARI value of 1 indicates perfect classification, its expected value is 0 under random classification, and a negative ARI value indicates classification that is worse than one would expect under random classification. Further details and discussion of the ARI are given by \cite{steinley04}. \subsection{Alcoholic consumption data from the National Longitudinal Survey of Youth} \subsubsection{The data} The National Longitudinal Survey of Youth (NLSY) is a longitudinal study conducted by the United States Bureau of Labor Statistics with the goal of understanding the interaction between labor force participation, education, and health behaviors in children and adolescents. The sample for this study was a cohort of children who were between the ages of 12 and 17 when first interviewed in 1997. The data of interest were gathered each year between 1997 and 2011 and again in 2013 (15 total possible interviews). Each respondent provided a number between 0 and 98 that represents the number of alcoholic drinks they typically consume on a given day on which they are drinking. Because we are interested in modeling drinking behaviour over the life span, the data are shifted from representing year of interview to age. We follow individuals who were first interviewed at age 16 until they are 19; all individuals with missing inputs are excluded and no covariates are adopted. To this end, 1151 observations with four time points (i.e., at ages 16, 17, 18, and 19) are used for the following analyses. \subsubsection{Model selection} We implement the Gaussian GMM via {\tt{Mplus}} Version 7.1 \citep{muthen98}. Our proposed GHD-GMM and GST-GMM are implemented in {\sf R} and run with $K=1,\ldots,10$ until the best model is obtained under each scenario. Table~\ref{nlsyresult} shows the results of fitting all of the models as aforementioned for a varying number of latent classes. The BIC values show that more than eight classes are needed with the conventional GMM, two are needed with constrained Models~I and~IV, and three are needed for all of the other models. The BIC values for the GST-GMM and GHD-GMM are always better than the BIC for the normal GMM. Notably, the BIC values for the GHD-GMM do not always improve on those for the GST-GMM. Among all fitted models, the three-cluster general GST-GMM under $\mbox{\boldmath$\beta$}_{yk}=\mathbf{0}$ (i.e., general Model III) is preferable according to the BIC. It is worth mentioning that, even though the skew-t distribution is a special case of the generalized hyperbolic distribution, the GST-GMM seems to be useful in addition to the GHD-GMM. \begin{table}[!ht] \caption{Results of fitting normal, GST, and GHD GMMs for consumption data from the National Longitudinal Survey of Youth.} \label{nlsyresult} \centering \small{ \begin{tabular*}{1.0\textwidth}{@{\extracolsep{\fill}}lrrrrrr} \hline &\multicolumn{3}{c}{GMM--Normal (constrained)} &\multicolumn{3}{c}{GMM--Normal (general)}\\ \cline{2-4}\cline{5-7} Class & Log-likelihood & Free paras & BIC & Log-likelihood & Free paras & BIC\\ \hline 1 & --14983.42 & 9 & --30030.27 & --14983.42& 9 & --30030.27 \\ 2 & --14623.41 & 12 & --29331.40 & --12671.88& 19 & --25477.69\\ 3 & --14330.00 & 15 & --28765.72 & --12233.95& 29 & --24672.31 \\ 4 & --14182.66 & 18 & --28492.19 & --12119.21& 39 & --24513.30 \\ 5 & --14076.42 & 21 & --28300.85 & --12027.60 & 49 & --24400.58 \\ 6 & --14015.58 & 24 & --28200.32 & --11950.97 & 59 & --24317.78 \\ 7 & --13980.78 & 27 & --28151.86 & --11906.09 & 69 & --24298.53 \\ 8 & --13937.17 & 30 & --28085.80 & --11870.44 & 79 &--24297.69 \\ 9 & --13916.40 & 33 & --28065.38& & & \\ \hline &\multicolumn{3}{c}{GHD--GMM (Model I, constrained)} &\multicolumn{3} {c}{GHD--GMM (Model I, general)} \\ \cline{1-4}\cline{5-7} Class & Log-likelihood & Free paras & BIC & Log-likelihood & Free paras & BIC \\ \hline 1 & --12403.20 & 13 & --24898.19 & --12403.28 & 13 & --24898.19 \\ 2 & --12315.75 & 16 & --24744.27& --12119.53 & 27 & --24429.36 \\ 3 & --12315.50 & 19 & --24764.91 & --11958.92 & 41 & \textbf{--24206.82}\\ 4 & & & & --11953.84 & 55 & --24295.33 \\ \hline &\multicolumn{3}{c}{GHD--GMM (Model II, constrained)} &\multicolumn{3}{c} {GHD--GMM (Model II, general)} \\ \cline{1-4}\cline{5-7} Class & Log-likelihood & Free paras & BIC & Log-likelihood & Free paras & BIC \\ \hline 1 & --12399.68 & 15 & --24883.94 & --12399.68 & 15 & --24905.09 \\ 2 & --12312.27 & 18 & --24737.32 & --12166.47 & 31 & --24551.45 \\ 3 & --12288.26 & 21 & --24717.49 & --12002.12 & 47 & --24335.51 \\ 4 & --12287.98 & 24 & --24745.12 & --11956.47 & 63 & --24356.99 \\ \hline &\multicolumn{3}{c}{GST--GMM (Model III, constrained)} &\multicolumn{3} {c}{GST--GMM (Model III, general)} \\ \cline{1-4}\cline{5-7} Classes & Log-likelihood & Free paras & BIC & Log-likelihood & Free paras & BIC \\ \hline 1 & --12421.85 & 12 & --24928.28 & --12421.92 & 12 & --24928.42 \\ 2 & --12352.31 & 15 & --24810.34 & --12151.6 & 25 & --24479.41 \\ 3 & --12340.61 & 18 & --24808.10 & --11966.84 & 38 &\textbf{ --24201.52} \\ 4 & --12348.28 & 21 & --24844.58 & --11925.67 & 51 & --24210.82 \\ \hline &\multicolumn{3}{c}{GST--GMM (Model IV, constrained)}&\multicolumn{3}{c} {GST--GMM (Model IV, general)} \\ \cline{1-4}\cline{5-7} Classes & Log-likelihood & Free paras & BIC & Log-likelihood & Free paras & BIC \\ \hline 1 & --12418.18 & 14 & --24935.05 & --12418.19 & 14 & --24935.05 \\ 2 & --12348.01 & 17 & --24748.06 & --12118.12 & 29 & --24440.64 \\ 3 & --12347.48 & 20 & --24756.18 & --11990.60 & 44 & --24291.33 \\ 4 & & & & --11938.08 & 59 & --24292.00 \\ \hline \end{tabular*}} \end{table} \subsubsection{Interpretation of the best model} The best-fitting model, the three-class Model III, breaks the data into three groups. From Table~\ref{AlcoholicParaEst}, it can be seen that Class 1 comprising 56\% of the population, begins with low-moderate drinking ($<1$ drink per drinking day), slightly increases during adolescence, and by age 19 the average drinks per drinking day is at about~1. These can be considered ``consistent low" drinkers. Although the intercept for this class is heavily positively skewed (intercept skewness $=2.59$), the slope is not (intercept skewness $=0.03$), which indicates that the individual slopes are nearly normally distributed around the class slope of 0.21. The second class, comprising 24\% of the population, are what will be called the ``decreasing" drinkers. This class has an intercept of around five drinks per drinking day (a drinking binge) and ends at about 3 drinks per drinking day (just below the amount considered a drinking binge).\footnote{The World Health Organization defines heavy episodic drinking (also called a drinking ``binge") as the consumption of 60 or more grams of alcohol on one occasion ({\tt www.who.int/gho/alcohol/consumption\_patterns/heavy\_episodic\_drinkers\_text/en/}), which is about four standard drinks ({\tt www.niaaa.nih.gov/alcohol-health/overview-alcohol-consumption/what- standard-drink}).} The intercept is again positively skewed (intercept skewness $=2.90$) but the slope is negatively skewed (slope skewness $=-0.78$), suggesting that individuals in this class decrease their consumption quickly over the period of adolescence. The third class, comprising 20\% of the population, will be called the ``increasing moderate" drinkers. Their initial level of drinking is around 2.87 drinks per drinking day (less than a binge) and this increases during adolescence, ending at age 19 around 7 drinks per drinking day (far above a drinking binge). Both the slope and intercept are slightly positively skewed (intercept skewness $=0.48$, slope skewness $=0.41$; see Table~\ref{AlcoholicParaEst}). \begin{table}[!ht] \caption{Key parameter estimates for the best model (three-class Model III).} \label{AlcoholicParaEst} \centering \small{ \begin{tabular*}{1.0\textwidth}{@{\extracolsep{\fill}}lrrr} \hline &\multicolumn{3}{c}{Class}\\ \cline{2-4} &$k=1$&$k=2$&$k=3$\\ \hline $n_k$&645&276&230\\ $\sum_{i=1}^n\pi_{ik}$&0.56&0.24&0.20\\ $\alpha_k$&$(0.32,0.21)^{'}$&$(4.98,-0.45)^{'}$&$(2.87,1.37)^{'}$\\ $\beta_k$&$(2.58,0.03)^{'}$&$(2.90,-0.78)^{'}$&$(0.48,0.41)^{'}$\\ $\nu_k$&6.83&2.97&2.62\\ $\mathbf\Psi_k$&$\left[\begin{array}{cc}0.22&-0.17\\-0.17&0.15\end{array}\right]$&$\left[\begin{array}{cc}0.10&-0.16\\-0.16&0.50\end{array}\right]$&$\left[\begin{array}{cc}0.14&-0.05\\-0.05&0.02\end{array}\right]$\\ \hline \end{tabular*}} \end{table} These results suggest that, during adolescence, which is typically a time when alcohol consumption is initiated, individuals will have different reactions to the exposure to alcohol given their previous experience. Those individuals who are low drinkers will tend to continue to be low drinkers, those who have already consumed alcohol heavily will begin to taper back to safe levels (alluding to these individuals ``knowing their limits" when it comes to alcohol), and those who are only at moderate levels tend to increase to heavy drinking. This model may be useful because for indicating which 15-year-olds should be the target of interventions if the goal is to prevent heavy drinking in late adolescence. Although the high drinkers may appear to be the most likely to develop problems related to alcohol, they may ``grow out" of their alcohol consumption; most especially, the 15-year-olds that only drink at moderate levels should not be neglected. \citet{kerr00} find similar patterns using three different youth surveys. They measure the stability of alcohol consumption over four time periods. Time~1 cohort are separated into three classes: abstainers, moderate drinkers, and heavy drinkers. They find a high proportion of abstainers continue to abstain and very few drink more than once or drink heavily. Moderate drinkers also show considerable stability in these samples, with 70\% or more staying in the moderate category. Time~1 heavy drinkers are the least stable. In all three surveys, less than half of the heavy drinkers remain heavy drinkers. Our results also aligned better with those in \cite{warner07}, who found three groups of adolescent drinking initiation: a large group with no or low drinking (our ``consistent low" drinkers), a group that drank exclusively in adolescence and then decreased (analogous to our ``decreasing" drinkers), and a group that started low and increased (analogous to our ``increasing moderate" drinkers). \subsubsection{Partition study} Other models tend to find similar latent classes. For instance, the three-class Model~I (which has a very similar BIC to the three-class skew-t model) demonstrates a similar partition (Table~\ref{PartitionCompare}). This suggests that the same pattern endures regardless of the distributional assumptions. However, the cluster proportions differ slightly (58\%, 24\%, and 18\%, for the low, high/decreasing, and moderate/increasing classes, respectively), which seems to suggest that the GHD model classifies more individuals into the ``low'' class than the skew-t model. If the goal of the analysis is to identify groups to target for interventions for the prevention of alcoholism, the proportions found in the skew-t model might be preferred as they create population groups that are larger. Therefore, interventions targeting this group may have a greater impact on the population than those targeting a smaller group. \begin{table}[!ht] \caption{Confusion matrix between the partition obtained by the 3-class Model I and the partition obtained by the 3-class Model III.} \label{PartitionCompare} \centering \small{ \begin{tabular*}{1.0\textwidth}{@{\extracolsep{\fill}}clccc} \hline &&\multicolumn{3}{c}{Model III, general}\\ &&Consistent low&Decreasing &Increasing moderate\\ \multirow{3}{*}{Model I, general}&Consistent low&645&0&23\\ &Decreasing&0&276&0\\ &Increasing moderate&0&0&207\\ \hline \end{tabular*}} \end{table} \subsection{Simulation studies} In addition to real data application of our proposed model, we perform simulation studies with data generated in a number of scenarios: linear and quadratic GMMs with different distributions of the measurement errors and random effects, resulting in four distinct simulated data examples (see Table~\ref{SimDetail} for details). Individual trajectories for these four simulation experiments are plotted in Figure~\ref{fig:simutrajectory}. \begin{table}[!ht] \caption{Key characteristics for Simulations~1--4.} \label{SimDetail} \centering \small{ \begin{tabular*}{1.0\textwidth}{@{\extracolsep{\fill}}lrrrrrrr} \hline Simulation&Model&$n$&$K$&$T$&$q$&$\sum_{i=1}^n\pi_{ik}$&Partition\\ \hline 1&Model I&400&2&50&3&$({1}/{2},{1}/{2})$&Overlapping\\ 2&Model II&800&2&5&2&$({1}/{2},{1}/{2})$&Separated\\ 3&Model III&1500&3&20&2&$({1}/{3},{1}/{3},{1}/{3})$&Separated\\ 4&Model IV&1000&2&8&3&$({1}/{2},{1}/{2})$&Overlapping\\ \hline \end{tabular*}} \end{table} \begin{figure*} \centering \begin{subfigure}[b]{0.425\textwidth} \centering \includegraphics[width=\textwidth]{M1G2QT50n400_2.pdf} \caption[Network2]% {{\small Simulation 1}} \label{fig:sim1} \end{subfigure} \quad \begin{subfigure}[b]{0.425\textwidth} \centering \includegraphics[width=\textwidth]{M2G2LT5n800_2.pdf} \caption[]% {{\small Simulation 2}} \label{fig:sim2} \end{subfigure} \vskip\baselineskip \begin{subfigure}[b]{0.425\textwidth} \centering \includegraphics[width=\textwidth]{M3G3LT20n1500_2.pdf} \caption[]% {{\small Simulation 3}} \label{fig:sim3} \end{subfigure} \quad \begin{subfigure}[b]{0.425\textwidth} \centering \includegraphics[width=\textwidth]{M4G2QT8n1000_2.pdf} \caption[]% {{\small Simulation 4}} \label{fig:sim4} \end{subfigure} \caption[ Simulation Examples] {\small Individual observation trajectories plots for the four simulation experiments.} \label{fig:simutrajectory} \end{figure*} We assess the performance of the family of non-elliptical GMMs in several different ways: Section~\ref{sec:sim1} illustrates the ability of our proposed family of models to recover underlying parameters when the number of classes and the model are correctly specified; then we present a comparison of the proposed models on BIC, ARI, and ERR from the clustering result for each simulation in Section~\ref{sec:sim2}; last but not least, we compare our proposed family of non-elliptical GMMs with Gaussian GMM developed by Muth{\'e}n and colleagues, which dominates the literature on GMMs in Section~\ref{sec:sim3} \subsubsection{Parameter recovery under the true model}\label{sec:sim1} First, we evaluate the ability of our proposed model to recover underlying parameters when the number of classes and the model are correctly specified. To this end, 100 datasets are generated for each of the four simulation experiments. True values and the means of the parameter estimates with their associated standard deviations are summarized in Tables~\ref{simu1result}--\ref{simu4result}. The results for each of the first three simulation experiments show that the means of all parameter estimates are close to the true values, with small standard deviations. The means of the last four elements of $\mbox{\boldmath$\beta$}_1$ and $\mbox{\boldmath$\beta$}_2$ are different from the true values due to the overlap between classes. \begin{table}[!ht] \caption{Key model parameters as well as means and standard deviations of the associated parameter estimates from the 100 runs for the first simulation experiment.} \label{simu1result} \centering \small{ \begin{tabular*}{1.0\textwidth}{@{\extracolsep{\fill}}lrrr} \hline &True values&Means&Standard deviations\\ \hline $\alpha_1$&$(15,8,-6)^{'}$&$(14.98,8.00,-6.00)^{'}$&$(0.10,0.09,0.15)^{'}$\\ $\alpha_2$&$(-14,-10,6)^{'}$&$(-14.06,-9.96,6.02)^{'}$&$(0.24,0.20,0.16)^{'}$\\ $\beta_1$&$(1,1,1)^{'}$&$(1.05,1.01,1)^{'}$&$(0.35,0.32,0.39)^{'}$\\ $\beta_2$&$(-1,-1,-1)^{'}$&$(-0.89,-0.95,-0.95)^{'}$&$(0.24,0.25,0.27)^{'}$\\ $\lambda_1$&-1&-0.52&0.70\\ $\lambda_2$&2&1.05&1.28\\ $\omega_1$&2&2.02&0.31\\ $\omega_2$&3&2.92&0.51\\ $\mathbf\Psi_1$&$\left[ \begin{array}{ccc}1&0&0\\0&0.7&0\\0&0&2\end{array}\right]$&$\left[\begin{array}{ccc}0.99&0.00&0.00\\0.00&0.70&0.00\\0.00&0.00&1.99\end{array}\right]$&$\left[\begin{array}{ccc}0.33&0.07&0.12\\0.07&0.21&0.11\\0.12&0.11&0.62\end{array}\right]$\\ $\mathbf\Psi_2$&$\left[ \begin{array}{ccc}1.5&0&0\\0&0.8&0\\0&0&0.9\end{array}\right]$&$\left[\begin{array}{ccc}1.38&0.00&0.01\\0.00&0.74&-0.01\\0.01&-0.01&0.84\end{array}\right]$&$\left[\begin{array}{ccc}0.39&0.08&0.08\\0.08&0.21&0.08\\0.08&0.08&0.21\end{array}\right]$\\ \hline \end{tabular*}} \end{table} \begin{table}[!ht] \caption{Key model parameters as well as means and standard deviations of the associated parameter estimates from the 100 runs for the second simulation experiment.} \label{simu2result} \centering \small{ \begin{tabular*}{1.0\textwidth}{@{\extracolsep{\fill}}lrrr} \hline &True values&Means&Standard deviations\\ \hline $\alpha_1$&$(4,5)^{'}$&$(4.00,5.00)^{'}$&$(0.11,0.08)^{'}$\\ $\alpha_2$&$(2,3)^{'}$&$(1.99,2.98)^{'}$&$(0.18,0.11)^{'}$\\ $\beta_1$&$(1,-1,1,1,1)^{'}$&$(0.94,-0.92,0.93,0.94,0.93)^{'}$&$(0.35,0.33,0.39,0.44,0.51)^{'}$\\ $\beta_2$&$(-1,1,-1,-1,-1)^{'}$&$(-0.77,0.83,-0.72,-0.68,-0.67)^{'}$&$(0.27,0.36,0.33,0.43,0.55)^{}$\\ $\lambda_1$&-1&-0.7&0.73\\ $\lambda_2$&-2&-1.05&0.85\\ $\omega_1$&2&2.02&0.32\\ $\omega_2$&3&3.11&0.58\\ $\mathbf\Psi_1$&$\left[ \begin{array}{cc}1&0\\0&0.7\end{array}\right]$&$\left[\begin{array}{cc}0.92&0.00\\0.00&0.65\end{array}\right]$&$\left[\begin{array}{cc}0.34&0.08\\0.08&0.22\end{array}\right]$\\ $\mathbf\Psi_2$&$\left[ \begin{array}{cc}1.5&0\\0&0.8\end{array}\right]$&$\left[\begin{array}{cc}1.20&-0.01\\-0.01&0.63\end{array}\right]$&$\left[\begin{array}{cc}0.36&0.08\\0.08&0.18\end{array}\right]$\\ \hline \end{tabular*}} \end{table} \begin{table}[!ht] \caption{Key model parameters as well as means and standard deviations of the associated parameter estimates from the 100 runs for the third simulation experiment.} \label{simu3result} \centering \small{ \begin{tabular*}{1.0\textwidth}{@{\extracolsep{\fill}}lrrr} \hline &True values&Means&Standard deviations\\ \hline $\alpha_1$&$(4,5)^{'}$&$(4.01,4.98)^{'}$&$(0.11,0.10)^{'}$\\ $\alpha_2$&$(0,0)^{'}$&$(-0.01,0.01)^{'}$&$(0.07,0.08)^{'}$\\ $\alpha_3$&$(-4,-5)^{'}$&$(-3.91,-4.9)^{'}$&$(0.81,1.01)^{'}$\\ $\beta_1$&$(1,1)^{'}$&$(1.00,1.01)^{'}$&$(0.10,0.09)^{'}$\\ $\beta_2$&$(0,0)^{'}$&$(-0.01,-0.02)^{'}$&$(0.17,0.19)^{'}$\\ $\beta_3$&$(-1,-1)^{'}$&$(-0.99,-0.98)^{}$&$(0.24,0.22)^{'}$\\ $\nu_1$&7&7.09&0.61\\ $\nu_2$&5&4.97&0.41\\ $\nu_3$&6&6.08&0.50\\ $\mathbf\Psi_1$&$\left[\begin{array}{cc}1&0\\0&0.7\end{array}\right]$&$\left[\begin{array}{cc}1.00&0.01\\0.01&0.68\end{array}\right]$&$\left[\begin{array}{cc}0.07&0.05\\0.05&0.07\end{array}\right]$\\ $\mathbf\Psi_2$&$\left[\begin{array}{cc}0.7&0\\0&0.6\end{array}\right]$&$\left[\begin{array}{cc}0.72&0.03\\0.03&0.64\end{array}\right]$&$\left[\begin{array}{cc}0.28&0.32\\0.32&0.40\end{array}\right]$\\ $\mathbf\Psi_3$&$\left[\begin{array}{cc}1.5&0\\0&0.8\end{array}\right]$&$\left[\begin{array}{cc}1.36&0.00\\0.00&0.76\end{array}\right]$&$\left[\begin{array}{cc}0.27&0.07\\0.07&0.08\end{array}\right]$\\ \hline \end{tabular*}} \end{table} \begin{table}[!ht] \caption{Key model parameters as well as means and standard deviations of the associated parameter estimates from the 100 runs for the fourth simulation experiment.} \label{simu4result} \centering \small{ \begin{tabular*}{1.0\textwidth}{@{\extracolsep{\fill}}lrrr} \hline &True values&Means&Standard deviations\\ \hline $\alpha_1$&$(8,7,-3)^{'}$&$(7.95, 7.01, -2.93)^{'}$&$(0.18,0.11,0.05)^{'}$\\ $\alpha_2$&$(-8,-7,3)^{'}$&$(-7.98, -6.99, 2.93)^{'}$&$(0.21,0.12,0.05)^{'}$\\ \multirow{2}{*}{$\beta_1$}&$(1,1,1,1,$&$(1.04,0.98,0.78,0.44,$&$(0.16,0.17,0.18,0.18,$\\ &$1,1,1,1)^{'}$&$-0.02,-0.62,-1.35,-2.21)^{'}$&$0.18,0.18,0.22,0.32)^{'}$\\ \multirow{2}{*}{$\beta_2$}&$(-1,-1,-1,-1,$&$(-1.02,-0.96,-0.78,-0.46,$&$(0.17,0.15,0.16,0.16,$\\ &$-1,-1,-1,-1)^{'}$&$-0.01,0.56,1.26,2.09)^{'}$&$0.18,0.22,0.29,0.40)^{'}$\\ $\nu_1$&7&7.43&0.80\\ $\nu_2$&6&6.27&0.59\\ $\mathbf\Psi_1$&$\left[\begin{array}{ccc}1&0&0\\0&0.7&0\\0&0&0.8\end{array}\right]$&$\left[\begin{array}{ccc}0.99&0.00&0.01\\0.00&0.71&0.00\\0.01&0.00&0.80\end{array}\right]$&$\left[\begin{array}{ccc}0.11&0.07&0.05\\0.07&0.06&0.04\\0.05&0.04&0.06\end{array}\right]$\\ $\mathbf\Psi_2$&$\left[\begin{array}{ccc}1.5&0&0\\0&0.8&0\\0&0&0.9\end{array}\right]$&$\left[\begin{array}{ccc}1.49&0.01&0.01\\0.01&0.79&0.01\\0.01&0.01&0.90\end{array}\right]$&$\left[\begin{array}{ccc}0.20&0.10&0.08\\0.10&0.09&0.04\\0.08&0.04&0.07\end{array}\right]$\\ \hline \end{tabular*}} \end{table} \subsubsection{Comparing Models I--IV}\label{sec:sim2} Second, we compare Models I--IV. One hundred datasets are generated for the four simulation experiments above and analyzed using the GMMs developed herein. The means of the BIC, the ARI, and the ERR are summarized in Table~\ref{simucomparef}. For Simulations~1--3, the best models obtained are those with underlying true data structures, as expected. The BIC selects Model~2 with the correct number of components for Simulation~4; however, the estimated indices, i.e., $\hat\lambda_1=-2.93$ and $\hat\lambda_2=-2.70$, are very close to the parametrization under the skew-t distribution. \begin{table}[!ht] \caption{Comparison of results --- including average BIC, ARI, and ERR values --- for Models~I--IV, where bold face font is used to highlight the model with the best BIC for each simulation.} \label{simucomparef} \begin{minipage}{\textwidth} \centering \small{ \begin{tabular*}{1.0\textwidth}{@{\extracolsep{\fill}}ccccccccc} \hline &\multicolumn{4}{c}{Model I} &\multicolumn{4}{c} {Model II} \\ \cline{2-5}\cline{6-9} &Free paras&BIC & ARI & ERR &Free paras& BIC & ARI & ERR\\ \hline \multirow{2}{*}{Simulation 1}& \multirow{2}{*}{89}& \multirow{2}{*}{\textbf{--69895}} & \multirow{2}{*}{1.00} & \multirow{2}{*}{0.00}& \multirow{2}{*}{143}& \multirow{2}{*}{--70507} & \multirow{2}{*}{1.00} & \multirow{2}{*}{0.00} \\ &&&&&&\\ \multirow{2}{*}{Simulation 2}& \multirow{2}{*}{29}& \multirow{2}{*}{--16018} & \multirow{2}{*}{0.92} & \multirow{2}{*}{0.02}& \multirow{2}{*}{35}& \multirow{2}{*}{\textbf{--15366}} & \multirow{2}{*}{0.97} & \multirow{2}{*}{0.01} \\ &&&&&&\\ \multirow{2}{*}{Simulation 3}& \multirow{2}{*}{36}& \multirow{2}{*}{--108937} & \multirow{2}{*}{0.50} & \multirow{2}{*}{0.33}& \multirow{2}{*}{71}& \multirow{2}{*}{--106890} & \multirow{2}{*}{0.53} & \multirow{2}{*}{0.33} \\ &&&&&&\\ \multirow{2}{*}{Simulation 4}& \multirow{2}{*}{69}& \multirow{2}{*}{--37133} & \multirow{2}{*}{1.00} & \multirow{2}{*}{0.00}& \multirow{2} {*}{103}& \multirow{2}{*}{\textbf{--36985}} & \multirow{2}{*}{1.00} & \multirow{2}{*}{0.00} \\ &&&&&&\\ \hline &\multicolumn{4}{c}{Model III} &\multicolumn{4}{c} {Model IV} \\ \cline{2-5}\cline{6-9} &Free paras&BIC & ARI & ERR &Free paras& BIC & ARI & ERR \\ \hline \multirow{2}{*}{Simulation 1}& \multirow{2}{*}{87}& \multirow{2}{*}{--69945} & \multirow{2}{*}{1.00} & \multirow{2}{*}{0.00}& \multirow{2}{*}{139}& \multirow{2}{*}{--69946} & \multirow{2}{*}{1.00} & \multirow{2}{*}{0.00} \\ &&&&&&\\ \multirow{2}{*}{Simulation 2}& \multirow{2}{*}{27}& \multirow{2}{*}{--15495} & \multirow{2}{*}{0.87} & \multirow{2}{*}{0.04}& \multirow{2}{*}{33}& \multirow{2}{*}{--16110} & \multirow{2}{*}{0.86} & \multirow{2}{*}{0.04} \\ &&&&&&\\ \multirow{2}{*}{Simulation 3}& \multirow{2}{*}{33} & \multirow{2}{*}{--101669} & \multirow{2}{*}{1.00} & \multirow{2}{*}{0.00} & \multirow{2}{*}{68}& \multirow{2}{*}{\textbf{--101587}} & \multirow{2}{*}{1.00} & \multirow{2}{*}{0.00} \\ &&&&&&\\ \multirow{2}{*}{Simulation 4}& \multirow{2}{*}{67} & \multirow{2}{*}{--37271} & \multirow{2}{*}{1.00} & \multirow{2}{*}{0.00} & \multirow{2}{*}{101} & \multirow{2}{*}{--37265} & \multirow{2}{*}{1.00} & \multirow{2}{*}{0.00} \\ &&&&&&\\ \hline \end{tabular*}} \end{minipage} \end{table} \subsubsection{Comparison with Gaussian GMMs}\label{sec:sim3} Finally, we compare our proposed family of models with the Gaussian GMMs (via {\tt{Mplus}}). First, 100 datasets are generated, as described before, from Simulation~1 where the distributions of random effects are not normal. Table~\ref{percentBIC} summarizes the percentage of the replications favoured by the BIC when analyzing those 100 generated datasets for 1--6 latent classes (note that 6 latent classes were never selected, see Table~\ref{percentBIC}) via Models~I and~III as well as Gaussian GMMs. We then generate 100 datasets from Simulation~2 where the distribution of measurement errors are not normal (Table~\ref{percentBIC4}). It is not surprising that the Gaussian GMMs overestimate the number of classes in both cases because the normality assumptions are violated. Moreover, when the normality assumption of the random effects is violated (Simulation 1), Gaussian GMMs tend to point to even more classes. It is noteworthy to mention that the best models, based on the BIC, are consistently Models~I and~II, respectively. \begin{table}[!ht] \caption{Percent preferred by the BIC when analyzing the Simulation 1 with Model I, Model III, and GMM along with number of classes.} \label{percentBIC} \centering \begin{tabular*}{1.0\textwidth}{@{\extracolsep{\fill}}lccccc} \hline &\multicolumn{5}{c}{Number of classes}\\ \cline{2-6} &1&2&3&4&5\\ \hline Model I&0&100&0&0&0\\ Model III&0&100&0&0&0\\ GMM&0&0&0&67&33\\ \hline \end{tabular*} \end{table} \begin{table}[!ht] \caption{Percent preferred by the BIC when analyzing the Simulation 4 with Model II, Model IV, and GMM along with number of classes.} \label{percentBIC4} \centering \begin{tabular*}{1.0\textwidth}{@{\extracolsep{\fill}}lccccc} \hline &\multicolumn{5}{c}{Number of classes}\\ \cline{2-6} &1&2&3&4&5\\ \hline Model II&0&100&0&0&0\\ Model IV&0&100&0&0&0\\ GMM&0&0&24&57&19\\ \hline \end{tabular*} \end{table} \section{Discussion}\label{sec:discussion} We have introduced novel GHD-GMM and GST-GMM models, which are extensions of the GMMs introduced by \citet{verbeke96} to the generalized hyperbolic and skew-t distributions, respectively, to facilitate heavier tails or asymmetry. Updates are derived for parameter estimation within the EM algorithm framework, which is made feasible by the fact that the generalized hyperbolic distribution can be represented as a normal mean-variance mixture, where the weight follows a GIG distribution. In our GMM extensions, four models were considered (GHD-GMM and GST-GMM under $\mbox{\boldmath$\beta$}_{yk} = \mathbf{0}$, GHD-GMM and GST-GMM under $\mbox{\boldmath$\beta$}_{\eta k} = \mathbf{0}$) and their performance was compared using simulated and real data. In terms of interpretation, GHD-GMM under $\mbox{\boldmath$\beta$}_{\eta k} = \mathbf{0}$ is preferable to GHD-GMM under $\mbox{\boldmath$\beta$}_{yk} = \mathbf{0}$ because the skewness parameters are in the data space and so the interpretation of the skewness parameters is clear. However, in terms of model complexity, GHD-GMM under $\mbox{\boldmath$\beta$}_{yk} = \mathbf{0}$ is preferable to GHD-GMM under $\mbox{\boldmath$\beta$}_{\eta k} = \mathbf{0}$ because the former model has $K(T-q)$ fewer parameters than the latter. We believe that this kind of mixture modeling approach for longitudinal data is important in many biostatistical and psychological applications, allowing accurate inference of model parameters and class membership probabilities while adjusting for heterogeneity, heavy tails, and skewness in the data. The proposed GHD-GMM and GST-GMM models have several advantages over Gaussian GMMs. The proposed GHD-GMM, which includes the multivariate skew-t, variance-gamma distribution, multivariate normal inverse-Gaussian distributions, etc., as special or limiting cases, provides flexibility to handle a broader range of multivariate longitudinal data --- the same is true, albeit to a lesser extent, for the proposed GST-GMM. In the presence of heterogeneity, heavy tails, and skewness in longitudinal data, the proposed models can fit the data considerably better than Gaussian mixtures thereby reducing the risk of extracting latent classes that are merely due to non-normality of the outcomes. When data are normal, the proposed GHD-GMM can be used to check the reproducibility of a Gaussian GMM solution due to the flexibility of the generalized hyperbolic distribution --- again, the same is true for the GST-GMM. However, when there exist outliers, while the concentration parameter mitigates the outliers, it has been shown that a contaminated approach can be more effective in handling the impact of the outliers \citep[see][]{punzo16}. Therefore, developing a contaminated version of the family of non-elliptical GMMs will be considered in future work. The models proposed herein can also be further developed in various ways. For example, for the first level of the GMM, only $q$th order polynomial equations are considered but kernel regressions or non-linear regressions could be incorporated into the model. Bayesian mixture modeling may offer researchers an alternative way to handle clustering of longitudinal data due to the popularity and advances in Markov chain Monte Carlo techniques. Finally, it is also worthwhile to other flexible parametric distributions of measurement errors and random effects, such as the coalesced generalized hyperbolic distribution and the multiple scaled generalized hyperbolic distribution \citep{tortora16} and then hidden truncation hyperbolic distribution \citep{murray17b}. {\smal
{'timestamp': '2017-11-15T02:37:35', 'yymm': '1703', 'arxiv_id': '1703.08723', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08723'}
arxiv
\section{Introduction} \label{sec:introduction} Measurements obtained through a distributed network of sensors or beacons can be an effective means of monitoring location, or the spatial distribution of other phenomena. The measurements themselves only provide indirect or noisy information towards the physical properties of interest, and so additional computational processing is required for inference. Such inference must be designed to take into account possible degradations in the measurements, and exploit prior statistical knowledge of the environment. However, the success of inference, in the end, is limited by how the beacons and sensors were physically distributed in the first place. Consider location-awareness, which is critical to human and robot navigation, resource discovery, asset tracking, logistical operations, and resource allocation~\cite{teller03}. In situations for which GPS is unavailable (indoors, underground, or underwater) or impractical, measurements of transmissions from fixed beacons~\cite{kurth03, newman03, olson04, djugash06, isler06, detweiler08, amundson09, huang11, kennedy12, derenick13} provide an attractive alternative. Designing a system for beacon-based location-awareness requires simultaneously deciding (a) how the beacons should be distributed ({e.g.,}\xspace spatially and across transmission channels); and (b) how location should be determined based on measurements of signals received from these beacons. \begin{figure}[!t] \centering \includegraphics[width=\linewidth]{Figs/fig31.pdf} \caption{Our algorithm optimizes beacon placement and channel assignments jointly with an algorithm for location inference, based on measurements of transmissions from these beacons. receiver localization. Here, we show an example beacon distribution inferred by our method (colored circles denoting beacons and channel assignments), and the corresponding error (RMSE) in locations estimated by the inference method.} \label{fig:motivation} \end{figure} Note that these decisions are inherently coupled. The placement of beacons and their channel allocation influence the nature of the ambiguity in measurements at different locations, and therefore which inference strategy is optimal. Therefore, one should ideally search over the space of both beacon allocation---which includes the number of beacons, and their placement and channel assignment---and inference strategies to find a pair that is jointly optimal. Unfortunately, due to phenomena such as noise, interference, and attenuation due to obstructions ({e.g.,}\xspace walls), this search rarely has a closed-form solution in all but the most simplistic of settings. Consequently, these decisions are decoupled in practice, and beacons are placed with some specific inference strategy in mind. This placement is most often performed manually by expert designers. In some cases, automatic placement methods are employed that apply heuristics ({e.g.,}\xspace coverage or field-of-view~\cite{gonzales-banos01}). However, such heuristics often rely on simplistic assumptions regarding the sensor and environment geometry, and do not adequately account for noise, interference, or other forms of degradation---{e.g.,}\xspace ignoring interference or attenuation due to walls to directly map signal strength to observations of range or bearing. These heuristics are thus unsuitable for use in many real-world settings. Recently, Chakrabarti~\cite{chakrabarti16} introduced a method that successfully uses stochastic gradient descent (SGD) to jointly learn sensor multiplexing patterns and reconstruction methods in the context of imaging. Motivated by this, we propose a new learning-based approach to designing the beacon distribution (across space and channels) and inference algorithm \emph{jointly} for the task of localization based on raw signal transmissions. We instantiate the inference method as a neural network, and encode beacon allocation as a differentiable neural layer. We then describe an approach to jointly training the beacon layer and inference network, with respect to a given signal propagation model and environment, to enable accurate location-awareness in that environment. We carry out evaluations under a variety of conditions---with different environment layouts, different signal propagation parameters, different numbers of transmission channels, and different desired trade-offs against the number of beacons. In all cases, we find that our approach automatically discovers designs--each different and adapted to its environment and settings---that enable high localization accuracy. Therefore, our method provides a way to consistently create optimized location-awareness systems for arbitrary environments and signal types, without expert supervision. \section{Related Work} \label{sec:related} Networks of sensors and beacons have been widely used for localization, tracking, and measuring other spatial phenomena. Many of the design challenges in sensor and beacon are related, since they involve problems that are duals of one another---based on whether the localization target is transmitting or receiving. In our work, we focus on localization with beacons, {i.e.,}\xspace where an agent estimates its location based on transmissions received from fixed, known landmarks. Most of the effort in localization is typically devoted to finding accurate inference methods, assuming the distribution and location of beacons in the environment are given. One setting for these methods is where sensor measurements can be assumed to provide direct, albeit possibly noisy, measurements of relative range or bearing from beacons---an assumption that is typically based on a simple model for signal propagation. Location estimation then proceeds by using these relative range and/or bearing estimates and knowledge of beacon locations. For example, acoustic long baseline (LBL) networks are frequently used to localize underwater vehicles~\cite{newman03,olson04}, while a number of low-cost systems exist that use RF and ultrasound to measure range~\cite{priyantha05, gu09}. \citet{moore04} propose an algorithm for estimating location based upon noise-corrupted range measurements, formulating the problem as one of realizing a two-dimensional graph whose structure is consistent with the observed ranges. \citet{detweiler08} describe a geometric technique that estimates a robot's location as it navigates a network of fixed beacons using either range or bearing observations. \citet{kennedy12} employ spectral methods to localize camera networks using relative angular measurements, and \citet{shareef08} use feed-forward and recurrent neural networks for localization based on noisy range measurements. Another approach, common for radio frequency (RF) beacon and WiFi-based networks, is to infer location directly from received signal strength (RSS) signatures. One way to do this is by matching against a database of RSS-location pairs~\cite{prasithsangaree02}. This database is typically generated manually via a site-survey, or ``organically'' during operation~\cite{haeberlen04, park10}. \citet{sala10} and \cite{altini10} adopt a different approach, training neural networks to predict a receiver's location within an existing beacon network based upon received signal strength. The above methods deal with optimal ways of inferring location given an existing network of beacons. The decision of how to distribute these beacons, however, is often made manually based on expert intuition. Automated placement methods are used rarely, and for very specific settings, such as RSS fingerprint-based localization~\cite{fang10}. The most common of these is to ensure full coverage---{i.e.,}\xspace to ensure that all locations are within an ``acceptable range'' of at least one beacon, assuming this condition is sufficient to guarantee accurate localization. One common instance of optimizing placement for coverage is the standard art-gallery visibility problem~\cite{gonzales-banos01} that seeks placements that ensure that all locations have line-of-sight to at least one beacon. This problem assumes a polygonal environment and that the beacons have an unlimited field-of-view, subject to occlusions by walls ({e.g.,}\xspace cameras). Related, \citet{agarwal09} propose a greedy landmark-based method that solves for the placement of the minimum number of beacons (within a $\log$ factor) necessary to cover all but a fraction of a given polygonal environment. Note that these methods treat occlusions as absolute, while in practice, obstructions often only cause partial attenuation---with points that are close but obstructed observing similar signal strengths as those that are farther away. \citet{kang13} provide an interesting alternative, and like us, use backpropagation to place WiFi access points---but again, only for the objective of maximizing coverage. \citet{fang10} consider localization accuracy for placing wireless access points to maximize receiver signal-to-noise ratios. The above methods address spatial placement but not transmission channel assignments, and associated issues with interference. Automatic channel assignment methods have been considered previously, but only for optimizing communication throughput~\cite{hills02,ling06}---{i.e.,}\xspace to minimize interference from two beacons in the same channel at any location. Note that this is a very different and simpler objective than one of enabling accurate localization, where the goal is to ensure that there is a unique mapping from every RSS signature (with or without interference) to location. Our approach provides a way to trade-off localization accuracy with the number of beacons, similar to the performance-cost trade-offs considered by the more general problem of sensor selection~\cite{cameron90,isler05,joshi09}. Some selection strategies are designed with specific inference strategies in mind. \citet{shewry87} and \citet{cressie93} use a greedy entropy-based approach to place sensors, tied to a Gaussian process (GP) model that is used for inference. However, this approach does not model the accuracy of the predictions at the selected locations. \citet{krause08} choose locations for a fixed sensor network that maximize mutual information using a GP model for phenomena over which inference is performed ({e.g.,}\xspace temperature). However, these formulations require that the phenomena be modeled as a GP, and are thus not suitable for the task of beacon-based localization. \if0 A great deal of attention has been paid within the robotics community and beyond to estimating location and other spatial phenomena using sensor networks. Existing work typically focuses either on inference for a given network or on choosing an optimal network allocation for a given inference strategy. While the following discussion focuses on localization within a network of beacons, many of the concepts apply to the more general problem of estimating spatial phenomena using sensor networks. A common approach to localization within existing radio frequency (RF)-based beacon networks is to use the received signal strength (RSS) as a fingerprint that is matched against a database of RSS-location pairs to determine the receiver's location~\cite{prasithsangaree02}. This database is typically generated manually via a site-survey, or ``organically'' during operation~\cite{haeberlen04, park10}. Similar to our inference model, \citet{sala10} use a neural network (a multilayer perceptron) to predict a receiver's location within an existing beacon network based upon received signal strength. \citet{altini10} take a similar approach for networks that employ Bluetooth for communication. Many beacon networks provide direct, albeit noisy, measurements of relative range or bearing. For example, acoustic long baseline (LBL) networks are frequently used to localize underwater vehicles~\cite{newman03,olson04}, while a number of low-cost systems exist that use RF and ultrasound to measure range~\cite{priyantha05, gu09}. \citet{moore04} propose an algorithm for estimating location based upon noise-corrupted range measurements, formulating the problem as one of realizing a two-dimensional graph whose structure is consistent with the observed ranges. \citet{detweiler08} describe a geometric technique that estimates a robot's location as it navigates a network of fixed beacons using either range or bearing observations. \citet{kennedy12} employ spectral methods to localize camera networks using angular measurements, without the need for a global coordinate frame. Alternatively, \citet{shareef08} evaluate the use of feedforward and recurrent neural network architectures to localize a receiver based upon noisy range measurements. Meanwhile, beacon allocation traditionally relies on coverage as a heuristic to guide placement in a specific environment. When the environment is polygonal and beacons have an unlimited field-of-view subject to occlusions by walls (e.g., cameras), coverage corresponds to the standard art-gallery visibility problem~\cite{gonzales-banos01}. Related, \citet{agarwal09} propose a greedy landmark-based method that solves for the placement of the minimum number of beacons (within a $\log$ factor) necessary to cover all but a fraction of a given polygonal environment. However, a beacon's sensing geometry is often complex as a result of partial attenuation due to the environment, beacon noise, and signal interference. Interference varies according to the placement of other beacons and channel allocation, which most coverage algorithms do not reason over. These factors are particularly important for RF-based localization, which is sensitive to the effects of aliasing, further complicating the relationship between allocation and inference. When the inferred phenomena is modeled using a Gaussian process (GP), a common technique is to greedily introduce sensors at the location with the highest entropy under the GP~\cite{shewry87, cressie93}. However, this approach does not model the accuracy of the predictions at the selected locations. Alternatively, \citet{krause08} choose locations for a fixed sensor network that maximize mutual information using a Gaussian process model for phenomena over which inference is performed (e.g., temperature). They show that this problem is NP-complete and propose a polynomial-time approximation algorithm that exploits the submodularity of mutual information to provide placements that are within a constant-factor of the optimal locations. Meanwhile, \citet{cameron90} take a Bayesian decision-theoretic approach to determine sensor placement for localization and recognition tasks. Alternatively, \citet{fang10} consider localization accuracy when placing wireless access points and choose locations that maximize signal-to-noise ratio. In similar fashion to our proposal to learn sensor placement via backpropagation, \citet{kang13} use a neural network to determine the placement of WiFi access points, however their objective is to maximize coverage, which is not appropriate for localization, as discussed above. In many scenarios, beacon allocation includes choosing both the location and channel for each beacon. These problems are typically assumed to be decoupled---the location of each beacon is first determined and then their channels are chosen to minimize interference~\cite{hills02} This can result in a sub-optimal allocation. An exception is \citet{ling06}, who jointly solve access point placement and channel selection using a local search approximation, however they seek to maximize communication throughput, which is a more straightforward objective than localization and does not require reasoning over inference. The sensor selection problem~\cite{isler05,joshi09} considers related scenarios in which there is a cost associated to querying sensors. The problem is to choose the subset of sensors to utilize at each point in time so as to balance inference accuracy with the corresponding query cost. \fi \newcommand{\tilde{I}}{\tilde{I}} \newcommand{\mathcal{D}}{\mathcal{D}} \newcommand{\tilde{\mathcal{E}}}{\tilde{\mathcal{E}}} \newcommand{\mathcal{E}}{\mathcal{E}} \newcommand{\mathbb{R}}{\mathbb{R}} \section{Approach} \label{sec:approach} \begin{figure}[!t] \centering \includegraphics[width=\columnwidth]{Figs/fig45.pdf} \caption{A schematic of our proposed approach. We seek to find the distribution of beacons $\{I_l\}$ and inference function $f(\cdot)$ that together yield reliable location estimates for a specific environment $\mathcal{E}$. For a candidate set of locations $l$, the assignment vectors $I_l$ determine whether a beacon is to be placed at that location, and if so, in what configuration. The environment mapping $\mathcal{E}$ then determines what the measured signal will be at any given location, taking into account noise, interference, obstructions, etc. We optimize these assignment vectors jointly with parameters of the inference function $f(\cdot)$, to minimize error in the estimated locations $\hat{v}$.} \label{fig:schema} \end{figure} We formalize the problem of designing a location-awareness system as that of determining an optimal distribution of beacons $\mathcal{D}$ and an inference function $f(\cdot)$, given an environment $\mathcal{E}$. For a given set of $L$ possible locations for beacons, we parameterize the distribution $\mathcal{D} = \{I_l\}$ as an assignment $I_l$ to each location $l \in \{1,\ldots L\}$, where $I_l\in\{0,1\}^{C+1}, |I_l|=1$ is a $(C+1)$-dimension $0$-$1$ vector with all but one entry equal to $0$. This vector denotes whether to place a beacon at location $l$ (otherwise, $I_l^1 = 1$) and in which one of $C$ possible configurations (i.e., $I_l^{c+1}=1$). In our experiments, a beacon's configuration corresponds to the channel on which it broadcasts. We parameterize the environment in terms of a function $s=\mathcal{E}(v,\{I_l\})$ that takes as input a location $v\in\mathbb{R}^2$ and a distribution of beacons $\mathcal{D} = \{I_l\}$, and produces a vector $s\in\mathbb{R}^m$ of measurements that an agent is likely to make at that location (Fig.~\ref{fig:schema}). Note that the environment $\mathcal{E}$ need not be a deterministic function. In the case of probabilistic phenomena such as noise and interference, $\mathcal{E}$ will produce a sample from the distribution of possible measurements. The inference function $f(\cdot)$ is then tasked with computing a reliable estimate of the location given these measurements. Our goal is to jointly optimize $\mathcal{D}=\{I_l\}$ and $f(\cdot)$ such that $f(\mathcal{E}(v,\{I_l\})) \approx v$ for a distribution of possible locations where the agent may visit. Additionally, we add a regularizer to our objective, e.g., to minimize the total number of individual beacons. \subsection{Optimization with Gradient Descent} Unfortunately, the problem as stated above involves a combinatorial search, since the space of possible beacon distributions is discrete with $(C+1)^{L}$ elements. We make the optimization tractable by adopting an approach similar to that of Chakrabarti~\cite{chakrabarti16}. We relax the assignment vectors $I_l$ to be real-valued and positive as $\tilde{I}_l \in \mathbb{R}_+^{C+1}, |\tilde{I}_l|=1$. The vector $\tilde{I}_l$ can be interpreted as expressing a probability distribution over the possible assignments at location $l$. Instead of optimizing over distribution vectors $\tilde{I}_l$ directly, we learn a weight vector $w_l\in\mathbb{R}^{C+1}$ with \begin{equation} \label{eq:wtoi} \tilde{I}_l = \mbox{SoftMax}(\alpha w_l)\qquad\tilde{I}_l^c = \frac{\exp(\alpha w_l^c)}{\sum_{c'}\exp(\alpha w_l^{c'})}, \end{equation} where $\alpha$ is a positive scalar parameter. Since our goal is to arrive at values of $\tilde{I}_l$ that correspond to hard assignments, we begin with a small value of $\alpha$ and increase it during the course of optimization according to an annealing schedule. Small values of $\alpha$ in initial iterations allow gradients to be backpropagated across Eqn.~\ref{eq:wtoi} to update $\{w_l\}$. As optimization progresses, increasing $\alpha$ causes the distributions $\{I_l\}$ to get ``peakier'', until they converge to hard assignments. We also define a distributional version of the environment mapping $\tilde{\mathcal{E}}(v,\{\tilde{I}_l\})$ that operates on these distributions instead of hard assignments. This mapping can be interpreted as producing the \emph{expectation} of the signal vector $s$ at location $v$, where the expectation is taken over the distributions $\{\tilde{I}_l\}$. We require that this mapping be differentiable with respect to the distribution vectors $\{\tilde{I}_l\}$. In the next sub-section, we describe an example of an environment mapping and its distributional version that satisfies this requirement. Next, we simply choose the inference function $f(\cdot)$ to be differentiable and have some parametric form (e.g., a neural network), and learn its parameters jointly with the weights $\{w_l\}$ of the beacon distribution as the minimizers of the loss: \begin{multline} \label{eq:lossdef} L(\{w_l\},\Theta) = R(\{\tilde{I}_l\}) + \\\frac{1}{\|\mathcal{V}\|}\sum_{v\in\mathcal{V}} \mathbb{E}_s \left\|v-f\left(\tilde{\mathcal{E}}\left(v,\{\tilde{I}_l\}\right); \Theta \right)\right\|^2, \end{multline} where $\mathcal{V}$ is the set of possible agent locations, $\Theta$ are the parameters of the inference function $f$, $\tilde{I}_l=$SoftMax$(\alpha w_l)$, as $\alpha\rightarrow\infty$, and $R$ is a regularizer. Note that the inner expectation in the second term of Eqn.~\ref{eq:lossdef} is with respect to the distribution of possible signal vectors for a fixed location and beacon distribution, and captures the variance in measurements due to noise, interference, etc. Since we require $f$ and $\tilde{\mathcal{E}}$ to be differentiable, we can optimize both $\Theta$ and $\{w_l\}$ by minimizing Eqn.~\ref{eq:lossdef} with stochastic gradient descent (SGD), computing gradients over a small batch of locations $v \in \mathcal{V}$, with a single sample of $s$ per location. We find that the quadratic schedule for $\alpha$ used by \citet{chakrabarti16} works well, i.e., we set $\alpha=\alpha_0(1+\gamma t^2)$ at iteration $t$. \subsection{Application to RF-based Localization} To give a concrete example of an application of this framework, we consider the following candidate setting of localization using RF beacons. We assume that each beacon transmits a sinusoidal signal at one of $C$ frequencies (channels). The amplitude of this signal is assumed to be fixed for every beacon, but we allow different beacons to have arbitrary phase variations amongst them. We assume an agent at a location has a receiver with multiple band-pass filters and is able to measure the power in each channel separately (i.e., the signal vector $s$ is $C$-dimensional). We assume that the power of each beacon's signal drops as a function of distance and the number of obstructions (e.g., walls) in the line-of-sight between the agent and the beacon. The measured power in each channel at the receiver is then based on the amplitude of the super-position of signals from all beacons transmitting on that channel. This super-position is a source of interference, since individual beacons have arbitrary phase. We also assume that there is some measurement noise at the receiver. We assume all beacons transmit at power $P_0$, and model the power of the attenuated signal received from beacon $l$ at location $v$ as \begin{equation} \label{eq:plv} P_l(v) = P_0~r_{l:v}^{-\zeta}~\beta^{o_{l:v}}, \end{equation} where $\zeta$ and $\beta$ are scalar parameters, $r_{l:v}$ is the distance between $v$ and the beacon location $l$, and $o_{l:v}$ is the number of obstructions intersecting the line between them. The measured power $s=\mathcal{E}(v,\{I_l\})$ in each channel at the receiver is then modeled as \begin{multline} \label{eq:meas} s^c = \left[\epsilon_1 + \sum_l I_l^{c+1}\sqrt{P_l(v)}\cos \phi_l\right]^2 +\\ \left[\epsilon_2 + \sum_l I_l^{c+1}\sqrt{P_l(v)}\sin \phi_l\right]^2, \end{multline} where $\phi_l$ is the phase of beacon $l$, and $\epsilon_1$ and $\epsilon_2$ correspond to sensor noise. We also model sensor saturation by clipping $s^c$ at some threshold $\tau$. At each invocation of the environment function, we randomly sample the phases $\{\phi_l\}$ from a uniform distribution between $[0,2\pi)$, and noise terms $\epsilon_1$ and $\epsilon_2$ from a zero-mean Gaussian distribution with variance $\sigma_z^2$. During training, the distributional version of the environment function $\tilde{\mathcal{E}}$ is constructed simply by replacing $I_l$ with $\tilde{I}_l$ in Eqn.~\ref{eq:meas}. For regularization, we use a term that penalizes the total number of beacons with a weight $\lambda$ \begin{equation} \label{eq:regdef} R(\{\tilde{I}_l\}) = \lambda \sum_l \tilde{I}_l^1. \end{equation} This setting simulates an environment that is complex enough to not admit closed-form solutions for the inference function or the beacon distribution. Of course, there may be other phenomena in certain applications, such as leakage across channels, multi-path interference, etc., that are not modeled here. However, these too can be incorporated in our framework as long as they can be modeled with an appropriate environment function $\mathcal{E}$. \begin{figure*}[!t] \centering \subfigure[\scriptsize Learned: Annealed Reg. ($0.0497$)]{\rotatebox{90}{\scriptsize \bf ~~~~~~~~~~~~~Map 1}\includegraphics[width=0.245\textwidth]{Figs/fig32.pdf}}\hfil \subfigure[\scriptsize Learned: High Fixed Reg. ($0.0633$)]{\includegraphics[width=0.245\textwidth]{Figs/fig37.pdf}}\hfil \subfigure[\scriptsize Learned: Low Fixed Reg. ($0.0567$)]{\includegraphics[width=0.245\textwidth]{Figs/fig38.pdf}}\hfil \subfigure[\scriptsize Handcrafted A ($0.0716$)]{\includegraphics[width=0.245\textwidth]{Figs/fig41.pdf}}\vspace{-0.75em}\\ \subfigure[\scriptsize Learned: Annealed Reg. ($0.0473$)]{\rotatebox{90}{\scriptsize \bf ~~~~~~~~~~~~~Map 2}\includegraphics[width=0.245\textwidth]{Figs/fig33.pdf}}\hfil \subfigure[\scriptsize Learned: High Fixed Reg. ($0.0688$)]{\includegraphics[width=0.245\textwidth]{Figs/fig35.pdf}}\hfil \subfigure[\scriptsize Learned: Low Fixed Reg. ($0.04907$)]{\includegraphics[width=0.245\textwidth]{Figs/fig36.pdf}}\hfil \subfigure[\scriptsize Handcrafted B ($0.06242$)]{\includegraphics[width=0.245\textwidth]{Figs/fig39.pdf}}\vspace{-0.75em}\\ \subfigure[\scriptsize Learned: Annealed Reg. ($0.0493$)]{\rotatebox{90}{\scriptsize \bf ~~~~~~~~~~~~~Map 3}\includegraphics[width=0.245\textwidth]{Figs/fig34.pdf}}\hfil \subfigure[\scriptsize Learned: High Fixed Reg. ($0.0680$)]{\includegraphics[width=0.245\textwidth]{Figs/fig43.pdf}}\hfil \subfigure[\scriptsize Learned: Low Fixed Reg. ($0.0506$)]{\includegraphics[width=0.245\textwidth]{Figs/fig42.pdf}}\hfil \subfigure[\scriptsize Handcrafted B ($0.0649$)]{\includegraphics[width=0.245\textwidth]{Figs/fig40.pdf}} \caption{Localization error maps for learned and handcrafted beacon distributions (with $8$ channels) for three environments. We show three learned distributions for each map---learned with annealed regularization, and two settings (high, low) of fixed regularization---as well as the best performing handcrafted placement. The overall RMSE is indicated below each error map (see Fig.~\ref{fig:motivation} for color mapping for errors).} \label{fig:map1-error} \end{figure*} \section{Results} \label{sec:results} In this section, we evaluate our method through a series of simulation-based experiments on three different environment maps. As discussed in Section~\ref{sec:related}, existing methods are not well-suited to beacon placement for localization. Consequently, we compare our method to to several hand-designed beacon allocation strategies. We first show that our inference network is effective at localization given the baseline placements by comparing to a standard nearest-neighbors method. We then analyze the performance when learning the beacon allocation and inference network jointly, demonstrating that our method learns a distribution and inference strategy that enable high localization accuracy for all three environments. We end by analyzing the effects of different degrees of regularization and different numbers of available channels, as well as the variation in the learned beacon distributions based on parameters of the environment function $\mathcal{E}$. \subsection{Setup} We conduct our experiments on three manually drawn environment maps, which correspond to floor plans (of size $1\times 0.7$ map units) with walls that serve as obstructions. For each map, we arrange $L=625$ possible beacon locations in a $25 \times 25$ evenly spaced grid. We consider configurations with values of $C=4,8,$ and $16$ RF-channels. Our experiments use the environment model defined in Eqn.~\ref{eq:plv} with $P_0 = 6.25\times 10^{-4}$, $\zeta=2.0$ (where locations are in map units), and $\beta = e^{-1.0}$, with sensor noise variance $\sigma_z^2=10^{-4}$. The sensor measurements are saturated at a threshold $\tau=1.0$. While training the beacons, we use parameters $\alpha_0 = 1$ and $\gamma = 1.25\times10^{-9}$ for the quadratic temperature scheme. These values were chosen empirically so that the beacon selection vectors $\tilde{I}_l$ converge at the same pace as it takes the inference network to learn (as observed while training on a fixed beacon distribution). After $900$k iterations, we switch the softmax to an ``arg-max'', effectively setting $\alpha$ to infinity and fixing the beacon placement, and then continue training the inference network. The inference function $f(\cdot)$ is parameterized as a $13$-layer feed-forward neural network. Our architecture consists of $6$ blocks of $2$ fully-connected layers. All hidden layers contain $1024$ units and are followed by ReLU activation. Each block is followed by a max pooling operation applied on disjoint sets of $4$ units. After the last block, there is a final output layer with $2$ units that predicts the $(x,y)$ location coordinates. During training, locations are randomly sampled and fed through our environment model to the inference network in batches of $1000$. All networks are trained by minimizing the loss defined in Eqn.~\ref{eq:lossdef} for $1000$k iterations using SGD with a learning rate of $0.01$ and momentum $0.9$, followed by an additional $100$k iterations with a learning rate $0.001$. We also use batch-normalization in all hidden layers. \subsection{Experiments} We evaluate the effectiveness of our approach for joint optimization of beacon placement and localization through a series of experiments. Localization performance can vary significantly within an environment. Consequently, for each beacon allocation and inference strategy, we report both average as well as worst-case performance over a dense set of locations, with multiple samples (corresponding to different random noise and interference phases) per location. We measure performance in terms of the root mean squared error (RMSE)---between estimated and true coordinates---over all samples at all locations, as well as over the worst sample at each location, which we refer to as \textit{worst-case RMSE}. We also measure the frequency with which large errors occur---defined with respect to different thresholds ($0.1, 0.2, 0.5$)---and report these as \textit{failure rates}. \begin{table*}[!t] \centering \setlength{\tabcolsep}{4pt} \caption{Performance Comparison for Different Inference and Placement Strategies}\label{tab:overall} \begin{tabularx}{1.0\linewidth}{c l l c c c c c c} \toprule Map & Allocation & Inference & Beacons & RMSE & RMSE (Worst-case) & Failure Rate ($0.10$) & Failure Rate ($0.20$) & Failure Rate ($0.50$)\\ \toprule \multirow{7}{*}{1} & Handcrafted A & kNN & $544$ & $0.0817$ & $0.1793$ & $19.1946~\%$ & $1.4662~\%$ & $0.0096~\%$\\ % & Handcrafted B & kNN & $180$ & $0.0998$ & $0.2384$ & $26.1523~\%$ & $4.7400~\%$ & $0.0600~\%$\\\cline{2-9} % & Handcrafted A & Network & $544$ & $0.0716$ & $0.1537$ & $13.5691~\%$ & $0.6706~\%$ & $\mathbf{0.0045~\%}$\\ % % & Handcrafted B & Network & $180$ & $0.0811$ & $0.1940$ & $17.1529~\%$ & $2.4632~\%$ & $0.0192~\%$\\\cline{2-9} % & Learned (low fixed reg.) & Network & $183$ & $0.0567$ & $0.1336$ & $\hphantom{1}6.4917~\%$ & $0.4866~\%$ & $0.0053~\%$\\ % & Learned (high fixed reg.) & Network & $\hphantom{1}12$ & $0.0633$ & $0.1511$ & $\hphantom{1}8.0217~\%$ & $1.3686~\%$ & $0.0827~\%$\\ % & Learned (annealed reg.) & Network & $\hphantom{1}25$ & $\mathbf{0.0497}$ & $\mathbf{0.1169}$ & $\hphantom{1}\mathbf{4.7705}~\%$ & $\mathbf{0.3706}~\%$ & $0.0125~\%$\\ % \toprule % \multirow{7}{*}{2} & Handcrafted A & kNN & $544$ & $0.0806$ & $0.1708$ & $18.7127~\%$ & $1.3098~\%$ & $0.0023~\%$\\ % & Handcrafted B & kNN & $180$ & $0.0839$ & $0.2040$ & $18.3838~\%$ & $2.4336~\%$ & $0.0306~\%$\\\cline{2-9} % & Handcrafted A & Network & $544$ & $0.0653$ & $0.1331$ & $10.4884~\%$ & $\mathbf{0.2718~\%}$ & $\mathbf{0.0001~\%}$\\ % & Handcrafted B & Network & $180$ & $0.0624$ & $0.1479$ & $\hphantom{1}9.1473~\%$ & $0.6843~\%$ & $0.0013~\%$\\\cline{2-9} % & Learned (low fixed reg.) & Network & $371$ & $0.0491$ & $0.1154$ & $\hphantom{1}\mathbf{4.3015~\%}$ & $0.2931~\%$ & $0.0016~\%$\\ % & Learned (high fixed reg.)& Network & $\hphantom{1}13$ & $0.0688$ & $0.1450$ & $11.9567~\%$ & $1.4807~\%$ & $0.0040~\%$\\ % & Learned (annealed reg.)& Network & $\hphantom{1}35$ & $\mathbf{0.0473}$ & $\mathbf{0.1142}$ & $\hphantom{1}4.6226~\%$ & $0.4182~\%$ & $0.0091~\%$\\ % \toprule % \multirow{7}{*}{3} & Handcrafted A & kNN & $544$ & $0.0814$ & $0.1717$ & $18.7939~\%$ & $1.6503~\%$ & $0.0027~\%$\\ % & Handcrafted B & kNN & $180$ & $0.0840$ & $0.2127$ & $16.6865~\%$ & $2.6309~\%$ & $0.0978~\%$\\\cline{2-9} % & Handcrafted A & Network & $544$ & $0.0670$ & $0.1432$ & $11.1586~\%$ & $0.6904~\%$ & $\mathbf{0.0009~\%}$\\ % & Handcrafted B & Network & $180$ & $0.0649$ & $0.1581$ & $\hphantom{1}9.7563~\%$ & $1.0512~\%$ & $0.0079~\%$\\\cline{2-9} % & Learned (low fixed reg.) & Network & $325$ & $0.0506$ & $0.1200$ & $\hphantom{1}\mathbf{4.2496~\%}$ & $\mathbf{0.3482~\%}$ & $0.0056~\%$\\ % & Learned (high fixed reg.)& Network & $\hphantom{1}14$ & $0.0680$ & $0.1495$ & $11.6651~\%$ & $1.2166~\%$ & $0.0454~\%$\\ % & Learned (annealed reg.)& Network & $\hphantom{1}43$ & $\mathbf{0.0493}$ & $\mathbf{0.1158}$ & $\hphantom{1}4.7211~\%$ & $0.6529~\%$ & $0.0045~\%$\\ \bottomrule \end{tabularx} \end{table*} Table~\ref{tab:overall} reports these metrics on the three environment maps for different versions our approach that vary the regularization settings. We have also experimented with a number of manually handcrafted distribution strategies for these maps and report the performance of the two strategies that worked best in Table~\ref{tab:overall}. For the handcrafted settings, we report the result of training a neural network for inference, as well as of $k$-nearest neighbors (kNN)-based inference (we try $k\in \{1,5,10,20\}$ and pick the best). These latter experiments show that the network-based inference performs well (better than the kNN baseline) and, therefore, that our architecture is reasonable for the task. Moreover, the results reveal that jointly optimizing beacon allocation and inference provides accuracies that exceed the handcrafted baselines, yielding different distribution strategies with different numbers of beacons. Figure~\ref{fig:map1-error} visualizes the beacon placement and channel allocation along with the RMSE for both learned and handcrafted beacon allocations. Next, we report a more detailed evaluation of the regularization scheme defined in Eqn.~\ref{eq:regdef}, and therefore the ability of our method to allow for a trade-off between the number of beacons placed and accuracy. First, we use a constant value of $\lambda$, trying various values between $0.0$ and $0.2$. As Figure~\ref{fig:reg} shows, increased regularization leads to solutions with fewer beacons. On Map 2, we find that decreased regularization always leads to solutions with lower error. On Maps 1 and 3, however, unregularized beacon placement results in increased localization error. This suggests that regularization may also allow our model to escape bad local minima during training. Then, we experiment with an annealing scheme for $\lambda$ and find that it leads to a better performance-cost trade-off. We use a simple annealing schedule that decays $\lambda = 0.2$ by a constant factor $\eta = 0.25$ every $100$k iterations. Figure~\ref{fig:map1-evolution} shows the evolution of beacon distributions throughout training (when using an annealed regularizer). Note that the images depict a hard assignment, however the network reasons over high entropy placements early in training, which explains the initial sparsity. With each map, the network quickly clusters a large number of beacons by channel, and gradually learns to reduce the number of beacons while increasing channel diversity. \begin{figure}[!t] \centering \includegraphics[width=\linewidth]{Figs/fig44.pdf} \caption{A plot showing the effects of regularization on mean error and the number of beacons placed. The dashed lines represent the mean error and beacons placed with annealed regularization on each map.} \label{fig:reg} \end{figure} Next, we evaluate the ability of our method to automatically discover successful placement and inference strategies for different environmental conditions and constraints in Table~\ref{tab:env-channels}. All results are on Map 1, with high fixed regularization ($0.2$). We report results for a propagation model with decreased attenuation at walls ($\beta = e^{-0.2}$), and one with increased noise ($\sigma_z^2 = 2.5\times 10^{-4}$). We find that our method adapts to these changes intuitively. Our method places fewer beacons when the signal passes largely unattenuated through walls and places more beacons when combating increased noise. We also experiment with fewer ($4$) and more ($16$) available RF channels. As expected, the availability of more channels allows our method to learn a more accurate localization system. More broadly, these experiments show that our approach can enable the automated design of location awareness systems in diverse settings. Finally, we evaluate the robustness of the joint placement and inference optimization with different random initializations. We repeat training on Map 1 (with fixed regularization of $0.04$) ten times, and report the deviations in the error metrics and numbers of beacons placed in Table~\ref{tab:restart}. \begin{figure*}[!t] \centering {\scriptsize \bf Map 1}\\ \subfigure[\scriptsize Iter \# $10$k]{\includegraphics[width=0.192\textwidth]{Figs/fig2.pdf}}\hfil \subfigure[\scriptsize Iter \# $20$k]{\includegraphics[width=0.192\textwidth]{Figs/fig5.pdf}}\hfil \subfigure[\scriptsize Iter \# $40$k]{\includegraphics[width=0.192\textwidth]{Figs/fig8.pdf}}\hfil \subfigure[\scriptsize Iter \# $70$k]{\includegraphics[width=0.192\textwidth]{Figs/fig10.pdf}}\hfil \subfigure[\scriptsize Iter \# $110$k]{\includegraphics[width=0.192\textwidth]{Figs/fig3.pdf}}\vspace{-0.65em}\\ \subfigure[\scriptsize Iter \# $180$k]{\includegraphics[width=0.192\textwidth]{Figs/fig4.pdf}}\hfil \subfigure[\scriptsize Iter \# $250$k]{\includegraphics[width=0.192\textwidth]{Figs/fig6.pdf}}\hfil \subfigure[\scriptsize Iter \# $320$k]{\includegraphics[width=0.192\textwidth]{Figs/fig7.pdf}}\hfil \subfigure[\scriptsize Iter \# $500$k]{\includegraphics[width=0.192\textwidth]{Figs/fig9.pdf}}\hfil \subfigure[\scriptsize Final]{\includegraphics[width=0.192\textwidth]{Figs/fig1.pdf}}\vspace{0.9em}\\ {\scriptsize\bf Map 2}\\ \subfigure[\scriptsize Iter \# $10$k]{\includegraphics[width=0.192\textwidth]{Figs/fig12.pdf}}\hfil \subfigure[\scriptsize Iter \# $20$k]{\includegraphics[width=0.192\textwidth]{Figs/fig15.pdf}}\hfil \subfigure[\scriptsize Iter \# $30$k]{\includegraphics[width=0.192\textwidth]{Figs/fig18.pdf}}\hfil \subfigure[\scriptsize Iter \# $70$k]{\includegraphics[width=0.192\textwidth]{Figs/fig20.pdf}}\hfil \subfigure[\scriptsize Iter \# $140$k]{\includegraphics[width=0.192\textwidth]{Figs/fig13.pdf}}\vspace{-0.65em}\\ \subfigure[\scriptsize Iter \# $180$k]{\includegraphics[width=0.192\textwidth]{Figs/fig14.pdf}}\hfil \subfigure[\scriptsize Iter \# $250$k]{\includegraphics[width=0.192\textwidth]{Figs/fig16.pdf}}\hfil \subfigure[\scriptsize Iter \# $300$k]{\includegraphics[width=0.192\textwidth]{Figs/fig17.pdf}}\hfil \subfigure[\scriptsize Iter \# $500$k]{\includegraphics[width=0.192\textwidth]{Figs/fig19.pdf}}\hfil \subfigure[\scriptsize Final]{\includegraphics[width=0.192\textwidth]{Figs/fig11.pdf}}\vspace{0.9em}\\ {\scriptsize\bf Map 3}\\ \subfigure[\scriptsize Iter \# $10$k]{\includegraphics[width=0.192\textwidth]{Figs/fig22.pdf}}\hfil \subfigure[\scriptsize Iter \# $20$k]{\includegraphics[width=0.192\textwidth]{Figs/fig25.pdf}}\hfil \subfigure[\scriptsize Iter \# $30$k]{\includegraphics[width=0.192\textwidth]{Figs/fig28.pdf}}\hfil \subfigure[\scriptsize Iter \# $70$k]{\includegraphics[width=0.192\textwidth]{Figs/fig30.pdf}}\hfil \subfigure[\scriptsize Iter \# $140$k]{\includegraphics[width=0.192\textwidth]{Figs/fig23.pdf}}\vspace{-0.65em}\\ \subfigure[\scriptsize Iter \# $180$k]{\includegraphics[width=0.192\textwidth]{Figs/fig24.pdf}}\hfil \subfigure[\scriptsize Iter \# $250$k]{\includegraphics[width=0.192\textwidth]{Figs/fig26.pdf}}\hfil \subfigure[\scriptsize Iter \# $300$k]{\includegraphics[width=0.192\textwidth]{Figs/fig27.pdf}}\hfil \subfigure[\scriptsize Iter \# $500$k]{\includegraphics[width=0.192\textwidth]{Figs/fig29.pdf}}\hfil \subfigure[\scriptsize Final]{\includegraphics[width=0.192\textwidth]{Figs/fig21.pdf}} \caption{The evolution of beacon distribution throughout training (with annealed regularization). The images depict a hard assignment, but the network is uncertain early in training, which explains the scarcity of beacons early on. The network quickly groups a large number of beacons and channel assignments along the edge of the map, but then gradually learns a sparse, diverse allocation, converging to a stable configuration around $200$k iterations.} \label{fig:map1-evolution} \end{figure*} \begin{table}[!t] \centering \setlength{\tabcolsep}{8.5pt} \caption{Modified Environment Settings}\label{tab:env-channels} \begin{tabularx}{1.0\linewidth}{l c c c} \toprule Scenario & Beacons & RMSE & RMSE (Worst-case)\\ \midrule Original & $12$ & $0.0633$ & $0.1511$\\ Low Attenuation & $\hphantom{0}8$ & $0.0426$ & $0.0910$\\ High Noise & $27$ & $0.1400$ & $0.2907$\\ Fewer Channels ($4$) & $11$ & $0.1290$ & $0.2581$ \\ More Channels ($16$) & $12$ & $0.0397$ & $0.0910$ \\ \bottomrule \end{tabularx} \end{table} \begin{table}[!t] \centering \caption{Training Stability over Multiple Runs}\label{tab:restart} \begin{tabularx}{0.9\linewidth}{l c c c c} \toprule & Mean & Std.\ Dev.\ & Min & Max\\ \midrule RMSE & $0.057$ & $0.0019$ & $0.0541$ & $0.0596$\\ Worst-case RMSE & $0.1365$ & $0.0039$ & $0.1289$ & $0.1413$\\ Num.\ Beacons & $93.50$ & $11.17$ & $79$ & $119$\\ \bottomrule \end{tabularx} \end{table} \section{Conclusion} \label{sec:conclusion} We described a novel learning-based method capable of jointly optimizing beacon allocation (placement and channel assignment) and inference for localization tasks. Underlying our method is a neural network formulation of inference with an additional differentiable neural layer that encodes the beacon distribution. By jointly training the inference network and beacon layer, we automatically learn an optimal design of a location-awareness system for arbitrary environments. We evaluated our method for the task of RF-based localization and demonstrated its ability to consistently discover high-quality localization systems for a variety of environment layouts and propagation models, without expert supervision. Additionally, we presented a strategy that trades off the number of beacons placed and the achievable accuracy. While we describe our method in the context of localization, the approach generalizes to problems that involve estimating a broader class of spatial phenomena using sensor networks. A reference implementation of our algorithm is available on the project page at \url{http://ripl.ttic.edu/nbp}. \section{Acknowledgements} \label{sec:acknowledgements} We thank NVIDIA for the donation of Titan X GPUs used in this research. This work was supported in part by the National Science Foundation under Grant IIS-1638072. \bibliographystyle{IEEEtranN} {\small \input{nbp.bbl} } \end{document}
{'timestamp': '2017-09-21T02:10:06', 'yymm': '1703', 'arxiv_id': '1703.08612', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08612'}
arxiv
\section{Introduction \& Previous Work} Linguistic Code-Switching (CS) occurs when a multilingual speaker switches languages during written or spoken communication. CS typically involves two or more languages or varieties of a language and it is classified as inter-sentential when it occurs between utterances or intra-sentential when it occurs within the utterance. For example a Spanish-English speaker might say ``El teacher me dijo que Juanito is very good at math.'' (The teacher told me that Juanito is very good at math). CS can be observed in various linguistic levels of representation for different language pairs: phonological, morphological, lexical, syntactic, semantic, and discourse/pragmatic switching. However, very little code-switching annotated data exists for language id, part-of-speech tags, or other syntactic, morphological, or discourse phenomena from which researchers can train statistical models. In this paper, we present an annotation scheme for obtaining part-of-speech (POS) tags for code-switching using a combination of expert knowledge and crowdsourcing. POS tags have been proven to be valuable features for NLP tasks like parsing, information extraction and machine translation \cite{och2004smorgasbord}. They are also routinely used in language modeling for speech recognition and in the front-end component of speech synthesis for training and generation of pitch accents and phrase boundaries from text \cite{taylor1998architecture, taylor1998assigning, zen2009statistical, hirschberg1990accent, watts2011unsupervised}. With the advent of large scale machine learning approaches, the annotation of large datasets has become increasingly challenging and expensive. Linguistic annotations by domain experts are key to any language understanding task, but unfortunately they are also expensive and slow to obtain. One widely adopted solution is crowdsourcing. In crowdsourcing naive annotators submit annotations for the same items on crowdsourcing platforms such as Amazon Mechanical Turk (AMT) and Crowdflower (CF). These are then aggregated into a single label using a decision rule like majority vote. Crowdsourcing allows one to obtain annotations quickly at lower cost. It also raises some important questions about the validity and quality of the annotations, mainly: a) are aggregated labels by non-experts as good as labels by experts? b) what steps are necessary to ensure quality? and c) how do you explain complex tasks to non-experts to maximize output quality? \cite{callison2010creating}. In \cite{snow2008cheap} the authors crowdsourced annotations in five different NLP tasks. To evaluate the quality of the new annotations they measured the agreement between the gold and crowdsourced labels. Furthermore, they showed that training a machine learning model on the crowdsourced labels yielded a high-performing model. \cite{callison2009fast} crowdsourced translation quality evaluations and found that by aggregating non-expert judgments it was possible to achieve the quality expected from experts. In \cite{hsueh2009data} crowdsourcing was used to annotate sentiment in political snippets using multiple noisy labels. The authors showed that eliminating noisy annotators and ambiguous examples improved the quality of the annotations. \cite{finin2010annotating} described a crowdsourced approach to obtaining Named Entity labels for Twitter data from a set of four labels using both AMT and CF. They found that a small fraction of workers completed most of the annotations and that those workers tended to score highest inter-annotator agreements. \cite{jha2010corpus} proposes a two-step disambiguation task to extract prepositional phrase attachments from noisy blog data. The task of crowdsourcing POS tags is challenging insofar as POS tagsets tend to be large and the task is intrinsically sequential. This means that workers need to be instructed about a large number of categories and they need to focus on more than the word to tag, making the task potentially longer, more difficult, and thus, more expensive. More importantly, even though broad differences between POS tags are not hard to grasp, more subtle differences tend to be critically important. An example would be deciding whether a word like "up" is being used as a preposition ("He lives up the street") or a particle ("He lived up to the expectations.") Previous research has tackled the task of crowdsourcing POS tags. The authors in \cite{hovy2014experiments} collected five judgments per word in a task which consists of reading a short context where the word to be tagged occurs, and selecting the POS tag from a drop-down menu. Using MACE \cite{hovy2013learning} they obtained 82.6\% accuracy and 83.7\% when restricting the number of words to be tagged using dictionaries. In his M.S. thesis, Mainzer \cite{mainzer2011labeling} proposed an interactive approach to crowdsourcing POS tags, where workers are assisted through a sequence of questions to help disambiguate the tags with minimal knowledge of linguistics. Workers following this approach for the Penn Treebank (PTB) Tagset \cite{santorini1990part} achieved 90\% accuracy. In this work, we propose to adapt the monolingual annotation scheme from \cite{mainzer2011labeling} to crowdsource Universal POS tags in a code-switching setting for the Miami Bangor Corpus. Our main contributions are the following: finding mappings to the universal POS tagset, extending a monolingual annotation scheme to a code-switching setting, creating resources for the second language of the pair (Spanish) and creating a paradigm that others can adopt to annotate other code-switched language pairs. \section{The Miami Bangor Corpus} The Miami Bangor corpus is a conversational speech corpus recorded from bilingual Spanish-English speakers living in Miami, FL. It includes 56 files of conversational speech from 84 speakers. The corpus consists of 242,475 words (transcribed) and 35 hours of recorded conversation. 63\% of transcribed words are English, 34\% Spanish, and 3\% are undetermined. The manual transcripts include beginning and end times of utterances and per word language identification. The original Bangor Miami corpus was automatically glossed and tagged with POS tags using the Bangor Autoglosser \cite{donnelly2011bangor,donnelly2011using}. The autoglosser finds the closest English-language gloss for each token in the corpus and assigns the tag or group of tags most common for that word in the annotated language. These tags have two main problems: they are unsupervised and the tagset used is uncommon and not specifically designed for multilingual text. To overcome these problems we decided to a) obtain new part-of-speech tags through in-lab annotation and crowdsourcing and b) to use the Universal Part-of-Speech Tagset \cite{petrov2011universal}. The Universal POS tagset is ideal for annotating code-switching corpora because it was designed with the goal of being appropriate to any language. Furthermore, it is useful for crowdsourced annotations because it is much smaller than other widely-used tagsets. Comparing it to the PTB POS tagset \cite{santorini1990part,marcus1993building}, which has a total of 45 tags, the Universal POS tagset has only 17: Adjective, Adposition, Adverb, Auxiliary Verb, Coordinating and Subordinating Conjunction, Determiner, Interjection, Noun, Numeral, Proper Noun, Pronoun, Particles, Punctuation, Symbol, Verb and Other. A detailed description of the tagset can be found in \url{http://universaldependencies.org/u/pos/}. \section{Annotation Scheme} The annotation scheme we have developed consists of multiple tasks: each token is assigned to a tagging task depending on word identity, its language and whether it is present in one of three disjoint wordlists. The process combines a) manual annotation by computational linguists, b) automatic annotation based on knowledge distilled from the Penn TreeBank guidelines and the Universal Tagset guidelines, and c) and d) two language-specific crowdsourcing tasks, one for English and one for Spanish. The pseudocode of the annotation scheme is shown in Algorithm \ref{alg:annotation}. \begin{algorithm} \SetKwInOut{Input}{Input} \underline{function RetrieveGoldUniversalTag} $(token, lang, tag)$\; \Input{A word $token$, lang ID $lang$ and POS tag $tag$} \uIf{IsInUniqueLists$(token, lang)$} { return RetrieveAutomaticTag$(token, lang)$\; } \uElseIf{IsInManualAnnotationList$(token, lang)$} { return RetrieveManualTag$(token, lang)$\; } \uElse { $utag$ = Map2Universal$(token, lang, tag)$\; \uIf{IsInTSQList$(token, lang)$} { utags = TokenSpecificQuestionTask$(token, 2)$\; } \uElse { utags = QuestionTreeTask$(token, lang, 2)$\; } return MajorityVote$([utag,utags])$\; } \caption{Pseudocode of the annotation scheme.} \label{alg:annotation} \end{algorithm} Table \ref{tab:annotation_task} shows the number and percentage of tokens tagged in each annotation task (second and third column) and the percentage of tokens that was annotated by experts in-lab, either because it was the manual task or because there was a tie in the crowdsourced task. In the next subsections we explain in detail each one of the annotation blocks. \begin{table} \centering \begin{tabular}{cccc} \hline Task & \# Tokens & \% Corpus & \% by Experts \\ \hline Automatic & 156845 & 56.58 & 0.00 \\ Manual & 4,032 & 1.45 & 1.45 \\ TSQ & 57,248 & 20.65 & 0.93 \\ English QT & 42,545 & 15.34 & 0.32\\ Spanish QT & 16,587 & 5.98 & 0.08 \\ \hline Total & 277,257 & 100 & 2.78\\ \hline \end{tabular} \caption{Breakdown of amount of corpus annotated per task.} \label{tab:annotation_task} \end{table} All the wordlists and sets of questions and answers mentioned but not included in the following sections are available in \url{www.cs.columbia.edu/~vsoto/cspos_supplemental.pdf} \subsection{Automatically tagged tokens} \label{sec:automatic_tokens} For English, the PTB Annotation guidelines \cite{santorini1990part} instructs annotators to tag a certain subset of words with a given POS tag. We follow those instructions by mapping the fixed PTB tag to a Universal tag. Moreover we expand this wordlist with a) English words that we found were always tagged with the same Universal tag in the Universal Dependencies Dataset and b) low-frequency words that we found only occur with a unique tag in the Bangor Corpus. Similarly, for Spanish, we automatically tagged all the words tagged with a unique tag throughout the Universal Dependencies Dataset (e.g. conjunctions like `aunque', `e', `o', `y', etc.; adpositions like `a', `con', `de', etc.; and some adverbs, pronouns and numerals) and low frequency words that only occurred with one tag throughout the Bangor corpus (e.g. `aquella', `tanta', `bastantes', etc.). Given the abundance of exclamations and interjections in conversational speech, we collected a list of frequent interjections in the corpus and tagged them automatically as INTJ. For example: `ah', `aha', `argh', `duh', `oh', `shh'. Finally, tokens labeled as Named Entities or Proper Nouns in the original Miami Bangor Corpus were automatically tagged as PROPN. \subsection{Manually tagged tokens} \label{sec:manual_tokens} We identified a set of English and Spanish words that we found to be particularly challenging for naive workers to tag and which occurred in the dataset in such low frequency that we were able to have them tagged in the lab by computational linguists. Note that a question specific to each one of these tokens could have been designed for crowdsourced annotations the way it was done for the words in section \ref{sec:question_specific}. The majority of these are tokens that needed to be disambiguated between adposition and adverb in English (e.g.`above', `across', `below', `between') and between determinant and pronoun in Spanish (e.g. `algunos/as', `cu\'antos/as', `muchos/as'). \subsection{Crowdsourcing Universal Tags} We used crowdsourcing to obtain new gold labels for every word not manually or automatically labeled. We started with the two basic approaches discussed in \cite{mainzer2011labeling} for disambiguating POS tags using crowdsourcing which we modified for a multilingual corpus. In the first task a question and a set of answers were designed to disambiguate the POS tag of a specific token. In the second task we defined two Question Trees (one for English and one for Spanish) that sequentially ask non-technical questions of the workers until the POS tag is disambiguated. These questions were designed so that the worker needs minimal knowledge of linguistics. All the knowledge needed, including definitions, is given as instructions or as examples in every set of questions and answers. Most of the answers contain examples illustrating the potential uses for the token in that answer. Two judgments were collected from the pertinent crowdsourced task and a third one was computed from applying a mapping from the Bangor tagset to the Universal tagset The new gold standard was computed as the majority tag between the three POS tags. \subsubsection{Token-specific questions (TSQ)} \label{sec:question_specific} In this task, we designed a question and multiple answers specifically for particular word tokens. The worker was then asked to choose the answer that is the most true in his/her opinion. Below is the question we asked workers for the token `can' (Note that users cannot see the POS tags when they select one of the answers): \noindent\rule[0.5ex]{\linewidth}{0.5pt} In the context of the sentence, is `can' a verb that takes the meaning of `being able to' or `know'? \begin{itemize} \item Yes. For example: `I can speak Spanish.' ({\bf AUX}) \item No, it refers to a cylindrical container. For example: `Pass me a can of beer.' ({\bf NOUN}) \end{itemize} \noindent\rule[0.5ex]{\linewidth}{0.5pt} We began with the initial list of English words and the questions developed in \cite{mainzer2011labeling} for English. However, we added additional token-specific questions for words that a) we thought would be especially challenging to label (e.g. `as', `off', `on') and b) appear frequently throughout the corpus (e.g. `anything', `something', `nothing'). We designed specific questions for a subset of Spanish words. Just as for English, we chose a subset of most frequent words that we thought would be especially challenging for annotation by workers like tokens that can be either adverbs or adpositions (e.g.`como', `cuando', `donde') or determiners and pronouns (e.g. `ese/a', `este/a', `la/lo') We modified many of the questions proposed in \cite{mainzer2011labeling}, to adapt them to a code-switching setting and to the universal POS tagset. For example, the token `no' can be an Adverb and Interjection in Spanish, and also a Determiner in English. Also, some of our questions required workers to choose the most accurate translations for a token in a given context: \noindent\rule[0.5ex]{\linewidth}{0.5pt} \noindent In the context of the sentence, would `la' be translated in English as `her' or `the'? \begin{itemize} \item The (`La ni\~{n}a est\'a corriendo' becomes `The girl is running') ({\bf DET}) \item Her (`La dije que parase' becomes `I told her to stop') ({\bf PRON}) \end{itemize} \noindent\rule[0.5ex]{\linewidth}{0.5pt} \subsubsection{Annotations Following a Question Tree} \label{sec:question_tree} In this task the worker is presented with a sequence of questions that follows a tree structure. Each answer selected by the user leads to the next question until a leaf node is reached, when the token is assigned a POS tag. We followed the basic tree structure proposed in \cite{mainzer2011labeling}, but needed to modify the trees considerably due again to the multilingual context. For example, the new Question Tree starts by first asking whether the token is an interjection or a proper noun. This is very important since any verb, adjective, adverb or noun can effectively be part of or itself be an interjection or proper noun. If the worker responds negatively, then they are asked to follow the rest of the tree. The resulting tree is slightly simpler than the one in \cite{mainzer2011labeling}. This is mainly because we moved the Particle-Adverb-Adposition disambiguation from this task into the Token-Specific Questions task. On the other hand, we added question nodes designed to disambiguate between main verbs and auxiliary verbs. The following is an example of the annotation task following the English Question Tree: \noindent\rule[0.5ex]{\linewidth}{0.5pt} \noindent Read the sentence carefully: \noindent ``Sabes porque I plan to move in August but I need to find a really good job.'' \noindent In the context of the sentence, is the word `good': \begin{itemize} \item A Proper Noun or part of a Proper Noun. \item A single word used as an exclamation that expresses acknowledgement or an emotional reaction. \item None of the above. \checkmark \end{itemize} In the context, `good' is a: \begin{itemize} \item Noun, because it names a thing, an animal, a place, events or ideas. \item Adjective, because it says something about the quality, quantity or the kind of noun or pronoun it refers to. \checkmark \item Verb, because it is used to demonstrate an action or state of being. \item Adverb, because it tells the how, where, when, when or the degree at which something is done. \end{itemize} Could `good' be a noun or a verb? \begin{itemize} \item It could be a Noun. For example, fun can be a noun as in ... or an adjective as in... \item It could be a Verb. For example, surprised can be a verb as in ... or an adjective as in ... \item No, it's definitely an Adjective. \checkmark \end{itemize} \noindent\rule[0.5ex]{\linewidth}{0.5pt} For the Spanish portion of the corpus, we modified the English subtasks still further, adapting them according to the syntactic properties of Spanish. One of the key differences from the English tree concerns verbs in their infinitival form. Users that choose to tag a token as verb are then asked to confirm that the infinitival form is not a noun, and if it is not, to decide whether a verb is acting as main verb or as an auxiliary verb (as a compound verb or periphrasis). \subsubsection{Mapping Stage} \label{sec:mapping} We use the pre-annotated tag from the Bangor corpus as the third tag to aggregate using majority voting. To obtain it, we first cleaned the corpus of ambiguous tags, and then defined a mapping from the Bangor tagset to the Universal tagset. This mapping process was first published in \cite{alghamdi2016part}. \section{Results} We assigned two judgments per token for each of our tasks. Before they were allowed to begin the tasks, workers were pre-screened using a quiz of ten questions. If two or more questions were missed during the initial quiz, the worker was denied access to the task. Furthermore, workers were required to be certified for the Spanish language requirement in Crowdflower. Only workers from U.K., U.S.A., Spain, Mexico and Argentina were allowed access to the task. The tasks for the workers were designed to present 9 questions per page plus one test question used to assess workers' performance. When a worker reached an accuracy lower than 85\% on these test questions, all their submitted judgments were discarded and the task made subsequently unavailable. Every set of 9+1 judgments was paid 5 cents (USD) for the Token-Specific Questions task and 6 cents for the Question Tree tasks. Table \ref{tab:agreement} shows the number of test questions for each task and of evaluation metrics to estimate the accuracy of the annotations obtained from the crowdsourcing workers. Taking into account all the judgments submitted for test questions, the majority voting tag had an accuracy of 0.97-0.98 depending on the task. These estimations are not expected to match the true accuracy we would get from the two judgments we obtained for the rest of non-test tokens, so we re-estimate the accuracy of the majority vote tag for every subset of one, two, three and four judgments collected, adding the initial Bangor tag. In this case we get an average accuracy ranging from 0.89-0.92 with just one token to 0.95-0.96 when using four tags. The best accuracy estimates for our POS tags are for the option of two crowdsourced tags and the Bangor tag, for which we obtained accuracies of 0.92 to 0.94. When looking at non-aggregated tags, the average accuracy per token of single judgments (SJ) were observed to be between 0.87 and 0.88. Measuring the agreement between single judgments and the majority vote (MV) per token, the average agreement value is between 0.87 and 0.89. \begin{table}[h] \centering \begin{tabular}{|l|c|c|c|} \hline Task & TSQ & Eng QT & Spa QT \\ \hline \# Tokens & 57.2K & 42.5K & 16.6K \\ \# Test Questions & 271 & 381 & 261 \\ Avg. \# Judgments per TQ & 55.72 & 28.60 & 16.28 \\ \hline Accuracy & 0.98 & 0.98 & 0.97 \\ Avg. Acc of SJ per TQ & 0.88 & 0.89 & 0.87\\ Avg. Agrmnt of SJ wrt MV & 0.89 & 0.90 & 0.87\\ \hline Accuracy(1+1) & 0.89 & 0.92 & 0.91 \\ Accuracy(2+1) & 0.94 & 0.92 & 0.92 \\ Accuracy(3+1) & 0.94 & 0.96 & 0.96 \\ Accuracy(4+1) & 0.96 & 0.95 & 0.96 \\ \hline \end{tabular} \caption{Accuracy and Agreement measurements per task.} \label{tab:agreement} \end{table} We examine the vote split for every non-test token to obtain a measure of confidence for the tags. We see that we consistently obtained full-confidence crowdsourced tags on at least 60\% of the tokens for each of the tasks, reaching 70\% for the Spanish Question Tree task. The option for which one of the crowdsourced tags was different from the other two (marked as 2-1 Bangor) on the table occurred between 18\% and 23\% of the time depending on the task, whereas the split where the Bangor tag was different from the crowdsourced tags (marked as 2-1 CF) occurred only between 10.63 and 12.15\% of the time. Finally the vote was split in three different categories only between 1.29\% and 4.51\% of the time. In those instances, the tie was broken by in-lab annotators. \begin{table}[h] \centering \begin{tabular}{|l|c|c|c|} \hline Task & TSQ & English QT & Spanish QT \\ \hline 3-0 & 60.12 & 67.20 & 70.09 \\ 2-1 (Bangor) & 23.20 & 19.74 & 17.98 \\ 2-1 (CF) & 12.16 & 10.97 & 10.63 \\ 1-1-1 & 4.51 & 2.09 & 1.29 \\ \hline \end{tabular} \caption{Voting split per task.} \label{tab:vote_split} \end{table} To further evaluate the performance of the annotation process by different tag categories, we examine the recall on the gold test questions. The recall across all tags and tasks is higher than 0.93 except for Interjections and Adjectives for the Spanish Question Tree and Adverbs for the English Question Tree. Looking at the failed test questions for Adverbs, it becomes apparent that workers had difficulty with adverbs of place that can also function as nouns, like: `home', `west', `south', etc. For example `home' in `right when I got home' was tagged 24 times as a Noun, and only 5 as an Adverb. \begin{table}[h] \centering \begin{tabular}{|l|c|c|c|} \hline Task & TSQ & Eng QT & Spa QT \\ \hline ADV & 0.98 & 0.2 & 1.0 \\ ADJ & 1.0 & 0.97 & 0.86\\ ADP & 1.0 & X & X\\ AUX & 1.0 & 0.98 & 1.0 \\ CONJ & 1.0 & X & X\\ DET & 1.0 & X & X\\ INTJ & 1.0 & 1.0 & 0.78\\ NOUN & 1.0 & 1.0 & 0.96 \\ NUM & 1.0 & X & X\\ PART & 1.0 & X & X\\ PRON & 0.93 & X & X\\ PROPN & X & 1.0 & X \\ SCONJ & 0.96 & X & X\\ VERB & 1.0 & 0.99 & 1.0\\ \hline Average & 0.99 & 0.88 & 0.93 \\ \hline \end{tabular} \caption{POS tags recall per task.} \label{tab:recall_per_tag} \end{table} \section{Conclusions} We have presented a new scheme for crowdsourcing Universal POS tagging of Spanish-English code-switched data derived from a monolingual process which also used a different tagset. Our scheme consists of four different tasks (one automatic, one manual, and two crowdsourced). Each word in the corpus is sent to only one task based upon curated wordlists. For the crowdsourced tokens, we have demonstrated that, taking the majority vote of one unsupervised tag and two crowdsourced judgments, we obtain highly accurate predictions. We have also shown high agreement on the predictions: between 95 and 99\% of the tokens received two or more votes for the same tag. Looking at the performance of each POS tag, our predictions averaged between 0.88 and 0.93 recall depending on the task. \clearpage \clearpage \newpage \bibliographystyle{IEEEtran}
{'timestamp': '2017-03-27T02:09:52', 'yymm': '1703', 'arxiv_id': '1703.08537', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08537'}
arxiv
\section{Introduction} \label{sec:introduction} Optimal control problems (OCPs) are an active field of research in the controls community since they may arise in many application areas as, e.g., Process Control, Robotics, Aerospace and Automotive. Throughout the last decades, many different approaches have been presented to solve these problems. A possible classification of these methods has been given in \cite{Diehl06Book}: (i) Dynamic programming, (ii) Indirect Methods, and (iii) Direct methods. While methods in the first class solve the OCP by finding optimal input segments using the Principle of Optimality (see, e.g., \cite{Bertsekas05}, or \cite{Bryson75}), the ones in the second area are based on solving the necessary conditions for optimality using a (two-point) boundary value problem, which can be solved by means of calculus of variations (\cite{Kirk70}, \cite{Sage68}) or Pontryagin's Maximum Principle (\cite{Pontryagin62}, \cite{Liberzon12}). The third direction is the most investigated and simplifies the OCP by parameterizing the control. According to the way the dynamics is handled, these methods are classified into fully discretized (or collocation) methods (see, e.g.,~\cite{Cervantes98}) and direct shooting methods, where the dynamics are included by some integration scheme (see, e.g., ~\cite{Bock84}). A detailed overview over Direct methods can, for example, be found in~\cite{Betts01}. Of special interest for our paper is the PRojection Operator based Newton method for Trajectory Optimization (PRONTO) which was introduced in \cite{Hauser02}, see also \cite{Hauser98}. In contrast to many other approaches solving optimal control problems, this method is able to guarantee feasibility of the dynamics after each iteration of the underlying Newton method using a ``projection operator'' defined by a feedback, closed-loop system. According to the classification in \cite{Diehl06Book} this can be seen as a combination of shooting and collocation. This method was designed to handle unconstrained optimal control problems (and extended to input-constrained problems in \cite{Saccon08}), considering final-state constraints only approximately by means of a final penalty. Matching exactly final-state constraints is of interest in many control applications. This is the case, for example, in the field of hybrid systems, that is, systems that consist of continuous and discrete event dynamics (see, e.g.,~\cite{Goebel12} and the references therein). Discontinuous jumps of continuous states may occur when the system state traverses a certain region of the state space. This demands for an exact satisfaction of constraints on the final state. Another field where this is of interest is the field of Model Predictive Control (MPC) (see, e.g., \cite{Rawlings09} and the references therein). In MPC, the system is controlled by means of repeatedly solving a finite-horizon OCP. In many approaches within MPC, convergence and stability can be guaranteed if a certain terminal condition is satisfied. This leads to the need of an algorithm being able to handle final state constraints. A first approach to solve the nonlinear transfer problem was introduced in~\cite{hauser2003computation}. In there, the terminal constraint was satisfied asymptotically by iteratively choosing a terminal reference until the actual final state matches the target one. The contribution of this paper is twofold. First, we introduce a new projection operator, inspired by the one presented in~\cite{Hauser98}, such that not only the dynamics, but also the terminal constraint is satisfied after each iteration of the optimization algorithm. We reformulate the constrained projection as a root-finding of an infinite dimensional functional, which can be accomplished by means of a Newton root-finding in Banach spaces. Then, based on this new projection operator, as main contribution we propose an optimal control method solving final-state constrained problems which shows recursive feasibility. The proposed algorithm consists of two steps. First, a feasible descent direction is determined using a quadratic approximation of the nonlinear problem. The descent direction is chosen such that the mismatch on the final state is zero. Second, the perturbed curve is projected on the feasible manifold such that the \emph{dynamics and the terminal constraint} are satisfied. An interesting feature of the proposed algorithm is that it is amenable to realtime, fast MPC schemes. Indeed, in many applications one may not be able to run the algorithm until convergence is achieved with a desired tolerance. Due to a reduced computation time it could be that a (much) shorter number of iterations can be run. Since feasibility of both the dynamics and the final state-constraint are guaranteed at each iteration one can stop the computation and still get a feasible trajectory. The paper is organized as follows. In Section~\ref{sec:problem_setup} we introduce the problem setup and recall how to solve final-state constrained linear quadratic optimal control problems. PRONTO is introduced in Section~\ref{subsec:pronto}. Our new final-state constrained PRONTO is presented in Section~\ref{sec:fs_pronto} and a numerical simulation for the optimal state-transfer of an inverted pendulum is given in Section~\ref{sec:simulations}. \paragraph*{Notation} Given a smooth vector field $f(x,u)$, we denote by $f_x (\bar{x}, \bar{u})$ its derivative with respect to $x$ evaluated at $(\bar{x}, \bar{u})$, and, consistently, by $f_u$ its derivative with respect to $u$. For the curve $\xi = (x(\cdot),u(\cdot))$, we introduce the projections $\pi_{1} = [I~0]$ and $\pi_{2} = [0~I]$ such that $x(\cdot) = \pi_1 \xi$ and $u(\cdot) = \pi_2 \xi$. Given a functional $\mathcal{G}} \newcommand{\LL}{\mathcal{L} : X \to {\mathbb{R}}$, with $X$ a Banach space, and a point $\xi \in X$, we denote by $D \mathcal{G}} \newcommand{\LL}{\mathcal{L}(\xi)$ the first Fr\'echet derivative of $\mathcal{G}} \newcommand{\LL}{\mathcal{L}$ evaluated at $\xi$, and, consistently, by $D^2 \mathcal{G}} \newcommand{\LL}{\mathcal{L}(\xi)$ its second Fr\'echet derivative, \cite{Zeidler95}. \section{Problem Setup and Preliminaries} \label{sec:problem_setup} In this paper we consider a final-state constrained optimal control problem. That is, we aim at finding a trajectory of a dynamical system that minimizes a given objective functional while satisfying an initial and a terminal constraint. Formally, we consider the problem \begin{align} \begin{split} \underset{(x(\cdot),u(\cdot))}{\text{minimize}} \: & \: \int_0^T \ell(x(\tau), u(\tau)) \,\d \tau \\ \text{subject to}} \newcommand{\maximize}{\text{maximize} \: & \: \dot{x}(t) = f(x(t),u(t)) \\ & \: x(0) = x_0, ~x(T) = x_T, \end{split} \label{eq:nonlin_state_transf} \end{align} where $\ell : {\mathbb{R}}^n \times {\mathbb{R}}^m \to {\mathbb{R}}$ is the running cost, $f : {\mathbb{R}}^n \times {\mathbb{R}}^m \to {\mathbb{R}}^n$ is the nonlinear vector field describing the control system, and $x_0 \in {\mathbb{R}}^n$ and $x_T \in {\mathbb{R}}^n$ are the initial and final fixed states respectively. We assume $\ell$ and $f$ to be $\mathcal{C}} \newcommand{\DD}{\mathcal{D}^2$ functions. Notice that in the rest of the paper, for the sake of brevity, we will omit the dimensions of the quantities when it will be clear from the equations. Before stating the main assumptions for problem \eqref{eq:nonlin_state_transf}, we recall some notation that will be also useful in the rest of the paper. Consider the Hamiltonian of \eqref{eq:nonlin_state_transf} given by \begin{align} \! H\! (x(t),p(t),u(t)) \! := \! \ell (x(t), u(t)) \! +\! p(t)^T \! f(x(t),u(t)), \label{eq:hamiltonian} \end{align} where $p(\cdot)$ is the costate. Then, for $\xi = (\bar x(\cdot),\bar u(\cdot))$ define \begin{align} \! q(\xi) \!\cdot\! (\zeta, \zeta) \!:=\! \int_0^T\! \begin{bmatrix} z(\tau) \\ v(\tau) \end{bmatrix}^T \!\! \begin{bmatrix} H_{xx}(\tau) &\!\!\! H_{xu}(\tau)\\ H_{ux}(\tau) &\!\!\! H_{uu}(\tau) \end{bmatrix} \!\! \begin{bmatrix} z(\tau) \\ v(\tau) \end{bmatrix} \! \d\tau, \label{eq:q} \end{align} where $\zeta = (z(\cdot),v(\cdot))$ is a (state-input) curve representing a variation from $\xi$, while $H_{xx}(t)$, $H_{xu}(t)$ and $H_{uu}(t)$ denote the appropriate second derivative of the $H$ evaluated along the extremal state-control-costate trajectory, e.g., $H_{xx}(t) = H_{xx}(\bar{x}(t), \bar{p}(t), \bar{u}(t))$. Given a dynamical system $\dot x = f(x,u)$, $x(0) = x_0$, we say that a state-input curve $\xi = (\bar x(t),\bar u(t))$ is a trajectory of the system if it satisfies the dynamics, i.e., $\dot{\bar x}(t) = f( \bar x(t), \bar u(t))$ for all $t\in[0,T]$ and $\bar x(0) = x_0$. We denote the (infinite-dimensional) manifold of all system trajectories by $\mathcal{T}} \newcommand{\UU}{\mathcal{U}$, so that we write $\xi \in \mathcal{T}} \newcommand{\UU}{\mathcal{U}$. Given a trajectory $\xi = (\bar x(t),\bar u(t))$, we denote by $T_\xi \mathcal{T}} \newcommand{\UU}{\mathcal{U}$ the manifold of curves $\zeta = (z(\cdot),v(\cdot))$ satisfying the linearized dynamics \begin{align} \dot z = f_x (\bar x(t),\bar u(t)) z +f_u(\bar x(t),\bar u(t))v \label{eq:linearization} \end{align} with $z(0) = 0$ and for $v(\cdot) \in L_2$. We say that $T_\xi \mathcal{T}} \newcommand{\UU}{\mathcal{U}$ is the tangent space of the trajectory manifold at $\xi$. \begin{assumption}[Linear controllability] The system $\dot x = f(x,u)$ is linearly controllable around any trajectory. That is, for any $(\bar{x}(\cdot), \bar{u}(\cdot))$ defined on $[0,T]$, the linearized system~\eqref{eq:linearization} is controllable over $[0,T]$. \label{ass:linear_ctrl} \end{assumption} \begin{assumption}[Second Order Sufficiency] Given a trajectory $\xi\in\mathcal{T}} \newcommand{\UU}{\mathcal{U}$, the Hamiltonian $H$ satisfies $H_{uu}(t) \ge r_0I$ for $t \in [0,T]$ and some $r_0 > 0$, and the quadratic functional $q$ is positive-definite\footnote{See, e.g., \cite{Zeidler95} for the definition of positive definite functional.} on $T_\xi\mathcal{T}} \newcommand{\UU}{\mathcal{U}$. \oprocend \label{ass:SSC} \end{assumption} \begin{theorem}[{\cite[Theorem~$2.1$]{hauser2003computation}}] Let $\xi = (x(\cdot), u(\cdot))$ be a stationary trajectory of~\eqref{eq:nonlin_state_transf} with corresponding costate trajectory $p(\cdot)$. Suppose that Assumption~\ref{ass:SSC} hold at $\xi$. If the system is linearly controllable around $\xi$, then $\xi$ is an isolated local minimum of~\eqref{eq:nonlin_state_transf}. \oprocend \end{theorem} \begin{remark} Assumption~\ref{ass:linear_ctrl} not only is a sufficient condition for the theorem above, but also guarantees that the algorithm we propose will be solvable at each iteration. \oprocend \end{remark} \subsection{Linear Quadratic (LQ) optimal state transfer problem} \label{subsec:fscLQR} We start by considering a special version of problem~\eqref{eq:nonlin_state_transf} in which the cost is quadratic and the dynamics is linear and time-varying, i.e., we consider the problem \begin{align} \label{eq:lin_state_transf} \begin{split} \underset{(x(\cdot),u(\cdot))}{\text{minimize}} \: & \: \int_0^T a(\tau)^T x(\tau) + b(\tau)^T u(\tau) \\ & \: + \dfrac{1}{2} \begin{bmatrix} x(\tau) \\ u(\tau) \end{bmatrix}^T \begin{bmatrix} Q(\tau) & S(\tau)\\ S(\tau)^T & R(\tau) \end{bmatrix} \begin{bmatrix} x(\tau) \\ u(\tau) \end{bmatrix} \d\tau \\[1ex] \text{subject to}} \newcommand{\maximize}{\text{maximize} \: & \: \dot{x} = A(t)x + B(t)u, \: x(0)=x_0, \: x(T)=x_T, \end{split} \end{align} where we assume that $a(\cdot)$ and $b(\cdot)$ are piecewise continuous vectors, and $A(\cdot)$, $B(\cdot)$, $Q(\cdot) = Q(\cdot)^T$, $R(\cdot) = R(\cdot)^T$, and $S(\cdot)$ are piecewise continuous matrices with $R(t) \geq r_0I$, $t \in [0,T]$, for some $r_0 > 0$. \begin{remark} Problem~\eqref{eq:lin_state_transf} can be obtained as the linear-quadratic approximation of problem~\eqref{eq:nonlin_state_transf}. In particular, $A(\cdot)$ and $B(\cdot)$ result from the linearization of the nonlinear dynamics $f$ at a given trajectory, while $Q$, $R$, $S$, $a$ and $b$ define the quadratic approximation of the nonlinear cost functional $\ell$ at the same trajectory. \oprocend \end{remark} \begin{theorem}[{\cite[Proposition~$1.1$]{hauser2003computation}}] If $(A(\cdot), B(\cdot))$ in \eqref{eq:lin_state_transf} describes a controllable linear time-varying system over $[0,T]$ and $q$ is positive definite on the space of the system trajectories, then problem~\eqref{eq:lin_state_transf} has a unique solution. \oprocend \end{theorem} Next, we recall how to solve problem~\eqref{eq:lin_state_transf}. We start by imposing the first-order necessary conditions of optimality. Setting to zero the first variation of the Hamiltonian with respect to $u$, we obtain the optimal feedback law \begin{align} \label{eq:u_feedback} u &= -R^{-1} [ \, S^T x + B^Tp + b \,]. \end{align} By setting the first variations of the Hamiltonian with respect to $x$ and $p$ to zero and by using~\eqref{eq:u_feedback}, we obtain the following linear two-point boundary value problem \begin{align} \label{eq:TPBVP} \hspace{-0.2cm} \begin{bmatrix} \dot{x} \\ \dot{p} \end{bmatrix} \! \!= \!\! \begin{bmatrix} \tilde{A} & \hspace{-0.3cm} -BR^{-1}B^T\\ -\tilde{Q} & \hspace{-0.3cm} -\tilde{A}^T \end{bmatrix} \!\! \begin{bmatrix} x \\ p \end{bmatrix} \! + \! \begin{bmatrix} -BR^{-1}b\\ SR^{-1}b-a \end{bmatrix}\!,\!\!\! \begin{array}{l} x(0) \!=\! x_0\\ p(T) \!=\! p_1 \end{array}\!\!, \end{align} where $p(t)$ is the costate, $p_1$ is a boundary value to be determined, $\tilde{A} := A-BR^{-1}S^T$ and $\tilde{Q} := Q - SR^{-1}S^T$. It can be shown that $p$ and $x$ in \eqref{eq:TPBVP} are related via an affine relation, i.e., \begin{equation} p = P x + r. \label{eq:Ricc_transf} \end{equation} By defining the gain matrix $K := R^{-1}(S^T+ B^TP)$, the optimal input~\eqref{eq:u_feedback} results into the affine feedback law $u = -Kx - R^{-1}(B^Tr+b).$ Then, equation \eqref{eq:TPBVP} can be decoupled by means of the sweep method, \cite{Bryson75}, which leads to the following differential (Riccati) equations \begin{align} \label{eq:P_dot} -\dot{P} &=A^TP + P A -K^TRK+Q, && \quad P(T)=0\\ \label{eq:r_dot} -\dot{r} &= (A-BK)^T r - K^T b +a, && \quad r(T)=p_1 \end{align} where the boundary conditions follow from~\eqref{eq:Ricc_transf}. The above equations should be integrated to determine the optimal control~\eqref{eq:u_feedback} and thus solve problem~\eqref{eq:lin_state_transf}. However, the terminal vector $p_1$ is still unknown. Thus, we need to express explicitly the relation between $p_1$ and the terminal condition $x_T$. Plugging \eqref{eq:Ricc_transf} into the first equation of \eqref{eq:TPBVP}, we obtain \begin{align} \label{eq:x_closeloop} \dot{x} &= (A - BK) x - BR^{-1} ( B^Tr + b ), && x(0)=x_0. \end{align} Next, we observe that \begin{align} \label{eq:terminal_x} x(T) = x_{\unf/}(T) + x_{\fcd/, b}(T) + x_{\fcd/, r}(T), \end{align} where $x_{\unf/}(T)$ is the unforced response of system \eqref{eq:x_closeloop} at time $t=T$, whereas $x_{\fcd/, b}(T)$ and $x_{\fcd/, r}(T)$ are the forced responses due to the inputs $BR^{-1} b$ and $BR^{-1} B^T r$, respectively. Focusing on $x_{\fcd/, r}(T)$, we note that it can be further split into two contributions related, respectively, to the forced and unforced responses of $r$. The latter contribution depends directly on $p_1$ and it can be shown that equation~\eqref{eq:terminal_x} can be rewritten as $x(T) = x_{\unf/}(T) + n(T) - W_c(T) p_1$, where $W_c(T)$ is the controllability Gramian matrix, \begin{equation*} W_c(t) := \!\!\int_0^t \!\!\Phi_c (t,\tau) B(\tau)R(\tau)^{-1} B(\tau)^T \Phi_c(t,\tau)^T\,\d \tau, \end{equation*} evaluated at time $T$, with $\Phi_c$ being the state transition function associated to closed-loop system with state matrix $A - BK$, while $n(T)$ denotes the terminal state of \begin{align*} \dot{n} & = (A-BK) n - BR^{-1} ( B^T r_{\fcd/} + b ), && n(0)=0, \end{align*} where $r_{\fcd/}$ denotes the forced response of $r$, i.e., it solves \eqref{eq:r_dot} with zero terminal condition. To conclude, $p_1$ can be computed as \begin{align*} p_1 = W_c(T)^{-1} \left(x_T - x_{\unf/}(T) - n(T)\right). \end{align*} \section{Projection Operator Newton Method for Trajectory Optimization (PRONTO)} \label{subsec:pronto} PRONTO was introduced in~\cite{Hauser98} to solve the following finite-horizon optimal control problem \begin{align} \begin{split} \underset{(x(\cdot),u(\cdot))}{\text{minimize}} \: & \: \int_0^T \ell (x(\tau),u(\tau)) \,\d\tau +m(x(T)) \\ \text{subject to}} \newcommand{\maximize}{\text{maximize} \: & \: \dot{x}(t) = f(x(t),u(t)), \hspace{0.5cm} x(0)=x_0, \end{split} \label{eq:pronto_ocp} \end{align} which, differently from problem~\eqref{eq:nonlin_state_transf}, has a terminal penalty $m : {\mathbb{R}}^n \to {\mathbb{R}}$ rather than a terminal constraint. The key idea of PRONTO is to (i) convert the dynamically constrained (infinite-dimensional) optimization problem into an unconstrained one by means of a projection operator, and (ii) solve the unconstrained problem via an infinite-dimensional Newton method. We start recalling the projection operator, which is based on a trajectory tracking feedback law. \subsection{The trajectory tracking nonlinear projection operator} \label{subsec:proj_oper} Suppose that $\xi := (\alpha(\cdot),\mu(\cdot))$ (defined on $t \geq 0$) is a bounded state-input curve and let $\eta := (x(\cdot),u(\cdot))$ be the trajectory determined by the nonlinear feedback system \begin{align} \Bigg\{ \begin{split} & \dot{x} (t) = f (x(t), u(t)),\hspace{1.4cm} x(0) = \alpha(0) \\ & u(t) = \mu(t) + K(t)[\alpha(t) - x(t)]. \end{split} \label{eq:tracking_operator} \end{align} Under suitable conditions on $f$ and $K$, the feedback system in \eqref{eq:tracking_operator} defines a \emph{continuous} nonlinear projection operator $\PP : \xi = (\alpha (\cdot), \mu (\cdot) ) \mapsto \eta = (x(\cdot), u(\cdot))$. The operator $\PP$ is a projection since $\PP = \PP\circ \PP $ on its domain. Indeed, independent of $K$, if $\xi$ is a trajectory of $f$, then $\xi$ is a \emph{fixed point} of $\PP$, i.e., $\xi = \PP(\xi)$. As a consequence, a trajectory can be characterized in terms of the projection operator as $\xi \in \mathcal{T}} \newcommand{\UU}{\mathcal{U}$ if and only if $\xi = \PP(\xi)$. In \cite{Hauser98}, the authors have proven that the projection operator $\PP$ is as smooth as $f$ and one can compute (and analyze) its derivatives. In particular, if $f$ is $\mathcal{C}} \newcommand{\DD}{\mathcal{D}^1$, then the first derivative of the projection operator is the linear mapping $\zeta = (\beta(\cdot),\nu(\cdot)) \mapsto D\PP(\xi)\cdot \zeta = (z(\cdot),v(\cdot))$ defined by \begin{align*} \Bigg\{ \begin{split} &\dot{z} (t) = f_x (x(t),u(t)) z(t) + f_u (x(t),u(t)) v(t),\: z(0) = 0\\ &v(t) = \nu(t) + K(t)[\beta(t) - z(t)]. \end{split} \end{align*} which is obtained by linearizing \eqref{eq:tracking_operator} about $\xi \in \mathcal{T}} \newcommand{\UU}{\mathcal{U}$. It can be shown that $D\PP(\xi)$ is itself a projection, so that $\zeta \in T_\xi\mathcal{T}} \newcommand{\UU}{\mathcal{U}$ if and only if $\zeta = D\PP(\xi) \cdot \zeta$. \subsection{The PRONTO algorithm} \label{subsec:pronto_alg} Writing the cost in \eqref{eq:pronto_ocp} as the functional \begin{align*} h(\xi) := \int_0^T \ell(x(\tau),u(\tau))\,\d\tau +m(x(T)), \end{align*} we see that the optimal control problem~\eqref{eq:pronto_ocp} is equivalent to the constrained optimization problem $\min_{\xi\in\mathcal{T}} \newcommand{\UU}{\mathcal{U}} h(\xi)$. Using the trajectory characterization and defining $g(\xi) := h(\PP(\xi) )$ the constrained problem can be converted into an unconstrained one as $\min_{\xi \in \mathcal{T}} \newcommand{\UU}{\mathcal{U}} h(\xi) = \min_{\xi} g(\xi).$ The PRONTO algorithm, stated in Algorithm~\ref{alg:PRONTO}, is based on a Newton method applied to $\min_{\xi} g(\xi)$ and includes two key steps. First, the search direction $\zeta_i$ is determined by an optimization problem considering the first and second derivatives of the nonlinear functional $g$. Since the derivatives of $g$ are computed, the projection $\PP$ is inherently considered within the calculation of the search direction. Moreover, the search direction is limited to the tangent space of the trajectory manifold at the current trajectory $\xi_i$, that is, $\zeta_{i}\in T_{\xi}\mathcal{T}} \newcommand{\UU}{\mathcal{U}$. Second, the update is performed using the projection $\PP$ in~\eqref{eq:pronto_alg_proj}, thus a feasible trajectory is determined after each iteration of the optimization algorithm. \begin{algorithm}[H] \begin{algorithmic} \StatexIndent[0] \textsc{Given:} initial trajectory $\xi_0 \in \mathcal{T}} \newcommand{\UU}{\mathcal{U}$ \StatexIndent[0] \textsc{For:} $i=0,1,2,\dots$ \StatexIndent[0.5] redesign feedback $K$ if desired/needed \StatexIndent[0.5] search direction \begin{equation}\label{eq:pronto_alg_desc_dir} \zeta_i=\mathop{\rm argmin}_{\zeta\in T_{\xi_i}\mathcal{T}} \newcommand{\UU}{\mathcal{U}} \, Dg(\xi_i) \cdot \zeta+\textstyle\frac{1}{2}D^2g (\xi_i)\cdot(\zeta,\zeta) \end{equation} \StatexIndent[0.5] step-size \begin{equation*} \gamma_i = \mathop{\rm argmin}_{\gamma\in (0,1]} \, g(\xi_i+\gamma\zeta_i) \end{equation*} \StatexIndent[0.5] update \begin{equation}\label{eq:pronto_alg_proj} \xi_{i+1} = \PP(\xi_i+\gamma_i\zeta_i) \end{equation} \end{algorithmic} \caption{PRONTO} \label{alg:PRONTO} \end{algorithm} \begin{remark} Notice that step \eqref{eq:pronto_alg_desc_dir} consists of solving a (standard) LQR problem in the form \begin{align*} \begin{split} \underset{\zeta = (z(\cdot),v(\cdot))}{\text{minimize}} \: & \: \int_0^T a(\tau)^T z(\tau) + b(\tau)^T v(\tau) \\ &\: \: + \dfrac{1}{2} \begin{bmatrix} z(\tau) \\ v(\tau) \end{bmatrix}^T \begin{bmatrix} Q(\tau) & S(\tau)\\ S(\tau)^T & R(\tau) \end{bmatrix} \begin{bmatrix} z(\tau) \\ v(\tau) \end{bmatrix} \d\tau \\[0.2ex] &\: \: + z(T)^T P_1 z(T) + r_1^Tz(T) \\[1ex] \text{subject to}} \newcommand{\maximize}{\text{maximize} \: & \: \dot{z} = A(t)z + B(t)v, \: \:\: z(0)=0. \end{split} \end{align*} Step~\eqref{eq:pronto_alg_proj} consists of computing the updated trajectory $\xi_{i+1} = (x_{i+1}(\cdot), u_{i+1}(\cdot))$ by running the closed loop system \eqref{eq:tracking_operator} with (given) curve $(\alpha(\cdot), \mu(\cdot)) =\xi_i + \gamma_i \zeta_i = (x_i(\cdot) + \gamma_i z_i(\cdot), u_i(\cdot) + \gamma_i v_i(\cdot))$. \oprocend \end{remark} \section{Final-state constrained PRONTO} \label{sec:fs_pronto} In this section, we introduce an optimization algorithm which solves the nonlinear optimal state transfer problem. The key approach is to: (i) introduce a projection operator, inspired by the one introduced in~\cite{Hauser98} (and recalled in Section~\ref{subsec:pronto}), such that not only the dynamics, but also the terminal constraint is satisfied, and (ii) compute a descent direction that satisfies the final-state constraint to first-order. \subsection{Final-state constrained projection operator} \label{subsec:fs_proj_oper} The Projection Operator as recalled in Section~\ref{subsec:proj_oper} is not able to guarantee an exact matching of the terminal constraint. As a key step of our algorithm, we introduce a final-state constrained projection operator, $\xi = ( \alpha (\cdot), \mu (\cdot) ) \mapsto \PP_c (\xi)=\eta = (x(\cdot),u(\cdot)),$ satisfying $x(T) = \alpha(T)$ where, as usual, $\xi$ is a curve while $\eta \in \mathcal{T}} \newcommand{\UU}{\mathcal{U}$ a trajectory. Our idea is to \emph{design} the operator $\PP_c$ as an iterative routine in which, at each iteration: (i)~we perturb the actual trajectory in order to hit exactly the terminal constraint and (ii) we project the resulting curve by means of the standard projection operator~\eqref{eq:tracking_operator}. The final-state constrained projection can be formalized in terms of an infinite dimensional root-finding. Given $x_T\in{\mathbb{R}}^n$, let us define a functional $\FF$ which associates to a state-input curve $\xi=(\alpha(\cdot),\mu(\cdot))$ the difference between its terminal state $\alpha(T)$ and $x_T$. Hence, a \emph{trajectory} $\eta$ being a \emph{root} of $\FF$, i.e., such that $\FF(\eta) = 0$, is exactly what we expect to be the result of the final-state constrained projection operator $\PP_c$ when applied to a curve $\xi$. Following the same high level idea in Section~\ref{subsec:pronto_alg} to derive the PRONTO algorithm, we convert the constrained root-finding of $\FF$ into the unconstrained root-finding of $\mathcal{G}} \newcommand{\LL}{\mathcal{L}(\cdot) := \FF(\PP(\cdot))$, with $\PP$ being the (unconstrained) projection operator introduced in~\eqref{eq:tracking_operator}. Given an initial curve $\xi$, the root of the functional $\mathcal{G}} \newcommand{\LL}{\mathcal{L}$ is found by means of an infinite-dimensional Netwon method. Formally, at each iteration the perturbation $\zeta_k$ is obtained by setting to zero the first order approximation of the perturbed functional, i.e. by solving for $\zeta_k$ the following equation \begin{equation} \mathcal{G}} \newcommand{\LL}{\mathcal{L}(\xi_{k}) + D\mathcal{G}} \newcommand{\LL}{\mathcal{L}(\xi_{k}) \cdot \zeta_{k} = 0. \label{eq:root_finding_approx} \end{equation} Using the chain rule, the linear mapping $D\mathcal{G}} \newcommand{\LL}{\mathcal{L}(\xi_{k})$ applied to a state-input curve $\zeta_{k}$ can be expressed as $D\mathcal{G}} \newcommand{\LL}{\mathcal{L}(\xi_{k}) \cdot \zeta_{k} = D\FF(\xi_k)\cdot D\PP(\xi_k) \cdot \zeta_k$. When $\xi_k$ is a trajectory, the linear mapping $D\PP(\xi_k)$ is a projection on the tangent space $T_{\xi_k}\mathcal{T}} \newcommand{\UU}{\mathcal{U}$ (see \cite{Hauser98}). Moreover, the first order expansion of the perturbed functional $\FF(\xi_k + \zeta)$ turns out to be $D\FF(\xi_k)\cdot \zeta = (\pi_1\zeta)(T)$. Thus, we can conclude that equation~\eqref{eq:root_finding_approx} simply enforces a terminal condition on $\zeta_k$, i.e., find the state component $z_k(\cdot)$ of $D\PP(\xi_k) \cdot \zeta_k \in T_{\xi_k}\mathcal{T}} \newcommand{\UU}{\mathcal{U}$ such that \begin{align} x_k(T) - x_T + z_k(T) = 0. \label{eq:root_finding_terminal_constraint} \end{align} Note that, since the linear mapping $D\mathcal{G}} \newcommand{\LL}{\mathcal{L}(\xi_{k})$ is not invertible, the solution of~\eqref{eq:root_finding_approx} is not unique. A finite dimensional counter-part of equation~\eqref{eq:root_finding_approx} is a linear system of the form $M z + n = 0$. When $\ker M$ is non-empty, the equation has not a unique solution. A typical approach to overcome this problem is to consider the equivalent least-square problem, which selects the minimum norm solution of the linear system. Motivated by this finite-dimensional observation, a reasonable choice is to select a $\zeta_{k}\in T_{\xi_{k}}\mathcal{T}} \newcommand{\UU}{\mathcal{U}$ satisfying condition~\eqref{eq:root_finding_terminal_constraint} with minimum $L_2$ norm. It can be obtained solving the following linear quadratic optimal state transfer problem \begin{align*} \begin{split} \zeta_k := (z_k(\cdot),v_k(\cdot)) = \mathop{\rm argmin}_{(z(\cdot),v(\cdot))} & \, \frac{1}{2} \int_0^T\! \big \|z(\tau)\big \|^2 + \big \|v(\tau)\big \|^2 \, \d\tau \\ \text{subj. to} \: & \: \dot{z} = A(t) z + B(t) v \\ & \: z(0)\!=\!0, \:\! z(T)\! =\! -x(T)\! +\! x_T, \end{split} \end{align*} where $A(\cdot)$ and $B(\cdot)$ result by the linearization of dynamics $f$ around the current iterate $\xi_k$. A pseudo code of the constrained projection operator $\PP_c$ is given in the following table (Algorithm~\ref{alg:cpo}). \begin{algorithm}[H] \begin{algorithmic} \StatexIndent[0] \textsc{Given}: a curve $\bar{\xi}$, a projection operator $\PP$ and a \StatexIndent[2.4] tolerance value {\tt\small tol}, \textsc{Set}: $\xi_0 = \bar{\xi}$ \StatexIndent[0] \textsc{For}: $k=0,1,2,\ldots$ \StatexIndent[0.5] search direction \begin{align*} \zeta_k = \mathop{\rm argmin}_{\zeta} &\: \textstyle \frac{1}{2} \big\|\zeta \big\|_{L_2}^2 \\[1ex] \:\text{subj. to} \: & \: \zeta \in T_{\xi_k}\mathcal{T}} \newcommand{\UU}{\mathcal{U} \\ \: &\: (\pi_1\zeta) (T) = -\FF(\xi_{k}) \end{align*} \StatexIndent[0.5] update \begin{align*} \xi_{k+1} = \PP (\xi_k + \zeta_k) \end{align*} \StatexIndent[0.5] \textsc{If}: $\| \FF(\xi_{k+1}) \| < {\tt tol}$, \textsc{Then:} break.\medskip \StatexIndent[0] \textsc{Set:} $\PP_c(\bar{\xi}) = \xi^*$, being $\xi^*$ the \emph{last} iteration trajectory. \end{algorithmic} \caption{Final-state constrained projection operator} \label{alg:cpo} \end{algorithm} \begin{remark} The convergence of Algorithm~\ref{alg:cpo} can be guaranteed by satisfying the hypotheses of Newton-Kantorovich theorem (see, e.g., \cite{Kantorovich48,Ortega68}). \oprocend \end{remark} \subsection{fsPRONTO Algorithm} \label{subsec:fspronto} We are ready to present the final-state constrained PRojection Operator Newton method for Trajectory Optimization (fsPRONTO) algorithm which is an iterative algorithm able to solve problem~\eqref{eq:nonlin_state_transf}. The algorithm extends the PRONTO outlined in Section~\ref{subsec:pronto_alg} combining a particular descent direction and the final-state constrained projection operator presented in Section~\ref{subsec:fs_proj_oper}. First, we search for a descent direction $\zeta_i \in T_{\xi_i} \mathcal{T}} \newcommand{\UU}{\mathcal{U}$ satisfying the final constraint to first-order by means of a linear-quadratic state transfer problem as in \eqref{eq:lin_state_transf}. Since each $\xi_i$ is already feasible, in order to maintain feasibility to first order, the perturbation $\zeta_i$ must satisfy the terminal constraint $z_i(T) := (\pi_1 \zeta_i)(T) = 0$. Second, we perform a backtracking line-search to modulate the descent direction. Finally, we perform the projection step by means of the constrained projection operator described by Algorithm~\ref{alg:cpo}. The fsPRONTO algorithm is formally stated in the following table (Algorithm~\ref{alg:fsPRONTO}). \begin{algorithm}[H] \begin{algorithmic} \StatexIndent[0] \textsc{Given:} initial trajectory $\xi_0$ \StatexIndent[0] \textsc{For:} $i=0,1,2,\dots$ \StatexIndent[0.5] redesign feedback $K$ if desired/needed \StatexIndent[0.5] constrained search direction \begin{align} \begin{split} \zeta_i = \mathop{\rm argmin}_{\zeta\in T_{\xi_i}\mathcal{T}} \newcommand{\UU}{\mathcal{U}} & \: \, Dg(\xi_i)\cdot\zeta+\textstyle\frac{1}{2}D^2g (\xi_i)\cdot(\zeta,\zeta) \\ \text{subj. to} \: & \: (\pi_1\zeta_i) (T) = 0 \end{split} \label{eq:fsPRONTO_desc} \end{align} \StatexIndent[0.5] step-size \begin{equation} \gamma_i = \mathop{\rm argmin}_{\gamma\in (0,1]} \, g(\xi_i+\gamma\zeta_i) \label{eq:fsPRONTO_linesearch} \end{equation} \StatexIndent[0.5] constrained update \begin{equation} \xi_{i+1} = \PP_c(\xi_i+\gamma_i\zeta_i) \label{eq:fsPRONTO_proj} \end{equation} \end{algorithmic} \caption{Final-state constrained PRONTO.} \label{alg:fsPRONTO} \end{algorithm} In the following, we have a closer look at some of the specific aspects of our newly presented Algorithm~\ref{alg:fsPRONTO}. \begin{remark} Notice that step \eqref{eq:fsPRONTO_desc} consists of solving a linear quadratic optimal state transfer problem in the form \begin{align*} \begin{split} \underset{\zeta = (z(\cdot),v(\cdot))}{\text{minimize}} \: & \: \int_0^T a(\tau)^T z(\tau) + b(\tau)^T v(\tau) \\ & \: + \frac{1}{2} \begin{bmatrix} z(\tau) \\ v(\tau) \end{bmatrix}^T \begin{bmatrix} Q(\tau) & S(\tau)\\ S(\tau)^T & R(\tau) \end{bmatrix} \begin{bmatrix} z(\tau) \\ v(\tau) \end{bmatrix} \d\tau \\[1ex] \text{subject to}} \newcommand{\maximize}{\text{maximize} \: & \: \dot{z} = A(t)z + B(t)v, \:\:\: z(0)=0, \:\: z(T) = 0, \end{split} \end{align*} as discussed in detail in Section~\ref{subsec:fscLQR}. Step~\eqref{eq:fsPRONTO_proj} consists of computing the updated trajectory $\xi_{i+1} = (x_{i+1}(\cdot), u_{i+1}(\cdot))$ via Algorithm~\ref{alg:cpo} with a (given) curve $\bar{\xi} = \xi_i + \gamma_i \zeta_i = (x_i(\cdot) + \gamma_i z_i(\cdot), u_i(\cdot) + \gamma_i v_i(\cdot))$. \oprocend \end{remark} \iffalse \FB{\begin{remark} It may happen that \eqref{eq:fsPRONTO_desc} is not well posed at each iteration, i.e., the second derivative of $g$ is not positive definite. If that happens, a quasi-Newton search direction can be found by calculating % \begin{align*} \zeta_i = & \mathop{\rm argmin}_{\zeta\in T_{\xi_i}\mathcal{T}} \newcommand{\UU}{\mathcal{U}} \, Dg(\xi_i)\cdot \zeta + \textstyle \frac{1}{2} \tilde{q}(\xi_{i})\cdot(\zeta,\zeta) \\ \text{subj. to} \: & \: (\pi_1\zeta_i) (T) = 0, \end{align*} % in place of~\eqref{eq:fsPRONTO_desc}, where $\tilde{q}(\xi_i)$ is a suitable positive definite approximation of $D^2g(\xi_i)$ (e.g., a Gauss-Newton approximation). \oprocend \end{remark} } \FB{\begin{remark} The line-search step in~\eqref{eq:fsPRONTO_linesearch} acts like a \emph{scaling factor} for the descent direction and has an influence on the terminal state of $\zeta_i$ as well. In order to counteract this influence, we design a descent direction having a zero terminal state, so that the scaling factor is ineffective. \oprocend \end{remark} } \FB{ \begin{remark} The PRONTO is shown to provide locally quadratic convergence (see~\cite{Hauser02}). The numerical simulations conjecture that this rate is preserved for the proposed fsPRONTO. However, proving local quadratic convergence for the fsPRONTO is subject of ongoing research. \oprocend \end{remark} } \fi \section{Numerical Computations} \label{sec:simulations} In this section we provide numerical computations showing the effectiveness of the proposed nonlinear algorithm. We solve the optimal state transfer problem for a driven inverted pendulum. We consider the problem \begin{align*} \underset{(x(\cdot),u(\cdot))}{\text{minimize}} \: & \: \int_0^T \textstyle\frac{1}{2} \big \|x(\tau)-x_d(\tau) \big \|^2_Q +\textstyle\frac{1}{2} \big \|u(\tau)-u_d(\tau) \big \|^2_R \,\d\tau \\ \text{subject to}} \newcommand{\maximize}{\text{maximize} \: & \: \left[\rule{0cm}{0.6cm} \begin{matrix} \dot{x}_1 \\[0.1cm] \dot{x}_2 \end{matrix} \right] = \begin{bmatrix} x_2 \\ \dfrac{g}{L}\sin x_1 - \dfrac{u}{L}\cos x_1 \end{bmatrix}, \: \begin{matrix} x(0) = x_0, \\[0.25em] x(T) = x_T,\end{matrix} \end{align*} with $L = 0.5$ m being the length of the pendulum and $g$ the gravity acceleration. We set the time horizon to $T=20$s. Moreover, $(x_d(\cdot), u_d(\cdot))$ is a (continuous) desired curve, $Q\in{\mathbb{R}}^{2\times 2}$ is a symmetric, positive-definite matrix and $R$ is a positive scalar. Before testing the fsPRONTO algorithm, we highlight the applicability of the final-state constrained projection operator presented in Algorithm~\ref{alg:cpo}. \begin{figure*}[!ht] \centering \hspace{-0.2cm} \includegraphics[scale=0.4]{fig_x1}\hspace{-0.21cm} \includegraphics[scale=0.4]{fig_x2}\hspace{-0.21cm} \includegraphics[scale=0.4]{fig_u} \caption{Evolution of $x_1$, $x_2$ and $u$ through the iterations of fsPRONTO (Algorithm~\ref{alg:fsPRONTO}). The desired curve (dashed blue), the initial (feasible) trajectory (dashed-dot green) and the optimal trajectory (solid red) are depicted. Intermediate (feasible) trajectories are plotted with light dotted lines.} \label{fig:fsPRONTO_iters} \vspace{-0.4cm} \end{figure*} We consider a given curve $\xi$ which is not a feasible trajectory of the inverted pendulum. The projected state $x_{1}$ is depicted in Figure~\ref{fig:fs_proj_oper_iters_x1}. Both projections $\PP(\xi)$ (in magenta) and $\PP_{c}(\xi)$ (in red) provide a trajectory close to the curve $\xi$ (in green). However, when closely checking the terminal state, one can see that only the trajectory projected under $\PP_c(\xi)$ satisfies the terminal constraint. \begin{figure}[!th] \centering \includegraphics[scale=0.4]{fig_cpo_x1} \caption{ Final-state constrained projection operator: $x_1$ state component. Specifically, the unfeasible curve $\xi$ (solid green), the standard projection $\PP(\xi)$ (dashed-dot magenta) and the constrained projection $\PP_c(\xi)$ (dashed-dot red) are depicted. } \label{fig:fs_proj_oper_iters_x1} \vspace{-0.4cm} \end{figure} Next, we apply the fsPRONTO (Algorithm~\ref{alg:fsPRONTO}) in order to optimize the trajectory of an inverted pendulum. We use $Q = \diag(100,1)$ and $R=1$ as cost parameters. The choice of a higher penalty on the first component $x_1$ of the least-square distance will result in an optimal solution (solid red) which almost overlaps the first component of the desired curve (dashed-dot blue) as shown in Figure~\ref{fig:fsPRONTO_iters}. It is worth nothing that, as expected, the algorithm guarantees recursive feasibility. In fact, the terminal error, highlighted in the inset, is zero at each iteration for both the state components. In Figure~\ref{fig:conv_rate} the descent at each iteration, in logarithmic scale, is depicted. It gives a measure of the rate of convergence of the algorithm which appears to be quadratic. \begin{figure}[!ht] \centering \includegraphics[scale=0.4]{fig_log10descent} \caption{Convergence Rate of fsPRONTO Algorithm.} \label{fig:conv_rate} \end{figure} \section{Conclusions} In this paper we have presented a new numerical approach for solving final-state constrained optimal control problems. The main advantage of the proposed method is that it guarantees recursive feasibility of both the dynamics and the final-state constraint at each iteration. Specifically, we have proposed a Newton method, inspired to the one introduced in \cite{Hauser02}, based on: (i) the design of a final-state constrained projection operator, being able to find a trajectory satisfying the final constraint, and (ii) the computation of a descent direction satisfying the final constraint to first-order. \begin{small} \bibliographystyle{IEEEtran}
{'timestamp': '2017-03-27T02:06:13', 'yymm': '1703', 'arxiv_id': '1703.08356', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08356'}
arxiv
\section{Introduction} Multipair multiple-input multiple-output (MIMO) relaying networks have recently attracted considerable attention since they can provide a cost-effective way of achieving performance gains in wireless systems via coverage extension and maintaining a uniform quality of service. In such a system, multiple sources simultaneously exchange information with multiple destinations via a shared multiple-antenna relay in the same time-frequency resource. Hence, multi-user interference is the primary system bottleneck. The deployment of massive antenna arrays at the relay has been proposed to address this issue due to their ability to suppress interference, provide large array and spatial multiplexing gains, and in turn to yield large improvements in spectral and energy efficiency \cite{H.Xie1,H.Xie3,C.Kong1,C.Kong2,M.Cheng}. There has recently been considerable research interest in multipair massive MIMO relaying systems. For example, \cite{S.Jin} derived the ergodic rate of the system when maximum ratio combining/maximum ratio transmission (MRC/MRT) beamforming is employed and showed that the energy efficiency gain scales with the number of relay antennas in Rayleigh fading channels. Then, \cite{X.Wang} extended the analysis to the Ricean fading case and obtained similar power scaling behavior. For full-duplex systems, \cite{H.Q.Ngo,Z.Zhang} analytically compared the performance of MRC/MRT and zero-forcing reception/transmission and characterized the impact of the number of user pairs on the spectral efficiency. All the aforementioned works are based on the assumption of perfect hardware. However, a large number of antennas at the relay implies a very large deployment cost and significant energy consumption if a separate RF chain is implemented for each antenna in order to maintain full beamforming flexibility. In particular, the fabrication cost, chip area and power consumption of the analog-to-digital converters (ADCs) and the digital-to-analog converters (DACs) grow roughly exponentially with the number of quantization bits \cite{J.Yoo,R.H.Walden}. The cumulative cost and power required to implement a relay with a very large array can be prohibitive, and thus it is desirable to investigate the use of cheaper and more energy-efficient components, such as low-resolution (e.g., one bit) ADCs and DACs. Fortunately, it has been shown in \cite{Y.Li3,Y.Li2} that large arrays exhibit a certain resilience to RF hardware impairments that could be caused by such low-cost components. \subsection{Related Work} Several recent contributions have investigated the impact of low-resolution ADCs on the massive MIMO uplink \cite{L.Fan,J.Zhang,L.Fan2,D.Verenzuela,Y.Li1,J.Choi2,C.Mollen,J.Mo,W.Tan,N.Liang}. For example, \cite{L.Fan2} optimized the training pilot length to maximize the spectral efficiency, while \cite{D.Verenzuela} revealed that in terms of overall energy efficiency, the optimal level of quantization is 4-5 bits. In \cite{Y.Li1}, the Bussgang decomposition \cite{J.J.Bussgang} was used to reformulate the nonlinear quantization using a second-order statistically equivalent linear operator, and to derive a linear minimum mean-squared error (LMMSE) channel estimator for one-bit ADCs. In \cite{J.Choi2}, a near-optimal low complexity bit allocation scheme was presented for millimeter wave channels exhibiting sparsity. The work of \cite{C.Mollen} examined the impact of one-bit ADCs on wideband channels with frequency-selective fading. Other work has focused on balancing the spectral and energy efficiency, either through the combined use of hybrid architectures with a small number of RF chains and low resolution ADCs, or using mixed ADCs architectures with high and low resolution. In contrast to the uplink case, there are relatively fewer contributions that consider the massive MIMO downlink with low-resolution DACs. In \cite{S.Jacobsson}, it was shown that performance approaching the unquantized case can be achieved using DACs with only 3-4 bits of resolution. The nearly optimal quantized Wiener precoder with low-resolution DACs was studied in \cite{A.Mezghani4}, and the resulting solution was shown to outperform the conventional Wiener precoder with 4-6 bits of resolution at high signal-to-noise ratio (SNR). For the case of one-bit DACs, \cite{J.Guerreiro,Y.Li4} showed that even simple MRT precoding can achieve reasonable results. In \cite{O.B.Usman}, an LMMSE precoder was proposed by taking the quantization non-linearities into account, and different precoding schemes were compared in terms of uncoded bit error rate. \subsection{Contributions} All these prior works are for single-hop systems rather than dual-hop connections via a relay. Recently, \cite{J.Liu} considered a relay-based system that uses mixed-resolution ADCs at the base station. Unlike \cite{J.Liu}, we consider a multipair amplify-and-forward (AF) relaying system where the relay uses both one-bit ADCs and one-bit DACs. The one-bit ADCs cause errors in the channel estimation stage and subsequently in the reception of the uplink data; then, after a linear transformation, the one-bit DACs produce distortion when the downlink signal is coarsely quantized. In this paper, we present a detailed performance investigation of the achievable rate of such doubly quantized systems. In particular, the main contributions are summarized as follows: \begin{itemize} \item We investigate a multipair AF relaying system that employs one-bit ADCs and DACs at the relay and uses MRC/MRT beamforming to process the signals. We take the correlation of the quantization noise into account, and present an exact achievable rate by using the arcsine law. Then, we use asymptotic arguments to provide an approximate closed-form expression for the achievable rate. Numerical results demonstrate that the approximate rate is accurate in typical massive MIMO scenarios, even with only a moderate number of users. \item We show that the channel estimation accuracy of the quantized system depends on the specific orthogonal pilot matrix that is used, which is in contrast to unquantized systems where any orthogonal pilot sequence yields the same result. We consider the specific case of identity and Hadamard pilot matrices, and we show that the identity training scheme provides better channel estimation performance for users with weaker than average channels, while the Hadamard training sequence is better for users with stronger channels. \item We compare the achievable rate of different ADC and DAC configurations, and show that a system with one-bit DACs and perfect ADCs outperforms a system with one-bit ADCs and perfect DACs. Focusing on the low transmit power regime, we show that the sum rate of the relay system with one-bit ADCs and DACs is $4/\pi^2$ times that achievable with perfect ADCs and DACs. Also, it is shown that the transmit power of each source or the relay can be reduced inversely proportional to the number of relay antennas, while maintaining a given quality-of-service. \item We formulate a power allocation problem to allocate power to each source and the relay, subject to a sum power budget. Locally optimum solutions are obtained by solving a sequence of geometric programming (GP) problems. Our numerical results suggest that the power allocation strategy can efficiently compensate for the rate degradation caused by the coarse quantization. \end{itemize} \subsection{Paper Outline and Notations} The remainder of the paper is organized as follows. Section \ref{sec:system_model} introduces the multipair AF relaying system model under consideration. Section \ref{sec:rate_analysis} presents an approximate closed-form expression for the sum rate, and compares the rate achieved with different ADC and DAC configurations. Section \ref{sec:power_allocation} formulates a power allocation problem to compensate for the rate loss caused by the coarse quantization. Numerical results are provided in Section \ref{sec:numerical_results}. Finally, Section \ref{sec:conclusions} summarizes the key findings. {\it Notation}: We use bold upper case letters to denote matrices, bold lower case letters to denote vectors and lower case letters to denote scalars. The notation $(\cdot)^{H}$, $(\cdot)^{*}$, $(\cdot)^{T}$, and $(\cdot)^{-1}$ respectively represent the conjugate transpose operator, the conjugate operator, the transpose operator, and the matrix inverse. The Euclidian norm is denoted by $|| \cdot ||$, the absolute value by $| \cdot |$, and ${\left[ {\bf{A}} \right]_{mn}}$ represents the $(m,n)$-th entry of $\bf{A}$. Also, ${\bf x} \thicksim {{\cal CN} ({\bf 0},{\bf \Sigma})}$ denote a circularly symmetric complex Gaussian random vector with zero mean and covariance matrix ${\bf \Sigma}$, while ${{\bf{I}}_k}$ is the identity matrix of size $k$. The symbol $\otimes$ is the Kronecker product, $\text{vec}\left(\bf A \right)$ represents a column vector containing the stacked columns of matrix $\bf A$, $\text{diag}\left(\bf B\right)$ denotes a diagonal matrix formed by the diagonal elements of matrix $\bf B$, $\Re\left( \bf C \right)$ and $\Im\left( \bf C \right)$ stand for the real and imaginary part of $\bf C $, respectively. Finally, the statistical expectation operator is represented by ${\tt E}\{\cdot\}$, the variance operator is ${\text{Var}} \left(\cdot\right)$, and the trace is denoted by ${\text{tr}}\left(\cdot\right)$. \section{System Model}\label{sec:system_model} Consider a multipair relaying system with one-bit quantization, as shown in Fig. \ref{fig:system_model}. There are $K$ single-antenna user pairs, denoted as ${\text S}_k$ and ${\text D}_{k}$, $k = 1,\ldots,K$, intending to exchange information with each other with the assistance of a shared relay. The relay is equipped with $M$ receive antennas with one-bit ADCs and $M$ transmit antennas with one-bit DACs. The one-bit ADCs cause errors in the channel estimation stage and subsequently in the reception of the uplink data; then, after a linear transformation, the one-bit DACs produce distortion when the downlink signal is coarsely quantized. Thus, the system we study is double quantized. We assume that direct links between ${\text S}_{k}$ and ${\text D}_{k}$ do not exist due to large obstacles or severe shadowing. In addition, we further assume that the relay operates in half-duplex mode, and hence it cannot receive and transmit signals simultaneously. Accordingly, information transmission from ${\text S}_k$ to ${\text D}_{k}$ is completed in two phases. In the first phase, the $K$ sources transmit independent data symbols to the relay, and in the second phase the relay broadcasts the double-quantized signals ${\bf{\tilde x}}_\text R$ to the destinations. The signals at the relay's receive antennas and at the destinations before quantization are respectively given by \begin{align}\label{eq:yR} {\bf y}_{\text R} &= {\bf G}_\text{SR} {\bf P_\text S}^{1/2} {\bf x}_{\text S} + {\bf n}_{\text R}\\ \label{eq:yD} {\bf y}_\text D &= \gamma {\bf G}_\text{RD}^T {\bf{\tilde x}}_\text R + {\bf n}_\text D, \end{align} where $\gamma$ is chosen to satisfy a total power constraint $p_\text R$ at the relay, i.e., ${\tt E}\left\{||\gamma{\bf{\tilde x}}_\text R ||^2 \right\} = p_\text R$, which will be specified shortly. The source symbols are represented by ${\bf x}_{\text S} = [{ x}_{{\text S},1},\ldots,{ x}_{{\text S},K}]^T$, whose elements are assumed to be Gaussian distributed with zero mean and unit power. ${\bf P_\text S}$ is a diagonal matrix that denotes the transmit power of the sources with $\left[{\bf P}_\text S\right]_{kk} = p_{{\text S},k}$. The vectors ${\bf n}_{\text R}$ and ${\bf n}_\text D$ represent additive white Gaussian noise (AWGN) at the relay and destinations, whose elements are both identically and independently distributed (i.i.d.) ${\cal{CN}}(0,1)$. Note that to keep the notation clean and without loss of generality, we take the noise variance to be $1$ here, and also in the subsequent sections. With this convention, $p_\text S$ and also the subsequent transmit powers can be interpreted as the normalized SNR. The matrices ${\bf G}_\text{SR} = [{\bf g}_{{\text {SR}},1},\ldots,{\bf g}_{{\text {SR}},K}]$ and ${\bf G}_\text{RD} = [{\bf g}_{{\text {RD}},1},\ldots,{\bf g}_{{\text {RD}},K}]$ respectively represent the uncorrelated Rayleigh fading channels from the $K$ sources to the relay with ${\bf g}_{{\text {SR}},k} \in {\cal{CN}}\left(0,\beta_{\text{SR},k}{\bf I}_{M}\right)$ and the channels from the relay to the $K$ destinations with ${\bf g}_{{\text {RD}},k} \in {\cal{CN}}\left(0,\beta_{\text{RD},k}{\bf I}_{M}\right)$. The terms $\beta_{\text{SR},k}$ and $\beta_{\text{RD},k}$ model the large-scale path-loss, which is assumed to be constant over many coherence intervals and known a priori. \begin{figure}[!ht] \centering \includegraphics[scale=0.22]{system_model.eps} \caption{Illustration of the multipair half-duplex relaying with one-bit ADCs and DACs.}\label{fig:system_model} \end{figure} \subsection{Channel Estimation} We assume training pilots are used to estimate the channel matrices ${\bf G}_\text{SR}$ and ${\bf G}_\text{RD}$, as in other massive MIMO AF relaying systems \cite{F.Gao}. Therefore, during each coherence interval of length $\tau_\text c$ (in symbols), all sources simultaneously transmit their mutually orthogonal pilot sequences ${\bf \Phi}_\text S \in \mathbb{C}^{{\tau_\text p} \times K}$ satisfying ${\bf \Phi}_\text S^H {\bf \Phi}_\text S = \tau_\text p {\bf I}_K$ to the relay while the destinations remain silent ($\tau_\text p \ge K$). Afterwards, all destinations simultaneously transmit their mutually orthogonal pilot sequences ${\bf \Phi}_\text D \in \mathbb{C}^{{\tau_\text p} \times K}$ satisfying ${\bf \Phi}_\text D^H {\bf \Phi}_\text D = \tau_\text p {\bf I}_K$ to the relay while the sources remain silent. Since the channels ${\bf G}_\text{SR}$ and ${\bf G}_\text{RD}$ are estimated in the same fashion, we focus only on the first link ${\bf G}_\text{SR}$. The received training signal at the relay is given by \begin{align} {\bf Y}_{\text p} = \sqrt{p_\text p} {\bf G}_\text{SR} {\bf \Phi}_\text S^T + {\bf N}_{\text p}, \end{align} where $p_\text p$ represents the transmit power of each pilot symbol, and ${\bf N}_\text p$ denotes the noise at the relay, which has i.i.d. ${\cal{CN}}\left(0,1\right)$ elements. After vectorizing the matrix ${\bf Y}_{\text p}$, we obtain \begin{align} {\bf y}_\text p = \text{vec} \left({\bf Y}_{\text p} \right) = \bar{\bf \Phi}_\text S \bar{\bf g}_\text{SR} + \bar{\bf n}_\text p, \end{align} where ${\bar{\bf \Phi}}_\text{S} = {\bf \Phi}_\text{S} \otimes \sqrt{p_\text p} {\bf I}_{M}$, ${\bar{\bf g}}_\text{SR} = \text{vec}\left({\bf G}_\text{SR}\right)$, and $\bar{\bf n}_\text p = \text{vec}\left({\bf N}_{\text p}\right)$. \subsubsection{One-bit ADCs} After the one-bit ADCs, the quantized signal can be expressed as \begin{align} {\bf r}_\text p = {\cal Q}\left({\bf y}_\text p\right), \end{align} where ${\cal Q}\left(\cdot\right)$ denotes the one-bit quantization operation, which separately processes the real and imaginary parts of the signal. Therefore, the output set of the one-bit ADCs is $\frac{1}{\sqrt 2}\left\{\pm 1\pm 1j\right\}$. Using the Bussgang decomposition \cite{J.J.Bussgang,A.Mezghani}, ${\bf r}_{\text p}$ can be represented by a linear signal component and an uncorrelated quantization noise ${\bf q}_{\text p}$: \begin{align} {\bf r}_\text p = {\bf A}_\text p {\bf y}_\text p + {\bf q}_\text p, \end{align} where ${\bf A}_\text p$ is the linear operator obtained by minimizing the power of the quantization noise ${\tt E}\left\{||{\bf q}_{\text p}||^2 \right\}$: \begin{align}\label{eq:Aa} {\bf A}_{\text p} = {\bf R}_{{\bf y}_{\text p} {\bf{ r}}_{\text p}}^H {\bf R}_{{\bf y}_{\text p} {\bf y}_{\text p}}^{-1}, \end{align} where ${\bf R}_{{\bf y}_{\text p} {\bf{r}}_{\text p}}$ denotes the cross-correlation matrix between the received signal ${\bf y}_{\text p}$ and the quantized signal ${\bf{r}}_{\text p}$, and ${\bf R}_{{\bf y}_{\text p} {\bf{y}}_{\text p}}$ represents the auto-correlation matrix of ${\bf y}_{\text p}$, which is computed as \begin{align}\label{eq:R_yy} {\bf R}_{{\bf y}_{\text p} {\bf y}_{\text p}} = {\bar{\bf \Phi}}_\text S {\tilde{\bf D}}_\text{SR} {\bar{\bf \Phi}}_\text S^H + {\bf I}_{M \tau_\text p}, \end{align} where ${\tilde{\bf D}}_\text{SR} = \left({\bf D}_\text{SR} \otimes {\bf I}_{M}\right)$ and ${\bf D}_\text{SR}$ is a diagonal matrix whose elements are $\left[{\bf D}_\text{SR}\right]_{kk} = \beta_{\text{SR},k}$ for $k = 1,\ldots, K$. For one-bit quantization, by invoking the results in \cite[Chapter 10]{A.Papoulis} and applying the arcsine law \cite{G.Jacovitti}, we have \begin{align}\label{eq:Ryy_tilde} {\bf R}_{{\bf y}_{\text p} {\bf{r}}_{\text p}} &= \frac{2}{\pi} {\bf R}_{{\bf y}_{\text p} {\bf y}_{\text p}} {\text{diag}} \left( {\bf R}_{{\bf y}_{\text p} {\bf y}_{\text p}} \right)^{-1/2}\\ {\bf R}_{{\bf{r}}_{\text p} {\bf{r}}_{\text p}} &= \frac{2}{\pi} \left( {\text{arcsin}} \left( {\bf J}\right) + j {\text{arcsin}} \left( {\bf K} \right) \right), \label{eq:Ry_tilde} \end{align} where \begin{align} {\bf J} &= {\text{diag}} \left( {\bf R}_{{\bf y}_{\text p} {\bf y}_{\text p}} \right)^{-1/2} \Re\left( {\bf R}_{{\bf y}_{\text p} {\bf y}_{\text p}} \right) {\text{diag}} \left( {\bf R}_{{\bf y}_{\text p} {\bf y}_{\text p}} \right)^{-1/2} \\ {\bf K} &= {\text{diag}} \left( {\bf R}_{{\bf y}_{\text p} {\bf y}_{\text p}} \right)^{-1/2} \Im \left( {\bf R}_{{\bf y}_{\text p} {\bf y}_{\text p}} \right) {\text{diag}} \left( {\bf R}_{{\bf y}_{\text p} {\bf y}_{\text p}} \right)^{-1/2}. \end{align} Substituting \eqref{eq:Ryy_tilde} into \eqref{eq:Aa}, and after some simple mathematical manipulations, we have \begin{align}\label{eq:Ap:diag} {\bf A}_{\text p} = \sqrt{\frac{2}{\pi}} {\text{diag}} \left( {\bf R}_{{\bf y}_{\text p} {\bf y}_{\text p}} \right)^{-1/2}. \end{align} Since ${\bf q}_{\text p}$ is uncorrelated with ${\bf y}_{\text p}$, we have \begin{align}\label{eq:R_qp} {\bf R}_{{\bf q}_{\text p} {\bf q}_{\text p}} = {\bf R}_{{\bf{r}}_{\text p} {\bf{r}}_{\text p}} - {\bf A}_{\text p} {\bf R}_{{\bf y}_{\text p} {\bf{y}}_{\text p}} {\bf A}_{\text p}^H. \end{align} Substituting \eqref{eq:Ry_tilde} into \eqref{eq:R_qp} yields \begin{align}\label{eq:R_qp:arcsine} {\bf R}_{{\bf q}_{\text p} {\bf q}_{\text p}} = \frac{2}{\pi} \left( {\text{arcsin}} \left( {\bf J}\right) + j {\text{arcsin}} \left( {\bf K} \right) \right) - \frac{2}{\pi} \left({\bf J} + j {\bf K} \right). \end{align} \subsubsection{LMMSE estimator} Based on the observation ${\bf r}_\text p$ and the training pilots ${\bf \Phi}_\text S$, we use the LMMSE technique to estimate ${\bf G}_\text{SR}$. Hence, the estimated channel ${\hat{\bf g}}_\text{SR}$ is given by \begin{align} {\hat{\bf g}}_\text{SR} = {\bf R}_{{\bar{\bf g}}_\text{SR} {\bf r}_\text p} {\bf R}_{{\bf r}_\text p {\bf r}_\text p}^{-1} {\bf r}_\text p. \end{align} As a result, the covariance matrix of the estimated channel ${\hat{\bf g}}_\text{SR}$ is expressed as \begin{align}\label{eq:R:g_hat_SR} &{\bf R}_{{\hat{\bf g}}_\text{SR} {\hat{\bf g}}_\text{SR}} = \\ \notag &{\tilde{\bf D}}_\text{SR} {\tilde{\bf \Phi}}_\text S^H \left({\tilde{\bf \Phi}}_\text S {\tilde{\bf D}}_\text{SR} {\tilde{\bf \Phi}}_\text S^H + {\bf A}_\text p {\bf A}_\text p^H + {\bf R}_{{\bf q}_{\text p} {\bf q}_{\text p}} \right)^{-1} {\tilde{\bf \Phi}}_\text S {\tilde{\bf D}}_\text{SR}, \end{align} where ${\tilde{\bf \Phi}}_\text S = {\bf A}_\text p {\bar{\bf \Phi}}_\text S$. \begin{remark} From \eqref{eq:R:g_hat_SR}, we can see that ${\bf R}_{{\hat{\bf g}}_\text{SR} {\hat{\bf g}}_\text{SR}}$ is a non-trivial function of ${\tilde{\bf \Phi}}_\text S$, which indicates that the quality of the channel estimates depends on the specific realization of the pilot sequence, which is contrary to unquantized systems where any set of orthogonal pilot sequences gives the same result. \end{remark} \begin{remark} Although our conclusion in {\em Remark 1} is obtained based on the LMMSE estimator, it also holds for the maximum likelihood estimator \cite{M.T.Ivrlac}. \end{remark} In the following, we study the performance of two specific pilot sequences to show how the pilot matrix affects the channel estimation. Here, we choose $\tau_\text p = K$, which is the minimum possible length of the pilot sequence. a) \textit{\underline{Identity Matrix}}. In this case, ${\bf{\Phi}}_\text S = \sqrt{K} {\bf I}_K$, and hence we have \begin{align} {\bf R}_{{\bf y}_{\text p} {\bf y}_{\text p}} = K p_\text p {\tilde{\bf D}}_\text{SR} + {\bf I}_{M K}. \end{align} Consequently, \begin{align}\label{eq:Ap:case1} {\bf A}_{\text p} &= \sqrt{\frac{2}{\pi}} \left( K p_\text p {\tilde{\bf D}}_\text{SR} + {\bf I}_{M K} \right)^{-1/2} = {\bar{\bf A}}_\text p \otimes {\bf I}_{M}\\ {\bf R}_{{\bf q}_{\text p} {\bf q}_{\text p}} &= \left(1 - \frac{2}{\pi} \right) {\bf I}_{M K}, \label{eq:Rqp:case1} \end{align} where ${\bar{\bf A}}_\text p$ is a diagonal matrix with $\left[{\bar{\bf A}}_\text p\right]_{kk} = \alpha_{\text p,k}= \sqrt{\frac{2}{\pi} \frac{1}{K p_\text p \beta_{\text{SR},k} + 1}}$. Substituting \eqref{eq:Ap:case1} and \eqref{eq:Rqp:case1} into \eqref{eq:R:g_hat_SR}, we obtain \begin{align} {\bf R}_{{\hat{\bf g}}_\text{SR} {\hat{\bf g}}_\text{SR}} = {\bf Q}_\text{SR}^{\left(1\right)} \otimes {\bf I}_{M}, \end{align} where ${\bf Q}_\text{SR}^{\left(1\right)}$ is a diagonal matrix with elements \begin{align}\label{eq:sigma_SR} \left[{\bf Q}_\text{SR}^{\left(1\right)} \right]_{kk} = \sigma_{\text{SR},k}^2 = \frac{2}{\pi} \frac{K p_\text p \beta_{\text{SR},k}^2}{K p_\text p \beta_{\text{SR},k} + 1}. \end{align} b) \textit{\underline{Hadamard Matrix}}. In this case, every element of ${\bf{\Phi}}_\text S$ is $+1$ or $-1$, and hence we have \begin{align}\label{eq:Ap:case2} {\bf A}_\text p &= \sqrt{\frac{2}{\pi} \frac{1}{p_\text p \sum\limits_{n=1}^K \beta_{\text{SR},k} + 1}} {\bf I}_{M K} \\ {\bf R}_{{\bf q}_{\text p} {\bf q}_{\text p}} &\approx \left(1 - \frac{2}{\pi} \right) {\bf I}_{M K}, \label{eq:Rqp:case2} \end{align} where the approximation in \eqref{eq:Rqp:case2} holds for low $p_\text p$. Substituting \eqref{eq:Ap:case2} and \eqref{eq:Rqp:case2} into \eqref{eq:R:g_hat_SR}, we obtain \begin{align} {\bf R}_{{\hat{\bf g}}_\text{SR} {\hat{\bf g}}_\text{SR}} = {\bf Q}_\text{SR}^{\left(2\right)} \otimes {\bf I}_{M}, \end{align} where ${\bf Q}_\text{SR}^{\left(2\right)}$ is a diagonal matrix with entries \begin{align} \left[{\bf Q}_\text{SR}^{\left(2\right)} \right]_{kk} = \kappa_{\text{SR},k}^2 = \frac{K {\bar\alpha}_{\text p}^2 \beta_{\text{SR},k}^2 p_\text p}{K {\bar\alpha}_{\text p}^2 \beta_{\text{SR},k} p_\text p + {\bar\alpha}_{\text p}^2 + 1 - \frac{2}{\pi}}, \end{align} where \begin{align} {\bar\alpha}_\text p = \sqrt{\frac{2}{\pi}\frac{1}{p_\text p \sum\limits_{k=1}^K\beta_{\text{SR},k} + 1}}. \end{align} For both cases, the channels from the sources to the relay ${\bf g}_{\text{SR},k}$ can be decomposed as \begin{align} {\bf g}_{\text{SR},k} = {\bf{\hat g}}_{\text{SR},k} + {\bf e}_{\text{SR},k}, \end{align} where ${\bf e}_{\text{SR},k}$ is the estimation error vector. The elements of ${\bf{\hat g}}_{\text{SR},k}$ and ${\bf e}_{\text{SR},k}$ are respectively distributed as ${\cal{CN}}(0, \sigma_{\text{SR},k}^2 )$ and ${\cal{CN}}(0, {\tilde\sigma}_{\text{SR},k}^2 )$ when ${\bf \Phi}_\text{SR}$ is an identity matrix, while they are distributed as ${\cal{CN}}(0, \kappa_{\text{SR},k}^2 )$ and ${\cal{CN}}(0, {\tilde\kappa}_{\text{SR},k}^2)$ when ${\bf \Phi}_\text{SR}$ is a Hadamard matrix, where ${\tilde\sigma}_{\text{SR},k}^2 = \beta_{\text{SR},k} - \sigma_{\text{SR},k}^2$ and ${\tilde\kappa}_{\text{SR},k}^2 = \beta_{\text{SR},k} - \kappa_{\text{SR},k}^2$. In what follows we define ${\bf{\hat G}}_\text{SR} = [{\bf{\hat g}}_{{\text {SR}},1},\ldots,{\bf{\hat g}}_{{\text {SR}},K}]$ and ${\bf E}_\text{SR} = [{\bf e}_{{\text {SR}},1},\ldots,{\bf e}_{{\text {SR}},K}]$. Similarly, the channels from the relay to the destinations ${\bf g}_{\text{RD},k}$ can be decomposed as \begin{align} {\bf g}_{\text{RD},k} = {\bf{\hat g}}_{\text{RD},k} + {\bf e}_{\text{RD},k}, \end{align} where ${\bf{\hat g}}_{\text{RD},k}$ and ${\bf e}_{\text{RD},k}$ are the estimated channel and estimation error vectors. The elements of ${\bf{\hat g}}_{\text{RD},k}$ and ${\bf e}_{\text{RD},k}$ are distributed as ${\cal{CN}}(0, \sigma_{\text{RD},k}^2 )$ and ${\cal{CN}}(0, {\tilde\sigma}_{\text{RD},k}^2 )$ when ${\bf \Phi}_\text{RD}$ is an identity matrix, while they are ${\cal{CN}}(0, \kappa_{\text{RD},k}^2 )$ and ${\cal{CN}}(0, {\tilde\kappa}_{\text{RD},k}^2 )$ when ${\bf \Phi}_\text{RD}$ is a Hadamard matrix, where \begin{align}\label{eq:sigma_RD} \sigma_{\text{RD},k}^2 &= \frac{2}{\pi} \frac{K p_\text p \beta_{\text{RD},k}^2}{K p_\text p \beta_{\text{RD},k} + 1}\\ \kappa_{\text{RD},k}^2 &= \frac{K {\hat\alpha}_{\text p}^2 \beta_{\text{RD},k}^2 p_\text p}{K {\hat\alpha}_{\text p}^2 \beta_{\text{RD},k} p_\text p + {\hat\alpha}_{\text p}^2 + 1 - \frac{2}{\pi}}, \end{align} with \begin{align} {\hat\alpha}_\text p = \sqrt{\frac{2}{\pi}\frac{1}{p_\text p \sum\limits_{k=1}^K\beta_{\text{RD},k} + 1}}, \end{align} and ${\tilde\sigma}_{\text{RD},k}^2 = \beta_{\text{RD},k} - \sigma_{\text{RD},k}^2$, ${\tilde\kappa}_{\text{RD},k}^2 = \beta_{\text{RD},k} - \kappa_{\text{RD},k}^2$. We also define ${\bf{\hat G}}_\text{RD} = [{\bf{\hat g}}_{{\text {RD}},1},\ldots,{\bf{\hat g}}_{{\text {RD}},K}]$ and ${\bf E}_\text{RD} = [{\bf e}_{{\text {RD}},1},\ldots,{\bf e}_{{\text {RD}},K}]$. For the channel from the \emph{k}-th source to the relay, the mean-square error (MSE) is given by \begin{align} \text{MSE}_{\text{SR},k} = {\tt E}\left\{ ||{\bf{\hat g}}_{\text{SR},k} - {\bf{ g}}_{\text{SR},k}||^2 \right\}. \end{align} Based on the above results, we have $\text{MSE}_{\text{SR},k} = {\tilde\sigma}_{\text{SR},k}^2$ for the identity matrix and $\text{MSE}_{\text{SR},k} = {\tilde\kappa}_{\text{SR},k}^2$ for the Hadamard matrix. The following proposition compares the MSE of the two approaches. \begin{proposition}\label{theor:pilot_matrix} For estimating the channel ${\bf g}_{\text{SR},k}$, the identity matrix is preferable to the Hadamard matrix for user $k$ if $\beta_{\text{SR},k} < \frac{1}{K} \sum\limits_{i=1}^K \beta_{\text{SR},i}$, and vice versa. \end{proposition} \proof The proof is trivial since ${\tilde\sigma}_{\text{SR},k}^2 < {\tilde\kappa}_{\text{SR},k}^2$ if $\beta_{\text{SR},k} < \frac{1}{K} \sum\limits_{i=1}^K \beta_{\text{SR},i}$. \endproof Proposition \ref{theor:pilot_matrix} reveals that the accuracy of the individual channel estimates depends on the particular choice of the orthogonal training scheme, contrary to the ideal case without quantization. More precisely, the scaled identity matrix is beneficial for any user with higher path loss than the average. This is because a weak user benefits from being the only one transmitting at a given time, without the presence of stronger users that dominate the behavior of the ADC. In the case of Hadamard matrix, all users are transmitting simultaneously, resulting in an average quantization noise level for all users jointly, which is advantageous for users with stronger channels. The question of optimizing the pilot sequence for a given performance metric is an interesting one, but is beyond the scope of the paper. For simplicity, we will assume the identity matrix approach in which each user's channel is estimated one at a time. \subsection{Data Transmission} \subsubsection{Quantization with One-bit ADCs} With one-bit ADCs at the receiver, the resulting quantized signals can be expressed as \begin{align}\label{eq:yR_tilde} {\bf{\tilde y}}_{\text R} = {\cal Q}\left( {\bf y}_{\text R} \right) = {\bf A}_{\text a} {\bf y}_{\text R} + {\bf q}_{\text a}, \end{align} where ${\bf A}_\text a$ is the linear operator, which is uncorrelated with ${\bf y}_\text R$. By adopting the same technique in the previous subsection, we have \begin{align}\label{eq:Aa:diag} {\bf A}_{\text a} &= \sqrt{\frac{2}{\pi}} {\text{diag}} \left( {\bf R}_{{\bf y}_{\text R} {\bf y}_{\text R}} \right)^{-1/2}\\ {\bf R}_{{\bf q}_{\text a} {\bf q}_{\text a}} &= \frac{2}{\pi} \left( {\text{arcsin}} \left( {\bf X}\right) + j {\text{arcsin}} \left( {\bf Y} \right) \right) - \frac{2}{\pi} \left({\bf X} + j {\bf Y} \right), \label{eq:R_qa:arcsine} \end{align} where \begin{align} \notag {\bf X} &= {\text{diag}} \left( {\bf R}_{{\bf y}_{\text R} {\bf y}_{\text R}} \right)^{-1/2} \Re\left( {\bf R}_{{\bf y}_{\text R} {\bf y}_{\text R}} \right) {\text{diag}} \left( {\bf R}_{{\bf y}_{\text R} {\bf y}_{\text R}} \right)^{-1/2} \\ \notag {\bf Y} &= {\text{diag}} \left( {\bf R}_{{\bf y}_{\text R} {\bf y}_{\text R}} \right)^{-1/2} \Im \left( {\bf R}_{{\bf y}_{\text R} {\bf y}_{\text R}} \right) {\text{diag}} \left( {\bf R}_{{\bf y}_{\text R} {\bf y}_{\text R}} \right)^{-1/2}\\ \notag {\bf R}_{{\bf y}_{\text R} {\bf y}_{\text R}} &= {\bf G}_\text{SR} {\bf P}_\text S {\bf G}_\text{SR}^H + {\bf I}_{M}. \end{align} \subsubsection{Digital Linear Processing} We assume that the relay adopts an AF protocol to process the quantized signals by one-bit ADCs ${\tilde{\bf y}}_\text R$, yielding \begin{align}\label{eq:xR} {\bf x}_\text R = {\bf W} {\bf {\tilde y}}_\text R, \end{align} where ${\bf W} = {\hat{\bf G}}_\text{RD}^* {\hat{\bf G}}_\text{SR}^H$ for MRC/MRT beamforming. \subsubsection{Quantization with One-bit DACs} Assuming one-bit DACs at the transmitter, the resulting quantized signals to be sent by the relay's transmit antennas can be expressed as \begin{align}\label{eq:x_tilde} {\bf{\tilde x}}_\text R = {\cal Q} \left({\bf x}_\text R\right) = {\bf A}_\text d {\bf x}_\text R + {\bf q}_\text d, \end{align} where ${\bf A}_\text d$ is the linear operator, and ${\bf q}_\text d$ is the quantization noise at the relay's transmit antennas, which is uncorrelated with ${\bf x}_\text R$. Due to the one-bit DACs, we have ${\tt E}\left\{||{\bf{\tilde x}}_\text R ||^2 \right\} = M$. Therefore, the normalization factor $\gamma$ (c.f. \eqref{eq:yD}) can be expressed as \begin{align}\label{eq:gamma} \gamma = \sqrt{\frac{p_\text R}{M}}. \end{align} Following in the same fashion as with the ADCs derivations, we obtain \begin{align}\label{eq:Ad} {\bf A}_\text d &= \sqrt{\frac{2}{\pi}} {\text{diag}} \left( {\bf R}_{{\bf x}_{\text R} {\bf x}_{\text R}} \right)^{-1/2}\\ \label{eq:R_qd} {\bf R}_{{\bf q}_{\text d} {\bf q}_{\text d}} &= \frac{2}{\pi} \left( {\text{arcsin}} \left( {\bf U}\right) + j {\text{arcsin}} \left( {\bf V} \right) \right) - \frac{2}{\pi} \left({\bf U} + j {\bf V} \right), \end{align} where \begin{align} \notag {\bf U} &= {\text{diag}} \left( {\bf R}_{{\bf x}_{\text R} {\bf x}_{\text R}} \right)^{-1/2} \Re\left( {\bf R}_{{\bf x}_{\text R} {\bf x}_{\text R}} \right) {\text{diag}} \left( {\bf R}_{{\bf x}_{\text R} {\bf x}_{\text R}} \right)^{-1/2} \\ \notag {\bf V} &= {\text{diag}} \left( {\bf R}_{{\bf x}_{\text R} {\bf x}_{\text R}} \right)^{-1/2} \Im \left( {\bf R}_{{\bf x}_{\text R} {\bf x}_{\text R}} \right) {\text{diag}} \left( {\bf R}_{{\bf x}_{\text R} {\bf x}_{\text R}} \right)^{-1/2}\\ \notag {\bf R}_{{\bf x}_{\text R} {\bf x}_{\text R}} &= {\bf W} {\bf R}_{{\bf{\tilde y}}_{\text R} {\bf{\tilde y}}_{\text R}} {\bf W}^H \\ \notag {\bf R}_{{\bf{\tilde y}}_{\text R} {\bf{\tilde y}}_{\text R}} &= {\bf A}_\text a {\bf R}_{{\bf{ y}}_{\text R} {\bf{ y}}_{\text R}} {\bf A}_\text a^H + {\bf R}_{{\bf q}_{\text a} {\bf q}_{\text a}}. \end{align} \section{Achievable Rate Analysis}\label{sec:rate_analysis} In this section, we investigate the achievable rate of the considered system. In particular, we first provide an expression for the exact achievable rate, which is applicable to arbitrary system configurations. Then we use asymptotic arguments to derive an approximate rate to provide some key insights. \subsection{Exact Achievable Rate Analysis} We consider the realistic case where the $K$ destinations do not have access to the instantaneous CSI, which is a typical assumption in the massive MIMO literature since the dissemination of instantaneous CSI leads to excessively high computational and signaling costs for very large antenna arrays. Hence, $\text D_k$ uses only statistical CSI to decode the desired signal. Combining \eqref{eq:yR}, \eqref{eq:yD}, \eqref{eq:yR_tilde}, \eqref{eq:xR}, \eqref{eq:x_tilde}, and \eqref{eq:gamma} yields the received signal at the \emph{k}-th destination \begin{align}\label{eq:received_signal_exact} y_{\text D,k} &= \underbrace{\gamma \sqrt{p_{{\text S},k}} {\tt E} \left\{ {\bf g}_{\text{RD},k}^T {\bf A}_\text d {\bf W} {\bf A}_\text a {\bf g}_{\text{SR},k} \right\} x_{\text S,k}}_\text{desired signal} + \underbrace{{\tilde n}_{\text D,k}}_\text{effective noise}, \end{align} where where ${\tilde n}_{\text D,k} = \\ \underbrace{\gamma \sqrt{p_{{\text S},k}} \left( {\bf g}_{\text{RD},k}^T {\bf A}_\text d {\bf W} {\bf A}_\text a {\bf g}_{\text{SR},k} - {\tt E} \left\{ {\bf g}_{\text{RD},k}^T {\bf A}_\text d {\bf W} {\bf A}_\text a {\bf g}_{\text{SR},k} \right\} \right) x_{\text S,k}}_\text{estimation error} \\ + \underbrace{\gamma \sum\limits_{i \neq k} \sqrt{p_{{\text S},i}} {\bf g}_{\text{RD},k}^T {\bf A}_\text d {\bf W} {\bf A}_\text a {\bf g}_{\text{SR},i} x_{\text S,i}}_\text{interpair interference} + \underbrace{\gamma {\bf g}_{\text{RD},k}^T {\bf A}_\text d {\bf W} {\bf A}_\text a {\bf n}_\text R}_\text{noise at the relay} \\ + \underbrace{\gamma {\bf g}_{\text{RD},k}^T {\bf A}_\text d {\bf W} {\bf q}_\text a}_\text{quantization noise of ADCs} + \underbrace{ \gamma {\bf g}_{\text{RD},k}^T {\bf q}_\text d}_\text{quantization noise of DACs} + \underbrace{n_{\text D,k}}_\text{noise at $k$-th destination}$, where $n_{\text D,k}$ is the \emph{k}-th element of the noise vector ${\bf n}_\text D$. Noticing that the ``desired signal'' and the ``effective noise'' in \eqref{eq:received_signal_exact} are uncorrelated, and capitalizing on the fact that the worst-case uncorrelated additive noise is independent Gaussian, we obtain the following achievable rate for the \emph{k}-th destination: \begin{align}\label{eq:rate_exact} &R_k= \\ &\frac{\tau_\text c - 2 \tau_\text p}{2 \tau_\text c} \log_2\left(1 + \frac{A_k}{B_k + C_k + D_k + E_k + F_k + \frac{1}{\gamma^2}} \right), \notag \end{align} where \begin{align} A_k &= p_{{\text S},k} |{\tt E}\left\{ {\bf g}_{\text{RD},k}^T {\bf{ A}}_\text d {\bf W} {\bf{A}}_\text a {\bf g}_{\text{SR},k}\right\} |^2\\ B_k &= p_{{\text S},k} \text{Var}\left( {\bf g}_{\text{RD},k}^T {\bf{ A}}_\text d {\bf W} {\bf{A}}_\text a {\bf g}_{\text{SR},k} \right)\\ C_k &= \sum\limits_{i\neq k} p_{{\text S},i} {\tt E} \left\{ |{\bf g}_{\text{RD},k}^T {\bf{ A}}_\text d {\bf W} {\bf{ A}}_\text a {\bf g}_{\text{SR},i}|^2 \right\}\\ D_k &= {\tt E}\left\{ ||{\bf g}_{\text{RD},k}^T {\bf{A}}_\text d {\bf W} {\bf{A}}_\text a ||^2\right\}\\ E_k &= {\tt E}\left\{|{\bf g}_{\text{RD},k}^T {\bf{ A}}_\text d {\bf W} {\bf R}_{{\bf q}_{\text a} {\bf q}_{\text a}} {\bf W}^H {\bf{ A}}_\text d^H {\bf g}_{\text{RD},k}^* |\right\}\\ F_k &= {\tt E}\left\{|{\bf g}_{\text{RD},k}^T {\bf R}_{{\bf q}_{\text d} {\bf q}_{\text d}} {\bf g}_{\text{RD},k}^* |\right\}. \end{align} \subsection{Asymptotic Simplifications} As we can see, the matrices ${\bf R}_{{\bf q}_{\text a} {\bf q}_{\text a}}$, ${\bf{ A}}_\text d$, and ${\bf R}_{{\bf q}_{\text d} {\bf q}_{\text d}}$ all involve arcsine functions, which does not give much insight into how the rate changes with various parameters. To facilitate the analysis, we focus on the asymptotic regime for a large number of users, in which \eqref{eq:R_yy} can be approximated by \begin{align}\label{eq:R_yy:approx} {\bf R}_{{\bf y}_{\text R} {\bf y}_{\text R}} \approx {\text{diag}} \left( {\bf R}_{{\bf y}_{\text R} {\bf y}_{\text R}} \right) \approx \left(1 + \sum\limits_{k=1}^K p_{{\text S},k} \beta_{\text{SR},k} \right) {\bf I}_{M}. \end{align} Substituting \eqref{eq:R_yy:approx} into \eqref{eq:Aa:diag} and \eqref{eq:R_qa:arcsine}, we have \begin{align}\label{eq:Aa:approx} {\bf A}_{\text a} &\approx \sqrt{\frac{2}{\pi}} \sqrt{\frac{1}{1 + \sum\limits_{k=1}^K p_{{\text S},k} \beta_{\text{SR},k}}} {\bf I}_{M} = \alpha_\text a {\bf I}_{M}\\ \label{eq:R_qa:approx} {\bf R}_{{\bf q}_{\text a} {\bf q}_{\text a}} &\approx \left(1 - \frac{2}{\pi} \right) {\bf I}_{M}. \end{align} Similarly, asymptotically we have \begin{align} {\bf{R}}_{{\bf x}_{\text R} {\bf x}_{\text R}} \approx \text{diag} \left( {\bf{R}}_{{\bf x}_{\text R} {\bf x}_{\text R}} \right) \approx {\hat\alpha}_\text d {\bf I}_{M}, \end{align} where \begin{align} &{\hat\alpha}_\text d = M \left(\alpha_\text a^2 + 1 - \frac{2}{\pi}\right) \sum\limits_{k=1}^K \sigma_{\text{SR},k}^2 \sigma_{\text{RD},k}^2 \\ \notag &+M \alpha_\text a^2 \sum\limits_{k=1}^K \sigma_{\text{SR},k}^2 \sigma_{\text{RD},k}^2 \left(M p_{\text S,k} \sigma_{\text{SR},k}^2 + \sum\limits_{i=1}^K p_{\text S,i} \beta_{\text{SR},i}\right). \end{align} Note that the proof of calculating the approximate ${\bf{ R}}_{{\bf x}_{\text R} {\bf x}_{\text R}}$ can be found in the Appendix \ref{app:theorm:Rk_tilde}. As a result, the matrices ${\bf{ A}}_\text d$ and ${\bf R}_{{\bf q}_{\text d} {\bf q}_{\text d}}$ can be approximated by \begin{align}\label{eq:Ad:approx} {\bf{ A}}_\text d &\approx \sqrt{\frac{2}{\pi{\hat\alpha}_\text d}} {\bf I}_{M}= \alpha_\text d {\bf I}_{M}\\ \label{eq:R_qd:approx} {\bf R}_{{\bf q}_{\text d} {\bf q}_{\text d}} &\approx \left(1 - \frac{2}{\pi} \right) {\bf I}_{M}. \end{align} \subsection{Approximate Rate Analysis} In this section, we derive a simpler closed-form approximation for the achievable rate. Substituting \eqref{eq:Aa:approx}, \eqref{eq:R_qa:approx}, \eqref{eq:Ad:approx}, and \eqref{eq:R_qd:approx} into \eqref{eq:rate_exact}, the exact achievable rate $R_k$ can be approximated by \begin{align}\label{eq:rate_approx} &{\tilde R}_k= \\ &\frac{\tau_\text c - 2 \tau_\text p}{2\tau_\text c} \log_2\left(1 + \frac{{\tilde A}_k}{{\tilde B}_k + {\tilde C}_k + {\tilde D}_k + {\tilde E}_k + {\tilde F}_k + {\tilde G}_k} \right), \notag \end{align} where \begin{align} {\tilde A}_k &= p_{{\text S},k} |{\tt E}\left\{ {\bf g}_{\text{RD},k}^T {\bf W} {\bf g}_{\text{SR},k}\right\} |^2, \\ {\tilde B}_k &= p_{{\text S},k} \text{Var}\left( {\bf g}_{\text{RD},k}^T {\bf W} {\bf g}_{\text{SR},k} \right), \\ {\tilde C}_k &= \sum\limits_{i\neq k} p_{{\text S},i} {\tt E} \left\{ |{\bf g}_{\text{RD},k}^T {\bf W} {\bf g}_{\text{SR},i}|^2 \right\},\\ {\tilde D}_k &= {\tt E}\left\{ ||{\bf g}_{\text{RD},k}^T {\bf W} ||^2\right\}, \\ {\tilde E}_k &= \left(1 - \frac{2}{\pi}\right)\frac{1}{\alpha_\text a^2} {\tt E}\left\{ ||{\bf g}_{\text{RD},k}^T {\bf W} ||^2\right\}, \\ {\tilde F}_k &= \left(1 - \frac{2}{\pi}\right)\frac{1}{\alpha_\text a^2 \alpha_\text d^2} {\tt E}\left\{||{\bf g}_{\text{RD},k}||^2\right\},\\ {\tilde G}_k &= \frac{1}{\gamma^2 \alpha_\text a^2 \alpha_\text d^2}. \end{align} With this expression, we can compute ${\tilde R}_k$ by using random matrix theory and present a closed-form approximate rate for the \emph{k}-th destination, as formalized in the following theorem. \begin{theorem}\label{theorm:Rk_tilde} With one-bit ADCs and DACs at the relay, the approximate achievable rate of the \emph{k}-th destination is given by \eqref{eq:rate_approx}, where \begin{align} &{\tilde A}_k = p_{\text S,k} M^4 \sigma_{\text{SR},k}^4 \sigma_{\text{RD},k}^4,\\ &{\tilde B}_k = p_{\text S,k} M^2 \left( M \sigma_{\text{SR},k}^4 \sigma_{\text{RD},k}^2 \beta_{\text{RD},k} + \beta_{\text{SR},k} t_k \right),\\ &{\tilde C}_k = M^2 \sum\limits_{i\neq k} p_{\text S,i} \left( M \sigma_{\text{SR},i}^4 \sigma_{\text{RD},i}^2 \beta_{\text{RD},k} + \beta_{\text{SR},i} t_k \right),\\ &{\tilde D}_k = M^2 t_k ,\\ &{\tilde E}_k = \left(\frac{\pi}{2} - 1\right) \left(1 + \sum\limits_{k=1}^K p_{\text S,k} \beta_{\text{SR},k} \right) M^2 t_k, \\ &{\tilde F}_k = \beta_{\text{RD},k}\left(\frac{\pi}{2} - 1\right)M^3 \sum\limits_{k=1}^K p_{\text S,k} \sigma_{\text{SR},k}^4 \sigma_{\text{RD},k}^2\\ \notag & + \beta_{\text{RD},k}\frac{M^2\pi}{2} \left(\frac{\pi}{2} - 1\right) \left(1 + \sum\limits_{k=1}^K p_{\text S,k} \beta_{\text{SR},k} \right) \sum\limits_{k=1}^K \sigma_{\text{SR},k}^2 \sigma_{\text{RD},k}^2\\ & {\tilde G}_k = \frac{M^3\pi }{2 p_\text R} \sum\limits_{k=1}^K p_{\text S,k} \sigma_{\text{SR},k}^4 \sigma_{\text{RD},k}^2 \\ \notag &+ \frac{M^2 \pi^2 }{4p_\text R} \left(1 + \sum\limits_{k=1}^K p_{\text S,k} \beta_{\text{SR},k} \right) \sum\limits_{k=1}^K \sigma_{\text{SR},k}^2 \sigma_{\text{RD},k}^2, \end{align} with $t_k = M \sigma_{\text{RD},k}^4 \sigma_{\text{SR},k}^2 + \beta_{\text{RD},k} \sum\limits_{n=1}^K \sigma_{\text{SR},n}^2 \sigma_{\text{RD},n}^2$. \end{theorem} \proof See Appendix \ref{app:theorm:Rk_tilde}. \endproof From Theorem \ref{theorm:Rk_tilde}, we can more readily see the impact of key parameters on the achievable rate. For instance, ${\tilde R}_k$ decreases with the number of user pairs $K$. This is expected since a higher number of users increases the amount of inter-user interference. In addition, ${\tilde R}_k$ is an increasing function of $M$, which reveals that increasing the number of relay's antennas always boosts the system performance. As $p_{\text S,k}$ approaches infinity, ${\tilde R}_k$ converges to a constant that is independent of $p_{\text S,k}$. In this case, the system becomes interference-limited. To quantify the impact of the double quantization on system performance, in the following corollaries we compare the achievable rate with several different ADC and DAC configurations. \begin{corollary}\label{coro:perfect:ADC} With perfect ADCs and one-bit DACs, the achievable rate of the \emph{k}-th destination can be expressed as \eqref{eq:rate:pA} (shown on the top of the next page), \begin{figure*} \begin{align}\label{eq:rate:pA} R_k^\text{pA} = \frac{\tau_\text c - 2 \tau_\text p}{2\tau_\text c} \log_2\left(1 + \frac{{\hat A}_k}{{\hat B}_k + {\hat C}_k + {\hat D}_k + \left(\frac{\pi}{2} - 1\right)M\beta_{\text{RD},k}{\tilde\alpha}_\text d + \frac{\pi{\tilde\alpha}_\text d}{2\gamma^2}} \right), \end{align} \hrule \end{figure*} where \begin{align} &{\tilde\alpha}_\text d = M \sum\limits_{k=1}^K {\hat\sigma}_{\text{SR},k}^2 {\hat\sigma}_{\text{RD},k}^2\\ \notag &+M\sum\limits_{k=1}^K {\hat\sigma}_{\text{SR},k}^2 {\hat\sigma}_{\text{RD},k}^2 \left(M p_{\text S,k} {\hat\sigma}_{\text{SR},k}^2 + \sum\limits_{i=1}^K p_{\text S,i} \beta_{\text{SR},i}\right) , \end{align} with ${\hat\sigma}_{\text{SR},k}^2 = \frac{K\beta_{\text{SR},k}^2p_\text p}{K\beta_{\text{SR},k}p_\text p + 1}$ and ${\hat\sigma}_{\text{RD},k}^2 = \frac{K\beta_{\text{RD},k}^2p_\text p}{K\beta_{\text{RD},k}p_\text p + 1}$; ${\hat A}_k$, ${\hat B}_k$, ${\hat C}_k$, ${\hat D}_k$ can be obtained by replacing ${\sigma}_{\text{SR},k}^2$ and ${\sigma}_{\text{RD},k}^2$ with ${\hat\sigma}_{\text{SR},k}^2$ and ${\hat\sigma}_{\text{RD},k}^2$ in ${\tilde A}_k$, ${\tilde B}_k$, ${\tilde C}_k$, ${\tilde D}_k$, respectively. \end{corollary} \begin{corollary} With perfect DACs and one-bit ADCs, the achievable rate of the \emph{k}-th destination can be expressed as \begin{align}\label{coro:perfect:DAC} R_k^\text{pD} = \frac{\tau_\text c - 2 \tau_\text p}{2\tau_\text c} \log_2\left(1 + \frac{{\tilde A}_k}{{\tilde B}_k + {\tilde C}_k + {\tilde D}_k + {\tilde E}_k + \frac{2}{\pi}{\tilde G}_k} \right). \end{align} \end{corollary} \begin{corollary}\label{coro:perfect:ADC:DAC} With perfect ADCs and DACs, the achievable rate of the \emph{k}-th destination can be expressed as \begin{align}\label{eq:rate:perfect} R_k^\text{p} = \frac{\tau_\text c - 2 \tau_\text p}{2\tau_\text c} \log_2\left(1 + \frac{{\hat A}_k}{{\hat B}_k + {\hat C}_k + {\hat D}_k + \frac{{\tilde\alpha}_\text d}{\gamma^2}} \right). \end{align} \end{corollary} Corollaries \ref{coro:perfect:ADC}-\ref{coro:perfect:ADC:DAC} together with Theorem \ref{theorm:Rk_tilde} provide four cases with different ADC/DAC configurations at the relay: 1) Case I: perfect ADCs and DACs; 2) Case II: perfect ADCs and one-bit DACs; 3) Case III: one-bit ADCs and perfect DACs; 4) Case IV: one-bit ADCs and DACs. The relative performance of these four configurations is described below. \begin{proposition}\label{prop:rate:compare} As the number of relay antennas becomes very large, we have \begin{align} R_k^\text p > R_k^\text{pA} > R_k^\text{pD} > {\tilde R}_k. \end{align} \end{proposition} \proof See Appendix \ref{app:prop:rate:compare}. \endproof Proposition \ref{prop:rate:compare} indicates that the rate of the system with perfect ADCs and one-bit DACs is higher than that of one-bit ADCs and perfect DACs system. This is because one-bit ADCs cause both channel estimation errors and rate degradation, while one-bit DACs only lead to a rate reduction. For what follows, we define the three rate ratios \begin{align} \left[\delta_1, \delta_2, \delta_3\right] = \left[\frac{R_k^\text{pA}}{R_k^\text p}, \frac{R_k^\text{pD}}{R_k^\text{p}}, \frac{{\tilde R}_k}{R_k^\text{p}}\right]. \end{align} We will compare these ratios for low SNR situations where massive MIMO systems are likely to operate. Here, we consider two cases: a) the transmit power of each source scales as $p_\text S = E_\text S/M$ (where we define $p_\text S = p_{\text S,k}$ for $k = 1,\ldots,K$) with fixed $E_\text S$, while $p_\text p$ and $p_\text R$ are fixed. This case focuses on the potential power savings of the sources; b) the transmit power of the relay scales as $p_\text R = E_\text R/M$ with fixed $E_\text R$, while $p_\text S$ and $p_\text R$ are fixed. This case focuses on the potential power savings of the relay. \begin{proposition}\label{prop:ratio_ps0} With $p_\text S = E_\text S/M$, and $E_\text u$, $p_\text p$, $p_\text R$ fixed, we have \begin{align} {\tilde R}_k &\rightarrow \frac{\tau_\text c - 2 \tau_\text p}{2\tau_\text c}\log_2\left(1 + \frac{2}{\pi}E_\text S \sigma_{\text{SR},k}^2 \right)\\ R_k^\text p &\rightarrow \frac{\tau_\text c - 2 \tau_\text p}{2\tau_\text c}\log_2\left(1 + E_\text S {\hat\sigma}_{\text{SR},k}^2\right), \end{align} as $M \rightarrow \infty$. In addition, if $E_\text S \rightarrow 0$, the rate ratios are given by \begin{align} \left[\delta_1, \delta_2, \delta_3\right] = \left[1, 4/\pi^2, 4/\pi^2 \right]. \end{align} \end{proposition} \begin{proposition}\label{prop:ratio_pr0} With $p_\text R = E_\text R/M$, and $E_\text R$, $p_\text p$, $p_\text S$ fixed, we have \begin{align} {\tilde R}_k &\rightarrow \frac{\tau_\text c - 2 \tau_\text p}{2\tau_\text c}\log_2\left(1 + \frac{2 E_\text R}{\pi} \frac{ \sigma_{\text{SR},k}^4 \sigma_{\text{RD},k}^4}{ \sum\limits_{k=1}^K\sigma_{\text{SR},k}^4 \sigma_{\text{RD},k}^2} \right)\\ R_k^\text p &\rightarrow \frac{\tau_\text c - 2 \tau_\text p}{2\tau_\text c}\log_2\left(1 + E_\text R \frac{ \hat\sigma_{\text{SR},k}^4 \hat\sigma_{\text{RD},k}^4}{ \sum\limits_{k=1}^K \hat\sigma_{\text{SR},k}^4 \hat\sigma_{\text{RD},k}^2} \right), \end{align} as $M \rightarrow \infty$. In addition, if $E_\text R \rightarrow 0$, the rate ratios are given by \begin{align} \left[\delta_1, \delta_2, \delta_3\right] = \left[2/\pi, 2/\pi, 4/\pi^2 \right]. \end{align} \end{proposition} From Propositions \ref{prop:ratio_ps0} and \ref{prop:ratio_pr0}, we can see that the system with one-bit ADCs and DACs has the same power scaling laws as the perfect hardware case, which is an encouraging result. In addition, for both Propositions \ref{prop:ratio_ps0} and \ref{prop:ratio_pr0}, $\delta_3 = 4/\pi^2$, revealing that for the double-quantized system, the rate ratio is $4/\pi^2$ times less than the perfect ADC/DAC case, for low transmit power at the sources or low transmit power at the relay. This result is the same as that in the system which is only quantized once \cite{A.Mezghani2}. Interestingly, focusing on the values of $\delta_1$ and $\delta_2$, we observe that the process to achieve the final scaling of $4/\pi^2$ is quite different. For low $p_{\text S,k}$ case, the value $4/\pi^2$ only results from $\delta_2 = 4/\pi^2$, implying that the rate loss is only caused by the one-bit ADCs. In contrast, for the low $p_\text R$ case, the value $4/\pi^2$ is generated by $\delta_1 = 2/\pi$ and $\delta_2 = 2/\pi$, indicating that the rate degradation comes from both one-bit ADCs and one-bit DACs. \section{Power Allocation}\label{sec:power_allocation} In this section, we formulate a power allocation problem maximizing the sum rate of the system for a given total power budget $P_\text T$, i.e., $\sum\limits_{k=1}^K p_{\text S,k} + p_\text R \leq P_\text{T}$. \subsection{Problem Formulation} Defining ${\bf p}_\text S = \left[p_{\text S,1}, \ldots, p_{\text S,K} \right]^T$, the problem is expressed as \begin{align}\label{problem1} {\cal P}_1: \mathop{\text{maximize}}\limits_{{\bf p}_\text S, p_r} \quad &\frac{\tau_c - 2 \tau_p}{2 \tau_c} \sum\limits_{k = 1}^{K} \log_2 \left( 1 + \gamma_k \right) \\ \label{eq:gamma:equality} {\text{subject to}} \quad &\gamma_k = \frac{p_{\text S,k}}{\xi_k}, k = 1, \ldots, K\\ &\sum\limits_{i = 1}^K p_{\text S,i} + p_r \leq P_\text T\\ &{\bf p}_\text S \geq {\bf 0}, p_r \geq 0, \end{align} where \begin{align} \xi_k &= \sum\limits_{i=1}^K p_{\text S,i} a_{k,i} + p_\text R^{-1} \left( \sum\limits_{i=1}^K b_{k,i} p_{\text S,i} + c_k \right) + d_k\\ c_k &= \frac{\pi^2 }{4 M^2\sigma_{\text{SR},k}^4 \sigma_{\text{RD},k}^4} \sum\limits_{n=1}^K \sigma_{\text{SR},n}^2 \sigma_{\text{RD},n}^2\\ d_k &= \frac{\pi}{2 M\sigma_{\text{SR},k}^2} + \frac{\pi^2 \beta_{\text{RD},k}}{4 M^2 \sigma_{\text{SR},k}^4 \sigma_{\text{RD},k}^4} \sum\limits_{n = 1}^K \sigma_{\text{SR},n}^2 \sigma_{\text{RD},n}^2, \end{align} and $a_{k,i}$ and $b_{k,i}$ are respectively given by \eqref{eq:a_k} and \eqref{eq:b_k}, shown on the top of the next page. \begin{figure*} \begin{align}\label{eq:a_k} a_{k,i} = \begin{cases} \frac{\pi}{2 M\sigma_{\text{SR},k}^2 \sigma_{\text{RD},k}^2} \left( \sigma_{\text{SR},k}^2 \beta_{\text{RD},k} + \sigma_{\text{RD},k}^2 \beta_{\text{SR},k} \right) + \frac{\pi^2 \beta_{\text{SR},k} \beta_{\text{RD},k} }{4 M^2 \sigma_{\text{SR},k}^4 \sigma_{\text{RD},k}^4} \sum\limits_{n=1}^K \sigma_{\text{SR},n}^2 \sigma_{\text{RD},n}^2, & i = k \\ \frac{1}{M\sigma_{\text{SR},k}^4 \sigma_{\text{RD},k}^4} \left(\sigma_{\text{SR},k}^2 \sigma_{\text{RD},k}^4 \beta_{\text{SR},i} + \frac{\pi}{2} \beta_{\text{RD},k} \sigma_{\text{SR},i}^4 \sigma_{\text{RD},i}^2 + \left(\frac{\pi}{2} - 1\right) \beta_{\text{SR},i} \sigma_{\text{SR},i}^2 \sigma_{\text{RD},i}^4 \right) \\ + \frac{\beta_{\text{SR},i}}{M^2 \sigma_{\text{SR},k}^4 \sigma_{\text{RD},k}^4} \left( \left( \frac{\pi^2}{4} - \frac{\pi}{2} + 1 \right) \beta_{\text{RD},k} + \left(\frac{\pi}{2} - 1\right) \beta_{\text{RD},i} \right) \sum\limits_{n = 1}^K \sigma_{\text{SR},n}^2 \sigma_{\text{RD},n}^2 , & i \neq k, \end{cases} \end{align} \hrule \end{figure*} \begin{figure*} \begin{align}\label{eq:b_k} b_{k,i} = \begin{cases} \frac{\pi }{2} \left(\frac{1}{M \sigma_{\text{RD},k}^2 } + \frac{\pi \beta_{\text{SR},k}}{2 M^2\sigma_{\text{SR},k}^4 \sigma_{\text{RD},k}^4} \sum\limits_{n=1}^K \sigma_{\text{SR},n}^2 \sigma_{\text{RD},n}^2 \right), &i = k\\ \frac{\pi}{2 M^2 \sigma_{\text{SR},k}^4 \sigma_{\text{RD},k}^4} \left(M \sigma_{\text{SR},i}^4 \sigma_{\text{RD},i}^2 + \frac{\pi}{2} \beta_{\text{SR},i} \sum\limits_{n=1}^K \sigma_{\text{SR},n}^2 \sigma_{\text{RD},n}^2 \right), &i\neq k, \end{cases} \end{align} \hrule \end{figure*} Since $\log\left(\cdot\right)$ is an increasing function, problem ${\cal P}_1$ can be reformulated as \begin{align}\label{problem2} {\cal P}_2: \mathop{\text{minimize}}\limits_{{\bf p}_\text S, p_r} \quad & \prod_{k = 1}^{K} \left( 1 + \gamma_k \right)^{-1} \\ \label{eq:gamma:inequality} {\text{subject to}} \quad &\gamma_k \leq \frac{p_{\text S,k}}{\xi_k} , k = 1, \ldots, K \\ &\sum\limits_{i = 1}^K p_{\text S,i} + p_r \leq P_\text T\\ &{\bf p}_\text S \geq {\bf 0}, p_r \geq 0, \end{align} which can be identified as a complementary geometric program (CGP) \cite{M.Avriel}. Note that the equality constraints \eqref{eq:gamma:equality} of ${\cal P}_1$ have been replaced with inequality constraints \eqref{eq:gamma:inequality}. Since the objective function of ${\cal P}_2$ decreases with $\gamma_k$, we can guarantee that the inequality constraints \eqref{eq:gamma:inequality} must be active at any optimal solution of ${\cal P}_2$, which means that problem ${\cal P}_2$ is equivalent to ${\cal P}_1$. \subsection{Successive Approximation Algorithm} CGP problems are in general nonconvex. Fortunately, we can first approximate the CGP by solving a sequence of GP problems. Then, each GP can be solved very efficiently with standard convex optimization tools such as CVX. The key idea is to use a monomial function $\omega_k\gamma_k^{\mu_k}$ to approximate $1 + \gamma_k$ near an arbitrary point ${\hat \gamma}_k > 0$. To make the approximation accurate, we need to ensure that \begin{align} \begin{cases} 1 + {\hat\gamma}_k = \omega_k{\hat\gamma_k}^{\mu_k}\\ {\mu_k}\omega_k{\hat\gamma}_k^{\mu_k - 1} = 1. \end{cases} \end{align} These results will hold if the parameters $\omega_k$ and $\mu_k$ are chosen as $\omega_k = {\hat\gamma}_k^{-\mu_k} \left(1 + {\hat\gamma}_k\right)$ and $\mu_k = \frac{{\hat\gamma}_k}{1+{\hat\gamma}_k}$. At each iteration, the GP is obtained by replacing the posynomial objective function with its best local monomial approximation near the solution obtained at the previous iteration. The following algorithm shows the steps to solving ${\cal P}_2$. \begin{algorithm}[ht!] \caption{Successive approximation algorithm for ${\cal{P}}_2$}\label{algorithm} 1) {\it Initialization}. Define a tolerance $\epsilon$ and parameter $\theta$. Set $j = 1$, and set the initial value of ${\hat\gamma}_k$ according to the signal-to-interference-plus-noise ratio (SINR) in Theorem \ref{theorm:Rk_tilde} with $p_{\text S,k} = \frac{P_\text T}{2K}$ and $p_r = \frac{P_\text T}{2}$. 2) {\it Iteration $j$}. Compute $\mu_k = \frac{{\hat\gamma}_k}{1+{\hat\gamma}_k}$. Then, solve the following GP problem ${\cal{P}}_3$: \begin{align}\label{problem4} {\cal P}_3: \mathop{\text{minimize}}\limits_{{\bf p}_\text S, p_r} \quad & \prod_{k = 1}^{K} \gamma_k^{-\mu_k} \\ {\text{subject to}} \quad &\theta^{-1}{\hat\gamma}_k \leq {\gamma}_k \leq \theta {\hat\gamma}_k, k = 1, \ldots, K\\ &\gamma_k p_{\text S,k}^{-1} \xi_k \leq 1, k = 1, \ldots, K \\ &\sum\limits_{i = 1}^K p_{\text S,i} + p_r \leq P_\text T\\ &{\bf p}_\text S \geq {\bf 0}, p_r \geq 0. \end{align} Denote the optimal solutions by ${\gamma}_{k}^{(j)}$, for $k = 1,\ldots, K$. 3) {\it Stopping criterion}. If $\max_k |{\gamma}_k^{(j)} - {\hat\gamma}_{k}| < \epsilon$, stop; otherwise, go to step 4). 4) {\it Update initial values}. Set ${\hat\gamma}_k = {\gamma}_k^{(j)}$, and $j = j + 1$. Go to step 2). \end{algorithm} We have neglected $\omega_k$ in the objective function of ${\cal P}_3$ since they are constants and do not affect the problem solution. Also, some trust region constraints are added, i.e., $\theta^{-1}{\hat\gamma}_k \leq {\gamma}_k \leq \theta {\hat\gamma}_k$, which limits how much the variables are allowed to differ from the current guess ${\hat\gamma}_k$. The parameter $\theta > 1$ controls the desired accuracy. More precisely, when $\theta$ is close to 1, it provides good accuracy for the momomial approximation but with slower convergence speed, and vice versa if $\theta$ is large. As discussed in \cite{S.Boyd2}, $\theta = 1.1$ offers a good tradeoff between accuracy and convergence speed. \section{Numerical Results}\label{sec:numerical_results} In this section, we present numerical results to validate previous analytical results and demonstrate the benefits of the power allocation algorithm. \subsection{Impact of the input pilot matrix} In this section, we evaluate the channel estimation accuracy of the identity and Hadamard pilot matrices. We choose $K = 4$, and the large scale fading coefficients ${\bf \beta}_\text{SR} = [0.6, 0.3, 0.1, 0.9]$. Fig. \ref{fig:MSE_pp} illustrates the MSE of each channel from the sources to the relay versus the transmit power of each pilot symbol. For $\beta_{\text{SR},k} = \left\{0.1, 0.3\right\}$ which are less than the average large scale fading value of $0.475$, the identity matrix pilot outperforms the Hadamard matrix, in agreement with Proposition \ref{theor:pilot_matrix}. In addition, observing the curves associated with the Hadamard matrix, we can see that the approximate results nearly overlap with the exact results in the low $p_\text p$ regime, indicating the validity of our theoretical analysis. However, if $p_\text p$ increases, the gap between the approximate and exact results grows. \begin{figure}[!ht] \centering \includegraphics[scale=0.45]{MSE_pp.eps} \caption{MSE versus $p_\text p$ for $K = 4$ and $M = 128$.}\label{fig:MSE_pp} \end{figure} \subsection{Validation of analytical results} In this section, we validate the theoretical derivations. For simplicity, we set the large-scale fading coefficients as $\beta_{\text{SR},k} = \beta_{\text{RD},k} = 1$ and adopt an equal power allocation strategy, i.e., $p_{\text S,k} = p_\text S$. Fig. \ref{fig:rate_num_user_ps10} shows the sum rate versus the number of user pairs $K$. The curves associated with ``Exact numerical results'' and ``Approximate numerical results'' are respectively generated by Monte-Carlo simulations according to \eqref{eq:rate_exact} and \eqref{eq:rate_approx} by averaging over $10^3$ independent channel realizations, and the ``Theoretical results'' curves are obtained based on Theorem \ref{theorm:Rk_tilde}. As can be seen, there exists a gap between ``Exact numerical results'' (where the matrices ${\bf R}_{{\bf q}_\text a {\bf q}_\text a}$ and ${\bf R}_{{\bf q}_\text d {\bf q}_\text d}$ are not diagonal, which means that the quantization noise is correlated) and ``Approximate numerical results'' (where the matrices ${\bf R}_{{\bf q}_\text a {\bf q}_\text a}$ and ${\bf R}_{{\bf q}_\text d {\bf q}_\text d}$ are approximated by identity matrices) when the number of user pairs is small, while the gap narrows and finally disappears as $K$ becomes large. The reason is that the correlation effect is stronger with smaller $K$ and weaker with larger $K$. In this example, our approximate model is very accurate when the number of user pairs is greater than $15$, which is a reasonable number for this size of array. In addition, we observe that the ``Approximate numerical results'' curve overlaps with that for the ``Theoretical results'', which verifies our analytical derivations in Theorem \ref{theorm:Rk_tilde}. \begin{figure}[!ht] \centering \includegraphics[scale=0.45]{rate_num_user_ps10.eps} \caption{Sum rate versus the the number of user pairs $K$ for $p_\text S = 10$ dB, $p_\text R = 10$ dB, and $p_p = 10$ dB.}\label{fig:rate_num_user_ps10} \end{figure} Fig. \ref{fig:rate_num_antenna_ps10_pr10} shows the sum rate versus the number of relay antennas. From Fig. \ref{fig:rate_num_antenna_K10_ps10_pr10}, we can see that when $K = 10$, the gap between the exact and approximate numerical results increases with the number of relay antennas. This suggests that for large antenna arrays, the correlation of the quantization noise becomes important and cannot be neglected. However, we are interested in the typical massive MIMO setup where the ratio between the number of relay antennas and the users is on the order of about $M/K = 10$, and thus we plot Fig. \ref{fig:rate_num_antenna_MdK10_ps10_pr10}. In this figure, we can see the gap slightly narrows (from 0.2791 bit/s/Hz at $M = 80$ to 0.2505 bit/s/Hz at $M = 200$) as the number of relay antennas increases, which indicates that our approximate model is accurate for massive MIMO scenarios. \begin{figure}[ht] \centering \subfigure[$K = 10$]{\label{fig:rate_num_antenna_K10_ps10_pr10}\includegraphics[width=0.37\textwidth]{rate_num_antenna_K10_ps10_pr10.eps}} \hspace{0.2in} \subfigure[$K = M/10$]{\label{fig:rate_num_antenna_MdK10_ps10_pr10}\includegraphics[width=0.37\textwidth]{rate_num_antenna_MdK10_ps10_pr10.eps}} \caption{Sum rate versus the number of relay antennas $M$ for $p_\text S = 10$ dB, $p_\text R = 10$ dB, and $p_p = 10$ dB.}\label{fig:rate_num_antenna_ps10_pr10} \end{figure} Fig. \ref{fig:required_ps} shows the transmit power $p_\text S$ of each source required to maintain a given sum rate of $5$ bit/s/Hz. We can see that when the number of relay antennas increases, the required $p_\text S$ is significantly reduced. Furthermore, if the number of relay antennas is very large, the required $p_\text S$ is irrelevant to the resolution of the DACs. In other words, the sources transmit the same power in Case I and Case II, and pay the same power in Case III and Case IV. Fig. \ref{fig:rate_ratio_ps0} plots the three rate ratios versus the number of relay antennas when $p_\text S$ is very low. We observe that the three rate ratio curves converge to two nonzero limits $1$ and $4/\pi^2$, which is consistent with Proposition \ref{prop:ratio_ps0}. This property provides an efficient way to predict the sum rate with one-bit quantization according to the known sum rate of perfect ADC and/or DAC systems in low source transmit power regimes and with large-scale relay antennas. \begin{figure}[ht] \centering \subfigure[Required $p_\text S$]{\label{fig:required_ps}\includegraphics[width=0.37\textwidth]{required_ps.eps}} \hspace{0.2in} \subfigure[Rate ratio: $p_\text S = -50$ dB]{\label{fig:rate_ratio_ps0}\includegraphics[width=0.37\textwidth]{rate_ratio_ps0.eps}} \caption{Required $p_\text S$ and rate ratio versus the number of relay antennas $M$ for $K = 5$, $p_p = 10$ dB, and $p_\text R = 10$ dB.}\label{fig:rate_ps0} \end{figure} Fig. \ref{fig:required_pr} shows the transmit power $p_\text R$ of the relay required to maintain a given sum rate of $5$ bit/s/Hz. As in the previous case, the required power is substantially reduced when the number of relay antennas grows, which indicates the great benefits of employing large antenna arrays. In addition, when $p_\text R$ is very small, e.g., $p_\text R = -10$ dB, the four curves show quite different results. The required number of relay antennas with one-bit ADCs and DACs is $M = 512$, which is approximately 2.5 times more than the case with perfect ADCs and DACs which requires $M = 208$ antennas. For Case II and Case III, the required number of relay antennas is almost the same, respectively $M = 314$ and $M = 345$. Fig. \ref{fig:rate_ratio_pr0} compares the three rate ratios when $p_\text R$ is very low. We can see that the three rate ratio curves converge to three nonzero limits $2/\pi$, $2/\pi$, and $4/\pi^2$, which agrees with Proposition \ref{prop:ratio_pr0}. \begin{figure}[ht] \centering \subfigure[Required $p_\text R$]{\label{fig:required_pr}\includegraphics[width=0.37\textwidth]{required_pr.eps}} \hspace{0.2in} \subfigure[Rate ratio: $p_\text R = -40$ dB]{\label{fig:rate_ratio_pr0}\includegraphics[width=0.37\textwidth]{rate_ratio_pr0.eps}} \caption{Required $p_\text R$ and rate ratio versus the number of relay antennas $M$ for $K = 5$, $p_p = 10$ dB, and $p_\text S = 10$ dB.}\label{fig:rate_pr0} \end{figure} \subsection{Power allocation} Fig. \ref{fig:power_allocation} illustrates the impact of the optimal power allocation scheme on the sum rate when all users experience different large-scale fading. The large-scale fading coefficients are arbitrarily generated by $\beta_{\text{SR},k} = z_k\left(r_{\text{SR},k}/r_0 \right)^\kappa$ and $\beta_{\text{RD},k} = z_k\left(r_{\text{RD},k}/r_0 \right)^\kappa$, where $z_k$ is a log-normal random variable with standard deviation 8 dB, $r_{\text{SR},k}$ and $r_{\text{RD},k}$ respectively represent the distances from the sources and destinations to the relay, $\kappa = 3.8$ is the path loss exponent, and $r_0$ denotes the guard interval which specifies the nearest distance between the users and the relay. The relay is located at the center of a cell with a radius of $1000$ meters and $r_0 = 100$ meters. We choose $\beta_\text{SR} = \left[0.2688, 0.0368, 0.00025, 0.1398, 0.0047 \right]$, and $\beta_\text{RD} = \left[0.0003, 0.00025, 0.0050, 0.0794, 0.0001 \right]$. As a benchmark scheme for comparison, we also plot the sum rate with uniform power allocation, i.e., $p_\text S = \frac{P_\text T}{2K}$ and $p_\text R = \frac{P_\text T}{2}$. For uniform power allocation, we can see that the rate of Case I is the highest, Case IV is the lowest, while Case II outperforms Case III. These results are in agreement with Proposition \ref{prop:rate:compare}. In addition, we observe that the optimal power allocation strategy significantly boosts the sum rate. Although the rate achieved by the optimal power allocation with one-bit ADCs and DACs is inferior to the case of perfect ADCs and DACs with uniform power allocation, it outperforms the other three one-bit ADC/DAC configurations. This demonstrates the great importance of power allocation in quantized systems. \begin{figure}[ht] \centering \includegraphics[scale=0.45]{power_allocation_10dB.eps} \caption{Sum rate versus the number of relay antennas $M$ for $K = 5$, $p_p = 10$ dB, and $P_\text T = 10$ dB.}\label{fig:power_allocation} \end{figure} \section{Conclusions}\label{sec:conclusions} We have analyzed the achievable rate of a multipair half-duplex massive antenna relaying system assuming that one-bit ADCs and DACs are deployed at the relay. An approximate closed-form expression for the achievable rate was derived, based on which the impact of key system parameters was characterized. It was shown that the sum rate with one-bit ADCs and DACs is $4/\pi^2$ times less than that achieved by an unquantized system in the low power regime. Despite the rate loss due to the use of one-bit ADCs and DACs, employing massive antenna arrays still enables significant power savings; i.e., the transmit power of each source or the relay can be reduced proportional to $1/M$ to maintain a constant rate, as in the unquantized case. Finally, we show that a good power allocation strategy can substantially compensate for the rate loss caused by the coarse quantization. \appendices \section{Proof of Theorem \ref{theorm:Rk_tilde}}\label{app:theorm:Rk_tilde} The end-to-end SINR given in \eqref{eq:rate_approx} consists of six expectation terms: 1) desired signal power ${\tilde A}_k$; 2) estimation error ${\tilde B}_k$; 3) interpair interference ${\tilde C}_k$; 4) noise at the relay ${\tilde D}_k$; 5) quantization noise of ADCs ${\tilde E}_k$; 6) quantization noise of DACs ${\tilde F}_k$. Besides these terms, we also need to calculate an approximation of ${\bf{R}}_{{\bf x}_{\text R} {\bf x}_{\text R}}$. In the following, we compute them one by one. 1) Approximate ${\bf{R}}_{{\bf x}_{\text R} {\bf x}_{\text R}}$: \begin{align}\label{eq:R_tilde_xR} &{\bf{ R}}_{{\bf x}_{\text R} {\bf x}_{\text R}} = {\tt E}\left\{ {\bf{\hat G}}_\text{RD}^* {\bf {\hat G}}_\text{SR}^H {\bf R}_{{\bf{\tilde y}}_{\text R} {\bf{\tilde y}}_{\text R}} {\bf{\hat G}}_\text{SR} {\bf{\hat G}}_\text{RD}^T \right\} \\ \notag &\approx \alpha_\text a^2 {\tt E}\left\{ {\bf{\hat G}}_\text{RD}^* {\bf{\hat G}}_\text{SR}^H {\bf G}_\text{SR} {\bf P}_\text S {\bf G}_\text{SR}^H {\bf{\hat G}}_\text{SR} {\bf{\hat G}}_\text{RD}^T \right\} \\ \notag &+ \left(\alpha_\text a^2 + 1 - \frac{2}{\pi}\right) {\tt E}\left\{ {\bf{\hat G}}_\text{RD}^* {\bf{\hat G}}_\text{SR}^H {\bf{\hat G}}_\text{SR} {\bf{\hat G}}_\text{RD}^T \right\}. \end{align} By using the fact that ${\tt E}\left\{||{\bf g}_{\text{SR},k}||^4 \right\} = M \left(M + 1\right)\beta_{\text{SR},k}^2$, we have \begin{align}\label{eq:gamma:term1} & {\tt E}\left\{ {\bf{\hat G}}_\text{RD}^* {\bf{\hat G}}_\text{SR}^H {\bf G}_\text{SR} {\bf P}_\text S {\bf G}_\text{SR}^H {\bf{\hat G}}_\text{SR} {\bf{\hat G}}_\text{RD}^T \right\} \\ \notag &= {\tt E}\left\{ {\bf{\hat G}}_\text{RD}^* {\bf{\hat G}}_\text{SR}^H {\bf {\hat G}}_\text{SR} {\bf P}_\text S {\bf{\hat G}}_\text{SR}^H {\bf{\hat G}}_\text{SR} {\bf{\hat G}}_\text{RD}^T \right\} \\ \notag &+ {\tt E}\left\{ {\bf{\hat G}}_\text{RD}^* {\bf{\hat G}}_\text{SR}^H {\bf E}_\text{SR} {\bf P}_\text S {\bf E}_\text{SR}^H {\bf{\hat G}}_\text{SR} {\bf{\hat G}}_\text{RD}^T \right\} \\ \notag &= M \sum\limits_{k=1}^K \sigma_{\text{SR},k}^2 \sigma_{\text{RD},k}^2 \left(M p_{\text S,k} \sigma_{\text{SR},k}^2 + \sum\limits_{i=1}^K p_{\text S,i} \beta_{\text{SR},i} \right) {\bf I}_{M} \\ \label{eq:gamma:term2} & {\tt E}\left\{ {\bf{\hat G}}_\text{RD}^* {\bf{\hat G}}_\text{SR}^H {\bf{\hat G}}_\text{SR} {\bf{\hat G}}_\text{RD}^T \right\} = M\sum\limits_{k=1}^K \sigma_{\text{SR},k}^2 \sigma_{\text{RD},k}^2 {\bf I}_{M}. \end{align} Then, by substituting \eqref{eq:gamma:term1} and \eqref{eq:gamma:term2} into \eqref{eq:R_tilde_xR}, we directly obtain \begin{align}\label{eq:Ad_approx} &{\bf{R}}_{{\bf x}_{\text R} {\bf x}_{\text R}} \approx \\ \notag &M \alpha_\text a^2 \sum\limits_{k=1}^K \sigma_{\text{SR},k}^2 \sigma_{\text{RD},k}^2 \left(M p_{\text S,k} \sigma_{\text{SR},k}^2 + \sum\limits_{i=1}^K p_{\text S,i} \beta_{\text{SR},i}\right){\bf I}_{M} \\ &+ \left(\alpha_\text a^2 + 1 - \frac{2}{\pi}\right) \sum\limits_{k=1}^K \sigma_{\text{SR},k}^2 \sigma_{\text{RD},k}^2 {\bf I}_{M}. \notag \end{align} 2) ${\tilde A}_k$: Since \begin{align} &{\tt E}\left\{ {\bf g}_{\text{RD},k}^T {\bf W} {\bf g}_{\text{SR},k}\right\} = {\tt E}\left\{ {\bf g}_{\text{RD},k}^T {\bf{\hat g}}_{\text{RD},k}^* {\bf{\hat g}}_{\text{SR},k}^H {\bf g}_{\text{SR},k}\right\} \\ \notag &= M^2 \sigma_{\text{SR},k}^2 \sigma_{\text{RD},k}^2, \end{align} we have \begin{align} {\tilde A}_k = p_{\text S,k} M^4 \sigma_{\text{SR},k}^4 \sigma_{\text{RD},k}^4. \end{align} 3) ${\tilde B}_k$: \begin{align} &{\tt E}\left\{ |{\bf g}_{\text{RD},k}^T {\bf{\hat G}}_\text{RD}^* {\bf{\hat G}}_\text{SR}^H {\bf g}_{\text{SR},k}|^2 \right\} = \\ \notag & {\tt E}\left\{ \sum\limits_{m = 1}^K \sum\limits_{n=1}^K {\bf g}_{\text{RD},k}^T {\bf{\hat g}}_{\text{RD},m}^* {\bf {\hat g}}_{\text{SR},m}^H {\bf g}_{\text{SR},k} {\bf g}_{\text{SR},k}^H {\bf{\hat g}}_{\text{SR},n} {\bf{\hat g}}_{\text{RD},n}^T {\bf g}_{\text{RD},k}^* \right\}, \end{align} which can be decomposed into three different cases: a) for $m = n = k$, \begin{align} &{\tt E}\left\{ |{\bf g}_{\text{RD},k}^T {\bf{\hat G}}_\text{RD}^* {\bf{\hat G}}_\text{SR}^H {\bf g}_{\text{SR},k}|^2 \right\}\\ \notag &= {\tt E}\left\{ ||{\bf{\hat g}}_{\text{SR},k}||^4 ||{\bf{\hat g}}_{\text{RD},k}||^4 \right\} \\ \notag &+ {\tt E}\left\{ ||{\bf{\hat g}}_{\text{SR},k}||^4 |{\bf{\hat g}}_{\text{RD},k}^T {\bf e}_{\text{RD},k}^* |^2 \right\} \\ \notag &+ {\tt E}\left\{ ||{\bf{\hat g}}_{\text{RD},k}||^4 |{\bf{\hat g}}_{\text{SR},k}^H {\bf e}_{\text{SR},k} |^2 \right\} \\ \notag &+ {\tt E}\left\{ |{\bf{\hat g}}_{\text{SR},k}^H {\bf e}_{\text{SR},k} |^2 |{\bf{\hat g}}_{\text{RD},k}^T {\bf e}_{\text{RD},k}^* |^2 \right\}\\ \notag &= M^2 \left(M+1\right)^2 \sigma_{\text{SR},k}^4 \sigma_{\text{RD},k}^4 \\ \notag &+ M^2 \left(M+1\right) \sigma_{\text{SR},k}^4 \sigma_{\text{RD},k}^2 {\tilde\sigma}_{\text{RD},k}^2 \\ \notag &+ M^2 \left(M+1\right) \sigma_{\text{RD},k}^4 \sigma_{\text{SR},k}^2 {\tilde\sigma}_{\text{SR},k}^2 \\ \notag &+ M^2 \sigma_{\text{SR},k}^2 {\tilde\sigma}_{\text{SR},k}^2 \sigma_{\text{RD},k}^2 {\tilde\sigma}_{\text{RD},k}^2. \end{align} b) for $m = n \neq k$, \begin{align} &{\tt E}\left\{ |{\bf g}_{\text{RD},k}^T {\bf{\hat G}}_\text{RD}^* {\bf{\hat G}}_\text{SR}^H {\bf g}_{\text{SR},k}|^2 \right\} \\ \notag &= M^2 \beta_{\text{SR},k} \beta_{\text{RD},k} \sum\limits_{n\neq k} \sigma_{\text{SR},n}^2 \sigma_{\text{RD},n}^2. \end{align} c) for $m \neq n \neq k$, \begin{align} {\tt E}\left\{ |{\bf g}_{\text{RD},k}^T {\bf{\hat G}}_\text{RD}^* {\bf{\hat G}}_\text{SR}^H {\bf g}_{\text{SR},k}|^2 \right\} = 0. \end{align} Combining a), b), and c), and by utilizing the fact of $\sigma_{\text{SR},k}^2 + {\tilde\sigma}_{\text{SR},k}^2 = \beta_{\text{SR},k}$ and $\sigma_{\text{RD},k}^2 + {\tilde\sigma}_{\text{RD},k}^2 = \beta_{\text{RD},k}$, we have \begin{align} &{\tt E}\left\{ |{\bf g}_{\text{RD},k}^T {\bf{\hat G}}_\text{RD}^* {\bf{\hat G}}_\text{SR}^H {\bf g}_{\text{SR},k}|^2 \right\} \\ \notag &= p_{\text S,k} M^4 \sigma_{\text{SR},k}^4 \sigma_{\text{RD},k}^4 + p_{\text S,k} M^3 \sigma_{\text{SR},k}^4 \sigma_{\text{RD},k}^2 \beta_{\text{RD},k} \\ \notag &+ p_{\text S,k} M^3 \sigma_{\text{RD},k}^4 \sigma_{\text{SR},k}^2 \beta_{\text{SR},k} \\ \notag &+ p_{\text S,k} M^2 \beta_{\text{SR},k} \beta_{\text{RD},k} \sum\limits_{n=1}^K \sigma_{\text{SR},n}^2 \sigma_{\text{RD},n}^2. \end{align} Thus, \begin{align} &{\tilde B}_k = p_{\text S,k} M^3 \left(\sigma_{\text{SR},k}^4 \sigma_{\text{RD},k}^2 \beta_{\text{RD},k} +\sigma_{\text{RD},k}^4 \sigma_{\text{SR},k}^2 \beta_{\text{SR},k} \right) \\ \notag &+ p_{\text S,k} M^2 \beta_{\text{SR},k} \beta_{\text{RD},k} \sum\limits_{n=1}^K \sigma_{\text{SR},n}^2 \sigma_{\text{RD},n}^2. \end{align} 4) ${\tilde C}_k$: \begin{align} &{\tt E}\left\{ |{\bf g}_{\text{RD},k}^T {\bf{\hat G}}_\text{RD}^* {\bf {\hat G}}_\text{SR}^H {\bf g}_{\text{SR},i}|^2 \right\} =\\ \notag & {\tt E}\left\{ \sum\limits_{m = 1}^K \sum\limits_{n=1}^K {\bf g}_{\text{RD},k}^T {\bf{\hat g}}_{\text{RD},m}^* {\bf{\hat g}}_{\text{SR},m}^H {\bf g}_{\text{SR},i} {\bf g}_{\text{SR},i}^H {\bf{\hat g}}_{\text{SR},n} {\bf{\hat g}}_{\text{RD},n}^T {\bf g}_{\text{RD},k}^* \right\}, \end{align} which can be decomposed as six cases: a) for $m \neq n \neq k,i$, \begin{align} {\tt E}\left\{|{\bf g}_{\text{RD},k}^T {\bf{\hat G}}_\text{RD}^* {\bf{\hat G}}_\text{SR}^H {\bf g}_{\text{SR},i}|^2 \right\} = 0. \end{align} b) for $m = n \neq k,i$, \begin{align} &{\tt E}\left\{ \sum\limits_{n \neq k,i} | {\bf{\hat g}}_{\text{SR},n}^H {\bf g}_{\text{SR},i} |^2 | {\bf g}_{\text{RD},k}^T {\bf{\hat g}}_{\text{RD},n}^* |^2 \right\} \\ \notag &= M^2 \beta_{\text{SR},i} \beta_{\text{RD},k} \sum\limits_{n \neq i,k} \sigma_{\text{SR},n}^2 \sigma_{\text{RD},n}^2. \end{align} c) for $m = n = k$ ($k\neq i$), \begin{align} &{\tt E}\left\{ |{\bf{\hat g}}_{\text{SR},k}^H {\bf g}_{\text{SR},i}|^2 |{\bf g}_{\text{RD},k}^T {\bf{\hat g}}_{\text{RD},k}^*|^2 \right\} \\ \notag &= M^2 \sigma_{\text{SR},k}^2 \sigma_{\text{RD},k}^2 \beta_{\text{SR},i} \left(\left(M + 1\right)\sigma_{\text{RD},k}^2 + {\tilde\sigma}_{\text{RD},k}^2 \right). \end{align} d) for $m = n = i$ ($i\neq k$), \begin{align} &{\tt E}\left\{ |{\bf g}_{\text{RD},k}^T {\bf{\hat g}}_{\text{RD},i}^*|^2 |{\bf{\hat g}}_{\text{SR},i}^H {\bf g}_{\text{SR},i} |^2 \right\} \\ \notag &= M^2 \sigma_{\text{SR},i}^2 \sigma_{\text{RD},i}^2 \beta_{\text{RD},k} \left(\left(M + 1\right)\sigma_{\text{SR},i}^2 + {\tilde\sigma}_{\text{SR},i}^2 \right). \end{align} e) for $m = i, n =k$, ${\tt E}\left\{|{\bf g}_{\text{RD},k}^T {\bf{\hat G}}_\text{RD}^* {\bf{\hat G}}_\text{SR}^H {\bf g}_{\text{SR},i}|^2 \right\} = 0$. f) for $m=k, n =i$, ${\tt E}\left\{|{\bf g}_{\text{RD},k}^T {\bf{\hat G}}_\text{RD}^* {\bf{\hat G}}_\text{SR}^H {\bf g}_{\text{SR},i}|^2 \right\} = 0$. Combining a), b), c), d), e), and f), we have \begin{align} &{\tilde C}_k = M^2 \sum\limits_{i\neq k} \beta_{\text{SR},i} \beta_{\text{RD},k} \sum\limits_{n =1}^K \sigma_{\text{SR},n}^2 \sigma_{\text{RD},n}^2 \\ \notag &+ M^3 \sum\limits_{i\neq k} p_{\text S,i} \left( \sigma_{\text{SR},k}^2 \sigma_{\text{RD},k}^4 \beta_{\text{SR},i} + \sigma_{\text{SR},i}^4 \sigma_{\text{RD},i}^2 \beta_{\text{RD},k}\right). \end{align} 5) ${\tilde D}_k$: Following the same approach as with the derivations of ${\tilde B}_k$, we obtain \begin{align} {\tilde D}_k = M^3 \sigma_{\text{SR},k}^2 \sigma_{\text{RD},k}^4 + M^2 \beta_{\text{RD},k} \sum\limits_{n = 1}^K \sigma_{\text{SR},n}^2 \sigma_{\text{RD},n}^2. \end{align} 6) ${\tilde E}_k$: By using the fact that ${\tilde E}_k = \left(1 - \frac{2}{\pi}\right)\frac{1}{\alpha_\text a^2} {\tilde D}_k$, we obtain the result for ${\tilde E}_k$. 7) ${\tilde F}_k$: ${\tilde F}_k = \frac{1 - \frac{2}{\pi}}{\alpha_\text a^2 \alpha_\text d^2} {\tt E}\left\{ ||{\bf g}_{\text{RD},k}||^2 \right\} = \left(1 - \frac{2}{\pi}\right)\frac{M \beta_{\text{RD},k}}{\alpha_\text a^2 \alpha_\text d^2}$. 8) ${\tilde G}_k$: Combining \eqref{eq:gamma}, \eqref{eq:Aa:approx}, and \eqref{eq:Ad:approx}, we can find the value of ${\tilde G}_k$. \section{Proof of Proposition \ref{prop:rate:compare}}\label{app:prop:rate:compare} We can readily observe that $R_k^\text{pD} > {\tilde R}_k$ and $R_k^\text p > R_k^\text{pA}$. Thus, we only focus on comparing $R_k^\text{pA}$ and $R_k^\text{pD}$. Due to the fact that ${\hat\sigma}_{\text{SR},k}^2 = \frac{\pi}{2} {\sigma}_{\text{SR},k}^2$ and ${\hat\sigma}_{\text{RD},k}^2 = \frac{\pi}{2} {\sigma}_{\text{RD},k}^2$ (c.f. \eqref{eq:sigma_SR}, \eqref{eq:sigma_RD}, and Corollary \ref{coro:perfect:ADC}), and by neglecting the low order terms as $M \rightarrow \infty$, the ratio between the SINR of $R_k^\text{pA}$ and that of $R_k^\text{pD}$ can be expressed as \begin{align} \frac{2^{\frac{2\tau_\text c}{\tau_\text c - 2\tau_\text p} R_k^\text{pA}} -1}{2^{\frac{2\tau_\text c}{\tau_\text c - 2\tau_\text p} R_k^\text{pD}} - 1} \rightarrow \frac{f_2}{f_1}, \end{align} where \begin{align} f_1 &= \frac{2}{\pi} p_{\text S,k} \sigma_{\text{SR},k}^4 \sigma_{\text{RD},k}^2 \beta_{\text{RD},k} + \frac{2}{\pi} p_{\text S,k} \sigma_{\text{RD},k}^4 \sigma_{\text{SR},k}^2 \beta_{\text{SR},k} \\ \notag &+ \frac{2}{\pi} \sum\limits_{i\neq k} p_{\text S,i} \left( \sigma_{\text{SR},k}^2 \sigma_{\text{RD},k}^4 \beta_{\text{SR},i} + \sigma_{\text{SR},i}^4 \sigma_{\text{RD},i}^2 \beta_{\text{RD},k} \right) \\ \notag &+ \sigma_{\text{SR},k}^2 \sigma_{\text{RD},k}^4 + \left(1 - \frac{2}{\pi}\right)\beta_{\text{RD},k} \sum\limits_{i=1}^K p_{\text S,i}\sigma_{\text{SR},i}^4 \sigma_{\text{RD},i}^2 \\ \notag &+\frac{1}{p_\text R}\sum\limits_{i=1}^K p_{\text S,i}\sigma_{\text{SR},i}^4 \sigma_{\text{RD},i}^2 \\ f_2 &= p_{\text S,k} \sigma_{\text{SR},k}^4 \sigma_{\text{RD},k}^2 \beta_{\text{RD},k} + p_{\text S,k} \sigma_{\text{RD},k}^4 \sigma_{\text{SR},k}^2 \beta_{\text{SR},k} \\ \notag &+ \sum\limits_{i\neq k} p_{\text S,i} \left( \sigma_{\text{SR},k}^2 \sigma_{\text{RD},k}^4 \beta_{\text{SR},i} + \sigma_{\text{SR},i}^4 \sigma_{\text{RD},i}^2 \beta_{\text{RD},k} \right)\\ \notag &+ \left(\frac{\pi}{2} - 1\right) \left(1 + \sum\limits_{k=1}^K p_{\text S,k} \beta_{\text{SR},k} \right) \sigma_{\text{SR},k}^2 \sigma_{\text{RD},k}^4 \\ \notag &+\frac{1}{p_\text R}\sum\limits_{i=1}^K p_{\text S,i}\sigma_{\text{SR},i}^4 \sigma_{\text{RD},i}^2. \end{align} Since $f_1 < f_2$, we conclude that $R_k^\text{pA} > R_k^\text{pD}$. This completes the proof. \bibliographystyle{IEEE} \begin{footnotesize}
{'timestamp': '2017-03-28T02:03:29', 'yymm': '1703', 'arxiv_id': '1703.08657', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08657'}
arxiv
\section{Introduction} \label{} In many applications one encounters the need to classify a given object under one of a number of distinct groups or classes based on a set of features known as the feature vector. A typical example is the task of classifying a machine part under one of a number of health states. Other applications that involve classification include face detection, object recognition, medical diagnosis, credit card fraud prediction and machine fault diagnosis. A common treatment of such classification problems is to model the conditional density functions of the feature vector \citep{ng2002discriminative}. Then, the most likely class to which a feature vector belongs can be chosen as the class that maximises the a posteriori probability of the feature vector. This is known as the maximum a posteriori (MAP) decision rule. Let $K$ be the number of classes, $\mathcal{C}_k$ be the $k$th class, $\textbf{x}$ be a feature vector and $\mathcal{D}_k$ be training samples belonging to the $k$th class $(k\in \{ 1,2,...,K\} )$. The MAP decision rule for the classification task is then to choose the most likely class of $\textbf{x}$, $\mathcal{C}^*(\textbf{x})$ given as: \begin{equation} \mathcal{C}^*(\textbf{x})=\arg \max_{\mathcal{C}_k} p(\mathcal{C}_k|\textbf{x}), \quad k\in \{ 1,2,...,K\} \end{equation} We assume for the moment that there are only $K=2$ classes, i.e. binary classification (we consider multi-class classification in a later section). Then, using Bayes' rule, the two posterior probabilities can be expressed as: \begin{equation} p(\mathcal{C}_k|\textbf{x})=\frac{p(\textbf{x}|\mathcal{C}_k)\times p(\mathcal{C}_k)}{p(\textbf{x})}, \quad {k\in \{ 1,2\} } \end{equation} It is often the case that the prior probabilities $p(\mathcal{C}_1)$ and $p(\mathcal{C}_2)$ are known, or else they may be estimable from the relative frequencies of $\mathcal{D}_1$ and $\mathcal{D}_2$ in $\mathcal{D}$ where $\mathcal{D}=\mathcal{D}_1 \cup \mathcal{D}_2$. Let these priors be given by $\pi_1$ and $\pi_2$ respectively for class $\mathcal{C}_1$ and $\mathcal{C}_2$. Then, the likelihood ratio defined as: \begin{equation} \lambda(\textbf{x})=\frac{p(\textbf{x}|\mathcal{C}_1)}{p(\textbf{x}|\mathcal{C}_2)} \end{equation} is compared against a threshold defined as $\tau=\pi_2/\pi_1$ so that one decides on class $\mathcal{C}_1$ if $\lambda(\textbf{x})\geq \tau$ and class $\mathcal{C}_2$ otherwise. Linear Discriminant Analysis (LDA) proceeds from here with two basic assumptions \citep[Chapter~8]{izenman2009modern}: \begin{enumerate} \item The conditional probabilities $p(\textbf{x}|\mathcal{C}_1)$ and $p(\textbf{x}|\mathcal{C}_2)$ have multivariate normal distributions. \item The two classes have equal covariance matrices, an assumption known as homoscedasticity. \end{enumerate} Let $\bar{\textbf{x}}_1$, $\bm{\Sigma}_1$ be the mean and covariance matrix of $\mathcal{D}_1$ and $\bar{\textbf{x}}_2$, $\bm{\Sigma}_2$ be the mean and covariance of $\mathcal{D}_2$ respectively. Then, for $k\in \{ 1,2\}$, \begin{equation} p(\textbf{x}|\mathcal{C}_k)=\frac{1}{\sqrt{(2\pi)^d\det(\bm{\Sigma}_k)}}\exp\bigg [-\frac{1}{2}(\textbf{x}-\bar{\textbf{x}}_k)^T\bm{\Sigma}_k^{-1}(\textbf{x}-\bar{\textbf{x}}_k) \bigg] \end{equation} where $d$ is the dimensionality of $\mathcal{X}$, which is the feature space of $\textbf{x}$. Given the above definitions of the conditional probabilities, one may obtain a log-likelihood ratio given as: \begin{align} &\ln \lambda(\textbf{x})\nonumber\\ &=\frac{1}{2}\ln \frac{\det \bm{\Sigma}_2}{\det \bm{\Sigma}_1}+\frac{1}{2} \bigg [(\textbf{x}-\bar{\textbf{x}}_2)^T\bm{\Sigma}_2^{-1}(\textbf{x}-\bar{\textbf{x}}_2)-(\textbf{x}-\bar{\textbf{x}}_1)^T\bm{\Sigma}_1^{-1}(\textbf{x}-\bar{\textbf{x}}_1) \bigg] \end{align} which is then compared against $\ln \tau$ so that $\mathcal{C}_1$ is chosen if $\ln \lambda(\textbf{x})\geq \ln \tau$, and $\mathcal{C}_2$ otherwise. Thus, the decision rule for classifying a vector $\textbf{x}$ under class $\mathcal{C}_1$ can be rewritten as: \begin{equation} (\textbf{x}-\bar{\textbf{x}}_2)^T\bm{\Sigma}_2^{-1}(\textbf{x}-\bar{\textbf{x}}_2)-(\textbf{x}-\bar{\textbf{x}}_1)^T\bm{\Sigma}_1^{-1}(\textbf{x}-\bar{\textbf{x}}_1) \geq \ln \frac{\tau^2\det \bm{\Sigma}_1}{\det \bm{\Sigma}_2} \end{equation} In general, this result is a quadratic discriminant. However, a linear classifier is often desired for the following reasons: \begin{enumerate} \item A linear classifier is robust against noise since it tends not to overfit \citep{mika1999fisher}. \item A linear classifier has relatively shorter training and testing times \citep{yuan2012recent}. \item Many linear classifiers allow for a transformation of the original feature space into a higher dimensional feature space using the kernel trick for better classification in the case of a non-linear decision boundary \citep[Chapter~6]{bishop2006pattern}. \end{enumerate} By calling on the assumption of homoscedasticity, i.e. $\bm{\Sigma}_1=\bm{\Sigma}_2=\bm{\Sigma}_x$, the original quadratic discriminant given by (6) for classifying a given vector $\textbf{x}$ decomposes into the following linear decision rule: \begin{equation} \textbf{x}^T\bm{\Sigma}_x^{-1}(\bar{\textbf{x}}_1-\bar{\textbf{x}}_2) \mathop{\gtreqless}_{\mathcal{C}_2}^{\mathcal{C}_1} \ln\tau+\frac{1}{2}(\bar{\textbf{x}}_1^T\bm{\Sigma}_x^{-1}\bar{\textbf{x}}_1-\bar{\textbf{x}}_2^T\bm{\Sigma}_x^{-1}\bar{\textbf{x}}_2) \end{equation} Here, $\bm{\Sigma}_x^{-1}(\bar{\textbf{x}}_1-\bar{\textbf{x}}_2)$ is a vector of weights denoted by $\textbf{w}$ and $\ln\tau+\frac{1}{2}(\bar{\textbf{x}}_1^T\bm{\Sigma}_x^{-1}\bar{\textbf{x}}_1-\bar{\textbf{x}}_2^T\bm{\Sigma}_x^{-1}\bar{\textbf{x}}_2)$ is a threshold denoted by $w_0$. This linear classifier is also known as Fisher’s Linear Discriminant. If only the weight vector \textbf{w} is required for dimensionality reduction, \textbf{w} may be obtained by maximising Fisher’s criterion \citep{fisher1936use}, given by: \begin{equation} S=\dfrac{\textbf{w}^T(\bar{\textbf{x}}_1-\bar{\textbf{x}}_2)(\bar{\textbf{x}}_1-\bar{\textbf{x}}_2)^T\textbf{w}}{\textbf{w}^T\bm{\Sigma}_x\textbf{w}} \end{equation} where $\bm{\Sigma}_{x}=n_1\bm{\Sigma}_1+n_2\bm{\Sigma}_2$ and $n_1$, $n_2$ are the cardinalities of $\mathcal{D}_1$ and $\mathcal{D}_2$ respectively. LDA is the optimal Bayes' classifier for binary classification if the normality and homoscedasticity assumptions hold \citep{hamsici2008bayes} \citep[Chapter~8]{izenman2009modern}. It demands only the computation of the dot product between $\textbf{w}$ and $\textbf{x}$, which is a relatively computationally inexpensive operation. As a supervised learning algorithm, LDA is performed either for dimensionality reduction (usually followed by classification) \citep[Chapter~16]{barber2012bayesian}, \citep{buturovic1994toward,duin2004linear,sengur2008expert}, or directly for the purpose of statistical classification \citep[Chapter~4]{fukunaga2013introduction}\citep{izenman2009modern,mika1999fisher}. LDA has been applied to several problems such as medical diagnosis e.g. \citep{sharma2008cancer,coomans1978application,sengur2008expert,polat2008cascade}, face and object recognition e.g. \citep{song2007parameterized,chen2000new,liu2007efficient,yu2001direct} and credit card fraud prediction e.g. \citep{mahmoudi2015detecting}. The widespread use of LDA in these areas is not because the datasets necessarily satisfy the normality and homoscedasticity assumptions, but mainly due to the robustness of LDA against noise, being a linear model \citep{mika1999fisher}. Since the linear Support Vector Machine (SVM) can be quite expensive to train, especially for large values of $K$ or $n$ ($n=n_1+n_2$), LDA is often relied upon \citep{hariharan2012discriminative}. Yet, practical implementation of LDA is not without problems. Of note is the small sample size (SSS) problem that LDA faces with high-dimensional data and much smaller training data \citep{sharma2015linear,lu2003regularized}. When $d\gg n$, the scatter matrix $\Sigma_x$ is not invertible, as it is not full-rank. Since the decision rule as given by (7) requires the computation of the inverse of $\Sigma_x$, the singularity of $\Sigma_x$ makes the solution infeasible. In works by, for example, \citep{liu2007efficient,paliwal2012improved}, this problem is overcome by taking the Moore-Penrose pseudo-inverse of the scatter matrix, rather than the ordinary matrix inverse. \cite{sharma2008cancer} use a gradient descent approach where one starts from an initial solution of $\textbf{w}$ and moves in the negative direction of the gradient of Fisher's criterion (8). This method avoids the computation of an inverse altogether. Another approach to solving the SSS problem involves adding a scalar multiple of the identity matrix to the scatter matrix to make the resulting matrix non-singular, a method known as regularised discriminant analysis \citep{friedman1989regularized,lu2003regularized}. However, for a given dataset that does not satisfy the homoscedasticity or normality assumption, one would expect that modifications to the original LDA procedure accounting for these violations would yield an improved performance. One such modification, in the case of a non-normal distribution, is the mixture discriminant analysis \citep{hastie1996discriminant,mclachlan2004discriminant,ju2003gaussian} in which a non-normal distribution is modelled as a mixture of Gaussians. However, the parameters of the mixture components or even the number of mixture components, are usually not known a priori. Other non-parametric approaches to LDA that remove the normality assumption involve using local neighbourhood structures \citep{cai2007locality,fukunaga1983nonparametric,li2009nonparametric} to construct a similarity matrix instead of the scatter matrix $\Sigma_x$ used in LDA. However, these approaches aim at linear dimensionality reduction, rather than linear classification. Another modification, in the case of a non-linear decision boundary between $\mathcal{D}_1$ and $\mathcal{D}_2$, is the Kernel Fisher Discriminant (KFD) \citep{mika1999fisher,zhao2009multiclass,polat2008cascade}. KFD maps the original feature space $\mathcal{X}$ into some other space $\mathcal{Y}$ (usually higher dimensional) via the kernel trick \citep{mika1999fisher}. While the main utility of the kernel is to guarantee linear separability in the transformed space, the kernel may also be employed to transform non-normal data into one that is near-normal. Our proposed method differs from the above approaches in that we primarily consider violation of the homoscedasticity assumption, and do not address the SSS problem. We seek to provide a linear approximation to the quadratic boundary given by (6) under heteroscedasticity without any kernel transformation; we note that several heteroscedastic LDA approaches have been proposed to this effect. Nevertheless, for reasons which we highlight in the next section, our contributions in this paper are stated explicitly as follows: \begin{enumerate} \item We propose a novel linear classifier, which we term the Gaussian Linear Discriminant (GLD), that directly minimises the Bayes error under heteroscedasticity via an efficient optimisation procedure. This is presented in Section 3. \item We propose a local neighbourhood search method to provide a more robust classifier if the data has a non-normal distribution (Section 4). \end{enumerate} \section{Related Work} Under the heteroscedasticity assumption, many LDA approaches have been proposed among which we mention \citep[Chapter~4]{fukunaga2013introduction},\citep{zhang2008equalized,mclachlan2004discriminant,duin2004linear,decell1976feature,decell1977feature,malina1981extended,loog2002non}. As it is known that Fisher's criterion (whose maximisation is equivalent to the LDA derivation described in the Introduction section) only takes into account the difference in the projected class means, existing heteroscedastic LDA approaches tend to obtain a generalisation on Fisher's criterion. In the work of \citep{loog2002non}, for instance, a directed distance matrix (DDM) known as the Chernoff distance, which takes into account the difference in covariance matrices between the two classes as well as the projected class means, is maximised instead of Fisher's criterion (8). The same idea employing the Chernoff criterion is used by \citep{duin2004linear}. A wider class of Bregman divergences including the Bhattacharya distance \citep{decell1976feature} and the Kullback-Leibler divergence \citep{decell1977feature} have also been used for heteroscedastic LDA, as Fisher's criterion can be considered a special case of these measures when the covariance matrices of the classes are equal. However, most of these approaches aim at linear dimensionality reduction, which involves finding a linear transformation that transforms the original data into one of reduced dimensionality, while at the same time maximising the discriminatory information between the classes. Our focus with this paper, however, is not on dimensionality reduction, but on obtaining a Bayes optimal linear classifier for binary classification assuming that the covariance matrices are not equal. As far as we know, the closest work to ours in this regard are the works by \citep{marks1974discriminant,anderson1962classification,peterson1966method,fukunaga2013introduction} Obtaining the Bayes optimal linear classifier involves minimising the probability of misclassification $p_e$ as given by: \begin{equation} p_e=\pi_1p(y<w_0|\mathcal{C}_1)+\pi_2p(y \geq w_0|\mathcal{C}_2) \end{equation} where $y=\textbf{w}^T\textbf{x}$. Unfortunately, there is no closed-form solution to the minimisation of (9) \citep{anderson1962classification}. Thus, an iterative procedure is inevitable in order to obtain the Bayes optimal linear classifier. In the work of \citep{marks1974discriminant}, for example, the iterative procedure described is to solve for $\textbf{w}$ and $w_0$ as given by \begin{align} &\textbf{w}=\big[s_1\bm{\Sigma}_1+s_2\bm{\Sigma}_2\big]^{-1}(\bar{\textbf{x}}_1-\bar{\textbf{x}}_2)\nonumber\\ & w_0=\mu_1-s_1\sigma_1^2=\mu_2+s_2\sigma_2^2 \end{align} by obtaining the optimal values of $s_1$ and $s_2$ via systematic trial and error. We denote this heteroscedastic LDA procedure by R-HLD-2, for the reason that the two parameters $s_1$ and $s_2$ are chosen at random. \citep{anderson1962classification} makes the observation that if the weight vector $\textbf{w}$ and the threshold $w_0$ are both multiplied by the same positive scalar, the decision boundary remains unchanged. Therefore, by multiplying (10) through by the scalar $s_1+s_2$, $\textbf{w}$ and $w_0$ can be put in the form of: \begin{align} &\textbf{w}=\big[s\bm{\Sigma}_2+(1-s)\bm{\Sigma}_1\big]^{-1}(\bar{\textbf{x}}_1-\bar{\textbf{x}}_2)\nonumber\\ & w_0=\mu_1-(1-s)\sigma_1^2=\mu_2+s\sigma_2^2 \end{align} Still, the optimal value of $s$ has to be chosen by systematic trial and error. We denote this heteroscedastic LDA approach by R-HLD-1, for the reason that only one parameter $s$ is chosen at random. As we show in the next section, $s$ is unbounded. Therefore, the difficulty faced by this approach is that $s$ has to be chosen from the interval $(-\infty,\infty)$, so that the probability of finding the optimal $s$ for a given dataset is low, without extensive trial and error to limit the choice of $s$ to some finite interval $[a,b]$. To avoid the unguided trial and error procedure in \citep{marks1974discriminant,anderson1962classification}, \citep{peterson1966method} and \citep[Chapter~4]{fukunaga2013introduction} propose a theoretical approach described below: \begin{enumerate} \item Change $s$ from $0$ to $1$ with small step increments $\Delta s$. \item Evaluate $\textbf{w}$ as given by: \begin{equation} \textbf{w}=\big[s\bm{\Sigma}_1+(1-s)\bm{\Sigma}_2\big]^{-1}(\bar{\textbf{x}}_1-\bar{\textbf{x}}_2) \end{equation} \item Evaluate $w_0$ as given by: \begin{equation} w_0=\frac{s\mu_2\sigma_1^2+(1-s)\mu_1\sigma_2^2}{s\sigma_1^2+(1-s)\sigma_2^2} \end{equation} \item Compute the probability of misclassification $p_e$. \item Choose $\textbf{w}$ and $w_0$ that minimise $p_e$. \end{enumerate} We refer to this procedure as C-HLD, for the reason that the optimal $s$ is constrained in the interval $[0,1]$. However, we highlight two main problems with the above C-HLD procedure: \begin{enumerate} \item There is no obvious choice of the step rate $\Delta s$. Too small a value of $\Delta s$ will demand too many matrix inversions in Step 2, as there will be too many $s$ values. On the other hand, if $\Delta s$ is too large, the optimal $s$ may not be refined enough, and the $\textbf{w}$ obtained may not be optimal. Specifically, the change in $\textbf{w}$ that results from a small change in $s$ is given as: \begin{equation} \mathrm{d}\textbf{w}=\big(s\bm{\Sigma}_2+(1-s)\bm{\Sigma}_1\big)^{-1}(\bm{\Sigma}_1-\bm{\Sigma}_2)\big(s\bm{\Sigma}_2+(1-s)\bm{\Sigma_1}\big)^{-1}(\bar{\textbf{x}}_1-\bar{\textbf{x}}_2)\mathrm{d}s \end{equation} which can affect the classification accuracy. \item The solution obtained this way is only locally optimal as $s$ is bounded in the interval $[0,1]$. As we show in the next section, $s$ is actually unbounded. When there is a class imbalance \citep{xue2008unbalanced}, the optimal $s$ may be found outside the interval $[0,1]$ which can lead to poor classification accuracy. \end{enumerate} Our proposed algorithm, which is described in the next section, unlike the trial and error approach by \citep{marks1974discriminant,anderson1962classification}, has a principled optimisation procedure, and unlike \citep{fukunaga2013introduction,peterson1966method} does not encounter the problem of choosing an inappropriate $\Delta s$, nor restricts $s$ to the interval $[0,1]$. Consequently, our proposed algorithm achieves a far lower training time than the C-HLD, R-HLD-1 and R-HLD-2, for roughly the same classification accuracy. \section{Gaussian Linear Discriminant} Let $\textbf{w}\in \mathbb{R}^d$ be a vector of weights, and $w_0\in\mathbb{R}$, a threshold such that: \begin{equation} \mathcal{C}^*(\textbf{x})= \begin{cases} \mathcal{C}_1 & \quad \text{if} \quad y=\textbf{w}^T\textbf{x}\geq w_0\\ \mathcal{C}_2 & \quad \text{if} \quad y=\textbf{w}^T\textbf{x}<w_0 \\ \end{cases} \end{equation} Since $\textbf{x}$ is assumed to have a multivariate normal distribution in classes $\mathcal{C}_1$ and $\mathcal{C}_2$, $y$ has a mean of $\mu_1$ and a variance of $\sigma_1^2$ for class $\mathcal{C}_1$ and a mean of $\mu_2$ and a variance of $\sigma_2^2$ for class $\mathcal{C}_2$ given as: \begin{equation} \mu_1=\textbf{w}^T\bar{\textbf{x}}_1 \quad \mu_2=\textbf{w}^T\bar{\textbf{x}}_2 \quad \sigma_1^2=\textbf{w}^T\bm{\Sigma}_1\textbf{w} \quad \sigma_2^2=\textbf{w}^T\bm{\Sigma}_2\textbf{w} \end{equation} With reference to the Bayes error of (9), the individual misclassification probabilities can be expressed as: \begin{align} & p(y<w_0|\mathcal{C}_1)\nonumber \\ &=\int_{-\infty}^{w_0}\frac{1}{\sqrt{2\pi}\sigma_1}\exp \bigg[-\frac{(\zeta-\mu_1)^2}{2\sigma_1^2} \bigg]d\zeta=1-Q\bigg(\frac{w_0-\mu_1}{\sigma_1}\bigg) \end{align} and \begin{equation} p(y\geq w_0|\mathcal{C}_2)=\int_{w_0}^{\infty}\frac{1}{\sqrt{2\pi}\sigma_2}\exp \bigg[-\frac{(\zeta-\mu_2)^2}{2\sigma_2^2} \bigg]d\zeta=Q\bigg(\frac{w_0-\mu_2}{\sigma_2}\bigg) \end{equation} where $Q(^.)$ is the Q-function. Therefore, the Bayes error to be minimised may be rewritten as: \begin{equation} p_e=\pi_1\big[1-Q(z_1)\big]+\pi_2\big[Q(z_2)\big] \end{equation} where \begin{equation} z_1=\frac{w_0-\mu_1}{\sigma_1} \quad \text{and} \quad z_2=\frac{w_0-\mu_2}{\sigma_2} \end{equation} Our aim is to find a local minimum of $p_e$. A necessary condition is for the gradient of $p_e$ to be zero, i.e., \begin{equation} \nabla p_e(\textbf{w},w_0)=\bigg[\frac{\partial p_e}{\partial \textbf{w}^T},\frac{\partial p_e}{\partial w_0} \bigg]^T=\textbf{0} \end{equation} From (9), it can be shown that: \begin{equation} \frac{\partial p_e}{\partial \textbf{w}}=\pi_1 \bigg(\frac{1}{\sqrt{2\pi}}e^{-z_1^2/2}\frac{\partial z_1}{\partial\textbf{w}} \bigg) -\pi_2\bigg(\frac{1}{\sqrt{2\pi}}e^{-z_2^2/2}\frac{\partial z_2}{\partial \textbf{w}} \bigg) \end{equation} From (20), however, we obtain the following: \begin{equation} \frac{\partial z_1}{\partial\textbf{w}}=\frac{-\sigma_1\bar{\textbf{x}}_1-z_1\bm{\Sigma}_1\textbf{w}}{\sigma_1^2} \quad \text{and} \quad \frac{\partial z_2}{\partial\textbf{w}}=\frac{-\sigma_2\bar{\textbf{x}}_2-z_2\bm{\Sigma}_2\textbf{w}}{\sigma_2^2} \end{equation} Therefore, \begin{equation} \frac{\partial p_e}{\partial \textbf{w}}=\frac{1}{\sqrt{2\pi}}\bigg[ -\pi_1e^{-z_1^2/2} \bigg(\frac{\sigma_1\bar{\textbf{x}}_1+z_1\bm{\Sigma}_1\textbf{w}}{\sigma_1^2}\bigg) + \pi_2e^{-z_2^2/2} \bigg(\frac{\sigma_2\bar{\textbf{x}}_2+z_2\bm{\Sigma}_2\textbf{w}}{\sigma_2^2}\bigg)\bigg] \end{equation} It can similarly be shown from (9) that, \begin{equation} \frac{\partial p_e}{\partial w_0}=\pi_1 \bigg(\frac{1}{\sqrt{2\pi}}e^{-z_1^2/2}\frac{\partial z_1}{\partial w_0} \bigg)-\pi_2\bigg(\frac{1}{\sqrt{2\pi}}e^{-z_2^2/2}\frac{\partial z_2}{\partial w_0} \bigg) \end{equation} Again, from (20), \begin{equation} \frac{\partial z_1}{\partial w_0}=\frac{1}{\sigma_1} \quad \text{and} \quad \frac{\partial z_2}{\partial w_0}=\frac{1}{\sigma_2} \end{equation} Therefore, \begin{equation} \frac{\partial p_e}{\partial w_0}=\frac{\pi_1}{\sqrt{2\pi}} \bigg(\frac{1}{\sigma_1}e^{-z_1^2/2}\bigg)-\frac{\pi_2}{\sqrt{2\pi}}\bigg(\frac{1}{\sigma_2}e^{-z_2^2/2} \bigg) \end{equation} Now, equating the gradient $\nabla p_e(\textbf{w},w_0)$ to zero, the following set of equations are obtained: \begin{equation} \bigg(\frac{\pi_2z_2}{\sigma_2^2}e^{-z_2^2/2}\bm{\Sigma}_2-\frac{\pi_1z_1}{\sigma_1^2}e^{-z_1^2/2}\bm{\Sigma}_1\bigg)\textbf{w}=\bigg(\frac{\pi_1}{\sigma_1}e^{-z_1^2/2} \bigg)\bar{\textbf{x}}_1-\bigg(\frac{\pi_2}{\sigma_2}e^{-z_2^2/2}\bigg)\bar{\textbf{x}}_2 \end{equation} \begin{equation} \frac{\pi_1}{\sigma_1}e^{-z_1^2/2}=\frac{\pi_2}{\sigma_2}e^{-z_2^2/2} \end{equation} Substituting (29) into (28) yields: \begin{equation} \bigg(\frac{z_2}{\sigma_2}\bm{\Sigma}_2-\frac{z_1}{\sigma_1}\bm{\Sigma}_1\bigg)\textbf{w}=(\bar{\textbf{x}}_1-\bar{\textbf{x}}_2) \end{equation} Then the vector $\textbf{w}$ can be given by: \begin{equation} \textbf{w}=\bigg(\frac{z_2}{\sigma_2}\bm{\Sigma}_2-\frac{z_1}{\sigma_1}\bm{\Sigma}_1\bigg)^{-1}(\bar{\textbf{x}}_1-\bar{\textbf{x}}_2) \end{equation} It will be noted however that (31) is still in terms of $w_0$, so that an explicit representation of $w_0$ in terms of $\textbf{w}$ is needed from (29) to substitute in $z_1$ and $z_2$ in (31). This is where our approach most significantly differs from \citep{fukunaga2013introduction}. Solving for $w_0$ from (29) results in the following quadratic: \begin{equation} \frac{z_2^2}{2}-\frac{z_1^2}{2}-\ln\bigg(\frac{\tau\sigma_1}{\sigma_2}\bigg)=0 \end{equation} which can be simplified to: \begin{equation} \bigg(\frac{w_0-\mu_2}{\sigma_2}\bigg)^2-\bigg(\frac{w_0-\mu_1}{\sigma_1}\bigg)^2 -2\ln \frac{\tau\sigma_1}{\sigma_2}=0, \end{equation} where $\tau$ is given as before as $\tau=\pi_2/\pi_1$. If $\tau$ is defined and not equal to zero, and $\sigma_1^2\not=\sigma_2^2$ (since $\bm{\Sigma}_1\not=\bm{\Sigma}_2$ for heteroscedastic LDA), (33) can be shown to have the following solutions: \begin{equation} w_0=\frac{\mu_2\sigma_1^2-\mu_1\sigma_2^2\pm\sigma_1\sigma_2\sqrt{(\mu_1-\mu_2)^2+2(\sigma_1^2-\sigma_2^2)\ln\big(\frac{\tau\sigma_1}{\sigma_2}\big)}}{\sigma_1^2-\sigma_2^2} \end{equation} Nevertheless, since there are two solutions to $w_0$ in (34), a choice has to be made as to which of them is substituted into (31). To eliminate one of the solutions, we consider the second-order partial derivative of $p_e$ with respect to $w_0$ evaluated at $w_0$ as given by (34), and determine under what condition it is greater than or equal to zero. This is a second-order necessary condition for $p_e$ to be a local minimum. From (27), it can be shown that: \begin{equation} \frac{\partial^2 p_e}{\partial w_0^2}=\frac{\pi_1}{\sqrt{2\pi}} \bigg(-\frac{z_1}{\sigma_1^2}e^{-z_1^2/2}\bigg)+\frac{\pi_2}{\sqrt{2\pi}}\bigg(\frac{z_2}{\sigma_2^2}e^{-z_2^2/2} \bigg) \end{equation} We denote this second-order derivative by $h$. We then consider all possibilities of $z_1$ and $z_2$ (which are the variables in (35) that depend on $w_0$) under three cases, and analyse the sign of $h$ in each. \subsubsection*{Case 1} $z_2\leq 0$ and $z_1\geq 0$: then $h$ is trivially non-positive. \subsubsection*{Case 2} $z_2\geq 0$ and $z_1\leq 0$: then $h$ is trivially non-negative. \subsubsection*{Case 3} $z_2>0$ and $z_1>0$ or $z_2<0$ and $z_1<0$: then $h$ is non-negative if and only if \begin{equation} \ln\bigg(\frac{\pi_2z_2}{\sigma_2^2}\bigg)-\frac{z_2^2}{2} \geq \ln\bigg(\frac{\pi_1z_1}{\sigma_1^2}\bigg)-\frac{z_1^2}{2} \end{equation} i.e., \begin{equation} \ln\bigg(\frac{z_2}{\sigma_2}\bigg/ \frac{z_1}{\sigma_1}\bigg) \geq \frac{z_2^2}{2}-\frac{z_1^2}{2}-\ln\bigg(\frac{\tau\sigma_1}{\sigma_2}\bigg) \end{equation} It will be noted that the right-hand side of the inequality (37) is identically zero, as can be seen from (32). Therefore, the condition under which $h$ is greater than or equal to zero is when: \begin{equation} \frac{z_2}{\sigma_2} \geq \frac{z_1}{\sigma_1} \end{equation} Note also that Case 2 necessarily satisfies (38) so that we consider (38) as the general inequality for the non-negativity of $h$ for all cases, and thus for $w_0$ to be a local minimum. Now, when one considers the two solutions of $w_0$ in (35), only the solution given by: \begin{equation} w_0=\frac{\mu_2\sigma_1^2-\mu_1\sigma_2^2+\sigma_1\sigma_2\sqrt{(\mu_1-\mu_2)^2+2(\sigma_1^2-\sigma_2^2)\ln\big(\frac{\tau\sigma_1}{\sigma_2}\big)}}{\sigma_1^2-\sigma_2^2} \end{equation} satisfies the inequality of (38), i.e., only this choice of $w_0$ corresponds to a local minimum. The proof of this is given in the appendix. We may then substitute this expression of $w_0$ into (31) so that (31) is in terms of $\textbf{w}$ only. Even so, $\textbf{w}$ has to be solved for iteratively. This is because (31) has no closed-form solution since $\mu_1,\mu_2,\sigma_1,\sigma_2$ are themselves functions of $\textbf{w}$. As the iterative procedure requires an initial choice of $\textbf{w}$, we use Fisher's choice of the weight vector as given by: \begin{equation} \textbf{w}=(n_1\bm{\Sigma}_1+n_2\bm{\Sigma}_2)^{-1}(\bar{\textbf{x}}_1-\bar{\textbf{x}}_2) \end{equation} as our initial solution. Again, we mention that $n_1$ and $n_2$ are the cardinalities of $\mathcal{D}_1$ and $\mathcal{D}_2$. After a number of such iterative updates, the optimal $w_0$ is then solved for from (39). This algorithm, known as the Gaussian Linear Discriminant (GLD), is described in detail in Algorithm 1. \begin{algorithm} \caption{GLD}\label{alg1} \begin{algorithmic}[1] \State Input: $\mathcal{D}_1$ and $\mathcal{D}_2$ \State Evaluate $\bar{\textbf{x}}_1,\bar{\textbf{x}}_2,\bm{\Sigma}_1,\bm{\Sigma}_2$ \State Initialise $\textbf{w}$: $\textbf{w}=(n_1\bm{\Sigma}_1+n_2\bm{\Sigma}_2)^{-1}(\bar{\textbf{x}}_1-\bar{\textbf{x}}_2)$ \State Evaluate $\mu_1,\mu_2,\sigma_1^2,\sigma_2^2,z_1,z_2$. \While {Stopping criteria are not satisfied} \State Solve for $w_0$ from (39) \State Evaluate $z_1,z_2$ \State Evaluate the Bayes error $p_e$ \State Update $\textbf{w}$ as $\textbf{w}=\bigg(\frac{z_2}{\sigma_2}\bm{\Sigma}_2-\frac{z_1}{\sigma_1}\bm{\Sigma}_1\bigg)^{-1}(\bar{\textbf{x}}_1-\bar{\textbf{x}}_2)$ \State Evaluate $\mu_1,\mu_2,\sigma_1,\sigma_2$. \EndWhile \end{algorithmic} \end{algorithm} Note that by multiplying both $\textbf{w}$ of (31) and $w_0$ proportionally by $c=(\sigma_1z_2-\sigma_2z_1)/\sigma_1\sigma_2$ (due to (38), $c$ is non-negative and hence the discrimination criterion given by (15) is not changed), the GLD may be viewed in terms of the optimal solution of (11), where \begin{equation} s=-\sigma_2z_1/(\sigma_1z_2-\sigma_2z_1). \end{equation} which is unbounded given the inequality of (38). However, unlike \citep{anderson1962classification,marks1974discriminant}, $s$ is not chosen by systematic trial and error, and unlike \citep{fukunaga2013introduction}, $s$ is not varied between $0$ and $1$ at small step increments. Instead, since $s$ is a function of $\textbf{w}$ and $w_0$, our algorithm may be interpreted as obtaining increasingly refined values of $s$ by improving upon $\textbf{w}$ and $w_0$ starting from Fisher's solution, as is described in Algorithm 1. \subsection{Stopping Criteria} The GLD algorithm may be terminated under any of the following conditions: \begin{enumerate} \item When the change in the objective function $p_e$ remains within a certain tolerance $\epsilon_1$ for a number of consecutive iterations. \item When the change in the norm of $\textbf{w}$ remains within a certain tolerance $\epsilon_2$ for a number of consecutive iterations. \item When the gradient of $p_e$ as given by (21) remains within a certain tolerance $\epsilon_3$ for a number of consecutive iterations. \item After a fixed number of iterations $I$, if convergence is slow. \end{enumerate} At the end of the algorithm, the final solution may be chosen either as the solution to which the iterations converge, or the solution corresponding to the minimum $p_e$ found in the iterative updates. \subsection{Multiclass Classification} Suppose now that there are $K>2$ classes in the dataset $\mathcal{D}$, then the classification problem may be reduced to a number of binary classification problems. The two main approaches usually taken for this reduction are the One-vs-All (OvA) and One-vs-One (OvO) strategies \citep{bishop2006pattern,hsu2002comparison}. \subsubsection{One-vs-All (OvA)} In OvA, one trains a classifier to discriminate between one class and all other classes. Thus, there are $K$ different classifiers. An unknown vector $\textbf{x}$ is then tested on all $K$ classifiers so that the class corresponding to the classifier with the highest discriminant score is chosen. However, with respect to the proposed GLD algorithm, this is an ill-suited approach. This is because the collection of all other classes on one side of the discriminant will not necessarily have a normal distribution, and could in fact be multimodal, if the means are well-separated. Since our algorithm is built on strong normality assumptions of the data on each side of the discriminant, the GLD, as has been formulated, is expected to perform poorly. \subsubsection{One-vs-One} In OvO, a classifier is trained to discriminate between every pair of classes in the dataset, ignoring the other $K-2$ classes. Thus, there are $K(K-1)/2$ unique classifiers that may be constructed. Again, an unknown vector $\textbf{x}$ is tested on all $K(K-1)/2$ classifiers. The predicted classes for all the classifiers are then tallied so that the class that occurs most frequently is chosen. This is equivalent to a majority vote decision. In a lot of cases, however, there is no clear-cut winner, as more than one class may have the highest number of votes. In such a case, the most likely class is often chosen randomly between those most frequently occurring classes. The GLD provides a more appropriate means for breaking such ties, by making use of the minimised Bayes error $p_e$ for each classifier. Specifically, one may instead use a weighted voting system, where the count of every predicted class is weighted by $1-p_e$, since $p_e$ provides an appropriate measure of uncertainty associated with each classifier output. Thus, the decision rule is reduced to choosing the maximum weighted vote among the $K$ classes. Note that even though the GLD minimises the Bayes error for each classifier, the overall Bayes error for a multiclass problem may not be minimised by using multiple binary classifiers. \section{Non-normal Distributions} So far, the fundamental assumption that has been used to derive the GLD is that the data in each class has a normal distribution. Thus, for an unknown non-normal distribution, the linear classifier we have obtained does not minimise the Bayes error for that unknown distribution. We argue, however, that if this unknown distribution is nearly-normal \citep{mudholkar2000epsilon}, then a more robust linear classifier may be found in some neighbourhood of the GLD. For this reason, we use a local neighbourhood search algorithm to explore the region in $\mathbb{R}^{d+1}$ around the GLD to obtain the classifier that minimises the number of misclassifications on the training dataset. We do this by perturbing each of the $d+1$ vector elements in the optimal $\tilde{\textbf{w}}=[w_0,\textbf{w}^T]^T$ obtained from the GLD procedure by a small amount $\delta\tilde{w}_i$. After every perturbation, the resulting classifier is evaluated on the test dataset. This procedure is repeated as described in Algorithm 2 until the stopping criterion is satisfied. \begin{algorithm}[!tbph] \caption{Local Neighbourhood Search (LNS)}\label{alg2} \begin{algorithmic}[1] \State Input: Optimal $\tilde{\textbf{w}}=[w_0,\textbf{w}^T]^T$ obtained from the GLD. \While {Stopping criterion is not satisfied} \State Let $\tilde{\textbf{w}}$ be the current solution. \For {$i\gets 1$ to $d$} \State $\textbf{v}^+\gets\tilde{\textbf{w}}$, $\textbf{v}^-\gets\tilde{\textbf{w}}$. \State $\textbf{v}^+\gets v_i^++\delta v_i^+$ \State Evaluate the misclassifications on the training set using $\textbf{v}^+$ \State $\textbf{v}^-\gets v_i^--\delta v_i^-$ \State Evaluate the misclassifications on the training set using $\textbf{v}^-$ \EndFor \State Set the classifier with the minimum number of misclassifications as the current solution $\tilde{\textbf{w}}$. \EndWhile \State Choose the classifier with the smallest number of misclassifications. \end{algorithmic} \end{algorithm} The algorithm is terminated after a certain maximum number of iterations $R$ is reached. Additionally, one may perform an early termination if after a predefined number of iterations $r_{max}$, there is no improvement in the minimum number of misclassifications on the training dataset that has been found in the search. \section{Experimental Validation} We validate our proposed algorithm on two artificial datasets denoted by D1 and D2, as well as on ten real-world datasets taken from the University of California, Irvine (UCI) Machine Learning Repository. These datasets are shown in Table 1, and cut across a wide range of applications including handwriting recognition, medical diagnosis, remote sensing and spam filtering. D1 and D2 are normally distributed with different covariance matrices. For D1, we generate $1000$ samples for class $\mathcal{C}_1$ and $2000$ samples for class $\mathcal{C}_2$ using the following Gaussian parameters: \begin{align} & \bar{\textbf{x}}_2=[3.86,3.10,0.84,0.84,1.64,1.08,0.26,0.01]^T, \nonumber\\ &\bm{\Sigma}_2=\text{diag}(8.41,12.06,0.12,0.22,1.49,1.77,0.35,2.73) \nonumber\\ & \bar{\textbf{x}}_1=\bar{\textbf{x}}_2-0.3, \quad \bm{\Sigma}_1=\textbf{I} \end{align} For D2, we generate $2000$ samples for class $\mathcal{C}_1$ and $4000$ samples for class $\mathcal{C}_2$ using the following Gaussian parameters: \begin{align} & \bar{\textbf{x}}_2=[-1.5,-0.75,0.75,1.5]^T, \nonumber\\ &\bm{\Sigma}_2=\text{diag}(0.25,0.75,1.25,1.75) \nonumber\\ & \bar{\textbf{x}}_1=\bar{\textbf{x}}_2-0.75, \quad \bm{\Sigma}_1=\textbf{I} \end{align} The above Gaussian parameters are slightly modified from the two class data used by \citep{fukunaga2013introduction} and \citep{xue2008unbalanced} in order to make the sample means less separated. \begin{table}[!tbph] \centering \caption{List and Characteristics of Datasets} {\begin{tabular}{ccccc} \hline Dataset & Label & $n$ & $d$ & $K$ \\ \hline D1 & (a) & $ 2000 $ & $ 8 $ & $ 2 $ \\ D2 & (b) & $ 2000 $ & $ 4 $ & $ 2 $ \\ Liver & (c) & $345$ & $6$ & $ 2 $ \\ Shuttle & (d) & $ 58000 $ & $ 9 $ & $7$ \\ Vowels & (e) & $ 990 $ & $ 10 $ & $ 11 $ \\ Zernike Moments & (f) & $2000$ & $47$ & $10$ \\ Image Segmentation (Statlog) & (g) & $2310$ & $19$ & $7$ \\ Spambase & (h) & $ 4601 $ & $ 37 $ & $ 2 $ \\ Wine Quality (White) & (i) &$4898$ & $11$ & $7$ \\ Pen Digits & (j) & $ 5620 $ & $ 64 $ & $ 10 $ \\ Satellite (Statlog) & (k) & $ 6435 $ & $ 36 $ & $ 6 $ \\ Letters & (l) & $ 20000 $ & $ 16 $ & $ 26 $ \\ \hline \end{tabular}}{} \caption*{This table lists the datasets used in the experimental section. $K$ is the number of classes, $d$ is the dimensionality of the dataset, and $n$ is the number of data points in the dataset.} \label{DS1} \end{table} For each dataset in Table 1, we perform $10$-fold cross validation. We run $20$ different trials. On each training dataset, we evaluate the minimum Bayes error achievable by our proposed algorithm averaged over all $10$ folds and $20$ trials. If there are more than two classes, we use OvO, and calculate the mean Bayes error over all $K(K-1)/2$ discriminants. As we are interested only in linear classification, we compare the performance of the GLD with the original LDA as well as the heteroscedastic LDA procedures by \citep{fukunaga2013introduction},\citep{anderson1962classification} and \citep{marks1974discriminant} as described in Section 2 in terms of the Bayes error (9). For the sake of brevity, we denote these three heteroscedastic LDA algorithms by the annotations earlier introduced: C-HLD, R-HLD-1 and R-HLD-2 respectively. These results are shown in Table 2. Moreover, for each of the test datasets, we evaluate the average classification accuracy for each of LDA, C-HLD, R-HLD-1, R-HLD-2, GLD and GLD with local neighbourhood search (LNS). We also compare the performance of these LDA approaches to the SVM. These results are shown in Table 3, while the average training times of the algorithms are shown in Table 4. We estimate the prior probabilities based on the relative frequencies of the data in each class in the dataset, and the stopping criterion for the GLD is thus: we stop if the gradient of $\textbf{w}$ change is less than or equal to $\epsilon_3=10^{-6}$, or else we terminate our algorithm after $I=20$ iterations and choose the solution corresponding to the minimum $p_e$. Also, for the LNS procedure, we perturb each vector element by $10\%$ of its absolute value, i.e. $\delta\tilde{w}_i=0.1|\tilde{w}_i|$, and we run for $R$=1000 iterations, terminating prematurely if $r_{max}=0.1R$. We use a step size of $\Delta s=0.001$ for the C-HLD algorithm, and run $1000$ trials for R-HLD-1 and R-HLD-2. All the parameters used in the experiments are optimised via cross-validation. Note that if the sample covariance matrix is singular, we use the Moore-Penrose pseudo-inverse. \section{Results and Discussion} \begin{table}[!tbph] \centering \setlength{\tabcolsep}{12pt} \caption{Average Bayes Error ($\%$)} \resizebox{\columnwidth}{!}{ {\begin{tabular}{cccccc} \hline Dataset & LDA & C-HLD & R-HLD-1 & R-HLD-2 & GLD \\ \hline (a) & $ 0.0397$ & $ 0.0382$ & $ 0.0383$ & $ 0.0361$ & $ \textbf{0.0360}$ \\ (b) & $ 0.0774$ & $ 0.0749$ & $ 0.0749$ & $ 0.0740$ & $ \textbf{0.0739}$ \\ (c) & $ 0.9981$ & $ \textbf{0.9838}$ & $ \textbf{0.9838}$ & $ \textbf{0.9838}$ & $ \textbf{0.9838}$ \\ (d) & $ \textbf{0.0001}$ & $ \textbf{0.0001}$ & $ \textbf{0.0001}$ & $ \textbf{0.0001}$ & $ \textbf{0.0001}$ \\ (e) & $ 0.0339$ & $ \textbf{0.0326}$ & $ \textbf{0.0326}$ & $ \textbf{0.0326}$ & $ \textbf{0.0326}$ \\ (f) & $ 0.0054$ & $ 0.0051$ & $ \textbf{0.0048}$ & $ \textbf{0.0048}$ & $ 0.0050$ \\ (g) & $ 0.0037$ & $ \textbf{0.0029}$ & $ \textbf{0.0029}$ & $ \textbf{0.0029}$ & $ \textbf{0.0029}$ \\ (h) & $ 0.0253$ & $ \textbf{0.022}8$ & $ \textbf{0.0228}$ & $ \textbf{0.0228}$ & $ \textbf{0.0228}$ \\ (i) & $ 0.0162$ & $ 0.0201$ & $ 0.0156$ & $ 0.0155$ & $ \textbf{0.0154}$ \\ (j) & $ \textbf{0.0002}$ & $ \textbf{0.0002}$ & $\textbf{ 0.0002}$ & $ \textbf{0.0002}$ & $ \textbf{0.0002}$ \\ (k) & $ 0.0046$ & $ \textbf{0.0039}$ & $ \textbf{0.0039}$ & $ \textbf{0.0039}$ & $ \textbf{0.0039}$ \\ (l) & $ \textbf{0.0007}$ & $ \textbf{0.0007}$ & $ \textbf{0.0007}$ & $ \textbf{0.0007}$ & $ \textbf{0.0007}$ \\ \hline \end{tabular}}{} } \caption*{This table shows the average Bayes error per discriminant as a percentage for each dataset for LDA, GLD, C-HLD, R-HLD-1 and R-HLD-2. Best values are in bold.} \label{Bayes} \end{table} \begin{table}[!tbph] \centering \caption{Average Classification Accuracy ($\%$)} \resizebox{\columnwidth}{!}{ {\begin{tabular}{cccccccc} \hline Dataset & LDA & C-HLD & R-HLD-1 & R-HLD-2 & GLD & LNS & SVM\\ \hline (a) & $ 76.00$ & $ 77.18$ & $ 77.00$ & $ 78.48$ & $ \textbf{78.65}$ & $ 78.57$ & $ 77.47$\\ (b) & $ 76.87$ & $77.93$ & $ 77.93$ & $ 78.17$ & $ \textbf{78.37}$ & $ 78.00$ & $ 77.70$\\ (c) & $ 67.83$ & $ 63.19$ & $ 62.32$ & $ 62.03$ & $ 63.77$ & $ 68.12$ & $ \textbf{68.70}$\\ (d) & $ 94.10$ & $ 96.60$ & $ 96.74$ & $ 96.73$ & $ 96.59$ & $ \textbf{97.91}$ & $ 84.39$\\ (e) & $ 73.64$ & $ 74.14$ & $ 74.44$ & $ 74.44$ & $ 74.14$ & $75.66$ & $ \textbf{76.77}$\\ (f) & $ 84.00$ & $ 83.90$ & $ 84.10$ & $ 84.15$ & $ \textbf{84.80}$ & $ 84.00$ & $ 81.90$\\ (g) & $ 94.33$ & $ 94.59$ & $ 94.59$ & $ 94.63$ & $ 94.59$ & $ 94.89$ & $ \textbf{96.15}$\\ (h) & $ 88.76$ & $ 88.29$ & $ 88.26$ & $ 88.15$ & $ 88.26$ & $ \textbf{90.28}$ & $ 85.68$\\ (i) & $ 53.41$ & $ 46.59$ & $ 53.37$ & $ 53.33$ & $ 53.55$ & $ \textbf{54.1}4$ & $ 51.88$\\ (j) & $ 96.74$ & $ 96.99$ & $ 96.97$ & $ 96.98$ & $ 97.01$ & $ 97.41$ & $ \textbf{97.84}$\\ (k) & $ 85.69$ & $ 86.06$ & $ 86.06$ & $ 86.03$ & $ 86.08$ & $ 86.65$ & $ \textbf{86.85}$\\ (l) & $ 81.67$ & $ 81.87$ & $ 81.83$ & $ 81.78$ & $ 81.88$ & $ 82.25$ & $ \textbf{85.39}$\\ \hline \end{tabular}}{} } \caption*{This table shows the average classification accuracy (\%) on the test datasets for LDA, C-HLD, R-HLD-1, R-HLD-2, GLD, GLD+LNS and SVM. Best values are in bold.} \label{Rate} \end{table} \begin{table}[!tbph] \centering \caption{Average Training Time (s)} \resizebox{\columnwidth}{!}{ {\begin{tabular}{cccccccc} \hline Dataset & LDA & C-HLD & R-HLD-1 & R-HLD-2 & GLD & LNS & SVM\\ \hline (a) & $ \textbf{0.001}$ & $ 0.161$ & $ 0.140$ & $ 0.139$ & $ 0.002$ & $0.181$ & $ 23.192$\\ (b) & $\textbf{0.001}$ & $0.142$ & $0.121$ & $0.121$ & $0.002$ & $ 0.060$ & $ 0.721$\\ (c) & $ \textbf{0.001}$ & $ 0.155$ & $ 0.1415$ & $ 0.1337$ & $ 0.003$ & $ 0.028$ & $ 2.673$\\ (d) & $\textbf{0.037}$ & $ 3.531$ & $ 3.023$ & $ 3.012$ & $0.089$ & $ 43.32$ & $4623.138$\\ (e) & $\textbf{0.036}$ & $ 11.099$ & $ 9.409$ & $ 9.751$ & $ 0.167$ & $ 2.075$ & $ 1.173$\\ (f) & $ \textbf{0.387}$ & $ 123.662$ & $ 123.649$ & $ 121.906$ & $ 1.955$ & $ 110.694$ & $23.126$\\ (g) & $\textbf{0.128}$ & $ 37.320$ & $ 30.876$ & $ 37.875$ & $ 0.488$ & $ 2.143$ & $21.775$\\ (h) & $ \textbf{0.101}$ & $ 10.437$ & $ 7.729$ & $ 7.474$ & $ 0.753$ & $ 36.83$ & $804.574$\\ (i) & $ \textbf{0.017}$ & $ 4.257$ & $ 3.691$ & $ 3.750$ & $ 0.080$ & $ 5.928$ & $ 914.257$\\ (j) & $\textbf{0.638}$ & $ 10.099$ & $9.358$ & $ 9.171$ & $ 0.915$ & $ 168.19$ & $ 409.38$\\ (k) & $ \textbf{0.304}$ & $ 18.067$ & $17.842$ & $ 17.912$ & $ 0.858$ & $ 13.919$ & $311.202$\\ (l) & $\textbf{0.835}$ & $73.050$ & $64.022$ & $65.414$ & $3.245$ & $ 37.202$ & $109.232$\\ \hline \end{tabular}}{} } \caption*{This table shows the average training times on the test datasets for LDA, C-HLD, R-HLD-1, R-HLD-2, GLD, GLD+LNS and SVM. Best values are in bold.} \label{Time} \end{table} For real-world datasets, the covariance matrices of the classes are rarely equal, therefore the homoscedasticity assumption in LDA does not hold. Our results in Table 2 confirm that LDA does not minimise the Bayes error under heteroscedasticity, as none of the datasets used has equal covariance matrices. With the exception of datasets (d), (j) and (l), where LDA achieves an equal Bayes error as the other heteroscedastic LDA approaches, LDA is outperformed by the GLD on all remaining datasets in terms of minimising the Bayes error. It will be noted that the other three heteroscedastic LDA approaches algorithms achieve a performance comparable to the GLD on all the datasets in terms of the Bayes error. However, R-HLD-1 and R-HLD-2 require a lot of trials ($1000$ in our experiments) in order to obtain the optimal parameters $s$ and $s_1$, $s_2$ respectively, while C-HLD requires a step size of $\Delta s=0.001$ which translates to $1001$ trials. Consequently, the training time for these algorithms far exceed that of the GLD, as can be seen in Table 4. For example, the gain in training time of the GLD over C-HLD, R-HLD-1 and R-HLD-2 is over $62$ folds for dataset (g), and about $20$ folds for dataset (l). Moreover, since C-HLD, R-HLD-1 and R-HLD-2 all require matrix inversions, performing a matrix inversion for each of the $1000$ trials can be a computationally demanding task especially for high-dimensional data, which have large covariance matrices. Instead, since the GLD follows a principled optimisation procedure, the number of matrix inversions required is far lower. For example, on dataset (f), which has a dimensionality of $47$, the GLD requires over $60$ times less time to train than the other heteroscedastic LDA approaches. It is conceivable that the minimisation of the Bayes error would translate into a good performance in terms of the classification accuracy, if the normality assumption of LDA holds. For this reason, it can be seen in Table 3 that the GLD achieves the best classification accuracy on datasets (a) and (b), which are generated from known normal distributions. Thus, the proposed GLD algorithm is particularly suited for applications with datasets that tend to be normally distributed in each class e.g. in machine fault diagnosis, or accelerometer-based human activity recognition \citep{ojetola2015data}, as it also requires far less training time than the existing heteroscedastic LDA approaches. However, for datasets (c) through to (l), the classes do not have any known normal distribution. Therefore, minimising the Bayes error under the normality assumption would not necessarily result in a classifier that has the best classification accuracy, even if the difference in covariance matrices has been accounted for. For this reason, it is not surprising that LDA achieves a superior classification accuracy than C-HLD, R-HLD-1, R-HLD-2 and the GLD on datasets (c) and (h) as can be seen in Table 3. However, by searching around the neighbourhood of the GLD, the Local Neighbourhood Search (LNS) algorithm is able to account for the non-normality and obtain a more robust classifier. Thus, the GLD, together with the LNS procedure, achieves a higher classification accuracy than all the LDA approaches on all the real-world datasets (i.e. (c) to (l)) with the exception of dataset (f) which has the GLD showing superior classification accuracy. While the SVM outperforms the LDA approaches on half of the datasets, its training time can be rather long for large datasets. For instance, for dataset (d) which has $58000$ elements, the SVM takes about $1.3$ hours to train whereas the GLD with LNS, which achieves the best classification accuracy on this dataset, takes $43$ seconds to train, representing over $100$ fold savings in computational time over the SVM. Similar patterns can be seen in other datasets like (i), where the GLD with LNS achieves a superior classification accuracy with over $150$ times shorter training time than the SVM. This suggests that for such large datasets, the GLD with Local Neighbourhood Search is a low-complexity alternative to the SVM, as it requires far less computational time than the SVM. We, however, make note of two weaknesses our proposed algorithms have. For the GLD, the procedure as described in Algorithm 1, may converge to a saddle point, instead of a local minimum. Even if it were to converge to a local minimum, there is no guarantee that is the global optimum solution due to the fact that the objective function $p_e$ is known to be non-convex \cite{anderson1962classification}. Also, since the Local Neighbourhood Search involves evaluating the misclassification rate on the training set for every perturbation, the procedure does not scale well with large amounts of training data. Because of this, it is important to have a good initial solution like the GLD, so that an early termination may be performed if there is no improvement after some number of iterations. \section{Conclusion} In this paper, we have presented the Gaussian Linear Discriminant (GLD), a novel and computationally efficient method for obtaining a linear discriminant for heteroscedastic Linear Discriminant Analysis (LDA) for the purpose of binary classification. Our algorithm minimises the Bayes error via an iterative optimisation procedure that uses Fisher's Linear Discriminant as the initial solution. Moreover, the GLD does not require any parameter adjustments. We have also proposed a local neighbourhood search method by which a more robust linear classifier may be obtained for non-normal distributions. Our experimental results on two artificial and ten real world applications show that when the covariance matrices of the classes are unequal, LDA is unable to minimise the Bayes error. Thus, under heteroscedasticity, our proposed algorithm achieves superior classification accuracy to the LDA for normally distributed classes. While the proposed GLD algorithm compares favourably with other heteroscedastic LDA approaches, the GLD requires a far less training time. Moreover, the GLD, together with the LNS, has been shown to be particularly robust, comparing favourably with the SVM, but requiring far less training time on our datasets. Thus, for expert systems like machine fault diagnosis or human activity monitoring that require linear classification, the proposed algorithms provide a low-complexity, high-accuracy solution. While this work has focused on linear classification, on-going work is focused on modifying the GLD procedure for the purpose of linear dimensionality reduction. Moreover, it is of particular interest to us to be able to derive the Bayes error for some known non-normal distributions. An alternative to this is to be able to obtain a kernel that implicitly transforms some data of a known non-normal distribution into a feature space where the classes are normally distributed. Finally, like all local search algorithms, the performance and complexity of the LNS procedure depends on the choice of the initial solution. Therefore, further work that explores the use initial solutions (including the heteroscedastic LDA approaches discussed) other than the GLD for the LNS procedure is being done.
{'timestamp': '2017-03-27T02:07:45', 'yymm': '1703', 'arxiv_id': '1703.08434', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08434'}
arxiv
\section{Introduction}\label{sec:intro} Researchers are often interested in estimating the entries of an unknown $n\times p$ mean matrix $\boldsymbol M$ given a single noisy realization, $\boldsymbol Y = \boldsymbol M + \boldsymbol Z$, where the entries of $\boldsymbol Z$ are assumed to be independent, identically distributed mean zero normal random variables with unknown variance $\sigma^2_z$. Consider a noisy matrix $\boldsymbol Y$ of gene expression measurements for different genes and tumors. Researchers may be interested in which tumors have unique gene expression profiles, and which genes are differentially expressed across different tumors. This is challenging because no replicates are observed. Each unknown $m_{ij}$ corresponds to a single observation $y_{ij}$, and so the maximum likelihood estimate $\boldsymbol Y$ has high variability. Accordingly, simplifying assumptions that reduce the dimensionality of $\boldsymbol M$ are often made. Many such assumptions relate to a two-way ANOVA decomposition of $\boldsymbol M$: \begin{align}\label{eq:decomp} \boldsymbol M = \mu \boldsymbol 1_n \boldsymbol 1_p' + \boldsymbol a \boldsymbol 1_p' + \boldsymbol 1_n \boldsymbol b' + \boldsymbol C, \end{align} where $\mu$ is an unknown grand mean, $\boldsymbol a$ is an $n \times 1$ vector of unknown row effects, $\boldsymbol b$ is a $p\times 1$ vector of unknown column effects, $\boldsymbol C$ is a matrix of elementwise ``interaction'' effects and $\boldsymbol 1_n$ and $\boldsymbol 1_p$ are $n\times 1$ and $p \times 1$ vectors of ones, respectively. In the absence of replicates, implicitly assuming $\boldsymbol C = \boldsymbol 0$ is common. This reduces the number of freely varying unknown parameters, from $np$ to $n + p$, but is also unlikely to be appropriate in practice. Alternatively, one might assume that elements of $\boldsymbol C$ can be written as a function of a small number $R$ of multiplicative components, i.e. $c_{ij} = \sum_{r= 1}^R u_{r,i} v_{r,j}$ where $\boldsymbol u_r$ and $\boldsymbol v_r$ and $n \times 1$ and $p\times 1$ row and column factors. This corresponds to a low-rank matrix $\boldsymbol C$ and an additive-plus-low-rank mean matrix $\boldsymbol M$. Additive-plus-low-rank models have a long history and continue to be very popular \citep{Fisher1923,Gollob1968, Johnson1972b, Mandel1971, Goodman1990, Forkman2014}. However, in the settings we consider it is reasonable to expect that $\boldsymbol C$ may be sparse with a relatively small number of nonzero elements, e.g.\ some tumor-gene combinations may have large interaction effects while others may have negligible interaction effects. In such settings, it is easy to imagine scenarios in which a low-rank estimate of $\boldsymbol M$ may fail, e.g.\ if $\boldsymbol Y$ were an $n\times n$ square matrix and all $c_{ii}$ were large while all $c_{ij}$, $i\neq j$ were equal to zero. In this case, a low-rank estimate of $\boldsymbol C$ would not suffice because a full rank $R = n$ estimate would be needed. If $\boldsymbol M$ is approximately additive in the sense that large deviations from additivity are rare, then $\boldsymbol C$ is sparse and estimation of $\boldsymbol M$ may be improved by penalizing elements of $\boldsymbol C$: \begin{align}\label{eq:obj} \text{min}_{\mu,\boldsymbol a,\boldsymbol b, \boldsymbol C}\frac{1}{2\sigma^2_z}\left|\left|\text{vec}\left\{\boldsymbol Y - \left( \mu \boldsymbol 1_n \boldsymbol 1_p' + \boldsymbol a \boldsymbol 1_p' + \boldsymbol 1_n \boldsymbol b' + \boldsymbol C\right)\right\} \right|\right|^2_2 + \lambda_c \left|\left| \text{vec}\left(\boldsymbol C\right)\right|\right|_1. \end{align} The $\ell_1$ penalty induces sparsity among the estimated entries of $\boldsymbol C$ and solving this penalized regression problem yields unique estimates of $\boldsymbol M$ and $\boldsymbol C$. Elements of $\boldsymbol C$ can be interpreted as interactions insofar as they indicate deviation from a strictly additive model. Although \eqref{eq:obj} is a standard lasso regression problem that can be solved easily given values of $\lambda_c$ and $\sigma^2_z$, specifying values of $\lambda_c$ and $\sigma^2_z$ is uniquely challenging in this setting. The methods suggested by \cite{Donoho1994} and \cite{Donoho1995} are not appropriate because they are specific to orthogonal design matrices; columns of the design matrix corresponding to the regression problem in \eqref{eq:obj} are correlated. The same is true of the unbiased risk estimate minimization procedure suggested by \cite{Tibshirani1996}. Although columns of the design matrix will become less correlated as $n$ and $p\rightarrow \infty$, the correlations may not be negligible in practice especially if $n$ or $p$ is relatively small. \cite{Tibshirani1996} also suggested cross validation, which could be performed after rewriting Equation~\eqref{eq:obj} to depend on a single parameter $\eta = \lambda_c \sigma^2_z$. However, cross-validation is also poorly suited to this setting. Consider leave-one-out cross validation to select a value of $\eta$, and suppose we hold out $y_{11}$ and solve \eqref{eq:obj} for any fixed value of $\eta$ using the elements of $\boldsymbol Y$ excluding $y_{11}$. We obtain estimates of $\mu$, $\boldsymbol a$, $\boldsymbol b$, and all elements of $\boldsymbol C$ \emph{except} $c_{11}$, as only the held out test data point $y_{11}$ contains any information about $c_{11}$. For this reason, we cannot compute an out-of-sample prediction for $y_{11}$ without making additional assumptions that relate $\mu$, $\boldsymbol a$, $\boldsymbol b$ and all of the elements of $\boldsymbol C$ except $c_{11}$ to $c_{11}$ and selecting $\eta$ by cross validation without additional assumptions is not possible. This penalized regression problems has been considered in the literature on outlier detection, as nonzero elements of $\boldsymbol C$ can alternatively be interpreted as outliers. \cite{She2011} interpret elements of $\boldsymbol C$ in this way and consider the more general problem with an arbitrary full rank design matrix $\boldsymbol X$. They approach specification of $\lambda_c$ and $\sigma^2_z$ by introducing a conservative extension of the methods suggested by \cite{Donoho1994} for orthogonal design matrices, setting $np$ different values $\lambda_i = \sigma\sqrt{2\left(1 - h_{ii}\right)\text{log}\left(np\right)}$ where $\boldsymbol H = \boldsymbol X \left(\boldsymbol X'\boldsymbol X\right)^{-1}\boldsymbol X$. Because $\sigma^2$ can be very challenging to estimate, they suggest setting $\lambda_i = \lambda \sqrt{1 - h_{ii}}$ in a data-adaptive way using a modified BIC. Although the methods proposed by \cite{She2011} have the advantage of applying to general regression problems with arbitrary design matrices $\boldsymbol X$, they have computational disadvantages in high dimensions because they require computing an initial robust estimate of and iteratively re-estimating $\boldsymbol C$. We take another approach and view the $\ell_1$ penalty on $\boldsymbol C$ as a Laplace prior distribution, in which case $\lambda_c$ and $\sigma^2_z$ can be interpreted as nuisance parameters that can be estimated from the data. The relationship between the $\ell_1$ penalty and the Laplace prior has long been acknowledged \citep{Tibshirani1996}. It offers not only a framework for specifying $\lambda_c$ and $\sigma^2_z$, but also decision theoretic justifications for using estimates of $\boldsymbol M$ and $\boldsymbol C$ obtained by solving \eqref{eq:obj} using estimated $\lambda_c$ and $\sigma^2_z$ because the posterior mode is known to minimize a specific data-adaptive loss function \citep{Pratt1965, Tiao1973}. The challenge is in the estimation of $\lambda_c$ and $\sigma^2_z$, because computing maximum marginal likelihood estimates may be prohibitively computationally demanding and intractable in practice \citep{Figueiredo2003, Park2008}. In this paper we instead present moment-based empirical Bayes estimators of the nuisance parameters $\lambda_c$ and $\sigma^2_z$ that are easy to compute, consistent and independent of assumptions made regarding $\boldsymbol a$ and $\boldsymbol b$. As our approach to estimating $\lambda_c$ and $\sigma^2_z$ uses the Laplace prior interpretation of the $\ell_1$ penalty, we refer to estimation of $\boldsymbol M$ via optimization of Equation~\eqref{eq:obj} using these nuisance parameter estimators as LANOVA penalization and we refer to the estimate $\widehat{\boldsymbol M}$ as the LANOVA estimate. The paper proceeds as follows: In Section~\ref{sec:lapen}, we introduce moment-based estimators for $\lambda_c$ and $\sigma^2_z$, show that they are consistent as \emph{either} the number of rows \emph{or} columns of $\boldsymbol Y$ go to infinity. We show that their efficiency is comparable to that of asymptotically efficient marginal maximum likelihood estimators (MMLEs). In Section~\ref{sec:laimp}, we discuss estimation of $\boldsymbol M$ via Equation~\eqref{eq:obj} given estimates of $\lambda_c$ and $\sigma^2_z$ and introduce a test of whether or not elements of $\boldsymbol C$ are heavy-tailed, which allows us to avoid LANOVA penalization in settings where it is especially inappropriate. We also investigate the performance of LANOVA estimates of $\boldsymbol M$ relative to strictly additive estimates, strictly non-additive estimates, additive-plus-low-rank estimates, IPOD estimates from \cite{She2011}, and approximately minimax estimates based on \cite{Donoho1994}, and examine robustness to misspecification of the distribution of elements of $\boldsymbol C$. In Section~\ref{sec:ext}, we extend LANOVA penalization to include penalization of lower-order mean parameters $\boldsymbol a$ and $\boldsymbol b$ and also to apply to the case where $\boldsymbol Y$ and $\boldsymbol M$ are $K$-way tensors. In Section~\ref{sec:numex}, we apply LANOVA penalization to a matrix of gene expression measurements, a three-way tensor of fMRI data and a three-way tensor of wheat infection data. In Section~\ref{sec:disc} we discuss extensions, specifically multilinear regression models and opportunities that arise in the presence of replicates. \section{LANOVA Nuisance Parameter Estimation}\label{sec:lapen} Consider the following statistical model for deviations of $\boldsymbol Y$ from a strictly additive model: \begin{align}\label{eq:matmod} \boldsymbol Y & = \mu \boldsymbol 1_n \boldsymbol 1_p' + \boldsymbol a \boldsymbol 1_p' + \boldsymbol 1_n \boldsymbol b' + \boldsymbol C + \boldsymbol Z, \\ \boldsymbol C & = \{ c_{ij} \} \sim \text{i.i.d.\ Laplace}\left(0,\lambda_c^{-1} \right)\text{, \quad} \boldsymbol Z = \{ z_{ij} \} \sim \text{i.i.d.\ }N\left(0,\sigma^2_z \right). \nonumber \end{align} The posterior mode of $\mu$, $\boldsymbol a$, $\boldsymbol b$ and $\boldsymbol C$ under this Laplace prior for $\boldsymbol C$ and flat priors for $\mu$, $\boldsymbol a$ and $\boldsymbol b$ corresponds to the solution of LANOVA penalization problem given by Equation~\eqref{eq:obj}. We construct estimators of $\lambda_c$ and $\sigma^2_z$ as follows. Letting $\boldsymbol H_k = \boldsymbol I_k - \boldsymbol 1_k \boldsymbol 1_k/k$ be the $k\times k$ centering matrix, we define $\boldsymbol R = \boldsymbol H_n \boldsymbol Y \boldsymbol H_p$. $\boldsymbol R$ dependes on $\boldsymbol C$ and $\boldsymbol Z$ alone, specifically $\boldsymbol R = \boldsymbol H_n \left(\boldsymbol C + \boldsymbol Z\right) \boldsymbol H_p$. We construct estimators of $\lambda_c$ and $\sigma^2_z$ from $\boldsymbol R$ by leveraging the difference between Laplace and normal tail behavior as measured by fourth order moments. The fourth order central moment of any random variable $x$ with mean $\mu_x$ and variance $\sigma^2_x$ can be expressed as $\mathbb{E}\left[\left(x - \mu_x\right)^4 \right] = \left(\kappa + 3\right)\sigma^4_x$, where $\kappa$ is interpreted as the \emph{excess kurtosis} of the distribution of $x$ relative to a normal distribution. A normally distributed variable has excess kurtosis equal to $0$, whereas a Laplace distributed random variable has excess kurtosis equal to $3$. It follows that the second and fourth order central moments of elements of $\boldsymbol C + \boldsymbol Z$ are $\mathbb{E}\left[\left(c_{ij} + z_{ij}\right)^2 \right] = \sigma^2_c + \sigma^2_z$ and $\mathbb{E}\left[\left(c_{ij} + z_{ij}\right)^4 \right] = 3\sigma^4_c + 3\left(\sigma^2_c + \sigma^2_z \right)^2$, respectively, where $\sigma^2_c = 2/\lambda^2_c$ is the variance of a Laplace$(0, \lambda_c^{-1})$ random variable. Given values of $\mathbb{E}\left[\left(c_{ij} + z_{ij}\right)^2\right]$ and $\mathbb{E}\left[\left(c_{ij} + z_{ij}\right)^4\right]$, we see that $\sigma^2_c$ and $\sigma^2_z$, and accordingly $\lambda_c$, can easily be recovered. We do not observe $\boldsymbol C + \boldsymbol Z$ directly, but we can use the the second and fourth order sample moments of $\boldsymbol R$, an estimate of $\boldsymbol C + \boldsymbol Z$, given by $\overline{r}^{\left(2\right)} = \frac{1}{np}\sum_{i = 1}^n \sum_{j = 1}^p r^2_{ij}$ and $\overline{r}^{\left(4\right)} = \frac{1}{np}\sum_{i = 1}^n \sum_{j = 1}^p r^4_{ij}$, respectively, to separately estimate $\sigma^2_c$ and $\sigma^2_z$. These estimators are: \begin{align} \label{eqn:momest} \widehat{\sigma}^4_c =& \left\{\frac{n^3p^3}{\left(n - 1\right)\left(n^2 - 3n + 3\right)\left(p - 1\right)\left(p^2 - 3p + 3\right)}\right\}\left\{\overline{r}^{\left(4\right)}/3 - \left(\overline{r}^{\left(2\right)}\right)^2 \right\}, \\ \nonumber \widehat{\sigma}^2_c =& \sqrt{\widehat{\sigma}^4_c}\text{,\quad} \widehat{\sigma}^2_z = \left\{\frac{np}{\left(n - 1\right)\left(p - 1\right)}\right\}\overline{r}^{\left(2\right)} - \widehat{\sigma}^2_c. \end{align} An estimator of $\lambda_c$ is then given by $\widehat{\lambda}_c = \sqrt{2/\widehat{\sigma}^2_c}$. Studying the properties of these estimators is slightly challenging, as elements of $\boldsymbol R$ are neither independent nor identically distributed. The estimator $\widehat{\sigma}^4_c$ is biased. It is possible to obtain an unbiased estimator for $\sigma^4_c$, however the unbiased estimator will not be consistent as $n\rightarrow \infty$ with $p$ fixed or $p \rightarrow \infty$ with $n$ fixed. Because these estimators depend on higher-order terms which can be very sensitive to outliers, it is desirable to have consistency as either the number of rows or columns grows. Accordingly, we prefer the biased estimator and examine its bias in the following proposition. \begin{proposition}\label{prop:bias} Under the model given by Equation~\eqref{eq:matmod}, \begin{align*} \mathbb{E}\left[\widehat{\sigma}^4_c\right] -\sigma^4_c =& -\left\{\frac{n^3 p^3}{\left(n - 1\right)\left(n^2 - 3n + 3\right)\left(p - 1\right)\left(p^2 - 3p + 3\right)}\right\}\left[\left\{\frac{3\left(n - 1\right)^2\left(p - 1\right)^2}{n^3p^3}\right\}\sigma^4_c +\right.\\ &\left. \left\{\frac{2\left(n - 1\right)\left(p - 1\right)}{n^2p^2}\right\}\left(\sigma^2_c + \sigma^2_z\right)^2 \right]. \end{align*} \end{proposition} A proof of this proposition and all other results presented in this paper are given in an web appendix. The bias is always negative and accordingly, yields overpenalization of $\boldsymbol C$. When both $n$ and $p$ are small, $\widehat{\sigma}^4_c$ tends to underestimate $\sigma^4_c$. Recalling that $\sigma^4_c$ is inversely related to $\lambda_c$, this reflects a tendency to overpenalize and accordingly overshrink elements of $\boldsymbol C$ when both $n$ and $p$ are small. This is desirable, in that it reflects a tendency to prefer the simple additive model when few data are available. We also observe that the bias depends on both $\sigma^2_c$ and $\sigma^2_z$. Holding $n$, $p$ and $\sigma^2_c$ fixed, we will overestimate $\lambda_c$ more when $\sigma^2_z$ is larger. Again, this is desirable, in that it reflects a tendency to prefer the simple additive model when the data are very noisy. Last, we see that the bias is $O\left(1/np\right)$, i.e.\ the bias approaches zero as \emph{either} the number of rows \emph{or} the number of columns increases. The large sample behavior of our estimators of the nuisance parameters is similar. \begin{proposition}\label{prop:consestsmat} Under the model given by Equation~\eqref{eq:matmod}, $\widehat{\sigma}^4_c\stackrel{p}{\rightarrow}\sigma^4_c$, $\widehat{\sigma}^2_c\stackrel{p}{\rightarrow}\sigma^2_c$, $\widehat{\lambda}_c\stackrel{p}{\rightarrow}\lambda_c$ and $\widehat{\sigma}^2_z\stackrel{p}{\rightarrow}\sigma^2_z$ as $n \rightarrow \infty$ with $p$ fixed, $p\rightarrow \infty$ with $n$ fixed, or $n, p\rightarrow \infty$. \end{proposition} Although these nuisance parameter estimators are easy to compute and consistent as $n$ or $p\rightarrow \infty$, they are not maximum likelihood estimators and may not be asymptotically efficient even as $n$ and $p\rightarrow \infty$. Accordingly, we compare the asymptotic efficiency of our estimator $\widehat{\sigma}^2_c$ to that of the corresponding asymptotically efficient marginal maximum likelihood estimator (MMLE) denoted by $\widetilde{\sigma}^2_c$ as $n$ and $p\rightarrow \infty$. As noted in the Introduction, obtaining $\widetilde{\sigma}^2_c$ is computationally demanding because maximizing the marginal likelihood of the data requires a Gibbs-within-EM algorithm that can be slow to converge \citep{Park2008}. Fortunately, computing the asymptotic variance of $\widetilde{\sigma}^2_c$ is simpler than computing $\widetilde{\sigma}^2_c$ itself. The asymptotic variance of $\widetilde{\sigma}^2_c$ is given by the Cram\'er-Rao lower bound for $\sigma^2_c$, which can be computed numerically from the density of the sum of Laplace and normally distributed variables \citep{Nadarajah2006,Diaz-Frances2008}. The asymptotic variance of $\widehat{\sigma}^2_c$ is straightforward to compute as $\sqrt{np}\left(\widehat{\sigma}^4_c - \sigma^4_c\right)$ converges in distribution to a moment estimator of $\sigma^4_c$. We note that the asymptotic variance of $\widehat{\lambda}_c$ is similarly straightforward to compute; both asymptotic variances are given in the web appendix. Letting $\mathbb{V}\left[\widetilde{\sigma}^{2}_c\right]$ and $\mathbb{V}\left[\widehat{\sigma}^{2}_c\right]$ refer to the variances of the estimators $\widetilde{\sigma}^{2}_c$ and $\widehat{\sigma}^{2}_c$, we plot the asymptotic relative efficiency $\mathbb{V}\left[\widetilde{\sigma}^{2}_c\right]/\mathbb{V}\left[\widehat{\sigma}^2_c\right]$ over values of $\sigma^2_c, \sigma^2_z \in \left[0, 1\right]$ in Figure~\ref{fig:comptomle}. Note that the relative efficiency of $\widehat{\sigma}^2_c$ compared to $\widetilde{\sigma}^2_c$ also reflects the relative efficiency of our estimators $\widehat{\lambda}_c$ and $\widehat{\sigma}^2_z$ compared to the MMLEs $\widetilde{\lambda}_c$ and $\widetilde{\sigma}^2_c$, respectively, because both are simple functions of $\widehat{\sigma}^2_c$. \begin{figure}[h] \centering \includegraphics[scale = 0.55]{comptomle.pdf} \caption{Asymptotic relative efficiency $\mathbb{V}[\widetilde{\sigma}^2_c]/\mathbb{V}[\widehat{\sigma}^2_c]$ of the MMLE $\widetilde{\sigma}^2_c$ versus our moment-based estimator $\widehat{\sigma}^2_c$ as a function of the true variances $\sigma^2_c$ and $\sigma^2_z$.} \label{fig:comptomle} \end{figure} When $\sigma^2_c$ is small relative to $\sigma^2_z$, the MMLE $\widetilde{\sigma}^{2}_c$ tends to be slightly more efficient. When $\sigma^2_c$ is large relative to $\sigma^2_z$, $\widetilde{\sigma}^{2}_c$ tends to be much more efficient. However, in such cases the interactions will not be heavily penalized and LANOVA penalization will not tend to yield a simplified, nearly additive estimate of $\boldsymbol M$. Put another way, Figure~\ref{fig:comptomle} indicates that $\widehat{\lambda}_c$ and $\widehat{\sigma}^2_z$ will be nearly as efficient as the corresponding MMLEs when LANOVA penalization is useful for producing a simplified, nearly additive estimate of $\boldsymbol M$ with sparse interactions. We also note that because they are moment-based, our estimators may be more robust to misspecification of the distribution of elements of $\boldsymbol C$ and $\boldsymbol Z$ than the MMLEs. \section{Mean Estimation, Interpretation, Model Checking and Robustness}\label{sec:laimp} \subsection{Mean Estimation} In practice, our nuisance parameter estimators are not guaranteed to be nonnegative and two special cases can arise. When $\widehat{\sigma}^4_c < 0$, we set $\widehat{\sigma}^2_c = 0$, $\widehat{\boldsymbol C} = \boldsymbol 0$, and $\widehat{\boldsymbol M} = \widehat{\boldsymbol M}_{ADD}$, where $\widehat{\boldsymbol M}_{ADD} = \left(\boldsymbol I_n - \boldsymbol H_n \right)\boldsymbol Y \left(\boldsymbol I_p - \boldsymbol H_p\right)$ is the strictly additive estimate. When $\widehat{\sigma}^2_z < 0$, we reset $\widehat{\sigma}^2_z = 0$ and set $\widehat{\boldsymbol M} = \widehat{\boldsymbol M}_{MLE}$, where $\widehat{\boldsymbol M}_{MLE} = \boldsymbol Y$ is the strictly non-additive estimate. Neither special case prohibits estimation of $\boldsymbol M$. We assess how often these special cases arise via a small simulation study. Setting $\sigma^2_z = 1$, $n = p = 25$, $\mu = 0$, $\boldsymbol a = \boldsymbol 0$ and $\boldsymbol b = \boldsymbol 0$, we simulate $10,000$ realizations of $\boldsymbol Y = \boldsymbol C + \boldsymbol Z$ under the model given by Equation~\eqref{eq:matmod} for each value of $\sigma^2_c \in \left\{1/2, 1, 3/2\right\}$. We obtain $\widehat{\sigma}^2_c \leq 0$ in 13.7\%, 1.64\% and 0.02\% of simulations for $\sigma^2_c$ equal to $1/2$, $1$ and $3/2$, respectively. This means that when the magnitude of elements of $\boldsymbol C$ is smaller, we are more likely to obtain a strictly additive estimate of $\boldsymbol M$. We do not obtain $\widehat{\sigma}^2_z = 0$ in any simulations. When $\widehat{\sigma}^2_c > 0$ and $\widehat{\sigma}^2_z > 0$, we can obtain an estimate of $\boldsymbol M$ from Equation~\eqref{eq:obj} using block coordinate descent. Setting $\widehat{\boldsymbol C}^{0} = \boldsymbol H_n \boldsymbol Y \boldsymbol H_p$ and $k = 1$, our block coordinate descent algorithm iterates the following until the objective function Equation~\eqref{eq:obj} converges: \begin{itemize} \item Set $\widehat{\mu}^{k} = \boldsymbol 1_n'(\boldsymbol Y - \widehat{\boldsymbol C}^{k-1})\boldsymbol 1_p/np$, $\widehat{\boldsymbol a}^{k} = \boldsymbol H_n'(\boldsymbol Y - \widehat{\boldsymbol C}^{k-1})\boldsymbol 1_p/p$, \\ $\widehat{\boldsymbol b}^{k} = \boldsymbol H_p(\boldsymbol Y - \widehat{\boldsymbol C}^{k-1})'\boldsymbol 1_n/n$ and $\boldsymbol R^{k} = \boldsymbol Y - \widehat{\mu}^{k} \boldsymbol 1_n \boldsymbol 1_p' - \widehat{\boldsymbol a}^{k}\boldsymbol 1_p' - \boldsymbol 1_n (\widehat{\boldsymbol b}^{k})'$; \item Set $\widehat{\boldsymbol C}^{k} = \text{sign}(\boldsymbol R^{k} ) (|\boldsymbol R^{k}| - \widehat{\lambda}_c \widehat{\sigma}^2_z )_+$, where $\widehat{\lambda}_c = \sqrt{2/\widehat{\sigma}^2_c}$ $\text{sign}(\cdot)$ and the soft-thresholding function $(\cdot )_+$ are applied elementwise. Set $k = k + 1$. \end{itemize} \subsection{Interpretation} The nonzero entries of $\widehat{\boldsymbol C}$ correspond to the $r$ largest residuals from fitting a strictly additive model with $\boldsymbol C = \boldsymbol 0$, where $r$ is determined by $\widehat{\lambda}_c$ and $\widehat{\sigma}^2_z$. Elements of $\widehat{\boldsymbol C}$ can be interpreted as interactions insofar as they indicate deviation from a strictly additive model for $\boldsymbol M$. However, because we do impose the standard ANOVA zero-sum constraints, we cannot interpret elements of $\widehat{\boldsymbol C}$ directly as population average interaction effects, i.e.\ $\widehat{c}_{ij} \neq \mathbb{E}\left[y_{ij}\right] -\frac{1}{p} \sum_{j = 1}^p \mathbb{E}\left[y_{ij}\right] - \frac{1}{n}\sum_{i = 1}^n \mathbb{E}\left[y_{ij}\right] + \frac{1}{np}\sum_{i = 1}^n \sum_{j = 1}^p \mathbb{E}\left[y_{ij}\right]$. For the same reason, $\mu$, $\boldsymbol a$ and $\boldsymbol b$ cannot be interpreted as the grand mean and population average main effects. To obtain estimates that have the standard population average interpretation, we recommend performing a two-way ANOVA decomposition of $\widehat{\boldsymbol M}$. In the appendix, we show that the grand mean and population average main effects obtained via ANOVA decomposition of $\widehat{\boldsymbol M}$ are identical to those obtained by performing an ANOVA decomposition of $\boldsymbol Y$. \subsection{Testing} LANOVA penalization assumes the distribution of entries of $\boldsymbol C$ have tail behavior consistent with a Laplace distribution. It is natural to ask if this assumption is appropriate, but it is difficult to test it because $\boldsymbol C$ and $\boldsymbol Z$ enter into the observed data through their sum $\boldsymbol C + \boldsymbol Z$. Accordingly, we suggest a test of the more general assumption that elements of $\boldsymbol C$ are heavy-tailed. This allows us to rule out LANOVA penalization when it is especially inappropriate, i.e. when the data suggest elements of $\boldsymbol C$ are normal tailed. When the distribution of elements of $\boldsymbol C$ is heavy-tailed, the distribution of elements of $\boldsymbol C + \boldsymbol Z$ will also be heavy-tailed and will have strictly positive excess kurtosis. In contrast, when elements of $\boldsymbol C$ are either all zero or have a distribution with normal tails, elements of $\boldsymbol C + \boldsymbol Z$ will have excess kurtosis equal to exactly zero. We construct a test of the null hypothesis $H_0$: $c_{ij} + z_{ij} \sim \text{i.i.d.}\ N\left(0,\sigma^2_c + \sigma^2_z\right)$, which encompasses the cases in which $\boldsymbol C = \boldsymbol 0$ or elements of $\boldsymbol C$ are normally distributed. Conveniently, the test statistic is a simple function of $\widehat{\sigma}^2_c$ and $\widehat{\sigma}^2_z$ and can be computed at little additional computational cost. We can also think of this as a test of deconvolvability of $\boldsymbol C + \boldsymbol Z$, where the null hypothesis is that deconvolution of $\boldsymbol C + \boldsymbol Z$ is not possible. \begin{proposition}\label{prop:test} For $\boldsymbol Y = \mu \boldsymbol 1_n \boldsymbol 1_p' + \boldsymbol a \boldsymbol 1_p' + \boldsymbol 1_n \boldsymbol b' + \boldsymbol C + \boldsymbol Z$, as $n$ and $p\rightarrow \infty$ an asymptotically level-$\alpha$ test of $H_0$: $c_{ij} + z_{ij} \sim \text{i.i.d.}\ N\left(0,\sigma^2_c + \sigma^2_z\right)$ is obtained by rejecting $H_0$ when \begin{align*} \sqrt{np}\left\{\frac{\widehat{\sigma}^4_c}{\sqrt{\frac{8}{3}}\left(\widehat{\sigma}^2_c + \widehat{\sigma}^2_z\right)^2}\right\} > z_{1 - \alpha}, \end{align*} where $z_{1-\alpha}$ denotes the $1-\alpha$ quantile of the standard normal distribution. \end{proposition} This test gives us power against the alternative where elements $\boldsymbol C$ are heavy-tailed and LANOVA penalization may be appropriate. Because this is an approximate test, we assess its level in finite samples in a small simulation study. Setting $\sigma^2_z = 1$, $n = p$, $\mu = 0$, $\boldsymbol a = \boldsymbol 0$ and $\boldsymbol b = \boldsymbol 0$, we simulate $10,000$ realizations of $\boldsymbol Y = \boldsymbol C + \boldsymbol Z$ under $H_0$ for each value of $n \in \left\{25, 100\right\}$ and $\sigma^2_c \in \left\{1/2, 1, 3/2\right\}$. When $n = p = 25$, the test rejects at a slightly higher rate than the nominal level. It rejects in 7.98\%, 7.65\% and 8.66\% of simulations for $\sigma^2_c$ equal to $1/2$, $1$ and $3/2$, respectively. When $n = p = 100$, the test nearly achieves the desired level. It rejects in 6.13\%, 5.60\% and 6.00\% of simulations for $\sigma^2_c$ equal to $1/2$, $1$ and $3/2$, respectively. We compute the approximate power of this test under two heavy-tailed distributions for elements of $\boldsymbol C$: the Laplace distribution assumed for LANOVA penalization and a Bernoulli-normal spike-and-slab distribution. \begin{proposition}\label{prop:power_lap} Assume that elements of $\boldsymbol C$ are independent, identically distributed mean zero Laplace random variables with variance $\sigma^2_c$ and let $\phi^2 = \sigma^2_c/\sigma^2_z$. Then as $n$ and $p\rightarrow \infty$, the asymptotic power of the test given by Proposition~\ref{prop:test} is: \begin{align*} 1 - \Phi\left[\frac{z_{1 - \alpha} - \sqrt{\frac{3np}{8}}\left(\frac{\phi^2}{\phi^2 + 1}\right)^2}{\sqrt{1 + \left\{\frac{68\phi^8 + 36\phi^6 + 9\phi^4}{\left(1 + \phi^2\right)^4}\right\}}}\right]. \end{align*} \end{proposition} The power depends on the variances $\sigma^2_c$ and $\sigma^2_z$ only through their ratio $\phi^2$. It is plotted for for $\alpha = 0.05$, $\phi^2 \in \left[0,2\right]$ and $np = \left\{100, 200, \dots, 1000\right\}$ in Figure~\ref{fig:power}. The power of the test is increasing in $\phi^2$ and increasing more quickly when $np$ is larger and more data are available. \begin{figure}[h] \centering \includegraphics[scale=0.85]{power.pdf} \caption{Approximate power of the test described in Proposition~\ref{prop:test}.} \label{fig:power} \end{figure} Now we consider the power for Bernoulli-normal distributed elements of $\boldsymbol C$. \begin{proposition}\label{prop:power_ss} Assume that elements of $\boldsymbol C$ are independent, identically distributed Bernoulli-normal random variables. An element of $\boldsymbol C$ is exactly equal to zero with probability $1 - \pi_c$, and normally distributed with mean zero and variance $\tau^2_c$ otherwise. Letting $\phi^2 = \tau^2_c/\sigma^2_z$, as $n$ and $p\rightarrow \infty$, the asymptotic power of the test given by Proposition~\ref{prop:test} is: \begin{align*} 1 - \Phi\left[\frac{z_{1 - \alpha} - \pi_c \left(1 - \pi_c\right)\left\{\sqrt{\frac{3np}{8}}\left(\frac{\phi^2}{\pi_c \phi^2 + 1}\right)^2\right\}}{\sqrt{1 + \pi_c \left(1 - \pi_c\right)\left\{\frac{\left(20\pi_c^2 - 28\pi_c + 35\right)\phi^8 + 16\left(5 - \pi_c\right)\phi^6 + 72\phi^4}{8\left(\pi_c \phi^2 + 1\right)^4}\right\}}}\right]. \end{align*} \end{proposition} The approximate power depends on the variances of the nonzero effects $\tau^2_c$ and the noise $\sigma^2_z$ only through their ratio $\phi^2$. It is plotted for $\alpha = 0.05$, $\pi_c \in \left[0,1\right]$, $\phi^2 \in \left\{0, 0.2, \dots, 2\right\}$ and $np = \left\{100, 1000\right\}$ in Figure~\ref{fig:power}. The approximate power is always increasing in $\phi^2$ and $np$. For fixed $\phi^2$ and $np$, power diminishes as the probability of an element of $\boldsymbol C$ being nonzero $\pi_c$ approaches $0$ or $1$ and $\boldsymbol C + \boldsymbol Z$ becomes more normally distributed. Overall, the test is more powerful when estimating $\boldsymbol C$ separately from $\boldsymbol Z$ is more valuable, e.g.\ when elements of $\boldsymbol C$ are large in magnitude relative to the noise and when many entries of $\boldsymbol C$ are exactly zero. \subsection{Robustness and Comparative Performance} If the true model is not the LANOVA model and elements of $\boldsymbol C$ are drawn from a different heavy-tailed distribution, it is natural to ask how our estimates $\widehat{\sigma}^2_c$, $\widehat{\sigma}^2_z$, and $\widehat{\boldsymbol M}$ perform. As $\boldsymbol M$ is a function of $\mu$, $\boldsymbol a$, $\boldsymbol b$ and $\boldsymbol C$, the performance of $\widehat{\boldsymbol M}$ also reflects the performance of $\widehat{\mu}$, $\widehat{\boldsymbol a}$, $\widehat{\boldsymbol b}$ and $\widehat{\boldsymbol C}$ indirectly. We find that the excess kurtosis $\kappa$ of the ``true'' distribution of elements of $\boldsymbol C$ determines our ability to estimate $\sigma^2_c$ separately from $\sigma^2_z$. \begin{proposition}\label{prop:misspec} Under the model $\boldsymbol Y = \mu \boldsymbol 1_n \boldsymbol 1_p' + \boldsymbol a \boldsymbol 1_p' + \boldsymbol 1_n \boldsymbol b' + \boldsymbol C + \boldsymbol Z$, where elements of $\boldsymbol C$ are independent, identically distributed draws from a mean zero, symmetric distribution with variance $\sigma^2_c$, excess kurtosis $\kappa$ and finite eighth moment and elements of $\boldsymbol Z$ are normally distributed with mean zero and variance $\sigma^2_z$, $\widehat{\sigma}^2_c \stackrel{p}{\rightarrow}\sqrt{\kappa/3}\sigma^2_c$ and $\widehat{\sigma}^2_z\stackrel{p}{\rightarrow} \sigma^2_z + \left(1 - \sqrt{\kappa/3}\right)\sigma^2_c$ as $n \rightarrow \infty$ with $p$ fixed, $p \rightarrow \infty$ with $n$ fixed, or $n$ and $p\rightarrow \infty$. \end{proposition} Proposition~\ref{prop:misspec} indicates that we underestimate $\sigma^2_c$ when elements of $\boldsymbol C$ are lighter-than-Laplace tailed and we overestimate $\sigma^2_c$ when elements of $\boldsymbol C$ are heavier-than-Laplace tailed. To see how this affects estimation of $\boldsymbol M$, we consider exponential power and Bernoulli-normal distributed elements of $\boldsymbol C$. Exponential power distributed $c_{ij}$ have density $p(c_{ij} | \sigma^2_c, q_c) = (q_c/(2\sigma_c))\sqrt{\Gamma(3/q_c)/\Gamma(1/q_c)^3} \text{exp}\{- (\Gamma(3/q_c)/\Gamma(1/q_c))^{q_c/2} |c_{ij}/\sigma_c|^{q_c}\}$ that is parameterized in terms of the variance $\sigma^2_c$ and a shape parameter $q_c$, and Bernoulli-normal distributed $c_{ij}$ are exactly equal to zero with probability $1 - \pi_c$ and normally distributed with mean zero and $\tau^2_c$ otherwise. Both distributions can be lighter- or heavier-than-Laplace tailed. The excess kurtosis of exponential power and Bernoulli-normal $c_{ij}$ is $\Gamma\left(5/q_c\right)\Gamma\left(1/q_c\right)/\Gamma\left(3/q_c\right)^2 - 3$ and $3\left(1 - \pi_c\right)/\pi_c$, respectively. As a result, elements of $\boldsymbol C$ will be heavier-than-Laplace tailed when $q_c < 1$ or $\pi_c < 0.5$ and lighter-than-Laplace tailed when $q_c > 1$ or $\pi_c > 0.5$. Note that when $q_c = 1$ the exponential power distribution corresponds to the Laplace distribution and the LANOVA model is correct, and when $\pi_c = 0.5$ the spike-and-slab distributed $\boldsymbol C$ have the same excess kurtosis as Laplace distributed $\boldsymbol C$ and the variance estimators $\widehat{\sigma}^2_c$ and $\widehat{\sigma}^2_z$ will be consistent. We compare the risk of the LANOVA estimate $\widehat{\boldsymbol M}$ to the risk of the maximum likelihood estimate $\widehat{\boldsymbol M}_{MLE}$, the risk of the strictly additive estimate $\widehat{\boldsymbol M}_{ADD}$, the risk of additive-plus-low-rank estimates $\widehat{\boldsymbol M}_{LOW,1}$ and $\widehat{\boldsymbol M}_{LOW,5}$ which assume rank-one and rank-five $\boldsymbol C$ respectively, the risk of the soft- and hard-thresholding IPOD estimates of \cite{She2011} $\widehat{\boldsymbol M}_{IPOD,S}$ and $\widehat{\boldsymbol M}_{IPOD,H}$, and the risk of approximately minimax estimates $\widehat{\boldsymbol M}_{MINI,U}$ and $\widehat{\boldsymbol M}_{MINI,S}$ obtained using the universal threshold and Stein's unbiased risk estimate (SURE) described by \cite{Donoho1994}. Additive-plus-low-rank estimates are computed according to \cite{Johnson1972b}. Approximately minimax estimates are computed according to $\widehat{\boldsymbol M}_{MINI,U} = \widehat{\boldsymbol M}_{ADD} + \widehat{\boldsymbol C}_{MINI,U}$ and $\widehat{\boldsymbol M}_{MINI,S} = \widehat{\boldsymbol M}_{ADD} + \widehat{\boldsymbol C}_{MINI,S}$, where $\widehat{\boldsymbol C}_{MINI,S}$ and $\widehat{\boldsymbol C}_{MINI,S}$ are obtained by applying the universal threshold or SURE soft thresholding methods given by \cite{Donoho1994} to elements of $\boldsymbol Y - \widehat{\boldsymbol M}_{ADD}$, as if elements of $\boldsymbol Y - \widehat{\boldsymbol M}_{ADD}$ were independent and identically distributed. We compute Monte Carlo estimates of the relative risks for $n = p = 25$, $\mu = 0$, $\boldsymbol a = \boldsymbol 0$, $\boldsymbol b = \boldsymbol 0$ and $\sigma^2_z = 1$. For exponential power distributed $\boldsymbol C$, we vary $\sigma^2_c = \left\{1/2,1,2 \right\}$ and $q_c = \left\{0.1,\dots,1.9 \right\}$. For Bernoulli-normal distributed $\boldsymbol C$, we vary $\tau^2_c = \left\{1/2,1,2 \right\}$ and $\pi_c = \left\{0,0.1,\dots,0.9,1 \right\}$. For each $(\sigma^2_c, q_c)$ and $(\tau^2_c, \pi_c)$, the Monte Carlo estimate is based on 500 simulated $\boldsymbol Y$. The results shown in Figure~\ref{fig:misspec} indicate generally favorable performance of the LANOVA estimate $\widehat{\boldsymbol M}$. The top four plots show log relative risk estimates when elements of $\boldsymbol C$ are exponential power distributed, whereas the bottom four plots show log relative risk estimates when elements of $\boldsymbol C$ are Bernoulli-normal distributed. As expected, the LANOVA estimate performs as well as or better than all alternative estimators when $q_c = 1$ and the LANOVA model is true. Interestingly, the LANOVA estimate also performs as well as or better than all alternative estimators when $\pi_c = 0.5$, even though the LANOVA model is not true. This suggests that the LANOVA estimate will tend to perform well relative to alternative estimators when the excess kurtosis of elements of $\boldsymbol C$ is similar to the excess kurtosis of a Laplace distribution. This is consistent with Proposition~\ref{prop:misspec}, which states that the asymptotic bias of the variance estimators $\widehat{\sigma}^2_c$ and $\widehat{\sigma}^2_z$ will depend on the excess kurtosis of the true distribution of elements of $\boldsymbol C$. \begin{figure}[h] \centering \includegraphics[scale=0.85]{misspecification_comb.pdf} \caption{Monte Carlo approximations of the relative risks of the LANOVA estimate $\widehat{\boldsymbol M}$ versus the MLE $\widehat{\boldsymbol M}_{MLE}$, the strictly additive estimate of $\widehat{\boldsymbol M}_{ADD}$, additive-plus-low-rank estimates $\widehat{\boldsymbol M}_{LOW,1}$ and $\widehat{\boldsymbol M}_{LOW,5}$ based on rank-1 and rank-5 estimates of $\boldsymbol C$, soft- and hard-thresholding IPOD estimates $\widehat{\boldsymbol M}_{IPOD,S}$ and $\widehat{\boldsymbol M}_{IPOD,H}$, and universal threshold and SURE based approximately minimax estimates $\widehat{\boldsymbol M}_{MINI,U}$ and $\widehat{\boldsymbol M}_{MINI,S}$.} \label{fig:misspec} \end{figure} In the first column of Figure~\ref{fig:misspec}, we see that the LANOVA estimate $\widehat{\boldsymbol M}$ tends to outperform the strictly non-additive estimate $\widehat{\boldsymbol M}_{MLE}$ when $q_c < 1$ or $\pi_c < 0.5$, especially when the variance of the interactions $\sigma^2_c$ or $\tau^2_c$ is small relative to the variance of the noise $\sigma^2_z$. Intuitively, this makes sense. When $q_c$ is small we expect that many elements of $\boldsymbol C$ will be very close to zero, and when $\pi_c$ is small, many elements of $\boldsymbol C$ will be exactly equal to zero. Furthermore, when $\sigma^2_c$ or $\tau^2_c$ are small we expect even the largest interactions to be small relative to the noise. Accordingly, this suggests that $\widehat{\boldsymbol M}$ tends to outperform the strictly non-additive estimate $\widehat{\boldsymbol M}_{MLE}$ when $\boldsymbol M$ is more nearly additive. Analogously, the LANOVA estimate $\widehat{\boldsymbol M}$ tends to outperform the strictly additive estimate $\widehat{\boldsymbol M}_{ADD}$ when $q_c > 1$ or $\pi_c > 0.5$, especially when the variance of the interactions $\sigma^2_c$ or $\tau^2_c$ is large relative to the variance of the noise $\sigma^2_z$. Again, this makes sense because we expect that fewer elements of $\boldsymbol C$ will be nearly or exactly equal to zero when $q_c > 1$ or $\pi_c > 0.5$, and more elements of $\boldsymbol M$ will be strictly non-additive. In the second column of Figure~\ref{fig:misspec}, we see that the relative performance of the LANOVA estimate $\widehat{\boldsymbol M}$ relative to the additive-plus-low-rank estimates $\widehat{\boldsymbol M}_{LOW,1}$ and $\widehat{\boldsymbol M}_{LOW,5}$ depends on the distribution of elements of $\boldsymbol C$. When elements of $\boldsymbol C$ are exponential power distributed, the LANOVA estimate $\widehat{\boldsymbol M}$ outperforms the additive-plus-low-rank estimates $\widehat{\boldsymbol M}_{LOW,1}$ and $\widehat{\boldsymbol M}_{LOW,5}$ as long as $q_c$ is neither to small nor too large, especially when the variance of the interactions $\sigma^2_c$ is large relative to the variance of the noise $\sigma^2_z$. When elements of $\boldsymbol C$ are Bernoulli-normal distributed, the LANOVA estimate $\widehat{\boldsymbol M}$ almost always outperforms both additive-plus-low-rank estimates $\widehat{\boldsymbol M}_{LOW,1}$ and $\widehat{\boldsymbol M}_{LOW,5}$. This makes sense, as low rank approximations of sparse matrices tend to perform poorly. In the third column, we see that the LANOVA estimate $\widehat{\boldsymbol M}$ tends to outperform the the soft- and hard-thresholding IPOD estimates $\widehat{\boldsymbol M}_{IPOD, S}$ and $\widehat{\boldsymbol M}_{IPOD, H}$ for values of $q_c > 0.5$ and all values of $\pi_c$ and $\tau^2_c$. The soft-thresholding IPOD estimate $\widehat{\boldsymbol M}_{IPOD, S}$ performs almost identically to the strictly additive estimate $\widehat{\boldsymbol M}_{ADD}$ which suggests that it tends to overpenalize elements of $\boldsymbol C$. Surprisingly, $\widehat{\boldsymbol M}_{IPOD,S}$ tends to slightly outperform $\widehat{\boldsymbol M}_{IPOD,H}$. As discussed in \cite{She2011}, outlier detection based on convex penalties, which are used to compute $\widehat{\boldsymbol M}$ and $\widehat{\boldsymbol M}_{IPOD,S}$, tends to perform worse than outlier detection based on nonconvex penalties, which are used to compute $\widehat{\boldsymbol M}_{IPOD,H}$. However the relatively better performance of $\widehat{\boldsymbol M}$ and $\widehat{\boldsymbol M}_{IPOD,S}$ relative to $\widehat{\boldsymbol M}_{IPOD, H}$ can be attributed to the fact that outlier detection based on convex penalties performs well when all observations have equal leverage, as is the case in this setting \citep{Rousseeuw1987}. The LANOVA estimate $\hat{\boldsymbol M}$ is also much faster to compute than both IPOD estimates; the soft- and hard-thresholding IPOD estimates take over $1,000$ times longer than the LANOVA estimate to compute on average across all simulations. In the last column, we see that the LANOVA estimate $\widehat{\boldsymbol M}$ tends to outperform the approximately minimax estimates $\widehat{\boldsymbol M}_{MINI,U}$ and $\widehat{\boldsymbol M}_{MINI,S}$ as long as elements of $\boldsymbol C$ are not extremely heavy tailed or extremely sparse, especially when the variance of the interactions $\sigma^2_c$ is large relative to the variance of the noise $\sigma^2_z$. Additionally, the improvements offered by the LANOVA estimate $\widehat{\boldsymbol M}$ over the approximately minimax estimates $\widehat{\boldsymbol M}_{MINI,U}$ and $\widehat{\boldsymbol M}_{MINI,S}$ are greater when $\boldsymbol C$ is exponential power distributed versus Bernoulli-normal distributed, which suggests that LANOVA penalization may be particularly useful when we expect that some elements of $\boldsymbol C$ are nearly but not exactly equal to zero. Altogether, these results also suggest that the LANOVA estimate $\widehat{\boldsymbol M}$ can offer better or comparable performance relative to alternatives as long as the tail behavior of elements of $\boldsymbol C$ is not too different from the tail behavior of a Laplace distribution. Relatedly, the results also also suggest that we might be able to construct an improved estimate of $\boldsymbol M$ based on LANOVA penalization if prior information on the tail behavior of elements of $\boldsymbol C$ is available. The results displayed in Figure~\ref{fig:misspec} suggest that the biased estimation of $\widehat{\sigma}^2_c$ and $\widehat{\sigma}^2_z$ when elements of $\boldsymbol C$ have lighter- or heavier-than Laplace tailed described in Proposition~\ref{prop:misspec} leads to poorer LANOVA estimates of $\boldsymbol M$. Fortunately, this suggests that estimation of $\boldsymbol M$ could be improved if less biased estimates of $\widehat{\sigma}^2_c$ and $\widehat{\sigma}^2_z$ could be obtained. Proposition~\ref{prop:misspec} suggests a correction of multiplying $\widehat{\sigma}^2_c$ by $\sqrt{3/\kappa}$ and subtracting $(1 - \sqrt{\kappa/3})\sqrt{3/\kappa}\widehat{\sigma}^2_c$ from $\widehat{\sigma}^2_z$. However because excess kurtosis $\kappa$ is not a readily interpretable quantity, specifying a more appropriate value of $\kappa$ \emph{a priori} may be difficult. However if a Bernoulli-normal distribution for elements of $\boldsymbol C$ is plausible, a more appropriate value of $\pi_c$ can be used to specify a more appropriate value of $\kappa$. If the new value of $\pi_c$ is close to the ``true'' proportion of nonzero elements of $\boldsymbol C$, this may improve estimation of $\sigma^2_c$ and $\sigma^2_z$ and accordingly, $\boldsymbol M$. \section{Extensions}\label{sec:ext} \subsection{Penalizing Lower-Order Parameters}\label{subsec:extrapen} When $\boldsymbol Y$ has many rows or columns, it may be reasonable to believe that many elements of $\boldsymbol a$ or $\boldsymbol b$ are exactly zero. A natural extension of Equation~\eqref{eq:obj} is given by \begin{align}\label{eq:objlowpen} \text{min}_{\mu,\boldsymbol a,\boldsymbol b, \boldsymbol C}\frac{1}{2\sigma^2_z}\left|\left|\text{vec}\left(\boldsymbol Y -\boldsymbol M\right) \right|\right|^2_2 + \lambda_a \left|\left|\boldsymbol a\right|\right|_1 + \lambda_b \left|\left|\boldsymbol b\right|\right|_1 + \lambda_c \left|\left| \text{vec}\left(\boldsymbol C\right)\right|\right|_1, \end{align} where we still have $\boldsymbol M = \boldsymbol 1_n \boldsymbol 1_p' \mu + \boldsymbol a \boldsymbol 1_p' + \boldsymbol 1_n \boldsymbol b' + \boldsymbol C$. Again, using the posterior mode interpretation of Equation~\eqref{eq:objlowpen}, we can estimate $\sigma^2_a$ and $\sigma^2_b$ from the observed data, $\boldsymbol Y$: \begin{align*} \widehat{\sigma}^2_a &=\frac{1}{n-1}\sum_{i = 1}^n \check{a}^2_i - \frac{n}{\left(n -1\right)\left(p - 1\right)}\overline{r}^{\left(2\right)}\text{, \quad}\widehat{\sigma}^2_b = \frac{1}{p-1}\sum_{j = 1}^p \check{b}^2_j - \frac{p}{\left(n -1\right)\left(p - 1\right)}\overline{r}^{\left(2\right)}. \end{align*} where $\check{\boldsymbol a} = \boldsymbol H_n \boldsymbol Y \boldsymbol 1_p/p$ and $\check{\boldsymbol b} = \boldsymbol H_p \boldsymbol Y' \boldsymbol 1_n/n$ are OLS estimates for $\boldsymbol a$ and $\boldsymbol b$. The estimators $\widehat{\lambda}_a = \sqrt{2/\widehat{\sigma}^2_a}$ and $\widehat{\lambda}_b = \sqrt{2/{\widehat{\sigma}^2_b}}$ can be shown to be consistent for $\lambda_a$ and $\lambda_b$ as $n\rightarrow \infty$ and $p\rightarrow \infty$, respectively. Because $\widehat{\lambda}_c$ and $\widehat{\sigma}^2_z$ do not depend on of $\boldsymbol a$ and $\boldsymbol b$, our estimators for $\lambda_c$ and $\sigma^2_z$ are unchanged. A block coordinate descent algorithm for solving Equation~\eqref{eq:objlowpen} is given in the web appendix. With respect to interpretation, population average row and column main effects can be obtained via ANOVA decomposition of $\widehat{\boldsymbol M}$. \subsection{Tensor Data} LANOVA penalization can be extended to a $p_1\times p_2 \times \dots \times p_K$ $K$-mode tensor $\boldsymbol Y$. We consider: \begin{align}\label{eq:tenmod} \text{vec}\left(\boldsymbol Y\right) &=\boldsymbol W \boldsymbol \beta + \text{vec}\left(\boldsymbol C\right)+ \text{vec}\left(\boldsymbol Z\right), \\ \nonumber \boldsymbol C &= \left\{c_{i_1\dots i_K}\right\} \sim \text{i.i.d. Laplace}\left(0,\lambda_c^{-1}\right)\text{, \quad} \boldsymbol Z = \left\{z_{i_1 \dots i_K}\right\} \sim \text{i.i.d. N}\left(0,\sigma^2_z\right), \end{align} where $\text{vec}\left(\boldsymbol Y\right)$ is the $\prod_{k= 1}^K p_k \times 1$ vectorization of the $K$-mode tensor $\boldsymbol Y$ with ``lower'' indices moving ``faster'' and $\boldsymbol W$ and $\boldsymbol \beta$ are the design matrix and unknown mean parameters corresponding to a $K$-way ANOVA decomposition treating the $K$ modes of $\boldsymbol Y$ as factors. The matrix $\boldsymbol W = \left[\boldsymbol W_1, \dots , \boldsymbol W_{2^K-1}\right]$ is obtained by concatenating the $2^{K}-1$ unique matrices of the form $\boldsymbol W_l = \left(\boldsymbol W_{l,1} \otimes \dots \otimes \boldsymbol W_{l,K} \right)$, where each $\boldsymbol W_{l,k}$ is equal to either $\boldsymbol I_{p_k}$ or $\boldsymbol 1_{p_k}$, excluding the identity matrix, $\boldsymbol I_{p_K}\otimes \dots \otimes \boldsymbol I_{p_1}$. As in the matrix case, approaches that assume a low rank $\boldsymbol C$ are common \citep{VanEeuwijk1998, Gerard2015}. We penalize elements of the highest order mean term $\boldsymbol C$ for which no replicates are observed. In the three-way tensor case, the first part of Equation~\eqref{eq:tenmod} refers to the following decomposition: \begin{align}\label{eq:tensor} y_{ijk} = \mu + a_i + b_j + d_k + e_{ij} + f_{ik} + g_{jk} + c_{ijk} + z_{ijk}. \end{align} Estimates of $\sigma^2_z$ and $\lambda_c$ are constructed from $\text{vec}\left(\boldsymbol R\right) = \left(\boldsymbol H_K \otimes \dots \otimes \boldsymbol H_1 \right)\text{vec}\left(\boldsymbol Y\right)$, where $\boldsymbol H_k = \boldsymbol I_{p_k} - \boldsymbol 1_{p_k} \boldsymbol 1_{p_k}/p_k$ is the $p_k \times p_k$ centering matrix and `$\otimes$' is the Kronecker product. As in the matrix case, $\text{vec}\left(\boldsymbol R\right)$ is independent of the lower-order unknown mean parameters $\boldsymbol \beta$, i.e. $\text{vec}\left(\boldsymbol R\right) = \left(\boldsymbol H_K \otimes \dots \otimes \boldsymbol H_1 \right)\text{vec}\left(\boldsymbol C + \boldsymbol Z\right)$. Our estimates of $\sigma^2_z$ and $\lambda_c$ are still functions of the second and fourth sample moments of $\boldsymbol R$: $\overline{r}^{\left(2\right)} = \frac{1}{p}\sum_{i = 1}^{p} r^2_{i}$ and $\overline{r}^{\left(4\right)} = \frac{1}{p}\sum_{i = 1}^{p} r^4_{i}$, where $p = \prod_{k = 1}^K p_k$. We extend our empirical Bayes estimators as follows: \begin{align} \widehat{\sigma}^4_c =& \left\{\prod_{k = 1}^K\frac{p_k^3}{\left(p_k - 1\right)\left(p_k^2 - 3p_k + 3\right)}\right\}\left\{\overline{r}^{\left(4\right)}/3 - \left(\overline{r}^{\left(2\right)}\right)^2 \right\}, \\ \nonumber \widehat{\sigma}^2_c =& \sqrt{\widehat{\sigma}^4_c}\text{,\quad} \widehat{\sigma}^2_z = \left(\prod_{k = 1}^K\frac{p_k}{p_k - 1}\right)\overline{r}^{\left(2\right)} - \widehat{\sigma}^2_c, \end{align} where $\widehat{\lambda}_c = \sqrt{2/\widehat{\sigma}^2_c}$. As in the matrix case, we can compute the bias of $\widehat{\sigma}^4_c$. \begin{proposition}\label{prop:biastens} Under the model given by Equation~\eqref{eq:tenmod}, \begin{align*} \mathbb{E}\left[\widehat{\sigma}^4_c\right] -\sigma^4_c =& -\left\{\prod_{k = 1}^K\frac{p_k^3}{\left(p_k - 1\right)\left(p^2_k - 3p_k + 3\right)}\right\}\left[\left\{3\prod_{k = 1}^K\frac{\left(p_k - 1\right)^2}{p_k^3}\right\}\sigma^4_c +\right.\\ &\left. \left(2\prod_{k= 1}^K\frac{p_k - 1}{p_k^2}\right)\left(\sigma^2_c + \sigma^2_z\right)^2 \right]. \end{align*} \end{proposition} Interpretation of this result is analogous to the matrix case. We tend to prefer the simpler model with $\text{vec}\left(\boldsymbol C\right) = \boldsymbol 0$ over a more complicated model with nonzero elements of $\text{vec}\left(\boldsymbol C\right)$ when few data are available or when the data is very noisy. Additionally, $\mathbb{E}\left[\widehat{\sigma}^4_c\right] - \sigma^4_c=O\left(1/p\right)$, i.e. the bias of $\widehat{\sigma}^4_c$ diminishes as the number of levels of \emph{any} mode increases. We also assess the large-sample performance of our empirical Bayes estimators in the $K$-way tensor case. \begin{proposition}\label{prop:consestsarr} Under the model given by Equation~\eqref{eq:tenmod}, $\widehat{\sigma}^4_c\stackrel{p}{\rightarrow}\sigma^4_c$, $\widehat{\sigma}^2_c\stackrel{p}{\rightarrow}\sigma^2_c$, $\widehat{\lambda}_c\stackrel{p}{\rightarrow}\lambda_c$ and $\widehat{\sigma}^2_z\stackrel{p}{\rightarrow}\sigma^2_z$ as $p_{k'} \rightarrow \infty$ with $p_{k}$, $k\neq k'$, fixed or $p_1,\dots, p_K\rightarrow \infty$. \end{proposition} A block coordinate descent algorithm for estimating the unknown mean parameters is given in the web appendix. Results for testing the appropriateness of assuming heavy-tailed $\boldsymbol C$ and robustness carry over to $K$-way tensors. $K$-way tensor analogues to Propositions~\ref{prop:test}-\ref{prop:misspec}, where we replace $np$ with $p$ and assume all $p_1,\dots,p_K\rightarrow \infty$, are shown to hold in the web appendix. Lastly we can also extend LANOVA penalization for tensor data to penalize lower-order mean parameters. Because tensor-variate $\boldsymbol Y$ include even more lower-order mean parameters, penalizing lower-order parameters is especially useful. We give nuisance parameter estimators for penalizing lower-order parameters in the three-way case in the web appendix. \section{Numerical Examples}\label{sec:numex} \paragraph{Brain Tumor Data:} We consider a $356\times 43$ matrix of gene expression measurements for 356 genes and 43 brain tumors. The 43 brain tumors include 24 glioblastomas and 19 oligodendrogal tumors, which include 5 astrocytomas, 8 oliodendrogliomas and 6 mixed oligoastrocytomas. This data is contained in the \texttt{denoiseR} package for \texttt{R} \citep{Josse2016a}, and it has been used to identify genes associated with glioblastomas versus oligodendrogal tumors \citep{Bredel2005,deTayrac2009}. We focus on comparison to \cite{deTayrac2009}, who used a variation of principal components analysis of $\boldsymbol Y$ to identify differentially expressed genes and groups of tumors which is similar to using an additive-plus-low-rank estimate of $\boldsymbol M$. To ensure a straightforward comparison to the methods used in \cite{deTayrac2009}, we do not perform any additional preprocessing of the data, e.g. adjustments for possible low rank confounding factors that are often observed in gene expression data \citep{Leek2007, Gagnon-Bartsch2013}. Unlike pairwise test-based methods which require prespecified tumor groupings, LANOVA penalization and additive-plus-low-rank estimates can be used to examine differential expression both within and across types of brain tumors. Differential expression \emph{within} types of brain tumors in particular is of recent interest \citep{Bleeker2012}. We apply LANOVA penalization with penalized interaction effects and unpenalized main effects. The test given by Proposition~\ref{prop:test} supports a non-additive estimate of $\boldsymbol M$; we obtain a test statistic of $18.45$ and reject the null hypothesis of normally distributed elementwise variability at level $\alpha = 0.05$ with $p<10^{-5}$. We estimate that $11,188$ elements of $\boldsymbol C$ (73\%) are exactly equal to zero, i.e. most genes are not differentially expressed. Figure~\ref{fig:prcomp} shows $\widehat{\boldsymbol C}$ and a subset containing fifty genes with the lowest gene-by-tumor sparsity rates. \begin{figure}[h] \centering \includegraphics[scale=0.85]{josse_fig.pdf} \caption{Elements of the $356\times 43$ matrix $\widehat{\boldsymbol C}$. The first panel shows the entire matrix $\widehat{\boldsymbol C}$ with rows (genes) and columns (tumors) sorted in decreasing order of the row and column sparsity rates. The second panel zooms in on the rows of $\widehat{\boldsymbol C}$ (genes) marked in the first panel, which correspond to the fifty rows (genes) with the lowest sparsity rates. Colors correspond to positive (red) versus negative (blue) values of $\widehat{\boldsymbol C}$ and darkness corresponds to magnitude. } \label{fig:prcomp} \end{figure} The results of LANOVA penalization are consistent with those of \cite{deTayrac2009}. We observe that 49\% and 56\% of the elements of $\widehat{\boldsymbol C}$ involving the genes ASPA and PDPN are nonzero. Examination of $\widehat{\boldsymbol M}$ indicates overexpression of these genes among glioblastomas relative to oligodendrogal tumors, as observed in \cite{deTayrac2009}. LANOVA penalization yields additional results that are consistent with the wider literature. The gene DLL3 has the highest rate of gene-by-tumor interactions at 74\% and tends to be underexpressed in glioblastomas. This is consistent with findings of overexpression of DLL3 in brain tumors with better prognoses \citep{Bleeker2012}. The KLRC genes KLRC1, KLRC2 and KLRC3.1 all have very high rates of gene-by-tumor interactions at 72\%, 70\% and 60\%. \cite{Ducray2008} has found evidence for differential KLRC expression across glioma subtypes. LANOVA penalization also indicates that several brain tumors have unique gene expression profiles. Glioblastomas 3, 4 and 30 have rates of nonzero gene-by-tumor interactions exceeding 50\% and similar gene expression profiles. Specifically, we observe overexpression of FCGR2B and HMOX1 and underexpression of RTN3 for gliomastomas 3, 4 and 30. Overexpression of FCGR2B or HMOX1 is associated with poorer prognosis \citep{Zhang2016, Ghosh2016a}, and RTN3 is differentially expressed across subgroups of glioblastoma that differ with respect to prognosis \citep{Cosset2017}. This suggests that glioblastomas 3, 4 and 30 may correspond to an especially aggressive subtype. \paragraph{fMRI Data:} Second, we consider a tensor of fMRI data which appeared in \cite{Mitchell2004}. During each of 36 tasks, fMRI activations were measured at $55$ time points and $4,698$ locations (voxels). Accordingly, the data can be represented as a $36\times 55\times 4,698$ three-way tensor. Because the data is so high dimensional, many methods of analysis are prohibitively computationally burdensome. Accordingly, parcellation approaches that reduce the spatial resolution of fMRI data by grouping voxels into spatially contiguous groups are common, however, the choice of a specific parcellation can be difficult \citep{Thirion2014}. Instead, we propose LANOVA penalization as an exploratory method to identify relevant dimensions of spatial variation that should be accounted for in a subsequent analysis. The test given by Proposition~\ref{prop:test} supports a non-additive estimate of $\boldsymbol M$; we obtain a test statistic of $298.87$ and reject the null hypothesis of normally distributed elementwise variability at level $\alpha = 0.05$ with $p<10^{-5}$. Having found support for the use of a non-additive estimate of $\boldsymbol M$, we also penalize lower-order mean parameters as $\boldsymbol Y$ is high dimensional and sparsity of lower-order mean parameters could result in substantial dimension reduction and improved interpretability. The LANOVA estimate has $1,751,179$ nonzero parameters, a small fraction of the $9,302,040$ parameters needed to represent the raw data, $\boldsymbol Y$ ($18.83\%$). Recalling that we are primarily interested in spatial variation, we examine estimated task-by-location interactions $\widehat{\boldsymbol F}$ and task-by-time-by-location elementwise interactions $\widehat{\boldsymbol C}$, as defined in Equation~\eqref{eq:tensor}. Figure~\ref{fig:fmri} shows the percent of nonzero entries $\widehat{\boldsymbol F}$ and $\widehat{\boldsymbol C}$ at each location. At each location, the proportion of nonzero entries of $\widehat{\boldsymbol F}$ is much larger than the proportion of nonzero entries of $\widehat{\boldsymbol C}$. This suggests that much of the spatial variation of activations by task can be attributed to an overall level change in activation over the duration of the task, as opposed to time-specific changes in activation. In a subsequent analysis, it may be reasonable to ignore task-by-time-by-location interactions. \begin{figure}[h] \centering \includegraphics[scale = 0.85]{fmri.pdf} \caption{Percent of nonzero entries of $\widehat{\boldsymbol F}$ and $\widehat{\boldsymbol C}$ by location, where $\widehat{\boldsymbol F}$ and $\widehat{\boldsymbol C}$ estimate $\boldsymbol F$ and $\boldsymbol C$ as defined in Equation~\eqref{eq:tensor}. Entries of $\boldsymbol F$ index task-by-location interaction terms and entries of $\boldsymbol C$ index task-by-time-by-location elementwise interaction terms. Darker colors indicate higher percentages.} \label{fig:fmri} \end{figure} By examining the percent of nonzero entries of $\widehat{\boldsymbol F}$ by location, we can get a sense of which locations correspond to level changes in fMRI activity response by task. There is evidence for an overall level change in response to at least some tasks for all locations; the minimum percent of nonzero entries of $\widehat{\boldsymbol F}$ per location is $33\%$. However, voxels in the the parietal region, the calcarine fissure and the right- and left-dorsolateral prefrontal cortex have particularly high proportions of nonzero entries of $\widehat{\boldsymbol F}$, suggesting that overall activation in these regions is particularly responsive to tasks. By examining the percent of nonzero entries of $\widehat{\boldsymbol C}$ by location, we can get a sense of which locations correspond to time-specific differential activity by task over time. We see that nonzero entries of $\widehat{\boldsymbol C}$ are concentrated among voxels in the upper supplementary motor area, the calcarine fissure and the left- and right-temporal lobes. In this way, we can use LANOVA estimates to identify subsets of relevant voxels that should be included in a subsequent analysis. \paragraph{Fusarium Data:} Last, we consider the problem of checking for nonzero three-way interactions in experimental data without replicates. The data is a $20\times 7 \times 4$ three-way tensor containing severity of disease incidence ratings for 20 varieties of wheat infected with 7 strains of Fusarium head blight over 4 years, from 1990-1993 that appeared in \cite{VanEeuwijk1998}. There is scientific reason to believe that several nonzero three-way variety-by-strain-by-year interactions are present. \cite{VanEeuwijk1998} examined these interactions using a rank-one tensor model for $\boldsymbol C$, i.e.\ $c_{ijk} = \alpha_{i} \gamma_{j} \delta_{k}$. However as noted in Section~\ref{sec:intro}, a low rank model may not be sufficient even if few nonzero interactions are present. As in \cite{VanEeuwijk1998}, we transform the severity ratings to the logit scale before estimating LANOVA parameters. The test given by Proposition~\ref{prop:test} supports a non-additive estimate of $\boldsymbol M$; we obtain a test statistic of $3.99$ and reject the null hypothesis of normally distributed elementwise variability at level $\alpha = 0.05$ with $p=3.34\times10^{-5}$. We obtain 87 nonzero entries of $\widehat{\boldsymbol C}$ ($16\%$). \begin{figure}[h] \centering \includegraphics[scale = 0.85]{fusarium.pdf} \caption{Entries of $\widehat{\boldsymbol C}$. Red (blue) points indicate positive (negative) nonzero entries of $\widehat{\boldsymbol C}$ and darker colors correspond to larger magnitudes.} \label{fig:fusarium} \end{figure} Figure~\ref{fig:fusarium} shows nonzero elements of $\widehat{\boldsymbol C}$ as well as nonzero elements of $\widehat{\boldsymbol C}_{IPOD,H}$ obtained using the hard-thresholding IPOD method of \cite{She2011}, with dashed lines separating groups of wheat and blight by country of origin: Hungary (H), Germany (G), France (F) or the Netherlands (N). Estimates of elements of $\widehat{\boldsymbol C}_{IPOD,S}$ obtained using the soft-thresholding IPOD method of \cite{She2011} are not pictured because they are all exactly equal to zero. We can interpret nonzero elements of estimates of $\boldsymbol C$ as evidence for variety-by-year-by-strain interactions that cannot be expressed as additive in variety-by-year, year-by-strain and variety-by-strain effects. Like \cite{VanEeuwijk1998}, both the LANOVA estimate $\widehat{C}$ and the hard-thresholding IPOD estimate $\widehat{\boldsymbol C}_{IPOD, H}$ include large three-way interactions in 1992, during which there was a disturbance in the storage of blight strains. Specifically, we observe interactions involving Dutch variety 2, the only variety with no infections at all in 1992, and interactions between Hungarian varieties 21 and 23 and foreign blight strains, which despite the storage disturbance were still able to cause infection in these two Hungarian varieties alone. The soft-thresholding IPOD estimate $\widehat{\boldsymbol C}_{IPOD,S}$ fails to include these real interactions, suggesting that it overpenalized $\boldsymbol C$ just as we observed in simulations. We do not have enough information about the data to assess whether or not the remaining interactions identified by $\hat{\boldsymbol C}$ and $\hat{\boldsymbol C}_{IPOD,H}$ are related to features of the study or known patterns in the behavior of certain varieties and strains, however they suggest further investigation of these varieties and strains may be warranted. \section{Discussion}\label{sec:disc} This paper demonstrates the use the common Lasso penalty and the corresponding Laplace prior distribution for estimating elementwise effects of scientific interest in the absence of replicates. Our procedure, LANOVA penalization, can also be interpreted as assessing evidence for nonadditivity. We show that our nuisance parameter estimators are consistent and explore their behavior when assumptions are violated. We demonstrate that the corresponding mean parameter estimates can perform favorably relative to strictly additive, strictly non-additive, additive-plus-low-rank, IPOD, and approximately minimax estimates when elements of $\boldsymbol C$ are exponential power or Bernoulli-normal distributed, especially if the tail behavior of elements of $\boldsymbol C$ is similar to the tail behavior of a Laplace distribution and the variance of the interactions $\sigma^2_c$ is large relative to the variance of the noise $\sigma^2_z$. We emphasize that LANOVA penalization is computationally simple. The nuisance parameter estimators are easy to compute for arbitrarily large matrices and estimates of $\boldsymbol M$ can be computed using fast a block coordinate descent algorithm that exploits the structure of the problem. We also extend LANOVA penalization to penalize lower-order mean parameters and apply to tensors. Finally, we show that LANOVA estimates can be used to examine gene-by-tumor interactions using microarray data, to perform exploratory analysis of spatial variation in activation response to tasks over time in high dimensional fMRI data and to assess evidence for ``real'' elementwise interaction effects at in experimental data. To conclude, we discuss several limitations and extensions. One limitation is that we assume heavy-tailed elementwise variation is of scientific interest and should be incorporated into the mean $\boldsymbol M$, whereas normally distributed elementwise variation is spurious noise $\boldsymbol Z$. If the noise is heavy-tailed, it may erroneously be incorporated into the estimate of $\boldsymbol C$. Similar issues arise with low rank models for $\boldsymbol C$, insofar as systematic correlated noise can erroneously be incorporated into the estimate of $\boldsymbol C$. Furthermore, if the elementwise variation of scientific interest includes low rank components, these low rank components may not be included in LANOVA estimates of the mean $\boldsymbol M$. This is of particular concern in the brain tumor data example but also of more general concern in applications involving gene expression data, because unobserved confounders with low rank structure may be present and need to be accounted for \citep{Leek2007, Gagnon-Bartsch2013}. That said, any method that aims to separate elementwise variation into components that are of scientific interest and spurious noise requires strong assumptions that must be considered in the context of the problem. Another limitation is that the results of the simulation study assessing the performance of the LANOVA estimate $\widehat{\boldsymbol M}$ do not necessarily suggest favorable performance of the LANOVA estimate in all settings. First, we only consider exponential power and Bernoulli-normal elements of $\boldsymbol C$. Although we expect the LANOVA estimate to perform well when elements of $\boldsymbol C$ are heavy tailed, we do not expect the LANOVA estimate to perform well when $\boldsymbol C$ are light-tailed. Second, this scenario considers $\boldsymbol C$ with independent, identically distributed elements. In some settings, it may be reasonable to expect dependence across elements of $\boldsymbol C$ and additive-plus-low-rank estimates may perform better. The methods presented in this paper could be extended in several ways. Although we use our estimators of $\lambda_c$ and $\sigma^2_z$ in posterior mode estimation, the same estimators could also be used to simulate from the posterior distribution using a Gibbs sampler. The output of a Gibbs sampler could be used to construct credible intervals for elements of $\boldsymbol M$, which would be one way of addressing uncertainty. We may also want to account for additional uncertainty induced by estimating $\lambda_c$ and $\sigma^2_z$. To address this, a fully Bayesian approach with prior distributions set for $\lambda_c$ and $\sigma^2_z$ could be taken at the cost of losing a sparse estimate of $\boldsymbol C$. Our empirical Bayes nuisance parameter estimators could be used to set parameters of prior distributions for $\lambda_c$ or $\sigma^2_z$. Last, LANOVA penalization for matrices is a specific case of the more general bilinear regression model, where we assume $\boldsymbol Y = \boldsymbol A \boldsymbol W + \boldsymbol B \boldsymbol X + \boldsymbol C + \boldsymbol Z$, given known $\boldsymbol W$ and $\boldsymbol X$. We chose to focus on a simpler case in this paper to facilitate the derivation of interpretable expressions for the bias of $\sigma^4_c$ as well as estimators that are consistent as either $n$ or $p \rightarrow \infty$ because researchers often encounter ``fat'' or ``skinny'' matrices in practice. However, the same logic could easily be extended to the more general bilinear regression context as well as the even more general multilinear context for tensor $\boldsymbol Y$. Finally, our intuition combined with the results of Section~\ref{sec:laimp} suggests that the Laplace distributional assumptions used in this paper are likely to be violated in many settings. The strength of the Laplace distributional assumption for elements of $\boldsymbol C$ can be justified by the need to make \emph{some} assumptions to estimate $\sigma^2_c$ and $\sigma^2_z$ when $\boldsymbol C$ and $\boldsymbol Z$ are always observed as a sum $\boldsymbol C + \boldsymbol Z$. Given that we need to estimate fourth order moments of $\boldsymbol C$ and $\boldsymbol Z$ just to separately estimate $\sigma^2_c$ and $\sigma^2_z$, we expect that we would need to estimate even higher order moments to assess the appropriateness of the Laplace distributional assumption for $\boldsymbol C$ which is notoriously difficult to do well in practice. However, if we observed replicate measurements, as is the case for lower-order mean parameters $\boldsymbol a$ and $\boldsymbol b$, we would not need to estimate fourth order moments to separately estimate $\sigma^2_a$ or $\sigma^2_b$ from $\sigma^2_z$. Instead, we could use fourth order moments to assess the appropriateness of the Laplace distributional assumptions for $\boldsymbol a$ or $\boldsymbol b$ and possibly improve distribution specification. In recent work, we have considered this question in the general regression setting and have found that it can be possible to test the appropriateness of Laplace distributional assumptions and, when Laplace distributional assumptions are inappropriate, choose better ones \citep{Griffin2017c}. \section*{Acknowledgements} This work was partially supported by NSF grants DGE-1256082 and DMS-1505136. \addcontentsline{toc}{section}{References}
{'timestamp': '2019-02-12T02:05:23', 'yymm': '1703', 'arxiv_id': '1703.08620', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08620'}
arxiv
\section{INTRODUCTION} \label{sec:intro} Multi-agent systems have gained a significant amount of attention in the last decades, due to the several advantages they yield with respect to single-agent setups. A recent direction in the multi-agent control and robotics field is the use of temporal logic languages for motion and/or action planning, since they provide a fully-automated correct-by-design controller synthesis approach for autonomous robots. Temporal logics, such as linear temporal logic (LTL), computation tree logic (CTL) or metric-interval temporal logic (MITL), provide formal high-level languages that can describe planning objectives more complex than the usual navigation techniques. The task specification is given as a temporal logic formula with respect to a discretized abstraction of the robot motion modeled as a finite transition system, and then, a high-level discrete plan is found by off-the-shelf model-checking algorithms, given the finite transition system and the task specification \cite{baier2008principles}. There exists a wide variety of works that employ temporal logic languages for multi-agent systems, e.g., \cite{Meng15,Belta2007,Bhatia2010,Bhatia2011,Cowlagi2016,Diaz2015,Fainekos2009,Filippidis2012}. The discretization o\texttt{}f a multi-agent system to an abstracted finite transition system necessitates the design of appropriate continuous-time controllers for the transition of the agents among the states of the transition system \cite{baier2008principles}. Most works in the related literature, however, including the aforementioned ones, either assume that there \textit{exist} such continuous controllers or adopt single- and double-integrator models, ignoring the actual dynamics of the agents. Discretized abstractions, including design of the discrete state space and/or continuous-time controllers, have been considered in \cite{Belta2005,belta2006controlling,reissig2011computing,tiwari2008abstractions,rungger2015state} for general systems and \cite{boskos2015decentralized, belta2004abstraction} for multi-agent systems. Another important issue concerning multi-agent abstractions that has not been addressed in the related literature is the collision avoidance between the robotic agents, which, unlike the unrealistic point-mass assumption that is considered in many works, can be more appropriately approximated by unions of rigid bodies. This work addresses the problem of decentralized abstractions for a team of mobile robotic manipulators, represented by a union of $3$D ellipsoids, among predefined regions of interest in the workspace. Mobile manipulators consist of a mobile base and a robotic arm, which makes them suitable for performing actions around a workspace (e.g., transportation of objects). In \cite{tanner2003nonholonomic} the authors consider the navigation of two mobile manipulators grasping an object, based on $3$D ellipsoids, whereas \cite{Loizou-RSS-14} deals with general-shape multi-agent navigation, both based on point-world transformations. Navigation of ellipsoidal agents while incorporating collision-avoidance properties was also studied in \cite{do2012coordination} for single-integrator dynamics, by transforming the ellipsoids to spheres. In our previous work \cite{verginis_ifac17}, we addressed a hybrid control framework for the navigation of mobile manipulators and their interaction with objects in a given workspace, proposing, however, a centralized solution. In this work, we design robust continuous-time controllers for the navigation of the agents among the regions of interest. The proposed methodology is decentralized, since each agent uses only local information based on limited sensing capabilities. Moreover, we guarantee (i) inter-agent collision avoidance by introducing a novel transformation-free ellipsoid-based strategy, (ii) connectivity maintenance for a subset of the initially connected agents, which might be important for potential cooperative tasks, and (iii) kinematic singularity avoidance of the robotic agents. The rest of the paper is organized as follows. Section \ref{sec:prel} provides necessary notation and preliminary background and Section \ref{sec:PF} describes the tackled problem. The main results are given in Section \ref{sec:main results} and Section \ref{sec:simulations} presents simulation results. Finally, \ref{sec:concl} concludes the paper. \section{PRELIMINARIES} \label{sec:prel} \subsection{Notation} The set of positive integers is denoted as $\mathbb{N}$ whereas the real and complex $n$-coordinate spaces, with $n\in\mathbb{N}$, are denoted as $\mathbb{R}^n$ and $\mathbb{C}^n$, respectively; $\mathbb{R}^n_{\geq 0}, \mathbb{R}^n_{> 0}, \mathbb{R}^n_{\leq 0}$ and $\mathbb{R}^n_{< 0}$ are the sets of real $n$-vectors with all elements nonnegative, positive, nonpositive, and negative, respectively. The notation $\|x\|$ is used for the Euclidean norm of a vector $x \in \mathbb{R}^n$. Given a a scalar function $y:\mathbb{R}^{n}\to\mathbb{R}$ and a vector $x\in\mathbb{R}^n$, we use the notation $\nabla_{x}y(x) = [\tfrac{\partial y}{\partial x_1}, \dots, \tfrac{\partial y}{\partial x_n}]^\top\in\mathbb{R}^n$. Define by $I_n \in \mathbb{R}^{n \times n}, 0_{m \times n} \in \mathbb{R}^{m \times n}$, the identity matrix and the $m \times n$ matrix with all entries zero, respectively; $\mathcal{B}_{c,r} = \{x \in \mathbb{R}^3: \|x-c\| \leq r\}$ is the $3$D sphere of center $c\in\mathbb{R}^{3}$ and radius $r \in \mathbb{R}_{\ge 0}$. The boundary of a set $A$ is denoted as $\partial A$ and its interior as $\accentset{\circ}{A} = A\backslash\partial A$. The vector connecting the origins of coordinate frames $\{A\}$ and $\{B$\} expressed in frame $\{C\}$ coordinates in $3$D space is denoted as $p^{\scriptscriptstyle C}_{{\scriptscriptstyle B/A}}\in{\mathbb{R}}^{3}$. For notational brevity, when a coordinate frame corresponds to an inertial frame of reference $\{I\}$, we will omit its explicit notation (e.g., $p_{\scriptscriptstyle B} = p^{\scriptscriptstyle I}_{\scriptscriptstyle B/I}, \omega_{\scriptscriptstyle B} = \omega^{\scriptscriptstyle I}_{\scriptscriptstyle B/I}$). All vector and matrix differentiations are derived with respect to an inertial frame $\{I\}$, unless otherwise stated. \subsection{Cubic Equations and Ellipsoid Collision} \begin{proposition} \label{prop:cubic} Consider the cubic equation $f(\lambda) = c_3\lambda^3+c_2\lambda^2+c_1\lambda + c_0 = 0$ with $c_\ell\in\mathbb{R},\forall \ell\in\{0,\dots,3\}$ and roots $(\lambda_1,\lambda_2,\lambda_3)\in\mathbb{C}^3$, with $f(\lambda_1)=f(\lambda_2)=f(\lambda_3)=0$. Then, given its discriminant $\Delta = (c_3)^4\prod_{\substack{i\in\{1,2\}\\\substack{j\in\{i+1,\dots,3\} } }}(\lambda_i-\lambda_j)^2$, the following hold: \begin{enumerate} [(i)] \item $\Delta = 0 \Leftrightarrow \exists i,j\in\{1,2,3\}$, with $i\neq j$, such that $\lambda_i=\lambda_j$, i.e., at least two roots are equal, \item $\Delta > 0 \Leftrightarrow \lambda_i\in\mathbb{R},\forall i\in\{1,2,3\}$, and $\lambda_i\neq\lambda_j, \forall i,j\in\{1,2,3\}$, with $i\neq j$, i.e., all roots are real and distinct. \end{enumerate} \end{proposition} \begin{proposition} \cite{choi2009continuous} \label{prop:ellipsoids} Consider two planar ellipsoids $\mathcal{A} = \{z\in\mathbb{R}^3 \text{ s.t. } z^\top A(t) z \leq 0\}$, $\mathcal{B} = \{z\in\mathbb{R}^3 \text{ s.t. } z^\top B(t) z \leq 0 \}$, with $z=[p^\top 1]^\top$ being the homogeneous coordinates of $p\in\mathbb{R}^2$, and $A, B:\mathbb{R}_{\geq 0}\to\mathbb{R}^{3\times3}$ terms that describe their motion in $2$D space. Given their characteristic polynomial $f:\mathbb{R}\to\mathbb{R}$ with $f(\lambda) = \det(\lambda A - B)$, which has degree $3$, the following hold: \begin{enumerate}[(i)] \item $\exists \lambda^*\in\mathbb{R}_{>0} \text{ s.t. } f(\lambda^*)=0$, i.e, the polynomial $f(\lambda)$ always has one positive real root, \item $\mathcal{A}\cap\mathcal{B} = \emptyset \Leftrightarrow \exists \lambda^*_1, \lambda^*_2 \in\mathbb{R}_{<0}$, with $\lambda^*_1\neq\lambda^*_2$, and $f(\lambda^*_1)=f(\lambda^*_2)=0$, i.e., $\mathcal{A}$ and $\mathcal{B}$ are disjoint if and only if the characteristic equation $f(\lambda) = 0$ has two distinct negative roots. \item $\mathcal{A}\cap\mathcal{B} \neq \emptyset$ and $\accentset{\circ}{\mathcal{A}}\cap\accentset{\circ}{\mathcal{B}}=\emptyset \Leftrightarrow \exists \lambda^*_1, \lambda^*_2 \in\mathbb{R}_{<0}$, with $\lambda^*_1=\lambda^*_2$, and $f(\lambda^*_1)=f(\lambda^*_2)=0$, i.e., $\mathcal{A}$ and $\mathcal{B}$ touch externally if and only if the characteristic equation $f(\lambda) = 0$ has a negative double root. \end{enumerate} \end{proposition} \section{PROBLEM FORMULATION} \label{sec:PF} \begin{figure}[] \vspace{0.4cm} \centering \includegraphics[trim = 0 0 0 0,scale=0.25]{robot_rigid_ellips.eps} \caption{An agent that consists of $\ell_i = 3$ rigid links.\label{fig:Agent}} \end{figure} Consider $N\in\mathbb{N}$ fully actuated agents with $\mathcal{V}\coloneqq \{1,\dots,N\}, N\geq 2$, composed by a robotic arm mounted on an omnidirectional mobile base, operating in a static workspace $\mathcal{W}$ that is bounded by a large sphere in $3$D space, i.e. $\mathcal{W} = \mathring{\mathcal{B}}_{p_0,r_0} = \{p\in\mathbb{R}^3 \text{ s.t. } \lVert p - p_0 \rVert < r_0\}$, where $p_0\in\mathbb{R}^3$ is the center of $\mathcal{W}$, and $r_0\in\mathbb{R}_{\geq 0}$ is its radius. Without loss of generality, we consider that $p_0 = 0_{3\times 1}$, corresponding to an inertial frame $\{I\}$. Within $\mathcal{W}$ there exist $K$ disjoint spheres around points of interest, which are described by $\pi_k = \mathcal{B}_{p_k,r_k} = \{p\in\mathbb{R}^3 \text{ s.t. } \lVert p - p_k \rVert \leq r_k\}, k\in\mathcal{K}\coloneqq\{1,\dots,K\}$, where $p_k\in\mathbb{R}^3$ and $r_k\in\mathbb{R}_{>0}$ are the center and radius of the $k$th region, respectively. The regions of interest can be equivalently described by $\pi_k = \{z\in\mathbb{R}^4 \text{ s.t. } z^\top T_{\pi_k}z \leq 0 \}$, where $z=[p^\top, 1]^\top$ is the vector of homogeneous coordinates of $p\in\mathbb{R}^3$, and \begin{equation} \label{eq:region matrix} T_{\pi_k} = \begin{bmatrix} I_3 & p_{k} \\ 0^\top_{3\times 1} & -r^2_k \end{bmatrix}, \forall k\in\mathcal{K}. \end{equation} The dynamic model of each agent is given by the second-order Lagrangian dynamics: \begin{equation} M_i(q_i)\ddot{q}_i + N_i(q_i,\dot{q}_i)\dot{q}_i + g_i(q_i) + f_i(q_i, \dot{q}_i) = \tau_i, \label{eq:dynamics} \end{equation} $\forall i\in\mathcal{V}$, where $q_i\in\mathbb{R}^{n_i}$ is the vector of generalized coordinates (e.g., pose of mobile base and joint coordinates of the arms), $M_i:\mathbb{R}^{n_i}\to\mathbb{R}^{n_i\times n_i}$ is the positive definite inertia matrix, $N_i:\mathbb{R}^{n_i}\times\mathbb{R}^{n_i}\to\mathbb{R}^{n_i\times n_i}$ is the Coriolis matrix, $g_i:\mathbb{R}^{n_i}\to\mathbb{R}^{n_i}$ is the gravity vector, $f_i:\mathbb{R}^{n_i}\times\mathbb{R}^{n_i}\to\mathbb{R}^{n_i}$ is a term representing friction and modeling uncertainties and $\tau_i\in\mathbb{R}^{n_i}$ is the vector of joint torques, representing the control inputs. Without loss of generality, we assume that $n_i = n\in\mathbb{N},\forall i\in\mathcal{V}$. In addition, we denote as $\{B_i\}$ the frame of the mobile base of agent $i$ and $p_{\scriptscriptstyle B_i}:\mathbb{R}^{n}\to\mathbb{R}^3$ its inertial position. Moreover, the matrix $\dot{M}_i - 2N_i$ is skew-symmetric \cite{siciliano2008springer}, and we further make the following assumption: \begin{assumption} \label{ass:f} There exist positive constants $c_i$ such that $\lVert f_i(q_i,\dot{q}_i)\rVert\leq c_i\lVert q_i \rVert \lVert \dot{q}_i \rVert, \forall (q_i,\dot{q}_i)\in\mathbb{R}^{n}\times\mathbb{R}^{n}, i\in\mathcal{V}$. \end{assumption} We consider that each agent is composed by $\ell_i$ rigid links (see Fig. \ref{fig:Agent}) with $\mathcal{Q}_i = \{1,\dots,\ell_i\}$ the corresponding index set. Each link of agent $i$ is approximated by the ellipsoid set \cite{choi2009continuous} $\mathcal{E}_{i_m}(q_i) = \{z\in\mathbb{R}^4 \text{ s.t. } z^\top E_{i_m}(q_i)z \leq 0\}$; $z=[p^\top, 1]^\top$ is the homogeneous coordinates of $p\in\mathbb{R}^3$, and $E_{i_m}:\mathbb{R}^n\to\mathbb{R}^{4\times4}$ is defined as $E_{i_m}(q_i) = T^{-T}_{i_m}(q_i)\hat{E}_{i_m}T^{-1}_{i_m}(q_i)$, where $\hat{E}_{i_m} = \text{diag}\{a^{-2}_{i_m},b^{-2}_{i_m},c^{-2}_{i_m},-1\}$ corresponds to the positive lengths $a_{i_m},b_{i_m},c_{i_m}$ of the principal axes of the ellipsoid, and $T_{i_m}:\mathbb{R}^n\to\mathbb{R}^{4\times4}$ is the transformation matrix for the coordinate frame $\{i_m\}$ placed at the center of mass of the $m$-th link of agent $i$, aligned with the principal axes of $\mathcal{E}_{i_m}$: \begin{equation} T_{i_m}(q_i) = \begin{bmatrix} R_{i_m}(q_i) & p_{i_m}(q_i) \\ 0^\top_{3\times 1} & 1 \end{bmatrix}, \notag \end{equation} with $R_{i_m}:\mathbb{R}^n\to\mathbb{R}^{3\times3}$ being the rotation matrix of the center of mass of the link, $\forall m\in\mathcal{Q}_i,i\in\mathcal{V}$. For an ellipsoid $\mathcal{E}_{i_m}, i\in\mathcal{V},m\in\mathcal{Q}_i$, we denote as $\mathcal{E}^{xy}_{i_m},\mathcal{E}^{xz}_{i_m}, \mathcal{E}^{yz}_{i_m}$ its projections on the planes $x$-$y$, $x$-$z$ and $y$-$z$, respectively, with corresponding matrix terms $E^{xy}_{i_m},E^{xz}_{i_m}, E^{yz}_{i_m}$. Note that the following holds for two different ellipsoids $\mathcal{E}_{i_m}$ and $\mathcal{E}_{j_l}$: \begin{align} \mathcal{E}_{i_m}(q_i)\cap\mathcal{E}_{j_l}(q_j) \neq \emptyset \ &\land \ \accentset{\circ}{\mathcal{E}}_{i_m}(q_i)\cap\accentset{\circ}{\mathcal{E}}_{j_l}(q_j) = \emptyset \Leftrightarrow \notag \\ \mathcal{E}^s_{i_m}(q_i)\cap\mathcal{E}^s_{j_l}(q_j) \neq \emptyset \ &\land \ \accentset{\circ}{\mathcal{E}}^s_{i_m}(q_i)\cap\accentset{\circ}{\mathcal{E}}^s_{j_l}(q_j) = \emptyset, \notag \end{align} $\forall s\in\{xy,xz,yz\}$, i.e., in order for $\mathcal{E}_{i_m}, \mathcal{E}_{j_l}$ to collide (touch externally), all their projections on the three planes must also collide. Therefore, a sufficient condition for $\mathcal{E}_{i_m}$ and $\mathcal{E}_{j_l}$ not to collide is $\mathcal{E}^s_{i_m}(q_i)\cap\mathcal{E}^s_{j_l}(q_j)=\emptyset$, for some $s\in\{xy,xz,yz\}$. In view of Proposition \ref{prop:ellipsoids}, that means that the characteristic equations $f^{s}_{i_m,j_l}(\lambda) \coloneqq \det(\lambda\mathcal{E}^s_{i_m}(q_i) - \mathcal{E}^s_{j_l}(q_j))=0$ must always have one positive real root and two negative distinct roots for at least one $s\in\{xy,xz,yz\}$. Hence, be denoting the discriminant of $f^{s}_{i_m,j_l}(\lambda) = 0$ as $\Delta^s_{i_m,j_l}$, Proposition \ref{prop:cubic} suggests that $\Delta^s_{i_m,j_l}$ must remain always positive for at least one $s\in\{xy,xz,yz\}$, since a collision would imply $\Delta^s_{i_m,j_l}=0$, $\forall s\in\{xy,xz,yz\}$. Therefore, by defining the function $\delta:\mathbb{R}\to\mathbb{R}_{\geq 0}$ as: \begin{equation} \label{eq:delta} \delta(x) = \begin{cases} \phi_\delta(x), & x > 0, \\ 0, & x \leq 0, \end{cases} \end{equation} where $\phi_\delta$ is an appropriate polynomial that ensures that $\delta(x)$ is twice continuously differentiable everywhere (e.g. $\phi_\delta(x)=x^3$), we can conclude that a sufficient condition for $\mathcal{E}_{i_m}$ and $\mathcal{E}_{j_l}$ not to collide is $\delta(\Delta^{xy}_{i_m,j_l}) + \delta(\Delta^{xz}_{i_m,j_l}) + \delta(\Delta^{yz}_{i_m,j_l}) > 0$, since a collision would result in $\Delta^s_{i_m,j_l} = 0 \Leftrightarrow \delta(\Delta^s_{i_m,j_l}) = 0, \forall s\in\{xy,xz,yz\}$. Next, we define the constant $\bar{d}_{\scriptscriptstyle B_i}$, which is the maximum distance of the base to a point in the agent's volume over all possible configurations, i.e. $\bar{d}_{\scriptscriptstyle B_i} = \sup_{q_i\in\mathbb{R}^n}\{ \lVert p_{\scriptscriptstyle B_i}(q_i) - p_i(q_i) \rVert \}, p_i\in\bigcup_{m\in\mathcal{Q}_i} \mathcal{E}_{i_m}(q_i)$. We also denote $\bar{d}_{\scriptscriptstyle B} = [\bar{d}_{\scriptscriptstyle B_1},\dots,\bar{d}_{\scriptscriptstyle B_N}]^\top\in\mathbb{R}_{\geq 0}^N$. Moreover, we consider that each agent has a sensor located at the center of its mobile base $p_{\scriptscriptstyle B_i}$ with a sensing radius $d_{\text{con}_i} \geq 2\max_{i\in\mathcal{V}}\{ \bar{d}_{\scriptscriptstyle B_i} \} + \varepsilon_d$, where $\varepsilon_d$ is an arbitrarily small positive constant. Hence, each agent has the sensing sphere $\mathcal{D}_i(q_i)=\{p\in\mathbb{R}^3 \text{ s.t. } \lVert p - p_{\scriptscriptstyle B_i}(q_i) \rVert \leq d_{\text{con}_i} \}$ and its neighborhood set at each time instant is defined as $\mathcal{N}_i(q_i) = \{j\in\mathcal{V}\backslash\{i\} \text{ s.t. } \lVert p_{\scriptscriptstyle B_i}(q_i) - p_{\scriptscriptstyle B_j}(q_j)\rVert \leq d_{\text{con}_i} \}$. As mentioned in Section \ref{sec:intro}, we are interested in defining transition systems for the motion of the agents in the workspace in order to be able to assign complex high level goals through logic formulas. Moreover, since many applications necessitate the cooperation of the agents in order to execute some task (e.g. transport an object), we consider that a nonempty subset $\widetilde{\mathcal{N}}_i \subseteq \mathcal{N}_i(q_i(0)), i\in\mathcal{V}$, of the initial neighbors of the agents must stay connected through their motion in the workspace. In addition, it follows that the transition system of each agent must contain information regarding the current position of its neighbors. The problem in hand is equivalent to designing decentralized control laws $\tau_i,i\in\mathcal{V}$, for the appropriate transitions of the agents among the predefined regions of interest in the workspace. Next, we provide the following necessary definitions. \begin{definition} \label{def:in region} An agent $i\in\mathcal{V}$ is in region $k \in\mathcal{K}$ at a configuration $q_i\in\mathbb{R}^n$, denoted as $\mathcal{A}_i(q_i)\in\pi_k$, if and only if $\lVert p_{i_m}(q_i) - p_k \rVert \leq r_k - \max\{\alpha_{i_m},\beta_{i_m},c_{i_m}\},\forall m\in\mathcal{Q}_i \Rightarrow \lVert p_{\scriptscriptstyle B_i}(q_i) - p_k \rVert \leq r_k - \bar{d}_{\scriptscriptstyle B_i}$. \end{definition} \begin{definition} Agents $i,j\in\mathcal{V}$, with $i\neq j$, are in \textit{collision-free} configurations $q_i,q_j\in\mathbb{R}^n$, denoted as $\mathcal{A}_i(q_i)\not \equiv\mathcal{A}_j(q_j)$, if and only if $\mathcal{E}_{i_m}(q_i)\cap\mathcal{E}_{j_l}(q_j)=\emptyset, \forall m\in\mathcal{Q}_i,l\in\mathcal{Q}_j$. \end{definition} Given the aforementioned discussion, we make the following assumptions regarding the agents and the validity of the workspace: \begin{assumption} \label{ass:validity} The regions of interest are \begin{enumerate}[(i)] \item large enough such that all the robots can fit, i.e., given a specific $k\in\mathcal{K}$, there exist $q_i, i\in\mathcal{V}$, such that $\mathcal{A}_i(q_i)\in\pi_k$, $\forall i\in\mathcal{V}$, with $\mathcal{A}_i(q_i)\not\equiv\mathcal{A}_j(q_j)$, $\forall i,j\in\mathcal{V}$, with $i\neq j$. \item sufficiently far from each other and the obstacle workspace, i.e., \begin{align*} & \lVert p_k - p_{k'} \rVert \geq \max\limits_{i\in\mathcal{V}}\{ 2\bar{d}_{\scriptscriptstyle B_i}\} + r_{k} + r_{k'} + \varepsilon_{p}, \notag \\ & r_0 - \| p_k \| \geq \max\limits_{i\in\mathcal{V}}\{ 2\bar{d}_{\scriptscriptstyle B_i}\}, \end{align*} $\forall k,k'\in\mathcal{K}, k\neq k'$, where $\varepsilon_p$ is an arbitrarily small positive constant. \end{enumerate} \end{assumption} Next, in order to proceed, we need the following definition. \begin{definition}\label{def:agent transition} Assume that $\mathcal{A}_i(q_i(t_0))\in\pi_k, i\in\mathcal{V}$, for some $t_0\in\mathbb{R}_{\geq 0},k\in\mathcal{K}$, with $\mathcal{A}_i(q_i(t_0))\not \equiv\mathcal{A}_j(q_j(t_0)), \forall j\in\mathcal{V}\backslash\{i\}$. There exists a transition for agent $i$ between $\pi_k$ and $\pi_{k'}, k'\in\mathcal{K}$, denoted as $(\pi_k,t_0)\xrightarrow{i}(\pi_{k'},t_f)$, if and only if there exists a finite time $t_f\geq t_0$, such that $\mathcal{A}_i(q_i(t_f))\in\pi_{k'}$ and $\mathcal{A}_i(q_i(t))\not \equiv\mathcal{A}_j(q_j(t))$, $\mathcal{E}_{i_m}(q_i(t))\cap\mathcal{E}_{i_\ell}(q_i(t))$, $\mathcal{E}_{i_m}(q_i(t))\cap\pi_{z} = \emptyset,\forall m,\ell\in\mathcal{Q}_i, m\neq \ell, j\in\mathcal{V}\backslash\{i\},z\in\mathcal{K}\backslash\{k,k'\}, t\in[t_0,t_f]$. \end{definition} Given the aforementioned definitions, the treated problem is the design of decentralized control laws for the transitions of the agents between two regions of interest in the workspace, while preventing collisions of the agents with each other, the workspace boundary, and the remaining regions of interest. More specifically, we aim to design a finite transition system for each agent of the form \cite{baier2008principles} \begin{equation} \mathcal{T}_i = (\Pi, \Pi_{i,0}, \xrightarrow{i}, \mathcal{AP}_i, \mathcal{L}_i, \mathcal{F}_i), \label{eq:TS} \end{equation} where $\Pi = \{\pi_1,\dots,\pi_K\}$ is the set of regions of interest that the agents can be at, according to Def. \ref{def:in region}, $\Pi_{i,0}\subseteq \Pi$ is a set of initial regions that each agent can start from, $\xrightarrow{i}\subset(\Pi\times\mathbb{R}_{\geq 0})^2$ is the transition relation of Def. \ref{def:agent transition}, $\mathcal{AP}_i$ is a set of given atomic propositions, represented as boolean variables, that hold in the regions of interest, $\mathcal{L}_i:\Pi\to2^{\mathcal{AP}_i}$ is a labeling function, and $\mathcal{F}_i:\Pi\to\Pi^{\lvert \widetilde{\mathcal{N}}_i \rvert}$ is a function that maps the region that agent $i$ occupies to the regions the initial neighbors $\widetilde{\mathcal{N}}_i$ of agent $i$ are at. Therefore, the treated problem is the design of bounded controllers $\tau_i$ for the establishment of the transitions $\xrightarrow{i}$. Moreover, as discussed before, the control protocol should also guarantee the connectivity maintenance of a subset of the initial neighbors $\widetilde{\mathcal{N} }_i,\forall i\in\mathcal{V}$. Another desired property important in applications involving robotic manipulators, is the nonsingularity of the Jacobian matrix $J_i:\mathbb{R}^n\to\mathbb{R}^{6\times n}$, that transforms the generalized coordinate rates of agent $i\in\mathcal{V}$ to generalized velocities \cite{siciliano2008springer}. That is, the set $\mathbb{S}_i = \{q_i\in\mathbb{R}^{n} \text{ s.t. } \det(J_i(q_i)[J_i(q_i)]^\top) = 0 \}$ should be avoided, $\forall i\in\mathcal{V}$. Formally, we define the problem treated in this paper as follows: \begin{problem} \label{Problem} Consider $N$ mobile manipulators with dynamics \eqref{eq:dynamics} and $K$ regions of interest $\pi_k,k\in\mathcal{K}$, with $\dot{q}_i(t_0) < \infty, A_i(q_i(t_0))\in \pi_{k_i}, k_i\in\mathcal{K}, \forall i\in\mathcal{V}$ and $\mathcal{A}_i(q_i(t_0))\not\equiv\mathcal{A}_j(q_j(t_0)), \mathcal{E}_{i_m}(q_i(t_0))\cap\mathcal{E}_{i_\ell}(q_i(t_0)) =\emptyset, \forall i,j \in\mathcal{V},i\neq j, m,\ell\in\mathcal{Q}_i,m\neq\ell$. Given nonempty subsets of the initial edge sets $\widetilde{\mathcal{N}}_{i}\subseteq\mathcal{N}_i(q_i(0))\subseteq\mathcal{V}, \forall i\in\mathcal{V}$, the fact that $\det(J_i(q_i(t_0))[J_i(q_i(t_0))]^\top) \neq 0, \forall i\in\mathcal{V}$, as well as the indices $k'_{i}\in\mathcal{K},i\in\mathcal{V}$, such that $\lVert p_{k'_i} - p_{k'_j}\rVert + r_{k'_i} + r_{k'_j} \leq d_{\text{con}_i}, \forall j\in\widetilde{\mathcal{N}}_i,i\in\mathcal{V}$, design decentralized controllers $\tau_i$ such that, for all $i\in\mathcal{V}$: \begin{enumerate} \item $(\pi_{k_i},t_0) \xrightarrow{i} (\pi_{k'_i},t_{f_i})$, for some $t_{f_i}\geq t_0$, \item $r_0 - (\lVert p_{\scriptscriptstyle B_i}(t) \rVert + \bar{d}_{\scriptscriptstyle B_i}) > 0,\forall t\in [t_0,t_{f_i}]$, \item $j_i^*\in{\mathcal{N}}_i(q_i(t)), \forall j_i^*\in\widetilde{\mathcal{N}}_i, t\in [t_0,t_{f_i}]$, \item $q_i(t)\in\mathbb{R}^n\backslash\mathbb{S}_i, \forall t\in [t_0,t_{f_i}]$. \end{enumerate} \end{problem} The aforementioned specifications concern 1) the agent transitions according to Def. \ref{def:agent transition}, 2) the confinement of the agents in $\mathcal{W}$, 3) the connectivity maintenance between a subset of initially connected agents and 4) the agent singularity avoidance. Moreover, the fact that the initial edge sets $\widetilde{\mathcal{N}}_i$ are nonempty implies that the sensing radius of each agent $i$ covers the regions $\pi_{k_j}$ of the agents in the neighboring set $\widetilde{\mathcal{N}}_i$. Similarly, the condition $\lVert p_{k'_i} - p_{k'_j}\rVert + r_{k'_i} + r_{k'_j} \leq d_{\text{con}_i}, \forall j\in\widetilde{\mathcal{N}}_i$, is a feasibility condition for the goal regions, since otherwise it would be impossible for two initially connected agents to stay connected. Intuitively, the sensing radii $d_{\text{con}_i}$ should be large enough to allow transitions of the multi-agent system to the entire workspace. \section{MAIN RESULTS} \label{sec:main results} \subsection{Continuous Control Design} \label{subsec:Continuous design} To solve Problem \ref{Problem}, we denote as $\varphi_i:\mathbb{R}^{Nn}\to\mathbb{R}_{\geq 0}$ a \emph{decentralized potential function}, with the following properties: \begin{enumerate}[(i)] \item The function $\varphi_i(q)$ is not defined, i.e., $\varphi_i(q) = \infty$, $\forall i\in\mathcal{V}$, when a collision or a connectivity break occurs, \item The critical points of $\varphi_i$ where the vector field $\nabla_{q_i}\varphi_i(q)$ vanishes, i.e., the points where $\nabla_{q_i}\varphi_i(q) = 0$, consist of the goal configurations and a set of configurations whose region of attraction (by following the negated vector field curves) is a set of measure zero. \item It holds that $\nabla_{q_i}\varphi_i(q) + \sum_{j\in\mathcal{N}_i(q_i)}\nabla_{q_i}\varphi_j(q) = 0$ $\Leftrightarrow$ $\nabla_{q_i}\varphi_i(q) = 0$ and $\sum_{j\in\mathcal{N}_i(q_i)}\nabla_{q_i}\varphi_j(q) = 0$, $\forall i\in\mathcal{N},q\in \mathbb{R}^{Nn} $. \end{enumerate} More specifically, $\varphi_i(q)$ is a function of two main terms, a \emph{goal function} $\gamma_i:\mathbb{R}^{n}\to\mathbb{R}_{\geq 0}$, that should vanish when $\mathcal{A}_i(q_i)\in\pi_{k'_i}$, and an \emph{obstacle function}, $\beta_i:\mathbb{R}^{n}\to\mathbb{R}_{\geq 0}$ is a bounded that encodes inter-agent collisions, collisions between the agents and the obstacle boundary/undesired regions of interest, connectivity losses between initially connected agents and singularities of the Jacobian matrix $J_i(q_i)$; $\beta_i$ vanishes when one or more of the above situation occurs. Next, we provide an analytic construction of the goal and obstacle terms. However, the construction of the function $\varphi_i$ is out of the scope of this paper. Examples can be found in \cite{dimarogonas2007decentralized}\footnote{In that case, we could choose $\varphi_i = \tfrac{1}{1-\phi_i}$, where $\phi_i$ is the proposed function of \cite{dimarogonas2007decentralized}} and \cite{panagou2017distributed}. \subsubsection{$\gamma_i$ - Goal Function} Function $\gamma_i$ encodes the control objective of agent $i$, i.e., reach the region of interest $\pi_{k'_i}$. Hence, we define $\gamma_i:\mathbb{R}^n\to\mathbb{R}_{\geq 0}$ as \begin{equation} \label{eq:gamma_i} \gamma_i(q_i) = \lVert q_i - q_{k'_i} \rVert^2, \end{equation} where $q_{k'_i}$ is a configuration such that $r_{k'} - \|p_{\scriptscriptstyle B_i}(q_{k'_i}) - p_{k'_i} \| \leq \bar{d}_{\scriptscriptstyle B_i} - \varepsilon$, for an arbitrarily small positive constant $\varepsilon$, which implies $\mathcal{A}_i(q_{k'_i})\in \pi_{k'_i}$, $\forall i\in\mathcal{V}$. In case that multiple agents have the same target, i.e., there exists at least one $j\in\mathcal{V}\backslash\{i\}$ such that $\pi_{k'_j} = \pi_{k'_i}$, then we assume that $\mathcal{A}_i(q_{k'_i})\not\equiv \mathcal{A}_j(q_{k'_j})$. \begin{comment} \begin{equation} \label{eq:gamma_i} \gamma_i(\eta_i) = \left\{ \begin{matrix} \eta_i, & \eta_i > (r_{k'_i} - \bar{d}_{\scriptscriptstyle B_i})^2\\ \phi_{i}(\eta_i), & (r_{k'_i} - \bar{d}_{\scriptscriptstyle B_i})^2 \geq \eta_i \geq 0 \end{matrix} \right. \end{equation} where $\eta_i:\mathbb{R}^n\to\mathbb{R}_{\geq 0}$, with $\eta_i(q_i) = \lVert p_{\scriptscriptstyle B_i} - p_{k'_i} \rVert^2$, denotes the distance of agent $i$'s base to the center of $\pi_{k'_i}$. Note that the condition $\eta_i < (r_{k'_i} - \bar{d}_{\scriptscriptstyle B_i})^2$ is equivalent to $\mathcal{A}_i(q_i)\in\pi_{k'_i}$. The term $\phi_i(\eta_i)$ is an appropriate polynomial that has its global minimum when $\eta_i = c^2_i$ and guarantees that $\gamma_i$ is non-negative and twice continuously differentiable everywhere. The constant $c_i$ is chosen such that $(r_{k'_i} - \bar{d}_{\scriptscriptstyle B_i})^2 > c^2_i > \bar{d}^2_{\scriptscriptstyle B_i}$, in order to ensure that, when the global minimum of $\gamma_i$ is reached (i.e. $\lVert p_{\scriptscriptstyle B_i} - p_{k'_i} \rVert = c_i$), the bounding sphere of radius $\bar{d}_{\scriptscriptstyle B_i}$ of agent $i$ will not contain the center $p_{k'_i}$ or region $\pi_{k'_i}$, i.e. $p_{k'_i}\notin\bigcup_{m\in\mathcal{Q}_i}\mathcal{E}_{i_m}(q_i), \forall q_i\in\{q_i\in\mathbb{R}^n \text{ s.t. } \gamma_i(\eta_i(q_i))=0 \}$, where $\bigcup_{m\in\mathcal{Q}_i}\mathcal{E}_{i_m}(q_i)\subseteq \{p\in\mathbb{R}^3 \text{ s.t. } \lVert p - p_{\scriptscriptstyle B_i} \rVert = \bar{d}_{\scriptscriptstyle B_i}, \lVert p_{\scriptscriptstyle B_i} - p_{k'_i} \rVert = c_i \}$ (see Figs. \ref{fig:gamma_i} and \ref{fig:region example}). In that way, by designing $\gamma_i$ such that it is minimized in a circle around the center of $\pi_{k'_i}$, we facilitate cases where more than one agents have the same goal region. In these cases, the goal functions $\gamma_i$ of the agents that have the same goal region will be minimized in different positions in the workspace, through the obstacle functions that are introduced next. Note also that Assumption \ref{ass:validity} ensures that a choice of $c_i$ such that $(r_{k'_i} - \bar{d}_{\scriptscriptstyle B_i})^2 > c^2_i > \bar{d}^2_{\scriptscriptstyle B_i}$ is feasible. \begin{figure}[ht] \centering \begin{tikzpicture}[scale = 0.4] \draw[->, line width = 1.0] (-0.5,0) -- (14,0) node[right] {$\eta_i$}; \draw[->, line width = 1.0] (0,-0.5) -- (0,14) node[above] {$\gamma_i(\eta_i)$}; \draw[scale=1,domain=12:14,smooth,variable=\x,blue, line width = 1.2] plot ({\x}, {\x-0.15}); \draw[scale=1,domain=0:12.5,smooth,variable=\x,red, line width = 1.2] plot ({\x}, {0.002492848800076*\x*\x*\x*\x -0.095300243682374*\x*\x*\x +1.257785216958420*\x*\x-5.242832392734686*\x +6.779616052196173 }); \node at (12.45, 0.0) {$\bullet$}; \node at (12.45, 12.25) {$\bullet$}; \node at (12.45,-0.6) {$ (r_{k'_i}-\bar{d}_{\scriptscriptstyle B_i})^2$}; \node at (3.0, 0.0) {$\bullet$}; \node at (3.0, -0.5) {$c^2_i$}; \node at (2.25, 0.0) {$\bullet$}; \node at (2.25, -0.6) {$\bar{d}^2_{\scriptscriptstyle B_i}$}; \node at (0.0, 0.0) {$\bullet$}; \node at (-0.8, -0.5) {$(0,0)$}; \node at (0, 12.25) {$\bullet$}; \draw [dashed] (0,12.25) -- (12.45,12.25); \draw [dashed] (12.45,0) -- (12.45,12.25); \end{tikzpicture} \caption{An example of the function $\gamma_i$ for $r_{k'_i} = 5, \bar{d}_{\scriptscriptstyle B_i}=1.5, c_i = \sqrt{3}$.} \label{fig:gamma_i} \end{figure} \begin{figure}[ht] \centering \begin{tikzpicture}[scale = 0.5] \draw [color = black,] (-5,0) circle (5cm); \node at (-5,0) {$\bullet$}; \node at (-5,0.5) {$p_{k'_i}$}; \draw [color=black,dashed,<->,>=stealth'](-5, 0.0) to (0, 0); \node at (-2.5, 0.3) {$r_{k'_i}$}; \draw [color = black, fill = black!5] (-5, -3.5) circle (1.5cm); \node at (-5, -3.5) {$\bullet$}; \node at (-5.25, -3.7) {$p_{\scriptscriptstyle B_i}$}; \draw [color=black,dashed,<->,>=stealth'](-5, -3.5) to (-3.5, -3.5); \node at (-4, -4.1) {$\bar{d}_{\scriptscriptstyle B_i}$}; \draw [color = black,dashed] (-5, -1.7321) circle (1.5cm);\ \draw [color = red,dashed] (-5, 0) circle (1.7321cm); \node at (-5, -1.7321) {$\bullet$}; \draw [color=black,dashed,-,>=stealth'](-5, -1.7321) to (-8, -1.7321); \draw [color=black,dashed,-,>=stealth'](-5, 0) to (-8, 0); \draw [color=black,<->,>=stealth'](-8, 0) to (-8, -1.7321); \node at (-8.7, -1) {$\sqrt{c_i}$}; \draw [color=black,dashed,-,>=stealth'](-5, -3.5) to (-2, -3.5); \draw [color=black,<->,>=stealth'](-2, -3.5) to (-2, 0); \node at (-0.45, -1) {$r_{k'_i} - \bar{d}_{\scriptscriptstyle B_i}$}; \end{tikzpicture} \caption{An example of an agent $i$, with bounding sphere of radius $\bar{d}_{\scriptscriptstyle B_i} = 1.5$, entering region $\pi_{k'_i}$ of radius $r_{k'_i} = 5$; $\gamma_i$ is minimized when $\eta_i = \lVert p_{\scriptscriptstyle B_i} - p_{k'_i} \rVert^2 = c^2_i = 3$ with $(r_{k'_i}-\bar{d}_{\scriptscriptstyle B_i})^2 > c^2_i > \bar{d}^2_{\scriptscriptstyle B_i}$, so that the bounding sphere of the agent does not contain the center $p_{k'_i}$. The dashed black circle denotes the agent when $\eta_i=c^2_i$ whereas the dashed red circle denotes all the possible configuration of $p_{k'_i}$ such that $\eta_i=c^2_i$.} \label{fig:region example} \end{figure} \end{comment} \subsubsection{$\beta_i$ - Collision/Connectivity/Singularity Function} \label{sec:beta_gamma_definitions} The function $\beta_i$ encodes all inter-agent collisions, collisions with the boundary of the workspace and the undesired regions of interest, connectivity between initially connected agents and singularities of the Jacobian matrix $J_i(q_i),\forall i\in\mathcal{V}$. Consider the function $\Delta_{i_m,j_l}:\mathbb{R}^{2n}\to\mathbb{R}_{\geq 0}$, with $\Delta_{i_m,j_l}(q_i,q_j) = \delta(\Delta^{xy}_{i_m,j_l}(q_i,q_j)) + \delta(\Delta^{xz}_{i_m,j_l}(q_i,q_j)) + \delta(\Delta^{yz}_{i_m,j_l}(q_i,q_j))$, where $\Delta^s_{i_m,j_l}:\mathbb{R}^{2n}\to\mathbb{R}_{\geq 0}$ is the discriminant of the cubic equation $\det\{\lambda E^s_{i_m}(q_i) - E^s_{j_l}(q_j)\}=0, \forall s\in\{xy,xz,yz\}$, for two given ellipsoids $\mathcal{E}_{i_m}$ and $\mathcal{E}_{j_l}, m\in\mathcal{Q}_i,l\in\mathcal{Q}_j,i,j,\in\mathcal{V}$, and $\delta$ as defined in \eqref{eq:delta}. As discussed in Section \ref{sec:PF}, a sufficient condition for the ellipsoids $\mathcal{E}_{i_m}$ and $\mathcal{E}_{j_l}$ not to collide, is $\Delta_{i_m,j_l}(q_i(t),q_j(t)) > 0, \forall t\in\mathbb{R}_{\geq 0}$. Additionally, we define the greatest lower bound of the $\Delta_{i_m,j_l}$ when the point $p_{j_l}$ is on the boundary of the sensing radius $\partial D_i(q_i)$ of agent $i$, as $\widetilde{{\Delta}}_{i_m,j_l} = \inf_{(q_i,q_j)\in\mathbb{R}^{2n}}\{\Delta_{i_m,j_l}(q_i,q_j)\} \text{ s.t. } \lVert p_{\scriptscriptstyle B_i}(q_i) - p_{j_l}(q_j) \rVert = d_{\text{con}_i}, \forall m\in\mathcal{Q}_i,l\in\mathcal{Q}_j,i,j\in\mathcal{V}$. Since $d_{\text{con}_i} > 2\max_{i\in\mathcal{V}}\{\bar{d}_{\scriptscriptstyle B_i}\} + \varepsilon_d$, it follows that there exists a positive constant $\varepsilon_\Delta$ such that $\widetilde{\Delta}_{i_m,j_l} \geq \varepsilon_\Delta > 0,\forall m\in\mathcal{Q}_i,l\in\mathcal{Q}_j,i,j\in\mathcal{V}, i\neq j$. Moreover, we define the function $\Delta_{i_m,\pi_k}:\mathbb{R}^n\to\mathbb{R}_{\geq 0}$, with $\Delta_{i_m,\pi_k}(q_i) = \delta(\Delta^{xy}_{i_m,\pi_k}(q_i))+\delta(\Delta^{xz}_{i_m,\pi_k}(q_i))+\delta(\Delta^{yz}_{i_m,\pi_k}(q_i))$, where $\Delta^s_{i_m,\pi_k}:\mathbb{R}^n\to\mathbb{R}$ is the discriminant of the cubic equation $\det(\lambda E^s_{i_m}(q_i) - T^s_{\pi_k})$, with $T^s_{\pi_k}$ the projected version of $T_{\pi_k}$ in \eqref{eq:region matrix}, $s\in\{xy,xz,yz\}$, and $\delta$ as given in \eqref{eq:delta}. A sufficient condition for $\mathcal{E}_{i_m}$ and region $\pi_k, k\in\mathcal{K}$ not to collide is $\Delta_{i_m,\pi_k}(q_i(t))>0, \forall t\in\mathbb{R}_{\geq 0}, m\in\mathcal{Q}_i,i\in\mathcal{V}$. We further define the function $\eta_{ij,c}:\mathbb{R}^{n}\times\mathbb{R}^{n}\to\mathbb{R}$, with $\eta_{ij,c}(q_i,q_j) = d^2_{\text{con}_i}-\lVert p_{\scriptscriptstyle B_i}(q_i) - p_{\scriptscriptstyle B_j}(q_j)\rVert^2$, and the distance functions $\beta_{i_m,j_l}:\mathbb{R}_{\geq 0}\to\mathbb{R}_{\geq 0}, \beta_{ij,c}:\mathbb{R}\to\mathbb{R}_{\geq 0}, \beta_{iw}:\mathbb{R}_{\geq 0}\to\mathbb{R}$ as \begin{align} \beta_{i_m,j_l}(\Delta_{i_m,j_l}) &= \begin{cases} \phi_{i,a}(\Delta_{i_m,j_l}), & 0 \leq \Delta_{i_m,j_l} < \bar{\Delta}_{i_m,j_l}, \\ \bar{\Delta}_{i_m,j_l}, & \bar{\Delta}_{i_m,j_l} \leq \Delta_{i_m,j_l}, \\ \end{cases} \notag \\ \beta_{ij,c}(\eta_{ij,c}) &= \begin{cases} 0, & \eta_{ij,c} < 0,\\ \phi_{i,c}(\eta_{ij,c}), & 0 \le \eta_{ij,c} < d^2_{\text{con}_i}, \\ d^2_{\text{con}_i}, & d^2_{\text{con}_i} \le \eta_{ij,c}, \end{cases} \notag \\%\label{eq:beta_c}\\ \beta_{iw}(\lVert p_{\scriptscriptstyle B_i} \rVert^2) &= (r_w - \bar{d}_{\scriptscriptstyle B_i})^2 - \lVert p_{\scriptscriptstyle B_i} \rVert^2, \notag \end{align} where $\bar{\Delta}_{i_m,j_l}$ is a constant satisfying $0 < \bar{\Delta}_{i_m,j_l} \leq \widetilde{\Delta}_{i_m,j_l}, \forall m\in\mathcal{Q}_i,l\in\mathcal{Q}_j,i,j\in\mathcal{V},i\neq j$, and $\phi_{i,a}, \phi_{i,c}$ are \textit{strictly increasing} polynomials appropriately selected to guarantee that the functions $\beta_{i_m,j_l}$, and $\beta_{ij,c}$, respectively, are twice continuously differentiable everywhere, with $\phi_{i,a}(0) = \phi_{i,c}(0) = 0, \forall i\in\mathcal{V}$. Note that the functions defined above use only local information in the sensing range $d_{\text{con}_i}$ of agent $i$. The function $\beta_{i_m,j_l}$ becomes zero when ellipsoid $\mathcal{E}_{i_m}$ collides with ellipsoid $\mathcal{E}_{j_l}$, whereas $\beta_{ij,c}$ becomes zero when agent $i$ loses connectivity with agent $j$. Similarly, $\beta_{iw}$ encodes the collision of agent $i$ with the workspace boundary. Finally, we choose the function $\beta_i:\mathbb{R}^{Nn}\to\mathbb{R}_{\geq 0}$ as \begin{align} \beta_i(q) =& (\det(J_i(q_i)[J_i(q_i)]^\top))^2\beta_{iw}(\lVert p_{\scriptscriptstyle B_i} \rVert^2)\prod\limits_{j\in\widetilde{\mathcal{N}}_i}\beta_{ij,c}(\eta_{ij,c}) \notag\\ &\prod\limits_{(m,j,l)\in\widetilde{T}}\beta_{i_m,j_l}(\Delta_{i_m,j_l})\prod\limits_{ (m,k)\in\widetilde{L}} \Delta_{i_m,\pi_k}(q_i), \label{eq:betas} \end{align} $\forall i\in\mathcal{V}$, where $\widetilde{T} = \mathcal{Q}_i\times\mathcal{V}\times\mathcal{Q}_j, \widetilde{L} = \mathcal{Q}_i\times(\mathcal{K}\backslash\{k_i,k'_i\})$, and we have omitted the dependence on $q$ for brevity. Note that we have included the term $(\det(J_iJ^\top_i))^2$ to also account for singularities of $J_i, \forall i\in\mathcal{V}$ and the term $\prod_{(m,j,l)\in\widetilde{T}}\beta_{i_m,j_l}(\Delta_{i_m,j_l})$ takes into account also the collisions between the ellipsoidal rigid bodies of agent $i$. With the introduced notation, the properties of the functions $\varphi_i$ are: \begin{enumerate}[(i)] \item $\beta_i(q)\to 0 \Leftrightarrow (\varphi_i(q) \to \infty), \forall i\in\mathcal{V}$, \item $ \nabla_{q_i}\varphi_i(q)|_{q_i=q^\star_i} = 0, \forall q^\star_i\in\mathbb{R}^n \text{ s.t. } \gamma_i(q^\star_i) = 0$ and the regions of attraction of the points $\{q \in\mathbb{R}^{Nn}: \nabla_{q_i}\varphi_i(q)|_{q_i=\widetilde{q}_i} = 0, \gamma_i(\widetilde{q}_i) \neq 0 \}, i\in\mathcal{V}$, are sets of measure zero. \end{enumerate} By further denoting $\mathbb{D}_i = \{q\in\mathbb{R}^{Nn}: \beta_i(q) > 0 \}$, we are ready to state the main theorem, that summarizes the main results of this work. \begin{theorem} Under the Assumptions \ref{ass:f}-\ref{ass:validity}, the decentralized control laws $\tau_i: \mathbb{D}_i\times\mathbb{R}^{n}\to \mathbb{R}^n$, with \begin{align} & \tau_i(q,\dot{q}_i) = g_i(q_i) - \nabla_{q_i}\varphi_i(q) - \sum\limits_{j\in\mathcal{N}_i(q_i)}\nabla_{q_i}\varphi_j(q) \notag \\ &\hspace{15mm} - \hat{c}_i(q_i,\dot{q}_i)\lVert q_i \rVert \dot{q}_i - \lambda_{i} \dot{q}_i, \label{eq:control law} \end{align} $\forall i\in\mathcal{V}$, along with the adaptation laws $\dot{\hat{c}}_i:\mathbb{R}^n\times\mathbb{R}^n\to\mathbb{R}$: \begin{equation} \dot{\hat{c}}_i(q_i,\dot{q}_i) = \sigma_i\lVert \dot{q}_i\rVert^2\lVert q_i\rVert, \label{eq:adaptation law} \end{equation} with $\hat{c}_i(q_i(t_0),\dot{q}_i(t_0)) < \infty,\sigma_i\in\mathbb{R}_{\geq 0}$ , $\forall i\in\mathcal{V}$, guarantee the transitions $(\pi_{k_i},t_0)\xrightarrow{i}(\pi_{k'_i},t_{f_i})$ for finite $t_{f_i},i\in\mathcal{V}$ for almost all initial conditions, while ensuring $\beta_i > 0,\forall i\in\mathcal{V}$, as well as the boundedness of all closed loop signals, providing, therefore, a solution to Problem \ref{Problem}. \end{theorem} \begin{proof} The closed loop system of \eqref{eq:dynamics} is written as: \small \begin{align} M_i(q_i)\ddot{q}_i + N_i(q_i,\dot{q}_i)\dot{q}_i + f_i(q_i,\dot{q}_i) = -\nabla_{q_i}\varphi_i(q_i) - \lambda_i\dot{q}_i \notag \\ - \hat{c}(q_i,\dot{q}_i)\lVert q_i \rVert\dot{q}_i - \sum\limits_{j\in\mathcal{N}_i(q_i)}\nabla_{q_i}\varphi_j(q), \label{eq:closed loop dynamics} \end{align} \normalsize $\forall i\in\mathcal{V}$. Due to Assumption \ref{ass:validity}, the domain where the functions $\varphi_i(q)$ are well-defined (i.e., where $\beta_i > 0$) is connected. Hence, consider the Lyapunov-like function $V:\mathbb{R}^{N}\times\mathbb{R}^{Nn}\times\mathbb{R}^N\times\mathbb{D}_1\times\dots\times\mathbb{D}_N\to\mathbb{R}_{\geq 0}$, with \begin{align} V(\varphi, \dot{q}, \widetilde{c},q) =& \sum\limits_{i\in\mathcal{V}} \varphi_i(q) + \frac{1}{2}[\dot{q}^\top_iM_i(q_i)\dot{q}_i + \frac{1}{\sigma_i}\widetilde{c}_i^2] \notag \end{align} where $\varphi$ and $\widetilde{c}$ are the stack vectors containing all $\varphi_i$ and $\widetilde{c}_i$, respectively, $i\in\mathcal{V}$, and $\widetilde{c}_i:\mathbb{R}^{n}\times\mathbb{R}^{n}\to\mathbb{R}$, with $\widetilde{c}_i(q_i,\dot{q}_i) = \hat{c}_i(q_i,\dot{q}_i) - c_i, \forall i\in\mathcal{V}$. Note that, since there are no collision or singularities at $t_0$, the functions $\beta_i(q), i\in\mathcal{V}$, are strictly positive at $t_0$ which implies the boundedness of $V$ at $t_0$. Therefore, since $\dot{q}_i(t_0)<\infty$ and $\hat{c}_i(t_0)<\infty, \forall i\in\mathcal{V}$, there exists a positive and finite constant $M<\infty$ such that $V_0\coloneqq V(\varphi(q(t_0)), \dot{q}(t_0), \tilde{c}(q(t_0),q(t_0)) \leq M$. By differentiating $V$, substituting the dynamics \eqref{eq:dynamics}, employing the skew symmetry of $\dot{M}_i - 2N_i$ as well as the property $\sum_{i\in\mathcal{V}} ( [\nabla_{q_i}\varphi_i(q)]^\top\dot{q}_i + \sum_{j\in\mathcal{N}_i(q_i)} [\nabla_{q_j}\varphi_i(q)]^\top\dot{q}_j ) = \sum_{i\in\mathcal{V}}( [\nabla_{q_i}\varphi_i(q) ]^\top + \sum_{j\in\mathcal{N}_i(q_i)} [\nabla_{q_i}\varphi_j(q)]^\top) \dot{q}_i$, we obtain \begin{align} \dot{V} =& \sum\limits_{i\in\mathcal{V}}\Bigg\{\dot{q}^\top_i \Bigg( \nabla_{q_i}\varphi_i(q) + \sum\limits_{j\in\mathcal{N}_i(q_i)} \nabla_{q_i}\varphi_j(q) + \tau_i - g_i(q_i)\Bigg) \notag \\ &-\dot{q}_i^\top f_i(q_i,\dot{q}_i) + \frac{1}{\sigma_i}\widetilde{c}_i\dot{\hat{c}}_i \Bigg\}, \end{align} which, by substituting the control and adaptation laws \eqref{eq:control law}, \eqref{eq:adaptation law} becomes: \begin{align} \dot{V} =& \sum\limits_{i\in\mathcal{V}}\{ -\lambda_i\lVert \dot{q}_i \rVert^2 - \hat{c}_i\lVert \dot{q}_i \rVert^2 \lVert q_i \rVert - \dot{q}_i^\top f_i(q_i,\dot{q}_i) \notag \\ & + \widetilde{c}_i\lVert \dot{q}_i \rVert^2 \lVert q_i \rVert \notag\\ \leq & \sum\limits_{i\in\mathcal{V}}\{ -\lambda_i\lVert \dot{q}_i \rVert^2 - (\hat{c}_i-c_i-\widetilde{c}_i)\lVert \dot{q}_i \rVert^2 \lVert q_i \rVert \end{align} where we have used the property $\lVert f_i(q_i,\dot{q}_i) \rVert \leq c_i\lVert q_i \rVert \lVert \dot{q}_i\rVert$. Since $\widetilde{c}_i = \hat{c}_i - c_i$, we obtain $\dot{V} \leq - \sum_{i\in\mathcal{V}}\lambda_i\lVert \dot{q}_i\rVert^2$, which implies that $V$ is non-increasing along the trajectories of the closed loop system. Hence, we conclude that $V(t)\leq V_0 \leq M$, as well as the boundedness of $\widetilde{c}_i, \varphi_i, \dot{q}_i$ and hence of $\hat{c}_i, \forall i\in\mathcal{V}, t\geq t_0$. Therefore, we conclude that $\beta_i(q(t)) > 0, \forall t\geq t_0, i\in\mathcal{V}$. Hence, inter-agent collisions, collision with the undesired regions and the obstacle boundary, connectivity losses between the subsets of the initially connected agents and singularity configurations are avoided. Moreover, by invoking LaSalle's Invariance Principle, the system converges to the largest invariant set contained in \begin{equation} S = \{(q,\dot{q})\in \mathbb{D}_1\times\dots\times\mathbb{D}_N\times\mathbb{R}^{Nn}\text{ s.t. } \dot{q} = 0_{Nn\times 1}\}. \label{eq:la salle0} \end{equation} For $S$ to be invariant, we require that $\ddot{q}_i = 0_{n\times 1}, \forall i\in\mathcal{V}$, and thus we conclude for the closed loop system \eqref{eq:closed loop dynamics} that $\nabla_{q_i}\varphi_i(q) = 0_{n\times 1}, \forall i\in\mathcal{V}$, since $\| f_i(q_i,0_{n\times1}) \| \leq 0, \forall q_i\in\mathbb{R}^{n}$, in view of Assumption \ref{ass:f}. Therefore, by invoking the properties of $\varphi_i(q)$, each agent $i\in\mathcal{V}$ will converge to a critical point of $\varphi_i$, i.e., all the configurations where $\nabla_{q_i}\varphi_i(q) = 0_{n\times1}, \forall i\in\mathcal{V}$. However, due to properties of $\varphi_i(q)$, the initial conditions that lead to configurations $\widetilde{q}_i$ such that $\nabla_{q_i}\varphi_i(q)|_{q_i=\widetilde{q}_i} = 0_{n\times1}$ and $\gamma_i(\widetilde{q}_i) \neq 0$ are sets of measure zero in the configuration space \cite{Koditchek92}. Hence, the agents will converge to the configurations where $\gamma_i(q_i) = 0$ from almost all initial conditions, i.e., $\lim\limits_{t\to\infty}\gamma_i(q_i(t)) = 0$. Therefore, since $r_{k'} - \|p_{\scriptscriptstyle B_i}(q_{k'_i}) - p_{k'_i} \| \leq \bar{d}_{\scriptscriptstyle B_i} - \varepsilon$, it can be concluded that there exists a finite time instance $t_{f_i}$ such that $\mathcal{A}_i(q_i(t_{f_i}))\in\pi_{k'}$, $\forall i\in\mathcal{V}$ and hence, each agent $i$ will be at its goal region $p_{k'_i}$ at time $t_{f_i}, \forall i\in\mathcal{V}$. In addition, the boundedness of $q_i,\dot{q}_i$ implies the boundedness of the adaptation laws $\dot{\hat{c}}_i, \forall i\in\mathcal{V}$. Hence, the control laws \eqref{eq:control law} are also bounded. \begin{figure*} \vspace{0.4cm} \begin{subfigure}[t]{0.32\textwidth} \includegraphics[scale = 0.31]{navigation_initial.eps} \caption{\label{fig:navigation initial}} \end{subfigure} \begin{subfigure}[t]{0.32\textwidth} \includegraphics[trim = -0.65cm 0 0 0,scale = 0.31]{navigation_final.eps} \caption{\label{fig:navigation final}} \end{subfigure} \begin{subfigure}[t]{0.32\textwidth} \includegraphics[scale = 0.31]{navigation_final2.eps} \caption{\label{fig:navigation final2}} \end{subfigure} (a): The initial position of the agents in the workspace of the simulation example. (b): The first transition of the agents in the workspace. Agent $1$ transits from $\pi_1$ to $\pi_2$, agent $2$ from $\pi_2$ to $\pi_1$, and agent $3$ from $\pi_{1}$ to $\pi_3$. (c): The second transition of the agents in the workspace. Agent $1$ transits from $\pi_2$ to $\pi_1$, agent $2$ from $\pi_1$ to $\pi_2$, and agent $3$ from $\pi_{3}$ to $\pi_2$. \end{figure*} \end{proof} \begin{remark} Note that the design of the obstacle functions \eqref{eq:betas} renders the control laws \eqref{eq:control law} decentralized, in the sense that each agent uses only local information with respect to its neighboring agents, according to its limited sensing radius. Each agent can obtain the necessary information to cancel the term $\sum_{j\in\mathcal{N}_i(q_i)} \nabla_{q_i}\varphi_j(q)$ from its neighboring agents. Finally, note that the considered dynamic model \eqref{eq:dynamics} applies for more general manipulation robots (e.g. underwater or aerial manipulators), without limiting the proposed methodology to mobile ones. \end{remark} \subsection{Hybrid Control Framework} \label{subsec:hybrid} Due to the proposed continuous control protocol of Section \ref{subsec:Continuous design}, the transitions $(\pi_{k_i},t_0)\xrightarrow{i}(\pi_{k'_i},t_{f_i})$ of Problem \ref{Problem} are well-defined, according to Def. \ref{def:agent transition}. Moreover, since all the agents $i\in\mathcal{V}$ remain connected with the subset of their initial neighbors $\widetilde{\mathcal{V}}_i$ and there exist finite constants $t_{f_i}$, such that $\mathcal{A}_i(q_i(t_{f_i}))\in\pi_{k'_i},\forall i\in\mathcal{V}$, all the agents are aware of their neighbors state, when a transition is performed. Hence, the transition system \eqref{eq:TS} is well defined, $\forall i\in\mathcal{V}$. Consider, therefore, that $\mathcal{A}_i(q_i(0))\in\pi_{k_{i,0}}, k_{i,0}\in\mathcal{K}, \forall i\in\mathcal{V}$, as well as a given desired path for each agent, that does not violate the connectivity condition of Problem \ref{Problem}. Then, the iterative application of the control protocol \eqref{eq:control law} for each transition of the desired path of agent $i$ guarantees the successful execution of the desired paths, with all the closed loop signals being bounded. \begin{remark} Note that, according to the aforementioned analysis, we implicitly assume that the agents start executing their respective transitions at the same time (we do not take into account individual control jumps in the Lyapunov analysis, i.e., it is valid only for one transition). Intuition suggests that if the regions of interest are sufficiently far from each other, then the agents will be able to perform the sequence of their transitions independently. Detailed technical analysis of such cases is part of our future goals. \end{remark} \section{SIMULATION RESULTS}\label{sec:simulations} To demonstrate the validity of the proposed methodology, we consider the simplified example of three agents in a workspace with $r_0 = 12$ and three regions of interest, with $r_k = 4, \forall k\in\{1,2,3\}$ m. Each agent consists of a mobile base and a rigid link connected with a rotational joint, with $\bar{d}_{\scriptscriptstyle B_i} = 1$m, $\forall i\in\{1,2,3\}$. We also choose $p_1 = [-5,-5]$m, $p_2 = [6,-4]$m, $p_3 = [-3,6]$m. The initial base positions are taken as $p_{\scriptscriptstyle B_1} = [-3,-4]^\top\text{m}, p_{\scriptscriptstyle B_2} = [3,-4]^\top\text{m}, p_{\scriptscriptstyle B_3} = [-4,-5]^\top\text{m}$ with $\bar{d}_{\scriptscriptstyle B_i} = 1.25\text{m}, \forall i\in\{1,2,3\}$, which imply that $\mathcal{A}_1(q_1(0)),\mathcal{A}_3(q_3(0))\in\pi_1$ and $\mathcal{A}_2(q_2(0))\in\pi_2$ (see Fig. \ref{fig:navigation initial}). The control inputs for the agents are the $2$D force acting on the mobile base, and the joint torque of the link. We also consider a sensing radius of $d_{\text{con}_i} = 8\text{m}$ and the subsets of initial neighbors as $\widetilde{\mathcal{N}}_1 = \{2\}, \widetilde{\mathcal{N}}_2 = \{1,3\}$, and $\widetilde{\mathcal{N}}_3 = \{2\}$, i.e., agent $1$ has to stay connected with agent $2$, agent $2$ has to stay connected with agents $1$ and $3$ and agent $3$ has to stay connected with agent $2$. The agents are required to perform two transitions. Regarding the first transition, we choose $\pi_{k'_1} = \pi_2$ for agent $1, \pi_{k'_2} = \pi_1$ for agent $2$, and $\pi_{k'_3} = \pi_3$, for agent $3$. Regarding the second transition, we choose $\pi_{k'_1} = \pi_1, \pi_{k'_2} = \pi_2$, and $\pi_{k'_3} = \pi_2$. The control parameters and gains where chosen as $k_i = 5, \lambda_i =10, \rho_i=1$, and $\sigma_i = 0.01, \forall i\in\{1,2,3\}$. We employed the potential field from \cite{dimarogonas2007decentralized}. The simulation results are depicted in Fig. \ref{fig:navigation final}-\ref{fig:c tilde}. In particular, Fig. \ref{fig:navigation final} and \ref{fig:navigation final2} illustrate the two consecutive transitions of the agents. Fig. \ref{fig:gamma beta} depicts the obstacle functions $\beta_i$ which are strictly positive, $\forall i\in\{1,2,3\}$. Finally, the control inputs are given in Fig. \ref{fig:inputs} and the parameter errors $\widetilde{c}$ are shown in Fig. \ref{fig:c tilde}, which indicates their boundedness. As proven in the theoretical analysis, the transitions are successfully performed while satisfying all the desired specifications. \begin{figure}[] \vspace{0.4cm} \centering \includegraphics[scale=0.35]{beta_i.eps} \caption{The obstacle functions $\beta_i, i\in\{1,2,3\}$, which remain strictly positive. \label{fig:gamma beta}} \end{figure} \begin{figure}[] \centering \includegraphics[scale=0.35]{inputs.eps} \caption{The resulting control inputs $\tau_i,\forall i\in\{1,2,3\}$ for the two transitions.\label{fig:inputs}} \end{figure} \section{CONCLUSIONS AND FUTURE WORKS} \label{sec:concl} In this paper we designed decentralized abstractions for multiple mobile manipulators by guaranteeing the navigation of the agents among predefined regions of interest, while guaranteeing inter-agent collision avoidance and connectivity maintenance for the initially connected agents. We proposed a novel approach for ellipsoid collision avoidance as well as appropriately chosen potential functions that are free of undesired local minima. Future efforts will be devoted towards addressing abstractions of cooperative tasks between the agents by employing hybrid control techniques as well as abstraction reconfiguration due to potential execution incapability of the transitions. \begin{figure}[] \vspace{0.4cm} \centering \includegraphics[scale=0.35]{c_tilde.eps} \caption{The parameter deviations $\widetilde{c}_i,\forall i\in\{1,2,3\}$, which are shown to be bounded.\label{fig:c tilde}} \end{figure}
{'timestamp': '2017-12-07T02:06:34', 'yymm': '1703', 'arxiv_id': '1703.08692', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08692'}
arxiv
\section{Algorithm for WLTP Optimization} We note that the WLTP optimization problem is convex with respect to individual ${\mathbf t}$ and ${\bm \pi}$. We note that the strict $<$ constraint can be modified as $\le -\epsilon$ for an $\epsilon$ small enough. The constraints are also convex in each of the variables individually. We will now develop an alternating minimization algorithm to solve the problem. In order to describe the Algorithm, we first define the three sub-problems: {\bf ${\mathbf t}$-Optimization: } Input ${\bm \pi}, \mathcal{\boldsymbol{S}}$ \begin{eqnarray} &\min& \sum_i \omega_i\left (\sum_{j}\frac{\pi_{ij}}{e^{t_j x}} \frac{(1-\rho_j)t_j M_j(t_j)}{t_j - \Lambda_j (M_j(t_j)-1)} \right)\nonumber\\ &s.t.& \eqref{formf}, \eqref{mjt},\eqref{opt_1},\eqref{tjo}, \eqref{forml}\nonumber\\ &var.& {\mathbf t} \nonumber \end{eqnarray} {\bf ${\bm \pi}$-Optimization: } Input ${\mathbf t}, \mathcal{\boldsymbol{S}}$ \begin{eqnarray} &\min& \sum_i \omega_i\left (\sum_{j}\frac{\pi_{ij}}{e^{t_j x}} \frac{(1-\rho_j)t_j M_j(t_j)}{t_j - \Lambda_j (M_j(t_j)-1)} \right)\nonumber\\ &s.t.& \eqref{formf}, \eqref{mjt},\eqref{opt_1},\eqref{opt_3}, \eqref{rhocon}, \eqref{opt_5}, \eqref{forml}\nonumber\\ &var.& {\bm \pi}\nonumber \end{eqnarray} {\bf ${\bm{ \mathcal{S} }}$-Optimization: } Input ${\mathbf t}, {\bm \pi}$ \begin{eqnarray} &\min& \sum_i \omega_i\left (\sum_{j}\frac{\pi_{ij}}{e^{t_j x}} \frac{(1-\rho_j)t_j M_j(t_j)}{t_j - \Lambda_j (M_j(t_j)-1)} \right)\nonumber\\ &s.t.& \eqref{formf}, \eqref{mjt},\eqref{opt_1},\eqref{opt_3}, \eqref{rhocon}, \eqref{opt_5}, \eqref{plc}\nonumber\\ &var.& \bm{ \mathcal{S} } \nonumber \end{eqnarray} The first two sub-problems ({\bf ${\mathbf t}$-Optimization} and {\bf ${\mathbf \pi}$-Optimization}) are convex, and thus can be solved by Projected Gradient Descent Algorithm. \input{placment} Since the objective is non-negative and the objective is non-increasing in each iteration, the algorithm converges. \section{Proof that Alternating Minimization Converges to Optimal Solution} The authors of \cite{1137/13094829X} showed that if the following five assumptions are satisfied for the minimization problem \begin{equation} min_{{\mathbf y}\in\mathbb R^{n_1},{\mathbf z}\in\mathbb R^{n_2}} H({\mathbf y},{\mathbf z})\equiv f({\mathbf y},{\mathbf z})+g_1({\mathbf y})+g_2({\mathbf z}) ,\label{beckmain} \end{equation} the alternating minimization over ${\mathbf y}$ and ${\mathbf z}$ converges to optimal solution with a sublinear rate of convergence. \begin{description} \item[A]The functions $g_1:\mathbb R^{n_1} \to (-\infty,\infty]$ and $g_2:\mathbb R^{n_2} \to (-\infty,\infty]$ are closed and proper convex functions assumed to be sub-differentiable over their domain.\\ \item[B]The function $f$ is a continuously differentiable convex function over dom $g_1 \times$ dom $g_2$\\ \item[C]The gradient of $f$ is (uniformly) Lipschitz continuous with respect to the variables vector ${\mathbf y}$ over dom $g_1$ with constant $L_1 \in(0,\infty)$: $$ \Arrowvert \nabla_1f({\mathbf y}+{\bf d_1},{\mathbf z}) -\nabla_1f({\mathbf y},{\mathbf z})\Arrowvert \le L_1 \Arrowvert {\bf d_1}\Arrowvert$$ for any ${\mathbf y} \in \text{ dom } g_1$, ${\mathbf z}\in \text{ dom } g_2$, and ${\bf d_1}\in\mathbb R^{n_1}$ such that ${\mathbf y}+{\bf d_1} \in \text{ dom } g_1$.\\ \item[D]The gradient of $f$ is Lipschitz continuous with respect to the variables vector ${\mathbf z}$ over dom $g_2$ with constant $L_2 \in(0,\infty]$: $$\Arrowvert {\nabla_2f({\mathbf y},{\mathbf z}+{\mathbf d}_2) -\nabla_2f({\mathbf y},{\mathbf z})}\Arrowvert \le L_2 \Arrowvert {{\mathbf d}_2}\Arrowvert$$ for any ${\mathbf y} \in \text{ dom }g_1$, ${\mathbf z}\in \text{ dom } g_2$, and ${\mathbf d}_2\in\mathbb R^{n_2}$ such that ${\mathbf y}+{\mathbf d}_2 \in \text{ dom } g_2$.\\ \item[E]The optimal set of \eqref{beckmain}, denoted by $X^*$, is nonempty, and the corresponding optimal value is denoted by $H^*$. In addition, for any $\tilde{\mathbf y}\in \text{ dom } g_1$ and $\tilde{\mathbf z}\in \text{ dom } g_2$, the problems $\min_{{\mathbf z}\in\mathbb R^{n_2}} f(\tilde{\mathbf y},{\mathbf z})+g_2({\mathbf z}),$ and $min_{{\mathbf y}\in\mathbb R^{n_1}}f(y,\tilde{z})+g_1({\mathbf y})$ have minimizers. \end{description}\par \begin{tabular}{|p{9cm}|} \hline \textbf{The Steps of Alternating Minimization Method}\\ \\ \textbf{Step 1:} Initialization \\ ${\mathbf y}_0 \in$ dom $g_1$, ${\mathbf z}_0 \in$ dom $g_2$ such that ${\mathbf z}_0 \in \operatornamewithlimits{argmin}_{{\mathbf z} \in \mathbb R^{n_2}}f({\mathbf y}_0,{\mathbf z})+g_2({\mathbf z})$.\\ \textbf{Step 2:} General Step (k=0,1,...)\\ $${\mathbf y}_{k+1} \in \operatornamewithlimits{argmin}_{{\mathbf y}\in \mathbb R^{n_1}}f({\mathbf y},{\mathbf z}_k)+g_1({\mathbf y}),$$ $${\mathbf z}_{k+1} \in \operatornamewithlimits{argmin}_{{\mathbf z}\in \mathbb R^{n_2}}f({\mathbf y}_{k+1},{\mathbf z})+g_2({\mathbf z})$$ \textbf{Step 3:} Decide the optimal set\\ The k-th iterate will be denoted by $\vec x_k=({\mathbf y}_k.{\mathbf z}_k)$, the generated sequence is monotone and satisfies:$$H(\vec x_0)\ge H(\vec x_1)\ge H(\vec x_2)\ge H(\vec x_3)\ge \ldots$$When $H(\vec x_{k+1})-H(\vec x_k) \to 0$ ,decide this $\vec x_k$ is the optimal arg.\\ \hline \label{amintabl} \end{tabular}\\ \\ In order to prove optimality of alternating minimization for our problem, we first transfer the constraints of our problem into the objective function. In order to do that, let \begin{displaymath} I(x)=\left\{ \begin{array}{ll} 0 & \textrm{if $x\ge 0$}\\ \infty & \textrm{if $x < 0$} \end{array}\right. \end{displaymath}\\ The problem in \eqref{objeq}-\eqref{forml} reduces to \begin{eqnarray} \min_{{\mathbf t},{\mathbf \pi}}&& \sum_i \omega_i \left( \sum_{j}\frac{\pi_{ij}}{e^{t_j x}} \frac{(1-\rho_j)t_j M_j(t_j)}{t_j - \Lambda_j (M_j(t_j)-1)}\right) \nonumber\\ & &+\sum_j{I(t_j)}+\sum_j{I(-t_j(t_j-\alpha_j+\Lambda_j)-\Lambda_j\alpha_j(e^{\beta_j t_j}-1))} \nonumber\\ & &+\sum_i{I(K_i-\sum_j \pi_{ij})}+\sum_i{I(\sum_j \pi_{ij}-K_i)}\nonumber\\ & &+\sum_i{\sum_j{I(\pi_{ij})}}+\sum_i{\sum_j{I(1-\pi_{ij})}} \end{eqnarray}\\ We will now verify that the above five assumptions are satisfied for our problem. \begin{description} \item[A] The function\begin{displaymath} I(x)=\left\{ \begin{array}{ll} 0 & \textrm{if $x\ge 0$}\\ \infty & \textrm{if $x < 0$} \end{array}\right. \end{displaymath} is convex over $\mathbb R$. The functions $g_1$, $g_2$ are \begin{eqnarray} &&g_1( {\bf t})\nonumber\\ &=&\sum_j{I(-t_j(t_j-\alpha_j+\Lambda_j)-\Lambda_j\alpha_j(e^{\beta_j t_j}-1))}\nonumber\\ &&+\sum_j{I(t_j)}\\ &&g_2({\bf \pi})\nonumber\\ &=&\sum_i{I(K_i-\sum_j \pi_{ij})}+\sum_i{I(\sum_j \pi_{ij}-K_i)}\nonumber\\ &&+\sum_i{\sum_j{I(\pi_{ij})}}+\sum_i{\sum_j{I(1-\pi_{ij})}} \end{eqnarray} The corresponding functions $g_1:\mathbb R^{n_1} \to [0,\infty]$ and $g_2:\mathbb R^{n_2} \to [0,\infty]$ h are closed and proper convex functions, subdifferentiable over their domain. The assumption A is thus satisfied.\\ \item[B] The function $f$ is $f({\bf t},{\bf \pi})=\sum_i \omega_i \left( \sum_{j}\frac{\pi_{ij}}{e^{t_j x}} \frac{(1-\rho_j)t_j M_j(t_j)}{t_j - \Lambda_j (M_j(t_j)-1)}\right)$, it has been proven convex over $t_j$ in Theorem 3 and convex over $\pi_{ij}$ in Theorem 4. So the function $f$ is a continuously differentiable convex function over dom $g_1 \times $ dom $g_2$. The assumption B is thus satisfied.\\ \item[C] The function $f({\bf t} ,{\bf \pi})$ is differentiable w.r.t. each $t_j$ and the deriavative is bounded for For the function $f({\bf t} ,{\bf \pi})$, denote $A=\alpha_j\Lambda_j$, $C=\alpha_j-\Lambda_j$, \begin{eqnarray} \Arrowvert \nabla_1f({\bf t}+{\bf d_1},{\bf \pi}) -\nabla_1f({\bf t},{\bf \pi})\Arrowvert =\nonumber\\ \sum_i \omega_i \sum_j\pi_{ij}\alpha e^{(\beta_j-x)t_j} M(d_{1j})\nonumber \end{eqnarray} \begin{eqnarray} &&M(d_{1j})\nonumber\\ &=&\frac{t_j e^{(\beta_j-x)d_{1j}}}{X(t_{1j}+d_{1j})}-\frac{t_j}{X(t_j)}+\frac{e^{(\beta_j-x)d_{1j} }}{X(t_j+d_{1j})}d_{1j} \nonumber\\ &\le&\frac{t_j}{X(t_j+d_{1j})}-\frac{t_j}{X(t_j)}+\frac{1}{X(t_j+d_{1j})}d_{1j} \nonumber\\ &=&\frac{A e^{\beta_j t_j}(e^{\beta_j d_{1j}}-1)}{X(t_j+d_{1j})X(t_j)} +\frac{1}{X(t_j+d_{1j})}d_{1j}\nonumber\\ &&+\frac{d_{1j}+2t_j-C}{X(t_j+d_{1j})X(t_j)}d_{1j}\nonumber\\ &=&\frac{A e^{\beta_j t_j}(\sum_{i=1}\frac{\beta_j^{i+1}d_{1j}^i}{(i+1)!})}{X(t_j+d_{1j})X(t_j)}d_{1j}+\frac{1}{X(t_j+d_{1j})}d_{1j}\nonumber\\ &&+\frac{d_{1j}+2t_j-C}{X(t_j+d_{1j})X(t_j)}d_{1j}\nonumber\\ &\le& L_{1j} d_{1j}\nonumber \end{eqnarray} $$\Arrowvert \nabla_1f({\bf t}+{\bf d_1},{\bf \pi}) -\nabla_1f({\bf t},{\bf \pi})\Arrowvert \le L_1 \Arrowvert {\bf d_1}\Arrowvert $$ Since $L_1 \in (0,\infty)$, The assumption C is also satisfied.\\ \item[D]For the function $f({\bf t}_j,{\bf \pi})$, denote $B=e^{-t_jx}M_j(t_j)$, $C_1 = \frac{1}{\alpha_j}+\beta_j$, $C_2 = \frac{M_j(t_j)-1}{t_j}$, \begin{eqnarray} \Arrowvert \nabla_2f({\bf t},{\bf \pi}+{\mathbf d}_2) -\nabla_2f({\bf t},{\bf \pi})\Arrowvert =\nonumber\\ \sum_i \omega_i \sum_j B N(d_{2,ij})\nonumber \end{eqnarray} \begin{eqnarray} &&N(d_{2,ij})\nonumber\\ &=&\pi_{ij}\left[\frac{1-\Lambda_jC_1-\lambda_id_{2,ij}C_1}{1-\Lambda_jC_2-\lambda_id_{2,ij}C_2}-\frac{1-\Lambda_jC_1}{1-\Lambda_jC_2}\right]\nonumber\\ &&+\frac{1-\Lambda_jC_1}{1-\Lambda_jC_2}d_{2,ij}\nonumber\\ &=&\frac{\pi_{ij}\lambda_i(C_2-C_1)}{(1-\Lambda_jC_2)(1-\Lambda_jC_2-\lambda_id_{2,ij}C_2)}d_{2,ij}\nonumber\\ &&+\frac{1-\Lambda_jC_1}{1-\Lambda_jC_2}d_{2,ij}\nonumber\\ &\le& L_{2,ij} d_{2,ij}\nonumber \end{eqnarray} $$\Arrowvert \nabla_2f({\bf t},{\bf \pi}+{\mathbf d}_2) -\nabla_1f({\bf t},{\bf \pi})\Arrowvert \le L_2 \Arrowvert {\mathbf d}_2\Arrowvert $$ Since $L_2 \in (0,\infty]$, the assumption D is satisfied.\\ \item[E]The optimal set of \eqref{beckmain}, denoted by $X^*$ is obviously nonempty as there always exist ${\bf \pi}$ and ${\bf t}_j$ as the iteration goes.\\ \end{description} \section{Bounds on Tail Latency} We first quantify tail latency for erasure-coded storage systems with arbitrary service time distribution (i.e., arbitrary known distribution of $X_j$). Let ${\bf Q}_j$ be the (random) time the chunk request spends in node $j$ (sojourn time). Under probabilistic scheduling, the service time (denoted by $L_i$) of a file-$i$ request is determined by the maximum chunk service time at a randomly selected set $A_i$ of storage nodes. Under probabilistic scheduling, the arrival of chunk requests at node $j$ form a Poisson Process with rate $\Lambda_j = \sum_i \lambda_i \pi_{ij}$. Let $M_j(t) = {\mathbb E}[e^{t X_j}]$ be the moment generating function of service time of processing a single chunk at server $j$. Then, the Laplace Stieltjes Transform of ${\bf Q}_j$ is given, using Pollaczek-Khinchine formula, as \begin{equation} {\mathbb E}[e^{-s Q_j}] = \frac{(1-\rho_j)s M_j(-s)}{s-\Lambda_j(1-M_j(-s))},\label{polla} \end{equation} where $\rho_j = \Lambda_j{\mathbb E}[X_j]$ is the request intensity at node $j$, and $M_j(t) = {\mathbb E}[e^{t X_j}]$ is the moment generating function of $X_j$ \cite{kleinrock1976queueing}. Further, let the latency of the file $i$ be denoted as $L_i$ using probabilistic scheduling. The {\em latency tail probability} of file $i$ is defined as the probability that $L_i$ is greater than or equal to $x$, for a given $x$. For given weight $w_i$ for file $i$, this paper wishes to minimize $\sum_i w_i \Pr(L_i\ge x)$. Since finding $\Pr(L_i\ge x)$ in closed form is hard for general service time distribution, we further use an upper bound on this and use that instead of $\Pr(L_i\ge x)$ in the objective. The following theorem gives an upper bound on the latency tail probability of a file. \begin{theorem} The latency tail probability for file $i$, $\Pr(L_i\ge x)$ using probabilistic scheduling is bounded by \begin{equation} \Pr(L_i\ge x)\le \sum_{j}\frac{\pi_{ij}}{e^{t_j x}} \frac{(1-\rho_j)t_j M_j(t_j)}{t_j - \Lambda_j (M_j(t_j)-1)}, \end{equation} for any $t_j> 0$, $\rho_j = \Lambda_j{\mathbb E}[X_j]$, satisfying $M_j(t_j)<\infty$ and $\Lambda_j (M_j(t_j)-1)<t_j$. \end{theorem} \begin{proof} We consider an upper bound on latency tail probability using probabilistic scheduling as follows. \begin{eqnarray} \Pr(L_i\ge x) &\stackrel{\text{(a)}}{=}& \Pr_{A_i, Q_j} (\max_{j\in A_i} Q_j \ge x) \\ &=& \Pr_{A_i, Q_j} (Q_j \ge x \text{ for some } j \in A_i) \\ &=& {\mathbb E}_{A_i,Q_j} [\max_{j\in A_i} {1}_{(Q_j\ge x)}]\\ &\le& {\mathbb E}_{A_i,Q_j}\sum_{j\in A_i} [ {1 }_{(Q_j\ge x)}]\\ &=& {\mathbb E}_{A_i}\sum_{j\in A_i}[ \Pr{(Q_j\ge x)}]\\ &=& \sum_{j}\pi_{ij} [ \Pr{(Q_j\ge x)}], \end{eqnarray} where (a) follows since for probabilistic scheduling, the time to retrieve the file is the maximum of the time of retrieving all the chunks from $A_i$. Using Markov Lemma, we have $ \Pr{(Q_j\ge x)} \le \frac{{\mathbb E}[e^{t_j Q_j}]}{e^{t_j x}}$. In order to obtain ${\mathbb E}[e^{t_j Q_j}]$, we use Pollaczek-Khinchine formula for Laplace Stieltjes Transform of $Q_j$ in \eqref{polla} and use $s=-t_j$. However, the expression is finite only when $\Lambda_j (M_j(t_j)-1)<t_j$. This proves the result as in the statement of the Theorem. \end{proof} In some cases, the moment generating function may not exist, which means that the condition $\Lambda_j (M_j(t_j)-1)<t_j$ may not be satisfied for any $t_j>0$. In such cases, we will use the Laplace Stieltjes Transform directly to give another upper bound in the next theorem. \begin{theorem} The latency tail probability for file $i$, $\Pr(L_i\ge x)$ is bounded by \begin{equation} \Pr(L_i\ge x)\le \sum_{j}\frac{\pi_{ij}(1 - {\mathbb E}[e^{-s_j Q_j}])}{1 - e^{-s_j x}}, \end{equation} for any $s_j> 0$, where $\rho_j = \Lambda_j{\mathbb E}[X_j]$, ${\mathbb E}[e^{-s Q_j}] = \frac{(1-\rho_j)s L_j(s)}{s-\Lambda_j(1-L_j(s))}$, and $L_j(s) = E[e^{-s X_j}]$. \end{theorem} \begin{proof} This result is a variant of Theorem 1, where Markov Lemma is used using Laplace Stieljes Transform of the Queue Waiting Time rather than the moment generating function. \end{proof} We next consider the case when the service time distribution is a shifted exponential distribution. This choice is motivated by the Tahoe experiments \cite{Yu_TON} and Amazon S3 experiments \cite{CS14}. Let the service time distribution from server $j$ has probability density function $f_{X_j}(x)$, given as \begin{equation} f_{X_j}(x)= \left\{\begin{array}{lr} \alpha_j e^{-\alpha_j(x-\beta_j)}, & \text{ for } x\ge \beta_j\\ 0, & \text{ for } x< \beta_j \end{array}.\right. \end{equation} Exponential distribution is a special case with $\beta_j=0$. The Moment Generating Function is given as \begin{equation} M_j(t) = \frac{\alpha_j}{\alpha_j-t}e^{\beta_j t} \quad \text{ for } t< \alpha_j. \end{equation} Using these expressions, we have the following result. \begin{corollary} When the service time distributions of servers are given by shifted exponential distribution, the latency tail probability for file $i$, $\Pr(L_i\ge x)$, is bounded by \begin{equation} \Pr(L_i\ge x)\le \sum_{j}\frac{\pi_{ij}}{e^{t_j x}} \frac{(1-\rho_j)t_j M_j(t_j)}{t_j - \Lambda_j (M_j(t_j)-1)}, \end{equation} for any $t_j>0$, $\rho_j = \frac{\Lambda_j}{\alpha_j}+\Lambda_j \beta_j$, $\rho_j<1$, and $t_j(t_j - \alpha_j + \Lambda_j) +\Lambda_j \alpha_j (e^{\beta_j t_j}-1)<0$. \end{corollary} \begin{proof} We note that the condition $\Lambda_j (M_j(t_j)-1)<t_j$ reduces to $t_j(t_j - \alpha_j + \Lambda_j) +\Lambda_j \alpha_j (e^{\beta_j t_j}-1)<0$. Since $t_j\ge \alpha_j$ will not satisfy $t_j(t_j - \alpha_j + \Lambda_j) +\Lambda_j \alpha_j (e^{\beta_j t_j}-1)<0$, the conditions in the statement of the Corollary implies $t_j<\alpha_j$ where the above moment generating function expression is used. \end{proof} Since exponential distribution is a special case of the shifted exponential distribution, we have the following corollary. \begin{corollary} When the service time distributions of servers are given by exponential distribution, the latency tail probability for file $i$, $\Pr(L_i\ge x)$, is bounded by \begin{equation} \Pr(L_i\ge x)\le \sum_{j}\frac{\pi_{ij}}{e^{t_j x}} \frac{(1-\rho_j)t_j M_j(t_j)}{t_j - \Lambda_j (M_j(t_j)-1)}, \end{equation} for any $t_j>0$, $\rho_j = \frac{\Lambda_j}{\alpha_j}$, $\rho_j<1$, $t_j <\alpha_j(1-\rho_j)$ \end{corollary} \section{Acknowledgment} This work was supported in part by the National Science Foundation under Grant no. CNS-1618335. \section{Conclusions} This paper provides bounds on latency tail probabilities for distributed storage systems using erasure coding. These bounds are used to formulate an optimization to jointly minimize weighted latency tail probability of all files over request scheduling and data placement. The non-convex optimization problem is solved using an efficient alternating optimization algorithm. Simulation results show significant reduction of tail latency for erasure-coded storage systems with realistic workload. Following this work, the probabilistic scheduling used in this paper has been shown to be optimal for tail index in \cite{Pareto}. However, the model of file size is different as compared to this paper. Finding more general scenarios where such scheduling strategy is optimal, or improving the strategy to show optimality for wider classes is an important research problem. \section{Numerical Results} To validate the proposed tail latency bound and tail latency optimization, we simulate erasure-coded storage systems and compare the performance of our proposed latency optimization, denoted as WLTP Policy, with five naive strategies: \begin{itemize} \item Proposed Approach-Optimized Placement, i.e., WLTP-OP ({\em Weighted Latency Tail Probability-Optimized Placement}) Policy: The joint scheduler is determined by the proposed solution that minimizes the weighted latency tail probabilities, with respect to our proposed tail latency bounds and placement optimization. We consider optimizing the placement of the chunks of the files in this policy. \item Proposed Approach-Random Placement, i.e., WLTP-OP ({\em Weighted Latency Tail Probability-Random Placement}) Policy: The joint scheduler is determined by the proposed solution that minimizes the weighted latency tail probabilities, with respect to our proposed tail latency bounds and placement optimization. The chunks are allocated randomly in this policy. \item PEAP-RP Policy ({\em Projected, Equal Access-Probability-Random Placement}): For each file request, the joint request scheduler selects available chunks and nodes with equal probability. The equal access-probabilities are projected toward feasible region in (\ref{objeq}) for all $t_j = .01$ to ensure stability of the storage system and the objective is then optimized over ${\mathbf t}$. We assume that the chunks of the files are randomly placed among the storage nodes. \item PEAP-OP Policy: This strategy is same as PEAP-RP except that we further perform placement optimization besides optimizing scheduling probabilities $\boldsymbol{\pi}$ and auxiliary variables $\boldsymbol{t}$. \item PPF-RP Policy ({\em Projected-Proportional Fairness-Random Placement Policy}): The joint request scheduler is optimized to balance the workload (arrival rates) of all storage nodes as will be described later. Intuitively, this policy minimizes the chance of congested bottleneck in the storage system. The strategy is further optimized over ${\mathbf t}$. \item PPF-OP Policy ({\em Projected-Proportional Fairness-Optimized Placement Policy}): The joint request scheduler is optimized to balance the workload (arrival rates) of all storage nodes as will be described later. Intuitively, this policy minimizes the chance of congested bottleneck in the storage system. The objective is further optimized over ${\mathbf t}$. The strategy here utilizes all $\boldsymbol{\pi}$, $\boldsymbol{t}$ and $\boldsymbol{\mathcal{S}}$ as mentioned above. Then, alternating optimization over placement and $\boldsymbol{t}$ are performed using the proposed policy. \end{itemize} In the simulations, we consider $r=1000$ files, all of size 200 MB and using $(7,4)$ erasure code in a distributed storage system consisting of $m=12$ distributed nodes. Based on \cite{Yu_TON,CS14,Yu-TON16}, we consider chunk service time that follows a shifted-exponential distribution with rate $\alpha_j$ and shift $\beta_j$. As shown in Table~\ref{tb}, we have 12 heterogeneous storage nodes with different service speed and round-trip-time. The base arrival rates for the first 250 files is $2/150$ s$^{-1}$, for the next 250 files are $4/150$ s$^{-1}$, for the next 250 files are $6/150$ s$^{-1}$, and for the last 250 files is $3/150$ s$^{-1}$. The first 250 files are placed on first seven nodes, the next 250 files are placed on nodes 2 to 8, the next 250 files are placed on nodes 4 to 10, and the last 250 files are placed on nodes 6 to 12. This paper also considers the weights of the files proportional to the arrival rates. In order to initialize the algorithm, we choose $\pi_{ij} = k/n$ on the placed servers, all $t_j = .01$. However, since these choices of $\mathbf \pi$ and ${\mathbf t}$ may not be feasible, we modify the initialization ${\bm \pi}$ to be the closest norm feasible solution to the above choice. \begin{table}[ht] \caption{Summary of parameters for the 12 storage nodes in our simulation (shift $\beta$ in ms and rate $\alpha$ in 1/s).}\centering \resizebox{.48 \textwidth}{!}{ \begin{tabular}{c c c c c c c} \hline\hline & Node 1 & Node 2 & Node 3 & Node 4 & Node 5 & Node 6 \\ [0.25ex] \hline $\alpha_j$ & 20.0015 & 26.1252 & 14.9850 & 17.0526 & 27.1422 & 22.8919 \\ $\beta_j$ & 10.5368 & 15.6018 & 8.2756 & 10.0120 & 12.8544 & 13.6722 \\ [1ex] \hline\hline & Node 7 & Node 8 & Node 9 & Node 10 & Node 11 & Node 12 \\ [0.25ex] \hline $\alpha_j$ & 30.0000 & 21.3812 & 11.9106 & 25.1599 & 28.8188 & 23.8067 \\ $\beta_j$ & 12.6616 & 9.9156 & 10.7872 & 8.6166 & 13.8721 & 10.8964 \\ [0.25ex] \hline \end{tabular}} \label{tb} \end{table} \begin{figure} \begin{center} \includegraphics[trim=.0in 0in 5.7in .0in, clip,width=0.45\textwidth]{tailProb_vs_x} \caption{Weighted Latency Tail Probability vs $x$ (in seconds).} \label{tailfig} \end{center} \end{figure} \noindent {\bf Weighted Latency Tail Probabilities: } In Figure~\ref{tailfig}, we plot the decay of weighted latency tail probability $\sum_i \omega_i\Pr(L_i \ge x)$ with $x$ (in seconds) for Policies WLTP, PEAP and BNW. Policy WLTP solves the optimal weighted latency tail probability via proposed alternative optimization algorithm over $t_j$ and $\pi_{i,j}$. With fixed ${\mathbf t}$, Policy PEAP uses equal server access probabilities, projected toward the feasible region, while Policy BNW load-balances chunk requests across different servers. The values of ${\mathbf t}$ are then found optimally for the above given values of $\pi_{i,j}$. In particular, for PPF, we set the access probability to be proportional to the service rates of the storage nodes, i.e., $\pi_{ij}=k_{i}\frac{\mu_{j}}{\sum_{j}\mu_{j}}$. This achieves optimal load-balancing, because the chance of congestion is minimized in the storage system. We note that our proposed algorithm for jointly optimizing ${\bm \pi}$ and ${\mathbf t}$ provides significant improvement over simple heuristics such as Policies PEAP-OP, PEAP-RP, PPF-RP and PPF-OP, as weighted latency tail probability reduces by an orders of magnitude. For example, our proposed Policy WLTP-OP decreases 99-percentile weighted latency (i.e., $x$ such that $\sum_i \omega_i\Pr(L_i \ge x)\le 0.01$) from above 220 seconds in the baseline policies to less than 40 seconds. Uniformly accessing servers and simple load-balancing are unable to optimize the request scheduler based on factors like chunk placement, request arrival rates, different latency weights, thus leading to much higher tail latency. We further notice that chunk placement optimization reduces the latency tail probability further for all $x$. \begin{figure} \begin{center} \includegraphics[trim=.1in .1in .5in .1in, clip,width=0.80\textwidth]{convg} \caption{Convergence of Weighted Latency Tail Probability.} \label{convfig} \end{center} \end{figure} \noindent {\bf Convergence of the Proposed Algorithm: } We have shown that the proposed algorithm is guaranteed to converge. To illustrate its convergence speed, Figure \ref{convfig} shows the convergence of objective value vs. the number of iterations for different values of $x$ ranging from 50 to 190 seconds in increments of 20 seconds. For 1000 files and 12 storage nodes, we note that the weighted latency tail probability shows convergence. In the rest of the results, 300 iterations are used and the results can only be better with higher number of iterations. \begin{figure} \begin{center} \includegraphics[trim=.0in .0in .3in .0in, clip,width=0.75\textwidth]{Lat_all} \caption{Weighted Latency Tail Probability for different file arrival rates. We vary the arrival rate of file i from $0.2\times\lambda$ to $2\times\lambda$, where $\lambda$ is the base arrival rate.} \label{arrfig} \end{center} \end{figure} \noindent {\bf Effect of Arrival Rates: } We next see the effect of varying request arrival rates on the weighted latency tail probability. We choose $x=50$ seconds. For $\lambda$ as the base arrival rates, we increase arrival rate of all files from $.2\lambda$ to $2\times\lambda$ and plot the weighted latency tail probability in Figure~\ref{arrfig}. While latency tail probability increases as arrival rate goes up, our algorithm assigns differentiated latency for different files to maintain low weighted latency tail probability. We compare our proposed algorithm with the different baseline policies and notice that the proposed algorithm outperforms all baseline strategies. Since the latency tail probability is more significant at high arrival rates, we observe significant improvement in latency tail by about 43\% ( approximately 0.025 to about 0.22) at the highest arrival rate in Figure 4 as compared to the optimized placement and projected equal access policy. Our proposed policy always receives the minimum latency. Thus, efficiently reducing the latency of the high arrival rate files reduces the overall weighted latency tail probability. \begin{figure} \begin{center} \includegraphics[trim=.0in .1in 5.8in .0in,clip,width=0.45\textwidth]{numberOfFiles} \caption{Weighted Latency Tail Probability for different number of files.} \label{filesfig} \end{center} \end{figure} \noindent {\bf Effect of Number of files: } Figure \ref{filesfig} demonstrates the impact of varying the number of video files from 200 files to 1200 files on the weighted latency tail probability. Weighted latency tail probabilities increases with the number of files, which brings in more workload (i.e., higher arrival rates). Our optimization algorithm optimizes new files along with existing ones to keep overall latency tail probability at a very low level. We note that the proposed optimization strategy effectively reduces the tail probability and outperforms the considered baseline strategies. Thus, joint optimization over all three variables $\boldsymbol{\mathcal{S}}$,$\boldsymbol{\pi}$ , and $\boldsymbol{t}$ helps reduce the tail probability dramatically . \section{Numerical Results} To validate the proposed tail latency bound and tail latency optimization, we employ a hybrid simulation method, which generates chunk service times based on real system measurements on Tahoe and Amazon S3 servers in \cite{Yu_TON,CS14,Yu-TON16}, and compare the performance of our proposed latency optimization, denoted as WLTP Policy, with five baseline strategies. The proposed strategy and the other baseline strategies are described below. \begin{itemize}[leftmargin=*] \item Proposed Approach-Optimized Placement, i.e., WLTP ({\em Weighted Latency Tail Probability}) Policy: The joint scheduler is determined by the proposed solution that minimizes the weighted latency tail probabilities, with respect to the three sets of variables: chunk placement on the servers ${\bm{ \mathcal{S} }}$, auxiliary variables ${\mathbf t}$, and the scheduling policy $\bm \pi$. \item Proposed Approach-Random Placement, i.e., WLTP-RP ({\em WLTP - Random Placement}) Policy: The chunks are placed uniformly at random. With this fixed placement, the weighted latency tail probability is optimized over the remaining two sets of variables: auxiliary variables ${\mathbf t}$, and the scheduling policy $\bm \pi$. \item WLTP-RP-Fixed ${\mathbf t}$ Policy: The chunks are placed uniformly at random, and all the auxiliary variables $t_j$ are set as $0.01$. The weighted latency tail probability is optimized over the scheduling access probabilities $\bm \pi$. \item PEAP ({\em Projected, Equal Access-Probability}) Policy: For each file request, the joint request scheduler selects available nodes with equal probability. This choice of $\pi_{i,j}= k_i/n_i$ may not be feasible and thus the access probabilities are projected toward feasible region in (\ref{objeq}) for all $t_j = .01$ for a uniformly randomly placed files to ensure stability of the storage system. With these fixed access probabilities, the weighted latency tail probability is optimized over the remaining two sets of variables: chunk placement on the servers ${\bm{ \mathcal{S} }}$, and the auxiliary variables ${\mathbf t}$. \item PEAP-RP Policy: As compared to the PEAP Policy, the chunks are placed uniformly at random. The weighted latency tail probability is optimized over the choice of auxiliary variables ${\mathbf t}$. \item PSPP ({\em Projected Service-Rate Proportional Allocation}) Policy: The joint request scheduler chooses the access probabilities to be proportional to the service rates of the storage nodes, i.e., $\pi_{ij}=k_{i}\frac{\mu_{j}}{\sum_{j}\mu_{j}}$. This policy assigns servers proportional to their service rates. These access probabilities are projected toward feasible region in (\ref{objeq}) for a uniformly random placed files to ensure stability of the storage system. With these fixed access probabilities, the weighted latency tail probability is optimized over the remaining two sets of variables: chunk placement on the servers ${\bm{ \mathcal{S} }}$, and the auxiliary variables ${\mathbf t}$. \item PSPP-RP ({\em PSPP - Random Placement}) Policy: As compared to the PSPP Policy, the chunks are placed uniformly at random. The weighted latency tail probability is optimized over the choice of auxiliary variables ${\mathbf t}$. \end{itemize} In the simulations, we consider $r=1000$ files, all of size 200 MB and using $(7,4)$ erasure code in a distributed storage system consisting of $m=12$ distributed nodes. Based on \cite{Yu_TON,CS14,Yu-TON16}, we consider chunk service time that follows a shifted-exponential distribution with rate $\alpha_j$ and shift $\beta_j$. As shown in Table~\ref{tb}, we have 12 heterogeneous storage nodes with different service rates $\alpha_j$ and shifts $\beta_j$. The base arrival rates for the first 250 files is $2/150$ s$^{-1}$, for the next 250 files are $4/150$ s$^{-1}$, for the next 250 files are $6/150$ s$^{-1}$, and for the last 250 files is $3/150$ s$^{-1}$. This paper also considers the weights of the files proportional to the arrival rates. In order to initialize the algorithm, we choose $\pi_{ij} = k/n$ on the placed servers, all $t_j = .01$. However, since these choices of $\mathbf \pi$ and ${\mathbf t}$ may not be feasible, we modify the initialization ${\bm \pi}$ to be the closest norm feasible solution to the above choice. \begin{table}[ht] \caption{Summary of parameters for the 12 storage nodes in our simulation (shift $\beta$ in ms and rate $\alpha$ in 1/s).}\centering \resizebox{.48 \textwidth}{!}{ \begin{tabular}{c c c c c c c} \hline\hline & Node 1 & Node 2 & Node 3 & Node 4 & Node 5 & Node 6 \\ [0.25ex] \hline $\alpha_j$ & 20.0015 & 26.1252 & 14.9850 & 17.0526 & 27.1422 & 22.8919 \\ $\beta_j$ & 10.5368 & 15.6018 & 8.2756 & 10.0120 & 12.8544 & 13.6722 \\ [1ex] \hline\hline & Node 7 & Node 8 & Node 9 & Node 10 & Node 11 & Node 12 \\ [0.25ex] \hline $\alpha_j$ & 30.0000 & 21.3812 & 11.9106 & 25.1599 & 28.8188 & 23.8067 \\ $\beta_j$ & 12.6616 & 9.9156 & 10.7872 & 8.6166 & 13.8721 & 10.8964 \\ [0.25ex] \hline \end{tabular}} \label{tb} \end{table} \begin{figure} \begin{center} \includegraphics[trim=.0in 0in 5.7in .0in, clip,width=0.45\textwidth]{tailProb_vs_x} \caption{Weighted Latency Tail Probability vs $x$ (in seconds).} \label{tailfig} \end{center} \end{figure} \noindent {\bf Weighted Latency Tail Probabilities: } In Figure~\ref{tailfig}, we plot the decay of weighted latency tail probability $\sum_i \omega_i\Pr(L_i \ge x)$ with $x$ (in seconds) for Policies WLTP, WLTP-RP, PSPP, PEAP, and WLTP-RP-Fixed ${\mathbf t}$. Notice that WLTP Policy solves the optimal weighted latency tail probability via proposed alternative optimization algorithm over $\bm \pi$, ${\mathbf t}$, and ${\bm{ \mathcal{S} }}$. With optimized ${\mathbf t}$ and placement, Policy PEAP uses equal server access probabilities, projected toward the feasible region, while Policy PSPP assign chunk requests across different servers proportional to their service rates. The values of ${\mathbf t}$ are then found optimally for the above given values of $\pi_{i,j}$. Note that this figure also represents the complementary cumulative distribution function (ccdf) of the WLTP, WLTP-RP, WLTP-RP-Fixed ${\mathbf t}$, PSPP, and PEAP. For instance, We observe that $\text{Pr}\left(x\geq20\right)\approx0.01$ for our proposed policy WLTP which is significantly lower as compared to the other strategies. We note that our proposed algorithm for jointly optimizing ${\bm \pi}$, ${\mathbf t}$ and $\boldsymbol{\mathcal{S}}$ provides significant improvement over simple heuristics such as Policies WLTP-RP-Fixed ${\mathbf t}$, PSPP, and PEAP, as weighted latency tail probability reduces by orders of magnitude. For example, our proposed Policy WLTP decreases 99-percentile weighted latency (i.e., $x$ such that $\sum_i \omega_i\Pr(L_i \ge x)\le 0.01$) from above 160 seconds in the baseline policies to about 20 seconds using WLTP. We also notice that chunk placement optimization reduces the latency tail probability for all $x$, as can be seen from Figure~\ref{tailfig} among the policies WLTP and WLTP-RP. Uniformly accessing servers and simple service-rate-based scheduling are unable to optimize the request scheduler based on factors like chunk placement, request arrival rates, different latency weights, thus leading to much higher tail latency. Since the policy WLTP-RP-Fixed ${\mathbf t}$ performs significantly worse than the other considered policies, we do not include this policy in the rest of the paper. \begin{figure} \begin{center} \includegraphics[trim=.1in .1in 6.1in .1in, clip,width=0.45\textwidth]{convg} \caption{Convergence of Weighted Latency Tail Probability.} \label{convfig} \end{center} \end{figure} \noindent {\bf Convergence of the Proposed Algorithm: } We have shown that the proposed algorithm converges within about 350 iterations to the optimal objective value, validating the efficiency of the proposed optimization algorithm. To illustrate its convergence speed, Figure \ref{convfig} shows the convergence of objective value vs. the number of iterations for different values of $x$ ranging from 20 to 70 seconds in increments of 10 seconds. In the rest of the results, 350 iterations will be used to get the required results. \begin{figure} \begin{center} \includegraphics[trim=.0in .0in 5.3in .0in, clip,width=0.45\textwidth]{Lat_all} \caption{Weighted Latency Tail Probability for different file arrival rates. We vary the arrival rate of file i from $0.2\times\lambda$ to $1.4\times\lambda$, where $\lambda$ is the base arrival rate.} \label{arrfig} \end{center} \end{figure} \noindent {\bf Effect of Arrival Rates: } We next see the effect of varying request arrival rates on the weighted latency tail probability. We choose $x=50$ seconds. For $\lambda$ as the base arrival rates, we increase arrival rate of all files from $.2\lambda$ to $1.4\times\lambda$ and plot the weighted latency tail probability in Figure~\ref{arrfig}. While latency tail probability increases as arrival rate increases, our algorithm assigns differentiated latency for different files to maintain low weighted latency tail probability. We compare our proposed algorithm with the different baseline policies and notice that the proposed algorithm outperforms all baseline strategies. Since the weighted latency tail probability is more significant at high arrival rates, we observe significant improvement in latency tail by about a multiple of 9 ( approximately 0.025 to about 0.22) at the highest arrival rate in Figure~\ref{arrfig} between PEAP and WLTP policies. Our proposed policy always receives the minimum latency. Thus, efficiently reducing the latency of the high arrival rate files reduces the overall weighted latency tail probability. \begin{figure} \begin{center} \includegraphics[trim=.0in .1in 5.8in .0in,clip,width=0.45\textwidth]{numberOfFiles} \caption{Weighted Latency Tail Probability for different number of files.} \label{filesfig} \end{center} \end{figure} \noindent {\bf Effect of Number of files: } Figure \ref{filesfig} demonstrates the impact of varying the number of files from 200 to 1200 on the weighted latency tail probability. Weighted latency tail probabilities increases with the number of files, which brings in more workload (i.e., higher arrival rates). Our optimization algorithm optimizes new files along with existing ones to keep overall weighted latency tail probability at a low level. We note that the proposed optimization strategy effectively reduces the tail probability and outperforms the considered baseline strategies. Thus, joint optimization over all three variables $\boldsymbol{\mathcal{S}}$, $\boldsymbol{\pi}$, and $\boldsymbol{t}$ helps reduce the tail probability significantly. \section{Introduction} Due to emerging applications such as big data analytics and cloud computing, distributed storage systems today often store multiple petabytes of data \cite{Sathiamoorthy13,Asure14,Fikes10}. As a result, these systems are transitioning from full data replication to the use of erasure code for encoding and spreading data chunks across multiple machines and racks, in order to achieve more efficient use of storage space while maintaining high reliability despite system failures. It is shown that using erasure codes can reduce the cost of storage by more than 50\% \cite{Asure14} due to smaller storage space and datacenter footprint. A key tradeoff for using erasure codes is performance. Distributed storage systems that employ erasure codes are known to be susceptible to long latency tails. Under full data replication, if a file is replicated $n$ times, it can be recovered from any of the $n$ replica copies. However, for an erasure-coded storage system using an $(n,k)$ code, a file is encoded into $n$ equal-size data chunks, allowing reconstruction from any subset of $k<n$ chunks. Thus, reconstructing the file requires fetching $k$ distinct chunks from different servers, which leads to significant increase of tail latency, since service latency in such systems is determined by the {\em hottest} storage nodes with highest congestion and slowest speed, which effectively become performance bottlenecks. It has been shown that in modern Web applications such as Bing, Facebook, and Amazon's retail platform, the long tail of latency is of particular concern, with $99.9$th percentile response times that are orders of magnitude worse than the mean \cite{T1,T2}. Despite mechanisms such as load-balancing and resource management, evaluations on large scale storage systems indicate that there is a high degree of randomness in delay performance \cite{Liang:2014}. The overall response time in erasure coded data-storage systems is dominated by the long tail distribution of the required parallel operations \cite{Barroso:2011}. To the best of our knowledge, quantifying the impact of erasure coding on tail latency is an open problem for distributed storage systems. Although recent research progress has been made on providing bounds of mean service latency \cite{ISIT:12,Joshi:13,lee2017mds,Tian_latency,Yu_TON}, much less is known on tail latency (i.e., $x$th-percentile latency for arbitrary $x\in[0,1]$) in erasure-coded storage systems. Mean Service latency for replication-based systems for identical servers with independent exponential service-times has been characterized for homogeneous files in \cite{gardner2016understanding}. However, the problem for erasure-coded based systems is still an open problem. To provide an upper bound on mean service latency of homogeneous files, {\em Fork-join queue analysis} in \cite{Makowski:89,JK13,LK13,Joshi:13,CS14,KumarTC14} provides upper bounds for mean service latency by forking each file request to all storage nodes. In a separate line of work, {\em Queuing-theoretic analysis} in \cite{ISIT:12,lee2017mds} proposes a {\em block-$t$-scheduling} policy that only allows the first $t$ requests at the head of the buffer to move forward. However, both approaches fall short of quantifying tail latency due to a {\em state explosion} problem, because states of the corresponding queuing model must encapsulate not only a snapshot of the current system including chunk placement and queued requests but also past history of how chunk requests have been processed by individual nodes. Later, mean latency bounds for arbitrary service time distribution and heterogeneous files are provided in \cite{Tian_latency,Yu_TON} using order statistic analysis and a probabilistic request scheduling policy. The authors in \cite{li2016mean} used probabilistic scheduling with uniform probabilities and exponential service times to show improved latency performance of erasure coding as compared to replication in the limit of large number of servers for replication-based systems. While reducing mean latency is found to have a positive impact on pushing down the latency envelop (e.g., reducing the 90th, and 99th percentiles) \cite{Liang:2014}, quantifying and optimizing tail latency for erasure-coded storage is still an open problem. In this paper, we propose an analytical framework to quantify tail latency in distributed storage systems that employ erasure codes to store files. This problem is challenging because (i) tail latency is significantly skewed by performance of the slowest storage nodes; (ii) a joint chunk scheduling problem needs to be solved on the fly to decide $n$-choose-$k$ chunks/servers serving each file request; and (iii) the problem is further complicated by the dependency and interference of chunk access times of different files on shared storage servers. Toward this end, we make use of probabilistic scheduling proposed in \cite{Tian_latency,Yu_TON,Yu-CCGRID,Yu-ICDCS,Yu-TCC16,Sprout}. Upon the arrival of each file request, we randomly dispatch a batch of $k$ chunk requests to $k$-out-of-$n$ storage nodes selected with some predetermined probabilities. Then, each storage node manages its local queue independently and continues processing requests in order. A file request is completed if all its chunk requests exit the system. This probabilistic scheduling policy allows us to analyze the (marginal) queuing delay distribution of each storage node and then combine the results (through Laplace Stieltjes Transform and order statistic bounds) to obtain an upper bound on tail latency in closed-form for general service time distributions. The tightest bound is obtained via an optimization over all probabilistic schedulers and all Markov bounds on tail probability. The proposed framework provides a mathematical crystallization of tail latency, illuminating key system design tradeoffs in erasure-coded storage. Prior evaluation of practical systems show that the latency spread is significant even when data object sizes are in the order of megabytes \cite{Liang:2014}. To tame tail latency in erasure coded storage, we propose an optimization problem to jointly minimize the sum probability that service latency of each file exceeds a given threshold. This optimization is carried out over three dimensions: the joint placement of all files, all probabilistic schedulers, and the auxiliary variables in the tail latency bounds. We note that the probabilistic scheduler helps decrease the differentiated tail latency of the files as compared to accessing the lowest-queue servers which is important for overall tail latency of files. Since data chunk transfer time in practical systems follows a shifted exponential distribution \cite{Yu_TON,CS14,Yu-TON16}, we show that under this assumption, the tail latency optimization can be formulated in closed-form as a non-convex minimization. To solve the problem, we prove that it is convex in two of the optimization variables and propose an alternating optimization algorithm, while the optimization with respect to file placement can be solved optimally using bipartite matching Extensive simulations shows significant reduction of tail latency for erasure-coded storage systems using the proposed optimization over five different baseline strategies. The main contributions of this paper are summarized as follows: \begin{itemize}[leftmargin=*] \item We propose an analytical framework to quantify tail latency for arbitrary erasure-coded storage systems and service time distributions. \item When chunk transfer time follows shifted-exponential distribution, we formulate a weighted latency tail probability optimization that simultaneous minimizes tail latency of all files by optimizing the system over three dimensions: chunk placement, auxiliary variables, and the scheduling policy. \item We develop an alternating optimization algorithm which is shown to converge to a local optima for the tail latency optimization. Two of the subproblems are convex, while bipartite matching is used to solve the third subproblem. Significant tail latency reduction up to a few orders of magnitude is validated through numerical results. \end{itemize} The rest of the paper is organized as follows. Section II gives the system model for the problem. Section III finds an upper bound on tail latency through probabilistic scheduling and Laplace Stieltjes transform of the waiting time from each server. Section IV formulates and solves the tail latency optimization. Section V presents our numerical results and Section VI concludes the paper. \section{System Model} We consider a data center consisting of $m$ heterogeneous servers, denoted by $M={1,2,...,m}$, also called storage nodes. To distributively store a set of $r$ files, indexed by $i=1,2,...r$, we partition each file $i$ into $k_i$ fixed-size chunks and then encode it using an $(n_i, k_i)$ MDS erasure code to generate $n_i$ distinct chunks of the same size for file $i$. The encoded chunks are assigned to and stored on $n_i$ distinct storage nodes, represented by a set $S_i$ of storage nodes, satisfying $S_i \subseteq M$ and $n_i=\vert S_i \vert$. The use of $(n_i, k_i)$ MDS erasure code allows the file to be reconstructed from any subset of $k_i$-out-of-$n_i$ chunks, whereas it also introduces a redundancy factor of $n_i/k_i$. Thus, upon the arrival of each file request, $k_i$ distinct chunks are selected by a scheduler and retrieved to reconstruct the desired file. Figure~\ref{sys} illustrates a distributed storage system with 7 nodes. Three files are stored in the system using $(6,4)$, $(5,3)$, and $(3,2)$ erasure codes, respectively. File requests arriving at the system are jointly scheduled to access $k_i$-out-of-$n_i$ distinct chunks. Prior work analyzing erasure-coded storage systems mainly focus on mean latency, including two approaches using queuing-theoretic analysis in \cite{ISIT:12,lee2017mds} and fork-join queue analysis in \cite{Makowski:89,JK13,LK13,Joshi:13,CS14,KumarTC14}. \begin{figure*} \begin{center} \includegraphics[width=0.75\textwidth]{sys.pdf} \caption{An illustration of a distributed storage system equipped with $7$ nodes and storing $3$ files using different erasure codes.} \label{sys} \end{center} \end{figure*} However, both approaches fall short of quantifying tail latency, because states of the corresponding queuing model must encapsulate not only a snapshot of the current system including chunk placement and queued requests, but also past history of how chunk requests have been processed by individual nodes. This leads to a {\em state explosion} problem as practical storage systems usually handle a large number of files and nodes \cite{Yu_TON}. To the best of our knowledge, quantifying tail latency for erasure-coded storage system is still an open problem because of challenges in joint request scheduling (i.e., selecting $n$-choose-$k$ chunks for each request on the fly with the goal of minimizing tail latency) as well as the dependency of straggling fragments on hot storage nodes. Consider the erasure-coded storage system storing 3 files, as shown in Figure~\ref{sys}. It is easy to see that a simple scheduling policy that accesses available chunks with equal probability lead to high tail latency, which is determined by hot storage nodes (i.e., nodes 1 and 5 in this case) with slowest performance. Yet, a policy that load-balances the number of requests processed by each server does not necessarily optimize tail latency of all files, which employ different erasure codes resulting in different impact on service latency. Assuming that chunk transfer time from all storage nodes have the same distribution, file 1 using $(6,4)$ code could still have much higher tail latency than file 3 that uses $(3,2)$ code, since its service time of each file request is determined by the slowest of the 4 selected chunks (rather than 2 selected chunks). In this paper, we use the Probabilistic Scheduling from \cite{Yu_TON,Tian_latency}, which is a probabilistic scheduling policy: 1) dispatches each batch of chunk requests (corresponding to the same file request) to appropriate a set of nodes (denoted by set $A_i$ of servers for file $i$) with predetermined probabilities ($P(A_i) $ for set $A_i$ and file $i$); 2) each node buffers requests in a local queue and processes in order. The authors of \cite{Yu_TON,Tian_latency} have shown that a probabilistic scheduling policy with feasible probabilities $\{P(A_i): \forall i,A_i\}$ exists if and only if there exists conditional probabilities $\pi_{i,j} \in [0,1],\forall i,j$ satisfying $$ \sum_{j=1}^m\pi_{i,j}=k_i \quad \forall i \quad \text{ and } \quad \pi_{i,j}=0\ \text{ if } \ j \notin S_i. $$ Consider the example shown in Figure~\ref{sys}. Under probabilistic scheduling, upon the arrival of a file 1 request, we randomly select $k_1=4$ nodes (from $\{1,2,3,5,6,7\}$) with available file chunks with respect to known probabilities $\{\pi_{1,j}, \ \forall j\}$ and dispatch a chunk request to each selected storage node. Then, each storage node manages its local queue independently and continues processing requests in order. The file request is completed if all its chunk requests are processed by individual nodes. While this probabilistic scheduling is used to provide an upper bound on mean service time in \cite{Yu_TON,Tian_latency}, we extend the policy and provide an analytical model for tail latency, enabling a novel tail latency optimization. We will now describe a queueing model of the distributed storage system. We assume that the arrival of client requests for each file $i$ form an independent Poisson process with a known rate $\lambda_i$. We consider chunk service time $X_j$ of node $j$ with arbitrary distributions, whose statistics can be obtained inferred from existing work on network delay \cite{WK,AY11} and file-size distribution \cite{Corbett:2004,Calder:2011}. Under MDS codes, each file $i$ can be retrieved from any $k_i$ distinct nodes that store the file chunks. We model this by treating each file request as a batch of $k_i$ chunk requests, so that a file request is served when all $k_i$ chunk requests in the batch are processed by distinct storage nodes. Even though the choice of codes for different files can be different, we assume that the chunk size is the same for all files. All requests are buffered in a common queue of infinite capacity. \begin{table}[ht] \centering \caption{Main notations Used in this paper} \label{my-label} \resizebox{.48\textwidth}{!}{ \begin{tabular}{cc} \hline \hline Symbol & Meaning \\ \hline $r$ & Number of files in system by $i=1,2,...,r $ \\ $m$ & Number of storage nodes \\ ($n_i, k_i$) & Erasure code parameters for file $i$ \\ $\lambda_i$ & Arrival rate of file $i$ \\ $\pi_{ij}$ & Probability of retrieving chunk of file $i$ from node $j$ \\ $L_i$ & Latency of retrieving file $i$ \\ $x$ & Parameter indexing latency tail probability \\ $Q_j$ & Sojourn Time of node $j$ \\ $X_j$ & Chunk Service Time of node $j$ \\ $M_j(t)$ & Moment Generating Function for the service time of node $j$ \\ $\mu_j$ & Mean service time of node $j$ \\ $\Lambda_j$ & Arrival rate on node $j$ \\ $\rho_j$ & Request intensity at node $j$ \\ $S_i$ &Set of storage nodes having chunks from file $i$\\ $A_i $ & Set of nodes used to provide chunks from file $i$ \\ $(\alpha_j,\beta_j)$ & Parameters of Shifted Exponential distributed\\& service time at node $j$\\ $\omega_i$ & weight of file $i$ \\ \hline \hline \end{tabular}} \end{table} \section{Optimizing Weighted Latency Tail Probability} Now we formulate a joint latency tail probability optimization for multiple, heterogeneous files. Since the latency tail probability is given by $\Pr(L_i \ge x)$ for $x> \max_j \beta_j$, we consider an optimization that minimizes {\em weighted latency tail probability} of all files, defined by \begin{eqnarray} \sum_i \omega_i\Pr(L_i \ge x), \end{eqnarray} where $\omega_i = \frac{\lambda_i}{\sum_i \lambda_i}$ is a positive weight assigned to file $i$ so that the files with larger arrival rates are weighted higher, and latency tail probability of file-$i$ service time is $\Pr(L_i \ge x)$. We consider the proposed bound on the latency tail probability to have the objective function as \begin{eqnarray} \sum_i \lambda_i\left (\sum_{j}\frac{\pi_{ij}}{e^{t_j x}} \frac{(1-\rho_j)t_j M_j(t_j)}{t_j - \Lambda_j (M_j(t_j)-1)} \right). \end{eqnarray} Let $\bm \pi = \{\pi_{i,j} \forall i,j\}$, ${\mathbf t}=\{t_j \forall j\}$, and ${\bm{ \mathcal{S} }} = \{\mathcal{S}_{i} \forall i\}$. We consider the following Weighted Latency Tail Probability (WLTP) optimization problem over the scheduling probabilities $\bm \pi$, the placement of files ${\bm{ \mathcal{S} }}$, and auxiliary parameters ${\mathbf t}$, i.e., \begin{eqnarray} &\min& \sum_{j}\Lambda_j{e^{-t_j x}} \frac{(1-\rho_j)t_j M_j(t_j)}{t_j - \Lambda_j (M_j(t_j)-1)} \label{objeq} \\ &s.t.&\Lambda_j=\sum_i \lambda_{i}\pi_{ij}\label{formf}\\ && M_j(t) = \frac{\alpha_j}{\alpha_j-t}e^{\beta_j t}\label{mjt}\\ && \rho_j = \frac{\Lambda_j}{\alpha_j}+\Lambda_j \beta_j \label{opt_1}\\ &&\sum_j\pi_{i,j} =k_i \label{opt_3}\\ && \pi_{i,j}=0, j\notin \mathcal{S}_{i} \label{rhocon}\\ &&\pi_{i,j}\in [0,1] \label{opt_5}\\ &&\left|\mathcal{S}_{i}\right|=n_{i}\,,\,\,\left|\mathcal{A}_{i}\right|=k_{i}\,\,\,\text{\ensuremath{\forall}i} \label{plc}\\ && t_j\ge 0\label{tjo}\\ && \!\!\!\! t_j(t_j - \alpha_j + \Lambda_j) +\Lambda_j \alpha_j (e^{\beta_j t_j}-1)<0 \label{forml}\\ &var.& \bm \pi, {\mathbf t}, {\bm{ \mathcal{S} }} \end{eqnarray} Here, Constraint (\ref{formf}) gives the aggregate arrival rate $\Lambda_j$ for each node under give scheduling probabilities $\pi_{i,j}$ and arrival rates $\lambda_i$, Constraint (\ref{mjt}) defines moment generating function with respect to parameter $t_j$, Constraint (\ref{opt_1}) defines the traffic intensity of the servers, Constraints (\ref{opt_3}-\ref{opt_5}) guarantee that the scheduling probabilities are feasible, and finally, the moment generating function exists due to the technical constraint in (\ref{forml}). If (\ref{forml}) is satisfied, $\rho_j<1$ holds too thus ensuring the stability of the storage system (i.e., queue length does not blow up to infinity under given arrival rates and scheduling probabilities). We note that $t_j>0$ can be equivalently converted to $t_j\ge 0$ (and thus done in \eqref{tjo}) since $t_j=0$ do not satisfy $t_j(t_j - \alpha_j + \Lambda_j) +\Lambda_j \alpha_j (e^{\beta_j t_j}-1)<0$ and has already been accounted for. We note that the the optimization over $\bm \pi$ helps decrease the weighted tail latency probability and gives significant flexibility over choosing the lowest-queue servers for accessing the files. The placement of the files ${\bm{ \mathcal{S} }}$ helps separate the highly accessed files on different servers thus reducing the objective. Finally, the optimization over the auxiliary variables ${\mathbf t}$ gives a tighter bound on the weighted latency tail probability. \begin{remark} The proposed WLTP optimization is non-convex, since Constraint (\ref{forml}) is non-convex in ($\bm \pi$, ${\mathbf t}$). Further, the content placement ${\bm{ \mathcal{S} }}$ has integer constraints. \end{remark} To develop an algorithmic solution, we prove that the problem is convex individually with respect to the optimization variables ${\mathbf t}$ and ${\bm \pi}$, when the other variables are fixed. This result allows us to propose an alternating optimization algorithm for the problem. The next result shows the the problem is convex in ${\mathbf t} = (t_1, t_2, \cdots, t_m)$. \begin{theorem} The objective function, $\sum_{j}\frac{\Lambda_j}{e^{t_j x}} \frac{(1-\rho_j)t_j M_j(t_j)}{t_j - \Lambda_j (M_j(t_j)-1)}$ is convex in ${\mathbf t} = (t_1, t_2, \cdots, t_m)$ in the region where the constraints in \eqref{formf}-\eqref{forml} are satisfied. \end{theorem} \begin{proof} We note that inside the summation, the term only depends on a single value of $t_j$. Thus, it is enough to show that $ \frac{t_j e^{-t_j x}M_j(t_j)}{t_j - \Lambda_j (M_j(t_j)-1)}$ is convex with respect to $t_j$. Since there is only a single index $j$ here, we ignore this subscipt for the rest of this proof. We denote \begin{eqnarray} F(t)&=&\frac{te^{-t x}M(t)}{t- \Lambda (M(t)-1)}\\ &=&\frac{\alpha t e^{(\beta-x)t}}{-t^2+(\alpha-\Lambda)t+\Lambda\alpha-\Lambda\alpha e^{\beta t}}\\ &=&\frac{\alpha t e^{(\beta-x)t}}{-t^2+(\alpha-\Lambda)t-\Lambda\alpha (e^{\beta t}-1)}\\ &=&\frac{\alpha t e^{(\beta-x)t}}{-t^2+(\alpha-\Lambda)t-\Lambda\alpha \sum_{u=1}^\infty\frac{(\beta t)^u}{u!}}\\ &=&\frac{\alpha e^{(\beta-x)t}}{-t+(\alpha-\Lambda)-\Lambda\alpha \sum_{u=1}^\infty\frac{(\beta)^u t^{u-1}}{u!}} \end{eqnarray} Thus, $F(t)$ can be written as product of $f(t) = \alpha e^{(\beta-x)t}$ and $g(t)= \frac{1}{h(t)}$, where $h(t) = -t+(\alpha-\Lambda)-\Lambda\alpha \sum_{u=1}^\infty\frac{(\beta)^u t^{u-1}}{u!}$. Since the constraints in \eqref{formf}-\eqref{forml} are satisfied, $h(t)> 0$. Further, all positive deriavatives of $h(t)$ are non-positive. Let $w(t) = -h'(t)$. Then, $w(t)\ge 0$, and $w'(t)\ge 0$. Further, we have \begin{eqnarray} g(t)&=&\frac{1}{h(t)}\nonumber\\ g'(t)&=&\frac{w(t)}{h^2(t)}\nonumber\\ g''(t)&=&\frac{h(t)w'(t)+2w^2(t)}{h^3(t)}. \end{eqnarray} \fontsize{10.4}{12.5}\selectfont Using these, $ F''(t)$ is given as \begin{eqnarray} &&F''(t)\nonumber\\ &=&f''(t)g(t)+f(t)g''(t)+2f'(t)g'(t)\nonumber\\ &=&\alpha e^{(\beta-x)t}\left(((\beta-x)^2 g(t)+g''(t)+2(\beta-x)g'(t))\right)\nonumber\\ &=&\frac{\alpha e^{(\beta-x)t}}{h^3(t)}\left((\beta-x)^2 h^2(t)+h(t)w'(t)+2w^2(t)\right.\nonumber\\ &&\left. +2(\beta-x)w(t)h(t)\right)\nonumber\\ &=&\frac{\alpha e^{(\beta-x)t}}{h^3(t)} \left(2\left(\frac{(\beta-x)h(t)}{2}+w(t)\right)^2 +h(t)w'(t) \right.\nonumber\\&&\left.+\frac{(\beta-x)^2h^2(t)}{4} \right)\nonumber\\ &\ge& 0, \end{eqnarray} where the last step follows since $h(t)\ge 0$, and $w'(t)\ge 0$. Thus, the objective function is convex in ${\mathbf t} = (t_1, t_2, \cdots, t_m)$. \end{proof} \fontsize{10.8}{13}\selectfont The next result shows that the proposed problem is convex in ${\bm \pi} = (\pi_{ij} \forall i=1, \cdots, r, j = 1,\cdots, m)$. \begin{theorem} The objective function, $\sum_{j}\frac{\Lambda_j}{e^{t_j x}} \frac{(1-\rho_j)t_j M_j(t_j)}{t_j - \Lambda_j (M_j(t_j)-1)}$ is convex in ${\bm \pi} = (\pi_{ij} \forall (i,j))$. \end{theorem} \begin{proof} Since the sum of convex functions is convex, it is enough to show that $\Lambda_j \frac{(1-\rho_j)}{t_j - \Lambda_j (M_j(t_j)-1)}$ is convex. Since $\Lambda_j$ is a linear function of ${\bm \pi}$, it is enough to prove that $\Lambda_j \frac{(1-\rho_j)}{t_j - \Lambda_j (M_j(t_j)-1)}$ is convex in $\Lambda_j $. Let $H_j = \frac{1-\rho_j }{1 - \Lambda_j (M_j(t_j)-1)/t_j}$. We need to show that $\Lambda_j H_j$ is convex in $\Lambda_j $. We will first show that $H_j$ is increasing and convex in $\Lambda_j $. We note that $H_j$ can be written as \begin{equation} H_j = \frac{1-\Lambda_j C_1}{1-\Lambda_j C_2}, \end{equation} where $C_1 = \frac{1}{\alpha_j}+\beta_j$ and $C_2 = \frac{M_j(t_j)-1}{t_j}$. Further $C_2\ge C_1$ since $M_j(t_j) -1 = {\mathbb E}[e^{t_jX_j}]-1 \ge {\mathbb E}[1+{t_jX_j}] -1 = t_j{\mathbb E}[{X_j}] = t_j\left(\frac{1}{\alpha_j}+\beta_j\right)$. Differentiating $H_j$ w.r.t. $\Lambda_j$, we have \begin{eqnarray} \frac{\delta}{\delta \Lambda_j} H_j &=& \frac{C_2-C_1}{(1-\Lambda_j C_2)^2}\ge 0\\ \frac{\delta^2}{\delta \Lambda_j^2} H_j &=& 2C_2\frac{C_2-C_1}{(1-\Lambda_j C_2)^3} \ge 0. \end{eqnarray} Thus, $H_j$ is an increasing convex function of $\Lambda_j$. Since $\Lambda_j$ is also an increasing convex function of $\Lambda_j$ and the product of two increasing convex functions is convex, the result follows. \end{proof}
{'timestamp': '2017-03-27T02:05:32', 'yymm': '1703', 'arxiv_id': '1703.08337', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08337'}
arxiv
\section{Introduction} \label{sec:intro} Face recognition (FR) is one of the most demanding computer vision tasks, due to its practical use in numerous applications, such as biometric, surveillance and human-machine interaction. The state-of-the-art FR methods \cite{taigman2014deepface, schroff2015facenet, sun2015deepid3, parkhi2015deep, baiduliu2015} surpassed human performance (97.53\%) and achieved significant accuracy on the standard labeled faces in the wild (LFW) \cite{lfw_huang2014} benchmark. These remarkable results are achieved by training the deep convolutional neural network (CNN) \cite{recentcnngu2015} with large databases \cite{mscelebguo16, parkhi2015deep, yi2014learning, umdfacesbansal2016}. The facial image databases mostly provide the identity labels. These labels allow the CNN models to be easily trained with the softmax loss. FR methods generally use the trained CNN model to extract facial features and then perform verification by computing distance or recognition with a classifier. However, from our extensive study (see Sect. \ref{sec:rel_work}), we observe that recent methods include different additional strategies to obtain better performance, such as: \begin{enumerate} \item \textit{train CNN with different loss functions \cite{schroff2015facenet, sun2015deepid3}:} requires carefully preparing the image pairs/triplets by maintaining certain constrains \cite{schroff2015facenet}, because arbitrary pairs/triplets do not contribute to the training. Online triplet generation requires a larger batch size (e.g., \cite{schroff2015facenet} used 1.8K images in a mini-batch with 40 images/identity), which is excessive for a limited resource machine. On the other hand, using offline triplets can be critical as many of them will be useless while training progresses. The joint optimization \cite{sun2015deepid3} with Softmax and Contrastive losses not only requires specific training data (with identity and pair labels) but also complicates the training procedure. \item \textit{fine-tune CNN:} requires training on each target dataset, which restricts the ability to generalize. \item \textit{metric learning \cite{Sankaranarayanan2016a, ding2015robust}:} requires particular form of training data (e.g., triplets). Moreover, it does not always guarantee to enhance performance \cite{wang2016face}. \item \textit{concatenating features from multiple CNNs \cite{sun2015deepid3, baiduliu2015}:} requires additional training data of different forms and train CNNs for each form. Besides, it is necessary to explore the particular modalities that can contribute to enhance performance. \end{enumerate} The use of the above strategies requires significant efforts in terms of data preparation or selection and computing resources. On the other hand, recent results on the ImageNet challenge \cite{imagenet_ijcv} indicate that deeper CNNs enhance performance of different computer vision tasks. These observations raise the following question - \textit{can we achieve state-of-the-art results with a single CNN model which is trained only once with the identity labels?} Our research is motivated by this question and we aim to address it by developing a simple yet robust single-CNN based FR method. Moreover, we want that our once-trained single CNN based FR method generalizes well across different datasets. In this research, our primary objective is to discover an efficient CNN architecture. We follow the recent findings, which suggest that deeper CNNs perform better on a number of computer vision tasks \cite{resnethe2015deep, recentcnngu2015}. We construct a deep CNN model with 27 convolutional and 1 fully connected (FC) layers, which incorporates the residual learning framework \cite{resnethe2015deep}. Moreover, we aim to find an efficient way to train our CNN only with the identity labels. Recently, \cite{centerlosswen2016} achieves high FR performance with a CNN trained from the identity labels. However, they perform joint optimization using the softmax and center loss \cite{centerlosswen2016} (CL). CL improves the features discrimination among different classes. It follows the principle that, features learned from a deep CNN should minimize the intra-class distances. Interestingly, we observe (see Fig \ref{fig:comp_bn_cl}) that an equivalent representation can be achieved by normalizing the CNN features before computing the loss. Therefore, we train our CNN using the softmax loss with the normalized features. With our single CNN model, first we evaluate on the LFW \cite{lfw_huang2014} benchmark and observe that it obtains 99.62\% accuracy. In order to demonstrate its effectiveness, we evaluated it on different challenging face verification tasks, such as face templates matching on the IJB-A \cite{ijbaKlare2015} dataset, video faces matching on the YouTube Faces \cite{ytfwolf2011} (YTF) dataset and cross age face matching on the CACD \cite{chen2015facecacd} dataset. Our method achieves 82.4\% TAR@FAR=0.001 on IJB-A \cite{ijbaKlare2015}, 96.24\% accuracy on YTF \cite{ytfwolf2011} and 99.13\% accuracy on CACD \cite{chen2015facecacd}. These results indicate that our method achieves very competitive and state-of-the-art results. Moreover, it generalizes very well across different datasets. We summarize our contributions as follows: (a) conduct extensive study and provide (Sec \ref{sec:rel_work}) a review and methodological comparison of the state-of-the-art methods; (b) propose (Sect. \ref{sec:deepvisage}) an efficient single CNN based FR method; (c) conduct (Sect. \ref{sec:res_exp}) extensive experiments on different datasets, which demonstrate that our method has excellent generalization ability; and (d) perform (Sect. \ref{ssec:disscussion}) an in-depth analysis to identify the influences of different aspects. In the remaining part of this paper, first we study and analyze the state-of-the-art FR methods in Section \ref{sec:rel_work}, describe our proposed method in Section \ref{sec:deepvisage}, present experimental results, perform analysis of our method and discuss them in Section \ref{sec:res_exp} and finally draw conclusions in Section \ref{sec:conclusion}. \section{Related work, state-of-the-art FR methods} \label{sec:rel_work} Face recognition (FR) in unconstrained environment attracts significant interest from the community. Recent methods exploited deep CNN models and achieved remarkable results on the LFW \cite{lfw_huang2014} benchmark. Besides, numerous methods have been evaluated on the IJB-A \cite{ijbaKlare2015} dataset. We study\footnote{We consider only the CNN based methods. For the others, we refer readers to the recently published survey \cite{learned2015labeled} for LFW and \cite{ijbaKlare2015} for IJB-A.} and analyze these methods based on several key aspects: (a) details of the CNN model; (b) loss functions used; (c) incorporation of additional learning strategy; (d) number of CNNs and (e) the training database used. Recent methods tend to learn CNN based features using a \textit{deep architecture} (e.g., 10 or more layers). This is inspired from the extraordinary success on the ImageNet \cite{imagenet_ijcv} challenge by famous CNN architectures \cite{recentcnngu2015}, such as AlexNet, VGGNet, GoogleNet, ResNet, etc. The FR methods commonly use these architectures as their baseline model (directly or slightly modified). For example, AlexNet is used by \cite{Sankaranarayanan2016, Sankaranarayanan2016a, viplfacenetliu2016, allinoneranjan2016, abdalmageed2016face, masi2016pose, schroff2015facenet}, VGGNet is used by \cite{parkhi2015deep, Crosswhite2016, masi16dowe, abdalmageed2016face, masi2016pose, ding2015robust, sparsifyingsun2015} and GoogleNet is used by \cite{nanyang2016, schroff2015facenet}. CASIA-Webface \cite{yi2014learning} proposed a simpler CNN model, which is used by \cite{wang2016face, chen2016unconstrained, ding2015robust}. Several methods, such as \cite{deepid2psun2015, taigman2014deepface, webscaletaigman2015, centerlosswen2016, sun2015deepid3} use a model with lower depth but increase its complexity with locally connected convolutional layers. Besides, \cite{zhou2015naive} use 4 parallel 10 layers CNNs to learn features from different facial regions. \textit{We follow the ResNet \cite{resnethe2015deep} based deep CNN model}. FR methods often train multiple CNNs and accumulate features from all of them to construct the final facial descriptors. It provides an additional boost to the performance. Different types of inputs are used to train these multiple CNNs: (a) \cite{deepid2psun2015, sun2015deepid3, sparsifyingsun2015, wang2016face, ding2015robust, baiduliu2015} used image-crops focused on certain facial regions (eyes, nose, lips, etc.); (b) \cite{ding2015robust, abdalmageed2016face, masi2016pose, taigman2014deepface} used different modality of input images, such as 2D, 3D, frontalized and synthesized faces at different poses and (c) \cite{webscaletaigman2015, baiduliu2015} used different training databases with varying number of images. \textit{We do not follow this approach and train only one CNN}. The CNN model parameters are learned by optimizing loss functions, which are defined based on the given task (e.g., classification, regression) and the available information (e.g., class labels, price). The softmax loss \cite{recentcnngu2015} is a common choice for classification tasks. It is often used by the FR methods to create good face representation by training the CNN as an identity classifier. It requires only the identity labels. The contrastive loss \cite{recentcnngu2015, contrastive_loss} is used by \cite{deepid2psun2015, taigman2014deepface, sparsifyingsun2015, sun2015deepid3, nanyang2016} for face verification and requires face image pairs and similarity labels. The triplet loss \cite{schroff2015facenet} is used by \cite{schroff2015facenet, parkhi2015deep, Crosswhite2016, baiduliu2015} for face verification and requires the face triplets. Recently the center loss \cite{centerlosswen2016} is proposed to enhance feature discrimination, which uses the identity labels. \textit{We use the softmax loss}. Several methods use multiple loss functions and train CNN using joint optimization \cite{deepid2psun2015, sparsifyingsun2015, sun2015deepid3, centerlosswen2016, allinoneranjan2016}. The other way is to use them sequentially \cite{taigman2014deepface, parkhi2015deep, Crosswhite2016, baiduliu2015, nanyang2016}, i.e., first train with the softmax and then train with the other loss. We observe that using multiple loss functions complicates the training data preparation task and the CNN training procedure. \textit{Therefore, we avoid this type of strategies}. Fine-tuning the CNN parameters is a particular form of transfer learning. It is commonly employed by several methods \cite{wang2016face, chen2016unconstrained, Sankaranarayanan2016} on the IJB-A \cite{ijbaKlare2015} dataset. It refines the CNN parameters from a previously learned model using a target specific training dataset. Several methods do not directly use the raw CNN features but employ an additional learning strategy. The \textit{metric/distance learning} strategy based on the Joint Bayesian method \cite{chen2012bayesian} is a popular one and used by \cite{deepid2psun2015, yi2014learning, wang2016face, chen2016unconstrained, sparsifyingsun2015, sun2015deepid3, ding2015robust}. Recently, two different strategies \cite{Sankaranarayanan2016a, Sankaranarayanan2016a} have been proposed to learn feature embedding using face triplets. Another strategy, called template adaptation \cite{Crosswhite2016}, exploits an additional SVM classifier. Apart from these, principal component analysis (PCA) is used by several methods \cite{masi16dowe, abdalmageed2016face, masi2016pose} to learn a dataset specific projection matrix. \cite{nanyang2016} learns an aggregation module to compute scores among two videos. The above methods often need training data from the target datasets. Moreover, they \cite{Sankaranarayanan2016, Sankaranarayanan2016a} may need to carefully prepare the training data, e.g., triplets. \textit{We do not need any such learning strategies}. The use of a large facial training dataset is important to achieve high FR accuracy \cite{schroff2015facenet, zhou2015naive}. \cite{zhou2015naive} provided an in-depth analysis and demonstrated the effect of the dataset size and the number of identities for FR. Following the high demand of a large FR dataset, several publicly available datasets have been released recently. Among them, CASIA-WebFace \cite{yi2014learning} is used by numerous methods \cite{centerlosswen2016, Sankaranarayanan2016, Sankaranarayanan2016a, viplfacenetliu2016, allinoneranjan2016, yi2014learning, wang2016face, chen2016unconstrained, ding2015robust, wu2015lightened, masi16dowe, abdalmageed2016face, masi2016pose}. Several researches \cite{masi16dowe, abdalmageed2016face, masi2016pose} enlarge it by synthesizing facial images with different shapes and poses based on the 3D face models. Recently, the MSCeleb \cite{mscelebguo16} dataset has been publicly released. It contains the largest collection of facial images and identities. \textit{We exploit it to develop our FR method}. \section{Proposed Method} \label{sec:deepvisage} Our FR method, called \textit{DeepVisage}, consists in pre-processing face image, learning CNN based facial features and computing similarity. Following the recent trend \cite{taigman2014deepface, schroff2015facenet, sun2015deepid3, parkhi2015deep, yi2014learning}, we exploit the CNN as the core component. Our deep CNN model follows the residual learning framework \cite{resnethe2015deep}. Moreover, it intelligently exploits feature normalization, which is a crucial step, see Sect. \ref{ssec:disscussion}. Our pre-processing stage consists in the detection of the face and facial landmarks, which are used to create a normalized face image. We compute the cosine similarity among the features of a pair of faces as the verification score. Below, we describe these elements. \subsection{Building blocks and deep CNN architecture} \label{ssec:deep_cnn} \paragraph{Convolutional networks:} \label{cnn_architecture} We begin with the basic ideas of CNN \cite{lecun1998gradient}: (a) local receptive fields with identical weights via the convolution operation and (b) spatial sub-sampling via the pooling operation. At a particular layer $l$, the convolution of the input $f_{x,y}^{Op, l-1}$ to obtain the $k^{th}$ output feature map $f_{x,y,k}^{C,l}$, can be expressed as: \begin{equation} \label{eq:conv_op} f_{x,y,k}^{C, l} = {\mathbf{w}_k^l}^T f_{x,y}^{Op, l-1} + b_k^l \end{equation} where, $\mathbf{w}_k^l$ and $b_k^l$ are the shared weights and bias. $C$ denotes convolution and $Op$ (for $l>1$) denotes various tasks, such as convolution, sub-sampling or activation. For $l=1$, $Op$ represents the input image. Sub-sampling or pooling performs a simple local operation, such as computing the average or maximum value in a local spatial neighborhood followed by reducing spatial resolution. We apply max pooling for our CNN, which has the following form: \begin{equation} \label{eq:max_pool} f_{x,y,k}^{P, l} = \max_{(m,n) \in \mathcal{N}_{x,y} } f_{m,n,k}^{Op, l-1} \end{equation} where, $\mathcal{N}_{x,y}$ denotes the local spatial neighborhood of $(x,y)$ coordinate and $P$ denotes the pooling operation. In order to ensure non-linearity of the network, the feature maps are passed through a non-linear activation function, e.g., the Rectified Linear Unit (ReLU) \cite{recentcnngu2015, prelu_he2015}: $f_{x,y,k}^l = max(f_{x,y,k}^{l-1}, 0)$. We apply the Parametric Rectified Linear Unit (PReLU) \cite{prelu_he2015} as the activation function, which has the following form: \begin{equation} \label{eq:prelu} f_{x,y,k}^{A,l} = max(f_{x,y,k}^{Op, l-1}, 0) + \lambda_k min(f_{x,y,k}^{Op, l-1}, 0) \end{equation} where, $\lambda_k$ is a trainable parameter to control the slope of the linear function for the negative input values and $A$ denotes activation operation. At the basic level, a CNN is constructed by stacking series of convolution, activation and pooling layers, see LeNet-5 \cite{lecun1998gradient} for an example. Often a layer with full connections is placed at the end of the stacked layers, called the fully connected (FC) layer. It takes all points (neurons) from the previous layer as input and connects it to all points (neurons) of the output layer. \paragraph{Residual learning framework \cite{resnethe2015deep}:} \label{residual_learning} A recent trend \cite{recentcnngu2015} on the ImageNet \cite{imagenet_ijcv} challenge shows that deeper CNNs achieve better results. However, it increases the model complexity, which makes it harder to optimize the loss of the CNN model. Besides, they may generate higher training error than a shallower CNN \cite{resnethe2015deep}. The residual learning framework \cite{resnethe2015deep} provides a solution to these problems. For a stack of a few layers, residual learning fits a mapping $\mathcal{F}(f) := \mathcal{H}(f) - f$ instead of fitting the underlying mapping $\mathcal{H}(f)$. Therefore, the original mapping is formulated as $\mathcal{F}(f) + f$, which means directly adding the input feature map $f$ with the output of the stacked layers $\mathcal{F}(f)$. This idea can be easily implemented with the notion of \textit{shortcut connection}. Formally, the output of a residual block $R$ can be expressed as: \begin{equation} \label{eq:res_block_op} f_{x,y,k}^{R, l} = f_{x,y}^{Op, l-q} + \mathcal{F}(f_{x,y}^{Op, l-q}, \{W_k\}) \end{equation} where, $f_{x,y}^{Op, l-q}$ represents the input feature map, $\mathcal{F}(.)$ is the residual mapping to be learned, $W_k$ is the parameters of the $k^{th}$ residual block and $q$ is the total number of stacked layers within the residual block. The flexible form of the residual function $\mathcal{F}(.)$ allows to stack multiple layers with different types of operations, such as convolution, pooling, activation etc. All of the residual blocks in our CNN consist of two convolution layers with different numbers of neurons. Each convolution is followed by a PReLU activation. \paragraph{Loss function:} \label{loss_function} Deep CNNs are trained by optimizing loss function. We use the softmax loss, which is widely used for classification: \begin{equation} \label{eq:softmax} \mathcal{L}_{Softmax} = -\sum_{i=1}^{N}log \frac{e^{\mathbf{w}^T_{y_i}f_i + b_{y_i}}}{\sum_{j=1}^{K}e^{\mathbf{w}^T_jf_i + b_j}} \end{equation} where, $f_i$ and $y_i$ are the features and true class label of the $i^{th}$ image. $\mathbf{w}_j$ and $b_j$ denote the weights and bias of the $j^{th}$ class. $N$ and $K$ denote the number of training samples and the number of classes. \paragraph{Feature normalization (FN):} \label{feature_norm} It is often used as a necessary step in many learning algorithms. It ensures that all of the features have equal contribution to the cost function \cite{PR_book}. With deep CNNs, we cannot guarantee this by only normalizing the input image pixels, because the scale of features (from the final FC layer) may change due to a series of operations at different layers. Therefore, to avoid the influence of un-normalized features during cost computation, we provide normalized features $f^{Nr}_i$ to the softmax loss as: $f^{Nr} = \frac{f^{Op} - \mu}{\sqrt{\sigma^2}}$, where $\mu$ and $\sigma^2$ are the mean and variance. During training, we apply normalization by computing $\mu$ and $\sigma$ from the samples of each mini-batch. Moreover, we maintain the moving average of $\mu$ and $\sigma$ and use them to normalize the test samples. Note that, this is a specific case of the popular batch normalization (BN) technique \cite{batch_normalization} with scale $\gamma=1$ and shift $\beta=0$. \paragraph{Proposed CNN architecture:} \label{proposed_cnn_model} Our CNN model consists of 27 convolution (\textit{Conv}), 4 pooling (\textit{Pool}) and 1 fully connected (\textit{FC}) layers. Each convolution uses a $3\times3$ kernel and is followed by a PReLU activation function. The CNN progresses from the lower to higher depth by decreasing the spatial resolution using a $2\times2$ \textit{max Pool} layer while gradually increasing the number of feature maps from 32 to 512. We use a \textit{FC} layer of 512 neurons after the last \textit{Conv} layer. We normalize (see \textit{\textbf{FN}} above) the output of this \textit{FC} layer and consider it as the desired feature representation of the input image. Finally, we use the \textit{softmax} layer to compute the loss and optimize it during training. Our CNN model incorporates the residual learning framework \cite{resnethe2015deep}, see Fig. \ref{fig:res_block_cnn} for the details. Overall, it comprises 40.5M parameters. \begin{figure}[t] \centering \hfil \includegraphics[scale=0.16]{Res_CNN_2.png} \caption{\footnotesize{Illustration of the proposed CNN architecture. \textbf{\textit{CoPr}} indicates convolution followed by the PReLU activation function. \textbf{\textit{ResBl}} is a residual block which computes $output \; = \; input + CoPr(CoPr(input))$. \textit{\textbf{\# Replication}} indicates how many times the same block is sequentially replicated in the CNN model. \textit{\textbf{\# Filts}} denotes the number of feature maps. \textbf{\textit{FN}} denotes feature normalization.}} \label{fig:res_block_cnn} \end{figure} \subsection{Image pre-processing and face verification} \label{ssec:img_preprocess_face_verify} \paragraph{\textit{Pre-processing:}} \label{par:pre_processing} We maintain the same form of the 2D face image during training and testing. Our pre-processing steps are: (a) detect\footnote{In case of multiple faces, we take the face closer to the image center.} face and landmarks using the MTCNN \cite{mtcnnZhang2016} detector; (b) normalize the face image by applying a 2D similarity transformation. The transformation parameters are computed from the location of the detected landmarks on the image and pre-set coordinates in a 112$\times$96 image frame; and (c) convert to grayscale. \paragraph{\textit{Face verification:}} \label{par:face_ver_test} We verify a pair of face images \cite{lfw_huang2014}, templates \cite{ijbaKlare2015} (contains multiple images and video frames) and videos \cite{ytfwolf2011} (given as frames) using the following steps: \begin{enumerate} \item \textit{pre-process}: apply the pre-processing\footnote{If the landmarks detector fails we keep the face image by cropping it based on the given/detected bounding box.} stage described in the previous paragraph. \item \textit{extract facial feature/representation}: we use the trained CNN model to extract the facial feature descriptor. For an image $i$, we obtain its descriptor $f_i$ by taking element-wise maximum of the features from its original $f_{i,o}$ and horizontally flipped version $f_{i,f}$. In order to perform verification based on template \cite{ijbaKlare2015} and video \cite{ytfwolf2011}, we obtain the descriptor for an identity by taking element-wise average of the features from all of the images/frames. \item \textit{compute verification score}: for a given pair of facial features, we compute the cosine similarity as the verification score. We compare this score to a threshold to decide whether two images belong to the same person. \end{enumerate} \section{Experiments, Results and Discussion} \label{sec:res_exp} Our experiments consist of first training the CNN model and then use it to extract facial features and perform different types (single-image \cite{lfw_huang2014, chen2015facecacd}, multi-image or video \cite{ijbaKlare2015, ytfwolf2011}) of face verification. In order to verify the effectiveness, we experiment on several datasets, namely LFW \cite{lfw_huang2014}, IJB-A \cite{ijbaKlare2015}, YTF \cite{ytfwolf2011} and CACD \cite{chen2015facecacd}. \subsection{CNN Training} \label{ssec:cnn_train} We collect the training images from the cleaned\footnote{We take the list of 5.05M faces provided by \cite{wu2015lightened} and keep non-overlapping (with test set) identities which has at least 30 images after successful landmarks detection.} version of the MS-Celeb-1M \cite{mscelebguo16} database, which consists of 4.47M images of 62.5K identities. We train our CNN model using only the identity label of each image. We use 95\% images (4.2M images) for training and 5\% images (232K images) for monitoring and evaluating the loss and accuracy. We train our CNN using the \textit{stochastic gradient descent} method and \textit{momentum} set to 0.9. Moreover, we apply \textit{L2} regularization with the \textit{weight decay} set to $5e^{-4}$. We begin the CNN training with a learning rate 0.1 for 2 epochs. Then we decrease it after each epoch by a factor 10. We stop the training after 5 epochs. We use 120 images in each mini-batch. During training, we apply data augmentation by horizontally flipping the images. Note that, during evaluation on a particular dataset, we do not apply any additional CNN training or fine-tuning and dimension reduction. \subsection{Results and Evaluation} \label{ssec:res_eval} Now we evaluate our proposed FR method, called \textit{DeepVisage}, on the most commonly used and challenging facial image datasets based on their specified protocols. \paragraph{\textit{Labeled Faces in the Wild (LFW) \cite{lfw_huang2014}:}} \label{par:lfw_eval} LFW is one of the most popular and challenging databases for evaluating unconstrained FR methods. It consists of 13,233 images of 5,759 identities. It has different evaluation protocols. We follow the \textit{unrestricted-labeled-outside-data} protocol based on the recent trend \cite{learned2015labeled}. The FR task requires verifying 6000 image pairs in 10 folds and report the accuracy. These pairs are equally divided into genuine and impostor pairs and comprises 7.7K images of 4,281 identities. Table \ref{tab:lfw_comparison} provides the results of our method along with the other state-of-the-art methods. We observe that, our method achieves significant accuracy (99.62\%) and among the top performers, despite the fact that: (a) we use single CNN, whereas Baidu \cite{baiduliu2015} used 10 CNNs to obtain 99.77\% and (b) we train CNN with comparatively much less amount of data and identities, whereas FaceNet \cite{schroff2015facenet} used 200M images of 8M identities to obtain 99.63\%. \begin{table}[h] \footnotesize \centering \caption{\footnotesize{Comparison of the state-of-the-art methods evaluated on the LFW benchmark \cite{lfw_huang2014}.}} \label{tab:lfw_comparison} \begin{tabular}{|c|c|c|c|} \hline \textbf{FR method} & \textbf{\begin{tabular}[c]{@{}c@{}}\# of\\ CNNs\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Dataset\\ Info\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Acc\\ \%\end{tabular}} \\ \hline \textit{\textbf{DeepVisage (proposed)}} & 1 & 4.48M, 62K & 99.62 \\ \hline Baidu \cite{baiduliu2015} & 10 & 1.2M, 1.8K & 99.77 \\ \hline Baidu \cite{baiduliu2015} & 1 & 1.2M, 1.8K & 99.13 \\ \hline FaceNet \cite{schroff2015facenet} & 1 & 200M, 8M & 99.63 \\ \hline Sparse ConvNet \cite{sparsifyingsun2015} & 25 & 0.29M, 12K & 99.55 \\ \hline DeepID3 \cite{sun2015deepid3} & 25 & 0.29M, 12K & 99.53 \\ \hline Megvii \cite{zhou2015naive} & 4 & 5M, 0.2M & 99.50 \\ \hline LF-CNNs \cite{aifrwen2016latent} & 25 & 0.7M, 17.2K & 99.50 \\ \hline DeepID2+ \cite{deepid2psun2015} & 25 & 0.29M, 12K & 99.47 \\ \hline Center Loss \cite{centerlosswen2016} & 1 & 0.7M, 17.2K & 99.28 \\ \hline MM-DFR \cite{ding2015robust} & 8 & 0.49M, 10.57K & 99.02 \\ \hline VGG Face \cite{parkhi2015deep} & 1 & 2.6M, 2.6K & 98.95 \\ \hline MFM-CNN \cite{wu2015lightened} & 1 & 5.1M, 79K & 98.80 \\ \hline VIPLFaceNet \cite{viplfacenetliu2016} & 1 & 0.49M, 10.57K & 98.60 \\ \hline Webscale \cite{webscaletaigman2015} & 4 & 4.5M, 55K & 98.37 \\ \hline AAL \cite{aalye2016face} & 1 & 0.49M, 10.57K & 98.30 \\ \hline FSS \cite{wang2016face} & 9 & 0.49M, 10.57K & 98.20 \\ \hline Face-Aug-Pose-Syn \cite{masi16dowe} & 1 & 2.4M, 10.57K & 98.06 \\ \hline CASIA-Webface \cite{yi2014learning} & 1 & 0.49M, 10.57K & 97.73 \\ \hline Unconstrained FV \cite{chen2016unconstrained} & 1 & 0.49M, 10.5K & 97.45 \\ \hline Deepface \cite{taigman2014deepface} & 3 & 4.4M, 4K & 97.35 \\ \hline \end{tabular} \end{table} The results in the Table \ref{tab:lfw_comparison} indicates saturation, because all of the methods achieve close to or more than human performance (97.53\%). Besides, it is argued that matching only 6K pairs is insufficient to justify a method w.r.t. the real world FR scenario \cite{blufrliao2014}. We address these issues by two ways: (a) employ more challenging evaluation metrics and (b) evaluate with the other challenging datasets. To this aim, first we follow the BLUFR LFW protocol \cite{blufrliao2014} and measure the true accept rate (TAR) at a low false accept rate (FAR). BLUFR \cite{blufrliao2014} protocol exploits all images of the LFW dataset and evaluates methods based on 10 trials experiments. Each trial computes 47M pair-matching scores (157K positives, 46.9M negatives), which is significantly higher than the 6K scores used in the standard protocol. Within this protocol, we compute the verification rate (VR) at FAR=0.1\% and compare with the methods which reported results\footnote{We do not include results from Baidu \cite{baiduliu2015} (VR@FAR: 99.11\% for single CNN and 99.41\% for 10-CNNs ensembles). The reason is that, we are not sure if they compute results based on the BLUFR protocol \cite{blufrliao2014} or based on the 6K pairs. Note that, we obtain 99.7\% on VR@FAR=0.1\% using the 6K pair-matching scores of the standard protocol.} in this protocol. We observe that: $ \textit{\textbf{DeepVisage \;(proposed)}} \; (98.65) > Center Loss\footnote{Results computed from the features publicly provided by the authors.} \; \cite{centerlosswen2016} \; (92.97\%) > FSS \; \cite{wang2016face} \; (89.8\%) > CASIA \; \cite{yi2014learning} \; (80.26\%) $ , i.e., our method obtains the best results published so far. Therefore, this result together with the Table \ref{tab:lfw_comparison} confirm the remarkable performance of \textit{DeepVisage} on the LFW database. Next, we justify our method by evaluating it on the challenging IJB-A \cite{ijbaKlare2015} dataset. \paragraph{\textit{IARPA Janus Benchmark A (IJB-A) \cite{ijbaKlare2015}:}} \label{par:lfw_eval} The recently proposed IJB-A database aims at raising the difficulty of FR by incorporating more variations in pose, illumination, expression, resolution and occlusion. It consists of 5,712 images and 2,085 videos of 500 identities. The FR task compares two templates. A template is a set of images and video-frames. The evaluation protocol requires computing the true accept rate (TAR) at a fixed false accept rate (FAR) with various values, e.g., 0.01 and 0.001. Table \ref{tab:ijb_comparison} presents our results along with the other state-of-the-art methods. We separate the results (with a horizontal line) to distinguish two categories: (1) methods only using a pre-trained CNN; our method belongs to this category and (2) methods use additional learning, such as CNN fine-tuning and metric learning. From the comparison among the $1^{st}$ category of methods, we observe that, our method provides the best result for FAR at 0.001\% and competitive (second best) at 0.01\%. By comparing it to the $2^{nd}$ category we observe that, it is also very competitive and provide better results than numerous methods from this category. Besides, similar to \cite{allinoneranjan2016, Sankaranarayanan2016a}, it is possible to exploit our CNN features and further improve the final results with external learning, such as TA \cite{Crosswhite2016}, NAN \cite{nanyang2016} and TPE \cite{Sankaranarayanan2016a}. \begin{table}[t] \footnotesize \centering \caption{\footnotesize{Comparison of the state-of-the-art methods evaluated on the IJB-A benchmark \cite{ijbaKlare2015}. `-' indicates the information for the entry is unavailable. Methods which incorporates external training (ExTr) or CNN fine-tuning (FT) with IJB-A training data are separated with a horizontal line. VGG-Face result was provided by \cite{Sankaranarayanan2016}. T@F denotes the \textit{True Accept Rate at a fixed False Accept Rate (TAR@FAR)}.}} \label{tab:ijb_comparison} \begin{tabular}{|c|c|c|c|c|} \hline \textbf{FR method} & \textbf{\begin{tabular}[c]{@{}c@{}}ExTr\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}FT\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}T@F\\0.01\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}T@F\\0.001\end{tabular}} \\ \hline \textit{\textbf{DeepVisage (proposed)}} & N & N & 0.887 & 0.824\\ \hline VGG Face \cite{parkhi2015deep} & N & N & 0.805 & 0.604\\ \hline Face-Aug-Pose-Syn \cite{masi16dowe} & N & N & 0.886 & 0.725\\ \hline Deep Multipose \cite{abdalmageed2016face} & N & N & 0.787 & - \\ \hline Pose aware FR \cite{masi2016pose} & N & N & 0.826 & 0.652 \\ \hline TPE \cite{Sankaranarayanan2016a} & N & N & 0.871 & 0.766\\ \hline All-In-One \cite{allinoneranjan2016} & N & N & 0.893 & 0.787 \\ \hline \hline \hline All-In-One \cite{allinoneranjan2016} + TPE & Y & N & 0.922 & 0.823 \\ \hline Sparse ConvNet \cite{sparsifyingsun2015} & Y & N & 0.726 & 0.460\\ \hline FSS \cite{wang2016face} & N & Y & 0.729 & 0.510\\ \hline TPE \cite{Sankaranarayanan2016a} & Y & N & 0.900 & 0.813\\ \hline Unconstrained FV \cite{chen2016unconstrained} & Y & Y & 0.838 & -\\ \hline TSE \cite{Sankaranarayanan2016} & Y & Y & 0.790 & 0.590\\ \hline NAN \cite{nanyang2016} & Y & N & 0.941 & 0.881 \\ \hline TA \cite{Crosswhite2016} & Y & N & 0.939 & 0.836 \\ \hline End-To-End \cite{eteChen2015} & N & Y & 0.787 & - \\ \hline \end{tabular} \end{table} \paragraph{\textit{YouTube Faces \cite{ytfwolf2011} (YTF):}} \label{par:lfw_eval} The YTF dataset is a widely used FR dataset of unconstrained videos. It consists of 3,425 videos of 1,595 identities. YTF evaluation requires matching 5000 video pairs in 10 folds and report average accuracy. Each fold consists of 500 video pairs and ensures subject-mutually exclusive property. We follow the \textit{restricted} protocol of YTF, i.e., access to only the similarity information. We report our result in Table \ref{tab:ytf_comparison}, along with the state-of-the-art methods. Results show that our method provides the best accuracy (96.24\%). Table \ref{tab:ytf_comparison} also provides the results (separated with a horizontal line) from \textit{unrestricted} protocol, i.e., access to similarity and identity information of the test data. We observe that our method is very competitive to the best accuracy, although it follows the \textit{restricted} protocol. The VGG Face \cite{parkhi2015deep} provides results with both protocols and shows that accuracy increases significantly (from \textit{restricted}-91.6\% to \textit{unrestricted}-97.3\%) when they learn their CNN feature embedding using the YTF training data. Based on this observation, we can predict that our result (96.24\%) can be further enhanced by training or fine tuning with the YTF data. \begin{table}[h] \footnotesize \centering \caption{\footnotesize{Comparison of the state-of-the-art methods evaluated on the Youtube Face \cite{ytfwolf2011}. \textit{\textbf{Ad.Tr.}} denotes additional training is used.}} \label{tab:ytf_comparison} \begin{tabular}{|c|c|c|} \hline \textbf{FR method} & \textbf{\begin{tabular}[c]{@{}c@{}}Ad.Tr.\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}Accuracy (\%)\end{tabular}} \\ \hline \textit{\textbf{DeepVisage (proposed)}} & N & 96.24\\ \hline VGG Face \cite{parkhi2015deep} & N & 91.60\\ \hline Sparse ConvNet \cite{sparsifyingsun2015} & N & 93.50\\ \hline FaceNet \cite{schroff2015facenet} & N & 95.18 \\ \hline DeepID2+ \cite{deepid2psun2015} & N & 93.20 \\ \hline Center Loss \cite{centerlosswen2016} & N & 94.90 \\ \hline MFM-CNN \cite{wu2015lightened} & N & 93.40 \\ \hline CASIA-Webface \cite{yi2014learning} & Y & 92.24 \\ \hline Deepface \cite{taigman2014deepface} & Y & 91.40 \\ \hline \hline \hline VGG Face \cite{parkhi2015deep} & Y & 97.30\\ \hline NAN \cite{nanyang2016} & Y & 95.72 \\ \hline \end{tabular} \end{table} \paragraph{\textit{Cross-Age Celebrity Dataset (CACD) \cite{chen2015facecacd}:}} \label{par:lfw_eval} CACD is a recently released dataset, which aims to ensure large variations of the ages in the wild. It consists of 163,446 images of 2000 identities with the age range from 16 to 62. CACD evaluation requires verifying 4000 image pairs in ten folds and report average accuracy. Table \ref{tab:cacd_comparison} reports the results of \textit{DeepVisage} along with the state-of-the-art methods. It shows that our method provides the best accuracy. Moreover, it is better than LF-CNN \cite{aifrwen2016latent}, which is a recent method specialized on age invariant face recognition. \begin{table}[h] \footnotesize \centering \caption{\footnotesize{Comparison of the state-of-the-art methods evaluated on the CACD \cite{chen2015facecacd} dataset. VGG \cite{parkhi2015deep} result is obtained from \cite{wu2015lightened}.}} \label{tab:cacd_comparison} \begin{tabular}{|c|c|c|} \hline \textbf{FR method} & \textbf{\begin{tabular}[c]{@{}c@{}}Accuracy (\%)\end{tabular}} \\ \hline \textit{\textbf{DeepVisage (proposed)}} & 99.13\\ \hline LF-CNNs \cite{aifrwen2016latent} & 98.50 \\ \hline MFM-CNN \cite{wu2015lightened} & 97.95 \\ \hline VGG Face \cite{parkhi2015deep} & 96.00\\ \hline CARC \cite{chen2015facecacd} & 87.60 \\ \hline \hline Human, Avg. & 85.70 \\ \hline Human, Voting \cite{chen2015facecacd} & 94.20 \\ \hline \end{tabular} \end{table} The evaluations of \textit{DeepVisage} (proposed method) across different challenging datasets prove that it not only achieves significant performance but also generalizes very well. It overcomes several of the difficulties which make unconstrained FR a challenging task. \subsection{Analysis and Discussion} \label{ssec:disscussion} We perform further analysis to highlight the influences of several aspects, such as: (a) training datasets; (b) CNN models and depth; (c) normalization and (d) activation functions. Therefore, we modify and train our CNN model and observe the accuracy and TAR@FAR=0.01 on LFW. Table \ref{tab:analysis_discussion_db} presents the results. First, we study the influence of training the proposed CNN with different datasets. It helps us to understand the capacity of the CNN to learn facial representation and identify the requirements to achieve better performance. The top part of Table \ref{tab:analysis_discussion_db} presents the analysis w.r.t. different datasets, from which we observe that: (a) CNN performance increased by training with larger number of images as well as identities, the best results are obtained with the largest dataset, i.e., MSCeleb \cite{mscelebguo16}; (b) synthesized images help to enhance performance, we see this from the pose augmented CASIA \cite{yi2014learning, masi16dowe} dataset; (c) a dataset with more variations per identity helps even with a relatively lower number of images and identities, we see this by comparing the CASIA \cite{yi2014learning} and UMD \cite{umdfacesbansal2016} datasets; and (d) large number of images with smaller number of identities may not help, we see this from the VGG Face \cite{parkhi2015deep} dataset. Besides, we analyze the dataset uniformity or balance issue, i.e., number of images-per-identity, see bottom part of of Table \ref{tab:analysis_discussion_db}. We use the MSCeleb \cite{mscelebguo16} dataset for this experiment. We see that, while maintaining certain balance is necessary, it is equality important to train CNN with a larger dataset. We obtain the best performance by keeping only the identities with 30 images or more. \begin{table}[t] \footnotesize \centering \caption{\footnotesize{Analysis of the influences from training databases, size and number of classes. T@F denotes the \textit{True Accept Rate at a fixed False Accept Rate (TAR@FAR)}.}} \label{tab:analysis_discussion_db} \begin{tabular}{|c|c|c|c|c|} \hline \textbf{Aspect} & \textbf{Add. info} & \textbf{\begin{tabular}[c]{@{}c@{}}Acc\\\%\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}T@F\\0.01\end{tabular}}\\ \hline \hline \hline \textit{\textbf{DB}} & \textbf{\textit{Size, Class}} & &\\ \hline CASIA \cite{yi2014learning} & 0.43M, 10.6K & 99.00 & 0.988 \\ \hline Pose-CASIA \cite{masi16dowe} & 1.26M, 10.6K & 99.15 & 0.992 \\ \hline UMDFaces \cite{umdfacesbansal2016} & 0.34M, 8.5K & 99.15 & 0.992 \\ \hline VGG Face \cite{parkhi2015deep} & 1.6M, 2.6K & 98.40 & 0.975 \\ \hline MSCeleb \cite{mscelebguo16} & 4.2M, 62.5K & 99.62 & 0.997 \\ \hline \hline \hline \textit{\textbf{Min samp/id}} & \textbf{\textit{Size, Class}} & &\\ \hline 10 & 4.48M, 62.7K & 99.56 & 0.996 \\ \hline 30 & 4.47M, 62.5K & 99.62 & 0.997 \\ \hline 50 & 3.91M, 47.3K & 99.60 & 0.997 \\ \hline 70 & 3.11M, 33K & 99.55 & 0.996 \\ \hline 100 & 1.5M, 12.7K & 99.23 & 0.991 \\ \hline \end{tabular} \end{table} Next, we analyze the results based on different CNN components and models. Table \ref{tab:analysis_discussion_cnn} and Fig. \ref{fig:roc_det_plot} present the results with different forms, where we train all settings with the CASIA \cite{yi2014learning} dataset. Our observations are: (a) the proposed CNN model obtains better performance by including feature normalization (FN) before loss computation, we see this by comparing with the center loss \cite{centerlosswen2016} and without FN based results and (b) it obtains better accuracy than the other commonly used CNNs (for FR), such as the VGG-Net \cite{parkhi2015deep} and CASIA-Net \cite{yi2014learning}. Note that, we do not directly compare with other loss functions (within our CNN model) as the center loss \cite{centerlosswen2016} has been shown to be more efficient than those. Additionally, we trained our CNN with ReLU instead of PReLU and observe that it decreases accuracy by approximately 0.5\%. In terms of complexity (measured with the number of parameters in Table \ref{tab:analysis_discussion_cnn}), our model is more complex than the simpler models (Cas-Net and CN-mod). However, it is much simpler than the VGG-Net \cite{parkhi2015deep}. Results indicate that, while a simpler model may limit\footnote{We train the CN-mod (see Table \ref{tab:analysis_discussion_cnn}) with the MSCeleb dataset and observed that, compared to our proposed CNN model CN-mod provides lower results and generalizes poorly.} the FR performance, a complex model is prone to overfitting. Perhaps this is the reason why the VGG-Net \cite{parkhi2015deep} requires additional fine-tuning on the target datasets. The above analyses justify the efficiency of our proposed CNN model. \begin{figure}[t] \centering \includegraphics[scale=0.4]{roc_LFW_up2.pdf} \caption{\footnotesize{Illustration of the ROC plots for different CNN models evaluates on the LFW \cite{lfw_huang2014} dataset.}} \label{fig:roc_det_plot} \end{figure} \begin{table}[h] \footnotesize \centering \caption{\footnotesize{Study the influences from CNN related issues. All CNN models are trained with the CASIA \cite{yi2014learning} dataset. CL- center loss \cite{centerlosswen2016}, FN- feature normalization. \textit{\textbf{CN-mod}} modifies the \textit{\textbf{Cas-Net}} \cite{yi2014learning} by replacing \textit{Pool} layer with a \textit{FC} layer of 512 neurons.}} \label{tab:analysis_discussion_cnn} \begin{tabular}{|c|c|c|c|} \hline \textbf{Settings} & \textbf{\textit{\# params}} & \textbf{\begin{tabular}[c]{@{}c@{}}Acc\\ \%\end{tabular}} & \textbf{\begin{tabular}[c]{@{}c@{}}T@F\\0.01\end{tabular}}\\ \hline Base-CNN (\textit{\textbf{proposed}}) & 40.5M & 99.00 & 0.988 \\ \hline Base-CNN - FN & 40.5M & 97.40 & 0.954 \\ \hline Base-CNN + CL - FN & 44.8M & 98.85 & 0.986 \\ \hline VGG-Net \cite{parkhi2015deep} & 182M & 95.15 & 0.883 \\ \hline Cas-Net \cite{yi2014learning} & 6M & 97.10 & 0.938 \\ \hline CN-mod & 8M & 97.50 & 0.956 \\ \hline \end{tabular} \end{table} We observe that, feature normalization (FN) before the loss computation plays a significant role in the performance. In order to gain further insights, we conduct experiments and visualize the features of the MNIST digits in the 2D space. This is similar to the visualization recently shown in \cite{centerlosswen2016} and hence we also provide a comparison with the center loss (CL). The CNN is composed of 6 convolution, 2 pool and 1 FC (with 2 neurons for 2D visualization) layers. We optimize it using the softmax loss. Fig. \ref{fig:comp_bn_cl} provides the illustration, from which we observe that: (a) FN provides a better feature discrimination in the normalized 2D space, see Fig. \ref{fig:comp_bn_cl}-b; (b) CL enforces the features towards its representative center and hence shows discrimination, see Fig. \ref{fig:comp_bn_cl}-c and (c) CL+FN does not provide much additional discrimination, see Fig. \ref{fig:comp_bn_cl}-b and Fig. \ref{fig:comp_bn_cl}-d. These observations reveal that, by exploiting the FN appropriately we can ensure feature discrimination and hence no additional loss function, e.g., CL, is necessary. \begin{figure}[h] \centering \includegraphics[scale=0.23]{BN_CL_Comp.pdf} \caption{\footnotesize{2D visualization of the MNIST \cite{lecun1998gradient} digits features, which are obtained by using same baseline CNN model and training settings. CL \cite{centerlosswen2016} parameters are set to $\lambda=0.003$ and $\alpha=0.5$. \textbf{a.} CNN without FN and CL; \textbf{b.} CNN with FN; \textbf{c.} CNN with CL; and \textbf{d.} CNN with FN and CL.}} \label{fig:comp_bn_cl} \end{figure} Finally, we investigate the incorrect results by observing the face image pairs in which \textit{DeepVisage} failed. \textit{Appendix} \ref{sec:error_analysis} provides the illustrations of the false accept/reject cases from the different datasets. We observe that, on LFW it failed (11/20 error cases) when the eyes are occluded by glasses or a cap. Incorrect CACD results and higher false rejection rate indicate that our method (although provides best accuracy) encounters difficulties to recognize the same person from the images of different ages. Incorrect results from YTF often suffers from high pose and perhaps low image resolution. IJB-A results reveal that our method needs to take care of the face images with extreme pose variations. Indeed, during the IJB-A experiments, we are forced to keep a large number of images as un-normalized due to the failure of landmarks detection for them. Based on empirical evidences, we believe that these un-normalized faces cause the degradation of our performance. Besides, the results from YTF and IJB-A indicate that we may need to use a better distance computation strategy. \section{Conclusion} \label{sec:conclusion} In this paper we present a single-CNN based FR method which achieves state-of-the-art performance and exhibits excellent ability of generalize across different FR datasets. Our method, called \textit{DeepVisage}, performs face verification based on a given pair of single images, templates and videos. It consists in a deep CNN model which is simple and straightforward to train. Overall, \textit{DeepVisage} is very easy to implement, thanks to the residual learning framework, feature normalization, softmax loss and the simplest distance. It successfully demonstrates that, in order to achieve state-of-the-art results it is not necessary to develop a complicated FR method by using complex training data preparation and CNN learning procedure. We foresee several future perspectives of this work, such as: (a) train CNN with a larger and more balanced dataset, which can be constructed by combining multiple publicly available datasets or by adopting the face synthesizing strategy \cite{masi16dowe} with the existing one; (b) enhance FR performance by incorporating failure detection based technique \cite{steger2016failure}, particularly for face and landmarks detection and (c) incorporate better distance computation method for the template and video comparison, e.g., use softmax based distance \cite{masi16dowe}.
{'timestamp': '2017-04-10T02:05:31', 'yymm': '1703', 'arxiv_id': '1703.08388', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08388'}
arxiv
\section{Introduction} \label{introduction} \subsection{Introduction} Penetration rate of communicating vehicles is expected to increase in the next years. Compared to in-road detectors and video sensors, a wireless road side unit (RSU) can collect more detailed vehicle data such as location, speed and acceleration rate, more than once a second, on some hundred meters range and probably at lower cost \cite{Florin:2015:SVC:2991309.2991354}. This new amount of high resolution data provided by V2X communication enables new traffic signal controls. We present a new reactive algorithm based on V2I communications using WAVE/IEEE 802.11p protocol. Simulation for road traffic and communication networking has been conducted using VEINS framework \cite{sommer2011bidirectionally}. This simulation framework led to a performance study of both road traffic and communication protocols. We show that the gain in road traffic performance is significant most of the time, especially in the case of a high penetration rate for vehicles and junctions. \subsection{State of the art} In the field of traffic signal control based on vehicular communication, several approaches have been developed in the few last years \cite{goodall2013traffic} : over-saturation algorithms which tend to avoid blockages by using V2I communication, gap-out algorithms which terminate the phase green if no vehicle is detected during a gap-out time, and platoon based algorithms which use vehicle clustering to provide acyclic timing plans. Some other approaches tend to minimize cumulative delays. In \cite{Agbolosu-Amison2012}, a dynamic gap-out algorithm has been presented. Total vehicular delays are minimized and the optimization determines ``phase sequence, phase green times, and gap-out times (both dynamic and regular gap-outs).'' In \cite{6644993}, a reactive control based on VANET communication is detailed. Different weights are assigned to vehicles depending on their distance to the junction. A timing plan is then computed and applied using these weights. Some papers have finely evaluated performances of WAVE/IEEE 802.11.p protocols \cite{4640898}, some of them comparing pros and cons of WAVE and alternatives such as LTE \cite{HameedMir2014}. Coupling road traffic and communication simulators have recently been achieved in VEINS \cite{sommer2011bidirectionally}. We also report ITETRIS \cite{5494182} and VSimRTI \cite{Schunemann:2011:VSR:2025545.2025628} that declare successful coupled simulation, even if we haven't been in measure to evaluate these last two softwares in detail. However, in the case of road traffic control applications, we did not see communication performance studies with specialized communication simulators. \subsection{Paper organization} We aimed in this paper to propose a new traffic light control algorithm, based on V2I communication and evaluated with a fine grained and extended simulation tool, VEINS \cite{sommer2011bidirectionally}. We modified VEINS in order to include TCP/IP support over IEEE 802.11p. We present some performance indicators of the WAVE protocol stack in the scenario of this new kind of road traffic control. This paper is organized in four parts. In part \hyperref[introduction]{\href{Introduction}{I}}, it has been provided the global context and state of the art in the field of connected traffic light signal control. In part \hyperref[control]{\href{Introduction}{II}}, a new algorithm is presented for road traffic control. Then simulation scenarii and results are shown for one junction and for a small American like road network in part \hyperref[simulation]{{\href{Introduction}{III}}}. In part \hyperref[conclusions]{{\href{Introduction}{IV}}} we open perspectives to future works. \section{Connected traffic light signal control} \label{control} \subsection{Algorithm description} In this section we describe a new local control algorithm. This control makes some \textit{hypothesis} on vehicles and infrastructure and is composed of the following subtasks : building \textit{a map}, \textit{electing} a vehicle and \textit{actuating} the TLS. \subsubsection{Assumptions} We use the terminology described in \cite{Florin:2015:SVC:2991309.2991354}. We assume that some junctions of the road network are equipped with traffic light signals (TLS) with communication capabilities. In our case the communication protocol is IEEE 802.11p coupled with the Internet Protocol version 4 (IPv4) and the Transmission Control Protocol (TCP). TCP adds transport services to IEEE 802.11.p, such as a reliable and ordered delivery of byte streams \cite{tanenbaum2011computer}. It is used in conjunction with IP which provides network routing services. Hence, we suppose that some TLS are able to communicate with the TCP/IP protocols over IEEE 802.11p and we consider it as an Intersection Agent (IA). Similarly, we suppose that some cars are equipped with the same communication capabilities and are also able to localize themselves, for example with GPS modules which provide in addition global time synchronization. We call them equipped vehicles or Vehicle Agents (VA)~\cite{Florin:2015:SVC:2991309.2991354}. \subsubsection{Dynamic Maps} With such capabilities, the IA can build a map of the connected vehicles coming and leaving the junction. Similarly each vehicle agent (VA) builds a map of the IAs approaching or leaving it in its communication range. To achieve this, we designed and programmed a map module in OMNET++ \cite{Varga01theomnet++}. For the map of the vehicles, the coordinates system is relative to the earth. Instead, for the map of the IAs, the coordinates system is relative to the concerned vehicle position. This change of coordinates enables the use of the same module for IAs map and vehicles map. The maps are \textit{dynamic}; they are updated periodically each time a message is received for the IA, and triggered on timer for the vehicles. Map's data that are older than a given time, named here $map\_module\_length$, are cleared. An IA signals itself by broadcasting its IP address and coordinates via UDP protocol. Once the IA announced, the vehicles equipped with UDP client build a local map of all the IAs in their communication range. These vehicles then elect the closest IA approaching. So, the vehicles know their relative positions to the closest junction approaching, without need for communication with the IA anymore. Once close to the elected junction, the vehicles open a TCP connection with the IA. After the TCP connection with the elected IA is established, all vehicles approaching the junction send periodically their position to the IA, each message being timestamped, with a time period named here $position\_send\_interval$. These vehicles data received by the IA enable the build of a map indexed by a unique vehicle identifier, described in \hyperref[tab:map]{\href{tab:map}{TABLE~I}}. Among the different fields of the map, we notice the state of the vehicle (approaching or leaving the junction) which is computed using the positions of vehicles and TLS. \begin{table}[ht] \begin{center} \caption{The IA and vehicle map module} \label{tab:map} \begin{tabular}{|c|c|} \hline \multicolumn{2}{|c|}{unique vehicle identifier} \\ \hline \hline \multirow{2}{*}{c} & the IA\_to\_car\_TCP\_connection \\ & identifier \\ \hline \multirow{2}{*}{T} & the trajectory which is \\ & an ordered map of couples (time, coordinates) \\ \hline \multirow{2}{*}{lst} & the last time the vehicle data \\ & has been received by the IA \\ \hline \multirow{2}{*}{fst} & the first time the vehicle data \\ & has been received by the IA\\ \hline \multirow{2}{*}{r} & the radius is the distance the car is\\ & to the approaching junction \\ \hline $\cos \theta$ & the car position is defined by its radius to the TLS and\\ $\sin \theta$ &the angle this radius is from the (x) axis \\ \hline \multirow{2}{*}{s} & the state of the car \\ & whether the car is coming or leaving the junction \\ \hline \end{tabular} \end{center} \end{table} \subsubsection{Election} We say the road state and a given junction map are synchronized when all vehicles in the junction map have been detected in the last $map\_module\_timeout$ seconds. Periodically, every $election\_interval$ time and when the junction map is synchronized, the IA computes the lead vehicles on the approaching edges. In our case, we suppose that the junctions have only two incoming edges, each edge having one lane. So there can be two lead vehicles maximum in our case. The two incoming edge \textit{priorities} alternate every $cycle\_duration/2$, where $cycle\_duration$ is the duration of the TLS periodic program. A vehicle among lead vehicles from incoming edges is elected with the \hyperref[election]{\href{election}{Algorithm 1}}. If the \hyperref[election]{\href{election}{Algorithm 1}} runs successfully, the IA sends a message to the elected vehicle. Otherwise the RSU will try to elect a vehicle after a $election\_interval$ time. \begin{algorithm} \caption{Vehicle Election} \label{election} \SetKwInOut{Input}{Input} \SetKwInOut{Output}{Output} \underline{function Elect} $(p,v,d_p,d_v,d_{min},\alpha)$\\ \Input{ \begin{itemize} \item $p$ is the identifier of the lead vehicle on the prioritized edge, and it is $None$ if no vehicle is detected on the prioritized edge \item $v$ is the identifier of the lead vehicle on the non prioritized edge, and it is $None$ if no vehicle is detected on the non prioritized edge \item $d_p$ represents the distance $p$ is to the junction, in case $p\neq None$, \item $d_v$ represents the distance $v$ is to the junction, in case $v\neq None$, \item $d_{min}>0$ is the minimum distance to consider a vehicle close to the junction, \item $\alpha > 1$ is a coefficient to ponderate the minimum distance. \end{itemize} } \Output{ $p$ or $v$.} \uIf{($p \neq None$ and $v \neq None$ and $d_p > \alpha d_{min}$ and $d_v < d_{min}$) or ($p == None$ and $v \neq None$ and $d_v < d_{min}$)} { $elected=v$\; } \uElse{ $elected=p$\; } return $elected$\; \end{algorithm} \subsubsection{Action} \textbf{The elected vehicle has now the power to set the TLS to a favorable state}, which is green light for the edge on which it is moving and red light for other edges. To do this, the elected vehicle sends a message to the IA with its established TCP connection. We set a minimum and a maximum duration for a given TLS state : $min\_state\_duration$ and $max\_state\_duration$. If no state switch has happened during $max\_state\_duration$ time, the state of the TLS is automatically changed. Similarly, the state of the TLS must remain the same for at least $min\_state\_duration$. With the $min\_state\_duration$ we ensure stability. With the $max\_state\_duration$ we ensure dynamics of the states and avoid blockages of the TLS. As we set $max\_state\_duration=cycle\_duration/2$, if no vehicle is connected near a junction, then the associated TLS will follow an open loop cyclic program with $cycle\_duration$ period. Once the connected vehicles know they are leaving the junction (with GPS and local map but not with communication means), they disconnect after they reach a given distance away from the junction. The process starts again for the next junction and so on. \subsection{Properties of the algorithm} \subsubsection{Property 1} The local control is safe because the control is done by means of a TLS which never gives green light simultaneously to antagonistic phases. \subsubsection{Property 2} It is not necessary for a vehicle to be equipped to pass the junction. \subsubsection{Property 3} As the control tends to minimize delays for equipped vehicles, communicating equipments of vehicles are encouraged. As the control presents gains for the road traffic, communicating equipments of junctions are encouraged. \subsubsection{Property 4} When no vehicle is equipped near an equipped junction, the $max\_state\_duration$ for a state induces that the TLS runs half time red and half time green light. It is equivalent to a simple open loop cyclic TLS program. \subsection{Implementation} We used VEINS Framework \cite{sommer2011bidirectionally} which includes SUMO \cite{SUMO2012} as microscopic traffic simulator and OMNET++ \cite{Varga01theomnet++} as communication network simulator. We modified and extended VEINS Framework in order to get TCP/IP support over IEEE 802.11p. To do this, ``inet'' models and Veins framework have been integrated and connected together. \begin{figure}[htbp] \begin{center} \includegraphics[width=0.6\linewidth]{img/wave_protocols_stack.jpeg} \caption{The IEEE WAVE protocols stack \cite{6755433}} \end{center} \end{figure} Some application modules have been written : map, car, road side unit, TCP client and server, UDP client and server applications, which implement the algorithm described above. Commands to control the TLS states have been added. The MAC1609 module of VEINS framework module has been modified to connect TCP/IP to IEEE 802.11p layers. \section{Simulation results} We simulated a few runs with different seeds, each run being reproducible. We present statistical results for the road network case with 20 different simulations and preliminary results (one typical run) for the one junction case. \label{simulation} \subsection{One Junction with connected TLS} \begin{minipage}{0.4\linewidth} \includegraphics[width=\linewidth]{img/one_junction_network_zoom_out_trimmed.png} \end{minipage} \hfill \begin{minipage}{0.5\linewidth} \subsubsection{Scenario for one junction} We used the following road network, composed of one junction, with one lane incoming edges of 300 m length. We varied the demand which is the number of vehicles (uniformally inserted in time) per lane per hour. For each of this traffic demand, we varied the ratio of equipped vehicles with on board unit (OBU). \end{minipage} \newline \newline The total simulation time is 600 s. For the communication and the control algorithm, the main parameters are described in \hyperref[table:parameters]{\href{table:parameters}{TABLE II}}. \begin{table}[h] \begin{center} \caption{Main parameters for the communication and road traffic control. Other parameters are VEINS defaults ones.} \label{table:parameters} \begin{tabular}{|c|c|} \hline Parameter name & Parameter value \\ \hline \hline vehicle TCP $position\_send\_interval$ & $500$ ms \\ \hline UDP broadcasting interval & $500$ ms \\ \hline IA $election\_interval$ & $500$ ms \\ \hline $cycle\_duration$& $90$ s \\ \hline $max\_state\_duration$ & 45 s\\ \hline $min\_state\_duration$ & 8 s\\ \hline $map\_module\_timeout$ & $2$ s \\ \hline $map\_module\_length$ & $5$ s \\ \hline $d_{min}$& $100$ m \\ \hline $\alpha$& $2$ \\ \hline MAC 1609 use service channel & true \\ \hline MAC 1609 bitrate & $27$ Mbps \\ \hline MAC 1609 carrier frequency & $5.890\times10^9$ Hz \\ \hline transmit power & $1$ mW \\ \hline application message payload & $30$ bytes \\ \hline transceiver sensitivity & $-89$ dBm \\ \hline \end{tabular} \end{center} \end{table} \subsubsection{Simulation measurements} \textbf{For the communication} we have measured the mean TCP end-to-end delay, TCP throughput on RSU (Road Side Unit) and the amount of TCP application data sent divided by the total simulation time. We define the simulation indicator mean TCP end-to-end delay as the sum of all packet delays divided by the number of packets exchanged. The throughput on RSU is the sum of TCP application packet (successfully received) sizes divided by the simulation time. A given number of communicating hosts may be the result of different combinations of a demand multiplied by a ratio of equipped vehicles. For example, $100\%$ equipped vehicles of $100$ vehicles in total, gives the same number as $10\%$ equipped vehicles of a total of $1000$ vehicles. In \hyperref[junction:rate_nodes]{\href{junction:rate_nodes}{figure 2}} we can see that the amount of TCP application data sent by the nodes increases as the mean vehicle speed decreases. We assume that as the mean vehicle speed is low, the communicating vehicles remain connected longer, and then they send more messages. In \hyperref[junction:delay]{\href{junction:delay}{figure 3}}, we see that the mean TCP end-to-end delay can be as high as $0.8 s$ when vehicle speed is low (about $8 m/s$). We know from \hyperref[junction:rate_nodes]{\href{junction:rate_nodes}{figure 2}} that there are more data sent by the nodes when mean speed is low. We suppose that as there are more messages sent in case of low speeds, the mean TCP end-to-end delay will be higher. The order of magnitudes of end-to-end delay is similar to the ones exposed in \cite{HameedMir2014}. Clearly, in \hyperref[junction:throughput_rsu]{\href{junction:throughput_rsu}{figure 4}}, the throughput on RSU is increasing linearly with the number of communicating vehicles. \begin{figure}[htbp] \begin{center} \includegraphics[width=0.9\linewidth, keepaspectratio]{img/one_junction/symetric_demand/rate_speed_matrix.pdf} \caption{Amount of TCP application data sent divided by the total simulation time (bit/s)} \label{junction:rate_nodes} \end{center} \end{figure} \begin{figure}[htbp] \begin{center} \includegraphics[width=0.9\linewidth, keepaspectratio]{img/one_junction/symetric_demand/delay_speed_matrix.pdf} \caption{Mean TCP end-to-end delay (s)} \label{junction:delay} \end{center} \end{figure} \begin{figure}[htbp] \begin{center} \includegraphics[width=0.9\linewidth, keepaspectratio]{img/one_junction/symetric_demand/RSU_input_rate.pdf} \caption{TCP application throughput on RSU (bit/s)} \label{junction:throughput_rsu} \end{center} \end{figure} \textbf{For the road traffic}, we measured the ratio of the ended vehicles by the inserted vehicles, and the mean travel time. We observe on \hyperref[junction:ended]{\href{junction:ended}{figure~5}} that the ratio of the ended vehicles by the inserted vehicles increases when the demand decreases and the ratio of equipped vehicles increases. For a given ratio of equipped vehicles, as the road traffic demand increases, the ratio of the ended vehicles by the inserted vehicles decreases. For a given demand, this ratio increases with the number of equipped vehicles. In \hyperref[junction:mtt]{\href{junction:mtt}{figure~6}}, for a given demand, the mean travel time decreases as the number of equipped vehicles increases. This should encourage the spreading of vehicle communication capabilities. For a fixed demand, the difference in travel time between the worst and the best cases for a total distance of 600 m, may be as high as 20 seconds. \begin{figure}[htbp] \begin{center} \includegraphics[width=0.9\linewidth, keepaspectratio]{img/one_junction/symetric_demand/Ended.pdf} \caption{Ratio of ended vehicles by inserted vehicles at 600s simulation time} \label{junction:ended} \end{center} \end{figure} \begin{figure}[htbp] \begin{center} \includegraphics[width=0.9\linewidth, keepaspectratio]{img/one_junction/symetric_demand/MTT.pdf} \caption{Mean Travel Time for equipped vehicles (s)} \label{junction:mtt} \end{center} \end{figure} \textbf{For the actuator}, we define the \textit{mean action interval} as the mean time interval between two consecutive changes of traffic lights state. We observe in \hyperref[junction:action]{\href{junction:action}{figure~7}} that the traffic light state is stable for high traffic demand combined with a high equipped vehicle penetration rate. This minimizes the total yellow time of the traffic light, and then maximizes the junction capacity. For a low demand combined with a high equipped vehicle penetration rate, the control is more reactive. \begin{figure}[htbp] \begin{center} \includegraphics[width=0.9\linewidth, keepaspectratio]{img/one_junction/symetric_demand/mean_action_interval.pdf} \caption{Mean action interval (s) for a cycle duration of 90 s.} \label{junction:action} \end{center} \end{figure} \subsection{Traffic control at the road network level} \subsubsection{Scenario for the road network} We consider here an American like network with 16 junctions and 40 edges of length 500 m each. This is the same network considered in~\cite{FARHI201541}, where centralized and decentralized road traffic controls have been combined. Each edge has one lane. We varied the number of equipped junctions : 25\%, 50\%, 100\%; and the penetration rate of equipped vehicles : 20\%, 50\%, 80\%. We defined nine zones in the network. The simulated time is $1800$ s and the communication parameters are the same as in the ``one junction'' scenario. \begin{figure}[htbp] \begin{center} \includegraphics[width=0.75\linewidth]{./img/road_network/example1.jpg} \caption{Regular network example.} \label{example1} \end{center} \end{figure} We used SUMO ``origin and destination edges instead of a complete list of edges. In this case the simulation performs fastest-path routing based on the traffic conditions found in the network at the time of departure/flow begin.''\cite{SUMOdemanddefinition}. The road traffic demand is given in tables III and IV. \begin{table}[h] \begin{center} \caption{The traffic demand for the first 900 s.} \begin{tabular}{|c|c|c|} \hline \diagbox{Origins}{Destinations}& Center zone & Each other zone\\ \hline Center zone & 0 & 10 ({\it{veh}})\\ \hline Each other zone & 15 ({\it{veh}}) & 15 ({\it{veh}})\\ \hline \end{tabular} \end{center} \end{table} \begin{table}[h] \begin{center} \caption{The traffic demand for the last 900 s.} \begin{tabular}{|c|c|c|} \hline \diagbox{Origins}{Destinations}& Center zone & Each other zone\\ \hline Center zone & 0 & 10 ({\it{veh}})\\ \hline Each other zone & 20 ({\it{veh}}) & 20 ({\it{veh}})\\ \hline \end{tabular} \end{center} \end{table} \subsubsection{Simulation results} (\hyperref[tab:saturated1]{\href{tab:saturated1}{Table~V}}, \hyperref[tab:saturated2]{\href{tab:saturated2}{Table~VI}} and \hyperref[tab:saturated3]{\href{tab:saturated3}{Table~VII}}) We compare our algorithm with an open loop fixed cycle TLS program, where the same cycle time is considered in both cases. This open loop cyclic control can also be achieved with zero communicating vehicles in our algorithm. The gain of our algorithm in terms of ended vehicles can be very high, as much as 30\%. The gain in running vehicles can be as high as 40\% and the gain in mean travel time can reach 30\%. We observe that when the penetration rate is 20\% and when all junctions are equipped, the algorithm is not efficient. We suppose that as there are less vehicles communicating, less vehicles manage to connect in time (before having passed the junction). It then could be possible that the TLS map is not a good image of the real traffic. This could explain why the cycles of the TLS are not globally adequate. When all junctions are equipped, this can even be globally disturbing. \begin{table}[htbp!] \begin{center} \caption{Ended vehicles in a scenario with the traffic demand of tables III and IV. Simulated time = 1800 s. Mean and standard deviation for 20 simulation runs.} \label{tab:saturated1} \resizebox{\columnwidth}{!}{% \begin{tabular}{|c|c|c|c|c|} \hline \diagbox{Equipped junctions}{Ended}{Penetration rate}&0\% & 20\% & 50\% & 80\% \\ \hline 25\%& 1373$\pm$19 &1470$\pm$33& 1507$\pm$18 & 1484$\pm$19 \\ & (0$\pm$0)\% & \textbf{(+7.1$\pm$2.5)\%} & \textbf{(+9.8$\pm$2.4)\%} & \textbf{(+8.1$\pm$1.9)\%} \\ \hline 50\%& 1373 $\pm$19 & 1499$\pm$49 & 1583$\pm$19 & 1571$\pm$20\\ & (0$\pm$0) \% & \textbf{(+9.2$\pm$3.4)\%} & \textbf{(+15.3$\pm$1.9)\%} & \textbf{(+14.5$\pm$2.3)} \%\\ \hline 100\%& 1373$\pm$19 & 1281$\pm$151 & 1805$\pm$49 & 1877$\pm$29\\ & (0$\pm$0)\% & \textcolor{red}{(-6.7$\pm$11.2)\%} & \textbf{(+31.5$\pm$4.1)\%} & \textcolor{green}{(+36.7$\pm$2.8)\%} \\ \hline \end{tabular} } \end{center} \end{table} \begin{table}[htbp!] \begin{center} \caption{Running vehicles in a scenario with the traffic demand of tables III and IV. Simulated time = 1800 s. Mean and standard deviation for 20 simulation runs.} \label{tab:saturated2} \resizebox{\columnwidth}{!}{% \begin{tabular}{|c|c|c|c|c|} \hline \diagbox{Equipped junctions}{Running}{Penetration rate}&0\% & 20\% & 50\% & 80\% \\ \hline 25\% & 954$\pm$16 & 842$\pm$32 & 817$\pm$18 & 848$\pm$21 \\ &(0$\pm$0\%) & \textbf{(-11.8$\pm$3.5\%)} & \textbf{(-14.4$\pm$2.7\%)} & \textbf{(-11.2$\pm$2.4\%)} \\ \hline 50\% & 954$\pm$16 & 835$\pm$36 & 764$\pm$17 & 778$\pm$21 \\ & (0$\pm$0\%) & \textbf{(-12.4$\pm$3.8\%)} & \textbf{(-19.9$\pm$2.1\%)} & \textbf{(-18.4$\pm$2.5\%)} \\ \hline 100\% & 954$\pm$16 & 962$\pm$80 & 583$\pm$43 & 517$\pm$27 \\ & (0$\pm$0\%) & \textcolor{red}{(+0.9$\pm$8.7\%) } & \textbf{(-38.9$\pm$4.7\%)} & \textcolor{green}{(-45.8$\pm$2.9\%) } \\ \hline \end{tabular} } \end{center} \end{table} \begin{table}[htbp!] \begin{center} \caption{Mean Travel Time (s) in a scenario with the traffic demand of tables III and IV. Simulated time = 1800 s. Mean and standard deviation for 20 simulation runs.} \label{tab:saturated3} \resizebox{\columnwidth}{!}{% \begin{tabular}{|c|c|c|c|c|} \hline \diagbox{Equipped junctions}{MTT(s)}{Penetration rate}&0\% & 20\% & 50\% & 80\% \\ \hline 25\% & 413.9$\pm$1.8 & 381.9$\pm$4.3 & 376.0$\pm$3.1 & 380.0$\pm$3.4 \\ & (0$\pm$0\%) & \textbf{(-7.7$\pm$1.1\%)} & \textbf{(-9.2$\pm$0.8\%)} & \textbf{(-8.2$\pm$0.9\%)} \\ \hline 50\% & 413.9$\pm$1.8 & 381.8$\pm$15.2 & 355.6$\pm$5.0 & 354.9$\pm$4.5 \\ & (0$\pm$0\%) & \textbf{(-7.8$\pm$3.8\%)} & \textbf{(-14.1$\pm$1.5\%)} & \textbf{(-14.2$\pm$1.2\%)} \\ \hline 100\% & 413.9$\pm$1.8 & 399.6$\pm$30.6 & 302.0$\pm$6.9 & 281.2$\pm$4.6 \\ & (0$\pm$0\%) & \textcolor{red}{(-3.4$\pm$7.4\%) } & \textbf{(-27.0$\pm$1.7\%)} & \textcolor{green}{(-32.1$\pm$1.2\%) } \\ \hline \end{tabular} } \end{center} \end{table} \section{Conclusions} \label{conclusions} We presented a new V2I based TLS control algorithm, with its design, implementation and performance study for communication and road traffic. Compared to an open loop cyclic TLS program, we showed that the presented algorithm features high gains in most of the configurations. However, in few cases, where low penetration rate for vehicles is combined with high ratio of equipped junctions, it seems that the algorithm is not efficient and produces some losses. An hypothesis for this phenomenon has been proposed. Future works could benefit from a mix of microscopic and macroscopic road traffic controls, based on vehicular communication networking. \bibliographystyle{IEEEtran}
{'timestamp': '2017-07-04T02:10:26', 'yymm': '1703', 'arxiv_id': '1703.08408', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08408'}
arxiv
\section{Introduction} The problem of finding a generalized Nash equilibrium (GNE) has recently drawn many attentions due to its applicability in various networked games with coupling constraints such as power grids \cite{zhu2016distributed}, optical networks \cite{jayash10} and wireless communication networks \cite{han2012game}. In such games, each player aims to minimize his cost function by taking a proper action in response to other players. Each player's feasible decision set is dependent on other players' actions. We are interested in seeking a GNE, which is a point that no player can unilaterally deviate his local action to minimize his cost function. Due to similarities between this problem and distributed consensus optimization problems (DCOPs), we aim to employ an efficient, robust and fast optimization technique referred to as the {\emph{ alternating direction method of multipliers}} (ADMM) to find a GNE of a multi-player game. The key differences between DCOP and GNE problem is that in a DCOP each agent desires to minimize a global objective by controlling a full vector optimization variable. However, in a GNE problem, we have a set of local optimization problems assigned to each player who controls only his action (which is an element of a full vector). This leads to have a sub-optimization problem associated to each player such that each of them is dependent on the other players' actions. \emph{\textbf{Related Works.}} Our work is related to the literature on (generalized) Nash games such as \cite{jayash8,facchinei2010generalized,fischer2014generalized,ssalehisadaghiani2016distributed} and DCOPs such as \cite{chang2015multi,johansson2008distributed}. (G)NE seeking in distributed networked games has recently attracted an increased interest due to many real-world applications. To name only a few, \cite{parise2015network,salehisadaghiani2016distributed}. In \cite{parise2015network}, the problem of finding GNE is studied in a networked game. A gradient-based algorithm is designed over a complete communication graph. Convergence proof is analyzed in the presence of delay and dynamic change. Similar to \cite{zhu2016distributed}, the problem of seeking a GNE is discussed in \cite{yi2017distributed} for the games that players have access to all players' actions on which their cost depends on. Thus, they exchange only local multipliers not the estimates of others' actions. A Nash game with a coupled constraint is considered in \cite{yin2011nash}. A variational inequality related approach is used to compute a GNE of the game. The authors in \cite{schiro2013solution} solve a quadratic GNE problem with linear shared coupled constraint using Lemkes method. Recently, there has been a widespread research on GNE seeking in aggregative games \cite{zhu2016distributed,yin2011nash,schiro2013solution}. Quadratic aggregative games with affine and convex coupling constraints are studied in \cite{paccagnan2016distributed,grammatico2016aggregative}. A coordination scheme belonging to a class of asymmetric projection algorithm is presented in \cite{paccagnan2016distributed} and its convergence to a GNE is then discussed. A model-free dynamic control law, based on monotone operator, is proposed in \cite{grammatico2016aggregative} to ensure the global convergence to a GNE. ADMM algorithms, which are in the scope of this paper, have been developed in 70's to find an efficient way to obtain an optimal point of distributed optimization problems (DOPs) \cite{bertsekas1999parallel,boyd2011distributed}. After the re-introduction of this method in \cite{boyd2011distributed}, ADMM has become widely used to locate optimal points of DOPs as a robust and fast technique \cite{he20121,wei2012distributed}. An inexact-ADMM algorithm is proposed in \cite{chang2015multi} for DCOPs with an affine equality constraint. In \cite{salehisadaghiani2016distributedifac}, we develop a methodology to relate a distributed NE problem with no coupled constraint to a DCOP using augmentation technique. It is shown that an NE problem can be treated as a set of sub-optimization problems with an augmented equality constraint for the estimates of the players. \emph{\textbf{Contributions.}} Motivated by ADMM methods designed for DCOPs, we develop a relatively fast algorithm for GNE problems within the framework of inexact-ADMM. Players are only aware of their own cost functions (which are not in the form of aggregative but general game), problem data (which is related to a private coupled equality constraint for each player) and action set of all players (they are not aware of the others' actions). We reformulate the conservative GNE problem into the corresponding Lagrange dual problem and then we augment it {\emph{using local estimates of players' actions as well as local copies of Lagrange multipliers}}. We derive a set of GNE conditions using the associated KKT conditions and finally we develop an inexact-ADMM algorithm based on the augmented Lagrange function which is related to each player. The convergence proof of the algorithm to a GNE of the game is then provided under a few mild assumptions on players' cost functions. The paper is organized as follows. The problem statement and assumptions are provided in Section~II. In Section~III, an inexact-ADMM-like algorithm is derived. Convergence of the proposed algorithm to a GNE of the game is discussed in Section~IV. Simulation results are illustrated in Section~V and concluding remarks are presented in Section~VI. \vspace{-0.2cm} \section{Problem Statement}\label{problem_statement} Consider $V=\{1,\ldots,N\}$ as a set of $N$ players that seek a GNE of a networked game with individual linear coupled constraints. The game is denoted by $\mathcal{G}$ and defined as follows:\vspace{-0.0cm} \begin{itemize} \item $\Omega_i\subset\mathbb{R}$: Action set of player $i$, $\forall i\in V$, \item $\Omega=\prod_{i\in V}\Omega_i\subset\mathbb{R}^N$: Action set of all players, \item $J_i:\Omega\rightarrow \mathbb{R}$: Cost function of player $i$, $\forall i\in V$. \end{itemize} The game $\mathcal{G}(V,\Omega_i,J_i)$ is defined over the set of players, $V$, the action set of player $i\in V$, $\Omega_i$ and the cost function of player $i\in V$, $J_i$. The players' actions are denoted as follows:\vspace{-0.0cm} \begin{itemize} \item $x=(x_i,x_{-i})\in\Omega$: All players actions, \item $x_i\in\Omega_i$: Player $i$'s action, $\forall i\in V$, \item $x_{-i}\!\in\!\Omega_{-i}\!:=\!\prod_{j\in V\backslash\{i\}}\!\Omega_j$:All players' actions except $i$. \end{itemize} The local data of player $i$ is given as $A^i:=[A_i^i,[A_j^i]_{j\neq i}]\in \mathbb{R}^{m\times N}$ with $A_i^i\in\mathbb{R}^m$, and $b^i\in\mathbb{R}^m$. Note that in this work, we are interested in a more general case in which each player has access only to his own private constraint which has not to be shared with the other players. \begin{assumption}\label{constraint} \footnote[1]{Derivation of the algorithm is not dependent on Assumption~\ref{constraint}. Simulations for various cases for matrix $A^i$, even the ones that do not satisfy this assumption, verify that the algorithm works even without considering this assumption. However, this assumption is used at the convergence proof.}There exists a positive semi-definite matrix $B^i\in\mathbb{R}^{m\times m}$ for all $i\in V$ such that, \begin{equation} A_i^i\in \ker(B^i-I_m),\,A_j^i\in \ker(B^i)\quad j\neq i. \end{equation} \end{assumption} Player $i$'s feasible strategy set is then denoted by $\mathcal{X}_i(x_{-i}):=\{x_i\in\Omega_i|A^ix=b^i\}$\footnote[2]{This case contains games with shared constraints for which $Ax=b$ for all $i\in V$ and $m\geq N$}. The game is played such that for a given $x_{-i}\in \Omega_{-i}$, each player $i\in V$ aims to minimize his own cost function selfishly w.r.t. $x_i$ subject to a private equality constraint. \begin{equation} \label{mini_0} \begin{cases} \begin{aligned} & \underset{x_i}{\text{minimize}} & & J_i(x_i,x_{-i}) \\ & \hspace{0.5cm}\text{s.t.} & & x_i\in\mathcal{X}_i(x_{-i}). \end{aligned} \end{cases} \end{equation} Each optimization problem is run by a particular player $i$ at the same time with other players. Note that \eqref{mini_0} can simply accommodate inequality constraints $A^ix\geq b^i$ by adding a slack variable $y\geq 0$ and rewrite the inequality constraint as $A^ix-y=b^i$. Note that the constraint $y\geq 0$ can be enforced by a convex indicator function. An NE of a game is defined as follows: \begin{definition}\label{Nash_def} Consider an $N$-player game $\mathcal{G}(V,\Omega_i,J_i)$, each player $i$ minimizing the cost function $J_i:\Omega\rightarrow\mathbb{R}$. A vector $x^*=(x_i^*,x_{-i}^*)\in\Omega$ is called a GNE of this game if \begin{equation} J_i(x_i^*,{x_{-i}^{*}})\leq J_i(x_{i},{x_{-i}^{*}})\quad\forall x_i\in \mathcal{X}_i(x_{-i}^*),\,\,\forall i\in V. \end{equation} \end{definition} An NE lies at the intersection of all solutions of the set \eqref{mini_0}. The key challenges are two-fold. First, each optimization problem in \eqref{mini_0} is dependent on the solution of the other simultaneous problems; second, the solutions are coupled through a linear constraint. Since this game is distributed, no player is aware of the actions, cost functions and constraints of the other players. Thus, each player $i$ maintains an estimate of the other players' actions. We define a few notations, in the following, for players' estimates.\vspace{-0cm} \begin{itemize} \item $x^i=(x_i^i,x_{-i}^i)\in\Omega$: Player $i$'s estimate of all players actions, \item $x_i^i\in\Omega_i$: Player $i$'s estimate of his own action which is indeed his action, i.e., $x_i^i=x_i\,\forall i\in V$, \item $x_{-i}^i\in\Omega_{-i}:=\prod_{j\in V\backslash\{i\}}\Omega_j$: Player $i$'s estimate of all other players' actions except his action, \item $\underline{x}=[{x^1}^T,\ldots,{x^N}^T]^T\in\Omega^N$: Augmented vector of estimates of all players' actions \end{itemize} Note that all players' actions can be interchangeably represented as $x=(x_i^i)_{i\in V}$. We assume that the cost function $J_i$, the action set $\Omega$ and the problem data $A^i,\,b^i$ are the only information available to player $i$. Thus, the players exchange their estimates in order to update their actions. An undirected \emph{communication graph} $G_C(V,E)$ is defined with $E\subseteq V\times V$ denoting the set of communication links between the players. $(i,j)\in E$ if and only if players $i$ and $j$ exchange estimates. In the following, we have a few definitions for $G_C$: \begin{itemize}\vspace{-0cm} \item $N_i:=\{j\in V|(i,j)\in E\}$: Set of neighbors of $i$ in $G_C$, \item $H:=[h_{ij}]_{i,j\in V}$: Adjacency matrix associated with $G_C$ where $h_{ij}=1$ if $(i,j)\in E$ and $h_{ij}=0$ otherwise, \item $D:=\text{diag}\{|N_1|,\ldots,|N_N|\}$: Degree matrix associated with $G_C$. \end{itemize} The following assumption is used for $G_C$. \begin{assumption}\label{connectivity} $G_C$ is a connected graph. \end{assumption} We aim to link game \eqref{mini_0} to a set of optimization problems whose solutions can be based on the ADMM. Game \eqref{mini_0} is equivalently represented as the following problem for $i\in V$. \begin{equation}\label{mini_11} \begin{cases} \begin{aligned} & \underset{x_i\in\Omega_i}{\text{min}} & & J_i(x_i,x_{-i}) \\ & \hspace{0.2cm}\text{s.t.} & & A^ix=b^i. \end{aligned} \end{cases} \end{equation} Let $\lambda\in\mathbb{R}^m$ be the joint Lagrange dual variable associated with the linear constraint $A^ix=b^i\,\forall i\in V$. The Lagrange dual problem of \eqref{mini_11} can be written as follows for $i\in V$. \begin{equation}\label{mini_22} \begin{cases} \begin{aligned} & \underset{\lambda\in\mathbb{R}^m}{\text{max}}\underset{x_i\in\Omega_i}{\text{min}} & & J_i(x_i,x_{-i})+\lambda^T(A^ix-b^i). \end{aligned} \end{cases} \end{equation} Note that we are interested in computing a variational GNE of the game since we assumed a common Lagrange multiplier $\lambda$ for each player in \eqref{mini_22}. Using the estimates of the actions $x^i$ and the local copies of the Lagrange dual variables $\lambda^i$ for $i\in V$, we reformulate \eqref{mini_22} so that the objective function is separable (the estimates are also interpreted as the local copies of $x$). Moreover, the slack variables $t^{ls}|_{\{l\in V,\,s\in N_l\}}\in\Omega$ and $p^{ls}|_{\{l\in V,\,s\in N_l\}}\in\mathbb{R}^m$ are employed to enforce that the local copies are equivalent. \begin{equation}\label{mini_33} \hspace{-0cm}\begin{cases} \begin{aligned} & \underset{\lambda^i\in\mathbb{R}^m,p^{ls}}{\text{max}}\,\underset{x_i^i\in\Omega_i,t^{ls}}{\text{min}} & & J_i\!(\!x_i^i,x_{-i}^i)\!+\!\mathcal{I}_{\Omega_i}(x_i^i)\!+\!{\lambda^i}^T(A^ix^i\!-\!b^i)\\ & \hspace{1cm}\text{s.t.} & & x^l=t^{ls}\quad\forall l\in V,\,\forall s\in N_l,\\ & & & x^s=t^{ls}\quad\forall l\in V,\,\forall s\in N_l,\\ & & & \lambda^l=p^{ls}\quad\forall l\in V,\,\forall s\in N_l,\\ & & & \lambda^s=p^{ls}\quad\forall l\in V,\,\forall s\in N_l, \end{aligned} \end{cases} \end{equation} where $\mathcal{I}_{\Omega_i}(x_i^i):=\begin{cases}0&\text{if }x_i^i\in\Omega_i\\\infty&\text{otherwise}\end{cases}$ is an indicator function of the feasibility constraint $x_i^i\in\Omega_i$. Note that the solution of \eqref{mini_33} is equivalent to that of \eqref{mini_22}, i.e., $x_i^i=x_i,\,\lambda^i=\lambda$ for all $i\in V$. The ADMM is then employed to solve \eqref{mini_33} in a distributed manner. A characterization of the NE for game \eqref{mini_0} could be obtained by finding the KKT conditions on \eqref{mini_33}. Let $\{u^{ls},v^{ls},w^{ls},z^{ls}\}_{l\in V,s\in N_l}$ with $u^{ls},v^{ls}\in \mathbb{R}^N$ and $w^{ls},z^{ls}\in \mathbb{R}^m$ be the Lagrange multipliers associated with the four constraints in \eqref{mini_33}, respectively. The corresponding Lagrange function for player $i$, $\forall i\in V$ is as follows: \begin{eqnarray} &&\hspace{-0.7cm}L_i\Big(x_i^i, \{t^{ls}, u^{ls}, v^{ls}\},\lambda^i, \{p^{ls}, w^{ls}, z^{ls}\}\Big)\nonumber\\ &&\hspace{-0.7cm}:= J_i(x_i^{i},x_{-i}^{i})+\mathcal{I}_{\Omega_i}(x_i^{i})+{\lambda^{i}}^T(A^ix^{i}-b^i)\nonumber\\ &&\hspace{-0.7cm}+\sum_{l\in V}\sum_{s\in N_l}{u^{ls}}^T(x^l-t^{ls})+{v^{ls}}^T(x^s-t^{ls}),\nonumber\\ &&\hspace{-0.7cm}-\sum_{l\in V}\sum_{s\in N_l}{w^{ls}}^T(\lambda^l-p^{ls})+{z^{ls}}^T(\lambda^s-p^{ls}). \end{eqnarray} Let $({{x}^{i}}^*, {{{\lambda}^{i}}^*})_{i\in V}$ and $\{{{u}^{ls}}^*,{{v}^{ls}}^*,{{w}^{ls}}^*,{{z}^{ls}}^*\}_{l\in V,\,s\in N_l}$ be a pair of primal and dual optimal solution to \eqref{mini_33}. Let denote $\sum_{j\in N_i}u^{ij}+v^{ji}:=U^i$ and $\sum_{j\in N_i}w^{ij}+z^{ji}:=W^i$ for notational simplicity. The KKT conditions are summarized as follows for $i\in V,\,j\in N_i$:\vspace{-0cm} \begin{eqnarray}\label{kkt_dual} \hspace{-0.8cm}\begin{cases}\nabla_iJ_i({{x}^{i}}^*)+\partial\mathcal{I}_{\Omega_i}({{x}_i^{i}}^*)+{\lambda^i}^{*T}A_i^i+{U_i^i}^*=0,\\ A^i{{x}^{i}}^*-b^i-{W^i}^*=\textbf{0}_m,\\ {{x}^{i}}^*={{x}^{j}}^*,\,{{\lambda}^{i}}^*={{\lambda}^{j}}^*,\\ {{u}^{ij}}^*+{{v}^{ij}}^*=\textbf{0}_N,\,{{w}^{ij}}^*+{{z}^{ij}}^*=\textbf{0}_m, \end{cases} \end{eqnarray} where $\nabla_iJ_i(\cdot)$ is gradient of $J_i$ w.r.t. $x_i$ and $\partial_i\mathcal{I}_{\Omega_i}(\cdot)$ is a subgradient of $\mathcal{I}_{\Omega_i}$ at $x_i$. By \eqref{kkt_dual} and Assumption~\ref{connectivity}, ${{x}^{1}}^*\!=\!\ldots\!=\!{{x}^{N}}^*\!:=\!x^*$ and ${{\lambda}^{1}}^*\!=\!\ldots\!=\!{{\lambda}^{N}}^*\!:=\!\lambda^*$. Then, the GNE of \eqref{mini_0}, $x^*$, satisfies the following equations $\forall i\in V,\,j\in N_i$: \begin{eqnarray}\label{Nash_equations} \begin{cases} \nabla_iJ_i({x}^*)+\partial\mathcal{I}_{\Omega_i}({x_i}^*)+{\lambda^{*}}^TA_i^i+{U_i^i}^*=0,\\ A^ix^{*}-b^i-{W^i}^*=\textbf{0}_m,\\ {u^{ij}}^*+{v^{ij}}^*=\textbf{0}_N,\,{w^{ij}}^*+{z^{ij}}^*=\textbf{0}_m. \end{cases} \end{eqnarray} In the following, we state a few assumptions for the existence of a GNE. \begin{assumption} \label{assump} For every $i\in V$, \begin{itemize} \item $\Omega_i\subset\mathbb{R}$ is compact and convex \item $\mathcal{X}_i(x_{-i})$ is non-empty for every $x_{-i}$ \item $J_i(x_i,x_{-i})$ is $C^1$ in $x_i$, jointly continuous in $x$ and convex in $x_i$, for every $x_{-i}$. \end{itemize} \end{assumption} The convexity of $\Omega_i$ implies that the indicator function $\mathcal{I}_{\Omega_i}$ is convex. This yields that there exists at least one bounded subgradient $\partial\mathcal{I}_{\Omega_i}$. \begin{assumption}\label{Lip_assump} Let $F:\Omega^N\rightarrow\mathbb{R}^N$, $F(\underline{x}):=[\nabla_iJ_i(x^i)]_{i\in V}$ be the pseudo-gradient vector (game map) where $\underline{x}:=[{x^1}^T,\ldots,{x^N}^T]^T\in\Omega^N$. $F$ is cocoercive $\forall\underline{x}\in\Omega^N$ and $\underline{y}\in\Omega^N$, i.e.,\vspace{-0.4cm} \begin{eqnarray} &&\hspace{-1cm}(F(\underline{x})-F(\underline{y}))^T(x-y)\geq \sigma_F\|F(\underline{x})-F(\underline{y})\|^2, \end{eqnarray} where $\sigma_F>0$. \end{assumption} \vspace{-0.4cm} \section{Distributed Inexact-ADMM Algorithm} Our objective is to find an ADMM-like algorithm for computing a GNE of $\mathcal{G}(V,\Omega_i,J_i)$ using only imperfect information over the communication graph $G_C(V,E)$. The algorithm is elaborated in the following steps:\\ 1- \textbf{\emph{Initialization Step:}} Each player $i\in V$ maintains an initial estimate for all players' actions, $x^i(0)\in\Omega$ and an initial Lagrange multiplier, $\lambda^i(0)\in\mathbb{R}^m$. The initial values of $u^{ij}(0),v^{ij}(0),w^{ij}(0)$ and $z^{ij}(0)$ are all set to be zero for all $i\in V$, $j\in N_i$.\\ 2- \textbf{\emph{Communication Step:}} At iteration $T(k)$, each player $i\in V$ exchanges his previous estimate of the other players' actions $x^i(k-1)$ and his dual Lagrange multiplier $\lambda^i(k-1)$ with his neighbors $j\in N_i$.\\ 3- \textbf{\emph{Action Update Step:}} At this moment all players update their actions, estimates and Lagrange multiplier via the ADMM. For each player $i\in V$, let the augmented Lagrange function associated with \eqref{mini_33} be as follows: \begin{eqnarray}\label{Augmented_Lag} &&\hspace{-1cm}L_i^a\Big(x_i^i, \{t^{ls}, u^{ls}, v^{ls}\},\lambda^i, \{p^{ls}, w^{ls}, z^{ls}\}\Big)\nonumber\\ &&\hspace{-1cm}:= J_i(x_i^{i},x_{-i}^{i})+\mathcal{I}_{\Omega_i}(x_i^{i})+{\lambda^{i}}^T(A^ix^{i}-b^i)\nonumber\\ &&\hspace{-1cm}+\sum_{l\in V}\sum_{s\in N_l}{u^{ls}}^T(x^l-t^{ls})+{v^{ls}}^T(x^s-t^{ls})\nonumber\\ &&\hspace{-1cm}-\sum_{l\in V}\sum_{s\in N_l}{w^{ls}}^T(\lambda^l-p^{ls})+{z^{ls}}^T(\lambda^s-p^{ls})\nonumber\\ &&\hspace{-1cm}+\frac{c}{2}\sum_{l\in V}\sum_{s\in N_l}(\|x^l-t^{ls}\|^2+\|x^s-t^{ls}\|^2)\nonumber\\ &&\hspace{-1cm}-\frac{c}{2}\sum_{l\in V}\sum_{s\in N_l}(\|\lambda^l-p^{ls}\|^2+\|\lambda^s-p^{ls}\|^2), \end{eqnarray} where $c>0$ is a scalar coefficient. Consider the ADMM algorithm associated with \eqref{mini_33} based on \eqref{Augmented_Lag}: The dual Lagrange multipliers $u^{ij},v^{ij},w^{ij},z^{ij}$ update rules $\forall i\in V,j\in N_i$ are as follows:\vspace{-0cm} \begin{eqnarray} &&\hspace{-1cm}u^{ij}(k)=u^{ij}(k-1)+\frac{c}{2}\big(x^i(k-1)-x^j(k-1)\big),\label{u_update_ADMM}\\ &&\hspace{-1cm}v^{ij}(k)=v^{ij}(k-1)+\frac{c}{2}\big(x^j(k-1)-x^i(k-1)\big),\label{v_update_ADMM}\\ &&\hspace{-1cm}w^{ij}(k)=w^{ij}(k-1)+\frac{c}{2}\big(\lambda^i(k-1)-\lambda^j(k-1)\big),\label{w_update_ADMM}\\ &&\hspace{-1cm}z^{ij}(k)=z^{ij}(k-1)+\frac{c}{2}\big(\lambda^j(k-1)-\lambda^i(k-1)\big).\label{z_update_ADMM} \end{eqnarray} The update rule for the slack variable $t^{ij}\in\mathbb{R}^N$, $\forall i\in V, j\in N_i$, which is based on \eqref{Augmented_Lag}, is as follows:\vspace{-0cm} \begin{eqnarray}\label{tijavalesh} &&\hspace{-0.7cm}t^{ij}(k)=\text{arg }\min_{t^{ij}} L_i^{a}\Big(x^i(k-1), \{t^{ls},u^{ls}(k),v^{ls}(k)\},\nonumber\\ &&\hspace{-0.7cm}\lambda^i(k-1),\{p^{ls}(k-1),w^{ls}(k),z^{ls}(k)\}\Big)\nonumber\\ &&\hspace{-0.7cm}=\text{arg }\min_{t^{ij}}\Big\{-(u^{ij}(k)+v^{ij}(k))^Tt^{ij}\nonumber\\ &&\hspace{-0.7cm}+\frac{c}{2}(\|x^i(k-1)-t^{ij}\|^2+\|x^j(k-1)-t^{ij}\|^2)\Big\}\nonumber\\ &&\hspace{-0.7cm}=\frac{1}{2c}(u^{ij}(k)+v^{ij}(k))+\frac{1}{2}(x^i(k-1)+x^j(k-1)).\label{x_i^i_ADMM} \end{eqnarray} The initial conditions $u^{ij}(0)=v^{ij}(0)=\textbf{0}_N$ $\forall i\in V,\,j\in N_i$ along with \eqref{u_update_ADMM} and \eqref{v_update_ADMM} suggest that $u^{ij}(k)+v^{ij}(k)=\textbf{0}_N$ $\forall i\in V,\,j\in N_i,\,k>0$. Then, \eqref{tijavalesh} yields, \begin{equation} t^{ij}(k)=\frac{x^i(k-1)+x^j(k-1)}{2}.\label{t_ij_simp} \end{equation} Similarly the update rule for $p^{ij}\in\mathbb{R}^m$ $\forall i\in V, j\in N_i$ is represented as the following:\vspace{-0cm} \begin{equation} p^{ij}(k)=\frac{\lambda^i(k-1)+\lambda^j(k-1)}{2}.\label{p_ij_simp} \end{equation} The local estimate update for all $i\in V$ is a min-max optimization problem based on \eqref{Augmented_Lag}. \begin{eqnarray}\label{x_i^i start} &&\hspace{-0.8cm}x_i^i(k)\!=\!\text{arg }\min_{x_i^i\in\mathbb{R}}\max_{\lambda^i\in\mathbb{R}^m}\!L_i^{a}\Big(x_i^i, \{t^{ls}(k), u^{ls}(k), v^{ls}(k)\},\lambda^i,\nonumber\\ &&\hspace{-0.8cm}\{p^{ls}(k), w^{ls}(k), z^{ls}(k)\}\Big)\nonumber\\ &&\hspace{-0.8cm}=\text{arg }\min_{x_i^i}\max_{\lambda^i}\Big\{J_i(x_i^i,x_{-i}^i(k-1))+\mathcal{I}_{\Omega_i}(x_i^i)\nonumber\\ &&\hspace{-0.8cm}-{\lambda^i}^Tb^i+{\lambda^i}^TA_i^ix_i^i+{\lambda^i}^TA_{-i}^ix_{-i}^i(k-1)\nonumber\\ &&\hspace{-0.8cm}+{U_i^i}(k)^Tx_i^i-{W^i}(k)^T\lambda^i\nonumber\\ &&\hspace{-0.8cm}+c\sum_{j\in N_i}\Big\|x_i^i-\frac{x_i^i(k-1)+x_i^j(k-1)}{2}\Big\|^2\nonumber\\ &&\hspace{-0.8cm}-c\sum_{j\in N_i}\Big\|\lambda^i-\frac{\lambda^i(k-1)+\lambda^j(k-1)}{2}\Big\|^2\Big\}\quad\forall i\in V.\label{x_i^i_ADMM_bef} \end{eqnarray} In the derivation of \eqref{x_i^i start}, we used \eqref{t_ij_simp} and \eqref{p_ij_simp}. The next min-max problem is equivalent in the sense that its solutions for $x_i^i$ and $\lambda^i$ are equivalent to the solutions of \eqref{x_i^i start}. \begin{eqnarray}\label{x_i^ivasat} &&\hspace{-0.8cm}x_i^i(k)=\text{arg }\min_{x_i^i}\max_{\lambda^i}\Big\{J_i(x_i^i,x_{-i}^i(k-1))+\mathcal{I}_{\Omega_i}(x_i^i)\nonumber\\ &&\hspace{-0.8cm}+c\sum_{j\in N_i}\Big\|x_i^i-\frac{x_i^i(k-1)+x_i^j(k-1)}{2}\Big\|^2+{U_i^i}(k)^Tx_i^i\\ &&\hspace{-0.8cm}+{\lambda^i}^T\Big(A_i^ix_i^i+A_{-i}^ix_{-i}^i(k-1)-b^i-{W^i}(k)\nonumber\\ &&\hspace{-0.8cm}+c\sum_{j\in N_i}(\lambda^i(k-1)+\lambda^j(k-1))\Big)-c|N_i|\|\lambda^i\|^2\Big\}\quad\forall i\in V.\label{x_i^i_ADMM_bef}\nonumber \end{eqnarray} For the last two lines of \eqref{x_i^ivasat}, we complete the squared term as follows: \begin{eqnarray}\label{x_i^ifaghatlambda^i} &&\hspace{-0.2cm}x_i^i(k)=\text{arg }\min_{x_i^i}\max_{\lambda^i}\Big\{J_i(x_i^i,x_{-i}^i(k-1))+\mathcal{I}_{\Omega_i}(x_i^i)\nonumber\\ &&\hspace{-0.2cm}+c\sum_{j\in N_i}\Big\|x_i^i-\frac{x_i^i(k-1)+x_i^j(k-1)}{2}\Big\|^2+{U_i^i}(k)^Tx_i^i\nonumber\\ &&\hspace{-0.2cm}-c|N_i|\Big\|\lambda^i-\frac{1}{2c|N_i|}\Big[c\sum_{j\in N_i}(\lambda^i(k-1)+\lambda^j(k-1))\nonumber\\ &&\hspace{-0.2cm}-{W^i}(k)+A_i^ix_i^i+A_{-i}^ix_{-i}^i(k-1)-b^i\Big]\Big\|^2\nonumber\\ &&\hspace{-0.2cm}+\frac{1}{4c|N_i|}\Big\|c\sum_{j\in N_i}(\lambda^i(k-1)+\lambda^j(k-1))\nonumber\\ &&\hspace{-0.2cm}-{W^i}(k)+A_i^ix_i^i+A_{-i}^ix_{-i}^i(k-1)-b^i\Big\|^2\Big\}. \end{eqnarray} Only the third line of \eqref{x_i^ifaghatlambda^i} is dependent on $\lambda^i$ which is the maximization variable. Thus, to maximize \eqref{x_i^ifaghatlambda^i} w.r.t. $\lambda^i$, we let $\lambda^i(k)$ be as follows: \begin{eqnarray}\label{lambda^i} &&\hspace{-1cm}\lambda^i(k)=\frac{1}{2c|N_i|}\Big(A_i^ix_i^{i}(k)+A_{-i}^ix_{-i}^{i}(k-1)-b^i\nonumber\\ &&\hspace{-1cm}-{W^i}(k)+2c\sum_{j\in N_i}\frac{\lambda^i(k-1)+\lambda^j(k-1)}{2}\Big). \end{eqnarray} Substituting back \eqref{lambda^i} into \eqref{x_i^ifaghatlambda^i}, we obtain, \begin{eqnarray}\label{x_i^ighableproximation} &&\hspace{-0.2cm}x_i^i(k)=\text{arg }\min_{x_i^i}\Big\{J_i(x_i^i,x_{-i}^i(k-1))+\mathcal{I}_{\Omega_i}(x_i^i)\nonumber\\ &&\hspace{-0.2cm}+c\sum_{j\in N_i}\Big\|x_i^i-\frac{x_i^i(k-1)+x_i^j(k-1)}{2}\Big\|^2+{U_i^i}(k)^Tx_i^i\nonumber\\ &&\hspace{-0.2cm}+\frac{1}{4c|N_i|}\Big\|c\sum_{j\in N_i}(\lambda^i(k-1)+\lambda^j(k-1))\nonumber\\ &&\hspace{-0.2cm}-{W^i}(k)+A_i^ix_i^i+A_{-i}^ix_{-i}^i(k-1)-b^i\Big\|^2\Big\}. \end{eqnarray} We simplify \eqref{x_i^ighableproximation} by using a proximal first-order approximation for $J_i(x_i^i,x_{-i}^i(k-1))$ and the last term in \eqref{x_i^ighableproximation} around $x^i(k-1)$; thus using inexact ADMM it follows: \begin{eqnarray}\label{x_i^ighableakhar} &&\hspace{-0.7cm}x_i^i(k)=\text{arg }\min_{x_i^i}\Big\{\Big[\nabla_iJ_i(x^i(k-1))+\frac{{A_i^i}^T}{2c|N_i|}\Big(A^ix^i(k-1)\nonumber\\ &&\hspace{-0.7cm}-b^i-{W^i}(k)+c\sum_{j\in N_i}(\lambda^i(k-1)+\lambda^j(k-1))\Big)\Big]^T.\nonumber\\ &&\hspace{-0.7cm}.(x_i^i-x_{i}^i(k-1))+\frac{\beta_i}{2}\|x_i^i-x_{i}^i(k-1)\|^2 +\mathcal{I}_{\Omega_i}(x_i^i)\nonumber\\ &&\hspace{-0.7cm}+c\sum_{j\in N_i}\Big\|x_i^i-\frac{x_i^i(k-1)+x_i^j(k-1)}{2}\Big\|^2+{U_i^i}(k)^Tx_i^i\Big\}, \end{eqnarray} where $\beta_i>0$ is a penalty factor for the proximal first-order approximation for $i\in V$. We obtain an equivalent problem to \eqref{x_i^ighableakhar} in the following such that its gradient w.r.t. $x_i^i$ is equivalent to that of \eqref{x_i^ighableakhar}. \begin{eqnarray}\label{x_i^ioptimal} &&\hspace{-0.7cm}x_i^i(k)=\text{arg }\min_{x_i^i}\Big\{\mathcal{I}_{\Omega_i}(x_i^i)+\frac{\alpha_i}{2}\Big\|x_i^i-\alpha_i^{-1}\Big(\beta_ix_i^i(k-1)\nonumber\\ &&\hspace{-0.7cm}-\nabla_iJ_i(x^i(k-1))-{U_i^i}(k)+c\sum_{j\in N_i}(x_i^i(k-1)+x_i^j(k-1))\nonumber\\ &&\hspace{-0.7cm}-\frac{{A_i^i}^T}{2c|N_i|}\Big(A^ix^{i}(k-1)-b^i-{W^i}(k)\nonumber\\ &&\hspace{-0.7cm}+c\sum_{j\in N_i}\lambda^i(k-1)+\lambda^j(k-1)\Big)\Big)\Big\|^2\Big\}, \end{eqnarray} \vspace{-0cm} where $\alpha_i:=\beta_i+2c|N_i|$. Let $\text{prox}_{g}^{a}[s]:=\text{arg }\min_{x}\{g(x)+\frac{a}{2}\|x-s\|^2\}$ be the proximal operator for the non-smooth function $g$. Note that $\text{prox}_{\mathcal{I}_{\Omega_i}}^{\alpha_i}[s]=T_{\Omega_i}[s]$ where $T_{\Omega_i}:\mathbb{R}\rightarrow\Omega_i$ is an Euclidean projection. Then for each player $i$, $\forall i\in V$ we obtain, \vspace{-0cm} \begin{eqnarray} &&\hspace{-0.7cm}x_i^i(k)=T_{\Omega_i}\Big[\alpha_i^{-1}\Big(\gamma_ix_i^i(k-1)-\nabla_iJ_i(x^i(k-1))-{U_i^i}(k)\nonumber\\ &&\hspace{-0.7cm}+c\sum_{j\in N_i}x_i^j(k-1)-\frac{{A_i^i}^T}{2c|N_i|}\Big(A_{-i}^ix_{-i}^{i}(k-1)-b^i-{W^i}(k)\nonumber\\ &&\hspace{-0.7cm}+c\sum_{j\in N_i}\lambda^i(k-1)+\lambda^j(k-1)\Big)\Big)\Big], \end{eqnarray} where $\gamma_i:=\beta_i+c|N_i|-\frac{1}{2c|N_i|}{A_i^i}^TA_i^i$. Eventually, after updating his action and dual Lagrange multiplier, each player $i$ takes average of the received information with his estimate and updates his estimate as follows:\vspace{-0cm} \begin{equation} x_{-i}^i(\!k\!)\!=\!\frac{1}{2}\!\Big(\!x_{-i}^i(\!k\!-\!1\!)\!+\!\underbrace{\frac{1}{|N_i|}\!\sum_{j\in N_i}\!x_{-i}^j\!(\!k\!-\!1\!)}_{\text{RECEIVED INFORMATION}}\Big)\!-\underbrace{\frac{1}{2c|N_i|}\!{U_{-i}^i}\!(k)}_{\text{PENALTY TERM}},\label{x_-i_Update} \end{equation} where $c>0$ is a scalar coefficient which is also used in \eqref{Augmented_Lag}. Note that in \eqref{x_-i_Update}, the penalty term is associated with the difference between the estimates of the neighboring players (Equations~\eqref{u_update_ADMM}, \eqref{v_update_ADMM}). Then the ADMM algorithm is represented as in Algorithm~1. \begin{algorithm} \caption{ADMM Algorithm} \label{ADMMalgorithm} \begin{algorithmic}[1] \State \textbf{initialization} $x^i(0)\in\Omega$, $\lambda^i(0)\in\mathbb{R}^m$, $U^{i}(0)=\textbf{0}_N$ and $W^{i}(0)=\textbf{0}_m$ $\forall i\in V$ \For{$k=1,2,\ldots$ } \For{each player $i\in V$ } \State players $i$, $j$ $\forall j\in N_i$ exchange $x^i(k-1)$, \Statex \hspace{0.95cm} $x^j(k-1)$, $\lambda^i(k-1)$ and $\lambda^j(k-1)$. \State $U^i(k)\!=\!U^i(k-1)\!+\!c\sum_{j\in N_i}(x^i(k-1)-x^j(k-1))$ \State $W^i(k)\!=\!W^i(k-1)\!+\!c\sum_{j\in N_i}(\lambda^i(k-1)\!-\!\lambda^j(k\!-\!1))$ \State $x_i^i(k)=T_{\Omega_i}\Big[\alpha_i^{-1}\Big(\gamma_ix_i^i(k-1)-\nabla_iJ_i(x^i(k-1))$ \Statex\hspace{2.3cm}$-{U_i^i}(k)+c\sum_{j\in N_i}x_i^j(k-1)$ \Statex\hspace{2.3cm}$-\frac{{A_i^i}^T}{2c|N_i|}\Big(A_{-i}^ix_{-i}^{i}(k-1)-b^i-{W^i}(k)$ \Statex\hspace{2.3cm} $+c\sum_{j\in N_i}\lambda^i(k-1)+\lambda^j(k-1)\Big)\Big)\Big]$ \State $\lambda^i(k)=\frac{1}{2c|N_i|}\Big(A_i^ix_i^{i}(k)+A_{-i}^ix_{-i}^{i}(k-1)-b^i$ \Statex\hspace{2.3cm}$-{W^i}(k)+2c\sum_{j\in N_i}\frac{\lambda^i(k-1)+\lambda^j(k-1)}{2}\Big)$ \State $x_{-i}^i(k)=\frac{\sum_{j\in N_i}x_{-i}^j(k-1))}{|N_i|}-\frac{U_{-i}^i(k-1)}{2c|N_i|}$ \EndFor \EndFor \vspace{-0cm} \end{algorithmic} \vspace{-0cm} \end{algorithm} \vspace{-0.5cm} \section{Convergence Proof}\label{convergence_proof} \begin{theorem}\label{theorem_convergence_rate} Let $\beta_i>0$ be player $i$'s penalty factor of the approximation in the inexact ADMM Algorithm~\ref{ADMMalgorithm} which satisfies\vspace{-0.2cm} \begin{equation}\label{condition} \sigma_F>\frac{1}{2\beta_{i}-\frac{\|A_i^i\|^2}{c|N_i|}}, \end{equation} where $\sigma_F$ is a positive constant for the cocoercive property of $F$, $A_i^i$ is player $i$'s problem data and $N_i$ is the number of neighbors of player $i$. Under Assumptions~\ref{constraint}-\ref{Lip_assump}, the sequence $\{x^i(k)\}$ $\forall i\in V$, generated by Algorithm~\ref{ADMMalgorithm} converges to $x^*$ NE of game \eqref{mini_0}. \end{theorem} \par{\emph{Proof}}. From step~7 in Algorithm~1, we obtain the following optimality condition: \begin{eqnarray}\label{optmal} &&\hspace{-0.2cm}\nabla_iJ_i(x^i(k-1))+\beta_i(x_i^i(k)-x_{i}^i(k-1)) +\partial_i\mathcal{I}_{\Omega_i}(x_i^i(k))\nonumber\\ &&\hspace{-0.2cm}+\frac{{A_i^i}^T}{2c|N_i|}\Big(A^ix^{i}(k-1)-b^i-W^i(k)\\ &&\hspace{-0.2cm}+c\sum_{j\in N_i}(\lambda^i(k-1)+\lambda^j(k-1))\Big)+U_i^i(k)\nonumber\\ &&\hspace{-0.2cm}+2c\sum_{j\in N_i}\Big(x_i^i(k)-\frac{x_i^i(k-1)+x_i^j(k-1)}{2}\Big)=0\quad\forall i\in V,\nonumber \end{eqnarray} Adding and subtracting $A_i^ix_i^i(k)$ from the second line of \eqref{optmal} and using \eqref{lambda^i}, it leads to \begin{eqnarray}\label{darakhar1} &&\hspace{-0.8cm}\nabla_iJ_i(x^i(k-1)) +\partial_i\mathcal{I}_{\Omega_i}(x_i^i(k))+{A_i^i}^T\lambda^i(k)\nonumber\\ &&\hspace{-0.8cm}+\delta_i(x_i^i(k)-x_i^i(k-1))+U_i^i(k)\\ &&\hspace{-0.8cm}+2c\sum_{j\in N_i}\Big(x_i^i(k)-\frac{x_i^i(k-1)+x_i^j(k-1)}{2}\Big)=0\quad\forall i\in V,\nonumber\vspace{-0cm} \end{eqnarray} where $\delta_i:=\beta_i-\frac{1}{2c|N_i|}{A_i^i}^TA_i^i$. Adding the first Nash condition \eqref{Nash_equations} and multiplying by $(x_i^i(k)-x_i^*)$, we obtain, \begin{eqnarray}\label{optimalx_inahayi} &&\hspace{-0.7cm}\Big(\nabla_iJ_i(x^i(k-1))-\nabla_iJ_i(x^*)\Big)^T(x_i^i(k-1)-x_i^*)\nonumber\\ &&\hspace{-0.7cm}+\Big(\nabla_iJ_i(x^i(k-1))-\nabla_iJ_i(x^*)\Big)^T(x_i^i(k)-x_i^i(k-1))\nonumber\\ &&\hspace{-0.7cm}+\Big(\partial_i\mathcal{I}_{\Omega_i}(x_i^i(k))-\partial_i\mathcal{I}_{\Omega_i}(x_i^*)\Big)^T(x_i^i(k)-x_i^*)\nonumber\\ &&\hspace{-0.7cm}+\Big(\lambda^i(k)-\lambda^*\Big)^TA_i^i(x_i^i(k)-x_i^*)\\ &&\hspace{-0.7cm}+\delta_i(x_i^i(k)-x_i^i(k-1))^T(x_i^i(k)-x_i^*)\nonumber\\ &&\hspace{-0.7cm}+\Big(U_i^i(k)-{U_i^i}^*\Big)^T(x_i^i(k)-x_i^*)\nonumber\\ &&\hspace{-0.7cm}+2c\!\sum_{j\in N_i}\!\Big(\!x_i^i(k)\!-\!\frac{x_i^i(k-1)\!+\!x_i^j(k-1)}{2}\!\Big)^T\!(\!x_i^i(k)\!-\!x_i^*)\!=\!0\nonumber \end{eqnarray} On the other hand, from \eqref{lambda^i} we obtain, \begin{eqnarray}\label{darakhar2} &&\hspace{-0.5cm}\textbf{0}_m=-A_i^ix_i^{i}(k)-A_{-i}^ix_{-i}^{i}(k-1)+b^i\nonumber\\ &&\hspace{-0.5cm}+W^i(k)+2c\sum_{j\in N_i}\lambda^i(k)-\frac{\lambda^i(k)+\lambda^j(k)}{2}\nonumber\\ &&\hspace{-0.5cm}+c\sum_{j\in N_i}(\lambda^i(k)+\lambda^j(k)-\lambda^i(k-1)-\lambda^j(k-1)), \end{eqnarray} Note that by \eqref{w_update_ADMM} and \eqref{z_update_ADMM}, $W^i(k+1)=W^i(k)+2c\sum_{j\in N_i}\lambda^i(k)-\frac{\lambda^i(k)+\lambda^j(k)}{2}$. Then, We add the second Nash condition \eqref{Nash_equations} to \eqref{darakhar2}. Moreover, using Assumption~\ref{constraint}, there exists a matrix $B^i$ such that we multiply into \eqref{darakhar2} and then multiply the result by $(\lambda^i(k)-\lambda^*)$. \begin{eqnarray}\label{OptimalLamndanahayi} &&\hspace{-0.7cm}0=-(x_i^{i}(k)-x_i^*)^T{A_i^i}^T(\lambda^i(k)-\lambda^*)\nonumber\\ &&\hspace{-0.7cm}+\Big(W^i(k+1)-{W^i}^*\Big)^T{B^i}^T(\lambda^i(k)-\lambda^*)\nonumber\\ &&\hspace{-0.7cm}+c\sum_{j\in N_i}(\lambda^i(k)+\lambda^j(k)-\lambda^i(k-1)-\lambda^j(k-1))^T\nonumber\\ &&\hspace{-0.7cm}.{B^i}^T(\lambda^i(k)-\lambda^*). \end{eqnarray} Adding \eqref{OptimalLamndanahayi} to \eqref{optimalx_inahayi}, it yields, \begin{eqnarray}\label{optimalbeforx-i} &&\hspace{-0.7cm}\Big(\nabla_iJ_i(x^i(k-1))-\nabla_iJ_i(x^*)\Big)^T(x_i^i(k-1)-x_i^*)\nonumber\\ &&\hspace{-0.7cm}+\Big(\nabla_iJ_i(x^i(k-1))-\nabla_iJ_i(x^*)\Big)^T(x_i^i(k)-x_i^i(k-1))\nonumber\\ &&\hspace{-0.7cm}+\Big(\partial_i\mathcal{I}_{\Omega_i}(x_i^i(k))-\partial_i\mathcal{I}_{\Omega_i}(x_i^*)\Big)^T(x_i^i(k)-x_i^*)\nonumber\\ &&\hspace{-0.7cm}+\delta_i(x_i^i(k)-x_i^i(k-1))^T(x_i^i(k)-x_i^*)\nonumber\\ &&\hspace{-0.7cm}+\Big(U_i^i(k)-{U_i^i}^*\Big)^T(x_i^i(k)-x_i^*)\nonumber\\ &&\hspace{-0.7cm}+\Big(W^i(k+1)-{W^i}^*)^T{B^i}^T(\lambda^i(k)-\lambda^*)\nonumber\\ &&\hspace{-0.7cm}+c\sum_{j\in N_i}(\lambda^i(k)+\lambda^j(k)-\lambda^i(k-1)-\lambda^j(k-1))^T.\nonumber\\ &&\hspace{-0.7cm}.{B^i}^T(\lambda^i(k)-\lambda^*)\\ &&\hspace{-0.7cm}+2c\!\sum_{j\in N_i}\!\Big(\!x_i^i(k)\!-\!\frac{x_i^i(k-1)\!+\!x_i^j(k-1)}{2}\Big)^T\!(x_i^i(k)\!-\!x_i^*)=0.\nonumber \end{eqnarray} The last equation that we need to add it to \eqref{optimalbeforx-i} is the one associated with $x_{-i}^i$, \eqref{x_-i_Update}, and multiplied by $(x_{-i}^i-x_{-i}^*)$. \begin{eqnarray}\label{u_for_-i_*_mult} &&\hspace{-1cm}U_{-i}^i(k)^T(x_{-i}^i(k)-x_{-i}^*)\nonumber\\ &&\hspace{-1cm}+2c\sum_{j\in N_i}\Big(x_{-i}^i(k)-\frac{x_{-i}^i(k-1)+x_{-i}^j(k-1)}{2}\Big)^T\nonumber\\ &&\hspace{-1cm}.(x_{-i}^i(k)-x_{-i}^*)=0. \end{eqnarray} Adding \eqref{u_for_-i_*_mult} to \eqref{optimalbeforx-i}, and using \eqref{u_update_ADMM} and \eqref{v_update_ADMM} for simplification, we obtain, \begin{eqnarray}\label{optimalghablejam} &&\hspace{-0.7cm}\Big(\nabla_iJ_i(x^i(k-1))-\nabla_iJ_i(x^*)\Big)^T(x_i^i(k-1)-x_i^*)\nonumber\\ &&\hspace{-0.7cm}+\Big(\nabla_iJ_i(x^i(k-1))-\nabla_iJ_i(x^*)\Big)^T(x_i^i(k)-x_i^i(k-1))\nonumber\\ &&\hspace{-0.7cm}+\Big(\partial_i\mathcal{I}_{\Omega_i}(x_i^i(k))-\partial_i\mathcal{I}_{\Omega_i}(x_i^*)\Big)^T(x_i^i(k)-x_i^*)\nonumber\\ &&\hspace{-0.7cm}+\delta_i(x_i^i(k)-x_i^i(k-1))^T(x_i^i(k)-x_i^*)\nonumber\\ &&\hspace{-0.7cm}+\!\sum_{j\in N_i}\!(u_i^{ij}(k+1)\!+\!v_i^{ji}(k+1)\!-\!{u_i^{ij}}^*\!-\!{v_i^{ji}}^*)^T\!(x_i^i(k)\!-\!x_i^*)\nonumber\\ &&\hspace{-0.7cm}+\sum_{j\in N_i}(u_{-i}^{ij}(k+1)+v_{-i}^{ji}(k+1))^T(x_{-i}^i(k)-x_{-i}^*)\nonumber\\ &&\hspace{-0.7cm}+\sum_{j\in N_i}(w^{ij}(k+1)+z^{ji}(k+1)-{w^{ij}}^*-{z^{ji}}^*)^T\nonumber\\ &&\hspace{-0.7cm}.{B^i}^T(\lambda^i(k)-\lambda^*)\nonumber\\ &&\hspace{-0.7cm}+c\sum_{j\in N_i}(\lambda^i(k)+\lambda^j(k)-\lambda^i(k-1)-\lambda^j(k-1))^T\nonumber\\ &&\hspace{-0.7cm}.{B^i}^T(\lambda^i(k)-\lambda^*).\nonumber\\ &&\hspace{-0.7cm}+c\sum_{j\in N_i}\Big(x^i(k)+x^j(k)-x^i(k-1)-x^j(k-1)\Big)^T\nonumber\\ &&\hspace{-0.7cm}.(x_i^i(k)-x_i^*)=0. \end{eqnarray} The second and third terms are bounded as follows:\vspace{-0cm} \begin{eqnarray}\label{cauchy_Schewwrtz} &&\hspace{-0.8cm}\Big(\nabla_iJ_i(x^i(k-1))\!-\!\nabla_iJ_i(x^*)\Big)^T\!(x_i^i(k)\!-\!x_i^i(k-1))\geq\\ &&\hspace{-0.8cm}\frac{-1}{2\rho}\!\|\!\nabla_iJ_i(x^i(k-1))\!-\!\nabla_iJ_i(x^*)\!\|^2\!-\!\frac{\rho}{2}\!\|\!x_i^i(k)\!-\!x_i^i(k-1)\!\|^2,\nonumber \end{eqnarray} for any $\rho>0$ $\forall i\in V$. By the convexity of $\mathcal{I}_{\Omega_i}$ (Assumption~\ref{assump}), we have for the third term, \begin{equation}\label{convexity_of_Indicator} (\partial\mathcal{I}_{\Omega_i}(x_i^i(k))-\partial\mathcal{I}_{\Omega_i}(x_i^*))^T(x_i^i(k)-x_i^*)\geq 0. \end{equation} Using \eqref{cauchy_Schewwrtz} and \eqref{convexity_of_Indicator} in \eqref{optimalghablejam} and summing over $i\in V$, we obtain, \begin{eqnarray}\label{optim_equation_Nash_combo_multiplic_Revised_Sum} &&\hspace{-0.7cm}\Big(F(\underline{x}(k-1))-F(\underline{x}^*)\Big)^T(x(k-1)-x^*)\nonumber\\ &&\hspace{-0.7cm}-\frac{1}{2\rho}\|F(\underline{x}(k-1))-F(\underline{x}^*)\|^2-\frac{1}{2}\|\underline{x}(k)-\underline{x}(k-1)\|_{M_1}^2\nonumber\\ &&\hspace{-0.7cm}+(\underline{x}(k)-\underline{x}(k-1))^T\text{diag}((\delta_ie_ie_i^T)_{i\in V})(\underline{x}(k)-\underline{x}^*)\nonumber\\ &&\hspace{-0.7cm}+\!\sum_{i\in V}\!\sum_{j\in N_i}\!(\!u_i^{ij}(k+1)\!+\!v_i^{ji}(k+1)\!-\!{u_i^{ij}}^*\!-\!{v_i^{ji}}^*\!)^T\!(\!x_i^i(k)\!-\!x_i^*\!)\nonumber\\ &&\hspace{-0.7cm}+\sum_{i\in V}\sum_{j\in N_i}(u_{-i}^{ij}(k+1)+v_{-i}^{ji}(k+1))^T(x_{-i}^i(k)-x_{-i}^*)\nonumber\\ &&\hspace{-0.7cm}+\frac{2}{c}(\underline{w}(k+1)-\underline{w}^*)^T\text{diag}(({B^i}^T)_{i\in V})(\underline{w}(k+1)-\underline{w}(k))\nonumber\\ &&\hspace{-0.7cm}+c(\underline{\lambda}(k)-\underline{\lambda}(k-1))^T((D+H)\otimes I_m)\nonumber\\ &&\hspace{-0.7cm}.\text{diag}(({B^i}^T)_{i\in V})(\underline{\lambda}(k)-\underline{\lambda}^*)+c(\underline{x}(k)-\underline{x}(k-1))^T\nonumber\\ &&\hspace{-0.7cm}.((D+H)\otimes I_N)(\underline{x}(k)-\underline{x}^*)\leq 0, \end{eqnarray} where $M_1:=\text{diag}((\rho e_ie_i^T)_{i\in V})$, $\underline{x}^*=[{{x^1}^*}^T,\ldots,{{x^N}^*}^T]^T$, $\underline{\lambda}=[{{\lambda^1}}^T,\ldots,{{\lambda^N}}^T]^T$ and $\underline{\lambda}^*=[{{\lambda^1}^*}^T,\ldots,{{\lambda^N}^*}^T]^T$. Moreover, $\underline{w}=(w^i)_{i\in V}\in \mathbb{R}^{m\sum_{i\in V}|N_i|}$ and $w^i=(w^{ij})_{j\in N_i}\in\mathbb{R}^{m|N_i|}$ and also $\underline{w}^*=({w^i}^*)_{i\in V}\in \mathbb{R}^{m\sum_{i\in V}|N_i|}$ and ${w^i}^*=({w_i^{ij}}^*)_{j\in N_i}\in\mathbb{R}^{m|N_i|}$. We bound the first term using Assumption~\ref{Lip_assump},\vspace{-0.3cm} \begin{eqnarray}\label{Cocoe_in_equat} &&\hspace{-1cm}\Big(F(\underline{x}(k-1))-F(\underline{x}^*)\Big)^T(x(k-1)-x^*)\nonumber\\ &&\hspace{-1cm}\geq\sigma_F\|F(\underline{x}(k-1))-F(\underline{x}^*)\|^2. \end{eqnarray} We also simplify the fourth and the fifth lines in \eqref{optim_equation_Nash_combo_multiplic_Revised_Sum}. Since $G_C$ is an undirected graph, for any $\{a_{ij}\}$, $\sum_{i\in V}\sum_{j\in N_i}a_{ij}=\sum_{i\in V}\sum_{j\in N_i}a_{ji}$. Then,\vspace{-0.2cm} \begin{eqnarray}\label{simpil_u_underline_bef} &&\hspace{-0.8cm}\sum_{i\in V}\!\sum_{j\in N_i}\!(u_i^{ij}(k+1)\!+\!v_i^{ji}(k+1)\!-\!{u_i^{ij}}^*\!-\!{v_i^{ji}}^*)^T\!(x_i^i(k)\!-\!x_i^*)\nonumber\\ &&\hspace{-0.8cm}+\sum_{i\in V}\sum_{j\in N_i}(u_{-i}^{ij}(k+1)+v_{-i}^{ji}(k+1))^T(x_{-i}^i(k)-x_{-i}^*)\nonumber\\ &&\hspace{-0.8cm}=\sum_{i\in V}\sum_{j\in N_i}(u_i^{ij}(k+1)-{u_i^{ij}}^*)^T(x_i^i(k)-x_i^*)\nonumber\\ &&\hspace{-0.8cm}+\sum_{i\in V}\sum_{j\in N_i}(v_i^{ij}(k+1)-{v_i^{ij}}^*)^T(x_i^j(k)-x_i^*)\nonumber\\ &&\hspace{-0.8cm}+\sum_{i\in V}\sum_{j\in N_i}u_{-i}^{ij}(k+1)^T(x_{-i}^i(k)-x_{-i}^*)\nonumber\\ &&\hspace{-0.8cm}+\sum_{i\in V}\sum_{j\in N_i}v_{-i}^{ij}(k+1)^T(x_{-i}^j(k)-x_{-i}^*). \end{eqnarray} Note that by \eqref{u_update_ADMM} and \eqref{v_update_ADMM} as well as the initial conditions for Lagrange multipliers $u^{ij}(0)=v^{ij}(0)=\textbf{0}_N$ $\forall i\in V,\,j\in N_i$, we obtain, \begin{equation}\label{u+v=0}u^{ij}(k)+v^{ij}(k)=\textbf{0}_N\quad \forall i\in V,\,j\in N_i,\,k>0. \end{equation} Substituting \eqref{u+v=0} into \eqref{simpil_u_underline_bef} and using \eqref{Nash_equations}, we obtain,\vspace{-0.2cm} \begin{eqnarray}\label{simpil_u_underline} &&\hspace{-0.8cm}\sum_{i\in V}\sum_{j\in N_i}(u_i^{ij}(k+1)-{u_i^{ij}}^*)^T(x_i^i(k)-x_i^j(k))\nonumber\\ &&\hspace{-0.8cm}+\sum_{i\in V}\sum_{j\in N_i}u_{-i}^{ij}(k+1)^T(x_{-i}^i(k)-x_{-i}^j(k))\nonumber\\ &&\hspace{-0.8cm}=\frac{2}{c}\sum_{i\in V}\sum_{j\in N_i}(u^{ij}(k+1)-{u_i^{ij}}^*e_i)^T(u^{ij}(k+1)-{u^{ij}}(k))\nonumber\\ &&\hspace{-0.8cm}:=\frac{2}{c}(\underline{u}(k+1)-\underline{u}^*)^T(\underline{u}(k+1)-\underline{u}(k)), \end{eqnarray} where $\underline{u}=(u^i)_{i\in V}\in \mathbb{R}^{N\sum_{i\in V}|N_i|}$ and $u^i=(u^{ij})_{j\in N_i}\in\mathbb{R}^{N|N_i|}$ and also $\underline{u}^*=({u^i}^*)_{i\in V}\in \mathbb{R}^{N\sum_{i\in V}|N_i|}$ and ${u^i}^*=({u_i^{ij}}^*)_{j\in N_i}\otimes e_i\in\mathbb{R}^{N|N_i|}$. Using \eqref{Cocoe_in_equat} and \eqref{simpil_u_underline}, for $\rho=\frac{1}{2\sigma_F}$ \eqref{optim_equation_Nash_combo_multiplic_Revised_Sum} becomes,\vspace{-0.3cm} \begin{eqnarray}\label{optim_equation_Nash_combo_multiplic_Revised_Sum_simpil} &&\hspace{-0.8cm}-\frac{1}{2}\|\underline{x}(k)-\underline{x}(k-1)\|_{M_1}^2\nonumber\\ &&\hspace{-0.8cm}+(\underline{x}(k)-\underline{x}(k-1))^TM_2(\underline{x}(k)-\underline{x}^*)\nonumber\\ &&\hspace{-0.8cm}+(\underline{\lambda}(k)-\underline{\lambda}(k-1))^TQ(\underline{\lambda}(k)-\underline{\lambda}^*)\nonumber\\ &&\hspace{-0.8cm}+\frac{2}{c}(\underline{u}(k+1)-\underline{u}^*)^T(\underline{u}(k+1)-\underline{u}(k))\nonumber\\ &&\hspace{-0.8cm}+\frac{2}{c}(\underline{w}(k+1)-\underline{w}^*)^TB(\underline{w}(k+1)-\underline{w}(k))\leq 0, \end{eqnarray} where $M_2:=\text{diag}\Big((\delta_i e_ie_i^T)_{i\in V}\Big)+c((D+H)\otimes I_N)$, $B:=\text{diag}(({B^i}^T)_{i\in V})$ and $Q:=c((D+H)\otimes I_N)B$. Note that, \begin{equation}\label{D+A_L} c((D+A)\otimes I_N)=c((D^{\frac{1}{2}}(2I-L_{N})D^{\frac{1}{2}})\otimes I_N), \end{equation} where $L:=D-H$, $D^{\frac{1}{2}}$, $D^{-\frac{1}{2}}$ and $L_N:=D^{-\frac{1}{2}}LD^{-\frac{1}{2}}$ are the Laplacian of $G_C$, the square root and reciprocal square root of $D$ and the normalized Laplacian of $G_C$, respectively. Since $D\succ 0$, $D^{-\frac{1}{2}}$ exist, it is shown in that $\lambda_{\max}(L_N)\leq2$. Then \eqref{D+A_L} yields that $c((D+H)\otimes I_N)\succeq0$. This concludes $M_2\succeq0$. Moreover, by Assumption~\ref{constraint}, $B\succeq 0$. We use the following inequality in \eqref{optim_equation_Nash_combo_multiplic_Revised_Sum_simpil} for every $\{a(k)\}$ and $M\succeq 0$: \begin{eqnarray} &&\hspace{-1cm}(a(k)-a(k-1))^TM(a(k)-a^*)=\frac{1}{2}\|a(k)-a^*\|_M^2\nonumber\\ &&\hspace{-1cm}+\frac{1}{2}\|a(k)-a(k-1)\|_M^2-\frac{1}{2}\|a(k-1)-a^*\|_M^2. \end{eqnarray} Then \eqref{optim_equation_Nash_combo_multiplic_Revised_Sum_simpil} becomes, \begin{eqnarray}\label{optim_equation_Nash_combo_multiplic_Revised_Sum_simpil_square} &&\hspace{-0.8cm}\Big\{\frac{1}{2}\|\underline{x}(k)-\underline{x}^*\|^2_{M_2}+\frac{1}{2}\|\underline{\lambda}(k)-\underline{\lambda}^*\|^2_{Q}\nonumber\\ &&\hspace{-0.8cm}+\frac{1}{c}\|\underline{u}(k+1)-\underline{u}^*\|^2+\frac{1}{c}\|\underline{w}(k+1)-\underline{w}^*\|_B^2\Big\}\leq\nonumber\\ &&\hspace{-0.8cm}\Big\{\frac{1}{2}\|\underline{x}(k-1)-\underline{x}^*\|^2_{M_2}+\frac{1}{2}\|\underline{\lambda}(k-1)-\underline{\lambda}^*\|^2_{Q}\nonumber\\ &&\hspace{-0.8cm}+\frac{1}{c}\|\underline{u}(k)-\underline{u}^*\|^2+\frac{1}{c}\|\underline{w}(k)-\underline{w}^*\|_B^2\Big\}\nonumber\\ &&\hspace{-0.8cm}-\frac{1}{2}\|\underline{x}(k)-\underline{x}(k-1)\|_{M_2-M_1}^2-\frac{1}{2}\|\underline{\lambda}(k)-\underline{\lambda}(k-1)\|^2_Q\nonumber\\ &&\hspace{-0.8cm}-\frac{1}{c}\|\underline{u}(k+1)-\underline{u}(k)\|^2-\frac{1}{c}\|\underline{w}(k+1)-\underline{w}(k)\|_B^2. \end{eqnarray} By the condition \eqref{condition}, $M_2-M_1\succ0$. Then \eqref{optim_equation_Nash_combo_multiplic_Revised_Sum_simpil_square} implies the following two results: \begin{enumerate} \item $\frac{1}{2}\|\underline{x}(k)-\underline{x}^*\|^2_{M_2}+\frac{1}{2}\|\underline{\lambda}(k)-\underline{\lambda}^*\|^2_{Q}+\frac{1}{c}\|\underline{u}(k+1)-\underline{u}^*\|^2+\frac{1}{c}\|\underline{w}(k+1)-\underline{w}^*\|_B^2\rightarrow\theta$, for some $\theta\geq0$, \vspace{0.3cm} \item $\begin{cases}\underline{x}(k)-\underline{x}(k-1)\rightarrow\textbf{0}_{N^2}\\ \underline{\lambda}(k)-\underline{\lambda}(k-1)\rightarrow\textbf{0}_{mN}\\ \underline{u}(k+1)-\underline{u}(k)\rightarrow\textbf{0}_{N\sum_{i\in V}|N_i|}\\ \underline{w}(k+1)-\underline{w}(k)\rightarrow\textbf{0}_{m\sum_{i\in V}|N_i|}\end{cases}$. \end{enumerate} Result 1 implies that the sequences $\{x^i(k)\},\,\{\lambda^i(k)\},\,\{u^{ij}(k)\}$ and $\{w^{ij}(k)\}$ (similarly $\{v^{ij}(k)\}$ and $\{z^{ij}(k)\}$) are bounded and have limit points denoted by $\bar{x}^i,\,\bar{\lambda}^i,\,\bar{u}^{ij}$ and $\bar{w}^{ij}$ ($\bar{v}^{ij}$ and $\bar{z}^{ij}$), respectively. Then, we obtain, \begin{eqnarray}\label{theta} &&\hspace{-0.8cm}\theta=\frac{1}{2}\|\underline{\bar{x}}(k)-\underline{x}^*\|^2_{M_2}+\frac{1}{2}\|\underline{\bar{\lambda}}(k)-\underline{\lambda}^*\|^2_{Q}\nonumber\\ &&\hspace{-0.8cm}+\frac{1}{c}\|\underline{\bar{u}}(k+1)-\underline{u}^*\|^2+\frac{1}{c}\|\underline{\bar{w}}(k+1)-\underline{\bar{w}}^*\|_B^2 \end{eqnarray} Result 2 along with \eqref{u_update_ADMM} and \eqref{w_update_ADMM} yield $\forall i\in V,\,j\in N_i$, \begin{equation}\label{xi=xjlambdai=lambdaj} \bar{x}^i=\bar{x}^j:=\bar{x},\,\bar{\lambda}^i=\bar{\lambda}^j:=\bar{\lambda} \end{equation} Moreover, by \eqref{u+v=0} we arrive at, \begin{equation}\label{u+v=0tilda}\bar{u}^{ij}+\bar{v}^{ij}=\textbf{0}_N\quad \forall i\in V,\,j\in N_i.\end{equation} Similarly, $\bar{w}^{ij}+\bar{z}^{ij}=\textbf{0}_m\quad \forall i\in V,\,j\in N_i$. Result 2 also implies that by \eqref{xi=xjlambdai=lambdaj}, \eqref{darakhar1} and \eqref{darakhar2}: \begin{eqnarray} &&\nabla_iJ_i(\bar{x})+\partial\mathcal{I}_{\Omega_i}(\bar{x}_i)+\sum_{j\in N_i}(\bar{u}_i^{ij}+\tilde{v}_i^{ji})=0,\label{optim_equation_tilda}\\ &&A^i\bar{x}-b^i-\sum_{j\in N_i}{\bar{w}^{ij}}+{\bar{z}^{ji}}=\textbf{0}_m.\label{shabihnash} \end{eqnarray} Comparing \eqref{xi=xjlambdai=lambdaj}-\eqref{shabihnash} with \eqref{Nash_equations}, it follows $\forall i\in V,\,j\in N_i$, \begin{eqnarray} &&\hspace{-0.8cm}\bar{x}^i=x^*\,(\underline{\bar{x}}=\underline{x^*}),\,\bar{\lambda}^i=x^*\,(\underline{\bar{\lambda}}=\underline{\lambda^*}),\label{xxlambdatilde=lambdastar}\\ &&\hspace{-0.8cm}\bar{u}^{ij}={u^{ij}}^*\,(\underline{\bar{u}}=\underline{u^*}),\,\bar{w}^{ij}={w^{ij}}^*\,(\underline{\bar{w}}=\underline{w^*}).\label{wtilde=wstar} \end{eqnarray} This completes the proof. $\hfill\blacksquare$ \section{Simulation Results} In this section, we simulate our algorithm for a wireless ad-hoc network (WANET). Consider a WANET with 16 nodes and 16 multi-hop communication links as in Fig.~1~(a). There are 15 users who aim to transfer data from a source to a destination. Solid line represents a link $L_j,\,j\in\{1,\ldots,16\}$ and dashed line displays a path $R_i,\,i\in\{1,\ldots,15\}$ that is assigned to user $i$ to transfer data. Each link $L_j$ has a positive capacity $C_j>0$ that restricts the users' data flow . \begin{figure} \vspace{-1.5cm} \hspace{-2.23cm} \centering \includegraphics [scale=0.4]{Communi_graph_complicated.pdf} \vspace{-0.1cm} \caption{(a) Wireless Ad-Hoc Network (left). (b) Communication graph $G_C$ (right).} \end{figure} The data flow of user $i$ is denoted by $x_i$ such that $0\leq x_i\leq 10$. For each user $i$, a cost function $J_i$ is defined as in \cite{ssalehisadaghiani2016distributed}: \begin{equation*}\label{Cost_fcn_gen} J_i(x_i,x_{-i}):=\sum_{j:L_j\in R_i}\frac{\kappa}{C_j-\sum_{w:L_j\in R_w}x_w}-\chi_i \log(x_i+1),\end{equation*} where $\kappa>0$ and $\chi_i>0$ are network-wide known and user-specific parameters, respectively. The problem is to find a GNE of the game which is played over a communication graph $G_C$ (depicted in Fig.~1~(b)). We assume a common constraint $x_1+x_3+x_5=14$ between the players. It is straightforward to check the Assumptions 2,3 and 4 on $G_C$ and the cost functions. The users' flow rate and the dual Lagrange multipliers (they converge to 0) as well as the normalized error are shown in Fig.~2 and Fig.~3 for $\chi_i=15$ $\forall i\in\{1,\ldots,15\}$ and $C_j=15$ $\forall j\in\{1,\ldots,16\}$. \begin{figure} \vspace{-2.8cm} \hspace{0.8cm} \includegraphics [scale=0.3]{Fig2_CDC.pdf} \label{fig:minipage1} \vspace{-2.6cm} \caption{Flow rates of users 1, 3, 5, 15. GNE points are represented by black stars.} \vspace{-0.6cm} \end{figure} \begin{figure} \vspace{-2.8cm} \hspace{0.8cm} \includegraphics [scale=0.3]{Fig3_CDC.pdf} \label{fig:minipage1} \vspace{-2.6cm} \caption{Dual Lagrange multipliers for users 1, 3, 5, 15.} \vspace{-0.6cm} \end{figure} \begin{figure} \vspace{-2.5cm} \hspace{0.8cm} \includegraphics [scale=0.3]{Fig1_CDC.pdf} \label{fig:minipage1} \vspace{-2.5cm} \caption{Normalized error of the users' data flow.} \vspace{-0.5cm} \end{figure} \vspace{-0.2cm} \section{Conclusions} A distributed GNE seeking algorithm is designed within the framework of inexact-ADMM. Each player is only aware of his own cost function, problem data and action set of all players. Each player exchanges the estimates of other players' actions along with the local copy of his Lagrange multiplier with his communication neighbors. An inexact-ADMM algorithm is then derived to find a GNE of the game. Convergence of the algorithm is then provided under mild conditions on cost functions. \vspace{-0.3cm} \bibliographystyle{IEEEtran}
{'timestamp': '2017-03-27T02:09:30', 'yymm': '1703', 'arxiv_id': '1703.08509', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08509'}
arxiv
\section*{Acknowledgements}\label{sec:acknowledgements} This work was funded by NSERC. We thank Ioannis Gkioulekas for his valuable suggestions and feedback. \section{Discussion}\label{sec:discussion} We have defined the first complete medial axis transform for natural images. Our approach bridges the gap between MAT methods for binary shapes and medial axis/local symmetry detection methods for real images. We have demonstrated state-of-the-art\ performance in medial point detection and shown that we can produce a high-quality rendering of the input image using as few as $10\%$ of its pixels. That said, it is important to note that AMAT is not designed to be optimal for either of these tasks. Instead, it is designed to strike a balance between two conflicting objectives: i) capturing an image's salient structures (in the form of medial axes and their respective scale/appearance information); ii) providing an accurate reconstruction of the original image from this abstracted representation. Therefore, performance should be assessed on both objectives jointly. We also want to emphasize that AMAT is a purely bottom-up algorithm, completely unsupervised and train-free. We consider this an important advantage of our approach, as it means that it can generalize well and in a predictable way to new datasets, without the need for additional tuning. Despite the lack of training, we have shown that it performs surprisingly well, and can even be competitive with supervised methods fine-tuned to specific datasets. In future work, our goal is to parameterize our method to accommodate the relative roles of shape and appearance, and allow for flexible hierarchical grouping of medial branches to support segmentations of varying granularities. Furthermore, although our current choice of $f/g$ favors simplicity and compactness at the cost of texture, our framework can accommodate \emph{any} encoding/decoding functions. Designing alternatives to better capture and reconstruct texture, or for specific discriminative tasks, is another exciting future direction. \section{Experiments}\label{sec:experiments} \begin{figure*}[t] \centering \def0.49{0.245} \def\img_id{3096} \includegraphics[width=0.49 \textwidth]{\img_id_resized.jpg} \includegraphics[width=0.49 \textwidth]{\img_id_axes_simplified.pdf} \includegraphics[width=0.49 \textwidth]{\img_id_branches_simplified.pdf} \includegraphics[width=0.49 \textwidth]{\img_id_gt_skel.pdf} \def\img_id{253055} \includegraphics[width=0.49 \textwidth]{\img_id_resized.jpg} \includegraphics[width=0.49 \textwidth]{\img_id_axes_simplified.pdf} \includegraphics[width=0.49 \textwidth]{\img_id_branches_simplified.pdf} \includegraphics[width=0.49 \textwidth]{\img_id_gt_skel.pdf} \caption{ From left to right: Input image, AMAT axes (unused points in black), medial point groups (color-coded), ground-truth skeletons. Note that semantically coherent image regions (\emph{e.g}\onedot} \def\Eg{\emph{E.g}\onedot, sky, grass) tend to be grouped together. } \label{fig:experiments:detection} \end{figure*} We evaluate the performance of our method on two tasks: i) localization of medial points in an image; and ii) generating accurate reconstructions of images, given their AMAT. \subsection{Medial Point Detection}\label{sec:experiments:detection} We want to emphasize the difference between the problem we are addressing and the objectives pursued in other works. In~\cite{tsogkas2012learning} the authors focus on detecting local reflective symmetries of elongated structures, and they build a dataset with annotations of segments in the BSDS300 that fit this description. As a result, a large portion of the segments in BSDS is not used in performance evaluation. In~\cite{shen2016object} the authors are explicitly interested in extracting \emph{object} skeletons, completely ignoring background structures. Although extracting object skeletons may be convenient for some tasks, it does not constitute a generalized notion of MAT. In our work we do not make such distinctions. The central idea behind the AMAT is to be able to reproduce the full input image, so we view all parts of the image as equally important. This is also the reason we choose BSDS500 as a basis for constructing medial axes annotations. BSDS500 contains multiple segmentations for each image, offering higher probability of capturing segments at varying scales, making it more relevant to the problem we are trying to solve than datasets with object-level annotations. Following~\cite{tsogkas2012learning}, we individually apply a skeletonization algorithm~\cite{telea2002augmented} to binary masks of all segments in a given segmentation, extracting \emph{segment skeletons}. The medial axis ground-truth for the image is formed by taking the union of all the segment skeletons, and this process is repeated for all available annotations (usually 5-7 per image). To conduct a fair comparison, we retrain the CG+BG+TG variant (MIL-color) from~\cite{tsogkas2012learning} on BMAX500. We also tried to retrain the CNN used in~\cite{shen2016object}, but the outputs we obtained were too noisy, and of no practical use. We hypothesize that this is because of the lack of consensus among the multiple ground-truth maps available for each image, which leads to convergence problems for the network; this has been previously reported in~\cite{xie2015holistically}. We evaluate performance using the standard precision, recall and F-measure metrics, and show the superior results of our method in~\reftab{tab:experiments:medialpointdetection-BMAX500}. Note that our algorithm outputs binary skeletons, so plotting a PR-curve by varying a score threshold is not applicable in our case. ``Human'' performance is defined in the same manner as in~\cite{martin2004learning,tsogkas2012learning}. For all methods, detections within a distance of $1\%$ of the image diagonal from a ground-truth positive are considered as true positives. We show qualitative results of the medial axes and the grouped branches in~\reffig{fig:experiments:detection}. \paragraph{Segmentation + skeletonization:} As an additional baseline we compute skeletons after running Arbelaez's segmentation algorithm~\cite{arbelaez2006boundary,arbelaez2011contour} at scales 0.2 (F=0.61), 0.3 (F=0.58), 0.4 (F=0.54), 0.5 (F=0.5). We point out that the performance of UCM + skeletonization depends critically on the threshold selection. The optimal threshold is not known a-priori and, given a desired level of skeleton detail, the appropriate value varies from image to image. By contrast, AMAT's scale parameter is more intuitive to select and provides image-independent control of skeleton detail. \paragraph{SK506 and WH-SYMMAX:} We also evaluate the performance of the AMAT on two additional datasets: WH-SYMMAX~\cite{shen2016multiple} (F=0.44) and SK506~\cite{shen2016object} (F=0.33). We compare with the pretrained FSDS~\cite{shen2016object} evaluating only on foreground skeletons, since our approach does not distinguish foreground from background. FSDS performs better than AMAT (F=0.67 and F=0.45 respectively). This is unsurprising, given that FSDS is a supervised method trained on these datasets in a way that allows it to take advantage of rich, object-specific information. However, this specialization comes at a cost: FSDS cannot generalize well to structures it has not seen before, which is evident when running it on BMAX500 (F=0.34 \vs F=0.56 for AMAT). \begin{table} \centering \begin{tabular}{|c|c|c|c|} \hline Metric & Precision & Recall & F-measure \\ \hline MIL~\cite{tsogkas2012learning} & 0.49 & 0.55 & 0.52 \\ \hline AMAT & 0.52 & 0.63 & \textbf{0.57} \\ \hline Human & 0.89 & 0.66 & 0.77 \\ \hline \end{tabular} \caption{Medial point detection on the BSDS500 val set.} \label{tab:experiments:medialpointdetection-BMAX500} \end{table} \subsection{Image Reconstruction}\label{sec:experiments:reconstruction} \begin{figure*}[t] \centering \def0.49{0.19} \def\img_id{145086} \includegraphics[width=0.49 \textwidth]{\img_id_resized.jpg} \includegraphics[width=0.49 \textwidth]{\img_id_rec_mil.png} \includegraphics[width=0.49 \textwidth]{\img_id_rec_gtseg.png} \includegraphics[width=0.49 \textwidth]{\img_id_rec_gtskel.png} \includegraphics[width=0.49 \textwidth]{\img_id_rec_amat.png} \def\img_id{85048} \includegraphics[width=0.49 \textwidth]{\img_id_resized.jpg} \includegraphics[width=0.49 \textwidth]{\img_id_rec_mil.png} \includegraphics[width=0.49 \textwidth]{\img_id_rec_gtseg.png} \includegraphics[width=0.49 \textwidth]{\img_id_rec_gtskel.png} \includegraphics[width=0.49 \textwidth]{\img_id_rec_amat.png} \def\img_id{42049} \includegraphics[width=0.49 \textwidth]{\img_id_resized.jpg} \includegraphics[width=0.49 \textwidth]{\img_id_rec_mil.png} \includegraphics[width=0.49 \textwidth]{\img_id_rec_gtseg.png} \includegraphics[width=0.49 \textwidth]{\img_id_rec_gtskel.png} \includegraphics[width=0.49 \textwidth]{\img_id_rec_amat.png} \caption{ \textbf{Image reconstruction}. From left to right: Input image, MIL~\cite{tsogkas2012learning}, GT-seg, GT-skel, AMAT. } \label{fig:experiments:reconstruction} \end{figure*} We now assess the quality of reconstructions we obtain by inverting the computed AMAT of images from the BSDS500 dataset. We compare with a baseline reconstruction algorithm based on the MIL approach of~\cite{tsogkas2012learning} (after retraining MIL-color on BMAX500). Their method uses features extracted in rectangular areas to produce a map of medial point strength at 13 scales and 8 orientations, for each pixel. A single confidence value for each point is derived through a noisy-or operation, which does away with scale and orientation information. As a surrogate, in our experiments we associate each point with the scale/orientation combination that has the highest score. The scheme we use to create a crude reconstruction with their approach is the following: We start by sorting medial point scores in decreasing order and we pick the highest-scoring point. The rectangular region at the respective scale and orientation is then marked as covered, and the process is repeated until the whole image has been reconstructed. Similarly to our own method, point encodings are the mean RGB values within the rectangle, and local reconstructions are computed by averaging overlapping encodings. We also compare with two more baselines: one obtained by considering ground-truth (GT) segments in BSDS500 and representing them by their mean RGB values (GT-seg); and a second, obtained through the GT skeletons and radii in BMAX500 (GT-skel). For the latter, we use the reconstruction process described in~\refsec{sec:implementation:inverting}. We consider three standard evaluation metrics for image similarity: MSE, PSNR, and SSIM. Results are reported in~\reftab{tab:experiments:reconstruction} and visual examples are shown in~\reffig{fig:experiments:reconstruction}. MIL uses rectangle filters at a finite set of scales and orientations that do not always match the scale and orientation of structures present in an image. As a result, MIL reconstructions are very blurred. GT-based reconstructions, on the other hand, have sharp edges but tend to have less texture detail, because people tend to undersegment images, favoring \emph{perceptual} coherence over region appearance coherence. Note that, for each image, we choose the GT annotation that produces the best SSIM score, to ensure we are always comparing against the best possible GT-based reconstruction. \begin{table} \centering \begin{tabular}{|c|c|c|c|c|} \hline Metric & MSE & PSNR (dB) & SSIM & Compression \\ \hline MIL~\cite{tsogkas2012learning} & 0.0258 & 16.6 & 0.53 & $20\times$ \\ \hline GT seg & 0.0149 & 18.87 & 0.64 & $9\times$\\ \hline GT skel & 0.0114 & 20.19 & 0.67 & $14\times$\\ \hline AMAT & \textbf{0.0058} & \textbf{22.74} & \textbf{0.74} & $11\times$ \\ \hline \end{tabular} \caption{Image reconstruction quality in BSDS500 val set.} \label{tab:experiments:reconstruction} \end{table} \section{Implementation Details}\label{sec:implementation} \begin{figure*}[t] \def\img_id{41004} \def0.49{0.24} \subfloat[Input image]{\includegraphics[width=0.49\textwidth]{\img_id_smoothed.jpg}}\hfill \subfloat[$w_s=10^{-4}$]{\includegraphics[width=0.49\textwidth]{{\img_id_recon0.0001}.jpg}}\hfill \subfloat[$w_s=10^{-3}$]{\includegraphics[width=0.49\textwidth]{{\img_id_recon0.001}.jpg}}\hfill \subfloat[$w_s=10^{-2}$]{\includegraphics[width=0.49\textwidth]{{\img_id_recon0.01}.jpg}}\hfill \caption{Using a progressively larger scale-cost factor $w_s$ removes details, keeping only coarse image structures.} \label{fig:smoothing} \end{figure*} \paragraph{Disk Cost Computation.}\label{sec:implementation:diskcost} Using a simple error metric such as MSE to compute $c_{ij}$ is not effective since disks with low MSE scores do not necessarily respect image boundaries. We propose the following alternative heuristic: First, we convert the RGB image to the CIELAB color space which is more suitable for measuring perceptual distances. Then, we define the cost of $D_{ij}$ as \begin{equation} c_{ij} = \sum_k \sum_l \norm{\f{ij} - \f{kl} }^2 \quad \forall k,l: D_{kl} \subset D_{ij}. \label{eq:diskcost} \end{equation} Intuitively, a low cost $c_{ij}$ implies that the encoding $\f{ij}$ is representative of \emph{all} disks that are fully contained in $D_{ij}$, hence $D_{ij}$ is not crossing any region boundaries. \paragraph{Dealing With Texture.}\label{sec:implementation:texture} The main motivation behind the choice of simple functions $f,g$, was simplicity and computational efficiency. Such functions also allow us to inject certain desired characteristics in the AMAT solution, such as appearance uniformity and alignment with boundaries. However, natural images often contain high-frequency textures or noise, which can lead to the accumulation of large errors in~\refeq{eq:diskcost}, and promote the selection of disks that do not correspond to perceptually coherent regions. Simple processing techniques (\emph{e.g}\onedot} \def\Eg{\emph{E.g}\onedot, Gaussian filtering) can reduce noise but they also degrade image boundaries and blend together neighboring regions. To alleviate this problem, we ``simplify'' the input image before extracting the AMAT, using a method that smooths high frequency regions, while preserving important edges~\cite{xu2011image}. In practice, this preprocessing produces an image that is perceptually very similar to the original, but without high-frequency textures that can cause the greedy algorithm to fail by placing disks at undesired locations. \paragraph{Inverting the AMAT.}\label{sec:implementation:inverting} Generating the reconstruction of a single disk-shaped region, $\tilde{D}_{\p{},r}^I$, is trivially achieved by replicating $\f{\p{},r}$. However, since medial disks overlap, most pixels in the image domain will be covered by multiple disks with different encodings. We resolve this ambiguity in a simple way: while computing the AMAT, we keep track of the number of disks each pixel is covered by; this quantity is called \emph{depth} in the context of the set cover problem. We then use the average $\f{}$ of all disks covering a point $\p{i}$ with depth $d_i$ as its reconstructed value: \begin{equation} \tilde{I}(\p{i}) = \frac{1}{d_{\p{i}}} \sum_{\p{},r} \f{\p{},r}, \quad \forall \p{},r: \p{i}\in D_{\p{},r}. \label{eq:reconstruction} \end{equation} \paragraph{Parameter Values.}\label{sec:method:parameter} For the smoothing algorithm we use the default values $\lambda=2\cdot10^{-4}$ and $\kappa=2$ that the authors suggest for natural images~\cite{xu2011image}. Regarding the scale cost term described in~\refsec{sec:method:wgsc}, we found that $w_s=10^{-4}$ is a value that strikes a good balance between reconstruction quality and sparsity of the generated medial axis. The maximum radius $R$ must be finite to keep complexity manageable, but large enough to capture large uniform structures in the image. Based on the size of images used in our experiments we used $40$ scales, excluding $r=1$ to force disks to be larger than single pixels; thus $r\in[2,41]$. \paragraph{Complexity and Running Time.}\label{sec:method:complexity} Computing $c_{ij}$ requires computing differences for all disks in $D_{ij}$. If $r_j$ is large, this number can grow quickly, yielding $O(NR^4)$ complexity. However, the most time-consuming step is the greedy approximation algorithm: At each iteration we cover at most $O(R^2)$ pixels, but we also have to update the costs of all overlapping disks. This has $O(NR^2\sum_{r=1}^R r^2) = O(NR^5)$ complexity. One could parallelize the procedure by partitioning an image, simultaneously processing individual parts, and combining the results. Our single-thread MATLAB\ implementation takes $\sim \unit[30]{sec}$ for the AMAT, grouping, and simplification steps, on a $256\times256$ image. \section{Introduction}\label{sec:introduction} \begin{figure}[!t] \centering \def0.49{0.49} \subfloat[Input image]{\includegraphics[width=0.49\linewidth]{teaser_img.pdf}\label{fig:teaser:input}} \subfloat[Binary MAT]{\includegraphics[width=0.49\linewidth]{teaser_mat.pdf}\label{fig:teaser:mat}} \\ \subfloat[Appearance-MAT]{\includegraphics[width=0.49\linewidth]{teaser_amat.pdf}\label{fig:teaser:amat}} \subfloat[Reconstructed image]{\includegraphics[width=0.49\linewidth]{teaser_recon.pdf}\label{fig:teaser:recon}} \caption{ \textbf{Top:} Input image (\ref{fig:teaser:input}) and segmentation (\ref{fig:teaser:mat}) from BSDS500, with color-coded ground-truth segments. Medial axes (green) and a subset of medial disks (red) are overlaid. Each (binary) segment can be reconstructed from its medial points and radii. \textbf{Bottom:} Similarly, the AMAT (\ref{fig:teaser:amat}) carries enough information to reconstruct the \emph{input image} (\ref{fig:teaser:recon}) with just $\sim 5\%$ of the pixels. } \label{fig:teaser} \end{figure} Symmetry is a ubiquitous property in the natural world, with a well-established role in human vision. Humans instinctively recognize and use symmetry to analyze complex scenes, as it facilitates the encoding of shapes and their discrimination and recall from memory~\cite{barlow1979versatility,royer1981detection,wagemans1998parallel}. In the context of computer vision, \emph{local} symmetry is of particular interest, because of its robustness to viewpoint changes and its connection to salient structures, such as object parts. This intuition is fundamental to many milestones in object representation theory, including generalized cylinders~\cite{binford1971visual}, superquadrics~\cite{barr1981superquadrics}, geons~\cite{biederman1987recognition}, and shock graphs~\cite{siddiqi1999shock}. Fundamental notions of local symmetry were introduced decades ago by Blum in the context of binary shapes with the \emph{medial axis transform (MAT)}~\cite{blum1967transformation,blum1973biological}. The MAT is a powerful shape abstraction, and provides a compact representation that preserves topological properties of the input shape. These properties are invariant to translation, rotation, scaling, articulation, and their locality offers robustness to occlusion. The MAT has been very effective in reducing the computational complexity of algorithms for various tasks, including shape matching~\cite{siddiqi1999shock} and recognition~\cite{sebastian2001recognition}, mesh editing~\cite{li2001decomposing,yoshizawa2003free}, and shape manipulation~\cite{du2004medial}. For these reasons many researchers have tried to achieve a good balance between MAT sparsity and reconstruction quality~\cite{tam2003shape,li2015q}. Extending the notion of the MAT to natural images can correspondingly benefit applications that rely on a sparse set of highly informative keypoints/landmarks, such as registration~\cite{zhou2016estimating}, retrieval~\cite{sivic2003video,avrithis2011medial}, pose estimation and body tracking~\cite{shotton2013efficient}, and structure from motion~\cite{agarwal2011building}. It could also assist segmentation by enforcing region-based constraints through their medial point representatives ~\cite{teo2015detection}, and by providing a practical alternative to manual scribbles/seeds for interactive segmentation~\cite{boykov2001interactive,price2010geodesic,isack2016hedgehog,lin2016scribblesup}. Another interesting application is artistic rendering of images:~\cite{gooch2002artistic} use approximate medial axes to simulate brush strokes and generate a painting-like version of the input photograph. Unfortunately, the MAT has not found widespread use in tasks involving natural images, due to the lack of a generalization that accommodates color and texture. Previous works have mostly attacked \emph{medial point detection}~\cite{tsogkas2012learning,shen2016object}, which amounts to determining the \emph{locations} of points lying on medial axes but not the scale of the respective medial disks. The type of axes considered is also typically constrained to make the problem more concrete: \cite{tsogkas2012learning} only considers elongated structures, on either foreground objects or background; ~\cite{shen2016object} focuses on \emph{object skeletons}, ignoring background structures. These methods lack another key characteristic of the MAT: medial point locations alone do not provide sufficient information to reconstruct the input. In this paper we introduce the first ``complete'' MAT for natural images, dubbed \emph{Appearance-MAT (AMAT)}. First, we provide a new definition in the context of natural images by framing MAT as a weighted geometric set cover (WGSC) problem. Our definition is centered around the MAT invertibility property and elicits a straightforward criterion for quality assessment, in terms of the reconstruction of the input image. Second, our algorithm associates each medial point with \emph{scale} as well as local \emph{appearance} information that can be used to reconstruct the input. Thus, the AMAT encompasses all the fundamental features of its binary counterpart. Third, we describe a simple bottom-up grouping scheme that exploits the additional scale and appearance information to connect points into medial \emph{branches}. These branches correspond to meaningful image regions, and extracting them can support image segmentation and object proposal generation, while offering a shape decomposition of the underlying structure as well. Being bottom-up in nature, our method does not assume object-level knowledge. It computes medial axes of both foreground and background structures, yielding a compact representation that only uses $\sim 10\%$ of the image pixels. Yet, this sparse set of points carries most of image signal, differing from other sparse image descriptions, \emph{e.g}\onedot} \def\Eg{\emph{E.g}\onedot edge maps, which strip the input of all appearance information. We perform experiments in medial point detection on a new dataset of medial axes, the \emph{Berkeley-Medial AXes (BMAX500)}, which is built on the popular BSDS500 dataset, showing state-of-the-art\ performance. We also measure the quality of reconstructions obtained by inverting the AMAT of images from the same dataset, using a variety of standard image quality metrics. We compare with three reconstruction baselines: one built on the medial point detection algorithm from~\cite{tsogkas2012learning} and two built from the ground-truth segmentations in BSDS500. Our method significantly outperforms the baselines in terms of reconstruction quality, while attaining a $11\times$ compression ratio. The outline of the paper is as follows: we start by reviewing related work on medial axis extraction for binary shapes and natural images in~\refsec{sec:related}. In~\refsec{sec:method} we describe our approach. \refsec{sec:implementation} includes implementation details and in~\refsec{sec:experiments} we present our results. Finally, in~\refsec{sec:discussion} we conclude and discuss ideas for future directions. \section{AMAT definition}\label{sec:method} \begin{figure*}[t] \centering \includegraphics[width=0.3\linewidth]{binary_shape.pdf}\hfill \includegraphics[width=0.35\linewidth]{google_cropped.pdf}\hfill \includegraphics[width=0.22\linewidth]{checkerboard.pdf} \caption{ \textbf{Left:} We can reconstruct a binary shape by expanding a value of ``1'' within the area of all medial disks. \textbf{Middle:} Disks are represented by their mean RGB value; disks that cross region boundaries have a high reconstruction error. \textbf{Right:} Toy example: depending on the task, the user can favor a dense representation with low reconstruction error (green disks) or a sparse representation with high reconstruction error (red disk) by varying the scale parameter $w_s$. } \label{fig:method:definition} \end{figure*} Consider a 2D binary shape, $O$, like the one in~\reffig{fig:method:definition}, and its boundary $\Theta_O$. The \emph{medial axis} of $O$ is the set of points $\p{}$ that are centers of the maximally inscribed (medial) disks, bitangent to $\Theta_O$ in the interior of the shape. The \emph{medial} (disk) \emph{radius} $r_{\p{}} \equiv r(\p{})$ is the distance between $\p{}$ and the points where the disk touches $\Theta_O$. The process of mapping $O$ to the set of pairs $(\p{},r_{\p{}}) \in \mathbb{R}^2 \times \mathbb{R}$ is called the \emph{medial axis transform} (MAT). Given these pairs, we can reconstruct $O$ as a union of overlapping disks that sweep-out its interior by ``expanding'' a value of one (1) inside the area covered by each medial disk. We argue that a MAT for real images should satisfy a similar principle: given the MAT of an image, we should be able to ``invert'' it, reconstructing \emph{the image} itself. There are several reasons why extending this idea to real images is a challenging task: natural images depict complex scenes, cluttered with numerous objects, instead of just a single foreground shape. Moreover, unlike binary images, real images exhibit complicated color and texture distributions. Nevertheless, we can exploit image redundancies and assume that an image is composed of many small regions of relatively uniform appearance. This is the same assumption that underlies most superpixel algorithms which break up an image into non-overlapping patches, while respecting perceptually meaningful region boundaries~\cite{shi2000normalized,levinshtein2009turbopixels,achanta2012slic}. \paragraph{Notation.} In the rest of the paper we denote a disk of radius $r$, centered at point $\p{}$, as $D_{\p{},r}\equiv D(\p{},r)$. For brevity, we often refer to such a disk as a $r$-disk or $(\p{},r)$-disk. $\set{D}$ is a collection of such disks of varying centers and radii, $\set{D}=\{ D_{\p{i},r_{\p{i}}} \},\, i\in\mathbb{N}$. The intersection of a $(\p{},r)$-disk with an image $I$ is a disk-shaped region of the image, and is denoted by $I \cap D_{\p{},r}=D_{\p{},r}^I \subset \set{D^I} = \{ D^I_{\p{i},r_{\p{i}}} \}$. Finally, we use $\circ$ to denote function composition, and $\norm{\cdot}$ for an appropriate error metric (\emph{e.g}\onedot} \def\Eg{\emph{E.g}\onedot, the $L_2$ norm). \paragraph{Formulation.} Consider an RGB image $I\subset\mathbb{R}^3$, and a disk-shaped region $D_{\p{},r}^I \subset I$. Let $f:\set{D^I} \rightarrow \mathbb{R}^K$ be a function that maps $D_{\p{},r}^I$ to a vector $\f{\p{},r}=f\circ D_{\p{},r}^I$; we call $\f{\p{},r}$ the \emph{encoding} of $D_{\p{},r}^I$. Now let $g:\mathbb{R}^K \rightarrow \set{D^I}$ be a function that maps $\f{\p{},r}$ back to a disk patch $\tilde{D}_{\p{},r}^I = \g{\p{},r} = g \circ \f{\p{},r}$. We call $g$ the \emph{decoding} function. In the general case, $f$ and $g$ will be \emph{lossy} mappings, which means that the reconstruction error $e_{\p{},r} = \norm{ \tilde{D}_{\p{},r}^I - D_{\p{},r}^I} \geq 0$. Using the above, we define the AMAT as the set of tuples $M:\{ ( \p{1},r_{\p{1}}, \f{\p{1},r_{\p{1}}} ), \ldots, ( \p{m},r_{\p{m}}, \f{\p{m},r_{\p{m}}} ) \}$, such that: \begin{equation} M = \argmin_{\p{},r}{\sum_{i=1}^m e_{\p{i},r_i}},\quad I=\bigcup_{i=1}^m D_{\p{i},r_i}^I. \label{eq:minimization} \end{equation} In~\refsec{sec:method:wgsc} we discuss constraining $m$. \paragraph{Encoding and decoding functions.} Our framework allows $f,g$ to take any form; for example, $f$ could be a histogram representation of color in $D_{\p{},r}^I$ and $g$ could return the mode of the distribution. In this paper we opt for simplicity: $f$ computes the mean of each color channel ``summarizing'' $D_{\p{},r}^I$, in a $3\times1$ vector $\f{\p{},r}$. Conversely, $g$ constructs an approximation $\tilde{D}_{\p{},r}^I \approx D_{\p{},r}^I$ by replicating $\f{\p{},r}$ in the respective disk-shaped area. When the $(\p{},r)$-disk is fully enclosed in a uniform region the reconstruction error $e_{\p{},r}$ is low, whereas when the disk crosses a strong image boundary, the encoding $\f{\p{},r}$ cannot accurately represent the underlying image region, resulting in a higher error. Note that the definition in~\refeq{eq:minimization} suggests conceptual similarities with superpixel representations. Selecting the points $\{ (\p{i},r_i,\f{\p{i},r_i}) \},\,i=1,\ldots,m$ is equivalent to covering the input image with $m$ disk-shaped superpixels. Minimizing the total reconstruction error implies that these ``superdisks'' do not cross region boundaries, as this would incur a high reconstruction error, as shown in~\reffig{fig:method:definition}. However, there are two important differences: First, in our case a canonical shape (disk) is used, whereas superpixels can have any form. Second, our disks are \emph{overlapping}, in contrast to standard, non-overlapping superpixels. Using canonical shapes helps achieve sparsity of the final MAT. Disks are optimal in that sense, as they are rotationally invariant and are fully defined using only their center and radius. By contrast, a free-form element requires storing coordinates of \emph{all} its boundary points. On the other hand, using one shape and no overlap would not reduce reconstruction quality, but it would result in disjointed medial points instead of smooth, connected medial axes. \subsection{AMAT as a Geometric Set Cover Problem}\label{sec:method:wgsc} The geometric set cover is the extension of the well studied set cover problem, in a geometric space. Here we only consider the case of a two-dimensional space and we particularly focus on the \emph{weighted} version of the problem, which is defined as follows: Consider a universe of $N$ points $X \in \mathbb{R}^2$ and subsets $\set{D} = \{D_1,D_2,\ldots,D_k\} \subseteq X$, called \emph{ranges}. A common choice for $D_i$ is intersections of $X$ with simple shape primitives, such as disks or rectangles. Now assume that each element in $\set{D}$ is associated with a non-negative weight or \emph{cost} $c_i$. Solving the WGSC problem amounts to finding a sub-collection $\bar{\set{D}} \subset \set{D}$ that covers the entire $X$ (all $N$ elements of $X$ are contained in at least one set in $\bar{\set{D}}$), while having the minimum total cost $C$; the total cost is simply the sum of costs of individual elements in $\bar{\set{D}}$. WGSC is a strongly NP-hard problem for which polynomial-time approximate solutions (PTAS) exist. The interested reader can find more details on WGSC and related algorithms in~\cite{mustafa2015quasi,varadarajan2010weighted,har2012weighted,chan2012weighted}. The AMAT formulation lends itself naturally to a WGSC interpretation. The spatial support $X^I$ of an input image $I$, is the universe of $N$ points. As $\set{D}$ we consider the set of $r$-disks with $r$ chosen from a finite set $\set{R}:\{r_1,r_2,\ldots,r_R\}$. The $r$-disks can be placed at any position $\p{}=(x,y)\in X^I$ such that $D_{\p{},r}$ is fully contained in $X^I$. We also assign a cost $c_{ij} \equiv c_{\p{i},r_j} \propto e_{ij}$ to each $(\p{i},r_j)$-disk, $i\in[1,N],\, j\in[1,R]$. Note that for brevity, we drop the subscripts $\p{i},r_j$ and simply use $ij$. We provide more details regarding computation of $c_{ij}$ in~\refsec{sec:implementation:diskcost}. As~\refeq{eq:minimization} suggests, the goal is to find a subset of disks that cover the entire image, while maintaining a low total reconstruction cost. A trivial solution would be to select each pixel as a disk of radius $r=1$, in which case $M=\{ (\p{1},r_{\p{1}},f_{\p{1},r_{\p{1}}}), \ldots, ( \p{N},r_{\p{N}},f_{\p{N},r_{\p{N}}} ) \}$, and $\sum_{i=1}^N e_{\p{i},r_i} = 0$; each pixel can be perfectly represented by its mean value. Such a solution is of no practical use. Staying true to the spirit of the MAT, we seek a solution that is \emph{sparse} (low number of medial points $m$), while being able to adequately reconstruct the input image. One possible way to do this would be to agree on a fixed ``budget'' of points, and look for the optimal solution, given $m$. However, choosing an acceptable $m$ can be a nuisance, as its value can vary significantly from image to image. In the original MAT, sparsity is implicitly induced through the use of maximal disks, touching the shape boundary at two or more points. Extending the maximality principle to real images is not straightforward because color and texture boundaries are not robustly defined. Relying on the output of an edge extraction algorithm is not a viable option either, as it would make our method sensitive to errors from which it would be impossible to recover. Instead, we choose to regularize the minimization criterion in~\refeq{eq:minimization} by adding a scale-dependent term $s_j = \frac{w_s}{r_j} \propto \frac{1}{r_j}$ to the costs $c_{ij}$. This way we favor the selection of larger disks at each point, as long as $s_j$ is not ``too'' large with respect to the error incurred by picking $D_{\p{},r_{j+1}}$ instead of $D_{\p{},r_j}$. Selecting a high value for $w_s$ leads to a sparser solution with higher total reconstruction error, whereas a low value for $w_s$ aims for a better reconstruction, by utilizing more, smaller disks to cover $X^I$. \reffig{fig:method:definition} (right) shows a toy example of these two cases and \reffig{fig:smoothing} shows how varying $w_s$ progressively removes details in a real image, keeping only the coarser structures. \paragraph{Greedy approximation algorithm.} There are many polynomial-time-approximate-solution (PTAS) algorithms for the vanilla set cover problem and its geometric variants. Here we use the simple, greedy algorithm described in~\cite{vazirani2013approximation}, adapted for the weighted case. The steps of our method are described in~\refalg{alg:greedy}. \begin{algorithm}[t] \caption{AMAT greedy algorithm.} \label{alg:greedy} \begin{algorithmic}[1] \Statex \textbf{Input:} $X^I=\{\p{1},\ldots,\p{N}\},\set{R}=\{r_1,\ldots,r_R\},f,g$ \Statex \textbf{Output:} $M$ \State Initialization: $M \leftarrow \emptyset,X^c \leftarrow \emptyset$ \Comment{$X^c:$ covered pixels}. \State Compute $\f{\p{},r},\, \g{\p{},r} = g \circ \f{\p{},r},c_{\p{},r},\ \forall \p{} \in I, \forall r \in \set{R}$ \While{$X^c \subset X^I$} \State $c_{\p{},r}^e \leftarrow \frac{c_{\p{},r}}{|D_{\p{},r} \setminus X^c|}+\frac{w_s}{r},\ \forall \p{} \in X^I,\ \forall r \in \set{R}$ \State $(\p{}^{*},r^{*}) \leftarrow \argmin_{\p{},r}{c_{\p{},r}^e},$ \State $c_{\p{},r} \leftarrow c_{\p{},r} - \frac{c_{\p{},r}}{|D_{\p{}^{*},r^{*}} \setminus X^c|},$ \Statex\hspace{\algorithmicindent}\hspace{\algorithmicindent} $\forall \p{},r: D_{\p{}^{*},r^{*}} \cap D_{\p{},r} \neq \emptyset$ \State $M\leftarrow M\cup{(\p{}^{*},r^{*},f_{\p{}^{*},r^{*}})}$ \State $X^c \leftarrow X^c \cup D_{\p{}^{*},r^{*}}$ \EndWhile \end{algorithmic} \end{algorithm} We start by computing the costs $c_{ij}$ for all possible disks $D_{ij}$. We define the \emph{effective cost} of $D_{ij}$ as $c_{ij}^e = \frac{c_{ij}}{A_{ij}} + s_j$ , where $A_{ij}$ is the number of \emph{new} pixels covered by $D_{ij}$ (pixels that have not been covered by a previously selected disk). Starting from an empty set $M$, we pick the disk with the lowest $c_{ij}^e$ and add it to the solution, removing the area $D_{ij}$ from the remaining pixels to be covered. We also adjust the cost of all disks that intersect with $D_{ij}$, because each disk should be penalized only for the \emph{new} pixels it is covering. This process is repeated until all image pixels have been covered by at least one disk. \subsection{Grouping Medial Points Into Branches}\label{sec:method:grouping} The scale and appearance associated with each medial point provide a rich description that can be used to group points belonging to the same region into \emph{medial branches}. The beneficial effects of grouping in low-level vision tasks have been observed in previous works~\cite{felzenszwalb2006min,zhu2007untangling,kokkinos2010highly,qi2015making}. In our case, grouping pixels into branches can help us refine the final medial axis, by aggregating consensus from neighboring points, and break the image into meaningful regions. We group detected medial points using an agglomerative scheme that starts at fine scales and progressively merges together nearby points at coarser scales. Our grouping criterion relies on proximity in \emph{scale-space} and \emph{appearance}. Intuitively, points that lie close have higher probability of belonging to the same branch. We also expect that the scale of points will change \emph{gradually} along a branch, so points that lie close to each other but have very different radii should probably not be grouped together. Finally, two points should not be grouped if their encodings are very dissimilar, regardless of their proximity in scale-space. We initialize branches as the connected components of the AMAT output. Starting at a scale $r_j$, we consider one branch at a time, and examine all other branches within a neighborhood of size $r_j \times r_j$ and a scale neighborhood $[r_{j-3},r_j]$. If two branches coexist in this scale-space neighborhood and their average encodings (summed along the branch curve) are similar, they are merged. The grouping algorithm terminates when all scales have been considered. \subsection{Medial Branch Simplification}\label{sec:method:simplification} The output of our algorithm captures mostly region centerlines but there are still imperfections in the form of noisy, disconnected medial point responses or ``lumps'', instead of thin contours. Such imperfections are expected because of the approximate solution to the minimization problem of~\refeq{eq:minimization} and the use of a discrete grid. Grouping MAT points into branches makes it possible to process each branch individually, enabling the correction of these errors post hoc. We perform simple morphological operations (dilation and thinning) on the points of each branch to merge neighboring and isolated pixels together, while removing redundant responses. We also adjust the scales of the medial points, to ensure that the medial disks corresponding to the simplified structure span the same image area. Because grouped branches correspond to relatively homogeneous regions, reconstruction results after simplification are practically identical. Examples of simplified medial axes are illustrated in~\reffig{fig:experiments:detection}. \section{Related Work}\label{sec:related} \paragraph{Binary shapes:}\label{sec:related:binary} Blum introduced the medial axis transform, or skeleton, of 2D shapes in his seminal works~\cite{blum1967transformation,blum1973biological}. Since then, researchers have developed algorithms for reliable and efficient medial axis extraction, its extension to 3D shapes, and its application to computer vision tasks. Siddiqi~\emph{et al}\onedot define \emph{shocks} as the singularities of a curve evolution process acting on the boundaries of a shape, and they organize them into a directed, acyclic shock graph~\cite{siddiqi1999shock}. Shock graphs were successfully used in shape matching~\cite{siddiqi1999shock}, recognition~\cite{sebastian2001recognition}, and database indexing~\cite{sebastian2002shock}. \emph{Bone graphs}~\cite{macrini2011bone} offer improved stability and a more intuitive representation of an object's parts, by identifying and analyzing ligature structures. Visual part correspondences are also established and used to measure part and aggregated shape similarity in~\cite{latecki2000shape}. The correspondence of skeleton branches to object parts is further explored in~\cite{ling2007shape,bai2008path}. More recently, Stolpner \emph{et al}\onedot deal with the problem of approximating a 3D solid via a union of overlapping spheres~\cite{stolpner2012medial}. The value of the MAT has been equally appreciated by the graphics community, where object shapes are routinely represented as point clouds or triangular meshes. Giesen~\emph{et al}\onedot~\cite{giesen2009scale} introduced the \emph{scale axis transform}, a skeletal shape representation that yields a hierarchy of successively simplified skeletons, which are obtained by multiplicative scaling of the MAT's radii. Li~\emph{et al}\onedot~\cite{li2015q} use quadratic error minimization to compute an accurate linear approximation of the MAT, called \emph{Q-MAT}. They show experiments on medial axis simplification where they reduce the number of nodes of an initial medial mesh by three orders of magnitude, while preserving good surface reconstruction. A comprehensive compilation of medial methods and their applications in the binary setting can be found in~\cite{siddiqi2008medial}. \paragraph{Natural images:}\label{sec:related:natural} Compared to the binary setting, the number of works on medial axis detection for natural images is rather limited. Levinstein \emph{et al}\onedot~\cite{levinshtein2013multiscale} detect \emph{symmetric parts} of objects by learning to merge adjacent deformable, maximally inscribed disks, modeled as superpixels. Learned attachment relations are then used to combine detected parts into coarse skeletal representations. Lee \emph{et al}\onedot extend that work by introducing a deformable disk model that can capture curved and tapered parts, and also add continuity constraints to the medial point grouping process~\cite{lee2013detecting}. In other works medial point detection is posed as a classification problem where pixels are labeled as ``medial'' or ``not-medial'', inspired by similar methods for boundary detection~\cite{martin2004learning}. Tsogkas and Kokkinos use multiple instance learning (MIL) to deal with the unknown scale and orientation during training~\cite{tsogkas2012learning}, while Shen \emph{et al}\onedot adapt a CNN with side outputs~\cite{xie2015holistically} for object skeleton extraction~\cite{shen2016object}. All these approaches exploit appearance information by incorporating a machine learning algorithm. Our work can be regarded as lying at the intersection of previous work on binary and natural images. From a technical standpoint, it shares more similarities with binary methods, for instance~\cite{stolpner2012medial}, which solves the set cover problem for volumes in the 3D space. At the same time, it can be applied to real images, without assuming a figure-ground segmentation, but it also demonstrates unique characteristics. Our method does not involve learning, and is not constrained in detecting a particular subset of medial axes as~\cite{tsogkas2012learning,shen2016object}. It also complements existing methods by augmenting point locations with scale and appearance descriptions, which are necessary for reconstructing the input.
{'timestamp': '2017-08-04T02:02:26', 'yymm': '1703', 'arxiv_id': '1703.08628', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08628'}
arxiv
\section{Introduction} A typical spatio-temporal model consists of three levels, a data model, a process model, and a parameter model. A common way to model data then is to assume $Y(\cdot)$, is conditionally independent given the process model $X(\cdot)$. For example, if observations take place at aerial regions, $\boldsymbol{s_i}$, at discrete time periods, $t$, and $Y(\boldsymbol{s_i},t)$ are counts, a common model is $Y(\boldsymbol{s_i},t)|X(\boldsymbol{s_i},t)\sim \mbox{Pois}(\exp(X(\boldsymbol{s_i},t)))$. The spatio-temporal diffusion structure is commonly then placed on the process model which commonly is assumed to have a Gaussian joint distribution of $\boldsymbol{X}\sim \mbox{Gaus}(\boldsymbol{0},Q^{-1}(\theta))$. The majority of analysis of these models is done using Bayesian techniques requiring a further parameter model for $\theta$. The challenge in these models is, then, determining an appropriate structure for $\boldsymbol{Q}^{-1}(\theta)$ or $\boldsymbol{Q}(\theta)$. If both the covariance and the precision is chosen to be too dense inference quickly becomes impossible due to the size of $\boldsymbol{Q}^{-1}(\theta)$. In spatio-temporal models it is quite common for the dimension of $\boldsymbol{Q}$ to be larger than $10^4\times 10^4$. A thorough overview giving many examples of this method of modeling is given in \cite{cressie2015statistics}. In modeling terrorism or crime data one possibility is to use an extremely general spatio-temporal process model to capture variance not explained through the use of covariates. For example \cite{python2016bayesian} use a Matern class covariance function over space and an AR(1) process over time. They then use covariates to test the impact of infrastructure, population, and governance. The general spatio-temporal process models used, in this case, has an extremely sparse precision structure greatly aiding in computations. While diffusion in spatio-temporal models is often modeled through a latent process, more recent models describing the spread of violence have incorporated self-excitation, or spatio-temporal diffusion that exists linearly in the data model itself. Self-excitation is the theory that in terrorism, or crime, the probability of an event occurring is a function of previous successful events. For instance \cite{mohler2012self} demonstrate that burglars are more likely to rob locations that have previously, successfully, been robbed. \cite{mohler2013modeling} derived a class of models that allowed for temporal diffusion in both the process model as well as the data model and demonstrated how the two processes were identifiable. In the modeling of terrorism data \cite{lewis2012self}, \cite{porter2012self}, and \cite{mohler2013modeling} have all successfully used the self-excitation approach to model. Most recently, \cite{tench2016spatio} used a likelihood approach for temporal modeling of IEDs in Northern Ireland using self-excitation. However, in these papers, the existence and analysis of self-excitation was the primary objective and any process model dependency was either ignored or treated as a nuisance. The one exception is in \cite{mohler2013modeling} where a temporal only model was assumed for the process model and inference was conducted on both the process model dependency and the data model dependency. In this manuscript, we will consider a spatial and a spatial-temporal process model that allows for self-excitation. We will present two self-exciting models for terrorist activity that have different process models corresponding to different notions of how terrorism evolves in time and space as well as temporal dependency in the data model to account for self-excitation. These two models are specific cases of more general spatio-temporal models that allow dependency in both the process model as well as the data model. We will further show how Laplace approximations similar to their use in Integrated Nested Laplace Approximation, or INLA, an approximate Bayesian method due to \cite{rue2009approximate} can be used to conduct inference for these types of models. We will show, via simulation, how INLA, when appropriately modified, can accurately be used to make inference on process level parameters for self-exciting models and aid analysts in determining the appropriate process model when scientific knowledge cannot be directly applied as in \cite{cressie2015statistics}. Finally, we will apply this technique to terrorism data in Iraq. We will show that choice of process model, in this case, results in differing conclusions on the impact of self-excitation in the model. \section{Self-Exciting Spatio-Temporal Models} The use of self-exciting models in both criminal and terrorism modeling has become increasingly popular over the last decade after being originally introduced in \cite{short2008statistical}. Self-excitement, in a statistical model, directly models copy-cat behavior by letting an observed event increase the intensity (or excites a model) over a specified time or location. Self-exciting models are closely related to Hawkes processes, which are counting processes where the probability of an event occurring is directly related to the number of events that previously occurred. In a self-exciting model, the criminal intensity at a given spatio-temporal location, $(x,y,t)$ is a mixture of a background rate, $\nu$ and self excitement function, $f(\mathcal{H}_{x,y,t})$ that is dependent on the observed history at that location, $\mathcal{H}_{x,y,t}$. A common temporal version of a discretized Hawkes process is \begin{align} & Y_t\sim \mbox{Pois}(\lambda_t) \\ & \lambda_t = \nu + \sum_{j < t} \kappa (t-j) y_j \nonumber\\ & t \in \{1,2,...T\} \end{align} In this example, in order for the process to have finite expectation in the limit, $\kappa(t-j)$ must be positive and $\sum_{i=1}^{\infty} \kappa (i) <1$. $\kappa (t-j)$ can be thought of as the probability that an event at time $j$ triggers an event at time $i$. \cite{laub2015hawkes} provides an excellent overview of the mathematical properties of the continuous Hawkes process and the discrete process when $\kappa (t-j)$ is taken to be an exponential decay function. In \cite{mohler2012self}, $\nu$ was treated as separable in space and time and was non-parametrically estimated using stochastic declustering, while in \cite{mohler2013modeling}, the spatial correlations were ignored and an AR(1) process was used for $\kappa(t)$ and an exponential decay was assumed for the self-excitation. In terrorism modeling \cite{lewis2012self} used a piece-wise linear function for $\kappa(t)$. Here we will first define a general model that allows spatial or spatial-temporal correlation to exist in the process model and positive temporal correlation to exist in the data model to allow for self-excitation. First define $s_i \in \mathcal{R}^2$, $i \in \{1,2,...,s\}$ as locations in a fixed, aerial, region. We further define $t \in \{1,2,...,n\}$ as discrete time. The general form of a spatial-temporal self-exciting model is then given in \eqref{eq:gen Model} \begin{align} & Y(\boldsymbol{s_i},t)|\mu(\boldsymbol{s_i},t) \sim \mbox{Pois}(\mu(\boldsymbol{s_i},t)) \label{eq:gen Model}\\ & \mu(\boldsymbol{s_i},t) = \exp(X(\boldsymbol{s_i},t)) + \eta Y(\boldsymbol{s_i},t-1) \nonumber \\ & \boldsymbol{X} \sim \mbox{Gau}(\boldsymbol{0},Q^{-1}(\theta))) \nonumber \end{align} Comparing the above to the Hawkes process, we now have $\nu$ as a function of space-time and denote it as $X(\boldsymbol{s_i},t)$. We use the simplest form of self-excitation letting $\kappa(t-j)$ be a point-mass function such that $\kappa(k)=\eta$ for $k=1$ and $\kappa(k)=0$ for $k \neq 1$. In all cases $Y(\boldsymbol{s_i},t)$ will be discrete, observable, count data. To contrast \eqref{eq:gen Model} with a typical spatial model, figure \ref{exc} depicts the expectation for one aerial location $(\boldsymbol{s_i},t)$ without self-excitation and with self-excitation as shown in Figure \ref{exc}. In this figure, the lower line shows $\mu(\boldsymbol{s_i},t)$ with $\eta=0$, and the upper line has $\eta=.4$. The impact of self-excitation is clearly present in time 10-13. \begin{figure}[h] \begin{center} \vspace{6pc} \includegraphics[width=.5 \linewidth]{Contageon3.pdf} \caption[]{This figure shows an example of the expectation of two processes, one with self-excitation and one without. The bottom line is the expectation of a process withs no self-excitation, the top has self-excitation of $\eta=.4$. The data realizations are from the process with self-excitation.} \label{exc} \end{center} \end{figure} \subsection{Spatially Correlated Self-Exciting Model} In the first example of \eqref{eq:gen Model} we assume the background intensity rate, $X(\boldsymbol{s_i},t)$ has only spatial correlation. This model is motivated through the assumption that the latent dependency, $X(\boldsymbol{s_i},t)$, is as a continuous measure of violent tendency at region $s_i$ at time period $t$ and regions that are closer together in space are assumed to share common characteristics. Next, define $N(\boldsymbol{s_i})$ as the neighborhood of location $s_i$ where two regions are assumed to be neighbors if they share a common border. $|N(\boldsymbol{s_i})|$ is the number of neighbors of location $s_i$. The model for $Y(\boldsymbol{s_i},t)$, or the number of observed violent events at a given space-time location is then given by: \begin{align} & Y(\boldsymbol{s_i},t)|\mu(\boldsymbol{s_i},t) \sim \mbox{Pois}(\mu(\boldsymbol{s_i},t)) \label{eq:Full Model}\\ & \mu(\boldsymbol{s_i},t) = \exp(X(\boldsymbol{s_i},t)) + \eta Y(\boldsymbol{s_i},t-1) \nonumber \\ & X(\boldsymbol{s_i},t) = \theta_1 \sum_{\boldsymbol{s_j}\in N(\boldsymbol{s_i})}X(\boldsymbol{s_j},t) + \epsilon(\boldsymbol{s_i},t) \nonumber\\ &\epsilon(\boldsymbol{s_i},t) \sim \mbox{Gau}(0,\sigma^2) \nonumber \end{align} Letting $\boldsymbol{H}$ denote the spatial neighborhood matrix such that $H_{i,j}=H_{j,i}=1$ if $\boldsymbol{s_i}$ and $\boldsymbol{s_j}$ are neighbors, the full distribution of the joint distribution of the latent state is $\boldsymbol{X}\sim \mbox{Gau} (\boldsymbol{0},(\boldsymbol{I}_{ns,ns}-\boldsymbol{I}_{n,n} \otimes \theta_1\boldsymbol{H})^{-1}\boldsymbol{L}(\boldsymbol{I}_{ns,ns}-\boldsymbol{I}_{n,n} \otimes \theta_1\boldsymbol{H})^{-1})$ where $\boldsymbol{L}=\text{diag}(\sigma^2,...,\sigma^2)$. The evolution in the latent field is equivalent to the spatial evolution in what is commonly referred to as a Simultaneous or Spatial Auto-regressive model (SAR). Alternatively, the Conditional Auto-regressive model (CAR) of \cite{besag1974spatial} could be used to model the latent state modifying the joint density above. The difference between the SAR and \eqref{eq:Full Model} is in the self excitement parameter, $\eta$. In \eqref{eq:Full Model}, temporal correlation is present, but is present through the data model specification rather than through a temporal evolution in the latent state. Therefore, temporal correlation is a function solely of the self-excitation in the process. $\eta$ gives the probability of an event at time $t-1$ creating an event at time $t$. In order for the system to be well-behaved, $\eta$ is constrained to (0,1). In order for the joint distribution of $\boldsymbol{X}$ to be valid, $\theta_1 \in (\psi_{(1)}^{-1},\psi_{(n)}^{-1})$ where $\psi_{i}$ is the $i$th smallest eigenvalues of $\boldsymbol{H}$. The critical assumption in this model is that the propensity of a given location to be violent is spatially correlated with its adjacent spatial neighbors and only evolves over time as a function of excitation. If terrorism is diffusing according to this model, regions that are geographically adjacent are behaving in a similar manner. The existence of self-excitation would indicate that individuals within a region are being inspired through the actions of others. While combating terrorism is complex, if terrorism is diffusing in this manner, one suggestion would be to identify the root causes within a geographic area as well as quick action against any malicious actor to discourage copy-cat behavior. \subsection{Reaction Diffusion Self-Exciting Model} Alternatively, a model similar to \cite{short2008statistical} can be used to motivate the process model for the latent state resulting in a non-separable spatio-temporal, $\boldsymbol{X}$. Here we let $X(\boldsymbol{s_i,t})$ corresponds to a continuous measure of violence due to terrorists or criminals at location $\boldsymbol{s_i}$ at time $t$. This is still a latent variable as we are not directly measuring $X(\boldsymbol{s_i,t})$. However, now in order for an area to increase in violent tendency, a neighboring area must decrease as the actors causing the violence move from location to location. Furthermore, if terrorists are removed from the battlefield at a rate proportional to the total number of terrorists present and if terrorists move to fill power vacuums, the process model is similar to the reaction-diffusion partial differential equation (see \cite{cressie2015statistics} for more on the reaction-diffusion model) \begin{equation} \frac{\partial X(\boldsymbol{s_i},t)}{\partial t}=\frac{\kappa}{|N(\boldsymbol{s_i})|} \triangle X(\boldsymbol{s_i},t)-\alpha X(\boldsymbol{s_i},t) \label{eq:Reaction} \end{equation} In order to generalize this partial differential equation (PDE) to an irregular lattice, we make use of the graphical Laplacian, $\Gamma$, in place of $\triangle$ in \eqref{eq:Reaction}. $\Gamma$ is a matrix that extends the notion of second derivatives to irregular graphs and can be defined as a matrix of the same dimension as the number of geographical regions with entries given by \[ \Gamma (s_i,s_j) \begin{cases} \hfill -N(s_i) \hfill & j=i \\ \hfill 1 \hfill & j\in N(s_i) \\ \hfill 0 \hfill& \text{Otherwise} \end{cases} \] With the addition of a random noise term assumed to be Gaussian, the full model can be seen as an example of \eqref{eq:gen Model}. \begin{align} & Y(\boldsymbol{s_i},t)|\mu(\boldsymbol{s_i},t) \sim \mbox{Pois}(\mu(\boldsymbol{s_i},t)) \label{eq:ReacDiffuse Model}\\ & \mu(\boldsymbol{s_i},t) = \exp(X(\boldsymbol{s_i},t)) + \eta Y(\boldsymbol{s_i},t-1) \nonumber \\ & \small X(\boldsymbol{s_i},t) = \frac{\kappa}{|N(s_i)|} \sum_{\boldsymbol{s_j}\in N(\boldsymbol{s_i})}X(\boldsymbol{s_j},t-1) + (1-\kappa-\alpha) X(\boldsymbol{s_i},t-1) + \epsilon(\boldsymbol{s},t) \nonumber\\ &\epsilon(\boldsymbol{s},t) \sim \mbox{Gau}(0,\sigma^2) \nonumber \end{align} In contrast to the Spatially Correlated Self-Exciting (SCSE) Model, the process model dependency exists in both space and time. In order to derive properties of this model we first let $\boldsymbol{M}=\kappa \text{ diag}\left( \frac{1}{|N_{s_i}|}\right) \Gamma + (1-\alpha) \boldsymbol{I}_{s,s}$ and now note that this is equivalent to a Vector Auto-Regressive, VAR, model $\boldsymbol{X}_t = \boldsymbol{M} \boldsymbol{X}_{t-1} + \boldsymbol{\epsilon}$ with $\boldsymbol{\epsilon}\sim \mbox{Gau}(\boldsymbol{0},\sigma^2 \boldsymbol{I})$. The VAR(1) model requires all the eigenvalues of $\boldsymbol{M}$ to be between -1 and 1. This can be satisfied by first noting that 0 is always an eigenvalue of $\text{ diag}\left( \frac{1}{|N_{s_i}|}\right)$ trivially corresponding to the eigenvector of all 1s. The largest eigenvalue is at most 2 as shown in \cite{chung1997spectral}. Due to the structure of $(1-\alpha) \boldsymbol{I}_{s,s}$ this implies maximum eigenvalue of $\boldsymbol{M}$ is $(1-\alpha)$ and minimum is $-2\beta+(1-\alpha)$. Therefore, the parameter spaces for $\alpha$ and $\kappa$ are $\alpha \in (0,1)$ and $\kappa \in (\frac{-\alpha}{2},\frac{2-\alpha}{2})$. Just as in the SCSE Model, if $\epsilon$ has a Gaussian distribution, the Reaction Diffusion Self-Exciting (RDSE) Model has an exact solution for the latent Gaussian field, $\boldsymbol{X}$. Letting $\Sigma_s$ be the spatial covariance at a fixed period of time which is assumed to be invariant to time , then we can solve for $\Sigma_s$ by using the relationship $\Sigma_s = \boldsymbol{M}\Sigma_s\boldsymbol{M^T} + \sigma^2 \boldsymbol{I}$. As demonstrated by \cite{cressie2015statistics}, this leads to $\text{vec}(\Sigma_s)=\left(\boldsymbol{I}_{s^2,s^2}-\boldsymbol{M}\otimes\boldsymbol{M}\right)^{-1}\text{vec}\left(\sigma^2 \boldsymbol{I}_{s,s}\right)$ where $\text{vec}\left( \right)$ is the matrix operator that stacks each column of the matrix on top of one or another. Recall that $s$ is the size of the lattice that is observed at each time period. The joint distribution for all $\boldsymbol{X}$ is then $\boldsymbol{X}\sim \mbox{Gau}(\boldsymbol{0},Q_{rd}^{-1}(\theta))$ where \begin{equation} Q_{rd}^{-1}(\theta)= \left[ \begin{array}{c|c|c|c} \Sigma_s & M \Sigma_s & ... & M^n\Sigma_s \\ \hline \Sigma_s M^T & \Sigma_s & ... & M^{n-1}\Sigma_s\\ \hline ... & ... & ... & ...\\ \hline \Sigma_s (M^T)^n & \Sigma_s (M^T)^{n-1}& ... & \Sigma_s \end{array} \right]\label{eq:Sig} \end{equation} . However, practically, this involves inverting a potentially large matrix $\boldsymbol{I}_{s^2,s^2}-\boldsymbol{M}\otimes\boldsymbol{M}$. Therefore, it is easier to deal with the inverse of \eqref{eq:Sig} given in \eqref{eq:Prec}. \begin{equation} Q_{rd}(\theta)= \left[ \begin{array}{c|c|c|c|c} \boldsymbol{I}_{n,n} & -M & \boldsymbol{0}& ... & ... \\ \hline - M^T & M^T M +\boldsymbol{I}_{n,n} & - M & \boldsymbol{0} & ... \\ \hline \boldsymbol{0} &- M^T & M^T M +\boldsymbol{I}_{n,n} & - M & ...\\ \hline ...&...&...&...&...\\ \hline \boldsymbol{0} & ... & - M^T & M^T M +\boldsymbol{I}_{n,n} & - M\\ \hline \boldsymbol{0} & ... & ... & -M^T & \boldsymbol{I}_{n,n} \end{array} \right] \frac{1}{\sigma^2}\label{eq:Prec} \end{equation} The primary difference between the SCSE model and the RDSE model is that the process model correlation in the SCSE is only spatial while in the RDSE it is spatio-temporal. In the below toy examples, we show the expectation for $X(s_i,t)$ for both the SCSE and the RDSE model on a 4 x 4 lattice structure. We fixed both models with a value of $X(s_1,1)=10$ as the upper left hand observation at time 1. As seen in the RDSE model, the high count at time 1 spreads to neighboring regions in time 2 and time 3 whereas the process model has no temporal spread in the SCSE but has a high level of spatial spread. \begin{center} Spatially Correlated Latent Process Conditional on $(s_1,1)=10$ \begin{tikzpicture}[>=latex'] \tikzset{block/.style= { rectangle, align=left,minimum width=.2cm,minimum height=.1cm}, rblock/.style={draw, shape=rectangle,rounded corners=1.5em,align=center,minimum width=.2cm,minimum height=.1cm}, input/.style={ draw, trapezium, trapezium left angle=60, trapezium right angle=120, minimum width=2cm, align=center, minimum height=1cm }, } \node [block, fill=orange!90] (x1) {\footnotesize 10}; \node [block, right = .1cm of x1, fill=blue!50] (x2) {\footnotesize 5}; \node [block, right = .1cm of x2,fill=blue!20] (x3) {\footnotesize 2}; \node [block, right = .1cm of x3, fill=blue!10] (x4) {\footnotesize 1}; \node [block, below = .1cm of x1, fill=blue!50] (y1) {\footnotesize 5}; \node [block, below = .1cm of x2, fill=blue!50] (y2) {\footnotesize 4}; \node [block, below = .1cm of x3, fill=blue!30] (y3) {\footnotesize 3}; \node [block, below = .1cm of x4,fill=blue!20] (y4) {\footnotesize 2}; \node [block, below = .1cm of y1,fill=blue!20] (z1) {\footnotesize 2}; \node [block, below = .1cm of y2, fill=blue!30] (z2) {\footnotesize 3}; \node [block, below = .1cm of y3, fill=blue!30] (z3) {\footnotesize 2}; \node [block, below = .1cm of y4, fill=blue!10] (z4) {\footnotesize 1}; \node [block, below = .1cm of z1, fill=blue!10] (q1) {\footnotesize 1}; \node [block, below = .1cm of z2, fill=blue!10] (q2) {\footnotesize 1}; \node [block, below = .1cm of z3, fill=blue!10] (q3) {\footnotesize 1}; \node [block, below = .1cm of z4, fill=blue!10] (q4) {\footnotesize 1}; \node [block, above = .1cm of x2] {\footnotesize Time 1}; \end{tikzpicture} \quad \begin{tikzpicture}[>=latex'] \tikzset{block/.style= { rectangle, align=left,minimum width=.2cm,minimum height=.1cm}, rblock/.style={draw, shape=rectangle,rounded corners=1.5em,align=center,minimum width=.2cm,minimum height=.1cm}, input/.style={ draw, trapezium, trapezium left angle=60, trapezium right angle=120, minimum width=2cm, align=center, minimum height=1cm }, } \node [block] (x1) {\footnotesize 0}; \node [block, right = .1cm of x1] (x2) {\footnotesize 0}; \node [block, right = .1cm of x2] (x3) {\footnotesize 0}; \node [block, right = .1cm of x3] (x4) {\footnotesize 0}; \node [block, below = .1cm of x1] (y1) {\footnotesize 0}; \node [block, below = .1cm of x2] (y2) {\footnotesize 0}; \node [block, below = .1cm of x3] (y3) {\footnotesize 0}; \node [block, below = .1cm of x4] (y4) {\footnotesize 0}; \node [block, below = .1cm of y1] (z1) {\footnotesize 0}; \node [block, below = .1cm of y2] (z2) {\footnotesize 0}; \node [block, below = .1cm of y3] (z3) {\footnotesize 0}; \node [block, below = .1cm of y4] (z4) {\footnotesize 0}; \node [block, below = .1cm of z1] (q1) {\footnotesize 0}; \node [block, below = .1cm of z2] (q2) {\footnotesize 0}; \node [block, below = .1cm of z3] (q3) {\footnotesize 0}; \node [block, below = .1cm of z4] (q4) {\footnotesize 0}; \node [block, above = .1cm of x2] {\footnotesize Time 2}; \end{tikzpicture} \end{center} \begin{center} Reaction Diffusion Latent Process Conditional on $(s_1,1)=10$ \end{center} \quad \begin{center} \begin{tikzpicture}[>=latex'] \tikzset{block/.style= { rectangle, align=left,minimum width=.2cm,minimum height=.1cm}, rblock/.style={draw, shape=rectangle,rounded corners=1.5em,align=center,minimum width=.2cm,minimum height=.1cm}, input/.style={ draw, trapezium, trapezium left angle=60, trapezium right angle=120, minimum width=2cm, align=center, minimum height=1cm }, } \node [block, fill=orange!90] (x1) {\footnotesize 10}; \node [block, right = .1cm of x1,fill=blue!10] (x2) {\footnotesize 1}; \node [block, right = .1cm of x2, fill=blue!10] (x3) {\footnotesize 1}; \node [block, right = .1cm of x3] (x4) {\footnotesize 0}; \node [block, below = .1cm of x1,fill=blue!10] (y1) {\footnotesize 1}; \node [block, below = .1cm of x2, fill=blue!10] (y2) {\footnotesize 1}; \node [block, below = .1cm of x3] (y3) {\footnotesize 0}; \node [block, below = .1cm of x4] (y4) {\footnotesize 0}; \node [block, below = .1cm of y1, fill=blue!10] (z1) {\footnotesize 1}; \node [block, below = .1cm of y2] (z2) {\footnotesize 0}; \node [block, below = .1cm of y3] (z3) {\footnotesize 0}; \node [block, below = .1cm of y4] (z4) {\footnotesize 0}; \node [block, below = .1cm of z1] (q1) {\footnotesize 0}; \node [block, below = .1cm of z2] (q2) {\footnotesize 0}; \node [block, below = .1cm of z3] (q3) {\footnotesize 0}; \node [block, below = .1cm of z4] (q4) {\footnotesize 0}; \node [block, above = .1cm of x2] {\footnotesize Time 1}; \end{tikzpicture} \qquad \begin{tikzpicture}[>=latex'] \tikzset{block/.style= { rectangle, align=left,minimum width=.2cm,minimum height=.1cm}, rblock/.style={draw, shape=rectangle,rounded corners=1.5em,align=center,minimum width=.2cm,minimum height=.1cm}, input/.style={ draw, trapezium, trapezium left angle=60, trapezium right angle=120, minimum width=2cm, align=center, minimum height=1cm }, } \node [block,fill=blue!30] (x1) {\footnotesize 3}; \node [block, right = .1cm of x1, fill=blue!30] (x2) {\footnotesize 3}; \node [block, right = .1cm of x2] (x3) {\footnotesize 0}; \node [block, right = .1cm of x3] (x4) {\footnotesize 0}; \node [block, below = .1cm of x1, fill=blue!30] (y1) {\footnotesize 3}; \node [block, below = .1cm of x2, fill=blue!10] (y2) {\footnotesize 1}; \node [block, below = .1cm of x3] (y3) {\footnotesize 0}; \node [block, below = .1cm of x4] (y4) {\footnotesize 0}; \node [block, below = .1cm of y1] (z1) {\footnotesize 0}; \node [block, below = .1cm of y2] (z2) {\footnotesize 0}; \node [block, below = .1cm of y3] (z3) {\footnotesize 0}; \node [block, below = .1cm of y4] (z4) {\footnotesize 0}; \node [block, below = .1cm of z1] (q1) {\footnotesize 0}; \node [block, below = .1cm of z2] (q2) {\footnotesize 0}; \node [block, below = .1cm of z3] (q3) {\footnotesize 0}; \node [block, below = .1cm of z4] (q4) {\footnotesize 0}; \node [block, above = .1cm of x2] {\footnotesize Time 2}; \end{tikzpicture} \qquad \begin{tikzpicture}[>=latex'] \tikzset{block/.style= { rectangle, align=center,minimum width=.2cm,minimum height=.1cm}, rblock/.style={draw, shape=rectangle,rounded corners=1.5em,align=center,minimum width=.2cm,minimum height=.1cm}, input/.style={ draw, trapezium, trapezium left angle=60, trapezium right angle=120, minimum width=2cm, align=center, minimum height=1cm }, } \node [block, fill=blue!20] (x1) {\footnotesize 2}; \node [block, right = .1cm of x1, fill=blue!10] (x2) {\footnotesize 1}; \node [block, right = .1cm of x2, fill=blue!10] (x3) {\footnotesize 1}; \node [block, right = .1cm of x3] (x4) {\footnotesize 0}; \node [block, below = .1cm of x1, fill=blue!10] (y1) {\footnotesize 1}; \node [block, below = .1cm of x2, fill=blue!10] (y2) {\footnotesize 1}; \node [block, below = .1cm of x3] (y3) {\footnotesize 0}; \node [block, below = .1cm of x4] (y4) {\footnotesize 0}; \node [block, below = .1cm of y1, fill=blue!10] (z1) {\footnotesize 1}; \node [block, below = .1cm of y2] (z2) {\footnotesize 0}; \node [block, below = .1cm of y3] (z3) {\footnotesize 0}; \node [block, below = .1cm of y4] (z4) {\footnotesize 0}; \node [block, below = .1cm of z1] (q1) {\footnotesize 0}; \node [block, below = .1cm of z2] (q2) {\footnotesize 0}; \node [block, below = .1cm of z3] (q3) {\footnotesize 0}; \node [block, below = .1cm of z4] (q4) {\footnotesize 0}; \node [block, above = .1cm of x2] {\footnotesize Time 3}; \end{tikzpicture}\\ \end{center} Practically, if data follows the RDSE model, it implies a high terrorism count in one region will manifest into a high terrorism count in a neighboring region at a later time period. In combating terrorism, the RDSE might suggest isolating geographical regions to mitigate the risk of spread while addressing self-excitation through direct action against malicious actors who are inspiring others. \section{Model Fitting} In both the RDSE and the SCSE, spatio-temporal diffusion exists in both the process model and the data model. If the diffusion was solely in the process model, a technique for inference would be Integrated Nested Laplace Approximation, or INLA. INLA was first proposed in \cite{rue2009approximate} to specifically address the issue of Bayesian Inference of high dimensional Latent Gaussian Random Fields, LGRFs. An example of this for count data is: \begin{align} Y(s_i)&\sim \mbox{Pois}(\mu(s_i,t)) \label{eq:model}\\ \mu(\boldsymbol{s_i,t})&=\exp(\lambda(\boldsymbol{s_i},t))\nonumber\\ \lambda(\boldsymbol{s_i},t) &= \beta_0 + \boldsymbol{Z}^t \boldsymbol{\beta} + X(\boldsymbol{s_i,t})\nonumber\\ X(\boldsymbol{s_i,t})& \sim \mbox{Gau}(\boldsymbol{0},Q^{-1}(\theta))\nonumber \end{align} INLA is often preferable over MCMC for these types of models. An issue with traditional Markov Chain Monte Carlo (MCMC) techniques for these models is that the dimension of $X$ is often very large. Therefore, while MCMC has $O_p(N^{-1/2})$ errors, the $N$ in the errors is the simulated sample size for the posterior. Just getting $N=1$ may be extremely difficult due to the vast number of elements of $X$ that need to be estimated. In general, MCMC will take hours or days in order to successfully simulate from the posterior making the computational cost of fitting multiple process models extremely high. In \cite{python2016bayesian}, terrorism data was fit using a grid over the entire planet using INLA, though without self-excitation in the model. To address the issues with MCMC use in LGRFs, \cite{rue2009approximate} developed a deterministic approach based on multiple Laplacian approximations. A LGRF is any density that can be expressed as \begin{equation} \pi(\boldsymbol{\theta},\boldsymbol{X} |\boldsymbol{Y}) \propto \pi (\theta)|Q(\boldsymbol{\theta})|^{1/2}\exp \left[\frac{-1}{2}\boldsymbol{X}^t Q(\boldsymbol{\theta}) \boldsymbol{X}+\sum_{\boldsymbol{s}} \log\left(\pi(Y(\boldsymbol{s_i})|X(\boldsymbol{s_i}),\boldsymbol{\theta})\right)\right] \end{equation} In order to conduct inference on this model, we need to estimate $\pi(\boldsymbol{\theta}|\boldsymbol{y})$, $\pi(\theta_i|\boldsymbol{y})$ and $\pi(x_i|\boldsymbol{y})$. The main tool \cite{rue2009approximate} employ is given in their equation (3) as \begin{equation} \tilde{\pi}(\boldsymbol{\theta}|\boldsymbol{Y})\propto \frac{\pi(\boldsymbol{X},\boldsymbol{\theta},\boldsymbol{Y})}{\tilde{\pi}_G (\boldsymbol{X}|\boldsymbol{\theta},\boldsymbol{Y})}|_{X=x^*(\boldsymbol{\theta})}\label{eq:main} \end{equation} In \cite{rue2009approximate} they note that the denominator of \eqref{eq:main} almost always appears to be unimodal and approximately Gaussian. The authors then propose to use a Gaussian approximation to $\pi(\boldsymbol{X}|\boldsymbol{\theta},\boldsymbol{Y})$ which is denoted above as $\tilde{\pi}_G$. Moreover, \eqref{eq:main} should hold no matter what choice of $\boldsymbol{X}$ is used, so a convenient choice for $\boldsymbol{X}$ is the mode for a given $\theta$, which \cite{rue2009approximate} denote as $x^*(\boldsymbol{\theta})$. Now, $\pi(\boldsymbol{\theta}|\boldsymbol{Y})$ can be explored by calculating the marginal for choices of $\theta$, which if chosen carefully can greatly decrease the computational time. These explored values can then be numerically integrated out to get credible intervals for $\pi(\theta_i|\boldsymbol{Y})$. Following the exploration of $\theta|Y$, and computation of $\theta_i|Y$, INLA next proceeds to approximate $\pi(X(s_i)|\boldsymbol{\theta},\boldsymbol{Y})$. The easiest way to accomplish this is to use the marginals that can be derived straightforwardly from $\tilde{\pi}_G(\boldsymbol{X}|\boldsymbol{\theta},\boldsymbol{Y})$ from \eqref{eq:main}. In this manuscript we will use this technique for simplicity of computation, however, if the latent states are of interest in the problem (and they often are), this can be problematic as it fails to capture any skewness of the posterior of $\boldsymbol{X}$. One way to correct this is to re-apply \eqref{eq:main} in the following manner: \begin{equation} \tilde{\pi}_{LA}(X(\boldsymbol{s_i})|\theta,y)\propto \frac{\pi(\boldsymbol{X},\theta,\boldsymbol{Y})}{\tilde{\pi}_G(\boldsymbol{X}_{-s_i}|X(s_i),\boldsymbol{\theta},\boldsymbol{Y})}|_{x_{-i}=\boldsymbol{x_{-i}}^*(x_i,\theta)}\label{eq:remain} \end{equation} In \eqref{eq:remain} $\boldsymbol{X}_{-s_i}$ is used to represent $\boldsymbol{X}$ with latent variable $X(s_i)$ removed. This is a reapplication of Tierney and Kadane's marginal posterior density and gives rise to the nested term in INLA. \subsection{Laplace Approximation for Spatio-Temporal Self-Exciting Models} While INLA is an attractive technique due to computational speed and implementation, it is not immediately usable for the SCSE and the RDSE as the structure in \eqref{eq:gen Model} is \begin{align} \mu(\boldsymbol{s_i},t) & = \exp(X(\boldsymbol{s_i},t)) + \eta Y(\boldsymbol{s_i},t-1)\nonumber\\ & \eta \in (0,1) \end{align} In this structure, $X(.)$ and $Y(.)$ are not linearly related and a Gaussian prior for $\eta$ is clearly not appropriate due to the parameter space constraints. However, Laplace approximations can still be used by conducting inference on $\eta$ at the same time inference is conducted on the the set of latent model parameters. In both the Spatially Correlated Self-Exciting Model and the Reaction Diffusion Self-Exciting model, the full conditional for the latent state is \begin{equation} \footnotesize\pi(\boldsymbol{X}|\boldsymbol{Y},\boldsymbol{\theta}) \propto \exp\left(-\frac{1}{2}\boldsymbol{X}^T \boldsymbol{Q(\boldsymbol{\theta})}\boldsymbol{X} + \sum_{s_i,t} \log \pi\left(Y(\boldsymbol{s_i},t)|X(\boldsymbol{s_i},t),\eta,Y(\boldsymbol{s_i},t-1)\right)\right)\label{eq:FullCond} \end{equation} Here we will let $\boldsymbol{\theta}=(\theta_1,\sigma^2,\eta)^T$ and $\boldsymbol{Q_{sc}(\boldsymbol{\theta})}=(\boldsymbol{I}_{sn,sn}-\theta_1\boldsymbol{I}_{t,t} \otimes \boldsymbol{H})$ for the Spatially Correlated Self-Exciting Model and use $\boldsymbol{Q_{rd}(\boldsymbol{\theta})}$ for the RDSEM defined in \eqref{eq:Prec}. While $\boldsymbol{\theta}$ in \eqref{eq:FullCond} does not contain $\eta$ we next do a Taylor series expansion of $\log \pi\left(Y(\boldsymbol{s_i},t)|X(\boldsymbol{s_i},t),\eta,Y(\boldsymbol{s_i},t-1)\right)$, as a function of $X(\boldsymbol{s_i},t)$ and, for each $\boldsymbol{s_i},t$, expand the term about a guess for the mode, say $\mu_0(\boldsymbol{s_i,t})$. First we write $\boldsymbol{B^*}(\boldsymbol{\theta}|\mu_0)$ as a vector of the same length as $X(\boldsymbol{s_i},t)$ where each element is given by \begin{equation} B(\boldsymbol{s_i},t|\mu_0)=\left(\frac{\partial \log\pi\left(Y(\boldsymbol{s_i},t)\right)}{\partial X(\boldsymbol{s_i},t)}\Bigr|_{X(\boldsymbol{s_i},t)=\mu(\boldsymbol{s_i},t)}-\mu(\boldsymbol{s_i},t) \frac{\partial^2\log\pi\left(Y(\boldsymbol{s_i},t)\right)}{\partial X(\boldsymbol{s_i},t)^2}\Bigr|_{X(\boldsymbol{s_i},t)=\mu(\boldsymbol{s_i},t)}\right)\label{eq:B(si)} \end{equation} Next, we further define $\boldsymbol{Q^*(\boldsymbol{\theta})}|\mu_0$ as the updated precision matrix. \begin{equation} \boldsymbol{Q^*(\boldsymbol{\theta})|\mu_0}=\boldsymbol{Q(\boldsymbol{\theta})}+\text{diag }\left(-\frac{\partial^2\log \pi\left(Y(\boldsymbol{s_i},t)\right)}{\partial X(\boldsymbol{s_i},t)^2}\right)\Bigr|_{X(\boldsymbol{s_i},t)=\mu(\boldsymbol{s_i},t)} \label{eq:Precision at Mode}\\ \end{equation} Where $\boldsymbol{Q(\boldsymbol{\theta})}$ is either $\boldsymbol{Q_{sc}(\boldsymbol{\theta})}$ or $\boldsymbol{Q_{rd}(\boldsymbol{\theta})}$ depending on the context. Then we can write \begin{equation} \footnotesize\pi(\boldsymbol{X}|\boldsymbol{Y},\boldsymbol{\theta}) \propto \exp\left(-\frac{1}{2}\boldsymbol{X}^T\left( \boldsymbol{Q^*(\boldsymbol{\theta})|\mu_0}\right)\boldsymbol{X} + \boldsymbol{X}^T\left( \boldsymbol{B^*}(\boldsymbol{\theta})|\boldsymbol{\mu_0}\right)\right) \label{eq:FullCondExpand} \end{equation} While in \eqref{eq:Precision at Mode}, $\boldsymbol{Q}(\boldsymbol{\theta})$, the original precision matrix, does not contain $\eta$, $\boldsymbol{Q^*(\boldsymbol{\theta})}$, the updated precision matrix, does depend on the self-excitation parameter. Next we find the values of $\mu(\boldsymbol{s_i})$ that maximize \eqref{eq:FullCondExpand}. This is done through the use of an iterative maximization algorithm by solving for $\boldsymbol{\mu_1}$ in $\left(Q^*(\boldsymbol{\theta})|\boldsymbol{\mu_0}\right)\boldsymbol{\mu_1}=\boldsymbol{B^*}(\boldsymbol{\theta}|\mu_0)$. For a fixed $\boldsymbol{\theta}$, this converges rapidly, due to the sparsity of both $\boldsymbol{Q_{sc}}$ and $\boldsymbol{Q_{rd}}$. . In \eqref{eq:main}, for a fixed $\boldsymbol{\theta}$, we can then find $x^*(\boldsymbol{\theta})$. When the denominator of \eqref{eq:main} is evaluated at $x^*(\boldsymbol{\theta})$ it becomes $|\boldsymbol{Q^*(\boldsymbol{\theta})}\frac{1}{2\pi}|^{1/2}$ which is equivalent to the hyperparameter inference recommended by \cite{lee1996hierarchical} as pointed out by R. A. Rigby in \cite{rue2009approximate}. In order to best explore $\pi(\boldsymbol{\theta}|\boldsymbol{Y})$ the posterior mode is first found through a Newton-Raphson based method. In order to do this we approximate the Hessian matrix based off of finite difference approximation to the second derivatives. After locating the posterior mode of $\pi(\boldsymbol{\theta}|\boldsymbol{Y})$, the parameter space can be explored using the exploration strategy laid out in section 3.1 of \cite{rue2009approximate}. Now, for the set of diffusion parameters, $\boldsymbol{\theta}$ which contain $\eta$, we have a method of estimating $\pi(\boldsymbol{\theta}|\boldsymbol{Y})$. Inference for any further data model covariates can now be conducted in the same manner as done in \cite{rue2009approximate}. \subsection{Model Comparison and Goodness of Fit} In order to conduct model comparison, we will use the deviance information criterion (DIC) originally proposed by \cite{spiegelhalter2002bayesian}. Goodness of fit will be conducted through the use of posterior predictive p-values, outlined by \cite{gelman1996posterior}. To approximate the DIC, we first find the effective number of parameters for a given $\boldsymbol{\theta}$. As noted in \cite{rue2009approximate}, we can estimate this by using $n-\text{tr}\left(\boldsymbol{Q(\theta)}\boldsymbol{Q^*(\theta)}^{-1}\right)$ for both the SCSEM and the RDSEM. This gives the effective number parameters for a given $\boldsymbol{\theta}$, which can then be averaged over $\pi(\boldsymbol{\theta}|\boldsymbol{Y})$ to get the effective number of parameters for the model. Secondly, we calculate the deviance of the mean \begin{equation} -2\sum_{s_i,t} \log \pi\left(Y(s_i,t)|\hat{X}(s_i,t),\boldsymbol{\theta^*}\right) \end{equation} where $\boldsymbol{\theta^*}$ is the posterior mode and $\hat{X}(s_i,t)$ is the expectation of the latent state fixing $\theta=\theta^*$. DIC can then be found through deviance of the mean plus two times the effective number of parameters as in chapter 7 of \cite{gelman2014bayesian} and initially recommended by \cite{spiegelhalter2002bayesian}. In order to assess goodness of fit in analyzing the terrorism data in Section 5, we will use posterior predictive P-values as described by \cite{gelman1996posterior}. Here, we pick critical components of the original dataset that we wish to see if the fitted model can accurately replicate, for instance the number of zeros in the dataset which we can designate as $T(\boldsymbol{Y})$. Next, for an index $m=1...M$, We then draw a value of $\boldsymbol{\theta_m}$ according to $\pi(\boldsymbol{\theta}|\boldsymbol{Y})$ and simulate a set of observations $Y^*(\boldsymbol{s_i,t})_m$ of the same dimension as $\boldsymbol{Y}$ and compute $T(\boldsymbol{Y}^*_m)$. This process is repeated M times and a posterior predictive p-value is computed as $\frac{1}{M}\sum_{m=1}^M I\left[T(\boldsymbol{Y}^*_m) > T(\boldsymbol{Y}) \right]$ where $I\left[ . \right]$ is the indicator function. While not a true P-value, both high and low values of the posterior predictive p-value should cause concern over the fitted models ability to replicate features of the original dataset. \section{Simulation} In order to validate the Laplace based methodology for spatially correlated self-exciting models we conducted simulation studies using data on a 8 by 8 Spatial grid assuming a rook neighborhood structure. In order to decrease the edge effect, we wrapped the grid on a torus so each node had four neighbors. For each grid location we simulated 100 observations, creating a spatio-temporal model that had 6400 observations, meaning in \eqref{eq:main}, $\boldsymbol{Q}(\boldsymbol{\theta})$ had a dimension of $6400 \times 6400$. In the first simulation we used \eqref{eq:Full Model} fixing the parameters at values that generated data that appeared to resemble the data from Iraq used in Section 5. The generating model we used was: \begin{align} & Y(\boldsymbol{s_i},t)|\mu(\boldsymbol{s_i},t) \sim \text{Pois }(\mu(\boldsymbol{s_i},t)) \label{eq:First Simulation}\\ & \mu(\boldsymbol{s_i},t) = \exp(-1+X(\boldsymbol{s_i},t)) + .2 Y(\boldsymbol{s_i},t-1) \nonumber \\ & X(\boldsymbol{s_i},t) = .22 \sum_{\boldsymbol{s_j}\in N(\boldsymbol{s_i})}X(\boldsymbol{s_j},t) + \epsilon(\boldsymbol{s_i},t) \nonumber\\ &\epsilon(\boldsymbol{s_i},t) \sim Gau(0,.4) \nonumber \end{align} The spatial parameter for model was $\theta_1=.22$ which suggests a positive correlation between spatially adjacent locations. An $\eta$ value of 0.2 would suggest that each event that occurs at one time period increases the expected number of events at the next time period by .2. Here we fix $\sigma^2$ was fixed at 0.4 and use a value of $\beta_0=-1$ to reflect that in real world applications the latent process likely is not zero mean. Once the data were generated, we found $\pi(\boldsymbol{\theta}|\boldsymbol{Y})$ by applying \eqref{eq:main}. Here we note that the numerator of \eqref{eq:main} is $\small\pi(\boldsymbol{X},\boldsymbol{\theta},\boldsymbol{Y})=\pi(\boldsymbol{Y}|\boldsymbol{X},\eta,\boldsymbol{\theta})\pi(\eta)\pi(\boldsymbol{X}|\theta_1,\sigma^2)\pi(\theta_1)\pi(\sigma^2)$ which requires a prior specification for $\eta$,$\theta_1$, and $\sigma$. In order to reflect an a-priori lack of knowledge we choose vague priors for all parameters. In this model, we use a Half-Cauchy with scale parameter of 25 for $\sigma$ and a Uniform ($\psi_{1}^{-1},\psi_{n}^{-1}$) where $\psi_(i)$ is the $i$th largest eigen vector of the spatial neighborhood. As we used a shared-boreder, or rook, neighbor structure wrapped on a torus, the parameter space is (-0.25,.025) as each spatial location has four neighbors. The choice of the Half-Cauchy is in line with the recommendations for vague priors for variance components of hierarchical models as outlined in \cite{gelman2006prior} and rigorously defended in \cite{polson2012half}. We let the prior for $\eta$ be Uniform(0,1). Using a gradient descent method with step-halving we found the posterior mode of $\pi(\boldsymbol{\theta}|\boldsymbol{Y})$ to be $\sigma^2=0.32$, $\theta_1=0.22$, and $\eta=0.20$. Using the z based parameterization described in Section 3.1 we next explored the parameterization $\log\pi(\boldsymbol{\theta}|\boldsymbol{Y})$ and found credible intervals of $\pi(\sigma^2|\boldsymbol{Y})=(0.29,0.36),\pi(\theta_1|\boldsymbol{Y})=(0.22,0.23)$ and $\pi(\eta|\boldsymbol{Y})=(.18,.21)$. Fixing $\boldsymbol{\theta}$ at the posterior mode, we then found an approximate 95\% credible interval for $\beta_0$ to be (.07,-1.67). In further refinement for $\beta_0$ was required, we could proceed to use \eqref{eq:remain}. This was not done here as $\beta_0$ was not the subject of our primary inference. The posterior maximum and credible interval for $\sigma^2$ appear to be slightly lower than expected, but the remaining parameter credible intervals covered the generating parameter. Next we simulated from the reaction-diffusion self-excitation model letting $\beta_0=0$, $\alpha=0.1$, $\kappa=0.2$, $\sigma^2=0.25$, and $\eta=0.4$ In fitting the model, we again use vague priors for all the parameters. Again, we place a Half-Cauchy prior on $\sigma^2$ as described above. In order to conform to the parameter space of $\alpha$ and $\kappa,$ we let $\pi(\alpha)\sim \text{Unif }(0,1)$ and $\pi(\kappa|\alpha)\sim\text{Unif }(-\frac{\alpha}{2},1-\frac{\alpha}{2})$. Again using the Laplace approximation technique of section 3, we found the posterior mode of $\pi(\boldsymbol{\theta}|\boldsymbol{Y})$ to be at $\alpha=0.085$, $\kappa=0.19$, $\sigma^2=0.21$, $\eta=0.35$. 95\% credible intervals for the posterior marginals were $\alpha \in (0.07, 0.10)$, $\kappa \in (0.14,0.24)$, $\sigma^2 \in (0.18,0.24)$, and $\eta \in (0.32, 0.40)$. At the posterior mode of $\boldsymbol{\theta}$, the posterior marginal for $\beta_0$ was approximately (-0.03,0.01). Critically, if there is self-excitement in the data, in all simulations it was differentiable from the latent diffusion. This is a spatial-temporal analogue to the finding in \cite{mohler2013modeling} where a temporal AR(1) process was differentiable from self-excitement. In our simulations, the approximations described in this manuscript performed reasonably well for inference on the spatio-temporal diffusion parameters in most cases. However, when $\sigma^2$ is large, or when $\eta$ is large, we have found that the approximations create bias in one or more of the parameters likely due to the high effective number of parameters. However, all approximate likelihood based methods will likely struggle in these cases as well. As noted in \cite{rue2009approximate}, the approximation error in Laplace based methods is related to the number of effective latent variables over the total sample size. \section{Spatio-Temporal Diffusion of Violence in Iraq (2003-2010)} \subsection{Statistical Models and Data} One region where the reasons for the diffusion of terror and crime still remains unclear is in Iraq during 2003 to 2010. While violence undoubtedly spread throughout the country, it remains unclear how or why, spatio-temporally, the spread occurred. Part of the uncertainty is that there still is not agreement over whether violence was due to insurgency, civil war, or organized crime. For example, \cite{hoffman2006insurgency} refers to the violence in Iraq as an insurgency, \cite{fearon2007iraq} argues that the spread of violence was due to a civil war, and \cite{williams2009criminals} argues that there was a large presence of organized crime in the country. A few previous studies have examined the presence or absence of self-excitaiton. In \cite{lewis2012self}, the authors concluded that self-excitation was present in select cities in Iraq during this time period. The presence of the self-excitation finding was echoed in \cite{braithwaite2015battle} where the authors also noted a correlation between locations that shared microscale infrastructure similarities. This would suggest repeat or near-repeat actions were causing the increase in violence in a region. However, in both of these cases, the latent spatio-temporal diffusion was, a-priori, assumed to be known. In fact, this is likely not the case. In a classic work on the subject, \cite{midlarsky1980violence} discuss how heterogeneity between locations can cause correlation in violence or individuals who cause violence can actually physically move from one location to another. In particular, if violence is strictly due to crime we would expect self-excitement and limited diffusion between geographical regions. Whereas if violence is due to insurgencies we would expect more movement of actors as they seek to create widespread disruption in the country. The former theory is reflected in the Spatial Correlation in the Spatially Correlated Self-Exciting model and the later theory would correspond to the Reaction Diffusion component of the second model. The overarching goal of this analysis, thus, is to determine whether in Iraq the growth of violence in fixed locations was due to the presence or absence of self-excitation. Furthermore, we want to determine whether the latent diffusion of violence is due to the movement of population such as in the Reaction Diffusion model, or whether there is static spatial correlation. We will answer this while controlling for exogenous factors that may also explain the rise in violence in a region. In order to address this question as well as demonstrate how Laplace based approximations can be used to fit real world data to models of the class of \eqref{eq:model} we used data from the Global Terrorism Database (GTD) introduced in \cite{lafree2007introducing} to examine the competing theories. The GTD defines terrorist events as events that are intentional, entail violence, and are perpetrated by sub-national actors. Additionally, the event must be aimed at obtaining a political, social, religions, or economic goal and must be conducted in order to coerce or intimidate a larger actor outside of the victim. The majority of lethal events in Iraq from 2003-2010 fit the above category. The GTD uses a variety of open media sources to capture both spatial and temporal data on terroristic events. The database contains information on what the event was, where it took place, when it took place, and what terrorist group was responsible for the event. From 2003 to 2010 in Iraq, the database contains 6263 terrorist events, the spatial structure is shown in figure \ref{SpaceIZ}. \begin{figure}[h] \begin{center} \vspace{6pc} \includegraphics[width=.8 \linewidth]{IncidentsOverPop.pdf} \caption[]{Spatial depiction of 6263 events in Iraq.} \label{SpaceIZ} \end{center} \end{figure} As seen in this map, the majority of the violence is in heavily populated areas such as Baghdad and in the regions north up the Tigris river to Mosul and west through the Euphrates river. In order to model this data, we aggregated the point data to 155 political districts intersected by ethnicities and aggregated the data monthly for 96 months meaning that $\Sigma(\theta)$ in \eqref{eq:gen Model} is a 14880 x 14880 matrix. Population for each political district was taken from the Empirical Studies of Conflict Project website, available from https://esoc.princeton.edu/files/ethnicity-study-ethnic-composition-district-level. We considered covariates controlling for the population density within a fixed region as well as for the underlying ethnicity. We will make the simplifying assumption that both of these are static over time. Previous statistical analysis on terrorism considered macro level covariates, such as democracy in \cite{python2016bayesian} that differ country to country but would not change within a single country as analyzed here. Other studies considered more micro level covariates such as road networks that were found to be statistically related to terrorism in \cite{braithwaite2015battle}. Here we take the view point that the vast majority of the incidents in Iraq were directed against individuals rather than terrorist events directed at fixed locations. Therefore, we would expect a higher population density to provide more targets for a potential terrorist to attack. Furthermore, covariates such as road networks, number of police, or number of US soldiers, would all be highly collinear with population density. We do, though, consider a covariate for ethnicity in a region. Specifically, we add an indicator if the region is predominately Sunni. The disenfranchisement of the Sunnis and high level of violence in Sunni dominated areas has been well established, see for e.g. \cite{baker2006iraq}. Previous research in \cite{linke2012space} focusing on Granger Causality also suggested indicators for majority Sunni/Shia may be appropriate in any analysis of violence in Iraq. \begin{align} & Y(\boldsymbol{s_i},t)|\mu(\boldsymbol{s_i},t) \sim \text{Pois }(\mu(\boldsymbol{s_i},t)) \label{eq:IZ Model}\\ & \mu(\boldsymbol{s_i},t) = \exp[\beta_0+\beta_1\log \text{Pop}(\boldsymbol{s_i})+\beta_2\text{Sunni }(\boldsymbol{s_i})+X(\boldsymbol{s_i},t)] + \eta Y(\boldsymbol{s_i},t-1) \nonumber \\ & X(\boldsymbol{s_i},t)\sim \mbox{Gaus}(\boldsymbol{0},\boldsymbol{Q}^{-1}(\theta)) \nonumber \end{align} The complete statistical model is given in \eqref{eq:IZ Model}. We next fit this model letting $\boldsymbol{Q}=\boldsymbol{Q_{sc}}$ and $\boldsymbol{Q}=\boldsymbol{Q_{rd}}$. We further consider fixing $\eta=0$ to test the presence or absence of self-excitement in the data for both process models. \subsection{Results} We fit all four models using the Laplace approximation method described in Section 3.1. For each of the parameters we used vague proper priors to ensure posterior validity. In the SCSEM and the Spatially Correlated models we used a Half-Cauchy with scale parameter of 5 for $\sigma$ and a Uniform ($\psi_{1}^{-1},\psi_{n}^{-1}$) where $\psi$ are the eigenvalues of $\boldsymbol{H}$. Using the neighborhood structure corresponding to the geographical regions described above, this corresponded to a Uniform (-.3,.13). For each of the exogenous covariates, we used independent Gaussian (0,1000) priors. For the SCSEM model we further assumed a Uniform (0,1) prior for $\eta$. In fitting the RDSEM, we again used a Half-Cauchy with scale parameter of 5 for $\sigma$. For the decay parameter, $\alpha$, we used a Uniform (0,1) prior and for the diffusion parameter, $\kappa$, we chose a Uniform $\left(\frac{-\alpha}{2},1-\frac{\alpha}{2}\right)$ in order to ensure we were in the allowable parameter space. \begin{table}[h] \caption {95\% Credible Intervals for Model Parameters} \label{tab:params} \begin{center} \begin{tabular}{ |c|c|c|c|c| } \hline & Spatial Correlation Only & SCSEM & Reation Diffusion Only & RDSEM \\ \hline $\beta_0$&(-20.2,-18.4) &(-16, -15.5) &(-22.4,-18.0) &(-22,-18.6 )\\ $\beta_1$& (1.2,1.4)&(0.9, 1.1) &(1.1, 1.4) &(1.1, 1.5)\\ $\beta_2$& (1.6,1.9)&(1.1,1.3) &(0.10, 0.33) &(0.17, 0.53)\\ $\eta$& - &(0.35,0.37) & - &(0, 0.04)\\ $\sigma^2$&(1.9,2.7) &(2.1, 2.5) & (0.20, 0.30)&(0.18,0.26)\\ $\theta_1$&(.08,.10) &(0.09,0.1) & - & - \\ $\alpha$& - & - & (0.001, 0.007) &(0.001, 0.007)\\ $\kappa$& - & - & (0.03, 0.07) &(0.03, 0.06) \\ \hline \end{tabular} \end{center} \end{table} All four models took approximately 30 min to an hour depending on starting values to converge using a Newton-Raphson based algorithm to find the maximum. Gaussian approximations to the 95\% credible intervals for the parameters are given for all four models are shown in table \ref{tab:params}. As can be seen in comparing the SCSEM to the RDSEM, the presence or absence of self-excitation appears to be dependent on the choice of structure of $\boldsymbol{Q}$. Furthermore, the impact of majority Sunni is also dependent on whether the Reaction Diffusion or Spatially Correlated model was used. Using the methodology described in Section 3.2, we next calculated DIC as well as posterior predictive P-values based off of the maximum observed value and the number of zeros in the dataset. In the original dataset, the maximum number of events observed for all regions and months was 26 and the dataset had 13445 month/district observations that were zero. The model assessment and selection results are shown in Table \ref{tab:results}. \begin{table} \caption {Model Assessment and Selection Statistics For Iraq Data} \label{tab:results} \begin{center} \begin{tabular}[H]{|c|c|c|c| } \hline Model & DIC & \begin{tabular}{@{}c@{}}P-Values\\ Maximum Value \end{tabular} & \begin{tabular}{@{}c@{}}P-Value \\ Zeros\end{tabular} \\ \hline \begin{tabular}{@{}c@{}}Spatially Correlated Model \\ without Self-Excitation \end{tabular} & 9370 & .02 & 1 \\ \hline \begin{tabular}{@{}c@{}}Spatially Correlated \\ Self-Exciting Model \end{tabular} & 8722 & .97 & 0\\ \hline \begin{tabular}{@{}c@{}}Reaction Diffusion \\ Only Model \end{tabular} & 8664 & .53 & .81\\ \hline \begin{tabular}{@{}c@{}}Reaction Diffusion \\ Self-Exciting Model \end{tabular} & 8699 & .45 & .89\\ \hline \end{tabular} \end{center} \end{table} Clearly from table \ref{tab:results}, the models with an underlying reaction diffusion process model outperform those with spatial correlation only. Furthermore, the addition of self-excitation in the model appears to have minimal impact. In particular, without self-excitation, the spatial correlation model tends to under count the number of violent activities while the SCSEM tends to over count. There really is not much difference between the RDSEM and the reaction diffusion model so we prefer the simper reaction diffusion only model. While $\beta_2$ is only minimally significant in the reaction diffusion model, the models perform better including the covariate than disregarding it entirely. \subsection{Significance} Under all measures of performance, the reaction diffusion model, \eqref{eq:ReacDiffuse Model}, without self-excitation outperforms the other models under consideration. This process model as well as values of the covariates and the lack of self-excitement in the data offer several insights into the causes of the spread of violence in Iraq. Not surprisingly, the reaction diffusion model has a positive relationship between log population and violence. As the majority of attacks are directed at individuals it would clearly follow that regions that have higher population will offer more targets as well as more potential combatants. Further, higher populated areas also would have had higher number of Iraqi government officials as well as US military presence. The positive, though small, relationship between Sunni and violence is also not surprising as, in general, predominately Sunni areas were generally more disenfranchised following the transition to a new Iraqi government after the downfall of Saddam Hussein. More significantly, though, was the finding that the reaction diffusion model fit the data better than the SCSEM or the RDSEM. This suggests that increases in violence can be attributed, at least in part, to movement between high violence and low violence areas rather than repeat or near-repeat actors in a fixed location. While the $\kappa$ parameter may appear small in \ref{tab:params} it still has an impact on the process. For the sake of simplicity, we can demonstrate this on a three node system. For this system we consider a central node that has a high level of violence surrounded by two nodes that have a low level of violence. In this set up we will fix $\beta_0=-19$, $\beta_1=1.3$ and consider each node as having a population of 1000 and let $\kappa \in \{.03,.07\}$. The resultant system over time is shown in Figure \ref{fig:kappa}. Even in this simple system, there is a noticeable increase in violence as the center node diffuses throughout the entire system. \begin{figure}[h] \vspace*{.51cm} \centering \includegraphics[width=8cm]{kappasensitivity} \caption{This plot shows the expected changes in violence in a simple three node system where the center node starts with a high level of violence and the other two nodes start with a low level of violence for $\kappa=.03$, depicted as dashed lines in above figure, and $\kappa=.07$, depicted as straight lines. As seen here after 12 months for $\kappa=.07$ the nodes are essentially at equilibrium. } \label{fig:kappa} \end{figure} The implications of the reaction-diffusion model being preferable over the SCSEM or the spatial correlation only model can be seen by going back to the original PDE that inspired the model, \eqref{eq:Reaction}. The underlying assumption in that model is that violence is that the rate of violence spreading to a region is determined through the levels of violence in neighboring region. From a military planning perspective, this would suggest that if there is a peaceful region surrounded by areas of high violence, the peaceful region should be isolated to prevent the movement of malicious actors. This strategy would be consistent with published military strategy as outlined in \cite{army2006counterinsurgency}. Finally, this offers insight into the nature of the conflict that was fought in Iraq. For instance, \cite{zhukov2012roads} discuss how insurgencies diffuse throughout a population by either physical movement of actors or through movement of ideas, whereas \cite{short2008statistical} suggest that criminal violence would be expected to have an element of self-excitation. When accounting for the possibility of spatial diffusion, this self-excitation does not appear to be present in the Iraqi dataset. Therefore, as a diffusion based model fits the data better, this would suggest the spread of violence was due to the physical movement of an insurgent population or ideology rather than a criminal element that would be expected to stay more static at a location. \section{Discussion} In this manuscript we develop statistical models that allow for spatio-temporal diffusion in the process model and temporal diffusion in the data model. We relate the models to existing theory in how violence diffuses in space and time. We further developed a Laplace approximation for spatio-temporal models that contain self-excitement. This modification allows for a quick and accurate fit to commonly used models in both the analysis of terrorism and criminology. A critical difference between classical INLA and our proposal is that in our proposal, inference is not only performed on the hyperparameters during the exploration of $\pi(\theta|Y)$ in \eqref{eq:main} but also on the self-excitation parameter $\eta$. While $\eta$ is not generally thought of as a hyperparameter, when the linear expansion of the log-likelihood is done in \eqref{eq:FullCondExpand}, $\eta$ enters into $\boldsymbol{Q^*}$ and $\boldsymbol{B^*}$ in a similar manner as the hyperparameters. While we only considered two process models and self-excitation that only exists for one time period, the methodology outlined above can easily be extended to allow self-excitation to have an exponential decay similar to the modeling technique of \cite{mohler2012self}. As shown above, the absence of testing multiple process models may result in premature conclusions about how violence is spreading over regions. While self-excitation may be present in one model, its significance may be dulled through the use of alternative process models resulting in differing conclusions. Although self-excitation has become increasingly popular, alternate approaches based on Besag's auto-logistic model, as used in \cite{weidmann2010predicting} are possible, though care must be taken if count data is used as Besag's auto-Poisson does not permit positive dependency. As shown in \cite{kaiser1997modeling}, a Winsorized Poisson must be used if positive dependency is desired, as it most certainly is in terrorism modeling. In this case, the data model dependency would linearly be associated with the log of $\mu(\boldsymbol{s_i},t)$. Though the motivation for the models in this manuscript was the spatio-temporal spread of violence, the novel concept of combining latent process dependency and data model dependency has the potential to be used in other fields. For example in the modeling of thunderstorms, self-excitation may be present temporally, while process model dependency may also be appropriate due to small-scale, unobservable, spatial or spatio-temporal dependency. Laplace approximations, as demonstrated in this manuscript, allow for quick and relatively accurate methods to fit multiple types of self-exciting spatio-temporal models for initial inference.
{'timestamp': '2017-09-27T02:02:30', 'yymm': '1703', 'arxiv_id': '1703.08429', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08429'}
arxiv
\section{Introduction} Graphs are used to represent data across a wide spectrum of areas, from computational chemistry to social network analysis. Graph mining is an active area of research, and there are numerous methods for mining smaller graphs (several thousand edges), but many of these systems are unable to scale to real-world graphs (e.g., social networks) with millions or even billions of edges. Conventional graph mining algorithms assume a complete static graph as input, however many real-world graphs are often too large to hold in main memory. Additionally, many real-world graphs of interest are dynamic and actively growing - Facebook, for example, records over 300 new users per minute and has a social graph with more than 400 billion edges \cite{ChingFB}. While it is possible to utilize conventional graph mining systems on dynamic graphs by processing static `snapshots' of the graph at various points in time, in many cases the underlying data the graph represents changes at a rate so fast that attempting to analyze the data using such methods is futile. In cases where the graph in question is inherently dynamic, we can instead treat the graph as a sequential stream of edges representing continuous updates to the graph's overall structure. For example, given a graph modeling friendships (edges) between users (nodes) in a social network, we can consider all new or updated relationships during a set time interval (e.g., 1 hour) a set of edges from time $t_i$ to $t_{i+1}$. The graph mining system then processes the sequential edge sets at every interval, as opposed to attempting to read the entire graph at once. Processing large graphs in a streaming fashion drastically reduces the system's memory requirements (since only small portions of the graph are seen at a time) and enables processing of large, dynamic real-world datasets. However, deploying a streaming model for real-time data analysis also imposes strict constraints: the system has a limited time window to process each set of edges, and edges can only be viewed once before they are replaced in memory by those in the next set. Many graph mining algorithms aim to identify interesting patterns within an input graph. Various algorithms use different metrics to quantify how `interesting' a pattern is: frequent subgraph mining (FSM) focuses on finding all subgraphs that appear in the graph over a certain frequency threshold, whereas problems such as counting motifs or finding maximal cliques in a graph (formalized in \cite{przulj-motifs} and \cite{bron-kerbosch-cliques}, respectively) focus on discovering subgraphs with a specific structure. This paper relies on a novel approach to identify interesting patterns in a graph - namely, finding a set of substructures that best compress the graph. More precisely, we compress a graph using a pattern (subgraph) $G$ by replacing all instances of $G$ in the graph with a new node $p$ representing $G$ (see figure \ref{fig:compress}). The reduction in size of the overall graph is a measure of the compression afforded by pattern $G$, and we search for patterns that compress the graph to the maximal extent. The same concept is found in certain types of data compression (e.g., LZ78 \cite{lz78}, ZIP) where the compression method looks for recurring patterns or sequences in the data stream, builds a dictionary representing the recurring patterns with shorter binary codes, and then stores the compressed data using only the binary codes and the dictionary. In the context of graphs, a byproduct of this process is that the pattern dictionary contains a set of subgraphs that compress well, and therefore represents an alternative approach for finding interesting (highly-compressing) patterns in a graph stream. We propose a dictionary-based compression method for graph- based knowledge discovery: {GraphZip}. Our approach is designed to efficiently mine graph streams and uncover interesting patterns by finding maximally-compressing substructures. Specifically, our main contributions are as follows: \begin{enumerate} \item We propose a new graph mining paradigm based on the LZ class of compression algorithms. \item Based on this paradigm, we introduce a new graph mining algorithm, {GraphZip}, for efficiently processing massive amounts of data from graph streams. \item We demonstrate the effectiveness and scalability of our method using a variety of openly available synthetic and real-world datasets. \end{enumerate} In our experiments, we demonstrate that our approach is able to retrieve both complex and insightful patterns from large real-world graphs by utilizing graph streams. In addition, we show that our approach is able to successfully mine a large class of varied substructures from artificially-generated graphs with ground truth patterns. When we compare {GraphZip}'s performance with that of several other state-of-the-art graph mining methods, we find that {GraphZip} consistently outperforms state-of-the-art methods on a variety of real-world datasets. The {GraphZip} system, including all related code and data used for this paper, are available for download online\footnote{\url{https://github.com/cpacker/graphzip}}. \endgroup \begin{figure} \includegraphics[width=3.2in]{figs-compression_by_sub_500dpi.png} \caption{Compression via substitution. Vertices $A$, $B$, and $C$ form a recurring pattern (subgraph) $G$. Substituting the pattern for a single node $P$ representing $G$ reduces the graph's overall size. The reduction in size is a measure of the compression afforded by pattern $P$. }\label{fig:compress} \end{figure} \section{Related Work} For the purposes of this paper, we classify previous work into two general categories: streaming and non-streaming. \subsection{Non-streaming} Non-streaming graph mining algorithms take as input either a single graph (single graph mining), or multiple smaller graphs (transactional mining). \textbf{Transactional mining.} {FSG} \cite{fsg} is an early approach to finding frequent subgraphs across a set of graphs, and adopts the Apriori algorithm for frequent itemset mining \cite{apriori}. {FSG} works by joining two frequent subgraphs to construct candidate subgraphs, then checking the frequency of the new candidates in the graph. {gSpan} \cite{gspan} uses a `grow-and-store' approach that extends saved subgraphs to form new ones, an improvement over {FSG}'s prohibitively expensive join operation. {Margin} \cite{margin} prunes the search space to find maximal subgraphs only, a narrower and thus easier problem than FSM. {CloseGraph} \cite{closegraph} is another method that reduces the problem space by mining only \emph{closed} frequent subgraphs - subgraphs that have strictly smaller support than any existing supergraphs. {Leap} \cite{leap} and {GraphSig} \cite{graphsig} are two recent approaches for mining `significant subgraphs' as measured by a probabilistic objective function. By mining a small set of statistically significant subgraphs as opposed to a complete set of frequent subgraphs, {Leap} and {GraphSig} are able to avoid the problem of exponential search spaces generated by FSM miners with low frequency thresholds. \textbf{Single graph mining.} {SUBDUE} \cite{subdue} is an approximate algorithm based on the branch-and-bound search technique. {SUBDUE}, like {GraphZip}, uses the Minimum Description Length (MDL) principle \cite{mdl} to mine maximally-compressing patterns in the graph. However, unlike {GraphZip}, {SUBDUE} returns a restrictively small number of patterns regardless of the size of the input graph \cite{grew}. {SUBDUE} has been improved in recent years \cite{subdue2-subgen,subdue3,subdue4}, yet the fundamental limitations of the algorithm (in particular the branch-and-bound technique) remain the same. {SEuS} \cite{seus} is an approximate method that creates a compressed representation of the graph by collapsing vertices that share labels. {SEuS} however is only effective in cases where the input graph has a small number of unique subgraphs that occur with high frequency, as opposed to when the input graph has a large number of subgraphs that appear with lower frequency. {SiGram} \cite{sigram} is a complete method for finding frequent connected subgraphs (complete methods are guaranteed to find all solutions that fit certain constraints such as the minimum frequency threshold, unlike their approximate counterparts). {SiGram} adopts a grow-and-store approach similar to {gSpan}, but uses the expensive (NP-complete) Maximal Independent Set (MIS) metric for its frequency threshold, leading the system to be comparatively inefficient in practice. Additionally, like {SEuS}, {SiGram} suffers from a limited domain problem as it is designed specifically to mine sparse, undirected and labeled graphs only. {Grew} \cite{grew} is another approximate method for mining frequent connected subgraphs, and is similar to {SUBDUE} in that {Grew} only discovers a relatively small subset of solutions in the search space. {GraMi} \cite{grami} is a state-of-the-art complete method (with an approximate version {AGraMi}) that has been shown to be highly-efficient for FSM on a single large graph. However, the size of the input graph is still limited since {GraMi} requires the entire graph to be held in main memory. {Arabesque} \cite{arabesque} is a recent distributed approach built on top of {Apache Giraph} \cite{giraph} that can horizontally scale non-streaming algorithms (FSM, clique finding, motif counting, etc.) across multiple servers. However, horizontal scaling can be cost-prohibitive and is only capable of linearly scaling algorithms whose runtimes often grow exponentially with the size of the input graph. {GERM} \cite{germ} and the algorithm introduced by Wackersreuther et al. \cite{wackersreuther} can mine frequent subgraphs in dynamic graphs, however both methods require as input snapshots of the entire graph as opposed to incremental updates to the graph via graph streams. \subsection{Streaming} {GraphScope} \cite{graphscope} is a parameter-free streaming method that, like {GraphZip} and {SUBDUE}, is based on the MDL principle. {GraphScope} encodes the graph stream with the objective of minimizing compression cost, in order to determine important change-points in the temporal data. Beyond change-point and community detection however, {GraphScope} has limited use for other tasks, e.g. mining interesting subgraphs. Though the model itself is parameter-free, {GraphScope} requires the dimensions of the graph (number of source and destination nodes) to be known \emph{a priori}, and thus is unable to mine streams from dynamic graphs that introduce unseen nodes in new edge streams. Braun et al. \cite{braun2014} proposed a novel data structure called DSMatrix for mining frequent patterns in dense graph streams, yet similar to {GraphScope} their approach requires that the edges and nodes be known beforehand, limiting its real-world applications. Aggarwal et al. \cite{aggarwalvldb2010} introduced a probabilistic model for mining dense structural patterns in graph streams, however the approximation techniques used lead to the occurrence of both false positives and false negatives in the results set, reducing the method's viability in many real-world settings. {StreamFSM} \cite{streamfsm}, based on {gSpan}, is a recently introduced method for frequent subgraph mining on graph streams, whose performance we compare directly with that of {GraphZip} (see section \S 4). There also exist several systems targeted at more specific graph analysis tasks in the streaming setting: counting triangles \cite{doulion}, outlier \cite{aggarwalicde2011} and hotspot \cite{aggarwalicdm2013} detection, and link prediction \cite{zhaoicde2016}. Summarization methods such as {TCM} \cite{tcm}, {gSketch} \cite{gsketch} and {count-min sketch} \cite{countminsketch} focus on constructing sketch synopses from large graph streams that can provide approximate answers to queries about the graph's properties. For a detailed survey of state-of-the-art graph stream techniques, see \cite{streamsurvey} (for a more general overview of graph mining algorithms, see \cite{gmsurvey}). {GraphZip} can process an infinite stream of edges without requiring details about nodes or edges beforehand, and has no restrictions on the type of graph being streamed. While {GraphZip} is designed specifically for the streaming setting, it draws from ideas such as grow-and-store and the MDL principle originally applied in non-streaming methods. In contrast to summarization methods, {GraphZip} returns exact subgraphs extracted from the stream as opposed to approximate results. To the best of our knowledge, {GraphZip} is the first graph mining algorithm for mining maximally-compressing subgraphs from a graph stream. \begin{table} \caption{Symbol definitions. Note that $\alpha${} and $\theta${} are the hyperparameters of the {GraphZip} algorithm.} \label{table:1} \begin{tabular}{@{}ll@{}} \toprule Symbol & Definition\\ \midrule $G$ & Arbitrary graph\\ $V_G$ & Vertex set of graph G\\ $E_G$ & Edge set of graph G\\ $S$ & Graph stream sequence\\ $S^{(i)}$ & Graph at time $i$ of stream $S$\\ $B$ & A batch of edges from graph stream\\ $P$ & Pattern dictionary\\ $P^{(i)}$ & Pattern (graph) $i$ in dictionary $P$\\ $V_{P^{(i)}}$ & Vertex (node) set of pattern $P^{(i)}$\\ \addlinespace[0.2em] $E_{P^{(i)}}$ & Edge set of pattern $P^{(i)}$\\ \addlinespace[0.2em] $C_{P^{(i)}}$ & Compression score of pattern $P^{(i)}$\\ \addlinespace[0.2em] $F_{P^{(i)}}$ & Frequency (count) of pattern $P^{(i)}$\\ $\alpha$ & Batch size\\ $\theta$ & Size threshold of $P$\\ $H(G)$ & Compression scoring function\\ $I(G, G)$ & Graph isomorphism function\\ $SI(G, G)$ & Subgraph isomorphism function\\ \bottomrule \end{tabular} \end{table} \section{Method} \subsection{Preliminaries} In this section, we review the fundamental graph theory needed to formulate our approach and formalize the definitions used in the rest of the paper. See table \ref{table:1} for symbol definitions. \textbf{Terminology.} A graph $G$ is composed of a vertex set $V$ which contains all vertices (nodes) $v \in V$, and an edge set $E$ which contains all edges $e \in E$, each of which connects a source vertex to a target vertex. A subgraph $g$ of $G$ is a graph composed of a subset of $G$'s vertices and edges. All vertices $v \in V$ and edges $e \in E$ have a unique \emph{index} which refers to its internal location in the edge or vertex list (e.g., $v_1$ in $V = \{v_1, v_2, v_3\}$ has index $0$, $v_2$ has index 1, etc.). In a vertex-labeled graph, there exists a one-to-one (i.e., unique) mapping from each vertex to a \emph{label}, and in an edge-labeled graph the same mapping exists for the edge set. The value of labels within a graph is often domain-dependent: e.g., in a social network, vertex labels may correspond to a user type (e.g. `male', `female') while edge labels may correspond to different relationship types (e.g. `friend', `family', etc.). \begin{definition} \emph{Isomorphism}: Two graphs $G_1$ and $G_2$ are isomorphic (denoted by $G_1 \simeq G_2$) if there is a one-to-one mapping between the edges and vertices of $G_1$ and $G_2$. That is, each vertex $v$ in $G_1$ is mapped to a unique vertex $u$ in $G_2$, the two of which must share the same edges, i.e., be adjacent to the same vertices (if the graph is labeled, the vertices and edges must also share the same labels). $G_1 \simeq G_2$ is equivalent to $G_1$ and $G_2$ sharing the same structure. \end{definition} \begin{definition} \emph{Subgraph isomorphism}: Graph $G_1$ is considered a subgraph isomorphism of graph $G_2$ if it is an isomorphism of some subgraph $g_2$ of $G_2$. The actual instance of $g_2$ is called an \emph{embedding} of $G_1$ in $G_2$. The subgraph isomorphism problem is a generalization of the graph isomorphism problem, and is known to be NP-complete \cite{subiso-npcomplete} (unlike the graph isomorphism problem, the complexity of which is undetermined). Despite the problem's complexity, many graph mining algorithms make heavy use of subgraph isomorphism checks for graph matching, and accordingly several optimizations have been made in the past decade which have significantly improved the efficiency of isomorphism (or subgraph isomorphism) checks in practice. \end{definition} \begin{definition} \emph{Graph stream:} A graph stream $S$ can be represented as a chronological sequence of edges drawn from a graph. \begin{displaymath} S = \{ e_{(1)}, e_{(2)}, e_{(3)}, ... , e_{(n)} \} \end{displaymath} We can process the graph stream by segmenting the stream into distinct sets of edges, each set forming a single (possibly disconnected) graph stream object. In the case of a dynamic graph, updates to the graph can be viewed as new stream objects. In the rest of the paper we also refer to graph stream objects as \emph{batches}, where \emph{batch size} refers to the size of the stream object's edge set (i.e., the number of edges in the batch). \end{definition} \subsection{Problem Formulation} Given a graph stream and a compression scoring function $H$, our objective function equates to maximizing the cumulative compression score of the entire pattern dictionary $P$: \begin{equation} \label{e.problem} f(G,H) = \argmax_P \sum_i H(P^{(i)}) \end{equation} The direct approach to solving for $f$ would require enumerating over all possible subgraphs of $G$, a computationally intractable task in most real-world scenarios since it would require storing the entirety of the graph stream, in addition to computing subgraph isomorphism checks over the entire graph. Therefore, we employ a heuristic algorithm to approximate such a solution. \begin{algorithm}[t!] \caption{GraphZip} \label{alg:graphzip} \begin{algorithmic}[1] \STATE{Initialize $P$} \WHILE{edges remain in stream} \STATE\label{line3}{Construct graph $B$ using $\alpha${} edges} \FOR{\textbf{each} graph $p$ in $P$} \STATE{$E$ $\gets$ subgraph isomorphisms of $p$ in $B$} \FOR{\textbf{each} graph $g$ in $E$} \STATE{$g' \gets g.copy()$} \FOR{\textbf{each} $e$ in $E_g$} \IF{$e$ not in $p$} \STATE{Extend $g'$ by new edge $e$} \ELSE \STATE{Add internal edge $e$ to $g'$} \ENDIF \ENDFOR \STATE{Mark each extended edge $e \in B$ as used} \IF{$g' \neq g$} \STATE{Add $g'$ to $P$} \ENDIF \ENDFOR \ENDFOR \STATE{$R \gets$ remaining unused edges in $B$} \STATE{Add edges in $R$ as single-edge patterns to $P$} \ENDWHILE \RETURN $P$ \end{algorithmic} \end{algorithm} \subsection{The {GraphZip} Algorithm} {GraphZip} is a highly-scalable method for discovering interesting patterns in a massive graph. Inspired by dictionary-based file compression, {GraphZip} builds a dictionary of highly-compressing patterns by counting previously seen patterns in the graph stream and saving new patterns that extend from old ones. The resulting dictionary contains highly-compressing patterns from the given graph stream, which can be used directly or fed into a separate non-streaming algorithm (e.g., a maximal-clique finder). While {GraphZip} is designed specifically with graph streams in mind, the algorithm can be easily applied to smaller static graphs without modification: if {GraphZip} is given as input a single graph it will automatically partition it into batches of size $\alpha${} and process the graph as a stream. If the total number of edges in the graph (or number of edges remaining after $n$ iterations) is less than $\alpha${}, {GraphZip} will process the graph as a single batch. This flexibility between input types allows us to compare {GraphZip} directly with non-streaming methods. \begin{figure}[t] \includegraphics[width=\columnwidth]{figs-graphzip_algorithm.pdf} \caption{A simplified illustration of the {GraphZip} algorithm. In dictionary $P$, blue indicates a new pattern, orange indicates a matched pattern extending to a new pattern, and green indicates a non-repeated pattern. After processing $S^{(1)}$, $P$ contains only single edge patterns. $A$-$B$, $C$-$A$, and $D$-$C$ are embedded in $S^{(2)}$, so they are extended as new patterns in $P$. $C$-$A$-$B$ is embedded in $S^{(3)}$, and is extended with an internal edge as a new pattern, along with the remaining edge $D$-$B$.} \label{fig:algorithm} \end{figure} The general procedure of {GraphZip} is illustrated in figure 2. {GraphZip} is initialized with an empty dictionary $P$ with max size $\theta${} (provided by the user), which maps graphs to their frequency (count) and compression score. {GraphZip} collects arriving edges from the graph stream into batches of size $\alpha${} (also provided by the user), and runs the $compress$ procedure on each batch $B$: if a pattern $p$ from the dictionary is embedded in $B$, {GraphZip} increments the frequency of the pattern in the dictionary and recomputes its compression score. Additionally, for each instance $i$ of pattern $p$ embedded in batch $B$, {GraphZip} extends $p$ by one edge length, tagging each of the edges from $B$ used to extend $p$. The new edges used to extend $p$ are the edges incident on $i$ that exist in batch $B$ but not in pattern $p$. {GraphZip} then adds the new extended pattern to $P$. After $P$ has been updated with all the extended patterns, the remaining untagged edges in $B$ are added as single-edge patterns to $P$. Our current reference implementation supports both undirected and directed edges, but not hyper-edges or self-loops. However, these limitations are implementation specific rather than inherent to the algorithm. Additionally, both representational variants can be converted to simple edges (a node and two edges). If the dictionary exceeds size 2$\theta${}, the dictionary is sorted according to the compression scores and trimmed to $\theta${}. A pattern's compression score is computed as follows: \begin{equation} \label{e.scorefunction} H(P^{(i)}) = (|E_{P^{(i)}}| - 1) \times (F_{P^{(i)}} - 1) \end{equation} This equates a pattern's compressibility to a product of its size and frequency. We use $(F_{P^{(i)}} - 1)$ so that a pattern with a frequency of $1$ has a compression score of $0$, since a pattern that only appears once affords no real compression to the overall graph. The same offset is applied to the pattern size in $(|E_{P^{(i)}}| - 1)$ to reduce the weighting of single-edge patterns. Due to the fact that overlapping instances of a pattern in a batch are counted independently, it is possible that {GraphZip} will overestimate the compression value of large structures with many homomorphisms. Note that the compression method used is intrinsically lossy, since {GraphZip} does not retain information on how each of the instances are connected to the rest of the graph. The main focus of our work is knowledge discovery in graph streams, so lossy compression is an appropriate trade-off for decreased complexity and increased performance. More work is necessary to make {GraphZip} lossless, for example in the case where it is necessary to fully reconstruct the original graph from the pattern dictionary. See algorithm \ref{alg:graphzip} for pseudo-code, and the online repository for a reference implementation. \subsection{Scalability} Speed and memory usage are critical properties of graph mining algorithms designed to mine large real-world graphs. A deployed graph mining system should be able to keep up with the flow of data in the dynamic graph setting, while summarizing a possibly infinite graph stream in memory. Memory usage in {GraphZip} is directly bounded by the maximum dictionary size ($\theta${}), and is indirectly bounded by the batch size ($\alpha${}), since the patterns within the dictionary cannot grow larger than the batch size (no subgraph isomorphisms of the pattern in the batch will exist). Both parameters $\theta${} and $\alpha${} can be modified to maximize performance given certain hardware limitations. The bulk of the computation in the {GraphZip} algorithm happens while checking for embeddings of pattern $p$ in batch $B$ (\emph{find all subgraph isomorphisms of $p$ in $B$}). Note that because each entry in the pattern dictionary is unique, none of the subgraph isomorphism checks are contingent on each other, and thus the loop can be na\"{\i}vely parallelized across an arbitrary number of cores. This allows for large performance gains and means that an increase in dictionary size can be scaled linearly with an increase in cores. Even without parallelization of the subgraph isomorphism checks, {GraphZip} is still faster than other state-of-the-art graph mining systems (as described in section \S 4). See section \S A for a formal runtime analysis. \section{Experimental Evaluation} There are two main questions we focus on when evaluating our algorithm: does it generate objectively and subjectively good results (i.e. correct and interesting results, respectively), and does it generate them in a reasonable amount of time? To answer these questions we test {GraphZip} on an extensive suite of synthetic and real datasets ranging from a few thousand to several million nodes and edges (see table \ref{tab:datasets}). Using these datasets, we benchmark {GraphZip} against three state-of-the-art, openly available graph mining systems: {SUBDUE}\footnote{\url{http://ailab.wsu.edu/subdue}}, {GraMi}\footnote{\url{https://github.com/ehab-abdelhamid/GraMi}}, and {StreamFSM}\footnote{\url{https://github.com/rayabhik83/StreamFSM}}. Because there is no directly comparable method to {GraphZip} for mining maximally-compressing patterns in graph streams, we instead evaluate {GraphZip} against a non-streaming method for mining compressing patterns ({SUBDUE}), a non-streaming method for frequent subgraph mining ({GraMi}), and a streaming method for frequent subgraph mining ({StreamFSM}). Highly-compressing patterns are often both large and frequent, so FSM methods serve as an appropriate comparison to {GraphZip}. All experiments were run on a compute server configured with an AMD Opteron 6348 processor (2.8 GHz) and 128GB of RAM. \begin{figure}[t!] \includegraphics[width=\columnwidth]{figs-graph_classes.pdf} \caption{We embed different types of graph substructures into our synthetic graphs, and then test to see if they are recovered. Corresponding datasets (from left to right): 3-CLIQ, 4-CLIQ, 4-STAR, 4-PATH, 8-TREE.}\label{fig:groups} \end{figure} \subsection{Synthetic graphs} To test whether our algorithm outputs \emph{correct} substructures, we utilize a tool called {SUBGEN} \cite{subdue2-subgen} to embed ground truth patterns with desired frequencies into an artificially generated graph. This allows us to test whether or not a graph mining system correctly surfaces known patterns we expect to be returned in the result set. Since both {GraphZip} and {SUBDUE} are designed to mine highly-compressing patterns from a graph, we embed large and frequent (i.e., highly-compressing) patterns in the graph, then record the number of ground truth patterns recovered. Given a set of embedded patterns $E$, and a set of patterns $R$ returned by our graph mining system, an embedded pattern $E^{(i)} \in E$ is considered \emph{matched} if for some returned pattern $R^{(i)} \in R$, $R^{(i)} \simeq E^{(i)}$. Thus, we calculate the fraction $a$ of embedded patterns recovered using the scoring metric \begin{equation} \label{e4.1} a = |\{E^{(i)} | E^{(i)} \in E \wedge R^{(i)} \in R \wedge E^{(i)} \simeq R^{(i)}\}|\ /\ |E| \end{equation} Which is equivalent to \begin{equation} \label{e4.2} \textit{\small accuracy} = {\textit{\small matched patterns } } / { \textit{ \small total patterns}} \end{equation} We count a ground truth pattern as \emph{matched} if it is found in {GraphZip}'s pattern dictionary after the final batch, or in {SUBDUE}'s case, if it is returned directly at the end of the program. In addition to making the ground truth patterns highly-compressing, we also design the patterns to cover a wide class of fundamental graph patterns, including cliques, paths, stars and trees (see figure \ref{fig:groups}). This allows us to discern if a method has difficulty mining a certain type of structure (e.g., a poorly designed system may have trouble detecting cycles and therefore cliques). The naming scheme for each synthetic graph dataset is \emph{N-TYPE}, where $N$ is the number of vertices in the embedded pattern and \emph{TYPE} is a shorthand of the pattern type (e.g., 3-CLIQ is a graph with embedded 3-cliques). All synthetic graphs in table \ref{table:graphzip-subdue-synthetic} are generated with 1000 nodes, 5000 edges, and 20\%, 50\% or 80\% coverage (the percentage of the graph covered by instances of the pattern). \begin{table}[t] \caption{{GraphZip} and {SUBDUE} runtime and accuracy on various synthetic graphs. For runtime, lower is better. For {SUBDUE}, the `{+}' for runtime indicates the program was terminated after 1000 seconds (no accuracy shown).} \label{table:graphzip-subdue-synthetic} \begin{tabular}{@{}lccc@{}c@{}cc@{}} \toprule \multirow{2}{*}{Dataset} & \multirow{2}{*}{Cov.} & \multicolumn{2}{c}{Runtime (sec.)} & \phantom{a} & \multicolumn{2}{c}{Accuracy (\%)} \\ \cmidrule(lr{0em}){3-4} \cmidrule{6-7} & (\%) & {\small {GraphZip}} & {\small {SUBDUE}} & \phantom{abc} & {\small {GraphZip}} & {\small {SUBDUE}} \\ \midrule \addlinespace[0.5em] \multirow{3}{*}{3-CLIQ} & 20 & \textbf{52.25} & 66.68 & & \textbf{100.0} & 89.24 \\ \addlinespace[-0.2em] & 50 & \textbf{3.779} & 22.22 & & \textbf{100.0} & 89.61 \\ \addlinespace[-0.2em] & 80 & \textbf{3.665} & 11.99 & & \textbf{100.0} & 86.61 \\ \addlinespace[0.3em] \multirow{3}{*}{4-PATH} & 20 & \textbf{45.37} & 58.00 & & \textbf{100.0} & 100.0 \\ \addlinespace[-0.2em] & 50 & \textbf{3.052} & 18.57 & & \textbf{100.0} & 100.0 \\ \addlinespace[-0.2em] & 80 & \textbf{2.935} & 10.30 & & \textbf{100.0} & 100.0 \\ \addlinespace[0.3em] \multirow{3}{*}{4-STAR} & 20 & \textbf{50.70} & 1000{+} & & \textbf{100.0} & - \\ \addlinespace[-0.2em] & 50 & \textbf{4.184} & 1000{+} & & \textbf{100.0} & - \\ \addlinespace[-0.2em] & 80 & \textbf{4.483} & 1000{+} & & \textbf{100.0} & - \\ \addlinespace[0.3em] \multirow{3}{*}{4-CLIQ} & 20 & \textbf{68.06} & 1000{+} & & \textbf{100.0} & - \\ \addlinespace[-0.2em] & 50 & \textbf{29.19} & 1000{+} & & \textbf{100.0} & - \\ \addlinespace[-0.2em] & 80 & \textbf{13.92} & 44.78 & & \textbf{100.0} & 89.51 \\ \addlinespace[0.3em] \multirow{3}{*}{5-PATH} & 20 & \textbf{48.47} & 1000{+} & & \textbf{100.0} & - \\ \addlinespace[-0.2em] & 50 & \textbf{4.461} & 21.30 & & \textbf{100.0} & 99.81 \\ \addlinespace[-0.2em] & 80 & \textbf{4.267} & 24.16 & & \textbf{100.0} & 99.42 \\ \addlinespace[0.3em] \multirow{3}{*}{8-TREE} & 20 & \textbf{62.68} & 1000{+} & & \textbf{100.0} & - \\ \addlinespace[-0.2em] & 50 & \textbf{10.39} & 1000{+} & & \textbf{99.65} & - \\ \addlinespace[-0.2em] & 80 & \textbf{11.07} & 1000{+} & & \textbf{100.0} & - \\ \addlinespace[0.1em] \bottomrule \end{tabular} \end{table} \subsection{Comparison with {SUBDUE}} Table \ref{table:graphzip-subdue-synthetic} shows the runtime and accuracy (eq. \ref{e4.1}) for {GraphZip} and {SUBDUE} on the synthetic datasets. {GraphZip} is clearly faster than {SUBDUE}, taking an order of magnitude less runtime in most experiments. Decreasing the coverage across all pattern types increased the runtime for both systems. {SUBDUE} is unable to process half of the datasets (including all 4-STAR and 8-TREE experiments) in less than 1000 seconds, while {GraphZip} is able to process the same datasets in a fraction of the time with 99-100\% accuracy in all cases. Among the datasets {SUBDUE} is able to process, the greatest difference in accuracy lies in the clique datasets (3-CLIQ and 4-CLIQ), where {SUBDUE} misses approximately 10\% of the embedded patterns. The {GraphZip} algorithm contains an explicit edge case to extend internal edges in a pattern with no new vertices, which enables {GraphZip} to capture cliques with high accuracy (see algorithm \ref{alg:graphzip} and figure \ref{fig:algorithm}). Our results indicate a stark difference in efficiency between {GraphZip} and {SUBDUE}: {SUBDUE} is significantly slower than {GraphZip} even on relatively small graphs with several thousand edges, and for graphs with certain classes of embedded patterns in them (stars and binary trees are particularly problematic). For this reason, when evaluating {GraphZip} with larger real-world graphs we focus on benchmarking against more scalable methods. \subsection{Real-world graphs} We use several large, real-world graph datasets to test the scalability of the {GraphZip} algorithm. See table \ref{tab:datasets} for further details. \\ \emph{NBER}\footnote{\url{http://www.nber.org/patents}}: NBER \cite{nber} is a graph of all U.S. patents granted (from Jan. 1963 to Dec. 1999) and the citations between them. The graph contains nearly 4 million nodes (patents) and over 16 million edges. Each node (citing patent) has edges to all the patents in its citation section. We added time-stamps to the citation graph prepared by \cite{snap-nber} and removed all withdrawn patents which had missing metadata ($<$ 0.04\% of all edges).\\ \emph{HetRec}\footnote{\url{http://grouplens.org/datasets/hetrec-2011}}: The HetRec 2011 MovieLens 2k \cite{hetrec} dataset links movies of the MovieLens 10M\footnote{\url{http://www.grouplens.org}} dataset with information from their IMDb\footnote{\url{http://www.imdb.com}} and Rotten Tomatoes\footnote{\url{http://www.rottentomatoes.com}} pages. We use a version of the dataset arranged by \cite{streamfsm}, in which nodes are labeled as `movie', `actor' or `director'. Edges connect movies to actors and directors: an edge from movie to director is labeled `directed-by', and an edge from movie to actor is labeled `acted-by'. The data spans 98 years, and is split into one graph stream (batch) file per year. \\ \emph{Higgs}\footnote{\url{https://snap.stanford.edu/data/higgs-twitter.html}}: The \emph{Higgs Twitter Dataset} \cite{higgs} is a collection of 563,069 interactions (retweets, mentions, and replies) between 304,691 users on Twitter before, during, and after the announcement of the discovery of Higgs boson particle on July 4th, 2012. The Tweets were scraped over the course of one week (168 hours) by filtering tweets for the tags `lhc', `cern', `boson' and `higgs'. Edges are labeled using the type of the interaction between the two users (`retweet', `mention', and `reply'), while all nodes share the same `user' label. \begin{table}[t] \caption{Details of real-world datasets used. The average stream-rate (in edges per second) is calculated by dividing the total number of edges by the time span of the entire graph. } \label{tab:datasets} \begin{tabular}{@{}lrrrr@{}} \toprule Dataset & Vertices & Edges & Labels & Stream-rate \\ \midrule NBER & 3,774,218 & 16,512,783 & 418 & $1.4 \times 10^{-2}$ \\ Higgs & 304,691 & 563,069 & 4 & $9.3 \times 10^{-1}$ \\ HetRec & 108,451 & 241,897 & 5 & $7.8 \times 10^{-5}$ \\ \bottomrule \end{tabular} \end{table} \begin{figure*}[t] \begin{minipage}[t]{0.48\linewidth} \begin{figure}[H] \centering \begin{subfigure}[H]{0.47\linewidth} \includegraphics[width=\linewidth]{figs-nber_sr_lscale.pdf} \caption{ } \label{fig:graphzip_grami_sr_nber} \end{subfigure}\qquad \begin{subfigure}[H]{0.44\linewidth} \includegraphics[width=\linewidth]{figs-nber_runtime.pdf} \caption{ } \label{fig:graphzip_grami_rt_nber} \end{subfigure} \vspace{-3mm} \caption[Two numerical solutions]{Stream-rate (a) and runtime (b) of {GraphZip} and {GraMi} on the \textit{NBER} dataset. {GraMi}'s stream-rate decrease significantly near the end, while {GraphZip}'s stream-rate remains relatively constant.} \label{fig:graphzip_grami_nber} \end{figure} \end{minipage}% \hfill% \begin{minipage}[t]{0.48\linewidth} \begin{figure}[H] \centering \begin{subfigure}[H]{0.47\linewidth} \includegraphics[width=\linewidth]{figs-hetrec_sr_lscale.pdf} \caption{ } \label{fig:graphzip_streamfsm_sr_hetrec_l} \end{subfigure}\qquad \begin{subfigure}[H]{0.44\linewidth} \includegraphics[width=\linewidth]{figs-hetrec_runtime.pdf} \caption{ } \label{fig:graphzip_streamfsm_rt_hetrec_nl} \end{subfigure} \vspace{-3mm} \caption[]{Stream-rate (a) and runtime (b) of {GraphZip}, {GraMi}, and {StreamFSM} on the \textit{HetRec} dataset. Both {GraMi} and {StreamFSM} experience a massive spike in runtime near iteration 93.} \label{fig:graphzip_streamfsm_hetrec} \end{figure} \end{minipage}% \vspace{-1.0mm} \end{figure*} \begin{figure} \vspace{2mm} \centering \begin{subfigure}[H]{0.45\linewidth} \includegraphics[width=\linewidth]{figs-nber_scatter.pdf} \caption{ } \label{fig:graphzip_nber_scat} \end{subfigure}\qquad \begin{subfigure}[H]{0.45\linewidth} \includegraphics[width=\linewidth]{figs-hetrec_scatter.pdf} \caption{ } \label{fig:graphzip_hetrec_scat} \end{subfigure} \vspace{-3mm} \caption[]{Distribution of {GraphZip}'s pattern dictionary after 300 iterations on \emph{NBER} (a) and after 98 iterations on \emph{HetRec} (b). The distribution for the larger \emph{NBER} dataset (a) is skewed towards patterns with high frequencies, while the distribution for patterns in \emph{HetRec} (b) is more varied.} \label{fig:graphzip_scats} \vspace{-1mm} \end{figure} \subsection{Comparison with {GraMi}} Despite being designed for mining highly-compressing patterns like {GraphZip}, {SUBDUE} has clear performance issues that restrict benchmarking it against {GraphZip} on large real-world graphs. Therefore we also compare {GraphZip} with {GraMi}, a state-of-the-art graph mining system for frequent subgraph mining on large static graphs. In contrast to {SUBDUE}, {GraMi} is efficient enough to process datasets with millions of edges, however {GraMi}'s relative performance still allows us to motivate the need for graph mining algorithms designed explicitly to handle streaming data. {GraMi} takes as input a single graph file as opposed to a sequence of edges, so in order to simulate mining a dynamic graph with a non-streaming method we append the previous graph with the next set of edges at each iteration, initializing the graph with the first set of edges. Thus, each iteration represents a `snapshot' of the growing graph. Since both methods are paramaterized, we first tune {GraMi}'s minimum frequency threshold so that it returns a usable number of non-single edge patterns, then set {GraphZip}'s parameters (batch and dictionary size) such that the pattern dictionary resembles the set of subgraphs returned by {GraMi}. On \emph{NBER} (figure \ref{fig:graphzip_grami_nber}), we fix {GraMi}'s minimum frequency threshold to 1000 which returned a set of subgraphs with a maximum, minimum, and average size of $6$, $1$, and $1.47$ respectively. Running {GraphZip} with $\alpha = 5$ and $\theta = 50$ resulted in a pattern dictionary with a maximum, minimum, and average subgraph size of $5$, $1$, and $2.89$ (figure \ref{fig:graphzip_scats} shows the dictionary distributions for both \emph{NBER} and \emph{HetRec}). Since the overall runtime of each model depends significantly on the configuration of the parameters, the main purpose of our comparison is to examine trends in the runtime and stream-rate of each model using settings where they return comparable sets of subgraphs. Our results show that {GraphZip} is clearly more scalable than {GraMi} when mining large graphs in the streaming setting. While processing \emph{NBER}, {GraMi}'s runtime (figure \ref{fig:graphzip_grami_rt_nber}) grows exponentially, experiencing a large spike near iteration 300. Figure \ref{fig:graphzip_grami_sr_nber} (normalized by patents per month) demonstrates this clearly: {GraphZip} maintains a constant stream-rate throughout, while {GraMi}'s stream-rate gradually slows until it sharply drops near the final updates. In fact, {GraphZip}'s stream-rate shows a slight increase over time; one explanation is that as the captured patterns in $P$ become more complex, less isomorphism checks occur per batch. Results on the \emph{HetRec} dataset indicate similar trends, though to a more extreme degree. With \emph{HetRec}, we use a minimum frequency threshold of 9,000 for {GraMi} and keep the previous settings for {GraphZip}: setting the threshold to 1,000 causes GraMi's stream-rate to slow to a relative crawl, and when using 10,000, {GraMi} is able to process the entire dataset but only returns two frequent subgraphs. While processing \emph{HetRec} with the threshold set to 9,000, {GraMi} maintains a high stream-rate which trends upwards over time until the 93rd iteration, where the system freezes and is unable to make any progress despite being left running for multiple days (as indicated by the red `X' on figures \ref{fig:graphzip_streamfsm_sr_hetrec_l} and \ref{fig:graphzip_streamfsm_rt_hetrec_nl}). \subsection{Comparison with {StreamFSM}} Since there are no algorithms for mining highly-compressing subgraphs from graph streams in the existing literature, we benchmark {GraphZip} against {StreamFSM}, a recently developed streaming algorithm for frequent subgraph mining. Subgraphs that compress well are often both frequent and large, so the tasks of mining highly-compressing and frequently-occurring subgraphs are closely related. The {StreamFSM} reference implementation available online was unable to find any frequently occurring subgraphs with any large datasets other than the provided \emph{HetRec} dataset (we hypothesize this is likely due to an implementation error), so we report results for {StreamFSM} on the HetRec dataset only. A reasonable amount of time in the streaming setting equates to processing time less than or equal (at the very most) to the streaming-rate of the data; if the system cannot process the stream at the speed it is being generated, then the system is much less applicable in the real-life setting. Our results indicate that {GraphZip} is significantly more scalable than {StreamFSM}: while {StreamFSM}'s stream-rate experiences an initial speedup, it quickly and consistently deteriorates after iteration 25, drastically increasing the runtime per iteration. The severe increase in runtime occurs around the same iteration that {GraMi} freezes (see figure \ref{fig:graphzip_streamfsm_rt_hetrec_nl}). In contrast, {GraphZip} is seemingly unaffected by the same updates that cause massive slowdowns in {GraMi} and {StreamFSM}. {GraphZip}'s stream-rate becomes relatively constant after an initial slowdown, and remains constant through to the end of the experiment (see figure \ref{fig:graphzip_streamfsm_sr_hetrec_l}). In the case of {GraphZip} and {StreamFSM}, the stream-rate of both systems is much faster than the average stream-rate of the data ($7.8 \times 10^{-5}$ edges per second), despite {StreamFSM}'s relative volatility. However, a constant stream-rate is crucial for a deployed system processing a graph in real-time, since constraints on data processing time require predictable performance. \begin{figure}[t] \centering \begin{subfigure}{\columnwidth} \includegraphics[width=\columnwidth]{figs-higgs_v_time.pdf} \caption{Tracking Tweets per hour about the Higgs boson over time.}\label{fig:growth_higgs} \end{subfigure} \begin{subfigure}{\columnwidth} \vspace{2mm} \includegraphics[width=\columnwidth]{figs-higgs_v_time_and_sr.pdf} \caption{Stream-rate of {GraphZip} on the \emph{Higgs} dataset (higher is better).}\label{fig:sr_higgs} \end{subfigure} \vspace{-1mm} \caption[]{(a) A large spike in activity occurs in the network after about 80 hours after the first Tweet. (b) After an initial slowdown, {GraphZip} converges to a constant stream-rate.} \end{figure} \section{Twitter \& the Higgs boson particle} One weakness of the datasets analyzed in the previous sections is the low granularity of their timestamps, e.g., \emph{HetRec} can only be split into real-time streaming units as small as year, and the synthetic datasets have no time information at all. Streaming intervals (and therefore time between results) as long as a year are unlikely in a real deployment setting, especially when disk space is taken into consideration (storing a year's worth of data before processing largely negates the benefit of streaming). For example, given a graph mining system configured to mine activity from a live network such as Twitter, it is likely that the user(s) would configure the interval to analyze patterns and trends over days, hours or even seconds. Additionally, reducing the time period between batches can reveal ebbs and flows in network activity that would be hidden by averaging out activity over a longer period. The \emph{Higgs}'s dataset has time data in seconds for each interaction, so we are able to pre-process the dataset into graph files segmented by the hour. One benefit to using the \emph{Higgs} dataset is to observe how large spikes in network traffic affect the stream-rate; the minimum, maximum, and average number of edges streamed per hour are 43, 45,861, and 3,352 respectively, with the peak number of tweets per hour coinciding with the official announcement of the discovery As we can see in figure \ref{fig:sr_higgs}, {GraphZip}'s stream-rate is unaffected by the large spike in network traffic (using the same model parameters as the previous experiments). After an initial slowdown (similar to \emph{HetRec}), {GraphZip}'s stream-rate converges on a constant stream-rate slightly faster than the maximum stream-rate the network reaches at the 80 hour mark, and much faster than the average stream-rate of the network ($9.3 \times 10^{-1}$ tweets per second). Our results indicate that if {GraphZip} had been deployed to monitor the graph stream in real-time, it would have been able to process each set of updates before the next set of updates arrived. \section{Conclusion and Future Work} In this paper, we introduced {GraphZip}, a graph mining algorithm that utilizes a dictionary-based compression approach to mine highly-compressing subgraphs from a graph stream. We showed that {GraphZip} is able to successfully mine artificially-generated graphs for maximally-compressing patterns with comparable accuracy and much greater speed than a state-of-the-art approach. Additionally, we also demonstrated that {GraphZip} is able to surface both complex and insightful patterns from large real-world graphs at speeds much faster than the actual stream-rate, with performance exceeding that of openly available state-of-the-art non-streaming and streaming methods. Future work will focus on implementing the potential optimizations to the algorithm discussed in this paper, including approximation algorithms for (subgraph) isomorphism computations and na\"{\i}ve parallelization. \section{Introduction} Graphs are used to represent data across a wide spectrum of areas, from computational chemistry to social network analysis. Graph mining is an active area of research, and there are numerous methods for mining smaller graphs (several thousand edges), but many of these systems are unable to scale to real-world graphs (e.g., social networks) with millions or even billions of edges. Conventional graph mining algorithms assume a complete static graph as input, however many real-world graphs are often too large to hold in main memory. Additionally, many real-world graphs of interest are dynamic and actively growing - Facebook, for example, records over 300 new users per minute and has a social graph with more than 400 billion edges \cite{ChingFB}. While it is possible to utilize conventional graph mining systems on dynamic graphs by processing static `snapshots' of the graph at various points in time, in many cases the underlying data the graph represents changes at a rate so fast that attempting to analyze the data using such methods is futile. In cases where the graph in question is inherently dynamic, we can instead treat the graph as a sequential stream of edges representing continuous updates to the graph's overall structure. For example, given a graph modeling friendships (edges) between users (nodes) in a social network, we can consider all new or updated relationships during a set time interval (e.g., 1 hour) a set of edges from time $t_i$ to $t_{i+1}$. The graph mining system then processes the sequential edge sets at every interval, as opposed to attempting to read the entire graph at once. Processing large graphs in a streaming fashion drastically reduces the system's memory requirements (since only small portions of the graph are seen at a time) and enables processing of large, dynamic real-world datasets. However, deploying a streaming model for real-time data analysis also imposes strict constraints: the system has a limited time window to process each set of edges, and edges can only be viewed once before they are replaced in memory by those in the next set. Many graph mining algorithms aim to identify interesting patterns within an input graph. Various algorithms use different metrics to quantify how `interesting' a pattern is: frequent subgraph mining (FSM) focuses on finding all subgraphs that appear in the graph over a certain frequency threshold, whereas problems such as counting motifs or finding maximal cliques in a graph (formalized in \cite{przulj-motifs} and \cite{bron-kerbosch-cliques}, respectively) focus on discovering subgraphs with a specific structure. This paper relies on a novel approach to identify interesting patterns in a graph - namely, finding a set of substructures that best compress the graph. More precisely, we compress a graph using a pattern (subgraph) $G$ by replacing all instances of $G$ in the graph with a new node $p$ representing $G$ (see figure \ref{fig:compress}). The reduction in size of the overall graph is a measure of the compression afforded by pattern $G$, and we search for patterns that compress the graph to the maximal extent. The same concept is found in certain types of data compression (e.g., LZ78 \cite{lz78}, ZIP) where the compression method looks for recurring patterns or sequences in the data stream, builds a dictionary representing the recurring patterns with shorter binary codes, and then stores the compressed data using only the binary codes and the dictionary. In the context of graphs, a byproduct of this process is that the pattern dictionary contains a set of subgraphs that compress well, and therefore represents an alternative approach for finding interesting (highly-compressing) patterns in a graph stream. We propose a dictionary-based compression method for graph- based knowledge discovery: {GraphZip}. Our approach is designed to efficiently mine graph streams and uncover interesting patterns by finding maximally-compressing substructures. Specifically, our main contributions are as follows: \begin{enumerate} \item We propose a new graph mining paradigm based on the LZ class of compression algorithms. \item Based on this paradigm, we introduce a new graph mining algorithm, {GraphZip}, for efficiently processing massive amounts of data from graph streams. \item We demonstrate the effectiveness and scalability of our method using a variety of openly available synthetic and real-world datasets. \end{enumerate} In our experiments, we demonstrate that our approach is able to retrieve both complex and insightful patterns from large real-world graphs by utilizing graph streams. In addition, we show that our approach is able to successfully mine a large class of varied substructures from artificially-generated graphs with ground truth patterns. When we compare {GraphZip}'s performance with that of several other state-of-the-art graph mining methods, we find that {GraphZip} consistently outperforms state-of-the-art methods on a variety of real-world datasets. The {GraphZip} system, including all related code and data used for this paper, are available for download online\footnote{\url{https://github.com/cpacker/graphzip}}. {GraphZip} is not to be confused with the method described in \cite{graphzip2} for hierarchical clustering on spatial data, which goes by the same name. \endgroup \begin{figure} \includegraphics[width=3.2in]{figs-compression_by_sub_500dpi.png} \caption{Compression via substitution. Vertices $A$, $B$, and $C$ form a recurring pattern (subgraph) $G$. Substituting the pattern for a single node $P$ representing $G$ reduces the graph's overall size. The reduction in size is a measure of the compression afforded by pattern $P$. }\label{fig:compress} \end{figure} \section{Related Work} For the purposes of this paper, we classify previous work into two general categories: streaming and non-streaming. \subsection{Non-streaming} Non-streaming graph mining algorithms take as input either a single graph (single graph mining), or multiple smaller graphs (transactional mining). \textbf{Transactional mining.} {FSG} \cite{fsg} is an early approach to finding frequent subgraphs across a set of graphs, and adopts the Apriori algorithm for frequent itemset mining \cite{apriori}. {FSG} works by joining two frequent subgraphs to construct candidate subgraphs, then checking the frequency of the new candidates in the graph. {gSpan} \cite{gspan} uses a `grow-and-store' approach that extends saved subgraphs to form new ones, an improvement over {FSG}'s prohibitively expensive join operation. {Margin} \cite{margin} prunes the search space to find maximal subgraphs only, a narrower and thus easier problem than FSM. {CloseGraph} \cite{closegraph} is another method that reduces the problem space by mining only \emph{closed} frequent subgraphs - subgraphs that have strictly smaller support than any existing supergraphs. {Leap} \cite{leap} and {GraphSig} \cite{graphsig} are two recent approaches for mining `significant subgraphs' as measured by a probabilistic objective function. By mining a small set of statistically significant subgraphs as opposed to a complete set of frequent subgraphs, {Leap} and {GraphSig} are able to avoid the problem of exponential search spaces generated by FSM miners with low frequency thresholds. \textbf{Single graph mining.} {SUBDUE} \cite{subdue} is an approximate algorithm based on the branch-and-bound search technique. {SUBDUE}, like {GraphZip}, uses the Minimum Description Length (MDL) principle \cite{mdl} to mine maximally-compressing patterns in the graph. However, unlike {GraphZip}, {SUBDUE} returns a restrictively small number of patterns regardless of the size of the input graph \cite{grew}. {SUBDUE} has been improved in recent years \cite{subdue2-subgen,subdue3,subdue4}, yet the fundamental limitations of the algorithm (in particular the branch-and-bound technique) remain the same. {SEuS} \cite{seus} is an approximate method that creates a compressed representation of the graph by collapsing vertices that share labels. {SEuS} however is only effective in cases where the input graph has a small number of unique subgraphs that occur with high frequency, as opposed to when the input graph has a large number of subgraphs that appear with lower frequency. {SiGram} \cite{sigram} is a complete method for finding frequent connected subgraphs (complete methods are guaranteed to find all solutions that fit certain constraints such as the minimum frequency threshold, unlike their approximate counterparts). {SiGram} adopts a grow-and-store approach similar to {gSpan}, but uses the expensive (NP-complete) Maximal Independent Set (MIS) metric for its frequency threshold, leading the system to be comparatively inefficient in practice. Additionally, like {SEuS}, {SiGram} suffers from a limited domain problem as it is designed specifically to mine sparse, undirected and labeled graphs only. {Grew} \cite{grew} is another approximate method for mining frequent connected subgraphs, and is similar to {SUBDUE} in that {Grew} only discovers a relatively small subset of solutions in the search space. {GraMi} \cite{grami} is a state-of-the-art complete method (with an approximate version {AGraMi}) that has been shown to be highly-efficient for FSM on a single large graph. However, the size of the input graph is still limited since {GraMi} requires the entire graph to be held in main memory. {Arabesque} \cite{arabesque} is a recent distributed approach built on top of {Apache Giraph} \cite{giraph} that can horizontally scale non-streaming algorithms (FSM, clique finding, motif counting, etc.) across multiple servers. However, horizontal scaling can be cost-prohibitive and is only capable of linearly scaling algorithms whose runtimes often grow exponentially with the size of the input graph. {GERM} \cite{germ} and the algorithm introduced by Wackersreuther et al. \cite{wackersreuther} can mine frequent subgraphs in dynamic graphs, however both methods require as input snapshots of the entire graph as opposed to incremental updates to the graph via graph streams. \subsection{Streaming} {GraphScope} \cite{graphscope} is a parameter-free streaming method that, like {GraphZip} and {SUBDUE}, is based on the MDL principle. {GraphScope} encodes the graph stream with the objective of minimizing compression cost, in order to determine important change-points in the temporal data. Beyond change-point and community detection however, {GraphScope} has limited use for other tasks, e.g. mining interesting subgraphs. Though the model itself is parameter-free, {GraphScope} requires the dimensions of the graph (number of source and destination nodes) to be known \emph{a priori}, and thus is unable to mine streams from dynamic graphs that introduce unseen nodes in new edge streams. Braun et al. \cite{braun2014} proposed a novel data structure called DSMatrix for mining frequent patterns in dense graph streams, yet similar to {GraphScope} their approach requires that the edges and nodes be known beforehand, limiting its real-world applications. Aggarwal et al. \cite{aggarwalvldb2010} introduced a probabilistic model for mining dense structural patterns in graph streams, however the approximation techniques used lead to the occurrence of both false positives and false negatives in the results set, reducing the method's viability in many real-world settings. {StreamFSM} \cite{streamfsm}, based on {gSpan}, is a recently introduced method for frequent subgraph mining on graph streams, whose performance we compare directly with that of {GraphZip} (see section \S 4). There also exist several systems targeted at more specific graph analysis tasks in the streaming setting: counting triangles \cite{doulion}, outlier \cite{aggarwalicde2011} and hotspot \cite{aggarwalicdm2013} detection, and link prediction \cite{zhaoicde2016}. Summarization methods such as {TCM} \cite{tcm}, {gSketch} \cite{gsketch} and {count-min sketch} \cite{countminsketch} focus on constructing sketch synopses from large graph streams that can provide approximate answers to queries about the graph's properties. For a detailed survey of state-of-the-art graph stream techniques, see \cite{streamsurvey} (for a more general overview of graph mining algorithms, see \cite{gmsurvey}). {GraphZip} can process an infinite stream of edges without requiring details about nodes or edges beforehand, and has no restrictions on the type of graph being streamed. While {GraphZip} is designed specifically for the streaming setting, it draws from ideas such as grow-and-store and the MDL principle originally applied in non-streaming methods. In contrast to summarization methods, {GraphZip} returns exact subgraphs extracted from the stream as opposed to approximate results. To the best of our knowledge, {GraphZip} is the first graph mining algorithm for mining maximally-compressing subgraphs from a graph stream. \begin{table} \caption{Symbol definitions. Note that $\alpha${} and $\theta${} are the hyperparameters of the {GraphZip} algorithm.} \label{table:1} \begin{tabular}{@{}ll@{}} \toprule Symbol & Definition\\ \midrule $G$ & Arbitrary graph\\ $V_G$ & Vertex set of graph G\\ $E_G$ & Edge set of graph G\\ $S$ & Graph stream sequence\\ $S^{(i)}$ & Graph at time $i$ of stream $S$\\ $B$ & A batch of edges from graph stream\\ $P$ & Pattern dictionary\\ $P^{(i)}$ & Pattern (graph) $i$ in dictionary $P$\\ $V_{P^{(i)}}$ & Vertex (node) set of pattern $P^{(i)}$\\ \addlinespace[0.2em] $E_{P^{(i)}}$ & Edge set of pattern $P^{(i)}$\\ \addlinespace[0.2em] $C_{P^{(i)}}$ & Compression score of pattern $P^{(i)}$\\ \addlinespace[0.2em] $F_{P^{(i)}}$ & Frequency (count) of pattern $P^{(i)}$\\ $\alpha$ & Batch size\\ $\theta$ & Size threshold of $P$\\ $H(G)$ & Compression scoring function\\ $I(G, G)$ & Graph isomorphism function\\ $SI(G, G)$ & Subgraph isomorphism function\\ \bottomrule \end{tabular} \end{table} \section{Method} \subsection{Preliminaries} In this section, we review the fundamental graph theory needed to formulate our approach and formalize the definitions used in the rest of the paper. See table \ref{table:1} for symbol definitions. \textbf{Terminology.} A graph $G$ is composed of a vertex set $V$ which contains all vertices (nodes) $v \in V$, and an edge set $E$ which contains all edges $e \in E$, each of which connects a source vertex to a target vertex. A subgraph $g$ of $G$ is a graph composed of a subset of $G$'s vertices and edges. All vertices $v \in V$ and edges $e \in E$ have a unique \emph{index} which refers to its internal location in the edge or vertex list (e.g., $v_1$ in $V = \{v_1, v_2, v_3\}$ has index $0$, $v_2$ has index 1, etc.). In a vertex-labeled graph, there exists a one-to-one (i.e., unique) mapping from each vertex to a \emph{label}, and in an edge-labeled graph the same mapping exists for the edge set. The value of labels within a graph is often domain-dependent: e.g., in a social network, vertex labels may correspond to a user type (e.g. `male', `female') while edge labels may correspond to different relationship types (e.g. `friend', `family', etc.). \begin{definition} \emph{Isomorphism}: Two graphs $G_1$ and $G_2$ are isomorphic (denoted by $G_1 \simeq G_2$) if there is a one-to-one mapping between the edges and vertices of $G_1$ and $G_2$. That is, each vertex $v$ in $G_1$ is mapped to a unique vertex $u$ in $G_2$, the two of which must share the same edges, i.e., be adjacent to the same vertices (if the graph is labeled, the vertices and edges must also share the same labels). $G_1 \simeq G_2$ is equivalent to $G_1$ and $G_2$ sharing the same structure. \end{definition} \begin{definition} \emph{Subgraph isomorphism}: Graph $G_1$ is considered a subgraph isomorphism of graph $G_2$ if it is an isomorphism of some subgraph $g_2$ of $G_2$. The actual instance of $g_2$ is called an \emph{embedding} of $G_1$ in $G_2$. The subgraph isomorphism problem is a generalization of the graph isomorphism problem, and is known to be NP-complete \cite{subiso-npcomplete} (unlike the graph isomorphism problem, the complexity of which is undetermined). Despite the problem's complexity, many graph mining algorithms make heavy use of subgraph isomorphism checks for graph matching, and accordingly several optimizations have been made in the past decade which have significantly improved the efficiency of isomorphism (or subgraph isomorphism) checks in practice. \end{definition} \begin{definition} \emph{Graph stream:} A graph stream $S$ can be represented as a chronological sequence of edges drawn from a graph. \begin{displaymath} S = \{ e_{(1)}, e_{(2)}, e_{(3)}, ... , e_{(n)} \} \end{displaymath} We can process the graph stream by segmenting the stream into distinct sets of edges, each set forming a single (possibly disconnected) graph stream object. In the case of a dynamic graph, updates to the graph can be viewed as new stream objects. In the rest of the paper we also refer to graph stream objects as \emph{batches}, where \emph{batch size} refers to the size of the stream object's edge set (i.e., the number of edges in the batch). \end{definition} \subsection{Problem Formulation} Given a graph stream and a compression scoring function $H$, our objective function equates to maximizing the cumulative compression score of the entire pattern dictionary $P$: \begin{equation} \label{e.problem} f(G,H) = \argmax_P \sum_i H(P^{(i)}) \end{equation} The direct approach to solving for $f$ would require enumerating over all possible subgraphs of $G$, a computationally intractable task in most real-world scenarios since it would require storing the entirety of the graph stream, in addition to computing subgraph isomorphism checks over the entire graph. Therefore, we employ a heuristic algorithm to approximate such a solution. \begin{algorithm}[t!] \caption{GraphZip} \label{alg:graphzip} \begin{algorithmic}[1] \STATE{Initialize $P$} \WHILE{edges remain in stream} \STATE\label{line3}{Construct graph $B$ using $\alpha${} edges} \FOR{\textbf{each} graph $p$ in $P$} \STATE{$E$ $\gets$ subgraph isomorphisms of $p$ in $B$} \FOR{\textbf{each} graph $g$ in $E$} \STATE{$g' \gets g.copy()$} \FOR{\textbf{each} $e$ in $E_g$} \IF{$e$ not in $p$} \STATE{Extend $g'$ by new edge $e$} \ELSE \STATE{Add internal edge $e$ to $g'$} \ENDIF \ENDFOR \STATE{Mark each extended edge $e \in B$ as used} \IF{$g' \neq g$} \STATE{Add $g'$ to $P$} \ENDIF \ENDFOR \ENDFOR \STATE{$R \gets$ remaining unused edges in $B$} \STATE{Add edges in $R$ as single-edge patterns to $P$} \ENDWHILE \RETURN $P$ \end{algorithmic} \end{algorithm} \subsection{The {GraphZip} Algorithm} {GraphZip} is a highly-scalable method for discovering interesting patterns in a massive graph. Inspired by dictionary-based file compression, {GraphZip} builds a dictionary of highly-compressing patterns by counting previously seen patterns in the graph stream and saving new patterns that extend from old ones. The resulting dictionary contains highly-compressing patterns from the given graph stream, which can be used directly or fed into a separate non-streaming algorithm (e.g., a maximal-clique finder). While {GraphZip} is designed specifically with graph streams in mind, the algorithm can be easily applied to smaller static graphs without modification: if {GraphZip} is given as input a single graph it will automatically partition it into batches of size $\alpha${} and process the graph as a stream. If the total number of edges in the graph (or number of edges remaining after $n$ iterations) is less than $\alpha${}, {GraphZip} will process the graph as a single batch. This flexibility between input types allows us to compare {GraphZip} directly with non-streaming methods. \begin{figure}[t] \includegraphics[width=\columnwidth]{figs-graphzip_algorithm.pdf} \caption{A simplified illustration of the {GraphZip} algorithm. In dictionary $P$, blue indicates a new pattern, orange indicates a matched pattern extending to a new pattern, and green indicates a non-repeated pattern. After processing $S^{(1)}$, $P$ contains only single edge patterns. $A$-$B$, $C$-$A$, and $D$-$C$ are embedded in $S^{(2)}$, so they are extended as new patterns in $P$. $C$-$A$-$B$ is embedded in $S^{(3)}$, and is extended with an internal edge as a new pattern, along with the remaining edge $D$-$B$.} \label{fig:algorithm} \end{figure} The general procedure of {GraphZip} is illustrated in figure 2. {GraphZip} is initialized with an empty dictionary $P$ with max size $\theta${} (provided by the user), which maps graphs to their frequency (count) and compression score. {GraphZip} collects arriving edges from the graph stream into batches of size $\alpha${} (also provided by the user), and runs the $compress$ procedure on each batch $B$: if a pattern $p$ from the dictionary is embedded in $B$, {GraphZip} increments the frequency of the pattern in the dictionary and recomputes its compression score. Additionally, for each instance $i$ of pattern $p$ embedded in batch $B$, {GraphZip} extends $p$ by one edge length, tagging each of the edges from $B$ used to extend $p$. The new edges used to extend $p$ are the edges incident on $i$ that exist in batch $B$ but not in pattern $p$. {GraphZip} then adds the new extended pattern to $P$. After $P$ has been updated with all the extended patterns, the remaining untagged edges in $B$ are added as single-edge patterns to $P$. Our current reference implementation supports both undirected and directed edges, but not hyper-edges or self-loops. However, these limitations are implementation specific rather than inherent to the algorithm. Additionally, both representational variants can be converted to simple edges (a node and two edges). If the dictionary exceeds size 2$\theta${}, the dictionary is sorted according to the compression scores and trimmed to $\theta${}. A pattern's compression score is computed as follows: \begin{equation} \label{e.scorefunction} H(P^{(i)}) = (|E_{P^{(i)}}| - 1) \times (F_{P^{(i)}} - 1) \end{equation} This equates a pattern's compressibility to a product of its size and frequency. We use $(F_{P^{(i)}} - 1)$ so that a pattern with a frequency of $1$ has a compression score of $0$, since a pattern that only appears once affords no real compression to the overall graph. The same offset is applied to the pattern size in $(|E_{P^{(i)}}| - 1)$ to reduce the weighting of single-edge patterns. Due to the fact that overlapping instances of a pattern in a batch are counted independently, it is possible that {GraphZip} will overestimate the compression value of large structures with many homomorphisms. Note that the compression method used is intrinsically lossy, since {GraphZip} does not retain information on how each of the instances are connected to the rest of the graph. The main focus of our work is knowledge discovery in graph streams, so lossy compression is an appropriate trade-off for decreased complexity and increased performance. More work is necessary to make {GraphZip} lossless, for example in the case where it is necessary to fully reconstruct the original graph from the pattern dictionary. See algorithm \ref{alg:graphzip} for pseudo-code, and the online repository for a reference implementation. \subsection{Scalability} Speed and memory usage are critical properties of graph mining algorithms designed to mine large real-world graphs. A deployed graph mining system should be able to keep up with the flow of data in the dynamic graph setting, while summarizing a possibly infinite graph stream in memory. Memory usage in {GraphZip} is directly bounded by the maximum dictionary size ($\theta${}), and is indirectly bounded by the batch size ($\alpha${}), since the patterns within the dictionary cannot grow larger than the batch size (no subgraph isomorphisms of the pattern in the batch will exist). Both parameters $\theta${} and $\alpha${} can be modified to maximize performance given certain hardware limitations. The bulk of the computation in the {GraphZip} algorithm happens while checking for embeddings of pattern $p$ in batch $B$ (\emph{find all subgraph isomorphisms of $p$ in $B$}). Note that because each entry in the pattern dictionary is unique, none of the subgraph isomorphism checks are contingent on each other, and thus the loop can be na\"{\i}vely parallelized across an arbitrary number of cores. This allows for large performance gains and means that an increase in dictionary size can be scaled linearly with an increase in cores. Even without parallelization of the subgraph isomorphism checks, {GraphZip} is still faster than other state-of-the-art graph mining systems (as described in section \S 4). See section \S A for a formal runtime analysis. \section{Experimental Evaluation} There are two main questions we focus on when evaluating our algorithm: does it generate objectively and subjectively good results (i.e. correct and interesting results, respectively), and does it generate them in a reasonable amount of time? To answer these questions we test {GraphZip} on an extensive suite of synthetic and real datasets ranging from a few thousand to several million nodes and edges (see table \ref{tab:datasets}). Using these datasets, we benchmark {GraphZip} against three state-of-the-art, openly available graph mining systems: {SUBDUE}\footnote{\url{http://ailab.wsu.edu/subdue}}, {GraMi}\footnote{\url{https://github.com/ehab-abdelhamid/GraMi}}, and {StreamFSM}\footnote{\url{https://github.com/rayabhik83/StreamFSM}}. Because there is no directly comparable method to {GraphZip} for mining maximally-compressing patterns in graph streams, we instead evaluate {GraphZip} against a non-streaming method for mining compressing patterns ({SUBDUE}), a non-streaming method for frequent subgraph mining ({GraMi}), and a streaming method for frequent subgraph mining ({StreamFSM}). Highly-compressing patterns are often both large and frequent, so FSM methods serve as an appropriate comparison to {GraphZip}. All experiments were run on a compute server configured with an AMD Opteron 6348 processor (2.8 GHz) and 128GB of RAM. \begin{figure}[t!] \includegraphics[width=\columnwidth]{figs-graph_classes.pdf} \caption{We embed different types of graph substructures into our synthetic graphs, and then test to see if they are recovered. Corresponding datasets (from left to right): 3-CLIQ, 4-CLIQ, 4-STAR, 4-PATH, 8-TREE.}\label{fig:groups} \end{figure} \subsection{Synthetic graphs} To test whether our algorithm outputs \emph{correct} substructures, we utilize a tool called {SUBGEN} \cite{subdue2-subgen} to embed ground truth patterns with desired frequencies into an artificially generated graph. This allows us to test whether or not a graph mining system correctly surfaces known patterns we expect to be returned in the result set. Since both {GraphZip} and {SUBDUE} are designed to mine highly-compressing patterns from a graph, we embed large and frequent (i.e., highly-compressing) patterns in the graph, then record the number of ground truth patterns recovered. Given a set of embedded patterns $E$, and a set of patterns $R$ returned by our graph mining system, an embedded pattern $E^{(i)} \in E$ is considered \emph{matched} if for some returned pattern $R^{(i)} \in R$, $R^{(i)} \simeq E^{(i)}$. Thus, we calculate the fraction $a$ of embedded patterns recovered using the scoring metric \begin{equation} \label{e4.1} a = |\{E^{(i)} | E^{(i)} \in E \wedge R^{(i)} \in R \wedge E^{(i)} \simeq R^{(i)}\}|\ /\ |E| \end{equation} Which is equivalent to \begin{equation} \label{e4.2} \textit{\small accuracy} = {\textit{\small matched patterns } } / { \textit{ \small total patterns}} \end{equation} We count a ground truth pattern as \emph{matched} if it is found in {GraphZip}'s pattern dictionary after the final batch, or in {SUBDUE}'s case, if it is returned directly at the end of the program. In addition to making the ground truth patterns highly-compressing, we also design the patterns to cover a wide class of fundamental graph patterns, including cliques, paths, stars and trees (see figure \ref{fig:groups}). This allows us to discern if a method has difficulty mining a certain type of structure (e.g., a poorly designed system may have trouble detecting cycles and therefore cliques). The naming scheme for each synthetic graph dataset is \emph{N-TYPE}, where $N$ is the number of vertices in the embedded pattern and \emph{TYPE} is a shorthand of the pattern type (e.g., 3-CLIQ is a graph with embedded 3-cliques). All synthetic graphs in table \ref{table:graphzip-subdue-synthetic} are generated with 1000 nodes, 5000 edges, and 20\%, 50\% or 80\% coverage (the percentage of the graph covered by instances of the pattern). \begin{table}[t] \caption{{GraphZip} and {SUBDUE} runtime and accuracy on various synthetic graphs. For runtime, lower is better. For {SUBDUE}, the `{+}' for runtime indicates the program was terminated after 1000 seconds (no accuracy shown).} \label{table:graphzip-subdue-synthetic} \begin{tabular}{@{}lccc@{}c@{}cc@{}} \toprule \multirow{2}{*}{Dataset} & \multirow{2}{*}{Cov.} & \multicolumn{2}{c}{Runtime (sec.)} & \phantom{a} & \multicolumn{2}{c}{Accuracy (\%)} \\ \cmidrule(lr{0em}){3-4} \cmidrule{6-7} & (\%) & {\small {GraphZip}} & {\small {SUBDUE}} & \phantom{abc} & {\small {GraphZip}} & {\small {SUBDUE}} \\ \midrule \addlinespace[0.5em] \multirow{3}{*}{3-CLIQ} & 20 & \textbf{52.25} & 66.68 & & \textbf{100.0} & 89.24 \\ \addlinespace[-0.2em] & 50 & \textbf{3.779} & 22.22 & & \textbf{100.0} & 89.61 \\ \addlinespace[-0.2em] & 80 & \textbf{3.665} & 11.99 & & \textbf{100.0} & 86.61 \\ \addlinespace[0.3em] \multirow{3}{*}{4-PATH} & 20 & \textbf{45.37} & 58.00 & & \textbf{100.0} & 100.0 \\ \addlinespace[-0.2em] & 50 & \textbf{3.052} & 18.57 & & \textbf{100.0} & 100.0 \\ \addlinespace[-0.2em] & 80 & \textbf{2.935} & 10.30 & & \textbf{100.0} & 100.0 \\ \addlinespace[0.3em] \multirow{3}{*}{4-STAR} & 20 & \textbf{50.70} & 1000{+} & & \textbf{100.0} & - \\ \addlinespace[-0.2em] & 50 & \textbf{4.184} & 1000{+} & & \textbf{100.0} & - \\ \addlinespace[-0.2em] & 80 & \textbf{4.483} & 1000{+} & & \textbf{100.0} & - \\ \addlinespace[0.3em] \multirow{3}{*}{4-CLIQ} & 20 & \textbf{68.06} & 1000{+} & & \textbf{100.0} & - \\ \addlinespace[-0.2em] & 50 & \textbf{29.19} & 1000{+} & & \textbf{100.0} & - \\ \addlinespace[-0.2em] & 80 & \textbf{13.92} & 44.78 & & \textbf{100.0} & 89.51 \\ \addlinespace[0.3em] \multirow{3}{*}{5-PATH} & 20 & \textbf{48.47} & 1000{+} & & \textbf{100.0} & - \\ \addlinespace[-0.2em] & 50 & \textbf{4.461} & 21.30 & & \textbf{100.0} & 99.81 \\ \addlinespace[-0.2em] & 80 & \textbf{4.267} & 24.16 & & \textbf{100.0} & 99.42 \\ \addlinespace[0.3em] \multirow{3}{*}{8-TREE} & 20 & \textbf{62.68} & 1000{+} & & \textbf{100.0} & - \\ \addlinespace[-0.2em] & 50 & \textbf{10.39} & 1000{+} & & \textbf{99.65} & - \\ \addlinespace[-0.2em] & 80 & \textbf{11.07} & 1000{+} & & \textbf{100.0} & - \\ \addlinespace[0.1em] \bottomrule \end{tabular} \end{table} \subsection{Comparison with {SUBDUE}} Table \ref{table:graphzip-subdue-synthetic} shows the runtime and accuracy (eq. \ref{e4.1}) for {GraphZip} and {SUBDUE} on the synthetic datasets. {GraphZip} is clearly faster than {SUBDUE}, taking an order of magnitude less runtime in most experiments. Decreasing the coverage across all pattern types increased the runtime for both systems. {SUBDUE} is unable to process half of the datasets (including all 4-STAR and 8-TREE experiments) in less than 1000 seconds, while {GraphZip} is able to process the same datasets in a fraction of the time with 99-100\% accuracy in all cases. Among the datasets {SUBDUE} is able to process, the greatest difference in accuracy lies in the clique datasets (3-CLIQ and 4-CLIQ), where {SUBDUE} misses approximately 10\% of the embedded patterns. The {GraphZip} algorithm contains an explicit edge case to extend internal edges in a pattern with no new vertices, which enables {GraphZip} to capture cliques with high accuracy (see algorithm \ref{alg:graphzip} and figure \ref{fig:algorithm}). Our results indicate a stark difference in efficiency between {GraphZip} and {SUBDUE}: {SUBDUE} is significantly slower than {GraphZip} even on relatively small graphs with several thousand edges, and for graphs with certain classes of embedded patterns in them (stars and binary trees are particularly problematic). For this reason, when evaluating {GraphZip} with larger real-world graphs we focus on benchmarking against more scalable methods. \subsection{Real-world graphs} We use several large, real-world graph datasets to test the scalability of the {GraphZip} algorithm. See table \ref{tab:datasets} for further details. \\ \emph{NBER}\footnote{\url{http://www.nber.org/patents}}: NBER \cite{nber} is a graph of all U.S. patents granted (from Jan. 1963 to Dec. 1999) and the citations between them. The graph contains nearly 4 million nodes (patents) and over 16 million edges. Each node (citing patent) has edges to all the patents in its citation section. We added time-stamps to the citation graph prepared by \cite{snap-nber} and removed all withdrawn patents which had missing metadata ($<$ 0.04\% of all edges).\\ \emph{HetRec}\footnote{\url{http://grouplens.org/datasets/hetrec-2011}}: The HetRec 2011 MovieLens 2k \cite{hetrec} dataset links movies of the MovieLens 10M\footnote{\url{http://www.grouplens.org}} dataset with information from their IMDb\footnote{\url{http://www.imdb.com}} and Rotten Tomatoes\footnote{\url{http://www.rottentomatoes.com}} pages. We use a version of the dataset arranged by \cite{streamfsm}, in which nodes are labeled as `movie', `actor' or `director'. Edges connect movies to actors and directors: an edge from movie to director is labeled `directed-by', and an edge from movie to actor is labeled `acted-by'. The data spans 98 years, and is split into one graph stream (batch) file per year. \\ \emph{Higgs}\footnote{\url{https://snap.stanford.edu/data/higgs-twitter.html}}: The \emph{Higgs Twitter Dataset} \cite{higgs} is a collection of 563,069 interactions (retweets, mentions, and replies) between 304,691 users on Twitter before, during, and after the announcement of the discovery of Higgs boson particle on July 4th, 2012. The Tweets were scraped over the course of one week (168 hours) by filtering tweets for the tags `lhc', `cern', `boson' and `higgs'. Edges are labeled using the type of the interaction between the two users (`retweet', `mention', and `reply'), while all nodes share the same `user' label. \begin{table}[t] \caption{Details of real-world datasets used. The average stream-rate (in edges per second) is calculated by dividing the total number of edges by the time span of the entire graph. } \label{tab:datasets} \begin{tabular}{@{}lrrrr@{}} \toprule Dataset & Vertices & Edges & Labels & Stream-rate \\ \midrule NBER & 3,774,218 & 16,512,783 & 418 & $1.4 \times 10^{-2}$ \\ Higgs & 304,691 & 563,069 & 4 & $9.3 \times 10^{-1}$ \\ HetRec & 108,451 & 241,897 & 5 & $7.8 \times 10^{-5}$ \\ \bottomrule \end{tabular} \end{table} \begin{figure*}[t] \begin{minipage}[t]{0.48\linewidth} \begin{figure}[H] \centering \begin{subfigure}[H]{0.47\linewidth} \includegraphics[width=\linewidth]{figs-nber_sr_lscale.pdf} \caption{ } \label{fig:graphzip_grami_sr_nber} \end{subfigure}\qquad \begin{subfigure}[H]{0.44\linewidth} \includegraphics[width=\linewidth]{figs-nber_runtime.pdf} \caption{ } \label{fig:graphzip_grami_rt_nber} \end{subfigure} \vspace{-3mm} \caption[Two numerical solutions]{Stream-rate (a) and runtime (b) of {GraphZip} and {GraMi} on the \textit{NBER} dataset. {GraMi}'s stream-rate decrease significantly near the end, while {GraphZip}'s stream-rate remains relatively constant.} \label{fig:graphzip_grami_nber} \end{figure} \end{minipage}% \hfill% \begin{minipage}[t]{0.48\linewidth} \begin{figure}[H] \centering \begin{subfigure}[H]{0.47\linewidth} \includegraphics[width=\linewidth]{figs-hetrec_sr_lscale.pdf} \caption{ } \label{fig:graphzip_streamfsm_sr_hetrec_l} \end{subfigure}\qquad \begin{subfigure}[H]{0.44\linewidth} \includegraphics[width=\linewidth]{figs-hetrec_runtime.pdf} \caption{ } \label{fig:graphzip_streamfsm_rt_hetrec_nl} \end{subfigure} \vspace{-3mm} \caption[]{Stream-rate (a) and runtime (b) of {GraphZip}, {GraMi}, and {StreamFSM} on the \textit{HetRec} dataset. Both {GraMi} and {StreamFSM} experience a massive spike in runtime near iteration 93.} \label{fig:graphzip_streamfsm_hetrec} \end{figure} \end{minipage}% \vspace{-1.0mm} \end{figure*} \begin{figure} \vspace{2mm} \centering \begin{subfigure}[H]{0.45\linewidth} \includegraphics[width=\linewidth]{figs-nber_scatter.pdf} \caption{ } \label{fig:graphzip_nber_scat} \end{subfigure}\qquad \begin{subfigure}[H]{0.45\linewidth} \includegraphics[width=\linewidth]{figs-hetrec_scatter.pdf} \caption{ } \label{fig:graphzip_hetrec_scat} \end{subfigure} \vspace{-3mm} \caption[]{Distribution of {GraphZip}'s pattern dictionary after 300 iterations on \emph{NBER} (a) and after 98 iterations on \emph{HetRec} (b). The distribution for the larger \emph{NBER} dataset (a) is skewed towards patterns with high frequencies, while the distribution for patterns in \emph{HetRec} (b) is more varied.} \label{fig:graphzip_scats} \vspace{-1mm} \end{figure} \subsection{Comparison with {GraMi}} Despite being designed for mining highly-compressing patterns like {GraphZip}, {SUBDUE} has clear performance issues that restrict benchmarking it against {GraphZip} on large real-world graphs. Therefore we also compare {GraphZip} with {GraMi}, a state-of-the-art graph mining system for frequent subgraph mining on large static graphs. In contrast to {SUBDUE}, {GraMi} is efficient enough to process datasets with millions of edges, however {GraMi}'s relative performance still allows us to motivate the need for graph mining algorithms designed explicitly to handle streaming data. {GraMi} takes as input a single graph file as opposed to a sequence of edges, so in order to simulate mining a dynamic graph with a non-streaming method we append the previous graph with the next set of edges at each iteration, initializing the graph with the first set of edges. Thus, each iteration represents a `snapshot' of the growing graph. Since both methods are paramaterized, we first tune {GraMi}'s minimum frequency threshold so that it returns a usable number of non-single edge patterns, then set {GraphZip}'s parameters (batch and dictionary size) such that the pattern dictionary resembles the set of subgraphs returned by {GraMi}. On \emph{NBER} (figure \ref{fig:graphzip_grami_nber}), we fix {GraMi}'s minimum frequency threshold to 1000 which returned a set of subgraphs with a maximum, minimum, and average size of $6$, $1$, and $1.47$ respectively. Running {GraphZip} with $\alpha = 5$ and $\theta = 50$ resulted in a pattern dictionary with a maximum, minimum, and average subgraph size of $5$, $1$, and $2.89$ (figure \ref{fig:graphzip_scats} shows the dictionary distributions for both \emph{NBER} and \emph{HetRec}). Since the overall runtime of each model depends significantly on the configuration of the parameters, the main purpose of our comparison is to examine trends in the runtime and stream-rate of each model using settings where they return comparable sets of subgraphs. Our results show that {GraphZip} is clearly more scalable than {GraMi} when mining large graphs in the streaming setting. While processing \emph{NBER}, {GraMi}'s runtime (figure \ref{fig:graphzip_grami_rt_nber}) grows exponentially, experiencing a large spike near iteration 300. Figure \ref{fig:graphzip_grami_sr_nber} (normalized by patents per month) demonstrates this clearly: {GraphZip} maintains a constant stream-rate throughout, while {GraMi}'s stream-rate gradually slows until it sharply drops near the final updates. In fact, {GraphZip}'s stream-rate shows a slight increase over time; one explanation is that as the captured patterns in $P$ become more complex, less isomorphism checks occur per batch. Results on the \emph{HetRec} dataset indicate similar trends, though to a more extreme degree. With \emph{HetRec}, we use a minimum frequency threshold of 9,000 for {GraMi} and keep the previous settings for {GraphZip}: setting the threshold to 1,000 causes GraMi's stream-rate to slow to a relative crawl, and when using 10,000, {GraMi} is able to process the entire dataset but only returns two frequent subgraphs. While processing \emph{HetRec} with the threshold set to 9,000, {GraMi} maintains a high stream-rate which trends upwards over time until the 93rd iteration, where the system freezes and is unable to make any progress despite being left running for multiple days (as indicated by the red `X' on figures \ref{fig:graphzip_streamfsm_sr_hetrec_l} and \ref{fig:graphzip_streamfsm_rt_hetrec_nl}). \subsection{Comparison with {StreamFSM}} Since there are no algorithms for mining highly-compressing subgraphs from graph streams in the existing literature, we benchmark {GraphZip} against {StreamFSM}, a recently developed streaming algorithm for frequent subgraph mining. Subgraphs that compress well are often both frequent and large, so the tasks of mining highly-compressing and frequently-occurring subgraphs are closely related. The {StreamFSM} reference implementation available online was unable to find any frequently occurring subgraphs with any large datasets other than the provided \emph{HetRec} dataset (we hypothesize this is likely due to an implementation error), so we report results for {StreamFSM} on the HetRec dataset only. A reasonable amount of time in the streaming setting equates to processing time less than or equal (at the very most) to the streaming-rate of the data; if the system cannot process the stream at the speed it is being generated, then the system is much less applicable in the real-life setting. Our results indicate that {GraphZip} is significantly more scalable than {StreamFSM}: while {StreamFSM}'s stream-rate experiences an initial speedup, it quickly and consistently deteriorates after iteration 25, drastically increasing the runtime per iteration. The severe increase in runtime occurs around the same iteration that {GraMi} freezes (see figure \ref{fig:graphzip_streamfsm_rt_hetrec_nl}). In contrast, {GraphZip} is seemingly unaffected by the same updates that cause massive slowdowns in {GraMi} and {StreamFSM}. {GraphZip}'s stream-rate becomes relatively constant after an initial slowdown, and remains constant through to the end of the experiment (see figure \ref{fig:graphzip_streamfsm_sr_hetrec_l}). In the case of {GraphZip} and {StreamFSM}, the stream-rate of both systems is much faster than the average stream-rate of the data ($7.8 \times 10^{-5}$ edges per second), despite {StreamFSM}'s relative volatility. However, a constant stream-rate is crucial for a deployed system processing a graph in real-time, since constraints on data processing time require predictable performance. \begin{figure}[t] \centering \begin{subfigure}{\columnwidth} \includegraphics[width=\columnwidth]{figs-higgs_v_time.pdf} \caption{Tracking Tweets per hour about the Higgs boson over time.}\label{fig:growth_higgs} \end{subfigure} \begin{subfigure}{\columnwidth} \vspace{2mm} \includegraphics[width=\columnwidth]{figs-higgs_v_time_and_sr.pdf} \caption{Stream-rate of {GraphZip} on the \emph{Higgs} dataset (higher is better).}\label{fig:sr_higgs} \end{subfigure} \vspace{-1mm} \caption[]{(a) A large spike in activity occurs in the network after about 80 hours after the first Tweet. (b) After an initial slowdown, {GraphZip} converges to a constant stream-rate.} \end{figure} \section{Twitter \& the Higgs boson particle} One weakness of the datasets analyzed in the previous sections is the low granularity of their timestamps, e.g., \emph{HetRec} can only be split into real-time streaming units as small as year, and the synthetic datasets have no time information at all. Streaming intervals (and therefore time between results) as long as a year are unlikely in a real deployment setting, especially when disk space is taken into consideration (storing a year's worth of data before processing largely negates the benefit of streaming). For example, given a graph mining system configured to mine activity from a live network such as Twitter, it is likely that the user(s) would configure the interval to analyze patterns and trends over days, hours or even seconds. Additionally, reducing the time period between batches can reveal ebbs and flows in network activity that would be hidden by averaging out activity over a longer period. The \emph{Higgs}'s dataset has time data in seconds for each interaction, so we are able to pre-process the dataset into graph files segmented by the hour. One benefit to using the \emph{Higgs} dataset is to observe how large spikes in network traffic affect the stream-rate; the minimum, maximum, and average number of edges streamed per hour are 43, 45,861, and 3,352 respectively, with the peak number of tweets per hour coinciding with the official announcement of the discovery As we can see in figure \ref{fig:sr_higgs}, {GraphZip}'s stream-rate is unaffected by the large spike in network traffic (using the same model parameters as the previous experiments). After an initial slowdown (similar to \emph{HetRec}), {GraphZip}'s stream-rate converges on a constant stream-rate slightly faster than the maximum stream-rate the network reaches at the 80 hour mark, and much faster than the average stream-rate of the network ($9.3 \times 10^{-1}$ tweets per second). Our results indicate that if {GraphZip} had been deployed to monitor the graph stream in real-time, it would have been able to process each set of updates before the next set of updates arrived. \section{Conclusion and Future Work} In this paper, we introduced {GraphZip}, a graph mining algorithm that utilizes a dictionary-based compression approach to mine highly-compressing subgraphs from a graph stream. We showed that {GraphZip} is able to successfully mine artificially-generated graphs for maximally-compressing patterns with comparable accuracy and much greater speed than a state-of-the-art approach. Additionally, we also demonstrated that {GraphZip} is able to surface both complex and insightful patterns from large real-world graphs at speeds much faster than the actual stream-rate, with performance exceeding that of openly available state-of-the-art non-streaming and streaming methods. Future work will focus on implementing the potential optimizations to the algorithm discussed in this paper, including approximation algorithms for (subgraph) isomorphism computations and na\"{\i}ve parallelization.
{'timestamp': '2017-03-28T02:02:17', 'yymm': '1703', 'arxiv_id': '1703.08614', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08614'}
arxiv
\section{Introduction} \label{s:intro} The goal of blind deconvolution is the task of estimating two unknown functions from their convolution. While it is a highly ill-posed bilinear inverse problem, blind deconvolution is also an extremely important problem in signal processing~\cite{RR12}, communications engineering~\cite{WP98}, imaging processing~\cite{CE07}, audio processing~\cite{LXQZ09}, etc. In this paper, we deal with an even more difficult and more general variation of the blind deconvolution problem, in which we have to extract multiple convolved signals mixed together in one observation signal. This joint blind deconvolution-demixing problem arises in a range of applications such as acoustics~\cite{LXQZ09}, dictionary learning~\cite{bristow2013fast}, and wireless communications~\cite{WP98}. We briefly discuss one such application in more detail. Blind deconvolution/demixing problems are expected to play a vital role in the future Internet-of-Things. The Internet-of-Things will connect billions of wireless devices, which is far more than the current wireless systems can technically and economically accommodate. One of the many challenges in the design of the Internet-of-Things will be its ability to manage the massive number of sporadic traffic generating devices which are most of the time inactive, but regularly access the network for minor updates with no human interaction~\cite{WBSJ14}. This means among others that the overhead caused by the exchange of certain types of information between transmitter and receiver, such as channel estimation, assignment of data slots, etc, has to be avoided as much as possible~\cite{5Gbook,shafi20175g}. Focusing on the underlying mathematical challenges, we consider a {\em multi-user communication} scenario where many different users/devices communicate with a common base station, as illustrated in Figure~\ref{fig:demix}. Suppose we have $s$ users and each of them sends a signal $\boldsymbol{g}_i$ through an unknown channel (which differs from user to user) to a common base station,. We assume that the $i$-th channel, represented by its impulse response $\boldsymbol{f}_i$, does not change during the transmission of the signal $\boldsymbol{g}_i$. Therefore $\boldsymbol{f}_i$ acts as convolution operator, i.e., the signal transmitted by the $i$-th user arriving at the base station becomes $\boldsymbol{f}_i \ast \boldsymbol{g}_i$, where ``$\ast$" denotes convolution. \begin{figure}[h!] \centering \includegraphics[width=140mm]{Demixing.pdf} \caption{Single-antenna multi-user communication scenario without explicit channel estimation: Each of the $s$ users sends a signal $\boldsymbol{g}_i$ through an unknown channel $\boldsymbol{f}_i$ to a common base station. The base station measures the superposition of all those signals, namely, $\boldsymbol{y} = \sum_{i=1}^s \boldsymbol{f}_i\ast \boldsymbol{g}_i $ (plus noise). The goal is to extract all pairs of $\{(\boldsymbol{f}_i,\boldsymbol{g}_i)\}_{i=1}^s$ simultaneously from $\boldsymbol{y}$.} \label{fig:demix} \end{figure} The antenna at the base station, instead of receiving each individual component $\boldsymbol{f}_i\ast \boldsymbol{g}_i$, is only able to record the superposition of all those signals, namely, \begin{equation}\label{eq:model0} \boldsymbol{y} = \sum_{i=1}^s \boldsymbol{f}_i\ast \boldsymbol{g}_i +\boldsymbol{n}, \end{equation} where $\boldsymbol{n}$ represents noise. We aim to develop a fast algorithm to simultaneously extract all pairs $\{(\boldsymbol{f}_i,\boldsymbol{g}_i)\}_{i=1}^s$ from $\boldsymbol{y}$ (i.e., estimating the channel/impulse responses $\boldsymbol{f}_i$ and the signals $\boldsymbol{g}_i$ jointly) in a numerically efficient and robust way, while keeping the number of required measurements as small as possible. \subsection{State of the art and contributions of this paper} A thorough theoretical analysis concerning the solvability of demixing problems via convex optimization can be found in~\cite{mccoy2013demixing}. There, the authors derive explicit sharp bounds and phase transitions regarding the number of measurements required to successfully demix structured signals (such as sparse signals or low-rank matrices) from a single measurement vector. In principle we could recast the blind deconvolution/demixing problem as the demixing of a sum of rank-one matrices, see~\eqref{eq:measure2}. As such, it seems to fit into the framework analyzed by McCoy and Tropp. However, the setup in~\cite{mccoy2013demixing} differs from ours in a crucial manner. McCoy and Tropp consider as measurement matrices (see the matrices $\mathcal{A}_i$ in~\eqref{eq:measure2}) full-rank random matrices, while in our setting the measurement matrices are rank-one. This difference fundamentally changes the theoretical analysis. The findings in~\cite{mccoy2013demixing} are therefore not applicable to the problem of joint blind deconvolution/demixing. The compressive principal component analysis in~\cite{WGMM13} is also a form of demixing problem, but its setting is only vaguely related to ours. There is a large amount of literature on demixing problems, but the vast majority does not have a ``blind deconvolution component'', therefore this body of work is only marginally related to the topic of our paper. Blind deconvolution/demixing problems also appear in convolutional dictionary learning, see e.g.~\cite{bristow2013fast}. There, the aim is to factorize an ensemble of input vectors into a linear combination of overcomplete basis elements which are modeled as shift-invariant---the latter property is why the factorization turns into a convolution. The setup is similar to~\eqref{eq:model0}, but with an additional penalty term to enforce sparsity of the convolving filters. The existing literature on convolutional dictionary learning is mainly focused on empirical results, therefore there is little overlap with our work. But it is an interesting challenge for future research to see whether the approach in this paper can be modified to provide a fast and theoretically sound solver for the sparse convolutional coding problem. There are numerous papers concerned with blind deconvolution/demixing problems in the area of wireless communications~\cite{sudhakar2010double,Ver98,li2001direct}. But the majority of these papers assumes the availability of multiple measurement vectors, which makes the problem significantly easier. Those methods however cannot be applied to the case of a single measurement vector, which is the focus of this paper. Thus there is essentially no overlap of those papers with our work. Our previous paper~\cite{LS17b} solves~\eqref{eq:model0} under subspace conditions, i.e., assuming that both $\boldsymbol{f}_i$ and $\boldsymbol{g}_i$ belong to known linear subspaces. This contributes to generalizing the pioneering work by Ahmed, Recht, and Romberg~\cite{RR12} from the ``single-user" scenario to the ``multi-user" scenario. Both~\cite{RR12} and \cite{LS17b} employ a two-step convex approach: first ``lifting"~\cite{CSV11} is used and then the lifted version of the original bilinear inverse problems is relaxed into a semi-definite program. An improvement of the theoretical bounds in~\cite{LS17b} was announced in~\cite{SJK16}. While the convex approach is certainly effective and elegant, it can hardly handle large-scale problems. This motivates us to apply a nonconvex optimization approach~\cite{CLS14, LLSW16} to this blind-deconvolution-blind-demixing problem. The mathematical challenge, when using non-convex methods, is to derive a rigorous convergence framework with conditions that are competitive with those in a convex framework. In the last few years several excellent articles have appeared on provably convergent nonconvex optimization applied to various problems in signal processing and machine learning, e.g., matrix completion~\cite{KMO09, KMO09b,SL16}, phase retrieval~\cite{CLS14,CC15,SQW16,CLM16}, blind deconvolution~\cite{LLB16,CJ16b,LLSW16}, dictionary learning~\cite{SQW16it}, super-resolution~\cite{EftW15} and low-rank matrix recovery~\cite{TBSR15,WCCL16}. In this paper we derive the first nonconvex optimization algorithm to solve~\eqref{eq:model0} fast and with rigorous theoretical guarantees concerning exact recovery, convergence rates, as well as robustness for noisy data. Our work can be viewed as a generalization of blind deconvolution~\cite{LLSW16} $(s=1)$ to the multi-user scenario $(s > 1)$. The idea behind our approach is strongly motivated by the nonconvex optimization algorithm for phase retrieval proposed in~\cite{CLS14}. In this foundational paper, the authors use a two-step approach: (i) Construct a good initial guess with a numerically efficient algorithm; (ii) Starting with this initial guess, prove that simple gradient descent will converge to the true solution. Our paper follows a similar two-step scheme. However, the techniques used here are quite different from~\cite{CLS14}. Like the matrix completion problem~\cite{CR08}, the performance of the algorithm relies heavily and inherently on how much the ground truth signals are aligned with the design matrix. Due to this so-called ``incoherence" issue, we need to impose extra constraints, which results in a different construction of the so-called~\emph{basin of attraction}. Therefore, influenced by~\cite{KMO09, SL16,LLSW16}, we add penalty terms to control the incoherence and this leads to the regularized gradient descent method, which forms the core of our proposed algorithm. To the best of our knowledge, our algorithm is the first algorithm for the blind deconvolution/blind demixing problem that is numerically efficient, robust against noise, and comes with rigorous recovery guarantees. \subsection{Notation} For a matrix $\boldsymbol{Z}$, $\|\boldsymbol{Z}\|$ denotes its operator norm and $\|\boldsymbol{Z}\|_F$ is its the Frobenius norm. For a vector $\boldsymbol{z}$, $\|\boldsymbol{z}\|$ is its Euclidean norm and $\|\boldsymbol{z}\|_{\infty}$ is the $\ell_{\infty}$-norm. For both matrices and vectors, $\boldsymbol{Z}^*$ and $\boldsymbol{z}^*$ denote their complex conjugate transpose. $\bar{\boldsymbol{z}}$ is the complex conjugate of $\boldsymbol{z}$. We equip the matrix space $\mathbb{C}^{K\times N}$ with the inner product defined by $\langle \boldsymbol{U}, \boldsymbol{V}\rangle : =\text{Tr}(\boldsymbol{U}^*\boldsymbol{V}).$ For a given vector $\boldsymbol{z}$, $\diag(\boldsymbol{z})$ represents the diagonal matrix whose diagonal entries are $\boldsymbol{z}$. For any $z\in\mathbb{R}$, let $z_+ = \frac{z + |z|}{2}.$ \section{Preliminaries}\label{s:model} Obviously, without any further assumption, it is impossible to solve~\eqref{eq:model0}. Therefore, we impose the following subspace assumptions throughout our discussion~\cite{RR12,LS17b}. \begin{itemize} \item {\bf Channel subspace assumption:} Each finite impulse response $\boldsymbol{f}_i\in\mathbb{C}^L$ is assumed to have {\em maximum delay spread} $K$, i.e., \begin{equation*} \boldsymbol{f}_i = \begin{bmatrix} \boldsymbol{h}_i \\ \boldsymbol{0} \end{bmatrix}. \end{equation*} Here $\boldsymbol{h}_i\in\mathbb{C}^K$ is the nonzero part of $\boldsymbol{f}_i$ and $\boldsymbol{f}_i(n) = 0 \text{ for } n > K.$ \item {\bf Signal subspace assumption:} Let $\boldsymbol{g}_i : = \boldsymbol{C}_i\bar{\boldsymbol{x}}_i$ be the outcome of the signal $\bar{\boldsymbol{x}}_i\in\mathbb{C}^N$ encoded by a matrix $\boldsymbol{C}_i\in\mathbb{C}^{L\times N}$ with $L > N$, where the encoding matrix $\boldsymbol{C}_i$ is known and assumed to have full rank\footnote{Here we use the conjugate $\bar{\boldsymbol{x}}_i$ instead of $\boldsymbol{x}_i$ because it will simplify our notation in later derivations.}. \end{itemize} \begin{remark} Both subspace assumptions are common in various applications. For instance in wireless communications, the channel impulse response can always be modeled to have finite support (or maximum delay spread, as it is called in engineering jargon) due to the physical properties of wave propagation~\cite{goldsmith2005wireless}; and the signal subspace assumption is a standard feature found in many current communication systems~\cite{goldsmith2005wireless}, including CDMA where $\boldsymbol{C}_i$ is known as spreading matrix and OFDM where $\boldsymbol{C}_i$ is known as precoding matrix. \end{remark} The specific choice of the encoding matrices $\boldsymbol{C}_i$ depends on a variety of conditions. In this paper, we derive our theory by assuming that $\boldsymbol{C}_i$ is a complex Gaussian random matrix, i.e., each entry in $\boldsymbol{C}_i$ is i.i.d.\ $\mathcal{C}\mathcal{N}(0,1)$. This assumption, while sometimes imposed in the wireless communications literature, is somewhat unrealistic in practice, due to the lack of a fast algorithm to apply $\boldsymbol{C}_i$ and due to storage requirements. In practice one would rather choose $\boldsymbol{C}_i$ to be something like the product of a Hadamard matrix and a diagonal matrix with random binary entries. We hope to address such more structured encoding matrices in our future research. Our numerical simulations (see Section~\ref{s:numerics}) show no difference in the performance of our algorithm for either choice. Under the two assumptions above, the model actually has a simpler form in the~\emph{frequency} domain. We assume throughout the paper that the convolution of finite sequences is circular convolution\footnote{This circular convolution assumption can often be reinforced directly (for example in wireless communications the use of a cyclic prefix in OFDM renders the convolution circular) or indirectly (e.g.\ via zero-padding). In the first case replacing regular convolution by circular convolution does not introduce any errors at all. In the latter case one introduces an additional approximation error in the inversion which is negligible, since it decays exponentially for impulse responses of finite length~\cite{Str00}.}. By applying the Discrete Fourier Transform DFT) to~\eqref{eq:model0} along with the two assumptions, we have \begin{equation*} \frac{1}{\sqrt{L}}\boldsymbol{F} \boldsymbol{y} = \sum_{i=1}^s\diag(\boldsymbol{F} \boldsymbol{h}_i)(\boldsymbol{F}\boldsymbol{C}_i \bar{\boldsymbol{x}}_i) + \frac{1}{\sqrt{L}}\boldsymbol{F}\boldsymbol{n} \end{equation*} where $\boldsymbol{F}$ is the $L\times L$ normalized unitary DFT matrix with $\boldsymbol{F}^*\boldsymbol{F} = \boldsymbol{F}\BF^* = \boldsymbol{I}_L$. The noise is assumed to be additive white complex Gaussian noise with $\boldsymbol{n}\sim \mathcal{C}\mathcal{N}(\boldsymbol{0}, \sigma^2d_0^2\boldsymbol{I}_L)$ where $d_0 = \sqrt{\sum_{i=1}^s \|\boldsymbol{h}_{i0}\|^2 \|\boldsymbol{x}_{i0}\|^2}$, and $\{(\boldsymbol{h}_{i0}, \boldsymbol{x}_{i0})\}_{i=1}^s$ is the ground truth. We define $d_{i0} = \|\boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*\|_F$ and assume without loss of generality that $\|\boldsymbol{h}_{i0}\|$ and $\|\boldsymbol{x}_{i0}\|$ are of the same norm, i.e., $\|\boldsymbol{h}_{i0}\| = \|\boldsymbol{x}_{i0}\| = \sqrt{d_{i0}}$, which is due to the scaling ambiguity\footnote{Namely, if the pair $(\boldsymbol{h}_i, \boldsymbol{x}_i)$ is a solution, then so is $(\alpha \boldsymbol{h}_i, \alpha^{-1} \boldsymbol{x}_i)$ for any $\alpha \neq 0$. }. In that way, $\frac{1}{\sigma^{2}}$ actually is a measure of SNR (signal to noise ratio). Let $\boldsymbol{h}_i\in\mathbb{C}^K$ be the first $K$ nonzero entries of $\boldsymbol{f}_i$ and $\boldsymbol{B}\in\mathbb{C}^{L\times K}$ be a low-frequency DFT matrix (the first $K$ columns of an $L\times L$ unitary DFT matrix). Then a simple relation holds, \begin{equation*} \boldsymbol{F}\boldsymbol{f}_i = {\boldsymbol{B}}\boldsymbol{h}_i, \quad \boldsymbol{B}^*\boldsymbol{B} = \boldsymbol{I}_K. \end{equation*} We also denote $\boldsymbol{A}_i := \overline{\boldsymbol{F}\boldsymbol{C}_i}$ and $\boldsymbol{e} := \frac{1}{\sqrt{L}}\boldsymbol{F}\boldsymbol{n}$. Due to the Gaussianity, $\boldsymbol{A}_i$ also possesses complex Gaussian distribution and so does $\boldsymbol{e}.$ From now on, instead of focusing on the original model, we consider (with a slight abuse of notation) the following equivalent formulation throughout our discussion: \begin{equation}\label{eq:measure1} \boldsymbol{y} = \sum_{i=1}^s \diag(\boldsymbol{B}\boldsymbol{h}_{i})\overline{\boldsymbol{A}_i\boldsymbol{x}_{i}} + \boldsymbol{e}, \end{equation} where $\boldsymbol{e} \sim \mathcal{C}\mathcal{N}(\boldsymbol{0}, \frac{\sigma^2 d_0^2}{L}\boldsymbol{I}_L)$. Our goal here is to estimate all $\{\boldsymbol{h}_i, \boldsymbol{x}_i\}_{i=1}^s$ from $\boldsymbol{y},\boldsymbol{B}$ and $\{\boldsymbol{A}_i\}_{i=1}^s$. Obviously, this is a bilinear inverse problem, i.e., if all $\{\boldsymbol{h}_i\}_{i=1}^s$ are given, it is a linear inverse problem (the ordinary demixing problem) to recover all $\{\boldsymbol{x}_i\}_{i=1}^s$, and vice versa. We note that there is a scaling ambiguity in all blind deconvolution problems that cannot be resolved by any reconstruction method without further information. Therefore, when we talk about exact recovery in the following, then this is understood modulo such a trivial scaling ambiguity. \vskip0.25cm Before proceeding to our proposed algorithm we introduce some notation to facilitate a more convenient presentation of our approach. Let $\boldsymbol{b}_l$ be the $l$-th column of $\boldsymbol{B}^*$ and $\boldsymbol{a}_{il}$ be the $l$-th column of $\boldsymbol{A}_i^*$. Based on our assumptions the following properties hold: \begin{equation*} \sum_{l=1}^L\boldsymbol{b}_l\boldsymbol{b}_l^* = \boldsymbol{I}_K, \quad \|\boldsymbol{b}_l\|^2 = \frac{K}{L}, \quad \boldsymbol{a}_{il}\sim \mathcal{C}\mathcal{N}(\boldsymbol{0}, \boldsymbol{I}_N). \end{equation*} Moreover, inspired by the well-known~\emph{lifting} idea~\cite{CSV11,RR12,CESV11,LS15}, we define the useful matrix-valued linear operator $\mathcal{A}_i : \mathbb{C}^{K\times N} \to \mathbb{C}^L$ and its adjoint $\mathcal{A}_i^*:\mathbb{C}^L\rightarrow \mathbb{C}^{K\times N}$ by \begin{equation}\label{def:Ai} \mathcal{A}_i(\boldsymbol{Z}) := \{\boldsymbol{b}_l^*\boldsymbol{Z}\boldsymbol{a}_{il}\}_{l=1}^L, \quad \mathcal{A}^*_i(\boldsymbol{z}) := \sum_{l=1}^L z_l \boldsymbol{b}_l\boldsymbol{a}_{il}^* = \boldsymbol{B}^*\diag(\boldsymbol{z})\boldsymbol{A}_i \end{equation} for each $1\leq i\leq s$ under canonical inner product over $\mathbb{C}^{K\times N}.$ Therefore,~\eqref{eq:measure1} can be written in the following equivalent form \begin{equation}\label{eq:measure2} \boldsymbol{y} = \sum_{i=1}^s \mathcal{A}_i(\boldsymbol{h}_i\boldsymbol{x}_i^*) + \boldsymbol{e}. \end{equation} Hence, we can think of $\boldsymbol{y}$ as the observation vector obtained from taking {\em linear} measurements with respect to a set of rank-1 matrices $\{\boldsymbol{h}_i\boldsymbol{x}_i^*\}_{i=1}^s.$ In fact, with a bit of linear algebra (and ignoring the noise term for the moment), the $l$-th entry of $\boldsymbol{y}$ in~\eqref{eq:measure2} equals the inner product of two block-diagonal matrices: \begin{equation}\label{eq:measure3} y_l = \left\langle \underbrace{ \begin{bmatrix} \boldsymbol{h}_{1,0}\boldsymbol{x}_{1,0}^* & \boldsymbol{0} & \cdots & \boldsymbol{0} \\ \boldsymbol{0} & \boldsymbol{h}_{2,0}\boldsymbol{x}_{2,0}^* & \cdots & \boldsymbol{0} \\ \vdots & \vdots & \ddots & \vdots \\ \boldsymbol{0} & \boldsymbol{0} & \cdots & \boldsymbol{h}_{s0}\boldsymbol{x}_{s0}^* \\ \end{bmatrix}}_{\text{defined as }\boldsymbol{X}_0 }, \begin{bmatrix} \boldsymbol{b}_{l}\boldsymbol{a}_{1l}^* & \boldsymbol{0} & \cdots & \boldsymbol{0} \\ \boldsymbol{0} & \boldsymbol{b}_{l}\boldsymbol{a}_{2l}^* & \cdots & \boldsymbol{0} \\ \vdots & \vdots & \ddots & \vdots \\ \boldsymbol{0} & \boldsymbol{0} & \cdots & \boldsymbol{b}_{l}\boldsymbol{a}_{sl}^* \\ \end{bmatrix} \right\rangle + e_l, \end{equation} where $y_l = \sum_{i=1}^s \boldsymbol{b}_l^*\boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*\boldsymbol{a}_{il} + e_l, 1\leq l\leq L$ and $\boldsymbol{X}_0$ is defined as the ground truth matrix. In other words, we aim to recover such a block-diagonal matrix $\boldsymbol{X}_0$ from $L$ linear measurements with block structure if $\boldsymbol{e} = \boldsymbol{0}.$ By stacking all $\{\boldsymbol{h}_{i}\}_{i=1}^s$ (and $\{\boldsymbol{x}_i\}_{i=1}^s, \{\boldsymbol{h}_{i0}\}_{i=1}^s,\{\boldsymbol{x}_{i0}\}_{i=1}^s$) into a long column, we let \begin{equation}\label{def:hx} \boldsymbol{h} := \begin{bmatrix} \boldsymbol{h}_1 \\ \vdots\\ \boldsymbol{h}_s \end{bmatrix}, \quad \boldsymbol{h}_0 := \begin{bmatrix} \boldsymbol{h}_{1,0} \\ \vdots\\ \boldsymbol{h}_{s0} \end{bmatrix}\in\mathbb{C}^{Ks} ,\quad \boldsymbol{x} := \begin{bmatrix} \boldsymbol{x}_1 \\ \vdots\\ \boldsymbol{x}_s \end{bmatrix},\quad \boldsymbol{x}_0 := \begin{bmatrix} \boldsymbol{x}_{1,0} \\ \vdots\\ \boldsymbol{x}_{s0} \end{bmatrix} \in\mathbb{C}^{Ns}. \end{equation} We define $\mathcal{H}$ as a bilinear operator which maps a pair $(\boldsymbol{h}, \boldsymbol{x})\in\mathbb{C}^{Ks}\times \mathbb{C}^{Ns}$ into a block diagonal matrix in $\mathbb{C}^{Ks\times Ns}$, i.e., \begin{equation}\label{def:H} \mathcal{H}(\boldsymbol{h}, \boldsymbol{x}) := \begin{bmatrix} \boldsymbol{h}_1\boldsymbol{x}_1^* & \boldsymbol{0} & \cdots & \boldsymbol{0} \\ \boldsymbol{0} & \boldsymbol{h}_2\boldsymbol{x}_2^* & \cdots & \boldsymbol{0} \\ \vdots & \vdots & \ddots & \vdots \\ \boldsymbol{0} & \boldsymbol{0} & \cdots & \boldsymbol{h}_s\boldsymbol{x}_s^* \\ \end{bmatrix}\in\mathbb{C}^{Ks\times Ns}. \end{equation} Let $\boldsymbol{X} := \mathcal{H}(\boldsymbol{h}, \boldsymbol{x})$ and $\boldsymbol{X}_0 := \mathcal{H}(\boldsymbol{h}_0, \boldsymbol{x}_0)$ where $\boldsymbol{X}_0$ is the ground truth as illustrated in~\eqref{eq:measure3}. Define $\mathcal{A}(\boldsymbol{Z}):\mathbb{C}^{Ks\times Ns}\rightarrow \mathbb{C}^L$ as \begin{equation}\label{def:A} \mathcal{A}(\boldsymbol{Z}) := \sum_{i=1}^s \mathcal{A}_i(\boldsymbol{Z}_i), \end{equation} where $\boldsymbol{Z} = \text{blkdiag}(\boldsymbol{Z}_1,\cdots,\boldsymbol{Z}_s)$ and $\text{blkdiag}$ is the standard MATLAB function to construct block diagonal matrix. Therefore, $\mathcal{A}(\mathcal{H}(\boldsymbol{h}, \boldsymbol{x})) = \sum_{i=1}^s \mathcal{A}_i(\boldsymbol{h}_i\boldsymbol{x}_i^*)$ and $\boldsymbol{y} = \mathcal{A}(\mathcal{H}(\boldsymbol{h}_0, \boldsymbol{x}_0)) + \boldsymbol{e}.$ The adjoint operator $\mathcal{A}^*$ is defined naturally as \begin{equation}\label{def:A-adj} \mathcal{A}^*(\boldsymbol{z}) : = \begin{bmatrix} \mathcal{A}_1^*(\boldsymbol{z}) & \boldsymbol{0} & \cdots & \boldsymbol{0} \\ \boldsymbol{0} & \mathcal{A}_2^*(\boldsymbol{z}) & \cdots & \boldsymbol{0} \\ \vdots & \vdots & \ddots & \vdots \\ \boldsymbol{0} & \boldsymbol{0} & \cdots & \mathcal{A}_s^*(\boldsymbol{z}) \\ \end{bmatrix}\in\mathbb{C}^{Ks\times Ns}, \end{equation} which is a linear map from $\mathbb{C}^L$ to $\mathbb{C}^{Ks\times Ns}.$ To measure the approximation error of $\boldsymbol{X}_0$ given by $\boldsymbol{X}$, we define $\delta(\boldsymbol{h},\boldsymbol{x})$ as the global relative error: \begin{equation}\label{def:delta} \delta(\boldsymbol{h},\boldsymbol{x}) := \frac{\|\boldsymbol{X} - \boldsymbol{X}_0\|_F}{\|\boldsymbol{X}_0\|_F} = \frac{\sqrt{\sum_{i=1}^s \|\boldsymbol{h}_i\boldsymbol{x}_i^* - \boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*\|_F^2}}{d_0} = \sqrt{\frac{\sum_{i=1}^s \delta_i^2 d_{i0}^2}{ \sum_{i=1}^s d_{i0}^2}}, \end{equation} where $\delta_i : = \delta_i(\boldsymbol{h}_i,\boldsymbol{x}_i)$ is the relative error within each component: \begin{equation*} \delta_i(\boldsymbol{h}_i,\boldsymbol{x}_i) := \frac{\|\boldsymbol{h}_i\boldsymbol{x}_i^* - \boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*\|_F}{d_{i0}}. \end{equation*} Note that $\delta$ and $\delta_i$ are functions of $(\boldsymbol{h},\boldsymbol{x})$ and $(\boldsymbol{h}_i,\boldsymbol{x}_i)$ respectively and in most cases, we just simply use $\delta$ and $\delta_i$ if no possibility of confusion exists. \subsection{Convex versus nonconvex approaches} As indicated in~\eqref{eq:measure3}, joint blind deconvolution-demixing can be recast as the task to recover a rank-$s$ block-diagonal matrix from linear measurements. In general, such a low-rank matrix recovery problem is NP-hard. In order to take advantage of the low-rank property of the ground truth, it is natural to adopt convex relaxation by solving a convenient nuclear norm minimization program, i.e., \begin{equation}\label{eq:convex} \min \sum_{i=1}^s \|\boldsymbol{Z}_i\|_*, \quad s.t. \quad\sum_{i=1}^s \mathcal{A}_i(\boldsymbol{Z}_i) = \boldsymbol{y}. \end{equation} The question of when the solution of~\eqref{eq:convex} yields exact recovery is first answered in our previous work~\cite{LS17b}. Late,~\cite{SJK16,JungKS17} have improved this result to the near-optimal bound $L\geq C_0s(K + N)$ up to some $\log$-factors where the main theoretical result is informally summarized in the following theorem. \begin{theorem}[\bf Theorem 1.1 in~\cite{JungKS17}]\label{thm:convex} Suppose that $\boldsymbol{A}_i$ are $L\times N$ i.i.d. complex Gaussian matrices and $\boldsymbol{B}$ is an $L\times K$ partial DFT matrix with $\boldsymbol{B}^*\boldsymbol{B} = \boldsymbol{I}_K$. Then solving~\eqref{eq:convex} gives exact recovery if the number of measurements $L$ yields \begin{equation*} L \geq C_{\gamma} s(K+N)\log^3L \end{equation*} with probability at least $1 - L^{-\gamma}$ where $C_{\gamma}$ is an absolute scalar only depending on $\gamma$ linearly. \end{theorem} While the SDP relaxation is definitely effective and has theoretic performance guarantees, the computational costs for solving an SDP already become too expensive for moderate size problems, let alone for large scale problems. Therefore, we try to look for a more efficient nonconvex approach such as gradient descent, which hopefully is also reinforced by theory. It seems quite natural to achieve the goal by minimizing the following~\emph{nonlinear} least squares objective function with respect to $(\boldsymbol{h}, \boldsymbol{x})$ \begin{equation}\label{def:F} F(\boldsymbol{h}, \boldsymbol{x}) : = \|\mathcal{A}(\mathcal{H}(\boldsymbol{h},\boldsymbol{x})) - \boldsymbol{y}\|^2 = \left\|\sum_{i=1}^s\mathcal{A}_i(\boldsymbol{h}_i\boldsymbol{x}_i^*) - \boldsymbol{y}\right\|^2. \end{equation} In particular, if $\boldsymbol{e} = \boldsymbol{0},$ we write \begin{equation}\label{def:F0} F_0(\boldsymbol{h}, \boldsymbol{x}) : = \left\|\sum_{i=1}^s\mathcal{A}_i(\boldsymbol{h}_i\boldsymbol{x}_i^* - \boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*)\right\|^2. \end{equation} As also pointed out in~\cite{LLSW16}, this is a highly nonconvex optimization problem. Many of the commonly used algorithms, such as gradient descent or alternating minimization, may not necessarily yield convergence to the global minimum, so that we cannot always hope to obtain the desired solution. Often, those simple algorithms might get stuck in local minima. \subsection{The basin of attraction} Motivated by several excellent recent papers of nonconvex optimization on various signal processing and machine learning problem, we propose our two-step algorithm: (i)~Compute an initial guess carefully; (ii)~Apply gradient descent to the objective function, starting with the carefully chosen initial guess. One difficulty of understanding nonconvex optimization consists in how to construct the so-called~\emph{basin of attraction}, i.e., if the starting point is inside this basin of attraction, the iterates will always stay inside the region and converge to the global minimum. The construction of the basin of attraction varies for different problems~\cite{CLS14,CLM16,SL16}. For this problem, similar to~\cite{LLSW16}, the construction follows from the following three observations. Each of these observations suggests the definition of a certain {\em neighborhood} and the basin of attraction is then defined as the intersection of these three neighborhood sets $\mathcal{N}_d \cap \mathcal{N}_{\mu} \cap \mathcal{N}_{\epsilon}.$ \begin{enumerate}[1.] \item {\bf Ambiguity of solution}: in fact, we can only recover $(\boldsymbol{h}_i,\boldsymbol{x}_i)$ up to a scalar since $(\alpha\boldsymbol{h}_i,\alpha^{-1}\boldsymbol{x}_i)$ and $(\boldsymbol{h}_i,\boldsymbol{x}_i)$ are both solutions for $\alpha\neq 0$. From a numerical perspective, we want to avoid the scenario when $\|\boldsymbol{h}_i\|\rightarrow 0$ and $\|\boldsymbol{x}_i\|\rightarrow\infty$ while $\|\boldsymbol{h}_i\|\|\boldsymbol{x}_i\|$ is fixed, which potentially leads to numerical instability. To balance both the norm of $\|\boldsymbol{h}_i\|$ and $\|\boldsymbol{x}_i\|$ for all $1\leq i\leq s$, we define \begin{equation*}\label{def:Kd} \mathcal{N}_d := \{ \{(\boldsymbol{h}_i, \boldsymbol{x}_i)\}_{i=1}^s: \| \boldsymbol{h}_i\| \leq 2\sqrt{d_{i0}}, \| \boldsymbol{x}_i\| \leq 2\sqrt{d_{i0}}, 1\leq i\leq s \}, \end{equation*} which is a convex set. \item {\bf Incoherence}: the performance depends on how large/small the incoherence $\mu^2_h$ is, where $\mu_h^2$ is defined by \begin{equation*} \mu^2_h : = \max_{1\leq i\leq s} \frac{L\|\boldsymbol{B}\boldsymbol{h}_{i0}\|^2_{\infty}}{\|\boldsymbol{h}_{i0}\|^2}. \end{equation*} The idea is that:~\emph{the smaller the $\mu^2_h$ is, the better the performance is.} Let us consider an extreme case: if $\boldsymbol{B}\boldsymbol{h}_{i0}$ is highly sparse or spiky, we lose much information on those zero/small entries and cannot hope to get satisfactory recovered signals. In other words, we need the ground truth $\boldsymbol{h}_{i0}$ has ``spectral flatness" and $\boldsymbol{h}_{i0}$ is not highly localized on the Fourier domain. A similar quantity is also introduced in the matrix completion problem~\cite{CR08,SL16}. The larger $\mu^2_h$ is, the more $\boldsymbol{h}_{i0}$ is aligned with one particular row of $\boldsymbol{B}.$ To control the incoherence between $\boldsymbol{b}_{l}$ and $\boldsymbol{h}_i$, we define the second neighborhood, \begin{equation}\label{def:Kmu} \mathcal{N}_{\mu} := \{ \{\boldsymbol{h}_i\}_{i=1}^s : \sqrt{L} \|\boldsymbol{B}\boldsymbol{h}_i\|_{\infty} \leq 4\sqrt{d_{i0}}\mu, 1\leq i\leq s\}, \end{equation} where $\mu$ is a parameter and $\mu \geq \mu_h$. Note that $\mathcal{N}_{\mu}$ is also a convex set. \item {\bf Close to the ground truth}: we also want to construct an initial guess such that it is close to the ground truth, i.e., \begin{equation}\label{def:Keps} \mathcal{N}_{\epsilon} := \left\{ \{(\boldsymbol{h}_i, \boldsymbol{x}_i)\}_{i=1}^s: \delta_i = \frac{\|\boldsymbol{h}_i\boldsymbol{x}_i^* - \boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*\|_F}{d_{i0}} \leq \varepsilon, 1\leq i\leq s \right\} \end{equation} where $\varepsilon$ is a predetermined parameter in $(0, \frac{1}{15}]$. \end{enumerate} \begin{remark} To ensure $\delta_{i} \leq \varepsilon$, it suffices to ensure $\delta \leq \frac{\varepsilon}{\sqrt{s}\kappa}$ where $\kappa := \frac{\max d_{i0}}{\min d_{i0}} \geq 1$. This is because \begin{equation*} \frac{1}{s\kappa^2}\sum_{i=1}^s \delta_i^2 \leq \delta^2 \leq \frac{\varepsilon^2}{s\kappa^2} \end{equation*} which implies $\max_{1\leq i\leq s}\delta_i \leq \varepsilon.$ \end{remark} \begin{remark} When we say $(\boldsymbol{h}, \boldsymbol{x})\in\mathcal{N}_d, \mathcal{N}_{\mu}$ or $\mathcal{N}_{\epsilon}$, it means for all $i=1,\dots,s$ we have $(\boldsymbol{h}_i,\boldsymbol{x}_i) \in\mathcal{N}_d$, $\mathcal{N}_{\mu}$ or $\mathcal{N}_{\epsilon}$ respectively. In particular, $(\boldsymbol{h}_0, \boldsymbol{x}_0) \in\mathcal{N}_d \cap \mathcal{N}_{\mu} \cap \mathcal{N}_{\epsilon}$ where $\boldsymbol{h}_0$ and $\boldsymbol{x}_0$ are defined in~\eqref{def:hx}. \end{remark} \subsection{Objective function and Wirtinger derivative} To implement the first two observations, we introduce the regularizer $G(\boldsymbol{h}, \boldsymbol{x})$, defined as the sum of $s$ components \begin{eqnarray}\label{def:G} G(\boldsymbol{h}, \boldsymbol{x}):= \sum_{i=1}^s G_i(\boldsymbol{h}_i,\boldsymbol{x}_i) . \end{eqnarray} For each component $G_i(\boldsymbol{h}_i,\boldsymbol{x}_i)$, we let $\rho \geq d^2 + 2\|\boldsymbol{e}\|^2$, $0.9 d_0 \leq d \leq 1.1d_0$, $0.9d_{i0} \leq d_i \leq 1.1d_{i0}$ for all $1\leq i\leq s$ and \begin{align} \label{def:Gi} G_i := \rho \Big[ \underbrace{G_0\left(\frac{\|\boldsymbol{h}_i\|^2}{2d_i}\right) + G_0\left(\frac{\|\boldsymbol{x}_i\|^2}{2d_i}\right)}_{ \mathcal{N}_d } + \underbrace{\sum_{l=1}^LG_0\left(\frac{L |\boldsymbol{b}_l^*\boldsymbol{h}_i|^2}{8d_i\mu^2 }\right)}_{\mathcal{N}_{\mu}} \Big], \end{align} where $G_0(z) = \max\{z-1, 0\}^2$. Here both $d$ and $\{d_i\}_{i=1}^s$ are data-driven and well approximated by our spectral initialization procedure; and $\mu^2$ is a tuning parameter which could be estimated if we assume a specific statistical model for the channel (for example, in the widely used Rayleigh fading model, the channel coefficients are assumed to be complex Gaussian). The idea behind $G_i$ is quite straightforward though the formulation is complicated. For each $G_i$ in~\eqref{def:Gi}, the first two terms try to force the iterates to lie in $\mathcal{N}_d$ and the third term tries to encourage the iterates to lie in $\mathcal{N}_{\mu}.$ What about the neighborhood $\mathcal{N}_{\epsilon}$? A proper choice of the initialization followed by gradient descent which keeps the objective function decreasing will ensure that the iterates stay in $\mathcal{N}_{\epsilon}$. \vskip0.25cm Finally, we consider the objective function as the sum of nonlinear least squares objective function $F(\boldsymbol{h},\boldsymbol{x})$ in~\eqref{def:F} and the regularizer $G(\boldsymbol{h},\boldsymbol{x})$, \begin{equation}\label{def:FG} \widetilde{F}(\boldsymbol{h}, \boldsymbol{x}) := F(\boldsymbol{h},\boldsymbol{x}) + G(\boldsymbol{h}, \boldsymbol{x}). \end{equation} Note that the input of the function $\widetilde{F}(\boldsymbol{h},\boldsymbol{x})$ consists of complex variables but the output is real-valued. As a result, the following simple relations hold \begin{equation*} \frac{\partial \widetilde{F}}{\partial \bar{\boldsymbol{h}}_i} = \overline{\frac{\partial \widetilde{F}}{\partial \boldsymbol{h}_i} }, \quad \frac{\partial \widetilde{F}}{\partial \bar{\boldsymbol{x}}_i} = \overline{\frac{\partial \widetilde{F}}{\partial \boldsymbol{x}_i} }. \end{equation*} Similar properties also apply to both $F(\boldsymbol{h},\boldsymbol{x})$ and $G(\boldsymbol{h},\boldsymbol{x})$. Therefore, to minimize this function, it suffices to consider only the gradient of $\widetilde{F}$ with respect to $\bar{\boldsymbol{h}}_i$ and $\bar{\boldsymbol{x}}_i$, which is also called Wirtinger derivative~\cite{CLS14}. The Wirtinger derivatives of $F(\boldsymbol{h},\boldsymbol{x})$ and $G(\boldsymbol{h},\boldsymbol{x})$ w.r.t. $\bar{\boldsymbol{h}}_i$ and $\bar{\boldsymbol{x}}_i$ can be easily computed as follows \begin{align} \nabla F_{\boldsymbol{h}_i} & = \mathcal{A}_i^*\left(\mathcal{A}(\boldsymbol{X})- \boldsymbol{y}\right)\boldsymbol{x}_i = \mathcal{A}_i^*\left(\mathcal{A}(\boldsymbol{X}-\boldsymbol{X}_0)- \boldsymbol{e} \right)\boldsymbol{x}_i, \label{eq:WFh} \\ \nabla F_{\boldsymbol{x}_i} & = \left(\mathcal{A}_i^*\left(\mathcal{A}(\boldsymbol{X}) - \boldsymbol{y}\right)\right)^*\boldsymbol{h}_i = \left(\mathcal{A}_i^*\left(\mathcal{A}(\boldsymbol{X}-\boldsymbol{X}_0) - \boldsymbol{e}\right)\right)^*\boldsymbol{h}_i, \label{eq:WFx}\\ \nabla G_{\boldsymbol{h}_i} & = \frac{\rho}{2d_i}\Big[G'_0\left(\frac{\|\boldsymbol{h}_i\|^2}{2d_i}\right) \boldsymbol{h}_i + \frac{L}{4\mu^2} \sum_{l=1}^L G'_0\left(\frac{L|\boldsymbol{b}_l^*\boldsymbol{h}_i|^2}{8d_i\mu^2}\right) \boldsymbol{b}_l\boldsymbol{b}_l^*\boldsymbol{h}_i \Big], \label{eq:WGh} \\ \nabla G_{\boldsymbol{x}_i} & = \frac{\rho}{2d_i} G'_0\left( \frac{\|\boldsymbol{x}_i\|^2}{2d_i}\right) \boldsymbol{x}_i, \label{eq:WGx} \end{align} where $\mathcal{A}(\boldsymbol{X}) = \sum_{i=1}^s \mathcal{A}_i(\boldsymbol{h}_i\boldsymbol{x}_i^*)$ and $\mathcal{A}^*$ is defined in~\eqref{def:A-adj}. In short, we denote \begin{equation}\label{def:grad} \nabla\widetilde{F}_{\boldsymbol{h}} : = \nabla F_{\boldsymbol{h}} + \nabla G_{\boldsymbol{h}}, \quad \nabla F_{\boldsymbol{h}} : = \begin{bmatrix} \nabla F_{\boldsymbol{h}_1} \\ \vdots \\ \nabla F_{\boldsymbol{h}_s} \end{bmatrix}, \quad \nabla G_{\boldsymbol{h}} : = \begin{bmatrix} \nabla G_{\boldsymbol{h}_1} \\ \vdots \\ \nabla G_{\boldsymbol{h}_s} \end{bmatrix}. \end{equation} Similar definitions hold for $\nabla\widetilde{F}_{\boldsymbol{x}},\nabla F_{\boldsymbol{x}}$ and $G_{\boldsymbol{x}}$. It is easy to see that $\nabla F_{\boldsymbol{h}} = \mathcal{A}^*(\mathcal{A}(\boldsymbol{X}) - \boldsymbol{y})\boldsymbol{x}$ and $\nabla F_{\boldsymbol{x}} = (\mathcal{A}^*(\mathcal{A}(\boldsymbol{X}) - \boldsymbol{y}))^*\boldsymbol{h}$. \section{Algorithm and Theory} \label{s:thm} \subsection{Two-step algorithm} As mentioned before, the first step is to find a good initial guess $(\boldsymbol{u}^{(0)}, \boldsymbol{v}^{(0)})\in\mathbb{C}^{Ks}\times\mathbb{C}^{Ns}$ such that it is inside the basin of attraction. The initialization follows from this key fact: \begin{equation*} \E(\mathcal{A}_i^*(\boldsymbol{y})) = \E\left(\mathcal{A}_i^*\left(\sum_{j=1}^s\mathcal{A}_j(\boldsymbol{h}_{j0}\boldsymbol{x}_{j0}^* )+\boldsymbol{e}\right)\right) = \boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*, \end{equation*} where we use $\boldsymbol{B}^*\boldsymbol{B} = \sum_{l=1}^L\boldsymbol{b}_l\boldsymbol{b}_l^* = \boldsymbol{I}_K$, $\E(\boldsymbol{a}_{il}\boldsymbol{a}_{il}^*) = \boldsymbol{I}_N$ and \begin{align*} \E(\mathcal{A}_i^*\mathcal{A}_i(\boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*)) & = \sum_{l=1}^L \boldsymbol{b}_l\boldsymbol{b}_l^*\boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^* \E(\boldsymbol{a}_{il}\boldsymbol{a}_{il}^*) = \boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*, \\ \E(\mathcal{A}_j^*\mathcal{A}_i(\boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*)) & = \sum_{l=1}^L \boldsymbol{b}_l\boldsymbol{b}_l^*\boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^* \E(\boldsymbol{a}_{il}\boldsymbol{a}_{jl}^*) = \boldsymbol{0},\quad \forall j\neq i. \end{align*} Therefore, it is natural to extract the leading singular value and associated left and right singular vectors from each $\mathcal{A}_i^*(\boldsymbol{y})$ and use them as (a hopefully good) approximation to $(d_{i0}, \boldsymbol{h}_{i0}, \boldsymbol{x}_{i0}).$ This idea leads to Algorithm~\ref{Initial}, the theoretic guarantees of which are given in Section~\ref{s:init}. The second step of the algorithm is just to apply gradient descent to $\widetilde{F}$ with the initial guess $\{(\boldsymbol{u}^{(0)}_{i}, \boldsymbol{v}^{(0)}_i, d_i)\}_{i=1}^s$ or $(\boldsymbol{u}^{(0)}, \boldsymbol{v}^{(0)},\{ d_i\}_{i=1}^s)$, where $\boldsymbol{u}^{(0)}$ stems from stacking all $\boldsymbol{u}^{(0)}_{i}$ into one long vector\footnote{It is clear that instead of gradient descent one could also use a second-order method to achieve faster convergence at the tradeoff of increased computational cost per iteration. The theoretical convergence analysis for a second-order method will require a very different approach from the one developed in this paper.}. \begin{algorithm}[h!] \caption{Initialization via spectral method and projection} \label{Initial} \begin{algorithmic}[1] \For{ $i = 1, 2, \dots, s$} \State Compute $\mathcal{A}_i^*(\boldsymbol{y}).$ \State Find the leading singular value, left and right singular vectors of $\mathcal{A}_i^*(\boldsymbol{y})$, denoted by $(d_i, \hat{\boldsymbol{h}}_{i0}, \hat{\boldsymbol{x}}_{i0})$. \State Solve the following optimization problem for $1\leq i\leq s$: \begin{equation*} \boldsymbol{u}^{(0)}_{i} := \text{argmin}_{\boldsymbol{z}\in\mathbb{C}^K} \|\boldsymbol{z} - \sqrt{d_{i}}\hat{\boldsymbol{h}}_{i0}\|^2 \text{ s.t. }\sqrt{L}\|\boldsymbol{B}\boldsymbol{z}\|_{\infty} \leq 2\sqrt{d_{i}}\mu. \end{equation*} \State Set $\boldsymbol{v}^{(0)}_i = \sqrt{d_i}\hat{\boldsymbol{x}}_{i0}$. \EndFor \State Output: $\{(\boldsymbol{u}^{(0)}_{i}, \boldsymbol{v}^{(0)}_i, d_i)\}_{i=1}^s$ or $(\boldsymbol{u}^{(0)}, \boldsymbol{v}^{(0)}, \{d_i\}_{i=1}^s)$. \end{algorithmic} \end{algorithm} \begin{algorithm}[h!] \caption{Wirtinger gradient descent with constant stepsize $\eta$} \label{AGD} \begin{algorithmic}[1] \State {\bf Initialization:} obtain $(\boldsymbol{u}^{(0)}, \boldsymbol{v}^{(0)}, \{d_i\}_{i=1}^s)$ via Algorithm~\ref{Initial}. \For{ $t = 1, 2, \dots, $} \For{ $i = 1, 2, \dots, s$} \State $\boldsymbol{u}^{(t)}_{i} = \boldsymbol{u}^{(t-1)}_{i} - \eta \nabla \widetilde{F}_{\boldsymbol{h}_i}(\boldsymbol{u}^{(t-1)}_{i}, \boldsymbol{v}^{(t-1)}_{i})$, \State $\boldsymbol{v}^{(t)}_{i} = \boldsymbol{v}^{(t-1)}_{i} - \eta \nabla \widetilde{F}_{\boldsymbol{x}_i}(\boldsymbol{u}^{(t-1)}_{i}, \boldsymbol{v}^{(t-1)}_{i})$, \EndFor \EndFor \end{algorithmic} \end{algorithm} \begin{remark} For Algorithm~\ref{AGD}, we can rewrite each iteration into \begin{equation*} \boldsymbol{u}^{(t)} = \boldsymbol{u}^{(t-1)} - \eta\nabla \widetilde{F}_{\boldsymbol{h}}(\boldsymbol{u}^{(t-1)}, \boldsymbol{v}^{(t-1)}), \quad\boldsymbol{v}^{(t)} = \boldsymbol{v}^{(t-1)} - \eta\nabla \widetilde{F}_{\boldsymbol{x}}(\boldsymbol{u}^{(t-1)}, \boldsymbol{v}^{(t-1)}), \end{equation*} where $\nabla\widetilde{F}_{\boldsymbol{h}}$ and $\nabla\widetilde{F}_{\boldsymbol{x}}$ are in~\eqref{def:grad}, and \begin{equation*} \boldsymbol{u}^{(t)} : = \begin{bmatrix} \boldsymbol{u}_1^{(t)} \\ \vdots \\ \boldsymbol{u}_s^{(t)} \end{bmatrix}, \quad \boldsymbol{v}^{(t)} : = \begin{bmatrix} \boldsymbol{v}_1^{(t)} \\ \vdots \\ \boldsymbol{v}_s^{(t)} \end{bmatrix}. \end{equation*} \end{remark} \subsection{Main results} Our main findings are summarized as follows: Theorem~\ref{thm:init} shows that the initial guess given by Algorithm~\ref{Initial} indeed belongs to the basin of attraction. Moreover, $d_i$ also serves as a good approximation of $d_{i0}$ for each $i$. Theorem~\ref{thm:main} demonstrates that the regularized Wirtinger gradient descent will guarantee the linear convergence of the iterates and the recovery is exact in the noisefree case and stable in the presence of noise. \begin{theorem}\label{thm:init} The initialization obtained via Algorithm~\ref{Initial} satisfies \begin{align} (\boldsymbol{u}^{(0)}, \boldsymbol{v}^{(0)}) \in \frac{1}{\sqrt{3}}\mathcal{N}_d\bigcap \frac{1}{\sqrt{3}} \mathcal{N}_{\mu}\bigcap \mathcal{N}_{\frac{2\varepsilon}{5\sqrt{s}\kappa}} \label{eq:init-val1} \end{align} and \begin{equation}\label{eq:d} 0.9d_{i0} \leq d_i\leq 1.1d_{i0} ,\quad 0.9d_0 \leq d\leq 1.1d_0, \end{equation} holds with probability at least $1 - L^{-\gamma+1}$ if the number of measurements satisfies \begin{equation} \label{Lbound} L \geq C_{\gamma+\log(s)}(\mu_h^2 + \sigma^2)s^2 \kappa^4 \max\{K,N\}\log^2 L/\varepsilon^2. \end{equation} Here $\varepsilon$ is any predetermined constant in $(0, \frac{1}{15}]$, and $C_{\gamma}$ is a constant only linearly depending on $\gamma$ with $\gamma \geq 1$. \end{theorem} \begin{theorem}\label{thm:main} Starting with the initial value $\boldsymbol{z}^{(0)}:= (\boldsymbol{u}^{(0)}, \boldsymbol{v}^{(0)})$ satisfying~\eqref{eq:init-val1} the Algorithm~\ref{AGD} creates a sequence of iterates $(\boldsymbol{u}^{(t)}, \boldsymbol{v}^{(t)})$ which converges to the global minimum linearly, \begin{align}\label{eq:errorbound} \|\mathcal{H}(\boldsymbol{u}^{(t)}, \boldsymbol{v}^{(t)}) - \mathcal{H}(\boldsymbol{h}_0, \boldsymbol{x}_0) \|_F & \leq \frac{\varepsilon d_0}{\sqrt{2s\kappa^2}}(1 - \eta\omega)^{t/2} + 60\sqrt{s} \|\mathcal{A}^*(\boldsymbol{e})\| \end{align} with probability at least $1 - L^{-\gamma+1}$ where $\eta\omega = \mathcal{O}((s\kappa d_0(K+N)\log^2L)^{-1})$ and \begin{equation*} \|\mathcal{A}^*(\boldsymbol{e})\| \leq C_0 \sigma d_0\sqrt{\frac{\gamma s(K + N)(\log^2L)}{L}} \end{equation*} if the number of measurements $L$ satisfies \begin{equation} \label{boundforL} L \geq C_{\gamma+\log (s)}(\mu^2 + \sigma^2)s^2 \kappa^4 \max\{K,N\}\log^2 L/\varepsilon^2. \end{equation} \end{theorem} \begin{remark} Our previous work~\cite{LS17b} shows that the convex approach via semidefinite programming (see~\eqref{eq:convex}) requires $L \geq C_0s^2(K + \mu^2_h N)\log^3(L)$ to ensure exact recovery. Later,~\cite{JungKS17} improves this result to the near-optimal bound $L\geq C_0s(K + \mu^2_h N)$ up to some $\log$-factors. The difference between nonconvex and convex methods lies in the appearance of the condition number $\kappa$ in~\eqref{boundforL}. This is not just an artifact of the proof---empirically we also observe that the value of $\kappa$ affects the convergence rate of our nonconvex algorithm, see Figure~\ref{fig:snr-kappa}. \end{remark} \begin{remark} Our theory suggests $s^2$-dependence for the number of measurements $L$, although numerically $L$ in fact depends on $s$ linearly, as shown in Section~\ref{s:numerics}. The reason for $s^2$-dependence will be addressed in details in Section~\ref{s:outline}. \end{remark} \begin{remark} In the theoretical analysis, we assume that $\boldsymbol{A}_i$ (or equivalently $\boldsymbol{C}_i$) is a Gaussian random matrix. Numerical simulations suggest that this assumption is clearly not necessary. For example, $\boldsymbol{C}_i$ may be chosen to be a Hadamard-type matrix which is more appropriate and favorable for communications. \end{remark} \begin{remark} If $\boldsymbol{e} = \boldsymbol{0},$~\eqref{eq:errorbound} shows that $(\boldsymbol{u}^{(t)}, \boldsymbol{v}^{(t)})$ converges to the ground truth at a linear rate. On the other hand, if noise exists, $(\boldsymbol{u}^{(t)}, \boldsymbol{v}^{(t)})$ is guaranteed to converge to a point within a small neighborhood of $(\boldsymbol{h}_0,\boldsymbol{x}_0).$ More importantly, if the number of measurements $L$ gets larger, $\|\mathcal{A}^*(\boldsymbol{e})\|$ decays at the rate of $\mathcal{O}(L^{-1/2})$. \end{remark} \section{Numerical simulations}\label{s:numerics} In this section we present a range of numerical simulations to illustrate and complement different aspects of our theoretical framework. We will empirically analyze the number of measurements needed for perfect joint deconvolution/demixing to see how this compares to our theoretical bounds. We will also study the robustness for noisy data. In our simulations we use Gaussian encoding matrices, as in our theorems. But we also try more realistic structured encoding matrices, that are more reminiscent of what one might come across in wireless communications. While Theorem~\ref{thm:main} says that the number of measurements $L$ depends {\em quadratically} on the number of sources $s$, numerical simulations suggest near-optimal performance. Figure~\ref{fig:L-vs-s-gaussian} demonstrates that $L$ actually depends linearly on $s$, i.e., the boundary between success (white) and failure (black) is approximately a linear function of $s$. In the experiment, $K = N = 50$ are fixed, all $\boldsymbol{A}_i$ are complex Gaussians and all $(\boldsymbol{h}_i,\boldsymbol{x}_i)$ are standard complex Gaussian vectors. For each pair of $(L,s)$, 25 experiments are performed and we treat the recovery as a success if $\frac{\|\hat{\boldsymbol{X}} - \boldsymbol{X}_0\|_F}{\|\boldsymbol{X}_0\|_F} \leq 10^{-3}.$ For our algorithm, we use backtracking to determine the stepsize and the iteration stops either if $\|\mathcal{A}(\mathcal{H}(\boldsymbol{h}^{(t+1)}, \boldsymbol{x}^{(t+1)}) - \mathcal{H}(\boldsymbol{h}^{(t)}, \boldsymbol{x}^{(t)})) \| < 10^{-6}\|\boldsymbol{y}\|$ or if the number of iterations reaches 500. The backtracking is based on the Armijo-Goldstein condition~\cite{luenberger2015linear}. The initial stepsize is chosen to be $\eta = \frac{1}{K+N}$. If $\widetilde{F}(\boldsymbol{z}^{(t)} - \eta \nabla \widetilde{F}(\boldsymbol{z}^{(t)})) > \widetilde{F}(\boldsymbol{z}^{(t)})$, we just divide $\eta$ by two and use a smaller stepsize. We see from Figure~\ref{fig:L-vs-s-gaussian} that the number of measurements for the proposed algorithm to succeed not only seems to depend linearly on the number of sensors, but it is actually rather close to the information-theoretic limit $s(K+N)$. Indeed, the green dashed line in Figure~\ref{fig:L-vs-s-gaussian}, which represents the empirical boundary for the phase transition between success and failure corresponds to a line with slope about $\frac{3}{2} s(K+N)$. It is interesting to compare this empirical performance to the sharp theoretical phase transition bounds one would obtain via convex optimization~\cite{CRP12,mccoy2013demixing}. Considering the convex approach based on lifting in~\cite{LS17b}, we can adapt the theoretical framework in~\cite{CRP12} to the blind deconvolution/demixing setting, but with one modification. The bounds in~\cite{CRP12} rely on Gaussian widths of tangent cones related to the measurement matrices $\mathcal{A}_i$. Since simply analytic formulas for these expressions seem to be out of reach for the structured rank-one measurement matrices used in our paper, we instead compute the bounds for full-rank Gaussian random matrices, which yields a sharp bound of about $3s(K+N)$ (the corresponding bounds for rank-one sensing matrices will likely have a constant larger than 3). Note that these sharp theoretical bounds predict quite accurately the empirical behavior of convex methods. Thus our empirical bound for using a non-convex methods compares rather favorably with that of the convex approach. \begin{figure}[h!] \centering \includegraphics[width=180mm]{demix_L_vs_s_gaussian.pdf} \caption{Phase transition plot for empirical recovery performance under different choices of $(L,s)$ where $K = N =50$ are fixed. Black region: failure; white region: success. The red solid line depicts the number of degrees of freedom and the green dashed line shows the empirical phase transition bound for Algorithm~\ref{AGD}.} \label{fig:L-vs-s-gaussian} \end{figure} Similar conclusions can be drawn from Figure~\ref{fig:L-vs-s-hadamard}; there all $\boldsymbol{A}_i$ are in the form of $\boldsymbol{A}_i = \boldsymbol{F} \boldsymbol{D}_i \boldsymbol{H}$ where $\boldsymbol{F}$ is the unitary $L\times L$ DFT matrix, all $\boldsymbol{D}_i$ are independent diagonal binary $\pm 1$ matrices and $\boldsymbol{H}$ is an $L\times N$ fixed partial deterministic Hadamard matrix. The purpose of using $\boldsymbol{D}_i$ is to enhance the incoherence between each channel so that our algorithm is able to tell apart each individual signal and channel. As before we assume Gaussian channels, i.e., $\boldsymbol{h}_i\sim \mathcal{C}\mathcal{N}(\boldsymbol{0}, \boldsymbol{I}_K)$ Therefore, our approach does not only work for Gaussian encoding matrices $\boldsymbol{A}_i$ but also for the matrices that are interesting to real-world applications, although no satisfactory theory has been derived yet for that case. Moreover, due to the structure of $\boldsymbol{A}_i$ and $\boldsymbol{B}$, fast transform algorithms are available, potentially allowing for real-time deployment. \begin{figure}[h!] \centering \includegraphics[width=75mm]{demix_L_vs_s_hadamard.pdf} \caption{Empirical probability of successful recovery for different pairs of $(L,s)$ when $K = N =50$ are fixed. } \label{fig:L-vs-s-hadamard} \end{figure} Figure~\ref{fig:snr-gaussian} shows the robustness of our algorithm under different levels of noise. We also run 25 samples for each level of SNR and different $L$ and then compute the average relative error. It is easily seen that the relative error scales linearly with the SNR and one unit of increase in SNR (in dB) results in one unit of decrease in the relative error. \begin{figure}[h!] \centering \begin{minipage}{0.48\textwidth} \includegraphics[width=75mm]{demix_snr_gaussian.pdf} \end{minipage} \hfill \begin{minipage}{0.48\textwidth} \includegraphics[width=75mm]{demix_snr_hadamard.pdf} \end{minipage} \caption{Relative error vs. SNR (dB): SNR = $20\log_{10}\left(\frac{\|\boldsymbol{y}\|}{\|\boldsymbol{e}\|}\right)$.} \label{fig:snr-gaussian} \end{figure} Theorem~\ref{thm:main} suggests that the performance and convergence rate actually depend on the condition number of $\boldsymbol{X}_0 = \mathcal{H}(\boldsymbol{h}_0,\boldsymbol{x}_0)$, i.e., on $\kappa = \frac{\max d_{i0}}{\min d_{i0}}$ where $d_{i0} = \|\boldsymbol{h}_{i0}\|\|\boldsymbol{x}_{i0}\|$. Next we demonstrate that this dependence on the condition number is not an artifact of the proof, but is indeed also observed empirically. In this experiment, we let $s=2$ and set for the first component $d_{1,0} = 1$ and for the second one $d_{2,0} = \kappa$ for $\kappa \in \{1,2,5\}$. Here, $\kappa = 1$ means that the received signals of both sensors have equal power, whereas $\kappa=5$ means that the signal received from the second sensor is considerably stronger. The initial stepsize is chosen as $\eta=1$, followed by the backtracking scheme. Figure~\ref{fig:snr-kappa} shows how the relative error decays with respect to the number of iterations $t$ under different condition number $\kappa$ and $L.$ The larger $\kappa$ is, the slower the convergence rate is, as we see from Figure~\ref{fig:snr-kappa}. This may result from two reasons: our spectral initialization may not be able to give a good initial guess for those weak components; moreover, during the gradient descent procedure, the gradient directions for the weak components could be totally dominated/polluted by the strong components. Currently, we still have no effective way of how to deal with this issue of slow convergence when $\kappa$ is not small. We have to leave this topic for future investigations. \begin{figure}[h!] \centering \begin{minipage}{0.48\textwidth} \includegraphics[width=75mm]{kappa_demix_L512.pdf} \end{minipage} \hfill \begin{minipage}{0.48\textwidth} \includegraphics[width=75mm]{kappa_demix_L1024.pdf} \end{minipage} \caption{Relative error vs. number of iterations $t$.} \label{fig:snr-kappa} \end{figure} \section{Convergence analysis} \label{s:converge} Our convergence analysis relies on the following four conditions where the first three of them are local properties. We will also briefly discuss how they contribute to the proof of our main theorem. Note that our previous work~\cite{LLSW16} on blind deconvolution is actually a special case $(s=1)$ of~\eqref{eq:measure1}. The proof of Theorem~\ref{thm:main} follows in part the main ideas in~\cite{LLSW16}. The readers may find the technical parts of~\cite{LLSW16} and this manuscript share many similarities. However, there are also important differences. After all, we are now dealing with a more complicated problem where the ground truth matrix $\boldsymbol{X}_0$ and measurement matrices are both rank-$s$ block-diagonal matrices, as shown in~\eqref{eq:measure3}, instead of rank-1 matrices in~\cite{LLSW16}. The key is to understand the properties of the linear operator $\mathcal{A}$ applying to different types of~\emph{block-diagonal} matrices. Therefore, many technical details are much more involved while on the other hand, some of results in~\cite{LLSW16} can be used directly. During the presentation, we will clearly point out both the similarities to and differences from~\cite{LLSW16}. \subsection{Four key conditions} \begin{condition}{\bf Local regularity condition:}\label{cond:reg} Let $\boldsymbol{z} : = (\boldsymbol{h}, \boldsymbol{x})\in\mathbb{C}^{s(K+N)}$ and $\nabla\widetilde{F}(\boldsymbol{z}) := \begin{bmatrix} \nabla\widetilde{F}_{\boldsymbol{h}}(\boldsymbol{z}) \\ \nabla\widetilde{F}_{\boldsymbol{x}}(\boldsymbol{z}) \end{bmatrix} \in\mathbb{C}^{s(K+N)}$, then \begin{equation}\label{def:reg} \|\nabla \widetilde{F}(\boldsymbol{z})\|^2 \geq \omega [\widetilde{F}(\boldsymbol{z}) - c]_+ \end{equation} for $\boldsymbol{z} \in\mathcal{N}_d \cap \mathcal{N}_{\mu} \cap \mathcal{N}_{\epsilon}$ where $\omega = \frac{d_0}{7000}$ and $c = \|\boldsymbol{e}\|^2 + 2000s\|\mathcal{A}^*(\boldsymbol{e})\|^2.$ \end{condition} We will prove Condition~\ref{cond:reg} in Section~\ref{s:LRC}. Condition~\ref{cond:reg} states that $\widetilde{F}(\boldsymbol{z}) = 0$ if $\|\nabla \widetilde{F}(\boldsymbol{z})\| = 0$ and $\boldsymbol{e} = 0$, i.e., all the stationary points inside the basin of attraction are global minima. \begin{condition}{\bf Local smoothness condition:}\label{cond:smooth} Let $\boldsymbol{z} = (\boldsymbol{h}, \boldsymbol{x})$ and $\boldsymbol{w} = (\boldsymbol{u}, \boldsymbol{v})$ and there holds \begin{equation}\label{def:CL} \|\widetilde{F}(\boldsymbol{z} + \boldsymbol{w}) - \widetilde{F}(\boldsymbol{z})\| \leq C_L \|\boldsymbol{w}\| \end{equation} for $\boldsymbol{z} + \boldsymbol{w}$ and $\boldsymbol{z}$ inside $\mathcal{N}_d \cap \mathcal{N}_{\mu} \cap \mathcal{N}_{\epsilon}$ where $C_L \approx \mathcal{O}(d_0s\kappa(1 + \sigma^2)(K + N)\log^2 L )$ is the Lipschitz constant of $\widetilde{F}$ over $\mathcal{N}_d \cap \mathcal{N}_{\mu} \cap \mathcal{N}_{\epsilon}$. The convergence rate is governed by $C_L$. \end{condition} The proof of Condition~\ref{cond:smooth} can be found in Section~\ref{s:smooth}. \begin{condition}{\bf Local restricted isometry property:}\label{cond:rip} Denote $\boldsymbol{X} = \mathcal{H}(\boldsymbol{h}, \boldsymbol{x})$ and $\boldsymbol{X}_0 = \mathcal{H}(\boldsymbol{h}_0, \boldsymbol{x}_0)$. There holds \begin{equation}\label{eq:rip} \frac{2}{3} \|\boldsymbol{X} - \boldsymbol{X}_0\|_F^2 \leq \left\| \mathcal{A}(\boldsymbol{X} - \boldsymbol{X}_0) \right\|^2 \leq \frac{3}{2} \|\boldsymbol{X} - \boldsymbol{X}_0\|_F^2 \end{equation} uniformly all for $(\boldsymbol{h}, \boldsymbol{x})\in\mathcal{N}_d \cap \mathcal{N}_{\mu} \cap \mathcal{N}_{\epsilon}$. \end{condition} Condition~\ref{cond:rip} will be proven in Section~\ref{s:LRIP}. It says that the convergence of the objective function implies the convergence of the iterates. \begin{remark}[\bf Necessity of inter-user incoherence]\label{rem:inc} Although Condition~\ref{cond:rip} is seemingly the same as the one in our previous work~\cite{LLSW16}, it is indeed very different. Recall that $\mathcal{A}$ is a linear operator acting on block-diagonal matrices and its output is the sum of $s$ different components involving $\mathcal{A}_i$. Therefore, the proof of Condition~\ref{cond:rip} heavily depends on the inter-user incoherence whereas this notion of incoherence is not needed at all for the single-user scenario. At the beginning of Section~\ref{s:model}, we discuss the choice of $\boldsymbol{C}_i$ (or $\boldsymbol{A}_i$). In order to distinguish one user from another, it is essential to use sufficiently different\footnote{Suppose all $\boldsymbol{C}_i$ are the same, there is no hope to recover all pairs of $\{(\boldsymbol{h}_i,\boldsymbol{x}_i)\}_{i=1}^s$ simultaneously.} encoding matrices $\boldsymbol{C}_i$ (or $\boldsymbol{A}_i$). Here the independence and Gaussianity of all $\boldsymbol{C}_i$ (or $\boldsymbol{A}_i$) guarantee that $\|\mathcal{P}_{T_i}\mathcal{A}_i^*\mathcal{A}_j\mathcal{P}_{T_j}\|$ is sufficiently small for all $i\neq j$ where $T_i$ is defined in~\eqref{def:T}. It is a key element to ensure the validity of Condition~\ref{cond:rip} which is also an important component to prove Condition~\ref{cond:reg}. On the other hand, due to the recent progress on this joint deconvolution and demixing problem, one is also able to prove a local restricted isometry property with tools such as bounding the suprema of chaos processes~\cite{JungKS17} by assuming $\{\boldsymbol{A}_i\}_{i=1}^s$ as Gaussian matrices. \end{remark} \begin{condition}{\bf Robustness condition:}\label{cond:robust} Let $\varepsilon \leq \frac{1}{15}$ be a predetermined constant. We have \begin{equation}\label{eq:robust} \|\mathcal{A}^*(\boldsymbol{e})\| = \max_{1\leq i\leq s}\|\mathcal{A}_i^*(\boldsymbol{e})\| \leq \frac{\varepsilon d_0}{10\sqrt{2}s \kappa}, \end{equation} where $\boldsymbol{e}\sim \mathcal{C}\mathcal{N}(0, \frac{\sigma^2d_0^2}{L})$ if $L \geq C_{\gamma}\kappa^2s^2(K + N)/\varepsilon^2.$ \end{condition} We will prove Condition~\ref{cond:robust} in Section~\ref{s:init}. We now extract one useful result based on Conditions~\ref{cond:rip} and~\ref{cond:robust}. From these two conditions, we are able to produce a good approximation of $F(\boldsymbol{h}, \boldsymbol{x})$ for all $(\boldsymbol{h}, \boldsymbol{x})\in\mathcal{N}_d \cap \mathcal{N}_{\mu} \cap \mathcal{N}_{\epsilon}$ in terms of $\delta$ in~\eqref{def:delta}. For $(\boldsymbol{h}, \boldsymbol{x})\in\mathcal{N}_d \cap \mathcal{N}_{\mu} \cap \mathcal{N}_{\epsilon}$, the following inequality holds \begin{equation}\label{eq:LUBD} \frac{2}{3}\delta^2d_0^2 -\frac{\varepsilon\delta d_0^2}{5\sqrt{s}\kappa} + \|\boldsymbol{e}\|^2 \leq F(\boldsymbol{h}, \boldsymbol{x}) \leq \frac{3}{2}\delta^2d_0^2 + \frac{\varepsilon\delta d_0^2}{5\sqrt{s}\kappa} + \|\boldsymbol{e}\|^2. \end{equation} Note that~\eqref{eq:LUBD} simply follows from \begin{equation*} F(\boldsymbol{h}, \boldsymbol{x}) = \| \mathcal{A}(\boldsymbol{X} - \boldsymbol{X}_0) \|_F^2 - 2\Real(\langle \boldsymbol{X}- \boldsymbol{X}_0, \mathcal{A}^*(\boldsymbol{e})\rangle) + \|\boldsymbol{e}\|^2. \end{equation*} Note that~\eqref{eq:rip} implies $\frac{2}{3}\delta^2d_0^2\leq \|\mathcal{A}(\boldsymbol{X}-\boldsymbol{X}_0)\|_F^2\leq \frac{3}{2}\delta^2d_0^2$. Thus it suffices to estimate the cross-term, \begin{align} |\Real(\langle \boldsymbol{X}- \boldsymbol{X}_0, \mathcal{A}^*(\boldsymbol{e})\rangle)| & \leq \|\mathcal{A}^*(\boldsymbol{e})\| \|\boldsymbol{X} - \boldsymbol{X}_0\|_* = \|\mathcal{A}^*(\boldsymbol{e})\| \sum_{i=1}^s\|\boldsymbol{h}_i\boldsymbol{x}_i^* - \boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*\|_* \nonumber \\ & \leq \sqrt{2}\|\mathcal{A}^*(\boldsymbol{e})\| \sum_{i=1}^s\|\boldsymbol{h}_i\boldsymbol{x}_i^* - \boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*\|_F \nonumber \\ & \leq \sqrt{2s} \|\mathcal{A}^*(\boldsymbol{e})\| \|\boldsymbol{X} - \boldsymbol{X}_0\|_F \leq \frac{\varepsilon \delta d_0^2}{10\sqrt{s}\kappa} \label{eq:cross} \end{align} where $\|\cdot\|_*$ and $\|\cdot\|$ are a pair of dual norms and $\|\mathcal{A}^*(\boldsymbol{e})\|$ comes from~\eqref{eq:robust}. \vskip0.5cm \subsection{Outline of the convergence analysis} \label{s:outline} For the ease of proof, we introduce another neighborhood: \begin{equation*} \mathcal{N}_{\widetilde{F}} = \left\{ (\boldsymbol{h},\boldsymbol{x}) : \widetilde{F}(\boldsymbol{h}, \boldsymbol{x}) \leq \frac{\varepsilon^2 d_0^2}{3s\kappa^2} + \|\boldsymbol{e}\|^2\right\}. \end{equation*} Moreover, another reason to consider $\mathcal{N}_{\widetilde{F}}$ is based on the fact that gradient descent~\emph{only} allows one to make the objective function decrease if the step size is chosen appropriately. In other words, all the iterates $\boldsymbol{z}^{(t)}$ generated by gradient descent are inside $\mathcal{N}_{\widetilde{F}}$ as long as $\boldsymbol{z}^{(0)}\in \mathcal{N}_{\widetilde{F}}.$ On the other hand, it is crucial to note that the decrease of the objective function does not necessarily imply the decrease of the relative error of the iterates. Therefore, we want to construct an initial guess in $\mathcal{N}_{\epsilon}\cap \mathcal{N}_{\widetilde{F}}$ so that $\boldsymbol{z}^{(0)}$ is sufficiently close to the ground truth and then analyze the behavior of $\boldsymbol{z}^{(t)}$. \vskip0.25cm In the rest of this section, we basically try to prove the following relation: \begin{equation*} \underbrace{ \frac{1}{\sqrt{3}}\mathcal{N}_d\cap \frac{1}{\sqrt{3}} \mathcal{N}_{\mu} \cap \mathcal{N}_{\frac{2\varepsilon}{5\sqrt{s}\kappa}}}_{\text{Initial guess}} \subset \underbrace{\mathcal{N}_{\epsilon}\cap \mathcal{N}_{\widetilde{F}}}_{ \{\boldsymbol{z}^{(t)}\}_{t\geq 0} \text{ in } \mathcal{N}_{\epsilon}\cap \mathcal{N}_{\widetilde{F}} } \subset \underbrace{\mathcal{N}_d \cap \mathcal{N}_{\mu} \cap \mathcal{N}_{\epsilon}}_{\text{Key conditions hold over }\mathcal{N}_d \cap \mathcal{N}_{\mu} \cap \mathcal{N}_{\epsilon} }. \end{equation*} Now we give a more detailed explanation of the relation above, which constitutes the main structure of the proof: \begin{enumerate} \item We will show $\frac{1}{\sqrt{3}}\mathcal{N}_d\cap \frac{1}{\sqrt{3}} \mathcal{N}_{\mu} \cap \mathcal{N}_{\frac{2\varepsilon}{5\sqrt{s}\kappa}} \subset \mathcal{N}_{\epsilon}\cap \mathcal{N}_{\widetilde{F}}$ in the proof of Theorem~\ref{thm:main} in Section~\ref{s:mainthm}, which is quite straightforward. \item Lemma~\ref{lem:betamu} explains why it holds that $\mathcal{N}_{\epsilon}\cap \mathcal{N}_{\widetilde{F}}\subset \mathcal{N}_d \cap \mathcal{N}_{\mu} \cap \mathcal{N}_{\epsilon}$ and where the $s^2$-bottleneck comes from. \item Lemma~\ref{lem:line_section} implicitly shows that the iterates $\boldsymbol{z}^{(t)}$ will remain in $\mathcal{N}_{\epsilon}\cap\mathcal{N}_{\widetilde{F}}$ if the initial guess $\boldsymbol{z}^{(0)}$ is inside $\mathcal{N}_{\epsilon}\cap \mathcal{N}_{\widetilde{F}}$ and $\widetilde{F}(\boldsymbol{z}^{(t)})$ is monotonically decreasing (simply by induction). Lemma~\ref{lem:induction} makes this observation explicit by showing that $\boldsymbol{z}^{(t)}\in \mathcal{N}_{\epsilon} \cap \mathcal{N}_{\widetilde{F}}$ implies $\boldsymbol{z}^{(t+1)} : = \boldsymbol{z}^{(t)} - \eta\nabla \widetilde{F}(\boldsymbol{z}^{(t)})\in \mathcal{N}_{\epsilon}\cap\mathcal{N}_{\widetilde{F}}$ if the stepsize $\eta$ obeys $\eta \leq \frac{1}{C_L}$. Moreover, Lemma~\ref{lem:induction} guarantees sufficient decrease of $\widetilde{F}(\boldsymbol{z}^{(t)})$ in each iteration, which paves the road towards the proof of linear convergence of $\widetilde{F}(\boldsymbol{z}^{(t)})$ and thus $\boldsymbol{z}^{(t)}.$ \end{enumerate} \vskip0.25cm Remember that $\mathcal{N}_d$ and $\mathcal{N}_{\mu}$ are both convex sets, and the purpose of introducing regularizers $G_i(\boldsymbol{h}_i, \boldsymbol{x}_i)$ is to approximately project the iterates onto $\mathcal{N}_d\cap\mathcal{N}_{\mu}.$ Moreover, we hope that once the iterates are inside $\mathcal{N}_{\epsilon}$ and inside a sublevel subset $\mathcal{N}_{\widetilde{F}}$, they will never escape from $\mathcal{N}_{\widetilde{F}}\cap\mathcal{N}_{\epsilon}$. Those ideas are fully reflected in the following lemma. \begin{lemma} \label{lem:betamu} Assume $0.9d_{i0}\leq d_i\leq 1.1d_{i0}$ and $0.9d_{0}\leq d\leq 1.1d_0$. There holds $\mathcal{N}_{\widetilde{F}} \subset \mathcal{N}_d \cap \mathcal{N}_{\mu}$; moreover, under Conditions~\ref{cond:rip} and~\ref{cond:robust}, we have $\mathcal{N}_{\widetilde{F}} \cap \mathcal{N}_{\epsilon}\subset \mathcal{N}_d \cap \mathcal{N}_{\mu}\cap\mathcal{N}_{\frac{9}{10}\epsilon}$. \end{lemma} \begin{proof} If $(\vct{h}, \vct{x}) \notin \mathcal{N}_d \cap \mathcal{N}_{\mu}$, by the definition of $G$ in~\eqref{def:G}, at least one component in $G$ exceeds $\rho G_0\left(\frac{2d_{i0}}{d_i}\right)$. We have \begin{eqnarray*} \widetilde{F}(\boldsymbol{h}, \boldsymbol{x}) & \geq & \rho G_0\left(\frac{2d_{i0}}{d_i}\right) \geq (d^2 + 2\|\boldsymbol{e}\|^2) \left( \frac{2d_{i0}}{d_i} - 1\right)^2 \\ & \geq & (2/1.1 - 1)^2 (d^2 + 2\|\boldsymbol{e}\|^2) \\ & \geq & \frac{1}{2} d_{0}^2 + \|\boldsymbol{e}\|^2 > \frac{\varepsilon^2 d_0^2}{3s \kappa^2} + \|\boldsymbol{e}\|^2, \end{eqnarray*} where $\rho \geq d^2 + 2\|\boldsymbol{e}\|^2$, $0.9d_0 \leq d \leq 1.1d_0$ and $0.9d_{i0} \leq d_i\leq 1.1d_{i0}.$ This implies $(\boldsymbol{h}, \boldsymbol{x}) \notin \mathcal{N}_{\widetilde{F}}$ and hence $\mathcal{N}_{\widetilde{F}} \subset \mathcal{N}_d \cap \mathcal{N}_{\mu}$. \\ Note that $(\boldsymbol{h}, \boldsymbol{x})\in \mathcal{N}_d \cap \mathcal{N}_{\mu} \cap \mathcal{N}_{\epsilon}$ if $(\boldsymbol{h}, \boldsymbol{x}) \in \mathcal{N}_{\widetilde{F}} \cap \mathcal{N}_{\epsilon}$. Applying~\eqref{eq:LUBD} gives \begin{equation*} \frac{2}{3}\delta^2d_0^2 -\frac{\varepsilon\delta d_0^2}{5\sqrt{s}\kappa} + \|\boldsymbol{e}\|^2 \leq F(\boldsymbol{h}, \boldsymbol{x})\leq \widetilde{F}(\boldsymbol{h}, \boldsymbol{x})\leq\frac{\varepsilon^2 d_0^2}{3s\kappa^2} + \|\boldsymbol{e}\|^2 \end{equation*} which implies that $\delta \leq \frac{9}{10}\frac{\varepsilon}{\sqrt{s}\kappa}.$ By definition of $\delta$ in~\eqref{def:delta}, there holds \begin{equation}\label{eq:bottleneck} \frac{81\varepsilon^2}{100s\kappa^2} \geq \delta^2 = \frac{\sum_{i=1}^s \delta_i^2d_{i0}^2}{\sum_{i=1}^s d_{i0}^2} \geq \frac{\sum_{i=1}^s \delta_i^2}{s\kappa^2} \geq \frac{1}{s\kappa^2} \max_{1\leq i\leq s}\delta_i^2, \end{equation} which gives $\delta_i \leq \frac{9}{10}\varepsilon$ and $(\boldsymbol{h}, \boldsymbol{x})\in \mathcal{N}_{\frac{9}{10}\varepsilon}.$ \end{proof} \begin{remark} The $s^2$-bottleneck comes from~\eqref{eq:bottleneck}. If $\delta \leq \varepsilon$ is small, we cannot guarantee that each $\delta_i$ is also smaller than $\varepsilon$. Just consider the simplest case when all $d_{i0}$ are the same: then $d_0^2 = \sum_{i=1}^s d_{i0}^2 = s d_{i0}^2$ and there holds \begin{equation*} \varepsilon^2\geq \delta^2 = \frac{1}{s}\sum_{i=1}^s \delta_i^2. \end{equation*} Obviously, we cannot conclude that $\max \delta_i \leq \varepsilon$ but only say that $\delta_i \leq \sqrt{s}\varepsilon.$ This is why we require $\delta ={\cal O}(\frac{\varepsilon}{\sqrt{s}})$ to ensure $\delta_i \leq \varepsilon$, which gives $s^2$-dependence in $L.$ \end{remark} \begin{lemma} \label{lem:line_section} Denote $\vct{z}_1 = (\boldsymbol{h}_1, \boldsymbol{x}_1)$ and $\vct{z}_2 = (\boldsymbol{h}_2, \boldsymbol{x}_2)$. Let $\vct{z}(\lambda):=(1-\lambda)\vct{z}_1 + \lambda \vct{z}_2$. If $\vct{z}_1 \in \mathcal{N}_{\epsilon}$ and $\vct{z}(\lambda) \in \mathcal{N}_{\widetilde{F}}$ for all $\lambda \in [0, 1]$, we have $\vct{z}_2 \in \mathcal{N}_{\epsilon}$. \end{lemma} \begin{proof} Note that for $\boldsymbol{z}_1\in\mathcal{N}_{\epsilon}\cap \mathcal{N}_{\widetilde{F}}$, we have $\boldsymbol{z}_1\in \mathcal{N}_d\cap\mathcal{N}_{\mu}\cap\mathcal{N}_{\frac{9}{10}\varepsilon}$ which follows from the second part of Lemma~\ref{lem:betamu}. Now we prove $\boldsymbol{z}_2\in\mathcal{N}_{\epsilon}$ by contradiction. Let us suppose that $\boldsymbol{z}_2 \notin \mathcal{N}_{\epsilon}$ and $\boldsymbol{z}_1 \in \mathcal{N}_{\epsilon}$. There exists $\vct{z}(\lambda_0):=(\vct{h}(\lambda_0), \vct{x}(\lambda_0)) \in \mathcal{N}_{\epsilon}$ for some $\lambda_0 \in [0, 1]$ such that $\max_{1\leq i\leq s}\frac{\|\boldsymbol{h}_i\boldsymbol{x}_i^* - \boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*\|_F}{d_{i0}} = \epsilon$. Therefore, $\vct{z}(\lambda_0) \in \mathcal{N}_{\widetilde{F}}\cap\mathcal{N}_{\epsilon}$ and \prettyref{lem:betamu} implies $\max_{1\leq i\leq s}\frac{\|\boldsymbol{h}_i\boldsymbol{x}_i^* - \boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*\|_F}{d_{i0}} \leq \frac{9}{10}\epsilon$, which contradicts $\max_{1\leq i\leq s}\frac{\|\boldsymbol{h}_i\boldsymbol{x}_i^* - \boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*\|_F}{d_{i0}} = \epsilon$. \end{proof} \begin{lemma} \label{lem:induction} Let the stepsize $\eta \leq \frac{1}{C_L}$, $\boldsymbol{z}^{(t)} : = (\boldsymbol{u}^{(t)}, \boldsymbol{v}^{(t)})\in\mathbb{C}^{s(K + N)}$ and $C_L$ be the Lipschitz constant of $\nabla\widetilde{F}(\boldsymbol{z})$ over $\mathcal{N}_d \cap \mathcal{N}_{\mu} \cap \mathcal{N}_{\epsilon}$ in~\eqref{def:CL}. If $\boldsymbol{z}^{(t)}\in \mathcal{N}_{\epsilon} \cap \mathcal{N}_{\widetilde{F}}$, we have $\boldsymbol{z}^{(t+1)} \in \mathcal{N}_{\epsilon} \cap \mathcal{N}_{\widetilde{F}}$ and \begin{equation} \label{eq:decreasing2} \widetilde{F}(\boldsymbol{z}^{(t+1)}) \leq \widetilde{F}(\boldsymbol{z}^{(t)}) - \eta \|\nabla \widetilde{F}(\boldsymbol{z}^{(t)})\|^2 \end{equation} where $\boldsymbol{z}^{(t+1)} = \boldsymbol{z}^{(t)} - \eta\nabla\widetilde{F}(\boldsymbol{z}^{(t)}).$ \end{lemma} \begin{remark} This lemma tells us that once $\boldsymbol{z}^{(t)}\in\mathcal{N}_{\epsilon}\cap\mathcal{N}_{\widetilde{F}}$, the next iterate $\boldsymbol{z}^{(t+1)} = \boldsymbol{z}^{(t)} - \eta \nabla \widetilde{F}(\boldsymbol{z}^{(t)})$ is also inside $\mathcal{N}_{\epsilon}\cap\mathcal{N}_{\widetilde{F}}$ as long as the stepsize $\eta \leq \frac{1}{C_L}$. In other words, $\mathcal{N}_{\epsilon}\cap\mathcal{N}_{\widetilde{F}}$ is in fact a stronger version of the basin of attraction. Moreover, the objective function will decay sufficiently in each step as long as we can control the lower bound of the $\nabla \widetilde{F}$, which is guaranteed by the Local Regularity Condition~\ref{cond:rip}. \end{remark} \begin{proof} Let $\phi(\tau) := \widetilde{F}(\boldsymbol{z}^{(t)} - \tau \nabla \widetilde{F}(\boldsymbol{z}^{(t)}))$, $\phi(0) = \widetilde{F}(\boldsymbol{z}^{(t)})$ and consider the following quantity: \begin{equation*} \tau_{\max}: = \max \{\mu: \phi(\tau) \leq \widetilde{F}(\boldsymbol{z}^{(t)}), 0\leq\tau \leq \mu \}, \end{equation*} where $\tau_{\max}$ is the largest stepsize such that the objective function $\widetilde{F}(\boldsymbol{z})$ evaluated at any point over the whole line segment $\{\boldsymbol{z}^{(t)} -\tau \widetilde{F}(\boldsymbol{z}^{(t)}), 0\leq \tau\leq \tau_{\max}\}$ is not greater than $\widetilde{F}(\boldsymbol{z}^{(t)})$. Now we will show $\tau_{\max} \geq \frac{1}{C_L}$. Obviously, if $\|\nabla\widetilde{F}(\boldsymbol{z}^{(t)})\| = 0$, it holds automatically. Consider $\|\nabla\widetilde{F}(\boldsymbol{z}^{(t)})\|\neq 0$ and assume $\tau_{\max} < \frac{1}{C_L}$. First note that, \begin{equation*} \frac{\diff}{\diff \tau} \phi(\tau) < 0 \Longrightarrow\tau_{\max} > 0. \end{equation*} By the definition of $\tau_{\max}$, there holds $\phi(\tau_{\max}) = \phi(0)$ since $\phi(\tau)$ is a continuous function w.r.t. $\tau$. Lemma~\ref{lem:line_section} implies \begin{equation*} \{ \boldsymbol{z}^{(t)} - \tau \nabla\widetilde{F}(\boldsymbol{z}^{(t)}), 0\leq \tau \leq \tau_{\max} \} \subseteq \mathcal{N}_{\epsilon}\cap\mathcal{N}_{\widetilde{F}}. \end{equation*} Now we apply Lemma~\ref{lem:DSL}, the modified descent lemma, and obtain \begin{equation*} \widetilde{F}(\boldsymbol{z}^{(t)} - \tau_{\max}\nabla\widetilde{F}(\boldsymbol{z}^{(t)})) \leq \widetilde{F}(\boldsymbol{z}^{(t)}) - (2\tau_{\max} - C_L\tau_{\max}^2)\|\widetilde{F}(\boldsymbol{z}^{(t)})\|^2 \leq \widetilde{F}(\boldsymbol{z}^{(t)}) - \tau_{\max}\|\widetilde{F}(\boldsymbol{z}^{(t)})\|^2 \end{equation*} where $C_L\tau_{\max} \leq 1.$ In other words, $\phi(\tau_{\max}) \leq \widetilde{F}(\boldsymbol{z}^{(t)} - \tau_{\max}\nabla\widetilde{F}(\boldsymbol{z}^{(t)})) < \widetilde{F}(\boldsymbol{z}^{(t)}) = \phi(0)$ contradicts $\phi(\tau_{\max}) = \phi(0)$. Therefore, we conclude that $\tau_{\max} \geq \frac{1}{C_L}$. For any $\eta \leq \frac{1}{C_L}$, Lemma~\ref{lem:line_section} implies \begin{equation*} \{ \boldsymbol{z}^{(t)} - \tau \nabla\widetilde{F}(\boldsymbol{z}^{(t)}), 0\leq \tau \leq \eta \} \subseteq \mathcal{N}_{\epsilon}\cap\mathcal{N}_{\widetilde{F}} \end{equation*} and applying Lemma~\ref{lem:DSL} gives \begin{equation*} \widetilde{F}(\boldsymbol{z}^{(t)} - \eta \nabla\widetilde{F}(\boldsymbol{z}^{(t)})) \leq \widetilde{F}(\boldsymbol{z}^{(t)}) - (2\eta - C_L\eta^2)\|\widetilde{F}(\boldsymbol{z}^{(t)})\|^2 \leq \widetilde{F}(\boldsymbol{z}^{(t)}) - \eta\|\widetilde{F}(\boldsymbol{z}^{(t)})\|^2. \end{equation*} \end{proof} \subsection{Proof of Theorem~\ref{thm:main}} \label{s:mainthm} Combining all the considerations above, we now prove Theorem~\ref{thm:main} to conclude this section. \begin{proof The proof consists of three parts: \paragraph{Part I: Proof of $\boldsymbol{z}^{(0)} : = (\boldsymbol{u}^{(0)}, \boldsymbol{v}^{(0)}) \in \mathcal{N}_{\epsilon}\cap\mathcal{N}_{\widetilde{F}}$.} From the assumption of Theorem~\ref{thm:main}, \begin{equation*} \boldsymbol{z}^{(0)} \in \frac{1}{\sqrt{3}}\mathcal{N}_d \bigcap \frac{1}{\sqrt{3}}\mathcal{N}_{\mu}\cap \mathcal{N}_{\frac{2\varepsilon}{5\sqrt{s}\kappa}}. \end{equation*} First we show $G(\boldsymbol{u}^{(0)}, \boldsymbol{v}^{(0)}) = 0$: for $0\leq i\leq s$ and the definition of $\mathcal{N}_d$ and $\mathcal{N}_{\mu}$, \begin{equation*} \frac{\|\boldsymbol{u}^{(0)}_i\|^2}{2d_i} \leq \frac{2d_{i0}}{3d_i} < 1, \quad \frac{L|\boldsymbol{b}_l^* \boldsymbol{u}^{(0)}_i|^2}{8d_i\mu^2} \leq \frac{L}{8d_i\mu^2} \cdot\frac{16d_{i0}\mu^2}{3L} \leq \frac{2d_{i0}}{3d_i} < 1, \end{equation*} where $\|\boldsymbol{u}^{(0)}_i\| \leq \frac{2\sqrt{d_{i0}}}{\sqrt{3}}$, $\sqrt{L}\|\boldsymbol{B}\boldsymbol{u}^{(0)}_i\|_{\infty} \leq \frac{4 \sqrt{d_{i0}}\mu}{\sqrt{3}}$ and $\frac{9}{10}d_{i0} \leq d_i\leq \frac{11}{10}d_{i0}.$ Therefore $$G_0\left( \frac{\|\boldsymbol{u}^{(0)}_i\|^2}{2d_i}\right) = G_0\left( \frac{\|\boldsymbol{v}^{(0)}_i\|^2}{2d_i}\right) = G_0\left(\frac{L|\boldsymbol{b}_l^*\boldsymbol{u}_i^{(0)}|^2}{8d_i\mu^2}\right) = 0$$ for all $1\leq l\leq L$ and $G(\boldsymbol{u}^{(0)}, \boldsymbol{v}^{(0)}) = 0.$ For $\boldsymbol{z}^{(0)} = (\boldsymbol{u}^{(0)}, \boldsymbol{v}^{(0)})\in \mathcal{N}_{\frac{2\varepsilon}{5\sqrt{s}\kappa}}$, we have $\delta(\boldsymbol{z}^{(0)}) := \frac{\sqrt{\sum_{i=1}^s \delta_i^2d_{i0}^2 }}{d_0} \leq \frac{2\varepsilon}{5\sqrt{s}\kappa}.$ By~\eqref{eq:LUBD}, there holds $\delta(\boldsymbol{z}^{(0)}) \leq \frac{2\varepsilon}{5\sqrt{s}\kappa}$ and $G(\boldsymbol{u}^{(0)}, \boldsymbol{v}^{(0)}) = 0$, \begin{equation*} \widetilde{F}(\boldsymbol{u}^{(0)}, \boldsymbol{v}^{(0)}) = F(\boldsymbol{u}^{(0)}, \boldsymbol{v}^{(0)}) \leq \|\boldsymbol{e}\|^2 + \frac{3}{2}\delta^2(\boldsymbol{z}^{(0)})d_0^2 + \frac{\varepsilon \delta(\boldsymbol{z}^{(0)}) d_0^2}{5\sqrt{s}\kappa} \leq \|\boldsymbol{e}\|^2 + \frac{\varepsilon^2 d_0^2}{3s\kappa^2} \end{equation*} and hence $\boldsymbol{z}^{(0)} = (\boldsymbol{u}^{(0)}, \boldsymbol{v}^{(0)})\in \mathcal{N}_{\epsilon}\bigcap \mathcal{N}_{\widetilde{F}}.$ \paragraph{Part II: The linear convergence of the objective function $\widetilde{F}(\boldsymbol{z}^{(t)})$.} Denote $\boldsymbol{z}^{(t)} : = (\boldsymbol{u}^{(t)}, \boldsymbol{v}^{(t)}).$ Note that $\boldsymbol{z}^{(0)}\in\mathcal{N}_{\epsilon}\cap\mathcal{N}_{\widetilde{F}}$, Lemma~\ref{lem:induction} implies $\boldsymbol{z}^{(t)}\in \mathcal{N}_{\epsilon}\cap\mathcal{N}_{\widetilde{F}}$ for all $t\geq 0$ by induction if $\eta \leq \frac{1}{C_L}$. Moreover, combining Condition~\ref{cond:reg} with Lemma~\ref{lem:induction} leads to \begin{equation*} \widetilde{F}(\boldsymbol{z}^{(t )}) \leq \widetilde{F}(\boldsymbol{z}^{(t-1)}) - \eta\omega \left[ \widetilde{F}(\boldsymbol{z}^{(t-1)}) - c \right]_+, \quad t\geq 1 \end{equation*} with $c = \|\boldsymbol{e}\|^2 + a\|\mathcal{A}^*(\boldsymbol{e})\|^2$ and $a = 2000s$. Therefore, by induction, we have \begin{equation*} \left[ \widetilde{F}(\boldsymbol{z}^{(t)}) - c\right]_+ \leq (1 - \eta\omega) \left[ \widetilde{F}(\boldsymbol{z}^{(t-1)}) - c \right]_+ \leq \left(1 - \eta\omega\right)^t \left[ \widetilde{F}(\boldsymbol{z}^{(0)}) - c\right]_+ \leq \frac{\varepsilon^2 d_0^2}{3s\kappa^2} (1 - \eta\omega)^{t} \end{equation*} where $\widetilde{F}(\boldsymbol{z}^{(0)}) \leq \frac{\varepsilon^2d_0^2}{3s\kappa^2} + \|\boldsymbol{e}\|^2$ and $\left[ \widetilde{F}(\boldsymbol{z}^{(0)}) - c \right]_+ \leq \left[ \frac{1}{3s\kappa^2}\varepsilon^2 d_0^2 - a\|\mathcal{A}^*(\boldsymbol{e})\|^2 \right]_+ \leq \frac{\varepsilon^2 d_0^2}{3s\kappa^2}.$ Now we conclude that $\left[ \widetilde{F}(\boldsymbol{z}^{(t)}) - c\right]_+$ converges to $0$ linearly. \paragraph{Part III: The linear convergence of the iterates $(\boldsymbol{u}^{(t)}, \boldsymbol{v}^{(t)})$.} Denote \begin{equation*} \delta(\boldsymbol{z}^{(t)}) : = \frac{\|\mathcal{H}(\boldsymbol{u}^{(t)}, \boldsymbol{v}^{(t)}) - \mathcal{H}(\boldsymbol{h}_0,\boldsymbol{x}_0)\|_F}{d_0}. \end{equation*} Note that $\boldsymbol{z}^{(t)}\in \mathcal{N}_{\epsilon}\cap\mathcal{N}_{\widetilde{F}}\subseteq \mathcal{N}_d \cap \mathcal{N}_{\mu} \cap \mathcal{N}_{\epsilon}$ and over $\mathcal{N}_d \cap \mathcal{N}_{\mu} \cap \mathcal{N}_{\epsilon}$, there holds $F_0(\boldsymbol{z}^{(t)}) \geq \frac{2}{3}\delta^2(\boldsymbol{z}^{(t)})d_0^2$ which follows from Local RIP Condition in~\eqref{eq:rip} and $F_0(\boldsymbol{z}^{(t)})$ defined in~\eqref{def:F0}. Moreover \begin{eqnarray*} \widetilde{F}(\boldsymbol{z}^{(t)}) - \|\boldsymbol{e}\|^2 & \geq & F_0(\boldsymbol{z}^{(t)}) - 2\Real\left(\langle \mathcal{A}^*(\boldsymbol{e}), \mathcal{H}(\boldsymbol{u}^{(0)}, \boldsymbol{v}^{(0)}) - \mathcal{H}(\boldsymbol{h}_0, \boldsymbol{x}_0) \rangle\right) \\ & \geq & \frac{2}{3} \delta^2(\boldsymbol{z}^{(t)})d_0^2 - 2\sqrt{2s}\|\mathcal{A}^*(\boldsymbol{e})\| \delta(\boldsymbol{z}^{(t)})d_0 \end{eqnarray*} where $G(\boldsymbol{z}^{(t)}) \geq 0$ and the second inequality follows from~\eqref{eq:cross}. There holds \begin{equation*} \frac{2}{3} \delta^2(\boldsymbol{z}^{(t)})d_0^2 - 2\sqrt{2s}\|\mathcal{A}^*(\boldsymbol{e})\| \delta(\boldsymbol{z}^{(t)})d_0 - a\|\mathcal{A}^*(\boldsymbol{e})\|^2 \leq \left[ \widetilde{F}(\boldsymbol{z}^{(t)}) - c \right]_+ \leq \frac{ \varepsilon^2 d_0^2}{3s\kappa^2}(1 - \eta\omega)^t \end{equation*} and equivalently, \begin{equation*} \left|\delta(\boldsymbol{z}^{(t)})d_0 - \frac{3\sqrt{2}}{2} \|\mathcal{A}^*(\boldsymbol{e})\| \right|^2 \leq \frac{\varepsilon^2 d_0^2}{2s\kappa^2} (1 - \eta\omega)^t + \left(\frac{3}{2}a + \frac{9}{2}\right)\|\mathcal{A}^*(\boldsymbol{e})\|^2. \end{equation*} Solving the inequality above for $\delta(\boldsymbol{z}^{(t)})$, we have \begin{eqnarray} \delta(\boldsymbol{z}^{(t)}) d_0 & \leq & \frac{\varepsilon d_0}{\sqrt{2s\kappa^2}}(1 - \eta\omega)^{t/2} +\left(\frac{3\sqrt{2}}{2} + \sqrt{\frac{3}{2}a + \frac{9}{2}} \right)\|\mathcal{A}^*(\boldsymbol{e})\| \nonumber \\ & \leq & \frac{\varepsilon d_0}{\sqrt{2s\kappa^2}}(1 - \eta\omega)^{t/2} + 60\sqrt{s} \|\mathcal{A}^*(\boldsymbol{e})\| \label{eq:main-res-2} \end{eqnarray} where $a = 2000s.$ Let $d^{(t)} : = \sqrt{\sum_{i=1}^s \|\boldsymbol{u}_i^{(t)}\|^2\|\boldsymbol{v}_i^{(t)}\|^2 }$ for $t\in\mathbb{Z}_{\geq 0}.$ By~\eqref{eq:main-res-2} and triangle inequality, we immediately obtain $|d^{(t)} - d_0| \leq \frac{\varepsilon d_0}{\sqrt{2s\kappa^2}}(1 - \eta\omega)^{t/2} + 60\sqrt{s} \|\mathcal{A}^*(\boldsymbol{e})\|.$ \end{proof} \section{Proof of the four conditions} This section is devoted to proving the four key conditions introduced in Section~\ref{s:converge}. The~\emph{local smoothness condition} and the~\emph{robustness condition} are relatively less challenging to deal with. The more difficult part is to show the~\emph{local regularity condition} and the~\emph{local isometry property}. The key to solve those problems is to understand how the vector-valued linear operator $\mathcal{A}$ in~\eqref{def:A} behaves on block-diagonal matrices, such as $\mathcal{H}(\boldsymbol{h},\boldsymbol{x})$, $\mathcal{H}(\boldsymbol{h}_0,\boldsymbol{x}_0)$ and $\mathcal{H}(\boldsymbol{h},\boldsymbol{x}) - \mathcal{H}(\boldsymbol{h}_0,\boldsymbol{x}_0).$ In particular, when $s=1$, all those matrices become rank-1 matrices, which have been well discussed in our previous work~\cite{LLSW16}. \vskip0.25cm First of all, we define the linear subspace $T_i\subset\mathbb{C}^{K\times N}$ along with its orthogonal complement for $1\leq i\leq s$ as \begin{eqnarray}\label{def:T} \begin{split} T_i & := \{ \boldsymbol{Z}_i\in\mathbb{C}^{K\times N} : \boldsymbol{Z}_i = \boldsymbol{h}_{i0}\boldsymbol{v}_i^* + \boldsymbol{u}_i\boldsymbol{x}_{i0}^*, \quad \boldsymbol{u}_i\in\mathbb{C}^K,\boldsymbol{v}_i\in\mathbb{C}^N \}, \\ T^{\bot}_i & := \left\{ \left(\boldsymbol{I}_K - \frac{\boldsymbol{h}_{i0}\boldsymbol{h}_{i0}^*}{d_{i0}}\right) \boldsymbol{Z}_i \left(\boldsymbol{I}_N - \frac{\boldsymbol{x}_{i0}\boldsymbol{x}_{i0}^*}{d_{i0}}\right) :\boldsymbol{Z}_i\in\mathbb{C}^{K\times N} \right\} \end{split} \end{eqnarray} where $\|\boldsymbol{h}_{i0}\| = \|\boldsymbol{x}_{i0}\| = \sqrt{d_{i0}}.$ In particular, $\boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^* \in T_i$ for all $1\leq i\leq s$. \vskip0.25cm The proof also requires us to consider block-diagonal matrices whose $i$-th block belongs to $T_i$ (or $T^{\bot}_i$). Let $\boldsymbol{Z} = \blkdiag(\boldsymbol{Z}_1,\cdots,\boldsymbol{Z}_s)\in\mathbb{C}^{Ks\times Ns}$ be a block-diagonal matrix and say $\boldsymbol{Z}\in T$ if \begin{equation*} T := \{ \text{blkdiag}(\{\boldsymbol{Z}_i\}_{i=1}^s) | \boldsymbol{Z}_i\in T_i \} \end{equation*} and $\boldsymbol{Z}\inT^{\bot}$ if \begin{equation*} T^{\bot} := \{ \text{blkdiag}(\{\boldsymbol{Z}_i\}_{i=1}^s) | \boldsymbol{Z}_i\in T^{\bot}_i \} \end{equation*} where both $T$ and $T^{\bot}$ are subsets in $\mathbb{C}^{Ks\times Ns}$ and $\mathcal{H}(\boldsymbol{h}_0,\boldsymbol{x}_0)\in T.$ \vskip0.25cm Now we take a closer look at a special case of block-diagonal matrices, i.e., $\mathcal{H}(\boldsymbol{h}, \boldsymbol{x})$ and calculate its projection onto $T$ and $T^{\bot}$ respectively and it suffices to consider $\mathcal{P}_{T_i}(\boldsymbol{h}_i\boldsymbol{x}_i^*)$ and $\mathcal{P}_{T^{\bot}_i}(\boldsymbol{h}_i\boldsymbol{x}_i^*)$. For each block $\boldsymbol{h}_i\boldsymbol{x}_i^*$ and $1\leq i\leq s$, there are unique orthogonal decompositions \begin{equation}\label{eq:orth} \boldsymbol{h}_i := \alpha_{i1} \boldsymbol{h}_{i0} + \tilde{\boldsymbol{h}}_i, \quad \boldsymbol{x} := \alpha_{i2} \boldsymbol{x}_{i0} + \tilde{\boldsymbol{x}}_i, \end{equation} where $\boldsymbol{h}_{i0} \perp \tilde{\boldsymbol{h}}_i$ and $\boldsymbol{x}_{i0} \perp \tilde{\boldsymbol{x}}_i$. It is important to note that $\alpha_{i1} = \alpha_{i1}(\boldsymbol{h}_i) = \frac{\langle \boldsymbol{h}_{i0}, \boldsymbol{h}_i\rangle}{d_{i0}}$ and $\alpha_{i2} = \alpha_{i2}(\boldsymbol{x}_i) = \frac{\langle \boldsymbol{x}_{i0}, \boldsymbol{x}_i\rangle}{d_{i0}}$ and thus $\alpha_{i1}$ and $\alpha_{i2}$ are functions of $\boldsymbol{h}_i$ and $\boldsymbol{x}_i$ respectively. Immediately, we have the following matrix orthogonal decomposition for $\boldsymbol{h}_i\boldsymbol{x}_i^*$ onto $T_i$ and $T^{\bot}_i$, \begin{equation}\label{eq:decomposition} \boldsymbol{h}_i\boldsymbol{x}_i^* - \boldsymbol{h}_{i0} \boldsymbol{x}_{i0}^* = \underbrace{(\alpha_{i1} \overline{\alpha_{i2}} - 1)\boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^* + \overline{\alpha_{i2}} \tilde{\boldsymbol{h}}_i \boldsymbol{x}_{i0}^* + \alpha_{i1} \boldsymbol{h}_{i0} \tilde{\boldsymbol{x}}_i^*}_{\text{belong to } T_i} + \underbrace{\tilde{\boldsymbol{h}}_i \tilde{\boldsymbol{x}}_i^*}_{\text{belongs to }T^{\bot}_i} \end{equation} where the first three components are in $T_i$ while $\tilde{\boldsymbol{h}}_i\tilde{\boldsymbol{x}}_i^*\in T^{\bot}_i$. \subsection{Key lemmata} From the decomposition in~\eqref{eq:orth} and~\eqref{eq:decomposition}, we want to analyze how $\|\tilde{\boldsymbol{h}}_i\|$, $\|\tilde{\boldsymbol{x}}_i\|$, $\alpha_{i1}$ and $\alpha_{i2}$ depend on $\delta_i = \frac{\|\boldsymbol{h}_i\boldsymbol{x}_i^* - \boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*\|_F}{d_{i0}}$ if $\delta_i < 1$. The following lemma answers this question, which can be viewed as an application of singular value/vector perturbation theory~\cite{Wedin72} applied to rank-1 matrices. From the lemma below, we can see that if $\boldsymbol{h}_i\boldsymbol{x}_i^*$ is close to $\boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*$, then $\mathcal{P}_{T^{\bot}_i}(\boldsymbol{h}_i\boldsymbol{x}_i^*)$ is in fact very small (of order ${\cal O}(\delta_i^2 d_{i0})$). \begin{lemma}{\bf (Lemma 5.9 in~\cite{LLSW16})} \label{lem:orth_decomp} Recall that $\|\boldsymbol{h}_{i0}\| = \|\boldsymbol{x}_{i0}\| = \sqrt{d_{i0}}$. If $\delta_i := \frac{\|\boldsymbol{h}_i\boldsymbol{x}_i^* - \boldsymbol{h}_{i0} \boldsymbol{x}_{i0}^*\|_F}{d_{i0}}<1$, we have the following useful bounds \[ |\alpha_{i1}|\leq \frac{\|\boldsymbol{h}_i\|}{\|\boldsymbol{h}_{i0}\|}, \quad |\alpha_{i1}\overline{\alpha_{i2}} - 1|\leq \delta_i, \] and \[ \|\tilde{\boldsymbol{h}}_{i}\| \leq \frac{\delta_i}{1 - \delta_i}\|\boldsymbol{h}_i\|,\quad \|\tilde{\boldsymbol{x}}_i\| \leq \frac{\delta_i}{1 - \delta_i}\|\boldsymbol{x}_i\|,\quad \|\tilde{\boldsymbol{h}}_i\| \|\tilde{\boldsymbol{x}}_i\| \leq \frac{\delta_i^2}{2(1 - \delta_i)} d_{i0}. \] Moreover, if $\|\boldsymbol{h}_i\| \leq 2\sqrt{d_{i0}}$ and $\sqrt{L}\|\mtx{B} \boldsymbol{h}_i\|_\infty \leq 4\mu \sqrt{d_{i0}}$, i.e., $\boldsymbol{h}_i\in\mathcal{N}_d\bigcap\mathcal{N}_{\mu}$, we have $\sqrt{L}\|\mtx{B}_i \tilde{\boldsymbol{h}}_i\|_\infty \leq 6 \mu \sqrt{d_{i0}}$. \end{lemma} Now we start to focus on several results related to the linear operator $\mathcal{A}$. \begin{lemma}{\bf (Operator norm of $\mathcal{A}$).}\label{lem:A-UPBD} For $\mathcal{A}$ defined in~\eqref{def:A}, there holds \begin{equation}\label{eq:A-UPBD} \|\mathcal{A}\| \leq \sqrt{s(N\log(NL/2) + (\gamma+\log s)\log L)} \end{equation} with probability at least $1 - L^{-\gamma}.$ \end{lemma} \begin{proof} Note that $\mathcal{A}_i(\boldsymbol{Z}_i) : = \{\boldsymbol{b}_l^*\boldsymbol{Z}_i\boldsymbol{a}_{il}\}_{l=1}^L$ in~\eqref{def:Ai}. Lemma 1 in~\cite{RR12} implies \begin{equation*} \|\mathcal{A}_i\| \leq \sqrt{N\log(NL/2) + \gamma'\log L} \end{equation*} with probability at least $1 - L^{-\gamma'}.$ By taking the union bound over $1\leq i\leq s$, \begin{equation*} \max\|\mathcal{A}_i\| \leq \sqrt{N\log(NL/2) + (\gamma+ \log s)\log L} \end{equation*} with probability at least $1 - sL^{-\gamma-\log s} \geq 1 - L^{-\gamma}.$ \vskip0.25cm For $\mathcal{A}$ defined in~\eqref{def:A}, applying the triangle inequality gives \begin{align*} \|\mathcal{A}(\boldsymbol{Z})\| & = \left\|\sum_{i=1}^s \mathcal{A}_i(\boldsymbol{Z}_i)\right\| \leq \sum_{i=1}^s \|\mathcal{A}_i\|\|\boldsymbol{Z}_i\|_F \leq \max_{1\leq i\leq s} \|\mathcal{A}_i\| \sqrt{s \sum_{i=1}^s \|\boldsymbol{Z}_i\|_F^2} = \sqrt{s}\max_{1\leq i\leq s} \|\mathcal{A}_i\| \|\boldsymbol{Z}\|_F \end{align*} where $\boldsymbol{Z} = \blkdiag(\boldsymbol{Z}_1,\cdots, \boldsymbol{Z}_s)\in\mathbb{C}^{Ks\times Ns}.$ Therefore, \begin{equation*} \|\mathcal{A}\| \leq \sqrt{s}\max_{1\leq i\leq s}\|\mathcal{A}_i\| \leq \sqrt{ s(N\log(NL/2) + (\gamma+\log s)\log L)} \end{equation*} with probability at least $1 - L^{-\gamma}$. \end{proof} \vskip0.25cm \begin{lemma}{\bf (Restricted isometry property for $\mathcal{A}$ on $T$).} \label{lem:ripu} The linear operator $\mathcal{A}$ restricted on $T$ is well-conditioned, i.e., \begin{equation}\label{eq:RIP-AT} \|\mathcal{P}_T\mathcal{A}^*\mathcal{A}\mathcal{P}_T - \mathcal{P}_T\| \leq \frac{1}{10} \end{equation} where $\mathcal{P}_T$ is the projection operator from $\mathbb{C}^{Ks\times Ns}$ onto $T$, given $L \geq C_{\gamma}s^2 \max\{K, \mu_h^2 N\}\log^2L$ with probability at least $1 - L^{-\gamma}.$ \end{lemma} \begin{remark} Here $\mathcal{A}\mathcal{P}_{T}$ and $\mathcal{P}_T\mathcal{A}^*$ are defined as \begin{equation*} \mathcal{A}\mathcal{P}_T(\boldsymbol{Z}) = \sum_{i=1}^s \mathcal{A}_i(\mathcal{P}_{T_i}(\boldsymbol{Z}_i)), \quad\mathcal{P}_T\mathcal{A}^*(\boldsymbol{z}) = \blkdiag( \mathcal{P}_{T_1}(\mathcal{A}_1^*(\boldsymbol{z})), \cdots, \mathcal{P}_{T_s}(\mathcal{A}_s^*(\boldsymbol{z})) ) \end{equation*} respectively where $\boldsymbol{Z}$ is a block-diagonal matrix and $\boldsymbol{z}\in\mathbb{C}^L.$ \end{remark} As shown in the remark above, the proof of Lemma~\ref{lem:ripu} depends on the properties of both $\mathcal{P}_{T_i}\mathcal{A}_i^*\mathcal{A}_i\mathcal{P}_{T_i}$ and $\mathcal{P}_{T_i}\mathcal{A}_i^*\mathcal{A}_j\mathcal{P}_{T_j}$ for $i\neq j$. Fortunately, we have already proven related results in~\cite{LS17b} which are written as follows: \begin{lemma}[\bf Inter-user incoherence, Corollary 5.3 and 5.8 in~\cite{LS17b}] There hold \begin{equation}\label{eq:AT1} \|\mathcal{P}_{T_i} \mathcal{A}_i^*\mathcal{A}_j\mathcal{P}_{T_j}\| \leq \frac{1}{10s}, \quad \forall i\neq j; \qquad \|\mathcal{P}_{T_i} \mathcal{A}_i^*\mathcal{A}_i\mathcal{P}_{T_i} - \mathcal{P}_{T_i}\| \leq \frac{1}{10s}, \quad\forall 1\leq i\leq s \end{equation} with probability at least $1 - L^{-\gamma+1}$ if $L\geq C_{\gamma}s^2\max\{K, \mu^2_hN\}\log^2L\log(s+1).$ \end{lemma} Note that $\|\mathcal{P}_{T_i} \mathcal{A}_i^*\mathcal{A}_j\mathcal{P}_{T_j}\| \leq \frac{1}{10s}$ holds because of independence between each individual random Gaussian matrix $\boldsymbol{A}_i$. In particular, if $s=1$, the inter-user incoherence $\|\mathcal{P}_{T_i} \mathcal{A}_i^*\mathcal{A}_j\mathcal{P}_{T_j}\| \leq \frac{1}{10s}$ is not needed at all. With~\eqref{eq:AT1}, it is easy to prove Lemma~\ref{lem:ripu}. \begin{proof}[\bf Proof of Lemma~\ref{lem:ripu}] For any block diagonal matrix $\boldsymbol{Z} = \blkdiag(\boldsymbol{Z}_1, \cdots,\boldsymbol{Z}_s)\in\mathbb{C}^{Ks\times Ns}$ and $\boldsymbol{Z}_i\in\mathbb{C}^{K\times N}$, \begin{align} \langle \boldsymbol{Z}, \mathcal{P}_T\mathcal{A}^*\mathcal{A}\mathcal{P}_T(\boldsymbol{Z}) - \mathcal{P}_T(\boldsymbol{Z})\rangle & = \sum_{1\leq i,j\leq s} \langle \mathcal{A}_i\mathcal{P}_{T_i}(\boldsymbol{Z}_i), \mathcal{A}_j\mathcal{P}_{T_j}(\boldsymbol{Z}_j)\rangle - \|\mathcal{P}_T(\boldsymbol{Z})\|_F^2 \nonumber \\ & = \sum_{i=1}^s \langle \boldsymbol{Z}_i, \mathcal{P}_{T_i}\mathcal{A}_i^*\mathcal{A}_i\mathcal{P}_{T_i}(\boldsymbol{Z}_i) - \mathcal{P}_{T_i}(\boldsymbol{Z}_i)\rangle + \sum_{i\neq j} \langle \mathcal{A}_i\mathcal{P}_{T_i}(\boldsymbol{Z}_i), \mathcal{A}_j\mathcal{P}_{T_j}(\boldsymbol{Z}_j)\rangle. \label{eq:TAAT2} \end{align} Using~\eqref{eq:AT1}, the following two inequalities hold, \begin{align*} |\langle \boldsymbol{Z}_i, \mathcal{P}_{T_i}\mathcal{A}_i^*\mathcal{A}_i\mathcal{P}_{T_i}(\boldsymbol{Z}_i) - \mathcal{P}_{T_i}(\boldsymbol{Z}_i)\rangle| & \leq \|\mathcal{P}_{T_i}\mathcal{A}_i^*\mathcal{A}_i\mathcal{P}_{T_i} - \mathcal{P}_{T_i} \| \|\boldsymbol{Z}_i\|_F^2 \leq \frac{\|\boldsymbol{Z}_i\|^2_F}{10s}, \\ |\langle \mathcal{A}_i\mathcal{P}_{T_i}(\boldsymbol{Z}_i), \mathcal{A}_j\mathcal{P}_{T_j}(\boldsymbol{Z}_j)\rangle| & \leq \|\mathcal{P}_{T_i}\mathcal{A}_i^*\mathcal{A}_j\mathcal{P}_{T_j} \| \|\boldsymbol{Z}_i\|_F\|\boldsymbol{Z}_j\|_F \leq \frac{\|\boldsymbol{Z}_i\|_F\|\boldsymbol{Z}_j\|_F}{10s}. \end{align*} After substituting both estimates into~\eqref{eq:TAAT2}, we have \begin{equation*} |\langle \boldsymbol{Z}, \mathcal{P}_T\mathcal{A}^*\mathcal{A}\mathcal{P}_T(\boldsymbol{Z}) - \mathcal{P}_T(\boldsymbol{Z})\rangle| \leq \sum_{1\leq i, j\leq s} \frac{ \|\boldsymbol{Z}_i\|_F\|\boldsymbol{Z}_j\|_F }{10s} \leq \frac{1}{10s}\left(\sum_{i=1}^s \|\boldsymbol{Z}_i\|_F\right)^2 \leq \frac{\|\boldsymbol{Z}\|_F^2}{10}. \end{equation*} \end{proof} Finally, we show how $\mathcal{A}$ behaves when applied to block-diagonal matrices $\boldsymbol{X} = \mathcal{H}(\boldsymbol{h},\boldsymbol{x})$. In particular, the calculations will be much simplified for the case $s=1$. \begin{lemma}{(\bf $\mathcal{A}$ restricted on block-diagonal matrices with rank-1 blocks).} \label{lem:key} \noindent Consider $\boldsymbol{X} = \mathcal{H}(\boldsymbol{h}, \boldsymbol{x})$ and \begin{equation}\label{eq:sigmamax} \sigma^2_{\max}(\boldsymbol{h}, \boldsymbol{x}) := \max_{1\leq l\leq L} \sum_{i=1}^s |\boldsymbol{b}^*_l\boldsymbol{h}_i|^2 \|\boldsymbol{x}_i\|^2. \end{equation} Conditioned on~\eqref{eq:A-UPBD}, we have \begin{equation}\label{eq:AX-rank} \|\mathcal{A}(\boldsymbol{X})\|^2 \leq \frac{4}{3} \|\boldsymbol{X}\|_F^2+ 2 \sqrt{2s\|\boldsymbol{X}\|_F^2 \sigma^2_{\max}(\boldsymbol{h}, \boldsymbol{x})(K+N)\log L} + 8s\sigma^2_{\max}(\boldsymbol{h}, \boldsymbol{x})(K+N) \log L, \end{equation} uniformly for any $\boldsymbol{h}\in\mathbb{C}^{Ks}$ and $\boldsymbol{x}\in\mathbb{C}^{Ns}$ with probability at least $1 - \frac{1}{\gamma}\exp(-s(K+N))$ if $L\geq C_{\gamma}s(K+N)\log L$. Here $ \|\boldsymbol{X}\|_F^2= \|\mathcal{H}(\boldsymbol{h}, \boldsymbol{x})\|_F^2 = \sum_{i=1}^s \|\boldsymbol{h}_i\|^2\|\boldsymbol{x}_i\|^2.$ \end{lemma} \begin{remark} Here are a few more explanations and facts about $\sigma^2_{\max}(\boldsymbol{h},\boldsymbol{x})$. Note that $\|\mathcal{A}(\boldsymbol{X})\|^2$ is the sum of $L$ sub-exponential~\footnote{For the definition and properties of sub-exponential random variables, the readers can find all relevant information in~\cite{Ver10}.} random variables, i.e., \begin{equation}\label{eq:AX} \|\mathcal{A}(\boldsymbol{X})\|^2 = \sum_{l=1}^L \left|\sum_{i=1}^s \boldsymbol{b}_l^*\boldsymbol{h}_i \boldsymbol{x}_i^*\boldsymbol{a}_{il}\right|^2. \end{equation} Here $\sigma^2_{\max}(\boldsymbol{h}, \boldsymbol{x})$ corresponds to the largest expectation of all those components in $\|\mathcal{A}(\boldsymbol{X})\|^2$. For $\sigma^2_{\max}(\boldsymbol{h}, \boldsymbol{x})$, without loss of generality, we assume $\|\boldsymbol{x}_i\| = 1$ for $1\leq i\leq s$ and let $\boldsymbol{h}\in\mathbb{C}^{Ks}$ be a unit vector, i.e., $\|\boldsymbol{h}\|^2 = \sum_{i=1}^s \|\boldsymbol{h}_i\|^2= 1$. The bound \begin{equation}\label{eq:sigma-lb} \frac{1}{L} \leq \sigma^2_{\max}(\boldsymbol{h}, \boldsymbol{x}) \leq \frac{K}{L} \end{equation} follows from $L \sigma^2_{\max}(\boldsymbol{h}, \boldsymbol{x}) \geq \sum_{l=1}^L \sum_{i=1}^s |\boldsymbol{b}_l^*\boldsymbol{h}_i|^2 = \|\boldsymbol{h}\|^2=1.$ Moreover, $\sigma_{\max}^2(\boldsymbol{h},\boldsymbol{x})$ and $\sigma_{\max}(\boldsymbol{h},\boldsymbol{x})$ are both Lipschitz functions w.r.t. $\boldsymbol{h}.$ Now we want to determine their Lipschitz constants. First note that for $\|\boldsymbol{x}_i\| = 1$, $\sigma_{\max}(\boldsymbol{h},\boldsymbol{x})$ equals \begin{equation*} \sigma_{\max}(\boldsymbol{h}, \boldsymbol{x}) = \max_{1\leq l\leq L} \|(\boldsymbol{I}_s\otimes \boldsymbol{b}_l^*)\boldsymbol{h}\| \end{equation*} where $\otimes$ denotes Kronecker product. Let $\boldsymbol{u}\in\mathbb{C}^{Ks}$ be another unit vector and we have \begin{align} |\sigma_{\max}(\boldsymbol{h}, \boldsymbol{x}) - \sigma_{\max}(\boldsymbol{u}, \boldsymbol{x})| & = \left| \max_{1\leq l\leq L} \|(\boldsymbol{I}_s\otimes \boldsymbol{b}_l^*)\boldsymbol{h} - \max_{1\leq l\leq L} \|(\boldsymbol{I}_s\otimes \boldsymbol{b}_l^*)\boldsymbol{u}\| \right| \nonumber \\ & = \max_{1\leq l\leq L} \left| \|(\boldsymbol{I}_s\otimes \boldsymbol{b}_l^*) \boldsymbol{h}\| - \|(\boldsymbol{I}_s\otimes \boldsymbol{b}_l^*) \boldsymbol{u}\| \right| \nonumber \\ & \leq \max_{1\leq l\leq L} \|(\boldsymbol{I}_s\otimes \boldsymbol{b}_l^*) (\boldsymbol{h} - \boldsymbol{u})\| \leq \|\boldsymbol{h}-\boldsymbol{u}\| \label{eq:Lips-sigma} \end{align} where $\|\boldsymbol{I}_s\otimes \boldsymbol{b}_l^*\| = \|\boldsymbol{b}_l\| \sqrt{\frac{K}{L}} < 1.$ For $\sigma^2_{\max}(\boldsymbol{h},\boldsymbol{x}),$ \begin{align} |\sigma^2_{\max}(\boldsymbol{h}, \boldsymbol{x}) - \sigma^2_{\max}(\boldsymbol{u}, \boldsymbol{x})| & \leq (\sigma_{\max}(\boldsymbol{h}, \boldsymbol{x}) + \sigma_{\max}(\boldsymbol{u}, \boldsymbol{x})) \cdot |\sigma_{\max}(\boldsymbol{h}, \boldsymbol{x}) - \sigma_{\max}(\boldsymbol{u}, \boldsymbol{x})| \nonumber \\ & \leq \frac{2K}{L}\|\boldsymbol{h}-\boldsymbol{u}\| \leq 2\|\boldsymbol{h}-\boldsymbol{u}\|. \label{eq:Lips-sigmasq} \end{align} \end{remark} \begin{proof}[{\bf Proof of Lemma~\ref{lem:key}}] Without loss of generality, let $\|\boldsymbol{x}_i\| = 1$ and $\sum_{i=1}^s \|\boldsymbol{h}_i\|^2 = 1$. It suffices to prove $f(\boldsymbol{h}, \boldsymbol{x}) \leq \frac{4}{3}$ for all $(\boldsymbol{h}, \boldsymbol{x})\in\mathbb{C}^{Ks}\times\mathbb{C}^{Ns}$ in~\eqref{def:hx} where $f(\boldsymbol{h}, \boldsymbol{x})$ is defined as \begin{equation*} f(\boldsymbol{h}, \boldsymbol{x}) := \|\mathcal{A}(\boldsymbol{X})\|^2 - 2 \sqrt{2s \sigma^2_{\max}(\boldsymbol{h}, \boldsymbol{x})(K+N)\log L} - 8s\sigma^2_{\max}(\boldsymbol{h}, \boldsymbol{x})(K+N) \log L. \end{equation*} \paragraph{Part I: Bounds of $\|\mathcal{A}(\boldsymbol{X})\|^2$ for any fixed $(\boldsymbol{h},\boldsymbol{x})$.} From~\eqref{eq:AX}, we already know that $Y = \|\mathcal{A}(\boldsymbol{X})\|_F^2 = \sum_{i=1}^{2L} c_i\xi_i^2$ where $\{\xi_i\}$ are i.i.d. $\chi^2_1$ random variables and $\boldsymbol{c} = (c_1, \cdots, c_{2L})^T\in \mathbb{R}^{2L}$. More precisely, we can determine $\{c_i\}_{i=1}^{2L}$ as \begin{equation*} \left| \sum_{i=1}^s \boldsymbol{b}_l^*\boldsymbol{h}_i\boldsymbol{x}^*\boldsymbol{a}_{il}\right|^2 = c_{2l-1} \xi_{2l-1}^2 + c_{2l}\xi_{2l}^2,\quad c_{2l-1} = c_{2l} = \frac{1}{2}\sum_{i=1}^s |\boldsymbol{b}_l^*\boldsymbol{h}_i|^2 \end{equation*} because $\sum_{i=1}^s \boldsymbol{b}^*_l\boldsymbol{h}_i \boldsymbol{x}_i^*\boldsymbol{a}_{il} \sim \mathcal{C}\mathcal{N}\left(0, \sum_{i=1}^s |\boldsymbol{b}^*_l \boldsymbol{h}_i|^2\right)$. By the Bernstein inequality, there holds \begin{equation}\label{ineq:bern} \mathbb{P}(Y - \mathbb{E}(Y) \geq t) \leq \exp\left(- \frac{t^2}{8\|\vct{c}\|^2}\right) \vee \exp\left(- \frac{t}{8\|\vct{c}\|_\infty}\right) \end{equation} where $\E(Y) = \|\boldsymbol{X}\|_F^2 = 1.$ In order to apply the Bernstein inequality, we need to estimate $\|\boldsymbol{c}\|^2$ and $\|\boldsymbol{c}\|_{\infty}$ as follows, \begin{align*} \|\boldsymbol{c}\|_{\infty} & = \frac{1}{2}\max_{1\leq l\leq L}\sum_{i=1}^s|\boldsymbol{b}^*_l\boldsymbol{h}_i|^2 = \frac{1}{2} \sigma^2_{\max}(\boldsymbol{h}, \boldsymbol{x}), \\ \|\boldsymbol{c}\|_2^2 & = \frac{1}{2}\sum_{l=1}^L \left|\sum_{i=1}^s|\boldsymbol{b}^*_l\boldsymbol{h}_i|^2 \right|^2 \leq \frac{1}{2}\left( \sum_{i=1}^s\sum_{l=1}^L|\boldsymbol{b}^*_l\boldsymbol{h}_i|^2 \right)\max_{1\leq l\leq L}\sum_{i=1}^s|\boldsymbol{b}^*_l\boldsymbol{h}_i|^2 \leq \frac{1}{2} \sigma^2_{\max}(\boldsymbol{h}, \boldsymbol{x}). \end{align*} Applying~\eqref{ineq:bern} gives \begin{equation*} \mathbb{P}( \|\mathcal{A}(\boldsymbol{X})\|^2 \geq 1 + t)\leq \exp\left(- \frac{t^2}{4 \sigma^2_{\max}(\boldsymbol{h}, \boldsymbol{x})}\right) \vee \exp\left(- \frac{t}{4\sigma^2_{\max}(\boldsymbol{h}, \boldsymbol{x})}\right). \end{equation*} In particular, by setting \begin{equation*} t = g(\boldsymbol{h},\boldsymbol{x}):= 2 \sqrt{2 s\sigma^2_{\max}(\boldsymbol{h}, \boldsymbol{x})(K+N)\log L} + 8s\sigma^2_{\max}(\boldsymbol{h}, \boldsymbol{x})(K + N)\log L, \end{equation*} we have \begin{equation*} \mathbb{P}\left(\|\mathcal{A}(\boldsymbol{X})\|^2 \geq 1 + g(\boldsymbol{h},\boldsymbol{x})\right) \leq e^{ - 2 s(K+N)(\log L)}. \end{equation*} So far, we have shown that $f(\boldsymbol{h}, \boldsymbol{x}) \leq 1$ with probability at least $1 - e^{- 2 s(K+N)(\log L)}$ for a fixed pair of $(\boldsymbol{h}, \boldsymbol{x}).$ \paragraph{Part II: Covering argument.} Now we will use a covering argument to extend this result for all $(\boldsymbol{h}, \boldsymbol{x})$ and thus prove that $f(\boldsymbol{h}, \boldsymbol{x})\leq \frac{4}{3}$ uniformly for all $(\boldsymbol{h}, \boldsymbol{x})$. We start with defining $\mathcal{K}$ and $\mathcal{N}_i$ as $\epsilon_0$-nets of $\mathcal{S}^{Ks-1}$ and $\mathcal{S}^{N-1}$ for $\boldsymbol{h}$ and $\boldsymbol{x}_i,1\leq i\leq s$, respectively. The bounds $|\mathcal{K}|\leq (1+\frac{2}{\epsilon_0})^{2sK}$ and $|\mathcal{N}_i|\leq (1+\frac{2}{\epsilon_0})^{2N}$ follow from the covering numbers of the sphere (Lemma 5.2 in~\cite{Ver10}). Here we let $\mathcal{N} := \mathcal{N}_1\times \cdots \times \mathcal{N}_s.$ By taking the union bound over $\mathcal{K}\times \mathcal{N},$ we have that $f(\boldsymbol{h}, \boldsymbol{x})\leq 1$ holds uniformly for all $(\boldsymbol{h}, \boldsymbol{x}) \in \mathcal{K} \times \mathcal{N}$ with probability at least \begin{equation*} 1- \left(1+ 2/\epsilon_0\right)^{2s(K + N)} e^{ - 2s(K+N)\log L } = 1- e^{-2s(K + N)\left(\log L - \log \left(1 + 2/\varepsilon_0\right)\right)}. \end{equation*} For any $(\boldsymbol{h}, \boldsymbol{x}) \in \mathcal{S}^{Ks-1}\times \underbrace{\mathcal{S}^{N-1}\times \cdots \times \mathcal{S}^{N-1}}_{s \text{ times}}$, we can find a point $(\boldsymbol{u}, \boldsymbol{v}) \in \mathcal{K} \times \mathcal{N}$ satisfying $\| \boldsymbol{h} - \boldsymbol{u} \| \leq \varepsilon_0$ and $\|\boldsymbol{x}_i - \boldsymbol{v}_i\| \leq \varepsilon_0$ for all $1\leq i\leq s$. Conditioned on~\eqref{eq:A-UPBD}, we know that \begin{equation*} \|\mathcal{A}\|^2\leq s(N\log(NL/2) + (\gamma + \log s)\log L) \leq s(N + \gamma + \log s)\log L. \end{equation*} Now we aim to evaluate $|f(\boldsymbol{h},\boldsymbol{x}) - f(\boldsymbol{u},\boldsymbol{v})|$. First we consider $|f(\boldsymbol{u}, \boldsymbol{x}) - f(\boldsymbol{u}, \boldsymbol{v})|$. Since $\sigma^2_{\max}(\boldsymbol{u}, \boldsymbol{x}) = \sigma^2_{\max}(\boldsymbol{u},\boldsymbol{v})$ if $\|\boldsymbol{x}_i\| = \|\boldsymbol{v}_i\| = \|\boldsymbol{u}\|=1$ for $1\leq i\leq s$, we have \begin{eqnarray*} |f(\boldsymbol{u}, \boldsymbol{x}) - f(\boldsymbol{u}, \boldsymbol{v})| & = & \left|\left\| \mathcal{A}(\mathcal{H}(\boldsymbol{u}, \boldsymbol{x}))\right\|_F^2 - \left\| \mathcal{A}(\mathcal{H}(\boldsymbol{u},\boldsymbol{v})) \right\|_F^2 \right| \\ & \leq & \left\| \mathcal{A}(\mathcal{H}(\boldsymbol{u}, \boldsymbol{x} - \boldsymbol{v}))\right\| \cdot \left\| \mathcal{A}(\mathcal{H}(\boldsymbol{u}, \boldsymbol{x} + \boldsymbol{v}))\right\| \\ & \leq & \|\mathcal{A}\|^2 \sqrt{\sum_{i=1}^s \|\boldsymbol{u}_i\|^2\|\boldsymbol{x}_i - \boldsymbol{v}_i\|^2} \sqrt{\sum_{i=1}^s \|\boldsymbol{u}_i\|^2\|\boldsymbol{x}_i + \boldsymbol{v}_i\|^2} \\ & \leq & 2\|\mathcal{A}\|^2 \varepsilon_0 \leq 2s(N + \gamma + \log s)(\log L)\varepsilon_0 \end{eqnarray*} where the first inequality is due to $||z_1|^2 - |z_2|^2| \leq |z_1 - z_2||z_1 + z_2|$ for any $z_1, z_2 \in \mathbb{C}$. We proceed to estimate $|f(\boldsymbol{h}, \boldsymbol{x}) - f(\boldsymbol{u}, \boldsymbol{x})|$ by using~\eqref{eq:Lips-sigmasq} and~\eqref{eq:Lips-sigma}, \begin{eqnarray*} | f(\boldsymbol{h}, \boldsymbol{x}) - f(\boldsymbol{u}, \boldsymbol{x})| & \leq & J_1 + J_2 + J_3 \\ & \leq & (2\|\mathcal{A}\|^2 + 2\sqrt{2s(K+N)\log L}+ 16s(K+N) \log L) \varepsilon_0\\ & \leq & 25s(K +N + \gamma + \log s)(\log L) \varepsilon_0 \end{eqnarray*} where~\eqref{eq:Lips-sigmasq} and~\eqref{eq:Lips-sigma} give \begin{eqnarray*} J_1 & = &\left| \|\mathcal{A}(\mathcal{H}(\boldsymbol{h},\boldsymbol{x}))\|_F^2 - \|\mathcal{A}(\mathcal{H}(\boldsymbol{u},\boldsymbol{x}))\|_F^2\right| \leq \left\| \mathcal{A}( \mathcal{H}(\boldsymbol{h} - \boldsymbol{u},\boldsymbol{x}) )\right\| \left\| \mathcal{A}( \mathcal{H}(\boldsymbol{h} + \boldsymbol{u},\boldsymbol{x}) )\right\| \leq 2\|\mathcal{A}\|^2 \varepsilon_0, \\ J_2 & = & 2 \sqrt{2s(K+N)\log L}\cdot |\sigma_{\max}(\boldsymbol{h}, \boldsymbol{x}) - \sigma_{\max}(\boldsymbol{u}, \boldsymbol{x})| \leq 2 \sqrt{2s(K+N)\log L} \varepsilon_0, \\ J_3 & = & 8s(K+N) (\log L) \cdot |\sigma^2_{\max}(\boldsymbol{h}, \boldsymbol{x}) - \sigma^2_{\max}(\boldsymbol{u}, \boldsymbol{x})| \leq 16s(K+N)(\log L) \varepsilon_0. \end{eqnarray*} \vskip0.25cm Therefore, if $\epsilon_0 = \frac{1}{81s(N + K + \gamma + \log s)\log L}$, there holds \begin{equation*} f(\boldsymbol{h},\boldsymbol{x}) \leq f(\boldsymbol{u},\boldsymbol{v}) + \underbrace{|f(\boldsymbol{u}, \boldsymbol{x}) - f(\boldsymbol{u}, \boldsymbol{v})| + |f(\boldsymbol{h},\boldsymbol{x}) -f(\boldsymbol{u},\boldsymbol{x}) |}_{\leq 27s(K+N+\gamma + \log s)(\log L)\varepsilon_0\leq \frac{1}{3}} \leq \frac{4}{3} \end{equation*} for all $(\boldsymbol{h},\boldsymbol{x})$ uniformly with probability at least $1- e^{-2s(K + N)\left(\log L - \log \left(1 + 2/\varepsilon_0\right)\right)}.$ By letting $L \geq C_{\gamma}s(K+N)\log L$ with $C_{\gamma}$ reasonably large and $\gamma \geq 1$, we have $\log L - \log\left(1 + 2/\varepsilon_0\right) \geq \frac{1}{2}(1 + \log(\gamma))$ and with probability at least $1 - \frac{1}{\gamma}\exp(-s(K+N))$. \end{proof} \subsection{Proof of the local restricted isometry property} \label{s:LRIP} \begin{lemma} \label{lem:rip} Conditioned on~\eqref{eq:RIP-AT} and~\eqref{eq:AX-rank}, the following RIP type of property holds: \begin{equation*} \frac{2}{3} \|\boldsymbol{X} - \boldsymbol{X}_0\|_F^2 \leq \|\mathcal{A}(\boldsymbol{X} - \boldsymbol{X}_0)\|^2 \leq \frac{3}{2}\|\boldsymbol{X}-\boldsymbol{X}_0\|_F^2 \end{equation*} uniformly for all $(\boldsymbol{h},\boldsymbol{x})\in \mathcal{N}_d \cap \mathcal{N}_{\mu} \cap \mathcal{N}_{\epsilon}$ with $\mu \geq \mu_h$ and $\epsilon \leq \frac{1}{15}$ if $L \geq C_{\gamma}\mu^2 s(K+N)\log^2 L$ for some numerical constant $C_{\gamma}$. \end{lemma} \begin{proof} The main idea of the proof follows two steps: decompose $\boldsymbol{X}-\boldsymbol{X}_0$ onto $T$ and $T^{\bot}$, then apply~\eqref{eq:RIP-AT} and~\eqref{eq:AX-rank} to $\mathcal{P}_T(\boldsymbol{X}-\boldsymbol{X}_0)$ and $\mathcal{P}_{T^{\bot}}(\boldsymbol{X}-\boldsymbol{X}_0)$ respectively. \vskip0.25cm For any $\boldsymbol{X} =\mathcal{H}(\boldsymbol{h},\boldsymbol{x})\in\mathcal{N}_{\epsilon}$ with $\delta_i \leq \varepsilon\leq \frac{1}{15}$, we can decompose $\boldsymbol{X} - \boldsymbol{X}_0$ as the sum of two block diagonal matrices $\boldsymbol{U} = \blkdiag(\boldsymbol{U}_i, 1\leq i\leq s)$ and $\boldsymbol{V} = \blkdiag(\boldsymbol{V}_i, 1\leq i\leq s)$ where each pair of $(\boldsymbol{U}_i, \boldsymbol{V}_i)$ corresponds to the orthogonal decomposition of $\boldsymbol{h}_i\boldsymbol{x}_i^* - \boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*$, \begin{equation}\label{eq:UV} \boldsymbol{h}_i\boldsymbol{x}^*_i - \boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^* := \underbrace{(\alpha_{i1} \overline{\alpha_{i2}} - 1)\boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^* + \overline{\alpha_{i2}} \tilde{\boldsymbol{h}}_i \boldsymbol{x}_{i0}^* + \alpha_{i1} \boldsymbol{h}_{i0}\tilde{\boldsymbol{x}}_i^*}_{\boldsymbol{U}_i\in T_i} + \underbrace{ \tilde{\boldsymbol{h}}_i \tilde{\boldsymbol{x}}_i^*}_{\boldsymbol{V}_i \in T_i^\perp} \end{equation} which has been briefly discussed in~\eqref{eq:orth} and~\eqref{eq:decomposition}. Note that $\mathcal{A}(\boldsymbol{X} - \boldsymbol{X}_0) = \mathcal{A}(\boldsymbol{U} + \boldsymbol{V})$ and \begin{equation*} \|\mathcal{A}(\boldsymbol{U})\| - \|\mathcal{A}(\boldsymbol{V})\| \leq \|\mathcal{A}(\boldsymbol{U} + \boldsymbol{V})\| \leq \|\mathcal{A}(\boldsymbol{U})\| + \|\mathcal{A}(\boldsymbol{V})\|. \end{equation*} Therefore, it suffices to have a two-side bound for $\|\mathcal{A}(\boldsymbol{U})\|$ and an upper bound for $\|\mathcal{A}(\boldsymbol{V})\|$ where $\boldsymbol{U}\in T$ and $\boldsymbol{V}\in T^{\bot}$ in order to establish the local isometry property. \paragraph{Estimation of $\|\mathcal{A}(\boldsymbol{U})\|$:} For $\|\mathcal{A}(\boldsymbol{U})\|$, we know from~\prettyref{lem:ripu} that \begin{equation}\label{eq:AU1} \sqrt{\frac{9}{10}}\|\boldsymbol{U}\|_F\leq \|\mathcal{A}(\boldsymbol{U})\| \leq \sqrt{\frac{11}{10}}\|\boldsymbol{U}\|_F \end{equation} and hence we only need to compute $\|\boldsymbol{U}\|_F.$ By \prettyref{lem:orth_decomp}, there also hold $\|\boldsymbol{V}_i\|_F \leq \frac{\delta_i^2}{2(1 - \delta_i)} d_{i0}$ and $\delta_i - \|\boldsymbol{V}_i\|_F\leq \|\boldsymbol{U}_i\|_F\leq \delta_i + \|\boldsymbol{V}_i\|_F$, i.e., \begin{equation*} \left(\delta_i - \frac{\delta_i^2}{2(1 - \delta_i)}\right)d_{i0} \leq \|\boldsymbol{U}_i\|_F \leq \left(\delta_i + \frac{\delta_i^2}{2(1 - \delta_i)}\right)d_{i0}, \quad 1\leq i\leq s. \end{equation*} With $\|\boldsymbol{U}\|_F^2 = \sum_{i=1}^s \|\boldsymbol{U}_i\|_F^2$, it is easy to get $\delta d_0\left(1 - \frac{\varepsilon}{2(1-\varepsilon)}\right) \leq \|\boldsymbol{U}\|_F \leq \delta d_0 \left(1 + \frac{\varepsilon}{2(1-\varepsilon)}\right)$. Combined with~\eqref{eq:AU1}, we get \begin{equation} \label{eq:AU} \sqrt{\frac{9}{10}}\left(1 - \frac{\varepsilon}{2(1-\varepsilon)}\right)\delta d_0 \leq \|\mathcal{A}(\boldsymbol{U}) \| \leq \sqrt{\frac{11}{10}}\left(1 + \frac{\varepsilon}{2(1-\varepsilon)}\right)\delta d_0. \end{equation} \paragraph{Estimation of $\|\mathcal{A}(\boldsymbol{V})\|$:} Note that $\boldsymbol{V}$ is a block-diagonal matrix with rank-1 block. So applying \prettyref{lem:key} gives us \begin{align} \|\mathcal{A}(\boldsymbol{V})\|^2 &\leq \frac{4}{3} \|\boldsymbol{V}\|_F^2+ 2 \sqrt{2s\|\boldsymbol{V}\|_F^2 \sigma^2_{\max}(\tilde{\boldsymbol{h}}, \tilde{\boldsymbol{x}})(K+N)\log L} + 8s\sigma^2_{\max}(\tilde{\boldsymbol{h}}, \tilde{\boldsymbol{x}})(K+N) \log L \label{ineq:AV} \end{align} where $\boldsymbol{V} = \mathcal{H}(\tilde{\boldsymbol{h}}, \tilde{\boldsymbol{x}})$ and $\tilde{\boldsymbol{h}} = \begin{bmatrix} \tilde{\boldsymbol{h}}_1 \\ \vdots \\ \tilde{\boldsymbol{h}}_s \end{bmatrix}. $ It suffices to get an estimation of $\|\boldsymbol{V}\|_F$ and $\sigma^2_{\max}(\tilde{\boldsymbol{h}},\tilde{\boldsymbol{x}})$ to bound $\|\mathcal{A}(\boldsymbol{V})\|$ in~\eqref{ineq:AV}. Lemma~\ref{lem:orth_decomp} says that $\|\tilde{\boldsymbol{h}}_i\| \|\tilde{\boldsymbol{x}}_i\| \leq \frac{\delta_i^2}{2(1 - \delta_i)} d_{i0} \leq \frac{\varepsilon}{2(1-\varepsilon)} \delta_i d_{i0}$ if $\varepsilon < 1$. Moreover, \begin{equation}\label{eq:orth-1} \|\tilde{\boldsymbol{x}}_i\| \leq \frac{\delta_i}{1 - \delta_i}\|\boldsymbol{x}_i\| \leq \frac{2\delta_{i}}{1 - \delta_i} \sqrt{d_{i0}}, \quad \sqrt{L}\|\mtx{B} \tilde{\boldsymbol{h}}_i \|_\infty \leq 6 \mu \sqrt{d_{i0}}, \quad 1\leq i\leq s \end{equation} if $(\boldsymbol{h},\boldsymbol{x})$ belongs to $\mathcal{N}_d \cap \mathcal{N}_{\mu} \cap \mathcal{N}_{\epsilon}.$ For $\|\boldsymbol{V}\|_F$, \begin{equation*} \|\boldsymbol{V}\|_F = \sqrt{\sum_{i=1}^s \|\boldsymbol{V}_i\|_F^2} = \sqrt{\sum_{i=1}^s \|\tilde{\boldsymbol{h}}_i\|^2 \|\tilde{\boldsymbol{x}}_i\|^2} \leq \frac{\varepsilon\delta d_0}{2(1-\varepsilon)}. \end{equation*} Now we aim to get an upper bound for $\sigma^2_{\max}(\tilde{\boldsymbol{h}}, \tilde{\boldsymbol{x}})$ by using~\eqref{eq:orth-1}, \begin{equation*} \sigma_{\max}^2(\tilde{\boldsymbol{h}}, \tilde{\boldsymbol{x}}) = \max_{1\leq l\leq L}\sum_{i=1}^s |\boldsymbol{b}^*_l\tilde{\boldsymbol{h}}_i|^2 \|\tilde{\boldsymbol{x}}_i\|^2 \leq C_0\frac{\mu^2 \sum_{i=1}^s \delta_i^2 d_{i0}^2}{L} = C_0\frac{\mu^2\delta^2 d_0^2}{L}. \end{equation*} By substituting the estimations of $\|\boldsymbol{V}\|_F$ and $\sigma^2_{\max}(\tilde{\boldsymbol{h}}, \tilde{\boldsymbol{x}})$ into~\eqref{ineq:AV} \begin{equation}\label{eq:AV} \|\mathcal{A}(\boldsymbol{V})\|^2 \leq \frac{\varepsilon^2 \delta^2d_0^2}{3(1-\varepsilon)^2} + \frac{\sqrt{2}\varepsilon \delta^2 d_0^2}{1-\varepsilon} \sqrt{\frac{C_0\mu^2 s (K+N)\log L}{L}} + \frac{8C_0 \mu^2 \delta^2d_0^2s(K+N)\log L}{L}. \end{equation} By letting $L \geq C_{\gamma }\mu^2 s(K + N)\log^2 L$ with $C_{\gamma} $ sufficiently large and combining \prettyref{eq:AV} and \prettyref{eq:AU}, we have \begin{equation*} \sqrt{\frac{2}{3}}\delta d_0 \leq \|\mathcal{A}(\boldsymbol{U})\| - \|\mathcal{A}(\boldsymbol{V})\| \leq \|\mathcal{A}(\boldsymbol{U}+\boldsymbol{V})\| \leq \|\mathcal{A}(\boldsymbol{U})\| + \|\mathcal{A}(\boldsymbol{V})\| \leq \sqrt{\frac{3}{2}}\delta d_0, \end{equation*} which gives $\frac{2}{3}\|\boldsymbol{X} - \boldsymbol{X}_0\|_F^2 \leq \|\mathcal{A}(\boldsymbol{X} - \boldsymbol{X}_0)\|^2 \leq \frac{3}{2}\|\boldsymbol{X} - \boldsymbol{X}_0\|_F^2.$ \end{proof} \subsection{Proof of the local regularity condition} \label{s:LRC} We first introduce a few notations: for all $(\boldsymbol{h}, \boldsymbol{x}) \in \mathcal{N}_d \cap \mathcal{N}_{\epsilon}$, consider $\alpha_{i1}, \alpha_{i2}, \tilde{\boldsymbol{h}}_i$ and $\tilde{\boldsymbol{x}}_i$ defined in \prettyref{eq:orth} and define \begin{equation*} \Delta\boldsymbol{h}_i = \boldsymbol{h}_i - \alpha_i \boldsymbol{h}_{i0}, \quad \Delta\boldsymbol{x}_i = \boldsymbol{x}_i - \overline{\alpha}_i^{-1}\boldsymbol{x}_{i0} \end{equation*} where \begin{equation*} \alpha_i (\boldsymbol{h}_i, \boldsymbol{x}_i)= \begin{cases} (1 - \delta_0)\alpha_{i1}, & \text{~if~} \|\boldsymbol{h}_i\|_2 \geq \|\boldsymbol{x}_i\|_2 \\ \frac{1}{(1 - \delta_0)\overline{\alpha_{i2}}}, & \text{~if~} \|\boldsymbol{h}_i\|_2 < \|\boldsymbol{x}_i\|_2\end{cases} \end{equation*} with \begin{equation}\label{def:delta0} \delta_0 := \frac{\delta}{10}. \end{equation} The function $\alpha_i(\boldsymbol{h}_i,\boldsymbol{x}_i)$ is defined for each block of $\boldsymbol{X} = \mathcal{H}(\boldsymbol{h}, \boldsymbol{x}).$ The particular form of $\alpha_i(\boldsymbol{h}, \boldsymbol{x})$ serves primarily for proving the Lemma~\ref{lem:regG}, i.e., local regularity condition of $G(\boldsymbol{h}, \boldsymbol{x})$. We also define \begin{equation*} \Delta\boldsymbol{h} : = \begin{bmatrix} \boldsymbol{h}_1 - \alpha_1 \boldsymbol{h}_{1,0} \\ \vdots \\ \boldsymbol{h}_s - \alpha_s \boldsymbol{h}_{s0} \end{bmatrix}\in\mathbb{C}^{Ks}, \quad \Delta\boldsymbol{x} : = \begin{bmatrix} \boldsymbol{x}_1 - \alpha_1 \boldsymbol{x}_{1,0} \\ \vdots \\ \boldsymbol{x}_s - \alpha_s \boldsymbol{x}_{s0} \end{bmatrix}\in\mathbb{C}^{Ns}. \end{equation*} The following lemma gives bounds of $\Delta\boldsymbol{x}_i$ and $\Delta\boldsymbol{h}_i$. \begin{lemma} \label{lem:DxDh} For all $(\boldsymbol{h},\boldsymbol{x}) \in \mathcal{N}_d \cap \mathcal{N}_{\epsilon}$ with $\epsilon \leq \frac{1}{15}$, there hold \begin{align*} \max\{ \|\Delta\boldsymbol{h}_i\|_2^2, \|\Delta\boldsymbol{x}_i\|_2^2\} & \leq (7.5\delta_i^2 + 2.88\delta_0^2) d_{i0}, \\ \|\Delta\boldsymbol{h}_i\|_2^2 \|\Delta\boldsymbol{x}_i\|_2^2 & \leq \frac{1}{26}(\delta_i^2 + \delta_0^2) d_{i0}^2. \end{align*} Moreover, if we assume $(\boldsymbol{h}_i, \boldsymbol{x}_i) \in \mathcal{N}_{\mu}$ additionally, we have $ \sqrt{L}\|\boldsymbol{B}(\Delta\boldsymbol{h}_i)\|_\infty \leq 6\mu\sqrt{d_{i0}}$. \end{lemma} \begin{proof} We only consider $\|\boldsymbol{h}_i\|_2 \geq \|\boldsymbol{x}_i\|_2$ and $\alpha_i = (1 - \delta_0) \alpha_{1i}$, and the other case is exactly the same due to the symmetry. For both $\Delta\boldsymbol{h}_i$ and $\Delta\boldsymbol{x}_i$, by definition, \begin{align} \Delta\boldsymbol{h}_i & = \boldsymbol{h}_i - \alpha_{i}\boldsymbol{h}_{i0} = \delta_0 \alpha_{i1} \boldsymbol{h}_{i0} + \tilde{\boldsymbol{h}}_i\label{def:Dhi},\\ \Delta\boldsymbol{x}_i & = \boldsymbol{x}_i - \frac{1}{(1 - \delta_0)\overline{\alpha_i}_1} \boldsymbol{x}_{i0} = \left(\alpha_{i2} - \frac{1}{(1 - \delta_0)\overline{\alpha}_{i1}}\right)\boldsymbol{x}_{i0} + \tilde{\boldsymbol{x}}_i \label{def:Dxi}, \end{align} where $\boldsymbol{h}_i = \alpha_{i1}\boldsymbol{h}_{i0} + \tilde{\boldsymbol{h}}_i$ and $\boldsymbol{x}_i = \alpha_{i2}\boldsymbol{x}_{i0} + \tilde{\boldsymbol{x}}_i$ come from the orthogonal decomposition in~\eqref{eq:orth}. \vskip0.25cm We start with estimating $\|\Delta\boldsymbol{h}_i\|^2.$ Note that $\|\boldsymbol{h}_i\|_2^2 \leq 4d_{i0}$ and $\|\alpha_{i1} \boldsymbol{h}_{i0}\|_2^2\leq \|\boldsymbol{h}_i\|_2^2$ since $(\boldsymbol{h}, \boldsymbol{x})\in\mathcal{N}_d\cap\mathcal{N}_{\mu}$. By \prettyref{lem:orth_decomp}, we have \begin{equation}\label{eq:Dh-est} \|\Delta\boldsymbol{h}_i\|_2^2 = \|\tilde{\boldsymbol{h}}_i\|_2^2 + \delta_0^2\|\alpha_{i1} \boldsymbol{h}_{i0}\|_2^2 \leq \left(\left(\frac{\delta_i}{1-\delta_i}\right)^2 + \delta_0^2\right)\|\boldsymbol{h}_i\|_2^2 \leq ( 4.6\delta_i^2 + 4\delta_0^2) d_{i0}. \end{equation} Then we calculate $\|\Delta\boldsymbol{x}_i\|$: from~\eqref{def:Dxi}, we have \begin{equation*} \|\Delta\boldsymbol{x}_i\|^2 = \left|\alpha_{i2} - \frac{1}{(1 - \delta_0)\overline{\alpha}_{i1}} \right|^2d_{i0} + \|\tilde{\boldsymbol{x}}_i\|^2 \leq \left|\alpha_{i2} - \frac{1}{(1 - \delta_0)\overline{\alpha}_{i1}} \right|^2d_{i0} + \frac{4\delta_i^2 d_{i0}}{(1 - \delta_i)^2}, \end{equation*} where \prettyref{lem:orth_decomp} gives $\|\tilde{\boldsymbol{x}}_i\|_2 \leq \frac{\delta_i}{1-\delta_i}\|\boldsymbol{x}_i\|_2 \leq \frac{2\delta_i}{1-\delta_i} \sqrt{d_{i0}}$ for $(\boldsymbol{h},\boldsymbol{x})\in\mathcal{N}_d\cap\mathcal{N}_{\epsilon}$. So it suffices to estimate $\left| \alpha_{i2} - \frac{1}{(1 - \delta_0)\overline{\alpha}_{i1}} \right|$, which satisfies \begin{equation}\label{eq:coef-up} \left|\alpha_{i2} - \frac{1}{(1 - \delta_0)\overline{\alpha_{i1}}}\right| = \frac{1}{|\alpha_{i1}|} \left| \overline{\alpha_{i1}} \alpha_{i2}- 1 - \frac{\delta_0}{1 - \delta_0} \right| \leq \frac{1}{|\alpha_{i1}|} \left( \left|(\overline{\alpha_{i1}} \alpha_{i2}- 1)\right| + \frac{\delta_0}{1 - \delta_0} \right). \end{equation} Lemma~\ref{lem:orth_decomp} implies that $| \overline{\alpha_{i1}} \alpha_{i2}- 1| \leq \delta_i$, and~\eqref{eq:orth} gives \begin{equation}\label{eq:lb-alpha} |\alpha_{i1}|^2 = \frac{1}{d_{i0}}(\|\boldsymbol{h}_i\|^2 - \| \tilde{\boldsymbol{h}}_i \|^2) \geq \frac{1}{d_{i0}}\left(1 - \frac{\delta_i^2}{(1-\delta_i)^2} \right)\|\boldsymbol{h}_i\|^2 \geq \left(1 - \frac{\delta_i^2}{(1-\delta_i)^2} \right)(1-\varepsilon) \end{equation} where $\|\tilde{\boldsymbol{h}}_i\| \leq \frac{\delta_i}{1-\delta_i}\|\boldsymbol{h}_i\|$ and $\|\boldsymbol{h}_i\|^2 \geq \|\boldsymbol{h}_i\|\|\boldsymbol{x}_i\| \geq (1-\varepsilon)d_{i0}$ if $\|\boldsymbol{h}_i\|\geq \|\boldsymbol{x}_i\|.$ Substituting~\eqref{eq:lb-alpha} into~\eqref{eq:coef-up} gives \begin{eqnarray*} \left|\alpha_{i2} - \frac{1}{(1 - \delta_0)\overline{\alpha_{i1}}}\right| & \leq & \frac{1}{\sqrt{1-\varepsilon}} \left(1 - \frac{\delta_i^2}{(1-\delta_i)^2} \right)^{-1/2}\left(\delta_i + \frac{\delta_0}{1-\delta_0}\right) \leq 1.2(\delta_i + \delta_0). \end{eqnarray*} Then we have \begin{eqnarray} \|\Delta\boldsymbol{x}_i\|_2^2 & \leq & \left(1.44(\delta_i+\delta_0)^2+ \frac{4\delta^2_i}{(1 - \delta_i)^2}\right) d_{i0} \leq (7.5\delta_i^2 + 2.88\delta_0^2)d_{i0}.\label{eq:Dx-est} \end{eqnarray} Finally, we try to bound $\|\Delta\boldsymbol{h}_i\|^2\|\Delta\boldsymbol{x}_i\|^2.$ \prettyref{lem:orth_decomp} gives $\|\tilde{\boldsymbol{h}}_i\|_2 \|\tilde{\boldsymbol{x}}_i\|_2 \leq \frac{\delta_i^2d_{i0}}{2(1 - \delta_i)}$ and $|\alpha_{i1}| \leq 2$. Combining them along with~\eqref{def:Dhi},~\eqref{def:Dxi},~\eqref{eq:Dh-est} and~\eqref{eq:Dx-est}, we have \begin{align*} \|\Delta\boldsymbol{h}_i\|_2^2 \|\Delta\boldsymbol{x}_i\|_2^2 &\leq \|\tilde{\boldsymbol{h}}_i\|_2^2\|\tilde{\boldsymbol{x}}_i\|_2^2 + \delta_0^2 |\alpha_{i1}|^2 \|\boldsymbol{h}_{i0}\|_2^2 \|\Delta\boldsymbol{x}_i\|_2^2 + \left|\alpha_{i2} - \frac{1}{(1 - \delta_0)\overline{\alpha}_{i1}}\right|^2 \|\boldsymbol{x}_{i0}\|_2^2 \|\Delta\boldsymbol{h}_i\|_2^2 \\ & \leq \left(\frac{\delta_i^4}{4(1 - \delta_i)^2} + 4\delta_0^2 (7.5\delta_i^2 + 2.88\delta_0^2) + 1.44(\delta_i + \delta_0)^2 (4.6\delta_i^2 + 4\delta_0^2 )\right) d_{i0}^2 \\ & \leq \frac{(\delta_i^2 + \delta_0^2)d_{i0}^2}{26}. \end{align*} By symmetry, similar results hold for the case $\|\boldsymbol{h}_i\|_2 < \|\boldsymbol{x}_i\|_2$ and $\max\{\|\Delta\boldsymbol{h}_i\|, \|\Delta\boldsymbol{x}_i\|\} \leq (7.5\delta_i^2 + 2.88\delta_0^2)d_{i0}.$ \vskip0.25cm Next, under the additional assumption $(\boldsymbol{h}, \boldsymbol{x}) \in \mathcal{N}_{\mu}$, we now prove $\sqrt{L}\|\mtx{B}(\Delta\boldsymbol{h}_i)\|_\infty \leq 6\mu\sqrt{d_{i0}}$:\\ Case 1: $\|\boldsymbol{h}_i\|_2 \geq \|\boldsymbol{x}_i\|_2$ and $\alpha_i = (1 - \delta_0) \alpha_{i1}$. By \prettyref{lem:orth_decomp} gives $|\alpha_{i1}| \leq 2$, which implies \begin{align*} \sqrt{L}\|\mtx{B}(\Delta\boldsymbol{h}_i)\|_\infty &\leq \sqrt{L}\|\mtx{B}\boldsymbol{h}_i \|_\infty + (1 - \delta_0) |\alpha_{i1}|\sqrt{L}\|\mtx{B}\boldsymbol{h}_{i0}\|_\infty \\ &\leq 4\mu\sqrt{d_{i0}} + 2(1 - \delta_0)\mu_h \sqrt{d_{i0}} \leq 6\mu\sqrt{d_{i0}}. \end{align*} Case 2: $\|\boldsymbol{h}_i\|_2 < \|\boldsymbol{x}_i\|_2$ and $\alpha_i = \frac{1}{(1-\delta_0)\overline{\alpha_{i2}}}$. Using the same argument as~\eqref{eq:lb-alpha} gives \begin{equation*} |\alpha_{i2}|^2\geq \left(1 - \frac{\delta_i^2}{(1-\delta_i)^2} \right)(1-\varepsilon). \end{equation*} Therefore, \begin{align*} \sqrt{L}\|\mtx{B}(\Delta\boldsymbol{h}_i)\|_\infty &\leq \sqrt{L}\|\mtx{B}\boldsymbol{h}_i\|_\infty + \frac{1}{(1 - \delta_0) |\overline{\alpha_{i2}}|} \sqrt{L}\|\mtx{B}\boldsymbol{h}_0\|_\infty \\ &\leq 4\mu\sqrt{d_0} + \left(1 - \frac{\delta_i^2}{(1-\delta_i)^2} \right)^{-1/2} \frac{\mu_h \sqrt{d}_0}{(1-\delta_0)\sqrt{1-\varepsilon}} \leq 6 \mu\sqrt{d_0}. \end{align*} \end{proof} \begin{lemma}{\bf (Local Regularity for $F(\boldsymbol{h},\boldsymbol{x})$)}\label{lem:regF} Conditioned on~\eqref{eq:rip} and~\eqref{eq:AX-rank}, the following inequality holds \begin{equation*} \Real\lp\langle \nabla F_{\boldsymbol{h}}, \Delta\boldsymbol{h} \rangle + \langle \nabla F_{\boldsymbol{x}}, \Delta\boldsymbol{x}\rangle\rp \geq \frac{\delta^2 d_0^2}{8} - 2\sqrt{s}\delta d_0 \|\mathcal{A}^*(\boldsymbol{e})\|, \end{equation*} uniformly for any $(\boldsymbol{h}, \boldsymbol{x}) \in \mathcal{N}_d \cap \mathcal{N}_{\mu} \cap \mathcal{N}_{\epsilon}$ with $\epsilon \leq \frac{1}{15}$ if $L \geq C\mu^2 s(K+N)\log^2 L$ for some numerical constant $C$. \end{lemma} \begin{proof} First note that for \begin{equation*} I_0 = \langle \nabla F_{\boldsymbol{h}}, \Delta\boldsymbol{h} \rangle + \overline{\langle \nabla F_{\boldsymbol{x}}, \Delta\boldsymbol{x}\rangle } = \sum_{i=1}^s \langle \nabla F_{\boldsymbol{h}_i}, \Delta\boldsymbol{h}_i \rangle + \overline{\langle \nabla F_{\boldsymbol{x}_i}, \Delta\boldsymbol{x}_i \rangle}. \end{equation*} For each component, recall that~\eqref{eq:WFh} and~\eqref{eq:WFx}, we have \begin{align*} \langle \nabla F_{\boldsymbol{h}_i}, \Delta\boldsymbol{h}_i \rangle + \overline{\langle \nabla F_{\boldsymbol{x}_i}, \Delta\boldsymbol{x}_i \rangle} & = \langle \mathcal{A}_i^*(\mathcal{A}(\boldsymbol{X} - \boldsymbol{X}_0) - \boldsymbol{e})\boldsymbol{x}_i, \Delta\boldsymbol{h}_i \rangle + \overline{\langle (\mathcal{A}_i^*(\mathcal{A}(\boldsymbol{X} - \boldsymbol{X}_0) - \boldsymbol{e}))^*\boldsymbol{h}_i, \Delta\boldsymbol{x}_i \rangle} \\ & = \left\langle \mathcal{A}(\boldsymbol{X} - \boldsymbol{X}_0) - \boldsymbol{e}, \mathcal{A}_i((\Delta\boldsymbol{h}_i)\boldsymbol{x}_i^* + \boldsymbol{h}_i (\Delta\boldsymbol{x}_i)^*) \right\rangle. \end{align*} Define $\boldsymbol{U}_i$ and $\boldsymbol{V}_i$ as \begin{equation} \label{eq:UV2} \boldsymbol{U}_i := \alpha_i\boldsymbol{h}_{i0}(\Delta\boldsymbol{x}_i)^* + \overline{\alpha_i}^{-1}(\Delta\boldsymbol{h}_i)\boldsymbol{x}_{i0}^* \in T_i, \quad \boldsymbol{V}_i := \Delta\boldsymbol{h}_i(\Delta\boldsymbol{x}_i)^*. \end{equation} Here $\boldsymbol{V}_i$ does not necessarily belong to $T^{\bot}_i.$ From the way of how $\Delta\boldsymbol{h}_i$, $\Delta\boldsymbol{x}_i$, $\boldsymbol{U}_i$ and $\boldsymbol{V}_i$ are constructed, two simple relations hold: \begin{eqnarray*} \boldsymbol{h}_i\boldsymbol{x}_i^* - \boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^* & = & \boldsymbol{U}_i + \boldsymbol{V}_i, \\ (\Delta\boldsymbol{h}_i)\boldsymbol{x}_i^* + \boldsymbol{h}_i (\Delta\boldsymbol{x}_i)^* & = & \boldsymbol{U}_i + 2\boldsymbol{V}_i. \end{eqnarray*} Define $\boldsymbol{U} : = \blkdiag(\boldsymbol{U}_1, \cdots, \boldsymbol{U}_s)$ and $\boldsymbol{V} : = \blkdiag(\boldsymbol{V}_1, \cdots, \boldsymbol{V}_s)$. $I_0$ can be simplified to \begin{align*} I_0 & = \sum_{i=1}^s \langle \nabla F_{\boldsymbol{h}_i}, \Delta\boldsymbol{h}_i \rangle + \overline{\langle \nabla F_{\boldsymbol{x}_i}, \Delta\boldsymbol{x}_i \rangle} = \sum_{i=1}^s \langle \mathcal{A}(\boldsymbol{U}+\boldsymbol{V})- \boldsymbol{e}, \mathcal{A}_i(\boldsymbol{U}_i + 2\boldsymbol{V}_i)\rangle \\ & = \underbrace{\langle \mathcal{A}(\boldsymbol{U}+\boldsymbol{V}), \mathcal{A}(\boldsymbol{U} + 2\boldsymbol{V})\rangle}_{I_{01}} - \underbrace{\langle \boldsymbol{e}, \mathcal{A}(\boldsymbol{U} + 2\boldsymbol{V})\rangle}_{I_{02}}. \end{align*} Now we will give a lower bound for $\Real(I_{01})$ and an upper bound for $\Real(I_{02})$ so that the lower bound of $\Real(I_0)$ is obtained. By the Cauchy-Schwarz inequality, $\Real(I_{01})$ has the lower bound \begin{equation}\label{eq:I_0} \Real(I_{01}) \geq (\|\mathcal{A}(\boldsymbol{U})\| - \|\mathcal{A}(\boldsymbol{V})\|) (\|\mathcal{A}(\boldsymbol{U})\| - 2\|\mathcal{A}(\boldsymbol{V})\|). \end{equation} In the following, we will give an upper bound for $\|\mathcal{A}(\boldsymbol{V})\|$ and a lower bound for $\|\mathcal{A}(\boldsymbol{U})\|$. \paragraph{Upper bound for $\|\mathcal{A}(\boldsymbol{V})\|$:} Note that $\boldsymbol{V}$ is a block-diagonal matrix with rank-1 blocks, and applying \prettyref{lem:key} results in \begin{equation*} \|\mathcal{A}(\boldsymbol{V})\|^2 \leq \frac{4}{3}\sum_{i=1}^s \|\boldsymbol{V}\|_F^2 + 2\sigma_{\max}(\Delta\boldsymbol{h},\Delta\boldsymbol{x}) \|\boldsymbol{V}\|_F\sqrt{2s(K+N)\log L} + 8s\sigma_{\max}^2(\Delta\boldsymbol{h}, \Delta\boldsymbol{x})(K+N) \log L. \end{equation*} By using Lemma~\ref{lem:DxDh}, we have $\|\Delta\boldsymbol{h}_i\|^2 \leq (7.5\delta_i^2 + 2.88\delta_0^2)d_{i0}$ and $\sqrt{L}\|\boldsymbol{B}(\Delta\boldsymbol{h}_i)\|_{\infty} \leq 6\mu\sqrt{d_{i0}}$. Substituting them into $\sigma^2_{\max}(\Delta\boldsymbol{h},\Delta\boldsymbol{x})$ gives \begin{eqnarray*} \sigma_{\max}^2(\Delta\boldsymbol{h}, \Delta\boldsymbol{x}) = \max_{1\leq l\leq L}\left(\sum_{i=1}^s |\boldsymbol{b}_l^*\Delta\boldsymbol{h}_i|^2 \|\Delta\boldsymbol{x}_i\|^2\right) \leq \frac{36\mu^2}{L} \sum_{i=1}^s (7.5\delta_i^2 + 2.88\delta_0^2)d_{i0}^2 \leq \frac{272\mu^2 \delta^2 d_0^2}{L}. \end{eqnarray*} For $\|\boldsymbol{V}\|_F$, note that $\|\Delta\boldsymbol{h}_i\|^2\|\Delta\boldsymbol{x}_i\|^2 \leq \frac{1}{26}(\delta_i^2 + \delta_0^2)d_{i0}^2$ and thus \begin{equation*} \|\boldsymbol{V}\|^2_F = \sum_{i=1}^s \|\Delta\boldsymbol{h}_i\|^2\|\Delta\boldsymbol{x}_i\|^2 \leq\frac{1}{26} \sum_{i=1}^s(\delta_i^2 + \delta_0^2)d_{i0}^2 \leq \frac{1}{26} \cdot 1.01\delta^2d_0^2 = \frac{\delta^2 d_0^2}{25}. \end{equation*} Then by $\delta \leq \varepsilon \leq \frac{1}{15}$ and letting $L \geq C\mu^2 s(K + N)\log^2 L$ for a sufficiently large numerical constant $C$, there holds \begin{equation}\label{eq:AVdelta} \|\mathcal{A}(\boldsymbol{V})\|^2 \leq \frac{\delta^2 d_0^2}{16} \implies \|\mathcal{A}(\boldsymbol{V})\| \leq \frac{\delta d_0}{4}. \end{equation} \paragraph{Lower bound for $\|\mathcal{A}(\boldsymbol{U})\|$:} By the triangle inequality, $\|\boldsymbol{U}\|_F \geq \delta d_0 - \frac{1}{5} \delta d_0 \geq \frac{4}{5}\delta d_0$ if $\epsilon \leq \frac{1}{15}$ since $\|\boldsymbol{V}\|_F \leq 0.2\delta d_0$. Since $\boldsymbol{U} \in T$, by \prettyref{lem:ripu}, there holds \begin{equation}\label{eq:AUdelta} \|\mathcal{A}(\boldsymbol{U})\| \geq \sqrt{\frac{9}{10}}\|\boldsymbol{U}\|_F \geq \frac{3}{4} \delta d_0. \end{equation} With the upper bound of $\mathcal{A}(\boldsymbol{V})$ in~\eqref{eq:AVdelta}, the lower bound of $\mathcal{A}(\boldsymbol{U})$ in \eqref{eq:AUdelta}, and~\eqref{eq:I_0}, we get $\Real(I_{01}) \geq \frac{\delta^2 d_0^2}{8}.$ Now let us give an upper bound for $\Real(I_{02})$, \begin{eqnarray*} \| I_{02} \| & \leq & \|\mathcal{A}^*(\boldsymbol{e})\| \|\boldsymbol{U} + 2\boldsymbol{V}\|_* = \|\mathcal{A}^*(\boldsymbol{e})\| \sum_{i=1}^s\|\underbrace{\boldsymbol{U}_i + 2\boldsymbol{V}_i}_{\text{rank-2}}\|_* \\ & \leq & \sqrt{2}\|\mathcal{A}^*(\boldsymbol{e})\| \sum_{i=1}^s \|\boldsymbol{U}_i + 2\boldsymbol{V}_i\|_F \\ & \leq & \sqrt{2s}\|\mathcal{A}^*(\boldsymbol{e})\| \|\boldsymbol{U} + 2\boldsymbol{V}\|_F \leq 2\sqrt{s}\delta d_0 \|\mathcal{A}^*(\boldsymbol{e})\| \end{eqnarray*} where $\|\cdot\|$ and $\|\cdot\|_*$ are a pair of dual norms and \begin{equation*} \|\boldsymbol{U} + 2\boldsymbol{V}\|_F \leq \|\boldsymbol{U} + \boldsymbol{V}\|_F + \|\boldsymbol{V}\|_F \leq \delta d_0+ 0.2\delta d_0 \leq 1.2\delta d_0. \end{equation*} Combining the estimation of $\Real(I_{01})$ and $\Real(I_{02})$ above leads to \begin{equation*} \Real( \langle \nabla F_{\boldsymbol{h}}, \Delta\boldsymbol{h}\rangle + \langle \nabla F_{\boldsymbol{x}}, \Delta\boldsymbol{x}\rangle) \geq \frac{\delta^2 d_0^2}{8} - 2\sqrt{s}\delta d_0 \|\mathcal{A}^*(\boldsymbol{e})\|. \end{equation*} \end{proof} \begin{lemma}{\bf (Local Regularity for $G(\boldsymbol{h},\boldsymbol{x})$}\label{lem:regG} For any $(\boldsymbol{h}, \boldsymbol{x}) \in \mathcal{N}_d \bigcap \mathcal{N}_{\epsilon}$ with $\epsilon \leq \frac{1}{15}$ and $\frac{9}{10}d_{0} \leq d \leq \frac{11}{10}d_{0}$, $\frac{9}{10}d_{i0} \leq d_i \leq \frac{11}{10}d_{i0}$, the following inequality holds uniformly \begin{equation} \label{eq:G_regularity} \Real\lp\langle \nabla G_{\boldsymbol{h}_i}, \Delta\boldsymbol{h}_i \rangle + \langle \nabla G_{\boldsymbol{x}_i}, \Delta\boldsymbol{x}_i \rangle\rp \geq 2\delta_0\sqrt{ \rho G_i(\boldsymbol{h}_i, \boldsymbol{x}_i)} = \frac{\delta}{5}\sqrt{ \rho G_i(\boldsymbol{h}_i, \boldsymbol{x}_i)}, \end{equation} where $\rho \geq d^2 + 2\|\boldsymbol{e}\|^2.$ Immediately, we have \begin{equation} \label{eq:G_regularity_demix} \Real\lp\langle \nabla G_{\boldsymbol{h}}, \Delta\boldsymbol{h} \rangle + \langle \nabla G_{\boldsymbol{x}}, \Delta\boldsymbol{x} \rangle\rp =\sum_{i=1}^s\Real\lp\langle \nabla G_{\boldsymbol{h}_i}, \Delta\boldsymbol{h}_i \rangle + \langle \nabla G_{\boldsymbol{x}_i}, \Delta\boldsymbol{x}_i \rangle\rp \geq {\frac{\delta}{5}}\sqrt{ \rho G(\boldsymbol{h}, \boldsymbol{x})}. \end{equation} \end{lemma} \begin{remark} For the local regularity condition for $G(\boldsymbol{h}, \boldsymbol{x})$, we use the results from~\cite{LLSW16} when $s=1$. This is because each component $G_i(\boldsymbol{h},\boldsymbol{x})$ only depends on $(\boldsymbol{h}_i,\boldsymbol{x}_i)$ by definition and thus the lower bound of $\Real\lp\langle \nabla G_{\boldsymbol{h}_i}, \Delta\boldsymbol{h}_i \rangle + \langle \nabla G_{\boldsymbol{x}_i}, \Delta\boldsymbol{x}_i \rangle\rp$ is completely determined by $(\boldsymbol{h}_i,\boldsymbol{x}_i)$ and $\delta_0$, and is independent of $s$. \end{remark} \begin{proof} For each $i:1\leq i\leq s$, $\nabla G_{\boldsymbol{h}_i}$ (or $\nabla G_{\boldsymbol{x}_i}$) only depends on $\boldsymbol{h}_i$ (or $\boldsymbol{x}_i$) and there holds \begin{equation*} \Real\lp\langle \nabla G_{\boldsymbol{h}_i}, \Delta\boldsymbol{h}_i \rangle + \langle \nabla G_{\boldsymbol{x}_i}, \Delta\boldsymbol{x}_i \rangle\rp \geq 2\delta_0\sqrt{ \rho G_i(\boldsymbol{h}_i, \boldsymbol{x}_i)} = \frac{\delta}{5}\sqrt{ \rho G_i(\boldsymbol{h}_i, \boldsymbol{x}_i)}, \end{equation*} which follows exactly from Lemma 5.17 in~\cite{LLSW16}. For~\eqref{eq:G_regularity_demix}, by definition of $\nabla G_{\boldsymbol{h}}$ and $\nabla G_{\boldsymbol{x}}$ in~\eqref{def:grad}, \begin{align*} \Real\lp\langle \nabla G_{\boldsymbol{h}}, \Delta\boldsymbol{h} \rangle + \langle \nabla G_{\boldsymbol{x}}, \Delta\boldsymbol{x} \rangle\rp & = \sum_{i=1}^s\Real\lp\langle \nabla G_{\boldsymbol{h}_i}, \Delta\boldsymbol{h}_i \rangle + \langle \nabla G_{\boldsymbol{x}_i}, \Delta\boldsymbol{x}_i \rangle\rp \\ &\geq \frac{\delta}{5} \sum_{i=1}^s\sqrt{ \rho G_i(\boldsymbol{h}_i, \boldsymbol{x}_i)} \geq \frac{\delta}{5}\sqrt{\rho G(\boldsymbol{h},\boldsymbol{x})} \end{align*} where $G(\boldsymbol{h},\boldsymbol{x}) = \sum_{i=1}^s G_i(\boldsymbol{h}_i,\boldsymbol{x}_i).$ \end{proof} \begin{lemma}{\bf (Proof of the Local Regularity Condition)} \label{lem:reg} Conditioned on~\eqref{eq:rip}, for the objective function $\widetilde{F}(\boldsymbol{h},\boldsymbol{x})$ in~\eqref{def:FG}, there exists a positive constant $\omega$ such that \begin{equation}\label{eq:regF} \|\nabla \widetilde{F}(\boldsymbol{h}, \boldsymbol{x})\|^2 \geq \omega \left[ \widetilde{F}(\boldsymbol{h}, \boldsymbol{x}) - c \right]_+ \end{equation} with $c = \|\boldsymbol{e}\|^2 + 2000s \|\mathcal{A}^*(\boldsymbol{e})\|^2$ and $\omega = \frac{d_0}{7000}$ for all $(\boldsymbol{h}, \boldsymbol{x}) \in \mathcal{N}_d \cap \mathcal{N}_{\mu} \cap \mathcal{N}_{\epsilon}$. Here we set $\rho \geq d^2 + 2\|\boldsymbol{e}\|^2.$ \end{lemma} \begin{proof} Following from Lemma~\ref{lem:regF} and Lemma~\ref{lem:regG}, we have \begin{eqnarray*} \Real( \langle \nabla F_{\boldsymbol{h}}, \Delta\boldsymbol{h}\rangle + \langle \nabla F_{\boldsymbol{x}}, \Delta\boldsymbol{x}\rangle) & \geq & \frac{\delta^2 d_0^2}{8} - 2\sqrt{s}\delta d_0 \|\mathcal{A}^*(\boldsymbol{e})\| \\ \Real( \langle \nabla G_{\boldsymbol{h}}, \Delta\boldsymbol{h} \rangle + \langle \nabla G_{\boldsymbol{x}}, \Delta\boldsymbol{x} \rangle) & \geq & \frac{\delta d}{5} \sqrt{ G(\boldsymbol{h}, \boldsymbol{x})} \geq \frac{9\delta d_0}{50}\sqrt{G(\boldsymbol{h}, \boldsymbol{x})} \end{eqnarray*} for all $(\boldsymbol{h}, \boldsymbol{x}) \in \mathcal{N}_d \cap \mathcal{N}_{\mu} \cap \mathcal{N}_{\epsilon}$ where $\rho \geq d^2 + 2\|\boldsymbol{e}\|^2 \geq d^2$ and $\frac{9}{10}d_0 \leq d \leq \frac{11}{10}d_0$. Adding them together gives $\Real\left (\langle \nabla \widetilde{F}_{\boldsymbol{h}}, \Delta\boldsymbol{h} \rangle + \langle \nabla \widetilde{F}_{\boldsymbol{x}}, \Delta\boldsymbol{x} \rangle\right)$ on the left side. Moreover, Cauchy-Schwarz inequality implies \begin{equation*} \Real\left (\langle \nabla \widetilde{F}_{\boldsymbol{h}}, \Delta\boldsymbol{h} \rangle + \langle \nabla \widetilde{F}_{\boldsymbol{x}}, \Delta\boldsymbol{x} \rangle\right) \leq 4\delta\sqrt{d_0} \| \nabla \widetilde{F}(\boldsymbol{h}, \boldsymbol{x})\| \end{equation*} where both $\|\Delta\boldsymbol{h}\|^2$ and $\|\Delta\boldsymbol{x}\|^2$ are bounded by $8\delta^2d_0$ in Lemma~\ref{lem:DxDh} since \begin{equation*} \|\Delta\boldsymbol{h}\|^2 = \sum_{i=1}^s \|\Delta\boldsymbol{h}_i\|^2 \leq \sum_{i=1}^s (7.5\delta_i^2 + 2.88\delta_0^2) d_{i0} \leq 8\delta^2 d_0. \end{equation*} Therefore, \begin{equation} \frac{\delta^2 d_0^2}{8} + \frac{ 9\delta d_0\sqrt{ G(\boldsymbol{h}, \boldsymbol{x})}}{50} - 2\sqrt{s}\delta d_0 \|\mathcal{A}^*(\boldsymbol{e}) \| \leq 4 \delta \sqrt{d_0} \| \nabla \widetilde{F}(\boldsymbol{h}, \boldsymbol{x})\|. \label{eq:nabla-tF} \end{equation} Dividing both sides of~\eqref{eq:nabla-tF} by $\delta d_0$, we obtain \begin{eqnarray*} \frac{4}{\sqrt{d_0}} \|\nabla \widetilde{F}(\boldsymbol{h}, \boldsymbol{x})\| & \geq & \frac{\delta d_0}{12} + \frac{9}{50}\sqrt{G(\boldsymbol{h}, \boldsymbol{x})} + \frac{\delta d_0 }{24} - 2\sqrt{s}\|\mathcal{A}^*(\boldsymbol{e})\| \\ & \geq & \frac{1}{6\sqrt{6}}[\sqrt{F_0(\boldsymbol{h},\boldsymbol{x})} + \sqrt{G(\boldsymbol{h}, \boldsymbol{x})}] + \frac{\delta d_0}{24} - 2\sqrt{s}\|\mathcal{A}^*(\boldsymbol{e})\| \end{eqnarray*} where the Local RIP condition~\eqref{eq:rip} implies $F_0(\boldsymbol{h}, \boldsymbol{x}) \leq \frac{3}{2}\delta^2 d_0^2$ and hence $\frac{\delta d_0}{12} \geq \frac{1}{6\sqrt{6}}\sqrt{F_0(\boldsymbol{h}, \boldsymbol{x})}$, where $F_0(\boldsymbol{h},\boldsymbol{x})$ is defined in~\eqref{def:F0}. Note that~\eqref{eq:cross} gives \begin{equation}\label{eq:AEHX} \sqrt{2\left[ \Real(\langle \mathcal{A}^*(\boldsymbol{e}), \boldsymbol{X} - \boldsymbol{X}_0\rangle) \right]_+} \leq \sqrt{ 2\sqrt{2s} \|\mathcal{A}^*(\boldsymbol{e})\| \delta d_0} \leq \frac{\sqrt{6}\delta d_0}{4} + \frac{4\sqrt{s}}{\sqrt{6}}\|\mathcal{A}^*(\boldsymbol{e})\|. \end{equation} By~\eqref{eq:AEHX} and $\widetilde{F}(\boldsymbol{h}, \boldsymbol{x}) - \|\boldsymbol{e}\|^2 \leq F_0(\boldsymbol{h}, \boldsymbol{x}) + 2 [\Real(\langle \mathcal{A}^*(\boldsymbol{e}), \boldsymbol{X} - \boldsymbol{X}_0\rangle)]_+ + G(\boldsymbol{h}, \boldsymbol{x})$, there holds \begin{eqnarray*} \frac{4}{\sqrt{d_0}} \|\nabla \widetilde{F}(\boldsymbol{h}, \boldsymbol{x})\| & \geq & \frac{1}{6\sqrt{6}} \Big[ \left(\sqrt{F_0(\boldsymbol{h}, \boldsymbol{x})} +\sqrt{2\left[ \Real(\langle \mathcal{A}^*(\boldsymbol{e}), \boldsymbol{X}-\boldsymbol{X}_0\rangle) \right]_+} + \sqrt{G(\boldsymbol{h}, \boldsymbol{x})}\right) \\ && + \frac{\delta d_0}{24} - \frac{1}{6\sqrt{6}} \left( \frac{\sqrt{6}\delta d_0}{4} + \frac{4\sqrt{s}}{\sqrt{6}}\|\mathcal{A}^*(\boldsymbol{e})\|\right) - 2\sqrt{s}\|\mathcal{A}^*(\boldsymbol{e})\|\\ & \geq & \frac{1}{6\sqrt{6}} \left[ \sqrt{ \left[\widetilde{F}(\boldsymbol{h}, \boldsymbol{x}) - \|\boldsymbol{e}\|^2\right]_+} - \sqrt{1000s}\|\mathcal{A}^*(\boldsymbol{e})\|\right]. \end{eqnarray*} For any nonnegative real numbers $a$ and $b$, we have $[\sqrt{(x - a)_+} - b ]_+ + b \geq \sqrt{(x - a)_+} $ and it implies \begin{equation*} ( x - a)_+ \leq 2 ( [\sqrt{(x - a)_+} - b ]_+^2 + b^2) \Longrightarrow [\sqrt{(x - a)_+} - b ]_+^2 \geq \frac{(x - a)_+}{2} - b^2. \end{equation*} Therefore, by setting $ a = \|\boldsymbol{e}\|^2$ and $b = \sqrt{1000s}\|\mathcal{A}^*(\boldsymbol{e})\|$, there holds \begin{eqnarray*} \|\nabla \widetilde{F}(\boldsymbol{h}, \boldsymbol{x})\|^2 & \geq & \frac{d_0}{3500} \left[ \frac{\widetilde{F}(\boldsymbol{h}, \boldsymbol{x}) - \|\boldsymbol{e}\|^2 }{2} - 1000s \|\mathcal{A}^*(\boldsymbol{e})\|^2 \right]_+ \\ & \geq & \frac{d_0}{7000} \left[ \widetilde{F}(\boldsymbol{h}, \boldsymbol{x}) - (\|\boldsymbol{e}\|^2 + 2000s \|\mathcal{A}^*(\boldsymbol{e})\|^2) \right]_+. \end{eqnarray*} \end{proof} \subsection{Local smoothness} \label{s:smooth} \begin{lemma} Conditioned on~\eqref{eq:rip},~\eqref{eq:robust} and~\eqref{eq:A-UPBD}, for any $\boldsymbol{z} : = (\boldsymbol{h}, \boldsymbol{x})\in\mathbb{C}^{(K+N)s}$ and $\boldsymbol{w} : = (\boldsymbol{u}, \boldsymbol{v})\in\mathbb{C}^{(K+N)s}$ such that $\boldsymbol{z}$ and $\boldsymbol{z}+\boldsymbol{w} \in \mathcal{N}_{\epsilon} \cap \mathcal{N}_{\widetilde{F}}$, there holds \begin{equation*} \| \nabla\widetilde{F}(\boldsymbol{z} + \boldsymbol{w}) - \nabla\widetilde{F}(\boldsymbol{z}) \| \leq C_L \|\boldsymbol{w}\|, \end{equation*} with \begin{equation*} C_L \leq \left(10\|\mathcal{A}\|^2d_0 + \frac{2\rho}{\min d_{i0}} \left( 5 + \frac{2L}{\mu^2} \right)\right) \end{equation*} where $\rho \geq d^2 + 2\|\boldsymbol{e}\|^2$ and $\|\mathcal{A}\| \leq \sqrt{s(N\log(NL/2) + (\gamma+\log s)\log L)}$ holds with probability at least $1 - L^{-\gamma}$ from Lemma~\ref{lem:A-UPBD}. In particular, $L = \mathcal{O}((\mu^2 + \sigma^2)s(K + N)\log^2 L)$ and $\|\boldsymbol{e}\|^2 = \mathcal{O}(\sigma^2d_0^2)$ follows from $\|\boldsymbol{e}\|^2 \sim \frac{\sigma^2d_0^2}{2L} \chi^2_{2L}$ and~\eqref{ineq:bern}. Therefore, $C_L$ can be simplified to \begin{equation*} C_L = \mathcal{O}(d_0s\kappa(1 + \sigma^2)(K + N)\log^2 L ) \end{equation*} by choosing $\rho \approx d^2 + 2\|\boldsymbol{e}\|^2.$ \end{lemma} \begin{proof} By \prettyref{lem:betamu}, we know that both $\vct{z}=(\vct{h}, \vct{x})$ and $\vct{z}+\vct{w}=(\vct{h}+\vct{u}, \vct{x}+\vct{v}) \in \mathcal{N}_d \cap \mathcal{N}_{\mu} \cap \mathcal{N}_{\epsilon}$. Note that \[ \nabla \widetilde{F} = (\nabla \widetilde{F}_{\boldsymbol{h}}, \nabla \widetilde{F}_{\boldsymbol{x}}) = (\nabla F_{\boldsymbol{h}} + \nabla G_{\boldsymbol{h}}, \nabla F_{\boldsymbol{x}} + \nabla G_{\boldsymbol{x}}), \] where~\eqref{eq:WFh},~\eqref{eq:WFx},~\eqref{eq:WGh} and~\eqref{eq:WGx} give $\nabla F_{\boldsymbol{h}},\nabla F_{\boldsymbol{x}},\nabla G_{\boldsymbol{h}}$ and $\nabla G_{\boldsymbol{x}}$. It suffices to find out the Lipschitz constants for all of those four functions. \paragraph{Step 1:} We first estimate the Lipschitz constant for $\nabla F_{\boldsymbol{h}}$ and the result can be applied to $\nabla F_{\boldsymbol{x}}$ due to symmetry. \begin{align*} \nabla F_{\boldsymbol{h}}(\boldsymbol{z} + \boldsymbol{w}) - \nabla F_{\boldsymbol{h}}(\boldsymbol{z}) &= \mathcal{A}^*\mathcal{A}( \mathcal{H}(\boldsymbol{h}+\boldsymbol{u},\boldsymbol{x} +\boldsymbol{v})) (\boldsymbol{x} + \boldsymbol{v}) - \left[ \mathcal{A}^*\mathcal{A}(\mathcal{H}(\boldsymbol{h},\boldsymbol{x}))\boldsymbol{x} + \mathcal{A}^*(\boldsymbol{y}) \boldsymbol{v}\right] \\ & = \mathcal{A}^*( \mathcal{A}(\mathcal{H}(\boldsymbol{h}+\boldsymbol{u}, \boldsymbol{x}+ \boldsymbol{v}) - \mathcal{H}(\boldsymbol{h},\boldsymbol{x})) )(\boldsymbol{x} + \boldsymbol{v}) \\ & \quad + \mathcal{A}^*\mathcal{A}( \mathcal{H}(\boldsymbol{h},\boldsymbol{x}) - \mathcal{H}(\boldsymbol{h}_0,\boldsymbol{x}_0) )\boldsymbol{v} - \mathcal{A}^*(\boldsymbol{e}) \boldsymbol{v} \\ & = \mathcal{A}^*( \mathcal{A}( \mathcal{H}(\boldsymbol{h}+\boldsymbol{u},\boldsymbol{v}) + \mathcal{H}(\boldsymbol{u}, \boldsymbol{x}) ) )(\boldsymbol{x} + \boldsymbol{v}) \\ & \quad + \mathcal{A}^*\mathcal{A}( \mathcal{H}(\boldsymbol{h},\boldsymbol{x}) - \mathcal{H}(\boldsymbol{h}_0,\boldsymbol{x}_0) )\boldsymbol{v} - \mathcal{A}^*(\boldsymbol{e}) \boldsymbol{v}. \end{align*} Note that $\|\mathcal{H}(\boldsymbol{h}, \boldsymbol{x})\|_F\leq \sqrt{\sum_{i=1}^s \|\boldsymbol{h}_i\|^2\|\boldsymbol{x}_i\|^2} \leq \|\boldsymbol{h}\|\|\boldsymbol{x}\|$ and $\boldsymbol{z}, \boldsymbol{z}+\boldsymbol{w} \in \mathcal{N}_d$ directly implies \begin{equation*} \|\mathcal{H}(\boldsymbol{u},\boldsymbol{x}) + \mathcal{H}(\boldsymbol{h}+\boldsymbol{u},\boldsymbol{v})\|_F \leq \|\vct{u}\| \|\vct{x}\| + \|\vct{h}+\vct{u}\|\|\vct{v}\| \leq 2\sqrt{d_0} (\|\boldsymbol{u}\| + \|\boldsymbol{v}\|) \end{equation*} where $\|\boldsymbol{h} + \boldsymbol{u}\| \leq 2\sqrt{d_0}.$ Moreover,~\eqref{eq:rip} implies \begin{equation*} \|\mathcal{H}(\boldsymbol{h},\boldsymbol{x}) - \mathcal{H}(\boldsymbol{h}_0,\boldsymbol{x}_0)\|_F \leq \epsilon d_0 \end{equation*} since $\boldsymbol{z}\in\mathcal{N}_d \cap \mathcal{N}_{\mu} \cap \mathcal{N}_{\epsilon}.$ Combined with $\|\mathcal{A}^*(\boldsymbol{e})\| \leq \varepsilon d_0$ in~\eqref{eq:robust} and $\|\boldsymbol{x} + \boldsymbol{v}\| \leq 2\sqrt{d_0}$, we have \begin{eqnarray} \|\nabla F_{\boldsymbol{h}}(\boldsymbol{z} + \boldsymbol{w}) - \nabla F_{\boldsymbol{h}}(\boldsymbol{z}) \| & \leq & 4d_0 \|\mathcal{A}\|^2(\|\boldsymbol{u}\| + \|\boldsymbol{v}\|) + \varepsilon d_0 \|\mathcal{A}\|^2 \|\boldsymbol{v}\| + \varepsilon d_0 \|\boldsymbol{v}\| \nonumber \\ & \leq & 5d_0 \|\mathcal{A}\|^2 ( \|\boldsymbol{u}\| + \|\boldsymbol{v}\|). \label{eq:LipFh} \end{eqnarray} Due to the symmetry between $\nabla F_{\boldsymbol{h}}$ and $\nabla F_{\boldsymbol{x}}$, we have, \begin{equation} \label{eq:LipFx} \|\nabla F_{\boldsymbol{x}}(\boldsymbol{z} + \boldsymbol{w}) - \nabla F_{\boldsymbol{x}}(\boldsymbol{z}) \| \leq 5d_0\|\mathcal{A}\|^2 ( \|\boldsymbol{u}\| + \|\boldsymbol{v}\|).\end{equation} In other words, \begin{equation* \| \nabla F(\boldsymbol{z} + \boldsymbol{w}) - \nabla F(\boldsymbol{z}) \| \leq 5\sqrt{2}d_0 \|\mathcal{A}\|^2(\|\boldsymbol{u}\| + \|\boldsymbol{v}\|) \leq 10d_0\|\mathcal{A}\|^2\|\boldsymbol{w}\| \end{equation*} where $\|\boldsymbol{u}\| + \|\boldsymbol{v}\| \leq \sqrt{2}\|\boldsymbol{w}\|.$ \paragraph{Step 2:} We estimate the upper bound of $\|\nabla G_{\boldsymbol{x}_i}(\boldsymbol{z}_i + \boldsymbol{w}_i) - \nabla G_{\boldsymbol{x}_i}(\boldsymbol{z}_i)\|$. Implied by Lemma~5.19 in~\cite{LLSW16}, we have \begin{align} \| \nabla G_{\boldsymbol{x}_i}(\boldsymbol{z}_i + \boldsymbol{w}_i) - \nabla G_{\boldsymbol{x}_i}(\boldsymbol{z}_i) \| \leq \frac{5d_{i0} \rho}{d_i^2} \|\boldsymbol{v}_i\|. \label{eq:LipGx} \end{align} \paragraph{Step 3:} We estimate the upper bound of $\|\nabla G_{\boldsymbol{h}_i}(\boldsymbol{z} + \boldsymbol{w}) - \nabla G_{\boldsymbol{h}_i}(\boldsymbol{z})\|$. Denote \begin{align*} \nabla G_{\boldsymbol{h}_i}(\boldsymbol{z} + \boldsymbol{w}) - \nabla G_{\boldsymbol{h}_i}(\boldsymbol{z}) &= \underbrace{\frac{\rho}{2d_i}\left[G'_0\left(\frac{\|\boldsymbol{h}_i + \boldsymbol{u}_i\|^2}{2d_i}\right) (\boldsymbol{h}_i + \boldsymbol{u}_i) - G'_0\left(\frac{\|\boldsymbol{h}_i\|^2}{2d_i}\right) \boldsymbol{h}_i\right] }_{\vct{j}_1} \\ & \underbrace{+ \frac{\rho L}{8d_i\mu^2 }\sum_{l=1}^L \left[G'_0\left(\frac{L|\boldsymbol{b}_l^*(\boldsymbol{h}_i + \boldsymbol{u}_i)|^2}{8d_i\mu^2}\right) \boldsymbol{b}_l^*(\boldsymbol{h}_i + \boldsymbol{u}_i) - G'_0\left(\frac{L|\boldsymbol{b}_l^*\boldsymbol{h}_i|^2}{8d_i\mu^2}\right) \boldsymbol{b}_l^*\boldsymbol{h}_i \right]\boldsymbol{b}_l}_{\vct{j}_2}. \end{align*} Following the same estimation of $\vct{j}_1$ and $\vct{j}_2$ in Lemma 5.19 of~\cite{LLSW16}, we have \begin{equation} \label{eq:LipG} \|\vct{j}_1\| \leq \frac{5d_{i0} \rho}{d_i^2} \|\boldsymbol{u}_i\|, \quad \|\vct{j}_2\| \leq \frac{3\rho Ld_{i0}}{2d_i^2\mu^2}\|\boldsymbol{u}_i\|. \end{equation} Therefore, combining~\prettyref{eq:LipGx} and \prettyref{eq:LipG} gives \begin{align*} \|\nabla G(\boldsymbol{z} + \boldsymbol{w}) - \nabla G(\boldsymbol{z})\| & = \sqrt{\sum_{i=1}^s \left(\| \nabla G_{\boldsymbol{h}_i}(\boldsymbol{z} + \boldsymbol{w}) - \nabla G_{\boldsymbol{h}_i}(\boldsymbol{z}) \|^2 + \| \nabla G_{\boldsymbol{x}_i}(\boldsymbol{z} + \boldsymbol{w}) - \nabla G_{\boldsymbol{x}_i}(\boldsymbol{z}) \|^2\right)} \\ & \leq \max\left\{\frac{5d_{i0} \rho}{d_i^2} + \frac{3\rho Ld_{i0}}{2d_i^2\mu^2}\right\} \sqrt{\sum_{i=1}^s\|\boldsymbol{u}_i\|^2} + \max\left\{\frac{5d_{i0} \rho}{d_i^2}\right\} \sqrt{\sum_{i=1}^s\|\boldsymbol{v}_i\|^2} \\ & \leq \max\left\{\frac{5d_{i0} \rho}{d_i^2} + \frac{3\rho Ld_{i0}}{2d_i^2\mu^2}\right\} \|\boldsymbol{u}\| + \max\left\{\frac{5d_{i0} \rho}{d_i^2}\right\} \|\boldsymbol{v}\| \\ & \leq \frac{2\rho}{\min d_{i0}} \left( 5 + \frac{2L}{\mu^2} \right)\|\boldsymbol{w}\|. \end{align*} In summary, the Lipschitz constant $C_L$ of $\widetilde{F}(\boldsymbol{z})$ has an upper bound as follows: \begin{align*} \|\nabla \widetilde{F}(\boldsymbol{z} + \boldsymbol{w}) - \nabla \widetilde{F}(\boldsymbol{z})\| & \leq \|\nabla F(\boldsymbol{z} + \boldsymbol{w}) - \nabla F(\boldsymbol{z})\| + \|\nabla G(\boldsymbol{z} + \boldsymbol{w}) - \nabla G(\boldsymbol{z})\| \\ & \leq \left(10\|\mathcal{A}\|^2d_0 + \frac{2\rho}{\min d_{i0}} \left( 5 + \frac{2L}{\mu^2} \right)\right) \|\boldsymbol{w}\|. \end{align*} \end{proof} \subsection{Robustness condition and spectral initialization} \label{s:init} In this section, we will prove the robustness condition~\eqref{eq:robust} and also Theorem~\ref{thm:init}. To prove~\eqref{eq:robust}, it suffices to show the following lemma, which is a more general version of~\eqref{eq:robust}. \begin{lemma}\label{lem:denoise} Consider a sequence of Gaussian independent random variable $\boldsymbol{c} = (c_1, \cdots, c_L)\in\mathbb{C}^L$ where $c_l\sim \mathcal{C}\mathcal{N}(0, \frac{\lambda_i^2}{L})$ with $\lambda_i \leq \lambda$. Moreover, we assume $\mathcal{A}_i$ in~\eqref{def:Ai} is independent of $\boldsymbol{c}$. Then there holds \begin{equation*} \|\mathcal{A}^*(\boldsymbol{c}) = \|\max_{1\leq i\leq s}\|\mathcal{A}_i^*(\boldsymbol{c} )\| \leq \xi \end{equation*} with probability at least $1 - L^{-\gamma}$ if $L \geq C_{\gamma + \log(s)}( \frac{\lambda}{\xi} +\frac{\lambda^2}{\xi^2} )\max\{ K,N \}\log L/\xi^2.$ \end{lemma} \begin{proof} It suffices to show that $\max_{1\leq i\leq s}\|\mathcal{A}_i^*(\boldsymbol{c})\| \leq \xi$. For each fixed $i:1\leq i\leq s$, \begin{equation*} \mathcal{A}_i^*(\boldsymbol{c}) = \sum_{l=1}^L c_l\boldsymbol{b}_l\boldsymbol{a}_{il}^* \end{equation*} The key is to apply the matrix Bernstein inequality~\eqref{thm:bern} and we need to estimate $\|\mathcal{Z}_l\|_{\psi_1}$, and the variance of $\sum_{l=1}^L \mathcal{Z}_l.$ For each $l$, $\| c_l \boldsymbol{b}_l\boldsymbol{a}_{il}^*\|_{\psi_1} \leq \frac{\lambda \sqrt{KN}}{L}$ follows from~\eqref{lemma:psi}. Moreover, the variance of $\mathcal{A}_i^*(\boldsymbol{c})$ is bounded by $\frac{\lambda^2 \max\{K,N\}}{L}$ since \begin{align*} \E [ \mathcal{A}_i^*(\boldsymbol{c}) (\mathcal{A}_i^*(\boldsymbol{c}) )^* ] & = \sum_{l=1}^L \E(|c_l|^2 \|\boldsymbol{a}_{il}\|^2)\boldsymbol{b}_l\boldsymbol{b}_l^* = \frac{N}{L} \sum_{l=1}^L \lambda_l^2\boldsymbol{b}_l\boldsymbol{b}_l^* \preceq \frac{\lambda^2 N}{L}, \\ \E [ (\mathcal{A}_i^*(\boldsymbol{c}) )^* (\mathcal{A}_i^*(\boldsymbol{c})) ] & = \sum_{l=1}^L \|\boldsymbol{b}_l\|^2 \E(|c_l|^2 \boldsymbol{a}_{il}\boldsymbol{a}_{il}^*) = \frac{K}{L^2} \sum_{l=1}^L \lambda_i^2 \boldsymbol{I}_N \preceq \frac{\lambda^2 K}{L}. \end{align*} Letting $t = \gamma\log L$ and applying~\eqref{thm:bern} leads to \begin{equation*} \|\mathcal{A}_i^*(\boldsymbol{c})\| \leq C_0\max\left\{ \frac{\lambda\sqrt{KN}\log^2 L}{L},\sqrt{\frac{C_{\gamma}\lambda^2\max\{K,N\}\log L}{L}}\right\} \leq \xi. \end{equation*} Therefore, by taking the union bound over $1\leq i\leq s$, \begin{equation*} \|\mathcal{A}_i^*(\boldsymbol{c})\| \leq \xi \end{equation*} with probability at least $1 - L^{-\gamma}$ if $L\geq C_{\gamma+\log(s)} (\frac{\lambda}{\xi} +\frac{\lambda^2}{\xi^2} )\max\{K,N\}\log^2L$. \end{proof} The robustness condition is an immediate result of Lemma~\ref{lem:denoise} by setting $\xi = \frac{\varepsilon d_0}{10\sqrt{2}s\kappa}$ and $\lambda = \sigma d_0.$ \begin{corollary}\label{cor:Ae}{\bf [Robustness Condition]} For $\boldsymbol{e} \sim \mathcal{C}\mathcal{N}(\boldsymbol{0}, \frac{\sigma^2d_0^2}{L}\boldsymbol{I}_L) $ \begin{equation*} \|\mathcal{A}_i^*(\boldsymbol{e})\| \leq \frac{\varepsilon d_0}{10\sqrt{2} s\kappa}, \quad \forall 1\leq i\leq s \end{equation*} with probability at least $1 - L^{-\gamma}$ if $L \geq C_{\gamma}(\frac{ s^2\kappa^2 \sigma^2}{\varepsilon^2} + \frac{s\kappa\sigma }{\varepsilon})\max\{K, N\} \log L$. \end{corollary} \begin{lemma}\label{lem:Ay-hx} For $\boldsymbol{e} \sim \mathcal{C}\mathcal{N}(\boldsymbol{0}, \frac{\sigma^2d_0^2}{L}\boldsymbol{I}_L) $, there holds \begin{equation}\label{eq:Ay-hx} \| \mathcal{A}_i^*(\boldsymbol{y}) - \boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^* \| \leq \xi d_{i0}, \quad \forall 1\leq i\leq s \end{equation} with probability at least $1 - L^{-\gamma}$ if $L \geq C_{\gamma+ \log (s)}s\kappa^2 (\mu^2_h + \sigma^2) \max\{K, N\} \log L /\xi^2.$ \end{lemma} \begin{remark} The success of the initialization algorithm completely relies on the lemma above. As mentioned in Section~\ref{s:thm}, $\E(\mathcal{A}_i^*(\boldsymbol{y})) = \boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*$ and Lemma~\ref{eq:Ay-hx} confirms that $\mathcal{A}_i^*(\boldsymbol{y})$ is close to $\boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*$ in operator norm and hence the spectral method is able to give us a reliable initialization. \end{remark} \begin{proof} Note that \begin{eqnarray*} \mathcal{A}_i^*(\boldsymbol{y}) & = & \mathcal{A}_i^*\mathcal{A}_i(\boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*) + \mathcal{A}_i^*(\boldsymbol{w}_i) \end{eqnarray*} where \begin{equation}\label{eq:AA} \boldsymbol{w}_i = \boldsymbol{y} - \mathcal{A}_i(\boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*) = \sum_{j\neq i} \mathcal{A}_j(\boldsymbol{h}_{j0}\boldsymbol{x}_{j0}^*) + \boldsymbol{e} \end{equation} is independent of $\mathcal{A}_i.$ The proof consists of two parts: 1. show that $\|\mathcal{A}_i^*\mathcal{A}_i(\boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*) - \boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*\| \leq \frac{\xi d_{i0}}{2}$; 2. prove that $\|\mathcal{A}_i^*(\boldsymbol{w}_i)\| \leq \frac{\xi d_{i0}}{2}$. \paragraph{Part I:} Following from the definition of $\mathcal{A}_i$ and $\mathcal{A}_i^*$ in~\eqref{def:Ai}, \begin{equation*} \mathcal{A}_i^*\mathcal{A}_i(\boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*) - \boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^* = \sum_{l=1}^L \underbrace{\boldsymbol{b}_l\boldsymbol{b}_l^*\boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*(\boldsymbol{a}_{il}\boldsymbol{a}_{il}^* - \boldsymbol{I}_N)}_{\text{defined as } \mathcal{Z}_l }. \end{equation*} where $\boldsymbol{B}^*\boldsymbol{B} = \boldsymbol{I}_K.$ The sub-exponential norm of $\mathcal{Z}_l$ is bounded by \begin{equation*} \|\mathcal{Z}_l\|_{\psi_1} \leq \max_{1\leq l\leq L}\|\boldsymbol{b}_l\| |\boldsymbol{b}_l^*\boldsymbol{h}_{i0}| \| (\boldsymbol{a}_{il}\boldsymbol{a}_{il}^* - \boldsymbol{I}_N) \boldsymbol{x}_{i0}\|_{\psi_1} \leq \frac{\mu\sqrt{KN}d_{i0}}{L} \end{equation*} where $\|\boldsymbol{b}_l\| = \sqrt{\frac{K}{L}}$, $\max_l|\boldsymbol{b}^*_l\boldsymbol{h}_{i0}|^2 \leq \frac{\mu^2 d_{i0}}{L}$ and $\| (\boldsymbol{a}_{il}\boldsymbol{a}_{il}^* - \boldsymbol{I}_N) \boldsymbol{x}_{i0}\|_{\psi_1} \leq \sqrt{Nd_{i0}}$ follows from~\eqref{lem:11JB}. We proceed to estimate the variance of $\sum_{l=1}^L \mathcal{Z}_l$ by using~\eqref{lem:9JB} and~\eqref{lem:12JB}: \begin{eqnarray*} \left\| \sum_{l=1}^L\E(\mathcal{Z}_l\mathcal{Z}_l^*)\right\| & = & \left\| \sum |\boldsymbol{b}_l^*\boldsymbol{h}_{i0}|^2 \boldsymbol{x}_{i0}^*\E(\boldsymbol{a}_{il} \boldsymbol{a}_{il}^* - \boldsymbol{I}_N)^2\boldsymbol{x}_{i0}\boldsymbol{b}_l\boldsymbol{b}_l^*\right\| \leq \frac{\mu^2N d_{i0}^2}{L}, \\ \left\| \sum_{l=1}^L\E(\mathcal{Z}_l^*\mathcal{Z}_l)\right\| & = & \frac{K}{L}\left\| \sum_{l=1}^L |\boldsymbol{b}_l^*\boldsymbol{h}_{i0}|^2 \E\left[ (\boldsymbol{a}_{il}\boldsymbol{a}_{il}^* - \boldsymbol{I}_N)\boldsymbol{x}_{i0}\boldsymbol{x}_{i0}^*(\boldsymbol{a}_{il}\boldsymbol{a}_{il}^* - \boldsymbol{I}_N)\right] \right\| \leq \frac{Kd_{i0}^2}{L}. \end{eqnarray*} Therefore, the variance of $\sum_{l=1}^L\mathcal{Z}_l$ is bounded by $\frac{\max\{K, \mu^2_hN\}d_{i0}^2}{L}$. By applying matrix Bernstein inequality~\eqref{thm:bern} and taking the union bound over all $i$, we prove that \begin{equation*} \|\mathcal{A}_i^*\mathcal{A}_i(\boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*) - \boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*\| \leq \frac{\xi d_{i0}}{2}, \quad \forall 1\leq i\leq s \end{equation*} holds with probability at least $1 -L^{-\gamma+1}$ if $L \geq C_{\gamma+\log(s)} \max\{K,\mu_h^2N\}\log L/\xi^2.$ \paragraph{Part II:} For each $1\leq l\leq L$, the $l$-th entry of $\boldsymbol{w}_i$ in~\eqref{eq:AA}, i.e., $(\boldsymbol{w}_i )_l = \sum_{j\neq i} \boldsymbol{b}_{l}^*\boldsymbol{h}_{j0}\boldsymbol{x}_{j0}^*\boldsymbol{a}_{jl} + e_l$, is independent of $\boldsymbol{b}^*_l\boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*\boldsymbol{a}_{il}$ and obeys $\mathcal{C}\mathcal{N}(0, \frac{\sigma_{il}^2}{L})$. Here \begin{eqnarray*} \sigma_{il}^2 & = & L\E|(\boldsymbol{w}_i)_l|^2 = L\sum_{j\neq i} |\boldsymbol{b}_{l}^*\boldsymbol{h}_{j0}|^2 \| \boldsymbol{x}_{j0} \|^2 + \sigma^2\|\boldsymbol{X}_0\|_F^2 \\ & \leq & \mu_h^2 \sum_{j\neq i}\|\boldsymbol{h}_{j0}\|^2 \|\boldsymbol{x}_{j0}\|^2 + \sigma^2\|\boldsymbol{X}_0\|_F^2 \leq (\mu_h^2 + \sigma^2) \|\boldsymbol{X}_0\|_F^2. \end{eqnarray*} This gives $\max_{i,l} \sigma_{il}^2\leq (\mu^2_h + \sigma^2) \|\boldsymbol{X}_0\|_F^2.$ Thanks to the independence between $\boldsymbol{w}_i$ and $\mathcal{A}_i$, applying Lemma~\ref{lem:denoise} results in \begin{equation}\label{eq:AA2} \|\mathcal{A}_i^*(\boldsymbol{w}_i)\| \leq \frac{\xi d_{i0}}{2} \end{equation} with probability $1 - L^{-\gamma + 1}$ if $L \geq C\max\left( \frac{(\mu_h^2 + \sigma^2) \|\boldsymbol{X}_0\|_F^2 }{\xi^2d_{i0}^2}, \frac{\sqrt{\mu^2_h + \sigma^2}\|\boldsymbol{X}_0\|_F }{\xi d_{i0}} \right)\max\{K,N\}\log L.$ \vskip0.5cm Therefore, combining~\eqref{eq:AA} with~\eqref{eq:AA2}, we get \begin{equation*} \|\mathcal{A}_i^*(\boldsymbol{y}) - \boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*\| \leq \|\mathcal{A}_i^*\mathcal{A}_i(\boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*) - \boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*\| + \|\mathcal{A}_i^*(\boldsymbol{w}_i)\| \leq \xi d_{i0} \end{equation*} for all $1\leq i\leq s$ with probability at least $1 - L^{-\gamma+1}$ if \begin{equation*} L \geq C_{\gamma+\log (s)}(\mu_h^2 + \sigma^2)s \kappa^2 \max\{K,N\}\log L/\xi^2 \end{equation*} where $\|\boldsymbol{X}_0\|_F/d_{i0} \leq \sqrt{s}\kappa.$ \end{proof} Before moving to the proof of Theorem~\ref{thm:init}, we introduce a property about the projection onto a closed convex set. \begin{lemma}[Theorem 2.8 in~\cite{RM11AP}]\label{lem:KMC} Let $Q := \{ \boldsymbol{w}\in\mathbb{C}^K | \sqrt{L}\|\boldsymbol{B}\boldsymbol{w}\|_{\infty} \leq 2\sqrt{d}\mu \}$ be a closed nonempty convex set. There holds \begin{equation*} \Real( \langle \boldsymbol{z} - \mathcal{P}_Q(\boldsymbol{z}) , \boldsymbol{w} - \mathcal{P}_Q(\boldsymbol{z}) \rangle ) \leq 0, \quad \forall \, \boldsymbol{w} \in Q, \boldsymbol{z}\in \mathbb{C}^K \end{equation*} where $\mathcal{P}_{Q}(\boldsymbol{z})$ is the projection of $\boldsymbol{z}$ onto $Q$. \end{lemma} With this lemma, we can easily see \begin{equation}\label{eq:nonexp} \|\boldsymbol{z} - \boldsymbol{w}\|^2 = \|\boldsymbol{z} - \mathcal{P}_Q(\boldsymbol{z})\|^2 + \|\mathcal{P}_Q(\boldsymbol{z}) - \boldsymbol{w}\|^2 + 2\Real(\langle \boldsymbol{z} - \mathcal{P}_Q(\boldsymbol{z}), \mathcal{P}_Q(\boldsymbol{z}) - \boldsymbol{w} \rangle) \geq \|\mathcal{P}_Q(\boldsymbol{z}) - \boldsymbol{w}\|^2 \end{equation} for all $\boldsymbol{z}\in\mathbb{C}^K$ and $\boldsymbol{w}\in Q$. It means that projection onto nonempty closed convex set is non-expansive. Now we present the proof of Theorem~\ref{thm:init}. \begin{proof}[\bf Proof of Theorem~\ref{thm:init}] By choosing $L \geq C_{\gamma+\log (s)}(\mu_h^2 + \sigma^2)s^2 \kappa^4 \max\{K,N\}\log L/\varepsilon^2$, we have \begin{equation}\label{eq:Ay-hx2} \|\mathcal{A}_i^*(\boldsymbol{y}) - \boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*\| \leq \xi d_{i0}, \quad \forall 1\leq i\leq s \end{equation} where $\xi = \frac{\varepsilon}{10\sqrt{2s}\kappa}$. By applying the triangle inequality to~\eqref{eq:Ay-hx2}, it is easy to see that \begin{equation}\label{eq:hd} (1 - \xi)d_{i0} \leq d_i \leq (1 + \xi)d_{i0}, \quad |d_{i} - d_{i0}| \leq \xi d_{i0} \leq \frac{\varepsilon d_{i0}}{10\sqrt{2s}\kappa} < \frac{d_{i0}}{10}, \end{equation} which gives $\frac{9}{10}d_{i0} \leq d_i \leq \frac{11}{10}d_{i0}$ where $d_i = \|\mathcal{A}_i^*(\boldsymbol{y})\|$ according to Algorithm~\ref{Initial}. \paragraph{Part I: Proof of $(\boldsymbol{u}^{(0)},\boldsymbol{v}^{(0)})\in \frac{1}{\sqrt{3}}\mathcal{N}_d \cap \frac{1}{\sqrt{3}}\mathcal{N}_{\mu}$} Note that $\boldsymbol{v}_i^{(0)} = \sqrt{d_i}\|\hat{\boldsymbol{x}}_{i0}\| = \sqrt{d_i}$ where $\hat{\boldsymbol{x}}_{i0}$ is the leading right singular vector of $\mathcal{A}_i^*(\boldsymbol{y}).$ Therefore, \begin{equation*} \| \boldsymbol{v}_i^{(0)} \| = \sqrt{d_i} \|\hat{\boldsymbol{x}}_{i0}\| = \sqrt{d_i} \leq \sqrt{(1 + \xi)d_{i0}} \leq \frac{2}{\sqrt{3}}\sqrt{d_{i0}}, \quad \forall 1\leq i\leq s \end{equation*} which implies $\{\boldsymbol{v}_i^{(0)}\}_{i=1}^s \in \frac{1}{\sqrt{3}}\mathcal{N}_d.$ Now we will prove that $\boldsymbol{u}_i^{(0)}\in \frac{1}{\sqrt{3}}\mathcal{N}_d\cap\frac{1}{\sqrt{3}}\mathcal{N}_{\mu}$ by Lemma~\ref{lem:KMC}. By Algorithm~\ref{Initial}, $\boldsymbol{u}_i^{(0)}$ is the minimizer to the function $f(\boldsymbol{z}) = \frac{1}{2} \| \boldsymbol{z} - \sqrt{d_i} \hat{\boldsymbol{h}}_{i0} \|^2$ over $Q_i := \{ \boldsymbol{z} | \sqrt{L}\|\boldsymbol{B}\boldsymbol{z}\|_{\infty} \leq 2\sqrt{d_i}\mu\}.$ Obviously, by definition, $\boldsymbol{u}_i^{(0)}$ is the projection of $\sqrt{d_i} \hat{\boldsymbol{h}}_{i0}$ onto $Q_i$. Note that $\boldsymbol{u}_i^{(0)}\in Q_i$ implies $\sqrt{L}\|\boldsymbol{B}\boldsymbol{u}_i^{(0)}\|_{\infty} \leq 2\sqrt{d_i}\mu\leq 2\sqrt{(1+\xi)d_{i0}}\mu \leq \frac{4\sqrt{d_{i0}}\mu}{\sqrt{3}}$ and hence $\boldsymbol{u}_i^{(0)}\in \frac{1}{\sqrt{3}} \mathcal{N}_{\mu}.$ Moreover, due to~\eqref{eq:nonexp}, there holds \begin{equation}\label{eq:KMC} \|\sqrt{d_i}\hat{\boldsymbol{h}}_{i0} - \boldsymbol{w}\|^2 \geq \|\boldsymbol{u}_i^{(0)} - \boldsymbol{w} \|^2, \quad \forall \boldsymbol{w}\in Q_i \end{equation} In particular, let $\boldsymbol{w} = \boldsymbol{0}\in Q_i$ and immediately we have \begin{equation*} \|\boldsymbol{u}_i^{(0)}\|^2 \leq d_i \leq \frac{4}{3} \Longrightarrow \boldsymbol{u}_i^{(0)}\in \frac{1}{\sqrt{3}}\mathcal{N}_{\mu}. \end{equation*} In other words, $\{(\boldsymbol{u}_i^{(0)}, \boldsymbol{v}_i^{(0)})\}_{i=1}^s \in \frac{1}{\sqrt{3}}\mathcal{N}_d\cap \frac{1}{\sqrt{3}}\mathcal{N}_{\mu}$. \paragraph{Part II: Proof of $(\boldsymbol{u}^{(0)},\boldsymbol{v}^{(0)})\in \mathcal{N}_{\frac{2\varepsilon}{5\sqrt{s}\kappa}}$} We will show $\|\boldsymbol{u}_i^{(0)}(\boldsymbol{v}_i^{(0)})^* - \boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*\|_F \leq 4\xi d_{i0}$ for $1\leq i\leq s$ so that $\frac{\|\boldsymbol{u}_i^{(0)}(\boldsymbol{v}_i^{(0)})^* - \boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*\|_F}{d_{i0}} \leq \frac{2\varepsilon}{5\sqrt{s}\kappa}$. \vskip0.25cm First note that $\sigma_j(\mathcal{A}_i^*(\boldsymbol{y})) \leq \xi d_{i0}$ for all $j\geq 2$, which follows from Weyl's inequality~\cite{Stewart90} for singular values where $\sigma_j(\mathcal{A}_i^*(\boldsymbol{y}))$ denotes the $j$-th largest singular value of $\mathcal{A}_i^*(\boldsymbol{y})$. Hence there holds \begin{equation}\label{eq:dhx-hx} \| d_i \hat{\boldsymbol{h}}_{i0}\hat{\boldsymbol{x}}_{i0}^* - \boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^* \| \leq \|\mathcal{A}_i^*(\boldsymbol{y}) - d_i \hat{\boldsymbol{h}}_{i0}\hat{\boldsymbol{x}}_{i0}^* \| + \|\mathcal{A}_i^*(\boldsymbol{y}) - \boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^* \| \leq 2\xi d_{i0}. \end{equation} On the other hand, for any $i$, \begin{align*} \left\| \left(\boldsymbol{I}_K - \frac{\boldsymbol{h}_{i0}\boldsymbol{h}_{i0}^*}{d_{i0}}\right)\hat{\boldsymbol{h}}_{i0} \right\| &= \left\| \left(\boldsymbol{I}_K - \frac{\boldsymbol{h}_{i0}\boldsymbol{h}_{i0}^*}{d_{i0}}\right) \hat{\boldsymbol{h}}_{i0}\hat{\boldsymbol{x}}_{i0}^*\hat{\boldsymbol{x}}_{i0}\hat{\boldsymbol{h}}_{i0}^* \right\| \\ &= \left\| \left(\boldsymbol{I}_K - \frac{\boldsymbol{h}_{i0}\boldsymbol{h}_{i0}^*}{d_{i0}}\right)\left[ \frac{1}{d_{i0}}(( \mathcal{A}_i^*(\boldsymbol{y}) - d_i \hat{\boldsymbol{h}}_{i0}\hat{\boldsymbol{x}}_{i0}^*) + \hat{\boldsymbol{h}}_{i0}\hat{\boldsymbol{x}}_{i0}^* - \frac{\boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*}{d_{i0}} \right] \hat{\boldsymbol{x}}_{i0}\hat{\boldsymbol{h}}_{i0}^* \right\| \\ &= \frac{1}{d_{i0}} \| \mathcal{A}_i^*(\boldsymbol{y}) - \boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^* \| + \left|\frac{d_i}{d_{i0}}-1\right| \leq 2\xi \end{align*} where $ (\boldsymbol{I}_K - \frac{\boldsymbol{h}_{i0}\boldsymbol{h}_{i0}^*}{d_{i0}}) \boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^* = \boldsymbol{0}$ and $(\mathcal{A}_i^*(\boldsymbol{y}) - d_i \hat{\boldsymbol{h}}_{i0}\hat{\boldsymbol{x}}_{i0}^*)\hat{\boldsymbol{x}}_{i0}\hat{\boldsymbol{h}}_{i0}^* = \boldsymbol{0}$. Therefore, we have \begin{equation}\label{eq:h0-h} \left\| \hat{\boldsymbol{h}}_{i0} - \frac{\boldsymbol{h}_{i0}^*\hat{\boldsymbol{h}}_{i0}}{d_{i0}} \boldsymbol{h}_{i0} \right\| \leq 2\xi, \quad \|\sqrt{d_i} \hat{\boldsymbol{h}}_{i0} - t_{i0} \boldsymbol{h}_{i0} \| \leq 2\sqrt{d_i}\xi, \end{equation} where $t_{i0} = \frac{\sqrt{d_i}\boldsymbol{h}_{i0}^*\hat{\boldsymbol{h}}_{i0}}{d_{i0}}$ and $|t_{i0}| \leq \sqrt{d_i/d_{i0}} <\sqrt{2}$. If we substitute $\boldsymbol{w}$ by $t_{i0} \boldsymbol{h}_{i0}\in Q_i$ into~\eqref{eq:KMC}, \begin{equation}\label{eq:h0-h-2} \|\sqrt{d_i}\hat{\boldsymbol{h}}_{i0} - t_{i0} \boldsymbol{h}_{i0}\| \geq \| \boldsymbol{u}_i^{(0)} - t_{i0} \boldsymbol{h}_{i0}\|. \end{equation} where $t_{i0} \boldsymbol{h}_{i0}\in Q_i$ follows from $\sqrt{L} |t_{i0}|\|\boldsymbol{B}\boldsymbol{h}_{i0}\|_{\infty} \leq |t_{i0}| \sqrt{d_{i0}}\mu_h \leq \sqrt{2d_{i0}}\mu$. \vskip0.5cm Now we are ready to estimate $\|\boldsymbol{u}^{(0)}_i(\boldsymbol{v}_i^{(0)})^* - \boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^* \|_F$ as follows, \begin{align*} \|\boldsymbol{u}^{(0)}_i(\boldsymbol{v}_i^{(0)})^* - \boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^* \|_F & \leq \|\boldsymbol{u}^{(0)}_i(\boldsymbol{v}_i^{(0)})^* - t_{i0}\boldsymbol{h}_{i0}(\boldsymbol{v}_i^{(0)})^* \|_F + \|t_{i0}\boldsymbol{h}_{i0}(\boldsymbol{v}_i^{(0)})^* - \boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^* \|_F \\ & \leq \underbrace{\|\boldsymbol{u}_i^{(0)} - t_{i0}\boldsymbol{h}_{i0}\| \|\boldsymbol{v}_i^{(0)}\|}_{I_1} + \underbrace{\left\| \frac{d_i}{d_{i0}} \boldsymbol{h}_{i0} \boldsymbol{h}^*_{i0} \hat{\boldsymbol{h}}_{i0} \hat{\boldsymbol{x}}_{i0}^* - \boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^* \right\|_F}_{I_2}. \end{align*} Here $I_1\leq 2\xi d_i$ because $\|\boldsymbol{v}_i^{(0)}\| = \sqrt{d_i}$ and $\|\boldsymbol{u}_i^{(0)} - t_{i0}\boldsymbol{h}_{i0}\| \leq 2\sqrt{d_i}\xi$ follows from~\eqref{eq:h0-h} and~\eqref{eq:h0-h-2}. For $I_2$, there holds \begin{equation*} I_2 = \left\| \frac{\boldsymbol{h}_{i0}\boldsymbol{h}_{i0}^*}{d_{i0}} \left(d_i \hat{\boldsymbol{h}}_{i0} \hat{\boldsymbol{x}}_{i0}^* - \boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*\right) \right\|_F \leq \|d_i \hat{\boldsymbol{h}}_{i0} \hat{\boldsymbol{x}}_{i0}^* - \boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^*\|_F \leq 2\sqrt{2}\xi d_{i0}, \end{equation*} which follows from~\eqref{eq:dhx-hx}. Therefore, \begin{align*} \|\boldsymbol{u}^{(0)}_i(\boldsymbol{v}_i^{(0)})^* - \boldsymbol{h}_{i0}\boldsymbol{x}_{i0}^* \|_F & \leq 2\xi d_i + 2 \sqrt{2}\xi d_{i0} \leq 5\xi d_{i0}\leq \frac{2\varepsilon d_{i0}}{5\sqrt{s}\kappa }. \end{align*} \end{proof} \section*{Appendix} \subsection*{Descent Lemma} \begin{lemma}[Lemma 6.1 in~\cite{LLSW16}]\label{lem:DSL} If $f(\boldsymbol{z}, \bar{\boldsymbol{z}})$ is a continuously differentiable real-valued function with two complex variables $\boldsymbol{z}$ and $\bar{\boldsymbol{z}}$, (for simplicity, we just denote $f(\boldsymbol{z}, \bar{\boldsymbol{z}})$ by $f(\boldsymbol{z})$ and keep in the mind that $f(\boldsymbol{z})$ only assumes real values) for $\boldsymbol{z} := (\boldsymbol{h}, \boldsymbol{x}) \in \mathcal{N}_{\epsilon}\cap\mathcal{N}_{\widetilde{F}}$. Suppose that there exists a constant $C_L$ such that \begin{equation*} \|\nabla f(\boldsymbol{z} + t \Delta \boldsymbol{z}) - \nabla f(\boldsymbol{z})\| \leq C_L t\|\Delta\boldsymbol{z}\|, \quad \forall 0\leq t\leq 1, \end{equation*} for all $\boldsymbol{z}\in \mathcal{N}_{\epsilon}\cap\mathcal{N}_{\widetilde{F}}$ and $\Delta \boldsymbol{z}$ such that $\boldsymbol{z} + t\Delta \boldsymbol{z} \in \mathcal{N}_{\epsilon}\cap\mathcal{N}_{\widetilde{F}}$ and $0\leq t\leq 1$. Then \begin{equation*} f(\boldsymbol{z} + \Delta \boldsymbol{z}) \leq f(\boldsymbol{z}) + 2\Real( (\Delta \boldsymbol{z})^T \overline{\nabla} f(\boldsymbol{z})) + C_L\|\Delta \boldsymbol{z}\|^2 \end{equation*} where $\overline{\nabla} f(\boldsymbol{z}) := \frac{\partial f(\boldsymbol{z}, \bar{\boldsymbol{z}})}{\partial \boldsymbol{z}}$ is the complex conjugate of $\nabla f(\boldsymbol{z}) = \frac{\partial f(\boldsymbol{z}, \bar{\boldsymbol{z}})}{\partial \bar{\boldsymbol{z}}}$. \end{lemma} \subsection*{Concentration inequality} We define the matrix $\psi_1$-norm via \begin{equation*} \|\boldsymbol{Z}\|_{\psi_1} := \inf_{u \geq 0} \{ \E[ \exp(\|\boldsymbol{Z}\|/u)] \leq 2 \}. \end{equation*} \begin{theorem}\label{thm:bern1}{\bf~\cite{KolVal11}} Consider a finite sequence of $\mathcal{Z}_l$ of independent centered random matrices with dimension $M_1\times M_2$. Assume that $R : = \max_{1\leq l\leq L}\|\mathcal{Z}_l\|_{\psi_1}$ and introduce the random matrix \begin{equation}\label{S} \mathcal{S} = \sum_{l=1}^L \mathcal{Z}_l. \end{equation} Compute the variance parameter \begin{equation}\label{sigmasq} \sigma_0^2 = \max\Big\{ \left\| \sum_{l=1}^L \E(\mathcal{Z}_l\mathcal{Z}_l^*)\right\|, \left\| \sum_{l=1}^L \E(\mathcal{Z}_l^* \mathcal{Z}_l)\Big\| \right\}, \end{equation} then for all $t \geq 0$ \begin{equation}\label{thm:bern} \|\mathcal{S}\| \leq C_0 \max\{ \sigma_0 \sqrt{t + \log(M_1 + M_2)}, R\log\left( \frac{\sqrt{L}R}{\sigma_0}\right)(t + \log(M_1 + M_2)) \} \end{equation} with probability at least $1 - e^{-t}$ where $C_0$ is an absolute constant. \begin{lemma}[Lemma 10-13 in~\cite{RR12}, Lemma 12.4 in~\cite{LS17b}] \label{lem:multiple1} Let $\boldsymbol{u}\in\mathbb{C}^n \sim \mathcal{C}\mathcal{N}(\boldsymbol{0}, \boldsymbol{I}_n)$, then $\|\boldsymbol{u}\|^2 \sim \frac{1}{2}\chi^2_{2n}$ and \begin{equation} \label{lem:8JB} \| \|\boldsymbol{u}\|^2 \|_{\psi_1} = \| \langle\boldsymbol{u}, \boldsymbol{u}\rangle \|_{\psi_1} \leq C n \end{equation} and \begin{equation} \label{lem:9JB} \E (\boldsymbol{u}\bu^* - \boldsymbol{I}_n)^2 = n\boldsymbol{I}_n. \end{equation} Let $\boldsymbol{q}\in\mathbb{C}^n$ be any deterministic vector, then the following properties hold \begin{equation} \label{lem:11JB} \| (\boldsymbol{u}\bu^* - \boldsymbol{I})\boldsymbol{q}\|_{\psi_1} \leq C\sqrt{n}\|\boldsymbol{q}\|, \end{equation} \begin{equation} \label{lem:12JB} \E[ (\boldsymbol{u}\bu^* - \boldsymbol{I})\boldsymbol{q}\bq^* (\boldsymbol{u}\bu^* - \boldsymbol{I})] = \|\boldsymbol{q}\|^2 \boldsymbol{I}_n. \end{equation} Let $\boldsymbol{v}\sim \mathcal{C}\mathcal{N}(\boldsymbol{0}, \boldsymbol{I}_m)$ be a complex Gaussian random vector in $\mathbb{C}^m$, independent of $\boldsymbol{u}$, then \begin{equation}\label{lemma:psi} \left\| \|\boldsymbol{u}\| \cdot \|\boldsymbol{v}\|\right\|_{\psi_1} \leq C\sqrt{mn}. \end{equation} \end{lemma} \end{theorem} \section*{Acknowledgement} S.Ling would like to thank Felix Krahmer and Dominik St\"{o}ger for the discussion about~\cite{SJK16}, and also thank Ju Sun for pointing out the connection between convolutional dictionary learning and this work.
{'timestamp': '2017-11-29T02:05:20', 'yymm': '1703', 'arxiv_id': '1703.08642', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08642'}
arxiv
\section*{Introduction}\label{sec:intro} Some biological systems are capable of maintaining an approximatively constant output despite environmental fluctuations. The ability to keep a constant \textit{steady state} has been called homeostasis or exact adaptation, a feature that is known to be achievable with integral feedback \cite{Barkal,alon1999robustness,stelling2004robustness,ma2009defining,briat2016antithetic}. The ability of preserving not only the steady state, but also the \textit{transient response} (i.e. the dynamic behaviour) has been less studied and, despite recent contributions \cite{karin,young2017dynamics}, the mechanisms that make it possible are still less well understood. To account for this property, Karin et al. \cite{karin} have recently introduced the concept of dynamical compensation, which they defined as follows: ``Consider a system with an input $u(t)$ and an output $y(t,s)$ such that $s > 0$ is a parameter of the system. The system is initially at steady state with $u(0) = 0$. Dynamical compensation (DC) with respect to $s$ is that for any input $u(t)$ and any (constant) $s$ the output of the system $y(t,s)$ does not depend on $s$. That is, for any $s_1$, $s_2$ and for any time-dependent input $u(t)$, $y(t,s_1) = y(t,s_2)$''. Karin et al. \cite{karin} used this this definition of dynamical compensation, which we refer to as ``DC1'', to describe a design principle that provides robustness to physiological circuits. The DC1 property is similar to the classic definition of structural unidentifiability. A parameter is structurally unidentifiable if it cannot be determined from any experiment, because there are different parameter values that produce the same observations. Using the same notation as in the DC1 definition, structural unidentifiability can be defined as follows \cite{ljung1994global,walter1997identification}: a parameter $s$ is structurally identifiable if it can be uniquely determined from the system output, that is, if for any $s_1$, $s_2$ it holds that $y(t,s_1) = y(t,s_2) \Leftrightarrow s_1 = s_2$. If this relationship does not hold for any $u(t)$, even in a small neighbourhood of $s$, the parameter is structurally unidentifiable. Thus, DC1 can be considered as a particular case of structural unidentifiability, with the additional requirement that the system is initially at steady state and with zero input \cite{sontag2016dynamic,villaverde2017dynamical}. Structural identifiability (SI) is a well-established concept with a long history of applications in the biological sciences \cite{bellman1970structural}. It was developed primarily by researchers working on the interface between biology and systems and control theor , long before the term ``systems biology'' became popular \cite{distefano2014dynamic}. Beginning with its original conception, it was recognized that structural identifiability is concerned with the theoretical existence of unique solutions and therefore is, strictly speaking, a mathematical \textit{a priori} problem \cite{jacquez1985numerical}. Solutions to \textit{a priori} problems depend only on the model’s structure (that is, the set of differential equations describing the dynamics of the system -- with the dependence on the inputs -- and the observation function that defines the measured variables) and not on the quality or quantity of the measurements the model is endeavouring to describe. This means that \textit{a priori} problems can be interrogated and completely understood before performing any experiments. Such interrogation is important: choosing a model structure is always based on arbitrary decisions that can have functional consequences, so testing structural properties allows us to detect defects in the chosen model structure before conducting further analysis \cite{walter1997identification}. For further information about the available methodologies for structural identifiability analysis we refer the reader to recent reviews and comparisons \cite{Chis11a,miao2011identifiability,grandjean2014structural,raue2014comparison,villaverde2016identifiability} and references therein. It should be noted that DC1 and structural unidentifiability are equivalent if we adopt a terminology commonly used in biological modelling, according to which the word ``parameter'' means a constant whose value is in general unknown \cite{distefano2014dynamic}. If all the parameters are assumed to be known, this equivalence does not apply because parameters are not being identified. However, in practice models usually contain a number of unknown parameters, whose values need to be determined. Even in those cases when parameter values can be obtained from the literature, they usually need to be reconciled with experimental data by some identification procedure based on input-output data \cite{van2006dynamic,jaqaman2006linking,ashyraliyev2008systems}. Thus, in realistic situations the correspondence between dynamical compensation and structural unidentifiability is relevant. In this context, lack of structural identifiability is typical of overly complex models, that is, those containing more parameters than can be supported by the evidence even in the utopian case of perfect measurements. As a consequence, the estimated values of structurally unidentifiable parameters are biologically meaningless. Structural identifiability is considered a prerequisite and necessary condition for the success of any parameter estimation procedure \cite{raue2014comparison,distefano2014dynamic,villaverde2016}. Furthermore, the use of a structurally unidentifiable model for predicting the time course of system variables that cannot be directly measured can produce wrong results \cite{cobelli1980parameter}. Hence, the usefulness of a model for obtaining biological insight is compromised if structural identifiability is not taken into account. In this paper we begin by illustrating the correspondence between the definition of dynamical compensation (DC1) and structural unidentifiability \cite{sontag2016dynamic,villaverde2017dynamical}, using the same case studies as in the original publication \cite{karin}. Then we suggest a more complete definition (DC2) drawing from ideas implicit in \cite{karin}. After discussing the implications that lack of structural identifiability has in biological modelling, we argue that it is important to assess, and ideally enforce, the structural identifiability of a model before using it to extract insights about the corresponding biological system. Given that structural identifiability is a desirable model property, we enquire whether it is possible to reconcile the concept of dynamical compensation with it. We provide a positive answer by suggesting an alternative definition of dynamical compensation (DC-Id) which does not necessarily imply lack of structural identifiability, and preserves the intended meaning of the DC concept. Using for illustrative purposes one of the circuits proposed by Karin et al. \cite{karin}, we explore different modelling choices, show how they affect the identifiability of the model, and propose feasible alternatives that lead to structurally identifiable models with dynamical compensation. \section*{Results}\label{sec:results} \subsection*{The original definition of dynamical compensation (DC1) is equivalent to structural unidentifiability}\label{sec:equiv} It was noted in the Introduction that, according to its original definition (DC1), dynamical compensation is equivalent to structural unidentifiability. Here we demonstrate this equivalence by interrogating the structural identifiability of the parameters of the four case studies presented in \cite{karin}. They are the circuits shown in Figure 1; they model possible regulatory mechanisms and are described by ordinary differential equations (ODEs). Since some of these models are nonlinear (C and D) and, in one case, also non-rational (circuit D), we used the STRIKE-GOLDD tool \cite{villaverde2016}, which is capable of analysing the structural identifiability of this type of systems. More details about the models and their analyses are provided in the Methods and Models section. \begin{figure*}[t] \begin{center} \includegraphics[width=1\linewidth]{4_circuits_diagram_original_par_names} \caption{Physiological systems used as case studies by Karin et al. \cite{karin}. Parameters $p$ and $s$ (or $s_i$) represent gain constants of the feedback loops present in the circuits.}\label{fig:4circuits} \end{center} \end{figure*} The parameters ($p, s$) of the two models exhibiting dynamical compensation -- i.e. the hormone circuit of Fig. 1C and the $\beta$IG model of Fig. 1D -- are structurally unidentifiable, while in the models that have exact adaptation but not dynamical compensation -- i.e. the ones shown in Fig. 1A and 1B -- those parameters are identifiable. Likewise, parameters ($\alpha, c, \gamma$) in the $\beta$IG model are structurally identifiable, as might be expected given that the model does not have dynamical compensation with respect to them. \subsection*{The meaning of dynamical compensation and an alternative definition (DC2)} The DC1 definition examined so far is the one explicitly provided by Karin et al. \cite{karin}. As explained above, DC1 does not mention explicitly certain aspects whose omission can lead to confusion, and in fact, it can be considered as a rephrasing of the structural unidentifiability property \cite{sontag2016dynamic,villaverde2017dynamical}. However, the concept of dynamical compensation was not introduced with the aim of describing the same issue as structural unidentifiability. Instead, it was purported to describe a different phenomenon, specifically relevant for the regulation of physiological systems. To clarify the intended meaning of dynamical compensation in the context it was proposed, we use the $\beta$IG model of Figure 1D as an example. This model describes a glucose homeostasis mechanism where $\beta$ stands for the beta-cell functional mass, $I$ for insulin, and $G$ for glucose. \begin{figure*}[t] \centering \includegraphics[width=1\linewidth]{Fig2c} \caption{Illustration of the phenomenon of dynamical compensation in a physiological circuit: the $\beta$IG model. The upper row shows the normal behaviour of the system for a given value of the $s_i$ parameter. The second row shows the evolution of the steady state after a change in the value of $s_i$. After a long adaptation period, which can take months, a new steady state is reached. Then, as shown in the third row, the response of the glucose concentration for the new parameter value is the same as the initial one (this does not happen for insulin and $\beta$-cell mass).} \label{fig:plots} \end{figure*} The time evolution of its three states in typical scenarios is shown in Figure \ref{fig:plots}. The first row describes the behaviour after a pulse in glucose, for example after meals. Both glucose and insulin concentrations reach peaks shortly after the meals, and in a few hours they return to their normal levels (steady state). The second row describes what happens if the value of a parameter, insulin sensitivity ($s_i$), is changed. Specifically, the figure represents the case in which $s_i^{new}=0.5s_i^{old}$. There is a slow adaptation of the system's steady state, which can take months, as seen in the figure. After this period the system has adapted to a new steady state: for glucose concentration it remains the same as the initial one, while the values of insulin concentration and $\beta$-cell mass are doubled. The third row illustrates the phenomenon of DC itself: after the adaptation to a new steady state has occurred, the output of the system (from the new steady state, and with the new value of insulin sensitivity) as a response to a pulse in glucose is \textit{the same as before the parameter change} (from the old steady state and the old parameter value). Note that only the glucose dynamics remains unchanged; for insulin and $\beta$-cell mass there is a scaling. In light of this behaviour, the following alternative definition of dynamical compensation (DC2) may be deduced from a detailed reading of the original paper by Karin et al.: \textbf{DC2 definition of dynamical compensation:} ``Consider a model of a dynamical system with an input $u(t)$, a set of states $x(t)$, and an output $y(t,s))$, such that $s > 0$ is a \textit{known} parameter. The system is initially at a steady state $x(0)=\xi$ with $u(0) = 0$. The dependence of the output on the initial steady state is denoted by $y(t,s,\xi)$. Dynamical compensation (DC) with respect to $s$ is that for any parameter values $s_1$, $s_2$, for any time-dependent input $u(t)$, and for two different initial steady states, $\xi_1 \neq \xi_2$, the output of the system does not depend on $s$, that is, $y(t,s_1, \xi_1) = y(t,s_2, \xi_2)$.'' \begin{figure*}[t] \centering \includegraphics[width=1\linewidth]{Fig3c} \caption{Dynamical compensation and structural unidentifiability in the $\beta$IG model. The first row reproduces the last row of Fig. \ref{fig:plots} and illustrates the phenomenon of dynamical compensation: after the system has adapted to the new value of $s_i$, the time-evolution of the glucose concentration (G) for the new value of ($s_i/2$) is the same as it was with the old value before adaptation ($s_i$). The second row illustrates the phenomenon of structural unidentifiability: the time-evolution of the glucose concentration (G) is the same for any value of the parameter $s_i$, as long as any deviations from the original value are compensated by changes in the parameter $p$. Note that, since the upper and lower plots of G are identical, if glucose is the only measured quantity both phenomena cannot be distinguished. However, the behaviour of the other state variables (I, $\beta$) can be very different, as can be noticed from the second and third columns.} \label{fig:plots3} \end{figure*} We have tried to keep this new definition, DC2, as similar as possible to DC1, and used the same notation. The DC2 definition of dynamical compensation makes it different from structural unidentifiability. However, it assumes that all model parameters are known, which is usually not realistic. Why is this requirement of known parameters necessary? Let us illustrate this point with Fig. \ref{fig:plots3}. It shows in its first row the aforementioned example of dynamical compensation, which has already been discussed (the first row in Fig. \ref{fig:plots3} is the same as the third one in \ref{fig:plots}). Now, let us assume that the parameters $p, s_i$ are unknown, to see the role played by structural unidentifiability. This is shown in the second row of Fig. \ref{fig:plots3}. It can be seen that different values of $s_i$ result in the same dynamic behaviour of glucose concentration, as long as the change in $s_i$ is compensated by a coordinated change in $p$. If, as suggested in \cite{karin}, glucose is the only measured variable, $p, s_i$ are structurally unidentifiable: their values cannot be determined, because there is an infinite number of possible combinations of values that yield the same output. This can be problematic, because choosing wrong values for $p, s_i$ results in incorrect predictions of the concentration of insulin, as can be observed in the second column. In fact, values of $p, s_i$ that yield the same curve of glucose can correspond to totally unrealistic curves of insulin. Importantly, since there is only one measured output (glucose), dynamical compensation cannot be distinguished from structural unidentifiability. For this reason, dynamical compensation can only be claimed if structural unidentifiability can be ruled out. This is the reason for enforcing known parameters in the DC2 definition. \subsection*{Implications of structural unidentifiability}\label{implications} The fact that a model is unidentifiable is important because, after five decades of research, it is now well understood that lack of structural identifiability is the result of choosing an inappropriate model structure for the available measurable variables (or variables that can be directly observed) \cite{walter1997identification,distefano2014dynamic}. When understood in this way, structural unidentifiability can be avoided or surmounted in at least three ways: (i) by reducing the number of parameters or changing their definition, (ii) by increasing the number of measured variables, if possible, or (iii) by determining the unidentifiable parameters in some alternative way, e.g. by direct measurements. Strategy (i) entails reformulating the model to remove redundant parameters, for example, by grouping several non-identifiable parameters into a single identifiable one. Perhaps the simplest example would be the merging of two parameters that multiply each other into a single one, i.e. $p_{\text{new}}= p_1\times p_2$. Such relationships can be revealed systematically by performing a structural identifiability analysis. Strategy (ii) can be illustrated with the ``$\beta$IG'' model: if it were possible to measure all its three states instead of only glucose, all the parameters in the $\beta$IG model would become structurally identifiable. In other words, while the effect on the glucose concentration (G) of a change in $p$ can be compensated by changing $s_i$, this does not happen for the insulin concentration (I). This point will be discussed in more detail in the following section. Strategy (iii) was applied for example by Watson et al. \cite{watson2011new}. After determining that two parameters in a homeostatic model were structurally unidentifiable, they decided to measure one of them by means of a tracer experiment and to calculate an estimate of the other using a steady state assumption. We will discuss a similar assumption in the context of the $\beta$IG model in the next section. Strategies (ii) and (iii) demonstrate how measurements and data can directly inform modelling decisions. More generally, structural identifiability analysis can inform expectations about how precisely a model can be defined, given measurements and data. For example, if the state of a system changes very little when a parameter varies, the system is said to be robust or insensitive to variations in that parameter \cite{distefano2014dynamic}. Speaking in terms of identifiability, this situation corresponds to poor \textit{practical} (or \textit{numerical}) \textit{identifiability}. Although the value of the parameter has some influence on the model output, its effect is too small to allow for its precise determination due to limitations in data quantity and/or quality\cite{jacquez1985numerical,walter1997identification}. In contrast, when the sensitivity of the model output to a parameter is exactly zero -- as implied by DC1 -- it corresponds to lack of \textit{structural identifiability}. In this case, the value of the parameter has no influence at all on the model output. As recently stressed by Janz\'en et al. \cite{janzen2016}, the danger of inadvertently using a structurally unidentifiable model is that the biological interpretations of its parameters are not valid, which may lead to wrong conclusions; furthermore, any predictions involving unmeasured states ``may be meaningless if the parameters directly or indirectly related to those states are unidentifiable'' \cite{janzen2016}. This can be illustrated with the $\beta$IG model, as seen in the second row of Fig. \ref{fig:plots3}: if we try to estimate the $p,s_i$ parameters from glucose (G) measurements, we will not be able to recover their true values, because they are structurally unidentifiable: there is an infinite number of combinations of their values that yield the same glucose profile. This, in turn, means that we cannot use the model to predict the time-course of insulin concentration (I), which is an unmeasured state. As seen in the lower plot of the second column, the predictions of insulin can be very different depending on the pair of $p,s_i$ values used. While structural identifiability analysis does not inform us of the plausibility of a biological mechanism, it can warn us that a particular model formulation is not adequate for describing the mechanism. In the words of Bellman and {\AA}str{\"o}m \cite{bellman1970structural}, the concept of structural identifiability ``is useful when answering questions such as: To what extent is it possible to get insight into the internal structure of a system from input-output measurements? What experiments are necessary in order to determine the internal couplings uniquely?'' Physiological models have often been the subject of structural identifiability analyses in the past; these studies may serve to illustrate why asking these questions make one’s interpretation of the model more rigorous. For example, DiStefano III \cite{distefano2014dynamic} reported identifiability issues in models of blood glucose control such as the classic one by Bolie \cite{Bolie}, among others. The Bolie model (see the Methods section for details) has two state variables, glucose and insulin, and five parameters. None of its parameters are identifiable if plasma glucose concentration is the only measured variable (let us refer to this model, which includes one observable, as ``Bolie A''). However, if insulin concentration is also measured (``Bolie B''), all of them become identifiable. If it is not possible to measure insulin, a structurally identifiable model can be obtained by reducing the number of unknown parameters to three, e.g. by fixing the values of two of them (``Bolie C''). The search for DC1 in model ``Bolie A'' could lead to the conclusion that the proposed mechanism for glucose concentration is infinitely robust to changes in the values of its parameters, and that this represents a biologically relevant feature. However, the same mechanism becomes structurally identifiable when modelled as ``Bolie B'' or ``Bolie C''. This example remarks that structural unidentifiability is not a property of a given mechanism, but a consequence of modelling choices. It should be noted that structural identifiability has close links with other properties, namely observability and controllability \cite{distefano1977relationships}, which provide important information about a dynamic model. Observability determines whether it is possible to reconstruct the internal state of a model by observing its output, while controllability determines the states that the system can reach by manipulating its input. Identifiability and observability are tightly related; in fact, structural identifiability analysis can be recast as observability analysis by considering the model parameters as constant state variables. This is the approach adopted by the STRIKE-GOLDD toolbox \cite{villaverde2016} used in our analyses. In turn, observability and controllability are usually considered as dual concepts. These three distinct but not unrelated properties -- identifiability, observability, and controllability -- can be analysed for general nonlinear ODE models using differential geometric approaches, which are described e.g. in \cite{Vidyasagar1993,sontag1982mathematical}. Finally, it should be mentioned that in a realistic parameter estimation scenario it is also necessary to take into account limitations introduced by the quantity and quality of the available data. This is the related topic of \textit{practical} or \textit{numerical} identifiability, which aims at quantifying the uncertainty in the estimated parameter values that results not only from the model structure but also from data limitations \cite{jacquez1985numerical,walter1997identification,distefano2014dynamic,villaverde2016identifiability}. \subsection*{Dynamical compensation in realistic scenarios: DC-Id}\label{sec:dc2} In reality, biological models almost always have a number of unknown parameters, whose values must be determined before the model can be used in practical applications. In this context the following question naturally arises: how does the behaviour described by the concept of dynamical compensation relate with structural identifiability of the parameters in the model? As we have already mentioned structural unidentifiability was shown to be equivalent to the (original explicit definition of) dynamical compensation \cite{sontag2016dynamic,villaverde2017dynamical}. Is this, then, the end of the question? Are systems with dynamical compensation ``doomed'' to be represented by structurally unidentifiable models, thus potentially limiting the biological insight that can be extracted from them? We claim here that this is not necessarily the case, provided that we reformulate the definition of dynamical compensation. To show this, let us examine in more detail the structural identifiability of a system with dynamical compensation, the $\beta$IG model of Fig. 1D. We analysed the structural identifiability of this model in its original formulation earlier in this paper, when we showed that the original definition of dynamical compensation (DC1) is equivalent to structural unidentifiability. In that section we showed that, when its five parameters $(p,s_i,\gamma,c,\alpha)$ are considered unknown and plasma glucose concentration (G) is the only available measurement, the $\beta$IG model is structurally unidentifiable. More specifically, the two parameters that exhibit dynamical compensation ($p,s_i$) are unidentifiable, while the remaining three are identifiable. Let us now see the results of such analysis when we change key aspects of the model, while preserving its dynamics. The two main choices we can play with are: (i) which parameters of the model are considered unknown, and therefore need to be estimated; and (ii) which measurements are possible. Regarding the first choice (i), we analyse not only the five-parameter case considered by Karin et al., but also other representative scenarios: when the unknown parameters are $\{s_i,\gamma,c,\alpha\}$ (i.e., all but $p$), when they are $\{p,s_i\}$, and when there is only one unknown, $s_i$. The second choice (ii) defines the output function of the model. While in general the output can be any function of the states, typically it consists of a subset of the states. In the version of the $\beta$IG model used by Karin et al. \cite{karin} the only measured variable was glucose concentration (G). Here we consider all the possibilities, to assess the consequences of measuring every possible combination of the three state variables of the model: glucose (G) and insulin (I) concentrations, and beta-cell mass ($\beta$). Let us consider that all three measurements could be in principle feasible (although in principle it seems much easier to measure G and I than $\beta$). The set of 28 alternative model configurations and the corresponding results of the structural identifiability analysis are summarized in Table \ref{tab:si_results}. \begin{table}[ht] \centering \begin{tabular}{c|c|c|c|c|} \cline{2-5} & \multicolumn{4}{c|}{ \cellcolor{gray}\textbf{Unknown parameters}}\\ \hline \rowcolor{gray} \multicolumn{1}{|c|}{\textbf{Outputs}} & $\{\alpha,\gamma,c,p,s_i\}$ & $\{p,s_i\}$ & $\{\alpha,\gamma,c,s_i\}$& $s_i$ \\ \hline \multicolumn{1}{|c|}{G} & $\{p,s_i\}$ & $\{p,s_i\}$ & $s_i$ & $s_i$ \\ \multicolumn{1}{|c|}{$\beta$} & $\{p,s_i\}$ & $\{p,s_i\}$ & - & - \\ \multicolumn{1}{|c|}{I} & $p$ & $p$ & - & - \\ \hline \multicolumn{1}{|c|}{G,I} & $p$ & $p$ & - & - \\ \multicolumn{1}{|c|}{G,$\beta$} & $\{p,s_i\}$ & $\{p,s_i\}$ & - & - \\ \multicolumn{1}{|c|}{I,$\beta$} & - & - & - & - \\ \hline \multicolumn{1}{|c|}{$\beta$,I,G} & - & - & - & - \\ \hline \end{tabular} \caption{\label{tab:si_results}\textbf{Structurally unidentifiable parameters for different configurations of the $\beta$IG model.} The choice of measured outputs and parameters considered unknown determines the identifiability of the remaining parameters (those considered to be unknown). Four representative choices of parameters are studied: (i) with all the model parameters $\{\alpha,\gamma,c,p,s_i\}$ considered unknown, (ii) with the two parameters $\{p,s_i\}$ that may exhibit dynamical compensation considered unknown, (iii) with all but $p$ unknown, and (iv) with only one parameter, $s_i$, considered unknown.} \end{table} From these results we highlight the following observations: \begin{itemize} \item The three parameters that do not have dynamical compensation, $\{\alpha,\gamma,c\}$, are always identifiable in this model, and knowing them does not change the identifiability of those that have dynamical compensation, $\{p,s_i\}$ (note that the second and third columns in Table \ref{tab:si_results} are identical, and so are the fourth and fifth). \item If glucose (G) is the only output, it is always impossible to identify $s_i$, even if all the remaining parameters are known. \item If other state variables can be measured, measuring also glucose does not improve the structural identifiability. \item The ``cheapest'' ways of obtaining an identifiable model are: \begin{enumerate}[label=(\Alph*)] \item If $p$ is assumed to be known, or can be estimated in some way other than from input-output data, we obtain a structurally identifiable model by measuring only insulin concentration (we could measure $\beta$-cell mass instead of insulin, but this seems to be technically more difficult, or maybe unfeasible). \item If all parameters including $p$ are unknown: since the $\beta$-cell mass changes very little (as can be seen in Fig. \ref{fig:plots3}), we can assume it constant and use as an estimate of it a single measurement obtained in the past. With this assumption it suffices to monitor the insulin concentration to obtain an identifiable model. \end{enumerate} \end{itemize} It can be noticed that there is substantial variability in the identifiability results depending on the modelling choices. We remark however that these choices do not alter the dynamics: the dynamic behaviour of the system is the same for all the different configurations above. How do these different configurations affect dynamical compensation? Both the original definition of dynamical compensation (DC1) and the second one (DC2) consider single-output models. Specifically, Karin et al. demonstrated that the $\beta$IG model has dynamical compensation in glucose concentration (G) with respect to the $\{p,s_i\}$ parameters. As can be seen in the first row of Table \ref{tab:si_results}, both parameters are structurally unidentifiable when G is the only output. To break this correspondence between dynamical compensation and structural unidentifiability we might interpret the ``output'' in the DC definition to be multi-dimensional. If we measure not only glucose but also other state variable(s) we can make $\{p,s_i\}$ identifiable, at least in some cases. However, this would entail losing the dynamical compensation property, because it holds for glucose but not for the other state variables that may form the output of the system. Thus, additional precisions should be incorporated into our working definition of dynamical compensation in order to make it describe a meaningful systemic property without being equivalent to structural unidentifiability. In light of this, we propose the following definition of dynamical compensation, which we call DC-Id: \textbf{DC-Id definition of dynamical compensation:} ``Consider a nonlinear time-invariant dynamic system modelled as a structure $M$ with the following equations: \begin{equation}\label{eq:M} M:\left\{% \begin{array}{lll} \dot{x}(t) & = & f(x(t),p,u(t))\\ y(t) & = & h(x(t),p)\\ x_0 & = & \xi(p)\\ \end{array}% \right. \end{equation} \noindent where $f$ and $h$ are vector functions, $p\in\mathbb{R}^q$ is a real-valued vector of parameters, $u\in\mathbb{R}^r$ is the input vector, $x\in\mathbb{R}^n$ the state variable vector, and $y\in\mathbb{R}^m$ the output or observables vector. The parameters $p$ can be known or unknown constants. The system is initially at a steady state $\xi$, with $u(0) = 0$. The initial state is denoted as $x_0$. The dependence of the $i^{th}$ output $y_i(t)$ on the initial steady state and on a particular value of a parameter $p_i \subset p$ can be made explicit by writing it as $y_i(t|p_i=k,x_0=\xi)$. Then, dynamical compensation (DC) of a particular model output $y_i \subset y$ with respect to a parameter $p_i \subset p$ is that, for any two values of $p_i$ ($k_1$ and $k_2$) and for two different initial steady states ($\xi_1 \neq \xi_2$), the output $y_i$ does not depend on $p_i$, that is, $y_i(t|p_i=k_1, x_0=\xi_1) = y_i(t|p_i=k_2, x_0=\xi_2)$, for any time-dependent input $u(t)$.'' This new definition effectively distinguishes the phenomenon of dynamical compensation from the structural unidentifiability property, by explicitly acknowledging that it applies to a subset (possibly only one) of the model outputs and to a subset of the parameters. When applied to the different model configurations of Table \ref{tab:si_results}, the DC-Id definition yields that there is indeed dynamical compensation for the G output (glucose concentration) with respect to the $\{p,s_i\}$ parameters in all cases, and not only for the unidentifiable ones. \section*{Discussion}\label{sec:conclusions} The ability to exhibit robust behaviour in the face of changing external conditions is a remarkable feature of many biological processes. It is now widely accepted that negative feedback plays a central role in biological phenomena such as homeostasis. Feedback mechanisms are capable of rendering a system robust to a wide range of external disturbances (or, in other words, they can compensate for changes in environmental conditions). Dynamic modelling is a powerful tool for analysing possible regulatory mechanisms, such as feedback circuits, and gaining insight about the corresponding biological systems. However, modelling artefacts such as those arising from structural unidentifiability may lead to wrong conclusions if not properly accounted for. The reason is that a system's dynamics determines what it can \textit{do}, while its identifiability (and observability) determines what we can \textit{know} about it. Hence deficiencies in identifiability may lead to wrong reconstructions of a system's behaviour. Therefore, the structural identifiability of a model should be assessed before the model is used to extract insights about (and ultimately understand) the corresponding biological system. For this reason we believe that it is necessary and useful to draw an explicit connection between the newly coined concept of dynamical compensation and the existing literature and theory on structural identifiability, especially taking into account that parameter identification is an ubiquitous need in biological modelling. With this aim, in the present work we have shown that the absence of such connection in the paper that introduced dynamical compensation \cite{karin} led to an ambiguous definition of the concept, which we have termed DC1. The fact that DC1 is essentially equivalent to structural unidentifiability when examined from the viewpoint of model identification \cite{sontag2016dynamic,villaverde2017dynamical} is a source of potential confusion: it opens the door to (i) interpreting as dynamical compensation what might be a case of structural unidentifiability, and to (ii) inadvertently using structurally unidentifiable models. Such use has associated risks, which we have discussed in this work. It is possible to deduce from a detailed reading of the original paper \cite{karin} an alternative definition of dynamical compensation, which we have called DC2. While DC2 can be considered implicit in \cite{karin}, we have stated it explicitly in the present paper and have shown that it removes some ambiguities of DC1. However, neither DC1 nor DC2 are appropriate for realistic modelling scenarios, in which it is necessary to estimate the values of parameters from input-output data. To address this issue we have proposed a modification of the definition of dynamical compensation which can be used in such cases. Our new definition, termed DC-Id, captures the biological meaning of the dynamical compensation phenomenon, which is the invariance of the dynamics of certain state variables of interest with respect to changes in the values of certain parameters. But, additionally, it includes precisions that make it distinct from structural unidentifiability, even in the context of parameter identification -- that is, when it is necessary to determine the values of the model parameters. In summary, we have discussed three alternative definitions of dynamical compensation, which we have termed DC1, DC2, and DC-Id. We have seen that DC1 is equivalent to structural unidentifiability, DC2 is different but of limited utility, and the proposed DC-Id is unambiguous and generally applicable. We see the discussion held in the present paper and the resulting clarification as an example of the gains that can be obtained by exchanging more notes among the different communities working in systems biology, which we have advocated elsewhere \cite{villaverde2014reverse}. Such an exchange of notes increases researchers' awareness of community-specific knowledge and is useful for avoiding potential misconceptions. \section*{Methods and Models}\label{sec:methods} \subsection*{Mathematical notation} Following the convention usually adopted when modelling dynamical systems, we use: $x$ to refer to state variables, $u$ for inputs, $y$ for outputs, and $p$ for parameters. States, inputs, and outputs are in general time-varying, while parameters are constants. We consider models described by ordinary differential equations of the following general form: \begin{equation}\label{eq:model_x} M:\left\{% \begin{array}{lll} \dot{x}(t) & = & f(x(t),p,u(t))\\ y(t) & = & h(x(t),p)\\ x_0 & = & x(p)\\ \end{array}% \right. \end{equation} where $f$ and $h$ are analytic vector functions of the states and parameters, which are in general nonlinear (linear models are a particular case). For ease of notation we will omit the dependence of $f$ and $h$ on $p$, and denote initial values of state variables or inputs as $x_0=x(0)$ and $u_0=u(0)$, respectively. We will also generally drop the time dependence, i.e. we will write $x$ instead of $x(t)$, and so on. Note that by ``model structure'' we refer not only to the dynamic equations ($\dot{x}$) but also to the definition of the observation function, or set of measured model outputs ($y$), and the known input variables ($u$). \subsection*{Nonlinear observability} Among the existing approaches for structural identifiability (SI) analysis, we adopt one that considers SI as a generalization of observability -- the property that allows reconstructing the internal state ($x$) of a model from observations of its outputs ($y$). If a model is observable there is a unique mapping from $y$ to $x$, and two different states will lead to two different outputs. Observability is a classic system-theoretic property introduced by Kalman for linear systems, and extended to the nonlinear case by Hermann and Krener \cite{hermann1977nonlinear}, among others. It can be studied with a differential geometry approach, as described in the remainder of this subsection. A thorough treatment of this matter can be found in \cite{Vidyasagar1993,sontag1982mathematical}. Observability analysis determines if the mapping from $y$ to $x$ is unique by analysing the expression of $y=h(x)$ and its derivatives. This is done by constructing an observability matrix that defines this mapping, and then calculating its rank. If the matrix is full rank then there is a one-to-one correspondence between outputs and states, and the system is observable. If not, the same output can be produced by several state vectors, and the system is unobservable. In the nonlinear case, the observability matrix is built using Lie derivatives. The Lie derivative of $h$ with respect to $f$ is: \begin{equation} L_f h(x) = \frac{\partial h(x)}{\partial x}f(x,u) \end{equation} Higher order Lie derivatives can be calculated from the lower order ones as: \begin{align} \begin{array}{rcl} L_f^2 h(x) & = & \frac{\partial L_f h(x)}{\partial x}f(x,u) \\ & \cdots & \\ L_f^i h(x) & = & \frac{\partial L_f^{i-1} h(x)}{\partial x}f(x,u) \end{array} \end{align} The nonlinear observability matrix can be written as: \begin{align}\label{nonlinobs} {\mathcal O}(x) = \left( \begin{array}{c} \frac{\partial }{\partial x}h(x) \\ \frac{\partial }{\partial x}(L_f h(x)) \\ \frac{\partial }{\partial x}(L_f^2 h(x)) \\ \vdots \\ \frac{\partial }{\partial x}(L_f^{n-1}h(x))\\ \end{array} \right) \end{align} \noindent where $n$ is the dimension of the state vector $x$. We can now formulate the \textit{Observability Rank Condition (ORC)} as follows: if the system given by (\ref{eq:model_x}) satisfies $\text{rank}({\mathcal O}(x_0)) = n$, where ${\mathcal O}$ is defined by (\ref{nonlinobs}), then it is (locally) observable around $x_0$ \cite{hermann1977nonlinear}. This condition guarantees \textit{local} observability, which means that the state $x_0$ can be distinguished from any other state in a neighbourhood, but not necessarily from distant states. The distinction between local and global identifiability is usually not relevant in biological applications. \subsection*{Structural identifiability as generalized observability} By considering the parameters as state variables with zero dynamics ($\dot p=0$), SI analysis can be recast as observability analysis. To this end, we augment the state vector as $\tilde{x} = \left[x,p\right]$ and write the generalized observability-identifiability matrix as: \begin{align}\label{obsident} {\mathcal O}_I(\tilde{x} ) = \left( \begin{array}{c} \frac{\partial }{\partial \tilde{x}}h(\tilde{x}) \\ \frac{\partial }{\partial \tilde{x}}(L_f h(\tilde{x})) \\ \frac{\partial }{\partial \tilde{x}}(L_f^2 h(\tilde{x})) \\ \vdots \\ \frac{\partial }{\partial \tilde{x}}(L_f^{n+q-1}h(\tilde{x}))\\ \end{array} \right) \end{align} \noindent where $n$ is the dimension of the state vector $x$ and $q$ is the dimension of the parameter vector $p$. We can now state a generalized Observability-Identifiability Condition (OIC): if a system satisfies $\text{rank}({\mathcal O}_I(\tilde x_0)) = n+q$, it is (locally) observable and identifiable around the state $\tilde x_0$. If $\text{rank}({\mathcal O}_I(\tilde x_0)) < n+q$, the model contains unidentifiable parameters (and/or unobservable states). It is possible to determine the identifiability of individual parameters because each column in $O_I$ contains the partial derivatives with respect to one parameter (or state). Thus if the matrix rank does not change after removing the $i^{th}$ column the $i^{th}$ parameter is not identifiable (if the column corresponds to a state, it is not observable). \subsection*{Software Availability} The software used in this paper for analysing structural identifiability is STRIKE-GOLDD (STRuctural Identifiability taKen as Extended-Generalized Observability with Lie Derivatives and Decomposition). It is a methodology and a tool for structural identifiability analysis \cite{villaverde2016} which can handle nonlinear systems of a very general class, including non-rational ones. At its core is the conception of structural identifiability as a generalization of observability. Since the calculation of $\text{rank}({\mathcal O}_I(\tilde x_0))$ can be computationally very demanding, even for models of moderate size, STRIKE-GOLDD includes a number of algorithmic modifications to alleviate its cost. One of them is the construction of the observability-identifiability matrix ${\mathcal O}_I$ with less than $n+q-1$ derivatives. In certain cases, this reduced matrix can suffice to establish the identifiability of the whole model; in other cases, it can at least report identifiability of a subset of parameters, even if it cannot decide on the rest. Another possibility is to decompose the model in a number of submodels, which have smaller matrices whose rank is easier to compute. More details about these and other procedures included in the methodology can be found in \cite{villaverde2016}. STRIKE-GOLDD is an open source MATLAB toolbox that can be downloaded from \url{https://sites.google.com/site/strikegolddtoolbox/}. A more complete description of the tool can be found in its user manual, which is available in the website. The code and instructions for reproducing the results reported in this paper can be found in \url{https://sites.google.com/site/strikegolddtoolbox/dc}. \subsection*{Models} \subsubsection*{Feedback circuits from Karin et al.} Fig. \ref{fig:4circuits} depicts the four circuits presented by Karin et al. \cite{karin} and includes their equations. The model depicted in Figure 1A is a linear system with integral feedback on the output variable, $y$. It corresponds to the circuit of Figure 1B from \cite{karin}. The system depicted in Figure 1B is also linear, but has proportional-integral feedback and includes an additional state variable. It corresponds to the circuit of Figure 1C from \cite{karin}. The nonlinear model of hormonal reactions shown in Figure 1C corresponds to the one in Figure 1D from \cite{karin}. Finally, the fourth case study (Figure 1D) has the same high-level diagram as the previous one (Figure 1C); however, the detailed dynamics are different. This circuit is known as the ``$\beta$IG model'' due to its three states ($\beta$, I, and G). It describes a glucose homeostasis mechanism where $\beta$ stands for the beta-cell functional mass, $I$ for insulin, and $G$ for glucose. It corresponds to the model in Figure 2 from \cite{karin}. The presence of terms such as $(8.4/G )^1.7$ makes this system non-rational, which complicates its analysis, since many structural identifiability methods can only deal with rational models. However, it is possible to analyse non-rational systems such as this one with the STRIKE-GOLDD tool described above. \subsubsection*{Bolie models of blood glucose regulation} Bolie \cite{Bolie} proposed the following model, which we have taken from \cite{distefano2014dynamic}: \begin{equation}\label{eq:Bolie_A} \begin{array}{lll} \dot{q_1} & = & p_1\cdot q_1-p_2\cdot q_2 + \delta\\ \dot{q_2} & = & p_3\cdot q_2+p_4\cdot q_1\\ y & = & \frac{q_1}{V_p}\\ \end{array}% \end{equation} Here $x_1$ and $x_2$ are the deviations of blood plasma glucose and insulin masses from their fasting levels, $\delta$ is an impulsive injection of glucose, $V_p$ is the plasma volume, and $p_1$, $p_2$, $p_3$, and $p_4$ are parameters describing distribution and interactions of glucose and insulin. We refer to the formulation above as ``Bolie A''. A different version, which we call ``Bolie B'', consists of the same equations plus an additional measured variable, that is, not only plasma glucose concentration ($y_1 = \frac{q_1}{V_p}$) but also insulin ($y_2 = \frac{q_2}{V_p}$) are measured. Finally, a third variant of this model, referred to as ``Bolie C'' in the main text, is simply the same as the ``Bolie A'' described above but with only three unknown parameters ($p_3$, $p_4$, and $V_p$); that is, if $p_1$ and $p_2$ are considered as known constants. All parameters in ``Bolie A'' are structurally unidentifiable, while in ``Bolie B'' and ``Bolie C'' they are identifiable.
{'timestamp': '2017-03-27T02:07:26', 'yymm': '1703', 'arxiv_id': '1703.08415', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08415'}
arxiv
\section{Introduction} Wearable personal trackers that collect sensor data about the wearer, have long been used for patient monitoring in health care. Holter Monitors~\cite{HolterM}, with large and heavy enclosures, that use tapes for recording, have recently evolved into affordable personal fitness trackers (e.g.,~\cite{Nike+}). Recently, popular health centric \textit{social sensor networks} have emerged. Products like Fitbit~\cite{Fitbit}, Garmin Forerunner\cite{Forerunner} and Jawbone Up~\cite{Jawbone} require users to carry wireless trackers that continuously record a wide range of fitness and health parameters (e.g., steps count, heart rate, sleep conditions), tagged with temporal and spatial coordinates. Trackers report recorded data to a providing server, through a specialized wireless base, that connects to the user's personal computer (see Figures~\ref{fig:system:main} and~\ref{fig:system:mainGarmin}). The services that support these trackers enable users to analyze their fitness trends with maps and charts, and share them with friends in their social networks. All happening too quickly both for vendors and users alike, this data-centric lifestyle, popularly referred to as the Quantified Self or ``lifelogging'' is now producing massive amounts of intimate personal data. For instance, BodyMedia~\cite{BodyMedia} has created one of the world's largest libraries of raw and real-world human sensor data, with 500 trillion data points~\cite{BMData}. This data is becoming the source of privacy and security concerns: information about locations and times of user fitness activities can be used to infer surprising information, including the times when the user is not at home~\cite{PleaseRobMe}, and company organizational profiles~\cite{TKS13}. We demonstrate vulnerabilities in the storage and transmission of personal fitness data in popular trackers from Fitbit~\cite{Fitbit} and Garmin~\cite{Forerunner}. Vulnerabilities have been identified for similar systems, including pacemakers (e.g., Halperin et al.~\cite{HHBRCDMFKM08}) and glucose monitoring and insulin delivery systems (e.g., Li et. al.~\cite{Insulin}). The differences in the system architecture and communication model of social sensor networks enable us to identify and exploit different vulnerabilities. We have built two attack tools, FitBite and GarMax, and show how they inspect and inject data into nearby Fitbit Ultra and Garmin Forerunner trackers. The attacks are fast, thus practical even during brief encounters. We believe that, the vulnerabilities that we identified in the security of Fitbit and Garmin are due to the many constraints faced by solution providers, including time to release, cost of hardware, battery life, features, mobility, usability, and utility to end user. Unfortunately, such a constrained design process often puts security in the back seat. \begin{figure} \centering \subfigure[] {\label{fig:system:main}{\includegraphics[width=1.7in]{sys1.eps}}} \subfigure[] {\label{fig:system:mainGarmin}{\includegraphics[width=1.7in]{garmin.eps}}} \caption{System components: (a) Fitbit: trackers (one cradled on the base), the base (arrow indicated), and a user laptop. The arrow pointing to the tracker shows the switch button, allowing the user to display various fitness data. (b) Garmin: trackers (the watch), the base(arrow indicated), and a user laptop.} \end{figure} To help address these constraints, in this paper we introduce SensCrypt, a protocol for secure fitness data storage and transmission on lightweight personal trackers. We leverage the unique system model of social sensor networks to encode data stored on trackers using two pseudo-random values, one generated on the tracker and one on the providing server. This enables SensCrypt, unlike previous work~\cite{HHBRCDMFKM08,RCHBC09}, to protect not only against inspect and inject attacks, but also against attackers that physically capture and read the memory of trackers. SensCrypt's hardware and computation requirements are minimal, just enough to perform low-cost symmetric key encryption and cryptographic hashes. SensCrypt does not impose storage overhead on trackers and ensures an even wear of the tracker storage, extending the life of flash memories with limited program/erase cycles. SensCrypt is related to Dabinder (Naveed et al.~\cite{NZDWG14}), an Android level defense. Dabinder generates and enforces secure bonding policies between a device and its official app, to prevent external device mis-bonding attacks for Bluetooth enabled Android health/medical devices. SensCrypt is built for a different platform and also, unlike Dabinder, minimizes the role played by the base. SensCrypt is applicable to a range of sensor based platforms, that includes a large number of popular fitness~\cite{Fitbit,Forerunner,Jawbone,MotoActv,Basis} and home monitoring solutions~\cite{Nest,WeMo,Mother}, as well as scenarios where the sensors need to be immobile and operable without network connectivity (e.g., infrastructure, traffic, building and campus monitoring solutions). In the latter case, the bases through which the sensors sync with the webserver are mobile, e.g., smartphones of workers, who may become proximal to the sensors with the intention of data collection or as a byproduct of routine operations. We have developed Sens.io, a \$52 tracker platform built on Arduino Uno, of similar capabilities with current solutions. On Sens.io, SensCrypt (i) imposes a 6ms overhead on tracker writes, (ii) reduces the end-to-end overhead of data uploads to 50\% of that of Fitbit, and (iii) enables a server to support large volumes of tracker communications. In conclusion, the contributions of this paper are the following: \begin{compactitem} \item Reverse engineer the semantics of the Fitbit Ultra and Garmin Forerunner communication protocol. [Section~\ref{sec:model:reverse}]. \item Build FitBite and GarMax, tools that exploit vulnerabilities in the design of Fitbit and Garmin to implement several attacks in a timely manner [Section~\ref{sec:attacks}]. \item Devise SensCrypt, a secure solution that imposes no storage overhead on trackers and requires only computationally cheap operations. [Section~\ref{sec:solution}] Show that SensCrypt protects even against invasive attackers, capable of reading the memory of captured trackers [Section~\ref{sec:analysis}]. \item Implement Sens.io, a tracker platform, of similar capabilities with existing popular solutions but at a fraction of the cost [Section~\ref{sec:implementation}]. Show that SensCrypt running on Sens.io is very efficient [Section~\ref{sec:evaluation}] \end{compactitem} While SensCrypt's defenses may not be immediately adopted by existing products~\footnote{We have contacted Fitbit and Garmin with our results. While interested in the security of their users, they have declined collaboration.}, this paper provides a foundation upon which to create, implement and test new defensive mechanisms for future tracker designs. \section{System Model, Attacker and Background} \label{sec:model} \subsection{System Model} \label{sec:model:system} We consider a general system consisting of tracker devices, base stations and an online social network. We exemplify the model components using Fitbit Ultra~\cite{Fitbit} and Garmin Forerunner~\cite{Forerunner}, two popular health centric social sensor networks (see Figures~\ref{fig:system:main} and~\ref{fig:system:mainGarmin}). For simplicity, we will use ``Fitbit'' to refer the Fitbit Ultra and ``Garmin'' to denote the Garmin Forerunner 610 solution. \noindent {\bf The tracker.} The \textit{tracker} is a wearable device that records, stores and reports a variety of user fitness related metrics. We focus on the following trackers: \begin{compactitem} \item {\bf The Fitbit tracker} measures the daily steps taken, distance traveled, floors climbed, calories burned, the duration and intensity of the user exercise, and sleep patterns. It consists of four IC chips, (i) a MMA7341L 3-axis MEMS accelerometer, (ii) a MEMS altimeter to count the number of floors climbed and (iii) a MSP 430F2618 low power TI MCU consisting of 92 KB of flash and 96 KB of RAM. The user can switch between displaying different real-time fitness information on the tracker, using a dedicated hardware \textit{switch} button (see the arrow pointing to the switch in Figure~\ref{fig:system:main}). \item {\bf The Garmin tracker} records data at user set periodic intervals (1-9 seconds). The data includes a timestamp, exercise type, average speed, distance traveled, altitude, start and end position, heart rate and calories burned during the past interval. The tracker has a heart rate monitor (optional) and a 12 channel GPS receiver with a built-in SiRFstarIII antenna. that enables the user to tag activities with spatial coordinates. \end{compactitem} \noindent Both Fitbit and Garmin trackers have chips supporting the ANT protocol, with a 15ft transmission range for Fitbit and 33ft for Garmin. Each tracker has a unique id, called the \textit{tracker public id} (TPI). Trackers also store profile information of their users, including age, gender and physiological information such as height, weight and gait information. \noindent {\bf The base and agent module.} The base connects with the user's main computing center (e.g., PC, laptop) and with trackers within transmission range (15ft for Fitbit and 33ft for Forerunner) over the ANT protocol. The user needs to install an ``agent module'', a software provided by the service provider (Fitbit, Garmin) to run on the base. The agent and base act as a bridge between the tracker and the online social network. They upload information stored on the tracker to its user account on the webserver, see Figures~\ref{fig:system:main} and~\ref{fig:system:mainGarmin} for system snapshots. \noindent {\bf Tracker to base pairing}. Fitbit trackers communicate to any base in their vicinity. However, tracker solutions like Garmin Forerunners allow trackers to communicate only through bases to which they have been previously ``paired'' or ``bonded''. Garmin's pairing procedure works in the following manner. The agent running on the base searches for available ANT enable devices. Each tracker periodically sends broadcast beacons over the ANT interface. If the agent discovers a tracker, it extracts its unique id (TPI). The agent uses one of two methods of authentication: initial \textit{pairing} or \textit{passkey}. The agent verifies if it already stores an authfile for this TPI. If no such file exists (i.e., this is the first time the tracker is pairing with the base), the agent uses the \textit{pairing} method and sends a bind request to the tracker. When prompted, the user needs to authenticate the operation, through the push of a button on the tracker. The agent then retrieves a factory embedded ``passkey'' from the tracker. It then stores the pair $\langle TPI, passkey \rangle$ in a newly created authfile. During subsequent authentications, the agent uses the \textit{passkey} method: it recovers the passkey corresponding to the TPI from the authfile and uses it to authenticate the tracker. The system model considered can be extended to cover the case of fitness tracking solutions that turn the user's mobile device into a base, e.g.,~\cite{Jawbone,Nike,Basis}. In such systems, the agent module is a mobile app running on the mobile device. The tracker communicates with the smartphone over existing network interfaces, e.g., Bluetooth or NFC. We note that Naveed et al.~\cite{NZDWG14} identified an intriguing vulnerability of Android smartphones bonded to health trackers. The vulnerability stems from the fact that the bonding occurs at smartphone device level not at the app level. This effectively leaves the health data vulnerable to rogue apps with Bluetooth permissions. \noindent {\bf The webserver.} The online social network webserver (e.g., fitbit.com, connect.garmin.com), allows users to create accounts from which they befriend and maintain contact with other users. Upon purchase of a tracker and base, the user binds the tracker to her social network account. Each social network account has a unique id, called the \textit{user public id} (UPI). When the base detects and sets up a connection with a nearby tracker, it automatically collects and reports tracker stored information (step count, distance, calories, sleep patterns) with temporal and spatial tags, to the corresponding user's social network account. In the following, we use the term \textit{webserver} to denote the computing resources of the online social network. \noindent {\bf Tracker-to-base communication: the ANT protocol.} Trackers communicate to bases over ANT, a 2.4 GHz bidirectional wireless Personal Area Network (PAN) ultra-low power consumption communication technology, optimized for transferring low-data rate, low-latency data. \noindent {\bf Data conversion.} The Fitbit tracker relies on the user's walk and run stride length values to convert the step count into the distance covered. It then extrapolates the user's Basal Metabolic Rate (BMR)~\cite{BMR} values and uses them to convert the user's daily activities into burned calories values. The Garmin tracker uses the GPS receiver to compute the outdoor distance covered by the user. It then relies on the Firstbeat\cite{Firstbeat} algorithm to convert user data (gender, height, weight, fitness class) and the captured heart rate information to estimate the user's Metabolic Equivalent (MET), which in turn is used to retrieve the calories burnt. \subsection{Attacker Model} \label{sec:model:attacker} We assume that the webserver is honest, and is trusted by all participants. We assume adversaries that are able to launch the following types of attacks: \noindent {\bf Inspect attacks}. The adversary listens on the communications of trackers, bases and the webserver. \noindent {\bf Inject attacks}. The adversary exploits solution vulnerabilities to modify and inject messages into the system, as well as to jam existing communications. \noindent {\bf Capture attacks}. The adversary is able to acquire trackers or bases of victims. The adversary can subject the captured hardware to a variety of other attacks (e.g., Inspect and Inject) but cannot access the memory of the hardware. We assume that in addition to captured devices, the adversary can control any number of trackers and bases (e.g., by purchasing them). \noindent {\bf JTAG attacks}. JTAG and boundary scan based attacks (e.g.,~\cite{B06}), extend the Capture attack with the ability to access the memory of captured devices. We focus here on ``JTAG-Read'' (JTAG-R) attacks, where the attacker reads the content of the \textit{entire} tracker memory. \subsection{Reverse Engineering Fitbit and Garmin} \label{sec:model:reverse} Our goal in reverse-engineering the Fitbit Ultra and Garmin Forerunner protocols was dual, (i) to understand the source(s) of vulnerabilities and (ii) to develop security solutions that are interoperable with these protocols. Sec. 103(f) of the DMCA (17 U.S.C. § 1201 (f))~\cite{Reverse.engineer} states that a person who is in legal possession of a program, is permitted to reverse-engineer and circumvent its protection if this is necessary in order to achieve ``interoperability''. To log communications between trackers and webservers, we wrote USB based filter drivers and ran them on a base. We have used Wireshark to capture all wireless traffic between the agent software and the webserver. To reverse engineer Fitbit, we exploited (i) the lack of encryption in all its communications and (ii) libfitbit~\cite{libfitbit}, a library built on ANT-FS~\cite{ANT-FS} for accessing and transferring data from Fitbit trackers. Unlike Fitbit, Garmin uses HTTPS with TLS v1.1 to send user login credentials. However, similar to Fitbit, all other communications are sent over plaintext HTTP. Fitbit and Garmin bases both use \textit{service logs}, files that store information concerning communications involving the base. Garmin's logs consist of an ``authfile'' for each tracker that was paired with the base, and .FIT files. The authfile contains authentication information for each tracker. Forerunner maintains 20 types of .FIT files, each storing a different type of tracker data, including information about user activities, schedules, locations and blood pressure readings. On the Windows installation of the Fitbit software, daily logs are stored in cleartext in files whose names record the hour, minute and second corresponding to the time of the first log occurrence. Each request and response involving the tracker, base and social network is logged and sometimes even documented in the archive folder of that log directory. In the following, we first focus on Fitbit's tracker memory organization and communication protocol. \noindent {\bf Fitbit: Tracker memory organization.} A tracker has both \textit{read banks}, containing data to be read by the base and \textit{write banks}, containing data that can be written by the base. The read banks store the daily user fitness records. The write banks store user information specified in the ``Device Settings'' and ``Profile Settings'' fields of the user's Fitbit account. The tracker commits sensor values (step, floor count) to the read bank once per minute. The tracker can store 7 days worth of 1-per-minute sensor readings~\cite{FitbitSpecs}. The webserver communicates with the tracker through XML blocks, that contain base64 encoded commands, or \textit{opcodes}. tracker. Opcodes are 7 bytes long. We briefly list below the most important opcodes and their corresponding responses. The opcode types are also shown in Figure~\ref{fig:fitbit:maincomm}. \begin{compactitem} \item {\bf Retrieve device information (TRQ-REQ):} opcode [0x24,000000]. Upon receiving this opcode from the webserver (via the base), the tracker sends a reply that contains its serial number (5 bytes), the hardware revision number, and whether the tracker is plugged in on the base. \item {\bf Read/write tracker memory (READ-TRQ/WRITE).} To read a memory bank, the webserver needs to issue the READ-TRQ opcode, [0x22, $index$,00000], where $index$ denotes the memory bank requested. The response embeds the content of the specified memory bank. To write data to a memory bank, the webserver issues the WRITE opcode [0x23, $index$, $datalen$,0000]. The payload data is sent along with the opcode. The value $index$ denotes the destination memory bank and $datalen$ is the length of the payload. A successful operation returns the response [0x41,000000]. \item {\bf Erase memory: (ERASE)} opcode [0x25, $index$, $t$, 0]. The webserver specifies the $index$ denoting the memory bank to be erased. The value $t$ (4 bytes, MSB) denotes the operation deadline - the date until which the data should be erased. A successful operation returns the response [0x41,000000]. \end{compactitem} \begin{figure}[t] \begin{center} \includegraphics[width=3.1in]{drawing2.eps} \caption{Fitbit $Upload$ protocol. Enables the tracker to upload its collected sensor data to the user's social networking account on the webserver. SensCrypt's $Upload$ protocol extends this protocol, see Section~\ref{sec:solution}.} \label{fig:fitbit:maincomm} \end{center} \end{figure} \noindent {\bf Fitbit: The communication protocol.} The communication between the webserver and the tracker through the base, is embedded in XML blocks, that contain base64 encoded opcodes: commands for the tracker. All opcodes are 7 bytes long and vary according to the instruction type (e.g., TRQ-REQ, READ-TRQ, WRITE, ERASE, CLEAR). The system data flow during the data upload operation is shown in Figure~\ref{fig:fitbit:maincomm}. \begin{enumerate} \item Upon receiving a beacon from the tracker, the base establishes a connection with the tracker. \item {\bf Phase 1:} The base contacts the webserver at the URL \url{HOME/device/tracker/uploadData} and sends basic client and platform information. \item {\bf Phase 2:} The webserver sends the tracker id and the opcode for retrieving tracker information (TRQ-REQ). \item The base contacts the specified tracker, retrieves its information TRQ-INFO (serial number, firmware version, etc.) and sends it to the webserver at \url{HOME/device/tracker/dumpData/lookupTracker}. \item {\bf Phase 3:} Given the tracker's serial number, the webserver retrieves the associated tracker public id (TPI) and user public id (UPI) values. The webserver sends to the base the TPI/UPI values along with the opcodes for retrieving fitness data from the tracker (READ-TRQ). \item The base forwards the TPI and UPI values and the opcodes to the tracker, retrieves the fitness data from the tracker (TRQ-DATA) and sends it to the webserver at \url{HOME/device/tracker/dumpData/dumpData}. \item {\bf Phase 4:} The webserver sends to the base, opcodes to WRITE updates provided by the user in her Fitbit social network account (device and profile settings, e.g., body and personal information, time zone, etc). The base forwards the WRITE opcode and the updates to the tracker, which overwrites the previous values on its write memory banks. \item The webserver sends opcodes to ERASE the fitness data from the tracker. The base forwards the ERASE request to the tracker, who then erases the contents of the corresponding read memory banks. \item The base forwards the response codes from the tracker to the webserver at the address\\ \url{HOME/device/tracker/dumpData/clearDataConfigTracker}. \item The webserver replies to the base with the opcode to CLOSE the tracker. \item The base requests the tracker to SLEEP for 15 minutes, before sending its next beacon. \end{enumerate} \subsection{Crypto Tools} \label{sec:model:tools} We use a symmetric key encryption system. We write $E_K(M)$ to denote the encryption of a message $M$ with key $K$. We also use cryptographic hashes that are pre-image, second pre-image and collision resistant. We use $H(M)$ to denote the hash of message $M$. We also use hash based message authentication codes~\cite{HMAC}: we write $Hmac(K, M)$ to denote the authentication code of message $M$ with key $K$. \section{Fitbit and Garmin Attacks} \label{sec:attacks} During the reverse engineering process, we discovered several fundamental vulnerabilities, which we describe here. We then detail the attacks we have deployed to exploit these vulnerabilities, and their results. \subsection{Vulnerabilities} \label{sec:attacks:vulnerability} \begin{figure} \centering \includegraphics[width=3.5in]{servicelog2.eps} \caption{Fitbit service logs: Proof of login credentials sent in cleartext in a HTTP POST request sent from the base to the webserver. \label{fig:service:log2}} \end{figure} \noindent {\bf Fitbit: cleartext login information.} During the initial user login via the Fitbit client software, user passwords are passed to the webserver in cleartext and then stored in log files on the base. Figure~\ref{fig:service:log2} shows a snippet of captured data, with the cleartext authentication credentials emphasized. Garmin uses encryption only during the login step. \noindent {\bf Fitbit and Garmin: cleartext HTTP data processing.} For both Fitbit and Garmin, the tracker's data upload operation uses no encryption or authentication. All the tracker-to-webserver communications take place in cleartext. \noindent {\bf Garmin: faulty authentication during Pairing}. The authentication in the Pairing procedure of Garmin assumes that the base follows the protocol and has not been compromised by an attacker. The authentication process is not mutual: the tracker does not authenticate the base. \subsection{The FitBite and GarMax Tools} We have built FitBite and GarMax, tools that exploit the above vulnerabilities to attack Fitbit Ultra and Garmin Forerunner. FitBite and GarMax consist of separate modules for (i) discovering and binding to a nearby tracker, (ii) retrieving data from a nearby tracker, (iii) injecting data into a nearby tracker and (iv) injecting data into the social networking account of a tracker owner. We have built FitBite and GarMax over ANT-FS, in order to connect to and issue (ANT-FS) commands to nearby trackers. The attacker needs to run FitBite or GarMax on a base he controls. The time required to search and bind to a nearby tracker varies significantly, but is normally in the range of 3-20 seconds. On average, the time to query a tracker is 12-15s. More detailed timing information is presented for the attacks presented in the following. We conclude that these attacks can be performed even during brief encounters with victim tracker owners. \subsection{Attacks and Results} \label{sec:attacks:results} \begin{table}[b] \centering \begin{tabular}{l r r} \toprule \textbf{Type of data} & \textbf{FitBite} & \textbf{GarMax}\\ \midrule Device info & \cmark & \cmark \\ User profile, schedules, goals & \cmark & \cmark \\ Fitness data & \cmark & \cmark \\ (GPS) Location history & \xmark & \cmark \\ \bottomrule \end{tabular} \caption{Types of data harvested by FitBite and GarMax from Fitbit and Garmin. Garmin provides GPS tagged fitness information, which GarMax is able to collect.} \label{table:tpdc} \end{table} \begin{figure*} \centering \includegraphics[width=6.9in]{garmin.gps.eps} \caption{TPDC outcome on Garmin: the attacker retrieves the user's exercise circuit on a map (shown in red on the right side), based on individual fitness data records (shown on the left in XML format). The data record on the left includes both GPS coordinates, heart rate, speed and cadence. \label{fig:garmin:tpdc}} \end{figure*} \noindent {\bf Tracker Private Data Capture (TPDC).} FitBite discovers tracker devices within transmission range and captures their fitness information: Fitbit performs no authentication during tracker data uploads. We exploit Garmin's assumption of an honest base to use GarMax, running on a corrupt base, to capture data from nearby trackers. We show how GarMax binds a ``rogue'' base agent to Garmin trackers of strangers within a radius of 33ft. GarMax exploits the authentication vulnerability of Garmin's Pairing procedure (see Section~\ref{sec:attacks:vulnerability}). During the tracker authentication and passkey retrieval step of the Pairing procedure (see Section~\ref{sec:model:reverse}), GarMax running on an attacker controlled base, retrieves the TPI of the nearby victim tracker. It then creates a directory with the TPI name and creates an auth file with a random, 8 byte long passkey. GarMax verifies the tracker's serial number and other ANT parameters, then reads the passkey from the auth file. Instead of running the \textit{passkey} authentication method, GarMax directly downloads fitness information (to be stored in .FIT files) from the tracker. This is possible since the tracker assumes the base has not been corrupted, and thus does not authenticate it. TPDC can be launched in public spaces, particularly those frequented by fitness users (e.g., parks, sports venues, etc) and takes less than 13s on average. It is particularly damaging as trackers store sensor readings (i) with high frequency (1-9 seconds for Garmin, 1 minute for Fitbit), and (ii) for long intervals: up to 7 days of fitness data history for Fitbit and up to 1000 laps and 100 favorite locations for Garmin. The data captured contains sensitive user profile information and fitness information. For Garmin this information is tagged with GPS locations. Table~\ref{table:tpdc} summarizes the information captured by FitBite and GarMax. Figure~\ref{fig:garmin:tpdc} shows the reconstructed exercise circuit of a victim, with data we recovered from a TPDC attack on Garmin. The GPS location history can be used to infer the user's home, locations of interest, exercise and travel patterns. \begin{figure} \centering \includegraphics[width=2.7in]{temper1.eps} \caption{Outcome of Tracker Injection (TI) attack on Fitbit tracker: The daily step count is unreasonably high (167,116 steps). \label{fig:fitbit:pic3}} \end{figure} \noindent {\bf Tracker Injection (TI) Attack.} FitBite and GarMax use the reverse engineered knowledge of the communication packet format, opcode instructions and memory banks, to modify and inject fitness data on neighboring trackers. On average, this attack takes less than 18s, for both FitBite and GarMax. Figure~\ref{fig:fitbit:pic3} shows a sample outcome of the TI attack on a victim Fitbit tracker, displaying an unreasonable value for the (daily) number of steps taken by its user. \begin{figure} \begin{center} \includegraphics[width=3.3in]{inject1.eps} \caption{Snapshot of Fitbit user account data injection attack. In addition to earning undeserved badges (e.g., the ``Top Daily Step''), it enables insiders to accumulate points and receive financial rewards through sites like Earndit~\cite{Earndit}.} \label{fig:attack:inject} \end{center} \end{figure} \noindent {\bf User Account Injection (UAI) Attack.} We used FitBite and GarMax to report fabricated fitness information into our social networking accounts. We have successfully injected unreasonable daily step counts, e.g., 12.58 million in Fitbit, see Figure~\ref{fig:attack:inject}. Fitbit did not report any inconsistency, especially as the corresponding distance we reported was 0.02 miles! The UAI attack takes only 6s on average. Similarly, GarMax fabricates an activity file embedding the attacker provided fitness data in FIT/TCX~\cite{TCX} format. The simplest approach is to copy an existing activity file of the same or another user (made publicly available in the Garmin Connect website) and modify device and user specific information. We have used GarMax to successfully inject ``running'' activities of 1000 miles each, the largest permissible value, while keeping the other parameters intact. \noindent {\bf Free Badges and Financial Rewards.} By successful injection of large values in their social networking accounts, FitBite and GarMax enable insiders to achieve special milestones and acquire merit badges, without doing the required work. Figure~\ref{fig:attack:inject} shows how in Fitbit, the injected value of 12.58 million steps, being greater than 40,000, enables the account owner to acquire a ``Top Daily Step'' badge. Furthermore, by injecting fraudulent fitness information into Earndit~\cite{Earndit}, an associated site, we were able to accumulate undeserved rewards, including 200 Earndit points, redeemable for a \$20 gift card. \begin{figure} \begin{center} \includegraphics[width=3.1in]{battery_rony.eps} \caption{Battery drain for three operation modes. The \textit{attack} mode drains the battery around 21 times faster than the 1 day upload mode and 5.63 times faster than the 15 mins upload mode.} \label{fig:fitbit:battery} \end{center} \end{figure} \noindent {\bf Battery Drain Attack.} FitBite allows the attacker to continuously query trackers in her vicinity, thus drain their batteries at a faster rate. To understand the efficiency of this attack, we have experimented with 3 operation modes. First, the \textit{daily upload} mode, where the tracker syncs with the USB base and the Fitbit account once per day. Second, the \textit{15 mins upload} mode, where the tracker is kept within 15 ft. from the base, thus allowing it to be queried once every 15 minutes. Finally, the \textit{attack} mode, where FitBite's TM module continuously (an average of 4 times a minute) queries the victim tracker. To avoid detection, the BM module uploads tracker data into the webserver only once every 15 minutes. Figure~\ref{fig:fitbit:battery} shows our battery experiment results for the three modes: FitBite drains the tracker battery around 21 times faster than the 1 day upload mode and 5.63 times faster than the 15 mins upload mode. In the daily upload mode, the battery lasted for 29 days. In the 15 mins upload mode, the battery lasted for 186.38 hours (7 days and 18 hours). In the attack mode, the battery lasted for a total of 32.71 hours. While this attack is not fast enough to impact trackers targeted by casual attackers, it shows that FitBite drains the tracker battery around 21 times faster than the 1 day upload mode and 5.63 times faster than the 15 mins upload mode. \noindent {\bf Denial of Service.} FitBite's injection attack can be used to prevent Fitbit users from correctly updating their real-time statistics. The storage capacity of the Garmin tracker is limited to 1000 laps. Thus, an attacker able to injects a number of fake laps exceeding the 1000 limit, can prevent the tracker from recording the user's valid data. A Fitbit tracker can display up to 6 digit values. When the injected value exceeds 6 digits, the least significant digits can not be displayed on the tracker. This prevents the user from keeping track of her daily performance evolution. In addition, for both Fitbit and Garmin, the attacker can render part of the recorded data useless, by injecting incorrect user profile information. For instance, by modifying user profile information (e.g., height, weight, see Section~\ref{sec:model:system}), the attacker corrupts information built based on it, e.g., ``calories burnt''. \section{A Protocol for Lightweight Security} \label{sec:solution} \subsection{Solution Requirements} \label{sec:solution:requirements} We aim to develop a solution for low power fitness trackers that satisfies the following requirements: \begin{compactenum} \item {\bf Security.} Defend against the attacks described in Section~\ref{sec:model:attacker}. \item {\bf Minimal tracker overhead.} Minimize the computation and storage overheads imposed on the resource constrained trackers. \item {\bf Flexible upload.} Allow trackers to securely upload sensor information through multiple bases. \item {\bf User friendly.} Minimize user interaction. \item {\bf Level tracker memory wear.} Extend memory lifetime by leveling the wear of its blocks. \end{compactenum} \subsection{Public Key Cryptography: A No Go} \label{sec:solution:pkc} We propose first FitCrypt, a solution to explore the feasibility of public key cryptosystems to efficiently secure the storage and communications of trackers. In FitCrypt, each tracker stores a public key. The corresponding private key is only known by the webserver. Each sensor data record is encrypted with the public key before being stored on the tracker. RSA with a 2048 bit key imposes a 4-hold storage overhead on Fitbit (each record of 64B is converted into a 256B record) and a 3.2-hold overhead on Garmin. We also consider ECIES (Elliptic Curve Integrated Encryption Scheme), an elliptic curve crypto (ECC) solution that uses a 224 bit key size, the security equivalent of RSA with 2048 bit modulus. ECIES imposes a storage overhead of $224+3r$ bits, where $r=112$ is the size of a security parameter. Thus, the storage overhead is 165\% for Fitbit and 150\% for Garmin). When run on an Arduino Uno board, FitCrypt-RSA takes 2.3s and FitCrypt-ECC takes 2.5s to encode a single sensor record (see Table~\ref{table:record:data}, Section~\ref{sec:evaluation}). Garmin records sensor data with a frequency as high as one write per second. FitCrypt imposes a 250\% overhead on the sensor recording task (of 2.5s every 1s interval), thus does not satisfy the second requirement of Section~\ref{sec:solution:requirements}. To address this issue, in the following we introduce SensCrypt, a lightweight and secure solution for wearable trackers. \subsection{SensCrypt} We introduce SensCrypt, a lightweight protocol for providing secure data storage and communication in fitness centric social sensor networks. \noindent {\bf Protocol overview.} Let $U$ denote a user, $T$ denote her tracker, $B$ a base and $W$ the webserver. $T$'s memory is divided into records, each storing one snapshot of sensor data. The memory is organized using a circular buffer structure, to ensure an even wear. $T$ shares a symmetric key $K_T$ with $W$. $W$ also maintains a unique {\emph secret} key $K_W$ for each tracker $T$. To prevent Inject attacks, all communications between $T$ and $W$ are authenticated with $K_T$. To prevent Inspect, Capture and JTAG-R attacks, we encode each tracker record using two pseudo-random numbers (PRNs). One PRN is generated by $W$ using $K_W$ and written on $T$ during data sync protocols. The other PRN is generated by $T$ using $K_T$ at the time when the record is written on its memory. Both PRNs can later be reconstructed by $W$. This approach significantly increases the complexity of an attack: the attacker needs to capture the encoded data and both PRNs to recover the cleartext data. \subsection{The SensCrypt Protocol} \label{sec:solution:details} \begin{table} \centering \begin{tabular}{l r} \toprule \textbf{Notation} & \textbf{Definition}\\ \midrule $U$, $T$, $B$, $W$ & user, tracker, base and webserver\\ $id_U$, $id_T$, $id_B$ & unique identifiers of $U$, $T$ and $B$ \\ \dirty & pointer to first written record\\ \clean & pointer to first available record\\ \start, \textit{end} & pointers to memory bounds\\ $K_W$ & symmetric key maintained by $W$ for $T$\\ $K_T$ & symmetric key shared by $W$ and $T$\\ $ctr$ & counter shared by $W$ and $T$\\ $Map$ & data base of $W$ for users and trackers\\ $mem$ & memory of a tracker\\ \bottomrule \end{tabular} \caption{Symbol definitions.} \label{table:notation} \end{table} \begin{figure} \centering \includegraphics[width=3.1in]{sensio.memory.complete.eps} \vspace{-5pt} \caption{Example SensCrypt tracker memory ($mem$). Light green denotes ``clean'', unwritten areas. Red denotes areas that encode tracker sensor data. (a) After ($i$-1) records have been written. The $ctr$ is 1. (b) After $Upload$ occurs at the state in (a). The $ctr$ becomes 2, to enable the creation of fresh PRNs, overwritten on the former red area. (c) After $n-i+2$ more records have been written from state (b), leading to the \clean\ pointer cycling over from the start of the memory. (d) After $Upload$ occurs at the state in (c). \label{fig:sensio:memory}} \end{figure} Let $id_U$, $id_B$, and $id_T$ denote the public unique identities of $U$, $B$, and $T$. $U$ has an account with $W$. $W$ manages a database $Map$ that has an entry for each user and tracker pair: $Map[id_U,id_T]$ = $[id_U$, $id_T$, $K_T$, $K_W$, $ctr]$. Each tracker is factory initialized with a symmetric key $K_T$ and a counter $ctr$ initialized to 1. $K_T$ and $ctr$ are also stored in $Map[id_U,id_T]$. $K_W$ is a per-tracker symmetric key, kept secret by $W$. Table~\ref{table:notation} summarizes these symbols for easy access. SensCrypt consists of 2 procedures, $RecordData$ and $Upload$. $RecordData$ is invoked by $T$ to record new sensor data; $Upload$ allows it to sync its data with $W$. We now describe the organization of the tracker memory. \noindent {\bf Tracker Memory Organization}. Let $mem$ denote the memory of $T$. $mem$ is divided in ``records'' of fixed length (e.g., 64 bytes for Fitbit, 80 bytes for Garmin). Each record stores one report from the tracker's sensors (see Section~\ref{sec:model:system}). We organize time into fixed length ``epochs'' (e.g., 2s long for Fitbit, 1-9s long for Garmin). $RecordData$ records sensor data once per epoch. $mem$ is organized using a circular buffer. The \dirty\ pointer is to the location of the first written record, and the \clean\ pointer is to the location of the first record available for writing. When reaching the end of $mem$, both records ``circle'' over to the \start\ pointer. Figure~\ref{fig:sensio:memory} illustrates the SensCrypt tracker storage organization, after the execution of various $RecordData$ and $Upload$ procedures. Algorithm~\ref{alg:senscrypt} shows the pseudo-code of the procedures. During $Upload$, each previously written tracker record is reset by $W$ to store a pseudo-random value (line 18 and lines 21-29 of Algorithm~\ref{alg:senscrypt}). That is, the $i$-th record of the tracker's memory is set to hold $E_{K_W}(ctr, i)$, where $K_W$ is the secret key $W$ stores for $T$. The index $i$ ensures that each record contains a different value. $ctr$ counts the number of times $mem$ has been completely overwritten; it ensures that a memory record is overwritten with a different encrypted value. \renewcommand{\baselinestretch}{1.0} \begin{algorithm}[t] \begin{minipage}{0.45\textwidth} \begin{tabbing} XX\=XX\=XX\=XX\=XX\=X\= \kill 1.$\mathtt{\mbox{\bf{Object}}\ implementation\ Memory;}$\\ 2.\>$\mathtt{T: mem:\ record[];\qquad\ \quad \quad \quad \ \ \# tracker\ memory}$\\ 3.\>$\mathtt{T: dirty:\ int;\ \# pointer\ to\ used\ area}$\\ 4.\>$\mathtt{T: clean:\ int;\ \# pointer\ to\ unused\ area}$\\ 5.\>$\mathtt{T: start, end:\ int;\ \# memory\ bounds}$\\ 6.\>$\mathtt{W: K_W:\ byte[];\ \# key\ for\ T}$\\ 7.\>$\mathtt{W,T: K_T:\ byte[];\ \# key\ shared\ by\ T, W}$\\ 8.\>$\mathtt{W,T: ctr:\ int;\ \# counter\ shared\ by\ T, W}$\\\\ 9.\>$\mathtt{\mbox{\bf{Operation}}\ int\ \underline{T: RecordData}(D: sensor\ data)}$\\ 10.\>\>$\mathtt{mem[clean]\ \oplus = D \oplus E_{K_T}(ctr, clean);}$\\ 11.\>\>$\mathtt{clean = clean + 1;}$\\ 12.\>\>$\mathtt{\mbox{\bf{if}}\ (clean == end)\ \mbox{\bf{then}};}$\\ 13.\>\>\>$\mathtt{clean = start;\ \mbox{\bf{fi}}}$\\ 14.\>$\mathtt{\mbox{\bf{end}}}$\\ 15.\>$\mathtt{\mbox{\bf{Operation}}\ void\ \underline{ProcessRecord}(ind: int, c: int)}$\\ 16.\>\>$\mathtt{W:\ D = mem[ind] \oplus E_{K_W}(c, ind) \oplus E_{K_T}(c, ind);}$\\ 17.\>\>$\mathtt{W:\ process(D);}$\\ 18.\>\>$\mathtt{W \rightarrow T:\ mem[ind] = E_{K_W}(c+1, ind);}$\\ 19.\>$\mathtt{\mbox{\bf{end}}}$\\ 20.\>$\mathtt{\mbox{\bf{Operation}}\ void\ \underline{Upload}()}$\\ 21.\>\>$\mathtt{\mbox{\bf{if}}\ (dirty < clean)\ \mbox{\bf{do}}}$\\ 22.\>\>\>$\mathtt{\mbox{\bf{for}}\ (i=dirty; i < clean; i++)\ \mbox{\bf{do}}}$\\ 23.\>\>\>\>$\mathtt{ProcessRecord(i, ctr);\ \mbox{\bf{od}}}$\\ 24.\>\>$\mathtt{\mbox{\bf{else\ if}}\ (clean < dirty)\ \mbox{\bf{do}}}$\\ 25.\>\>\>$\mathtt{\mbox{\bf{for}}\ (i=dirty; i \le end; i++)\ \mbox{\bf{do}}}$\\ 26.\>\>\>\>$\mathtt{ProcessRecord(i, ctr);\ \mbox{\bf{od}}}$\\ 27.\>\>\>$\mathtt{\mbox{\bf{for}}\ (i=start; i < clean; i++)\ \mbox{\bf{do}}}$\\ 28.\>\>\>\>$\mathtt{ProcessRecord(i, ctr+1);\ \mbox{\bf{od}}}$\\ 29.\>\>\>$\mathtt{W,T:\ ctr = ctr+1;\ \mbox{\bf{fi}}}$\\ 30.\>\>$\mathtt{T:\ dirty = clean;}$\\ 31.\>$\mathtt{\mbox{\bf{end}}}$\\ \end{tabbing} \caption{Tracker memory management pseudocode. Instructions preceded by $W:$ are executed at the webserver, those preceded by $T:$ are executed at the tracker. $W \rightarrow T: I$ denotes an instruction $I$ issued at $W$ and executed at $T$. The entire RecordData is executed at $T$. Figure~\ref{fig:sensio:memory} illustrates the pseudocode.} \label{alg:senscrypt} \end{minipage} \normalsize \vspace{-10pt} \end{algorithm} \noindent {\bf The RecordData Procedure}. Commit newly recorded sensor data $D$ to $mem$, in the next available record, pointed to by \clean. $T$ generates a new pseudo-random value, $E_{K_T}(ctr, \clean)$, and xors it into place with $mem[\clean]=E_{K_W}(ctr, clean)$ and $D$ (see line 10 of algorithm~\ref{alg:senscrypt}): \[ mem[\clean] = D \oplus E_{K_T}(ctr, \clean) \oplus E_{K_W}(ctr, clean). \] The \clean\ pointer is then incremented (line 11). When reaching the \textit{end} of $mem$, \clean\ circles back to \start (lines 12,13). We call ``red'' the written records and ``green'' the records available for write. \dirty\ and \clean\ enable us to reduce the communication overhead of $Upload$ (see next): instead of sending the entire $mem$, $T$ sends to $W$ only the red records. \noindent {\bf The Upload Procedure}. We present the SensCrypt $Upload$ as an extension of the corresponding Fitbit protocol illustrated in Figure~\ref{fig:fitbit:maincomm}. In the following, each message $M$ sent between $T$ and $W$ is accompanied by an authentication value $Hmac(K_T, M)$, where Hmac is a hash based message authentication code~\cite{HMAC}. The receiver of the message uses $K_T$ to verify the authenticity of the sender and of the message. For simplicity of exposition, in the following we omit the Hmac value. $Upload$ extends steps 6b and 7 of the Fitbit $Upload$. Specifically, when $T$ receives the READ-TRQ command (step 6a), it compares the \dirty\ and \clean\ pointers. If $\dirty < \clean$ (see Figure~\ref{fig:sensio:memory}(a)), $T$ sends to $W$, through $B$, \[ {\tt T \rightarrow B \rightarrow W: TRQ-DATA, id_T, mem[dirty .. clean]}, \] where $mem[dirty .. clean]$ denotes $T$'s red memory area. For each record $i$ between \dirty\ and \clean, $W$ uses keys $K_T$ and $K_W$ and the current value of $ctr$ to recover the sensor data: $D[i] = mem[i] \oplus E_{K_T}(ctr, i) \oplus E_{K_W}(ctr, i)$ (see lines 21-23 and line 16). Then, in step 7 of Upload (see Figure~\ref{fig:fitbit:maincomm}), $W$ sends to $T$: \[ {\tt W \rightarrow B \rightarrow T: WRITE, id_T, E_{K_T}(ctr+1, E_{K_W}(ctr+1, i))}, \] $\forall i$=\dirty..\clean. $T$ uses $K_T$ to decrypt each $E_{K_T}(ctr+1, E_{K_W}(ctr+1, i))$ value. If the first field of the result equals $ctr+1$, $T$ overwrites $mem[\dirty+i]$ with $E_{K_W}(ctr+1, i)$ (see line 18), then sets \dirty=\clean (line 30). Thus, mem[\dirty .. \clean] becomes green. The case where \clean\ $<$ \dirty, occurring when \clean\ circles over, past the memory end, is handled similarly, see lines 24-29 of Algorithm~\ref{alg:senscrypt} and Figure~\ref{fig:sensio:memory}(c) and (d). We eliminate the ERASE communication (steps 8 and 9 in Figure~\ref{fig:fitbit:maincomm}) from the Fitbit protocol. \section{Analysis} \label{sec:analysis} \subsection{SensCrypt Advantages} \label{sec:analysis:advantages} SensCrypt ensures an even wear of tracker memory: the most overwritten memory record has at most 2 overwrites more than the least overwritten record. To see why this is the case, consider that once written, a record is not overwritten until a next $Upload$ takes place. The circular buffer organization of the memory ensures that all the memory records of the tracker are overwritten, not just the ones at the start of the memory. Using the example illustrated in Figure~\ref{fig:sensio:memory}(d), notice that the first record, has been overwritten twice since the subsequent green blocks: once with $encData[1]$, see Figure~\ref{fig:sensio:memory}(c), and once with the new $E_{K_W}(3, 1)$ received from $W$. By preventing excessive overwriting of records at the beginning of the memory, SensCrypt extends the life of trackers. This is particularly important for flash memories, that have a limited number of P/E (program/erase) cycles. SensCrypt is user friendly, as the user is not involved in $Upload$ and $RecordData$ procedures. The SensCrypt base is thin, required to only setup standard secure SSL connections to $W$, and forward traffic between $T$ and $W$. SensCrypt imposes no storage overhead on trackers: sensor data is xor-ed in-place in $mem$. \subsection{Security Discussion} \label{sec:analysis:security} \begin{table} \centering \begin{tabular}{l r r} \toprule \textbf{Capabilities} & \textbf{SensCrypt} & \textbf{FitCrypt}\\ \midrule Inspect & TPDC, TI, UAI & TPDC, TI, UAI\\ Inject & TPDC, TI, UAI & TPDC, TI, UAI\\ Capture & TPDC, TI, UAI & TPDC, TI, UAI\\ JTAG-R & TPDC, TI, UAI & TPDC, TI, UAI\\ JTAG-RW & TPDC & TPDC\\ JTAG-R + Inspect & TI, UAI & TPDC, TI, UAI\\ JTAG-R + Inject & TI & TPDC, TI\\ Double JTAG-R & TI, UAI & TPDC, TI, UAI\\ \bottomrule \end{tabular} \caption{ Comparison of defenses provided by SensCrypt and FitCrypt against the types of attacks described in Section~\ref{sec:attacks:results} when the adversary has a combination of the capabilities described in Section~\ref{sec:model:attacker}. Each element in the table describes which attacks are thwarted by the corresponding solution.} \label{table:analysis} \end{table} Consider the life cycle of record $i$, $R_i$, on $T$. After the execution of the first $Upload$, $R_i$ is initialized with $E_{K_W}(ctr, i)$. When $R_i$ is overwritten with sensor data, it contains $encData[i]$ = $D[i] \oplus E_{K_T}(ctr, i) \oplus E_{K_W}(ctr, i)$. Subsequently, $R_i$ is not touched until an Upload takes place. During Upload, the (encoded) content of $mem[i]$ is sent to $W$, who subsequently overwrites $R_i$ with a new value: $E_{K_W}(ctr+1, i)$. The base does not contribute to the messages it forwards between $T$ and $W$. Hence, the base does not need to be authenticated. The use of the $ctr+1$ value in communications through the base ensures message freshness. Without $E_{K_T}(ctr, i)$, an Inspect adversary capturing communications between $T$ and $W$ cannot recover $mem[i]$. The use of HMACs with the key $K_T$ to authenticate communications between $T$ and $W$ prevents Inject attacks: an attacker that modifies existing messages or injects new messages cannot create valid HMAC values. An attacker that launches a Capture attack against a victim tracker or base, cannot recover information from them and thus has no advantage over general Inspect and Inject attacks. An adversary that captures a tracker $T$ and launches a JTAG-R attack can either read $E_{K_W}(ctr, i)$ or $D[i]$ $\oplus$ $E_{K_W}(ctr, i)$ $\oplus$ $E_{K_T}(ctr, i)$, but not both. The use of the $E_{K_T}(ctr, i)$ value prevents an attacker from recovering $D[i]$. A JTAG-R attack against a captured, trusted base of tracker $T$ offers no advantage over Inspect and Inject attacks: in SensCrypt, the base only forwards traffic between $T$ and $W$. Similar to JTAG-R, a JTAG-RW attack against a captured tracker cannot decode previously encoded sensor data; it can however encode fraudulent data on the tracker (TI attack) and thus also inject data into $W$ (UAI attack). An adversary able to perform Inspect, Capture and JTAG-R attacks can gain access to $E_{K_W}(ctr, i)$ when sent by $W$, then use JTAG-R to read $T$'s $K_T$, compute $E_{K_T}(ctr, i)$ and learn $D[i]$ (TPDC attack). We note the complexity of this attack. If able to further implement Inject attacks, the adversary can also succeed in a UAI attack. Furthermore, SensCrypt is vulnerable to an adversary able to capture $T$ twice, at times $t_1$ and $t_2$. At time $t_1$ the adversary uses JTAG-R to read $E_{K_W}(ctr, i)$. At time $t_2$, assuming $T$ has already written record $i$, the adversary uses JTAG-R to read $mem[i]$ and $K_T$ and recover $D[i]$. This $\textit{double JTAG-R attack}$ is significantly more complex than a single JTAG-R attack. In addition, this attack is further complicated by time constraints: At $t_1$, record $i$ has not yet been written, and at $t_2$ it has been written \textit{but} an Upload has not yet been executed. An Upload procedure before $t_2$ would overwrite record $i$ with $E_{K_W}(ctr+1, i)$, effectively thwarting this attack. FitCrypt is resilient to TPDC attacks launched by adversaries capable of performing JTAG-R and Inspect, Inject and double JTAG-R attacks: $T$'s records encrypted with the public key can only be decrypted by $W$. Table~\ref{table:analysis} summarizes the comparison of SensCrypt and FitLock defenses. While providing more defenses (i.e., against TPDC for several attacker capabilities), FitLock is not a viable solution on most of the available trackers (see Section~\ref{sec:evaluation}). \section{Applications} \begin{table*} \centering \begin{tabular}{l r r r r} \toprule \textbf{Platform} & \textbf{Type of data} & \textbf{Communication} & \textbf{Coverage} & {Memory}\\ \midrule Fitbit~\cite{Fitbit} & user profile, fitness, sleep data & ANT+, BT & 5-50m & 96 KB RAM, 112 KB flash\\ Garmin FR610~\cite{Forerunner} & fitness data, heart rate, location & ANT+ & 10-20m & 1 MB\\ Nike+~\cite{Nike} & profile, fitness data & BT & 50m & Flash 256KB, RAM 32 KB\\ Jawbone Up~\cite{Jawbone} & fitness, sleep data & BT & 50m & 128KB Flash, 8KB RAM\\ Motorola MotoActv~\cite{MotoActv}& fitness data, user profile & ANT+, BT, Wi-Fi & 35m & 16 GB\\ Basis B1~\cite{Basis} & fitness, sleep data, heart rate & BT & 50m & 7 days of data\\ Mother~\cite{Mother} & motion, fitness, proximity & 915-MHz & 30m & 32 KB RAM\\ Nest~\cite{Nest} & utility data & Wi-Fi & 35m & 512Mb DRAM, 2 Gb flash\\ Belkin WeMo~\cite{WeMo} & home electronics & Wi-Fi & 35m & RAM 32 MB, Flash 16 MB\\ \bottomrule \end{tabular} \caption{SensCrypt applicability: fitness trackers, home monitoring solutions.} \label{table:application} \end{table*} SensCrypt can be applied to a range of sensor based platforms, where resource constrained sensors are unable to directly sync their data with a central webserver and need to use an Internet connected base. This includes a large number of popular fitness and home monitoring solutions. Table~\ref{table:application} summarizes several such platforms, including the communication and storage capabilities of their sensors. SensCrypt can also be used in applications where the sensors need to be immobile, while being able to operate without network connectivity. Examples include health, infrastructure, traffic, building and campus monitoring solutions. The bases through which the sensors sync with the webserver are mobile, e.g., smartphones of workers, who may become proximal to the sensors with the intention of data collection or as a byproduct of routine operations. SensCrypt can also secure the data and communications of platforms for social psychological studies. One such example is SociableSense~\cite{RMMR11}, a smartphone solution that captures sensitive user behaviors (including co-location), processes the information on a remote server, and provides measures of user sociability. \section{Sens.io: The Platform} \label{sec:implementation} \begin{figure} \begin{center} \includegraphics[width=2.9in]{arduinoSystem.eps} \caption{Testbed for SensCrypt. Sens.io is the Arduino Uno device equipped with Bluetooth shield and SD card is the tracker. Nexus 4 is the base.} \label{fig:sens.io} \end{center} \end{figure} We have built Sens.io, a prototype tracker, from off-the-shelves components. It consists of an Arduino Uno Rev3 ~\cite{arduinoUno} and external Bluetooth (Seeeduino V3.0) and SanDisk card shields. The Arduino platform is a good model of resource constrained trackers: its ATmega328 micro-controller has a 16MHz clock, 32 KB Flash memory, 2 KB SRAM and 1KB EEPROM. The Bluetooth card has a default baud rate of 38,400 and communication range up to 10m. Since the Arduino has 2 KB SRAM, it can only rely on 1822 bytes to buffer data for transmissions. The SD card (FAT 16) can be accessed at the granularity of 512 byte blocks. The cost of Sens.io is \$52 (\$25 Arduino card, \$20 Bluetooth shield, \$2.5 SD Card shield, \$4 SD card, see Figure~\ref{fig:sens.io}), a fraction of Fitbit's (\$99) and Garmin's (\$299) trackers. \begin{figure} \begin{center} \includegraphics[width=3.3in]{fitlock.architecture.eps} \caption{SensCrypt architecture. The tracker relies on locally stored key $K_T$ to authenticate webserver messages and encode sensor data. The webserver manages the $Map$ structure, to authenticate and decrypt tracker reports.} \label{fig:senscrypt:solution} \end{center} \end{figure} \noindent {\bf SensCrypt.} We have implemented a general, end-to-end SensCrypt architecture, as illustrated in Figure~\ref{fig:senscrypt:solution}. We have implemented the tracker both in Arduino's programming language (a Wiring implementation~\cite{ArduinoGuide}), and, for generality, in Android. The base component (written exclusively in Android) is a simple communication relay. We implemented the webserver using Apache Tomcat 7.0.52 and Apache Axis2 Web services engine. We used the MongoDB 2.4.9 database to store the $Map$ structure. We implemented a Bluetooth~\cite{Bluetooth} serial communication protocol between the tracker and the base. \noindent {\bf The testbed.} We used Sens.io for the tracker, an Android Nexus 4 with 1.512 GHz CPU for the base, and a 2.4GHz Intel Core i5 Dell laptop with 4GB of RAM for the webserver. We used Bluetooth for tracker to base communications and Wi-Fi for the connectivity between the base and the webserver. Figure~\ref{fig:sens.io} illustrates our testbed. \section{Evaluation} \label{sec:evaluation} We used Sens.io for the tracker, Android Nexus 4 with 1.512 GHz CPU for the base, and a 2.4GHz Intel Core i5 Dell laptop with 4GB of RAM for the webserver. We used Bluetooth for tracker to base communications and Wi-Fi for the connectivity between the base and the webserver. Figure~\ref{fig:sens.io} illustrates our testbed. In the following, we report evaluation results, as averages taken over at least 10 independent protocol runs. \begin{table} \centering \begin{tabular}{l r r r} \toprule \textbf{Platform} & \textbf{SensCrypt} & \textbf{FitCr-RSA} & \textbf{FitCr-ECC}\\ \midrule Fitbit & 6.02 & 2300 & 2520\\ Garmin & 6.06 & 2300 & 2520\\ \bottomrule \end{tabular} \caption{RecordData: computation overhead in ms. FitCrypt-RSA 2048 bit is not viable on Arduino (2.3s). FitCrypt-ECC 224 bit (equivalent of RSA 2048 bit) is even less efficient. SensCrypt is 2-3 orders of magnitude more efficient.} \label{table:record:data} \end{table} \subsection{Tracker: RecordData Overhead} We have investigated the overhead of the $RecordData$ procedure on Sens.io. Table~\ref{table:record:data} compares the performance of SensCrypt and FitCrypt, with times shown in milliseconds. We have explored two versions of FitCrypt, using RSA and ECC. FitCrypt-RSA with a 1024 bit modulus takes more than 500ms, but is currently obsolete. FitCrypt-RSA with a 2048 bit modulus hangs on Sens.io due to its low (2KB) RAM. The value shown in Table~\ref{table:record:data} is from~\cite{GPWES04}, where a similar platform was used. FitCrypt-ECC uses ECIES, an elliptic curve cryptography solution, with a 224 bit key size, the security equivalent of RSA with 2048 bit modulus. FitCrypt-RSA 2048 and FitCrypt-ECC are not viable alternatives, imposing an overhead of 230\% for 1 per sec. RecordData frequency. SensCrypt imposes however an overhead of less than 1\% (6ms for each 1s interval between RecordData runs). \subsection{Webserver: Storage Overhead} The webserver maintains a data structure, $Map$, with a record for each user and tracker pair. The entry consists of user, tracker and bases ids (8 byte long each), a salt (16B), password hash (28B), 2 symmetric keys (32B each) and a counter (1B). Assuming a single base in the $Bases$ list, a Map entry stores 133 bytes. For a 1 million user base, the webserver needs to store a $Map$ structure of 127MB. The average time to retrieve a record from a 1 million user $Map$ is 158ms. \subsection{Upload: End-to-end Overhead} We consider a ``Fitbit'' scenario where the Upload procedure runs once every 15 minutes when in the vicinity of a base. Assuming a RecordData frequency of once every 2s (usual in Garmin), and a record size of 64B, SensCrypt uploads and overwrites 71 blocks of 512B each. The tracker side of the SensCrypt Upload procedure takes 502ms, dominated by the cost to read and write 71 blocks of data from/to the SD card. A single core of the Dell laptop can support 5 Uploads per second. The server cost is dominated by the 158ms cost of retrieving a record from a 1 million entry $Map$. The Upload/s rate of the webserver can be improved by caching the least recently accessed or most popular records of $Map$. Even though transferring over Bluetooth, the communication cost of SensCrypt's Upload is 153ms. This is due to the low RAM available on Arduino for buffering packets (2KB). SensCrypt's total Upload time of 845ms is 400ms less than FitCrypt's, assuming Fitbit's memory size. We note however that Fitbit records data only once per minute, a rate at which SensCrypt would perform significantly faster. SensCrypt is 13 times faster (by more than 11s) than FitCrypt when considering Garmin's memory (2000 blocks of 512B). This gain is due to SensCrypt's optimization of only uploading the red, written blocks, instead of the entire memory. Furthermore, even on the communication restricted Sens.io, SensCrypt reduces the upload operation of the \textit{real} Fitbit equipment (1481ms on average) by 43\%. \begin{table} \centering \begin{tabular}{l r r r} \toprule \textbf{Solutions} & \textbf{T} & \textbf{W} & \textbf{Comm}\\ \midrule SensCrypt & 502.13 & 190.4 & 153\\ FitCrypt (Fitbit) & 904.56 & 177.36 & 162\\ FitCrypt (Garmin) & 9366 & 322 & 1686\\ \bottomrule \end{tabular} \caption{Upload: comparison of tracker, webserver and communication delays (shown in ms) of SensCrypt and FitCrypt. FitCrypt (RSA or ECC) is shown both for the Fitbit (96KB) and Garmin (1MB) memory size. The delay of SensCrypt is independent of $mem$ size, and significantly shorter. } \label{table:upload} \end{table} \subsection{Battery Impact} To evaluate the impact of SensCrypt on the battery lifetime, we powered the Sens.io device using a 9V alkaline battery~\cite{duracell}. In a first experiment, we evaluated the ability of SensCrypt to mitigate the effects of the battery drain attack. For this, we used the Bluetooth enabled Sens.io device to establish a connection with an Android app running on a Nexus 4 base. We investigated and compared two scenarios. In the first scenario, the Bluetooth enabled Sens.io runs the Fitbit protocol to process and respond to requests received every 15s. In the second scenario, the Sens.io device runs SensCrypt to process the same requests. Each scenario is performed using a fresh 9V battery. When running Fitbit, the Sens.io device runs out of battery after 484 minutes. When running SensCrypt, the Sens.io device lasts for a total of 821 minutes. Thus, SensCrypt extends the battery lifetime of Sens.io under the battery depletion attack by 69\%. \begin{figure} \begin{center} \includegraphics[width=2.9in]{battery.sensio.eps} \caption{Battery lifetime for 9V cell powered Sens.io device in four scenarios: Baseline, Fitbit, SensCrypt and FitCrypt-RSA-256. The last three scenarios record sensor data every 2s. The Baseline scenario measures the battery lifetime of Arduino device with no functionality. SensCrypt reduces 13\% of the battery lifetime over Fitbit's operation. Even a vulnerable FitCrypt-RSA-256 reduces the battery lifetime to half of SensCrypt.} \label{fig:battery} \end{center} \end{figure} In a second experiment, we compared the impact of the periodic SensCrypt, FitCrypt-RSA-256 and Fitbit sensor data recording operations on the Sens.io battery lifetime. In the experiment, we considered a 2s interval between consecutive sensor recording operations. We have tested several RSA key sizes (2048 to 256 bit long). An (insecure) RSA key size of 256 bits was the largest value that did not hang on an Arduino board after only a few encryptions. We have also run a baseline experiment, measuring the battery lifetime of an Arduino board that is not recording any sensor data. Figure~\ref{fig:battery} shows our results. In the Baseline scenario, the battery lasted 56 hrs and 23 mins. When running Fitbit's sensor data record operation, the battery lasted 50 hrs and 18 mins. When running SensCrypt's $RecordData$ operation, the battery lasted 43 hrs and 38 mins. Thus, Fitbit's sensor recording operation shortens the battery by 10\% over the baseline. SensCrypt's $RecordData$ reduces the battery lifetime by 13\% of the Fitbit battery lifetime. Finally, when running FitCrypt-RSA-256, the battery lasted only 22 hrs and 10 mins. Even with a vulnerable key size, FitCrypt reduces the battery lifetime by 49\% of the SensCrypt lifetime. This confirms the unsuitability of public key cryptosystems to secure resource constrained fitness trackers. \section{Related Work} \label{sec:related} In the context of implantable medical devices (IMDs) Halperin et al.~\cite{HHBRCDMFKM08} introduce novel software radio attacks and propose zero power notification, authentication and key exchange solutions. Rasmussen et al.~\cite{RCHBC09} propose proximity based access control solutions for IMDs. The different mission of fitness trackers creates different design constraints. First, unlike IMD security, where the focus is on authentication and key exchange, SensCrypt's focus is on the secure storage and communication of tracker data. This is further emphasized by our need to also consider attackers that can perform Capture and JTAG-R attacks, for both trackers and bases (readers in the IMD context). While such attacks may not be possible for IMDs, and IMD readers may be expensive enough to afford tamper proof memory, these assumptions do not hold for most existing fitness centric social sensor network solutions. Furthermore, while additional user interaction may be naturally accepted for IMDs, fitness security solutions should minimize or even eliminate user involvement. Tsubouchi et al.~\cite{TKS13} have shown that Fitbit data can be used to infer surprising information, in the form of working relations between tracker carrying co-workers. This information could be used to surreptitiously learn the organizational profile of a company. This work assumes access to the fitness data of other users, a task that part of our paper undertakes. Naveed et al.~\cite{NZDWG14} introduced an ``external device mis-bonding attack'' for Bluetooth enabled Android health/medical devices, then collected sensitive user data from and fed arbitrary information into the user's account. They developed Dabinder, an OS level defense that generates and enforces secure bonding policies between a device and its official app. Our work differs in the types and implementation of attacks, and in the solution placement: SensCrypt is implemented at the tracker and webserver, whereas Dabinder is focused on the base. Lim et al.~\cite{WBAN} analyzed the security of a remote cardiac monitoring system where the data originating from the sensors is sent through a Body Area Network (BAN) gateway and a wireless router to a final monitoring server. Muraleedharan et al.~\cite{Muraleedharan} proposed DoS attacks including Sybil~\cite{Sybil} and wormhole~\cite{Wormhole} attacks, for a health monitoring system using wireless sensor networks. They introduced an energy-efficient cognitive routing algorithm to address such attacks. Our work differs through its system architecture, communication model and tracker capabilities. Barnickel et al.~\cite{HealthNet} targeted security and privacy issues for HealthNet, a health monitoring and recording system. They proposed a security and privacy aware architecture, relying on data avoidance, data minimization, decentralized storage, and the use of cryptography. Marti et al.~\cite{Ramon} described the requirements and implementation of the security mechanisms for MobiHealth, a wireless mobile health care system. MobiHealth relies on Bluetooth and ZigBee link layer security for communication to the sensors and uses HTTPS mutual authentication and encryption for connections to the backend. \section{Conclusions} \label{sec:conclusions} We identified and exploited vulnerabilities in the design of Fitbit and Garmin, to launch inspection and injection attacks. We presented SensCrypt, a secure and efficient solution for storing and communicating tracker sensor data. SensCrypt imposes minimal computation and communication overhead on trackers, and is resilient even to attackers able to probe the memory of captured trackers. \section{Acknowledgments} \noindent This research was supported in part by DoD grant W911NF-13-1-0142 and NSF grant EAGER-1450619.
{'timestamp': '2017-03-27T02:08:21', 'yymm': '1703', 'arxiv_id': '1703.08455', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08455'}
arxiv
\section{Introduction} Herlihy and Shavit's~\cite{HerlihyS93,HerlihyS99} \emph{asynchronous computability theorem} (ACT) characterizes which tasks are solvable in asynchronous shared-memory systems. Informally, this characterization employs the language of combinatorial topology: a task can be expressed as a relation between two ``colored'' simplicial complexes. The theorem states that a protocol (algorithm) exists if and only if there is a ``color-preserving'' simplicial map from one complex to the other compatible with the task's relation. This approach replaces the usual operational model, where computations unfold in time, with a static model in which all possible protocol interleavings are captured in a single combinatorial structure. The proof of the ACT contains one difficult step. Using the classical \emph{simplicial approximation theorem}~\cite[p.89]{Munkres84}, it is straightforward to construct a simplicial map having all desired properties except that of being color-preserving. To make this map color-preserving required a rather long construction employing mechanisms from point-set topology, such as $\epsilon$-balls and Cauchy sequences. Borowsky and Gafni~\cite{BorowskyG97} later proposed an alternative proof strategy for the ACT in which the essential chromatic property was guaranteed by an algorithm, rather than by a combinatorial construction. The description of this algorithm was sketchy, however, and no proof was provided. In this paper, we give the first complete description of their algorithm, along with its first proof of correctness. The paper is structured as follows. In Section \ref{sec:topology}, we briefly introduce the combinatorial model and the relevant topological machinery, and we give a short exposition on the work by Borowsky and Gafni~\cite{BorowskyG97}. In Section 3, we describe the convergence algorithm and a subroutine used by it. In Section 4, we give a complete proof of correctness of the convergence algorithm. In Section 5, we explain how the convergence algorithm can be applied to more general tasks. In Section 6, we summarize some related work, and in Section 7, we conclude with some final remarks. \section{Combinatorial Topology} \label{sec:topology} This section reviews the basic notions of combinatorial topology that will be used to describe shared-memory computation. Our basic construct, called a simplicial complex, can be defined in two complementary ways: combinatorial and geometric. Sometimes it is convenient to use one view, sometimes the other, and we will go back and forth as needed. \subsection{Abstract Simplicial Complexes} Given a finite set $V$, and a~family $\cK$ of finite subsets of $V$, we say that $\cK$ is an \emph{abstract simplicial complex} on $V$ if the following hold: \begin{enumerate} \item [(1)] if $X\in\cK$, and $Y\subseteq X$, then $Y\in\cK$; \item [(2)] $\{v\}\in\cK$, for all $v\in V$. \end{enumerate} Each set in $\cK$ is called a \emph{simplex}, usually denoted by lower-case Greek letters $\sigma$ and $\tau$. A subset of a simplex is a \emph{face} of that simplex. The \emph{dimension} $\dim \sigma$ is one less than the number of elements of $\sigma$, or $|\sigma| - 1$. We use ``$n$-simplex'' as shorthand for ``$n$-dimensional simplex'', and similarly for ``$n$-face''. A simplex $\phi$ in $\cK$ is a \emph{facet} of $\cK$ if $\phi$ is not contained in any other simplex. A complex is \emph{pure} if all its facets have the same dimension. The \emph{$n$-skeleton} of a complex $\cK$, $\skel^n \cK$, is the complex formed by all simplexes of $\cK$ of dimension $n$ or less. If $\cK$ and $\cL$ are complexes with $\cK \subseteq \cL$, we say $\cK$ is a \emph{subcomplex} of $\cL$. We use $\Delta^n$ to denote the complex consisting of a single $n$-simplex and its faces. A \emph{labeling} is a map $\lambda: V \rightarrow D$, where $D$ is an arbitrary domain, such as the natural numbers. A map $\phi$ carrying vertexes of $\cK$ to vertexes of $\cL$ is a \emph{simplicial map} if it also carries simplexes of $\cK$ to simplexes of $\cL$. A simplicial map $\chi: \mathcal{K} \rightarrow \mathcal{L}$ is a \emph{coloring} if for each simplex $\sigma$ of $\cK$, the vertexes of $\sigma$ are mapped to distinct vertexes. Most complexes considered here are endowed with a coloring $\chi$, and such complexes are called \emph{chromatic}. A simplicial map $\phi: \cK \to \cL$ is \emph{color-preserving} if $\chi(v) = \chi(\phi(v))$ for vertexes $v \in \cK$. For complexes $\cK$ and $\cL$, a~\emph{carrier map}, written \begin{equation*} \Gamma: \cK \to 2^\cL, \end{equation*} maps each simplex $\sigma\in\cK$ to a~subcomplex $\Gamma(\sigma)$ of~$\cL$, such that if $\tau \subseteq \sigma$, then $\Gamma(\tau) \subseteq \Gamma(\sigma)$. A simplicial map $\gamma$ is \emph{carried by} a carrier map $\Gamma$ if $\gamma(\sigma) \subseteq \Gamma(\sigma)$ for every simplex in their domain. In this case, $\gamma$ is said to be \emph{carrier-preserving}. The \emph{star} of a simplex $\sigma \in \cC$, written $\Star(\sigma,\cC)$, or $\Star(\sigma)$ when $\cC$ is clear from context, is the complex that consist of every simplex $\tau$ which contains $\sigma$, and every simplex contained in such $\tau$. \subsection{Geometric Complexes} In the alternative geometric view, we embed a complex in a Euclidean space $\ensuremath{\mathbb{R}}^d$ of sufficiently high dimension. Given a set $X = \set{x_0, \ldots, x_n}$ of points in $\ensuremath{\mathbb{R}}^d$, their \emph{convex hull}, written $\conv X$, is the set of points $y$ that can be expressed as \begin{equation*} y = \sum_{i=0}^n t_i \cdot x_i, \end{equation*} where the coefficients $t_i$ satisfy $0 \leq t_i \leq 1$, and $\sum_{i=0}^n t_i = 1$. The $t_i$ are called the \emph{barycentric coordinates} of $y$ with respect to $X$. The set $X$ is \emph{affinely independent} if no point in the set can be expressed as a weighted sum of the others. A (geometric) vertex is a point in $\ensuremath{\mathbb{R}}^d$, and a (geometric) $n$-simplex is the convex hull of $(n+1)$ affinely-independent geometric vertexes. A \emph{geometric simplicial complex} $\cK$ in $\ensuremath{\mathbb{R}}^d$ is a~collection of of geometric simplexes, such that \begin{enumerate} \item [(1)] any face of a~$\sigma\in\cK$ is also in $\cK$; \item [(2)] for all $\sigma,\tau\in\cK$, their intersection $\sigma\cap\tau$ is a~face of each of them. \end{enumerate} We use $|\cK|$ to denote the point-set occupied by the geometric complex $\cK$. Given a geometric simplicial complex $\cK$, we can define the underlying abstract simplicial complex $\cC(\cK)$ as follows: take the union of all the sets of vertexes of the simplexes of $\cK$ as the vertexes of $\cC(\cK)$, then for each simplex $\sigma=\conv\{v_0,\dots,v_n\}$ of $\cK$ take the set $\{v_0,\dots,v_n\}$ to be a simplex of $\cC(\cK)$. In the opposite direction, given an abstract simplicial complex $\ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}}$ with finitely many vertexes, there exist many geometric simplicial complexes $\cK$, such that $\cC(\cK)=\ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}}$. The \emph{open star}, denoted $\Ostar(\sigma)$, is the union of the interiors of the simplexes that contain $\sigma$: \begin{equation*} \Ostar(\sigma)=\bigcup_{\tau\supseteq\sigma}\inte\tau. \end{equation*} Note that $\Ostar(\sigma)$ is not an~abstract or geometric simplicial complex, but just a open point-set in $\cC$. \subsection{Subdivisions} \begin{figure} \centerline{\includegraphics[width=\hsize]{Ch03-7}} \caption{A geometric complex and a subdivision of it.} \label{figure:ch03:subdivision} \end{figure} If $\ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}}$ and $\cB$ are geometric complexes, a continuous map $f: |\ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}}| \to |\cB|$ is \emph{carried by} a carrier map $\Phi: \ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}} \to 2^{\cB}$ if, for every simplex $\sigma \in \ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}}$, $f(\sigma) \subseteq |\Phi(\sigma)|$. Informally, a \emph{subdivision} of a complex $\cK$ is constructed by ``dividing'' the simplexes of $\cK$ into smaller simplexes, to obtain another complex $\cL$. Subdivisions can be defined for both geometric and abstract complexes. \begin{definition} \label{def:ch03:subdivision} \index{subdivision} A geometric complex $\cB$ is called a \emph{subdivision} of a geometric complex $\ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}}$ if the following two conditions are satisfied: \begin{enumerate} \item[(1)] $|\ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}}|=|\cB|$; \item[(2)] each simplex of $\ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}}$ is the union of finitely many simplexes of~$\cB$. \end{enumerate} \end{definition} Figure~\ref{figure:ch03:subdivision} shows a geometric complex and a~subdivision of that complex. Subdivisions can be defined for abstract simplicial complexes as well. \begin{definition}\label{def:ch03:Subd} Let $\ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}}$ and $\cB$ be abstract simplicial complexes. We say that $\cB$ \emph{subdivides} the complex $\ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}}$ if there exists a~homeomorphism $h:|\ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}}|\rightarrow|\cB|$ and a~carrier map $\Phi:\ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}}\rightarrow 2^{\cB}$, such that for every simplex $\sigma\in\ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}}$, the restriction $h|_{|\sigma|}$ is a~homeomorphism between $|\sigma|$ and $|\Phi(\sigma)|$. \end{definition} A subdivision $\Div(\cK)$ is \emph{chromatic}, if $\Div(\cK)$ is chromatic, and for every simplex $\sigma \in \cK$, $\Div(\sigma)$ and $\sigma$ have the same colors. Let $\Div \cK$ be a subdivision. The \emph{carrier} of a simplex $\sigma$, $\Car(\sigma)$, is the smallest simplex $\kappa \in \Div \cK$ such that $\sigma \in \Div(\cK)$. \subsubsection{Barycentric Subdivision} \label{section:ch03:barycentric} In classical combinatorial topology, the following barycentric subdivision is perhaps the most widely used. \begin{definition}\label{def:ch03:barySubd} \index{barycentric subdivision} \index{subdivision!barycentric} Let $\cK$ be an~abstract simplicial complex. Its \emph{barycentric} subdivision $\bary\cK$ is the abstract simplicial complex whose vertexes are the non-empty simplexes of $\cK$. A~$(k+1)$-tuple $(\sigma_0,\dots,\sigma_k)$ is a~simplex of $\bary\cK$ if and only if the tuple can be indexed so that $\sigma_0 \subset \cdots \subset \sigma_k$. \end{definition} \subsubsection{Standard Chromatic Subdivision} \begin{figure} \centerline{\includegraphics[width=\hsize]{subdivisions}} \caption{A simplex $\sigma$ (top), the barycentric subdivision $\bary \sigma$ (bottom left), and the standard chromatic subdivision $\Ch \sigma$ (bottom right).} \label{figure:ch03:subdivisions} \end{figure} The \emph{standard chromatic subdivision} $\Ch(\cK)$ is the chromatic analog to the barycentric subdivision. (See Figure~\ref{figure:ch03:subdivisions}.) \begin{definition}\label{def:ch03:chromSubd} Let $(\ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}},\chi)$ be a~chromatic abstract simplicial complex. Its \emph{standard chromatic} subdivision $\Ch(\ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}})$ is the abstract simplicial complex whose vertexes have the form $(i,\sigma_i)$, where $i \in \{0, ...,n\}$, $\sigma_i$ is a non-empty face of $\sigma$, and $i \in \chi(\sigma_i)$. A~$(k+1)$-tuple $(\sigma_0,\dots,\sigma_k)$ is a~simplex of $\Ch(\ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}})$ if and only if \begin{itemize} \item the tuple can be indexed so that $\sigma_0\subseteq \cdots \subseteq \sigma_k$. \item for $0 \leq i,j \leq n$, if $i \in \chi(\sigma_j)$ then $\sigma_i \subseteq \sigma_j$. \end{itemize} Finally, to make the subdivision chromatic, we define the coloring $\chi: \Ch(\cK)$ to be $\chi(i,\sigma) = i$. \end{definition} This subdivision extends to complexes in the obvious way, and it can be \emph{iterated} to produce subdivisions $\Ch^N(\sigma)$, for $N > 0$. \subsection{Links and Connectivity} Subdivided simplexes exhibit an important property called \emph{link-connectivity}. We provide the necessary definitions below. \begin{definition} The \emph{link} of a $\sigma$ in complex $\cK$, denoted $\Lk(\sigma, \cK)$, is the subcomplex of $\cK$ consisting of all simplexes $\tau$ disjoint from $\sigma$ such that $\tau \cup \sigma \in \cK$. \end{definition} One can think of the link of $\sigma$ as a simplicial neighborhood that encompasses $\sigma$. Next, we present the concept of \emph{connectivity} as taken from algebraic topology. \begin{definition} Let $S^k$ denote the $k$-dimensional sphere. A~complex $\cK$ is \emph{$k$-connected} if, for all $0\leq m\leq k$, any continuous map $f:~S^m~\to~|\cK|$ can be extended to a continuous $F:~D^{m+1}~\to~|\cK|$, where the sphere $S^m$ is the boundary of the disk $D^{m+1}$. \end{definition} One way to think about this property is that any map $f$ of the $k$-sphere that cannot be ``filled in'' represents a $k$-dimensional ``hole'' in the complex. \begin{definition} A pure $n$-dimensional complex $\cK$ is \emph{link-connected} if for all $\sigma \in \cK$, $\Lk(\sigma, \cK)$ is $(n - \dim(\sigma) - 2)$-connected. \end{definition} Informally, link-connectivity ensures that a complex cannot be ``pinched'' too thinly. All subdivided simplexes are link-connected, which is an important property for proving the main theorem. \subsection{Useful Theorems} We will need the following \emph{pasting lemma} from point-set topology. \begin{lemma} \label{lemma:pasting} Let $X_1$ and $X_2$ be closed sets of a common space, with continuous $f_i : X_i \rightarrow Y$ that coincide on the intersection $X_1 \cap X_2$. Then the function $f : X_1 \cup X_2 \rightarrow Y$, defined in terms of the $f_i$, is a continuous function. \end{lemma} We will also need the following version of the classical \emph{simplicial approximation theorem}. \begin{definition} \label{def:ch03:simplicial-approximation} Let $\ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}}$ and $\cB$ be abstract simplicial complexes, let $f:~|\ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}}|~\to~|\cB|$ be a~continuous map, and let $\varphi:~\ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}}~\to~\cB$ be a~simplicial map. The map $\varphi$ is called a~\emph{simplicial approximation} to~$f$, if for every simplex $\alpha$ in $\ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}}$ we have \begin{equation} \label{eq:defsimpappr} f(\inte|\alpha|) \subseteq \bigcap_{a \in \alpha} \Ostar(\varphi(a)) =\Ostar(\varphi(\alpha)), \end{equation} where $\inte|\alpha|$ denotes the interior of $|\alpha|$. \end{definition} \begin{theorem} \label{theorem:ch03:approx} Let $\ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}}$ and $\cB$ be simplicial complexes. Given a~continuous map $f:|\ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}}|~\to~|\cB|$, there is an $N > 0$ such that $f$ has a~simplicial approximation $\varphi:~\Ch^N(\ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}})~\to~\cB$. \end{theorem} This theorem remains true if we replace the standard chromatic subdivision $\Ch(\cdot)$ with the barycentric subdivision $\Bary(\cdot)$. \section{Read-Write Memory} \input{computation.tex} \section{The Asynchronous Computability Theorem} \input{theorem.tex} \section{Correctness of the Convergence Algorithm} \input{correctness.tex} \section{Related work} A more complete treatment of topological models for concurrent computing can be found in the textbook of Herlihy, Kozlov, and Rajsbaum~\cite{HerlihyKR2013}. The original ACT~\cite{HerlihyS93,HerlihyS99} used combinatorial arguments to construct the color-preserving map required by the theorem. Borowsky and Gafni~\cite{BorowskyG97} proposed the alternative algorithmic approach to constructing this map, but without complete definitions or a proof of correctness. Guerraoui and Kuznetsov~\cite{GuerraouiK2004} compare the two approaches. Gafni \emph{et al.}~\cite{GafniKM2014} recently generalized the ACT to encompass infinite executions and other models. The first application of the ACT was to prove the impossibility of the \emph{$k$-set agreement} task~\cite{Chaudhuri90}, a result also proved, using other techniques, by Borowsky and Gafni~\cite{BorowskyG93}, and by Saks and Zaharoglou~\cite{SaksZ93}. These results generalize the classic proofs of the impossibility of consensus due to Fischer \emph{et al.}~\cite{FischerL82} and Biran \emph{et al.}~\cite{BiranMZ90}. Castaneda and Rajsbaum~\cite{CastanedaR08} use the ACT to show that the \emph{renaming} task~\cite{AttiyaBDKPR87} for $n+1$ processes has no wait-free read/write protocol with $2n$ output names when $n+1$ is a prime power, but that a protocol does exist when $n+1$ is not a prime power. Attiya \emph{et al.}~\cite{AttiyaCHP2013} and Kozlov~\cite{Kozlov15a} give upper bounds on the running times of such protocols. \section{Remarks} The heart of the ACT is the construction of a chromatic map from a chromatic subdivision of the input complex to the output complex. While it is easy to construct a non-chromatic map using the well-known \emph{simplicial approximation theorem}~\cite[p.89]{Munkres84}, the only prior construction~\cite{HerlihyKR2013,HerlihyS99} was long and complex. The algorithmic approach proposed by Borowsky and Gafni~\cite{BorowskyG93} was intuitively appealing, but lacked a complete statement of the algorithm and a proof. Here, we have given such a statement and proof, and we believe the result, while far from simple, is easier to follow, and yields new insight into this key construction. \vspace{10pt} \newpage \bibliographystyle{plain} \subsection{Processes} As stated, a process is an automaton. Each process has a unique \emph{name}. In a computation, it starts with an input value, takes a finite number of steps, and halts with an output value. The task specification defines which values can be assigned as inputs, and which can be accepted as outputs. A process state is modeled as a vertex, labeled with both that process's name and its state. A system state is a simplex, where each vertex represents a process and its state, and the vertexes represent mutually compatible states. Such is simplex colored by process names, and labeled with process states. An initial system state is represented as a simplex whose set of vertexes represent the simultaneous states of distinct processes. The set of all possible states forms a chromatic complex, colored by process names, and labeled with process states. Henceforth, we speak of a vertex's \emph{color} as shorthand for the name of the corresponding process. \subsection{Tasks} To reduce computation to its simplest form, we consider a fundamental unit of computation called a~\emph{task}. An input to a task is distributed: only part of the input is given to each process. The output from a task is also distributed: only part of the output is computed by each process. The task specification states which outputs can be produced in response to each inputs. A \emph{task} is a triple $(\ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}}, \cO, \Gamma)$, where $\ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}}$ is the \emph{input complex\/} that defines all possible initial configurations, $\cO$ is the \emph{output complex} that defines all possible final configurations, and $\Gamma$ is a carrier map carrying each $m$-simplex of $\ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}}$ to a subcomplex of $m$-simplexes of $\cO$, for $0 \leq m \leq n$. $\Gamma$ has the following interpretation: for each $\sigma \in \ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}}$, if the $(\dim \sigma +1)$ processes in $\sigma$ start with the designated input values, and the remaining $n- \dim \sigma$ processes fail without taking any steps, then each simplex in $\Gamma(\sigma)$ corresponds to a legal final state of the non-faulty processes. A task has the following interpretation. For each simplex $\sigma \in \ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}}$, if the $(\dim \sigma +1)$ processes in $\sigma$ each starts on the unique vertex colored with its name, taking as input that vertex's labeled value, and the remaining $n- \dim \sigma$ processes fail without taking any steps, then each simplex in $\Gamma(\sigma)$ corresponds to a legal final state of the non-faulty processes, where each process halts on the unique vertex colored with its name, taking as output that vertex's labeled value. The most common task considered in this paper is a \emph{convergence} task. We are given a input complex $\ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}}$ colored by process names, and a chromatic subdivision of $\ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}}$. In the task $(\ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}}, \Div(\ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}}), \Div)$, the $n+1$ processes start on vertexes of an $n$-simplex $\sigma$ of $\ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}}$, where each process's input vertex is colored by that process's name. The processes halt on a single simplex of $\Div(\sigma)$, and each process halts on an vertex is colored by that process's name. In some circumstances, we relax the requirement that each processes halt on an output vertex labeled with its own name. A \emph{colorless} task is also defined by a triple $(\ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}},\cO,\Gamma)$, but there is no requirement that the decision map be color-preserving. \subsection{Protocols} A \emph{protocol} is a concurrent algorithm to solve a task: initially each process knows its own part of the input, but not the others'. Each process communicates with the others by reading and writing a shared memory, and eventually halts with its own output value. Collectively, the individual output values form the task's output. Here, we are concerned with protocols where processes communicate by reading and writing shared memory. Without loss of generality, we consider \emph{full-information} protocols in which each process repeatedly writes its current state to the shared memory, and constructs its new state by taking a snapshot of (instantaneously reading) the states written by other processes. After a finite number of such communication rounds, each process applies a \emph{decision map} to its state to choose an output value. All possible executions of a protocol can be modeled as a chromatic simplicial complex. We think of the protocol executions as a chromatic carrier map $\Xi$ from the input complex $\ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}}$ to $\cP$, the chromatic \emph{protocol complex.} The carrier map $\Xi$ carries each input simplex $\sigma\in\ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}}$ to a subcomplex $\Xi(\sigma)$ of the protocol complex. $\Xi$ carries each $\sigma\in\ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}}$ to the executions in which the processes in $\sigma$ do not hear from any other process. The protocol complex is related to the output complex by the decision map $\delta$, a chromatic simplicial map that sends each vertex $v$ in the protocol complex to a vertex $w$ in the output complex, colored with the same process name. The decision value labeling $w$ is the value which the corresponding process takes as its output value. A protocol with carrier map $\Xi$ solves the task if the carrier map obtained by composing $\delta$ with $\Xi$ is carried by $\Delta$. \subsection{Read-Write Memory} In the most natural shared-memory model, the processes share an ordered sequence of \emph{registers}, memory units that can hold values from an arbitrary domain. A process can \emph{read} a register, returning its current contents, or it can \emph{write} a new value to that register, obliterating that register's prior value. There are many variations of the asynchronous read-write model, all computationally equivalent in the sense that one model can simulate the others with overhead polynomial in the number of processes. Here, we will use two distinct alternatives. In the \emph{snapshot} model, each process can write atomically to a single register, but it can atomically read any set of registers, an operation called a \emph{snapshot}. It is also sometimes convenient to use a variation known as the \emph{immediate snapshot} model~\cite{BorowskyG93,SaksZ93} An \emph{immediate snapshot} takes place in two contiguous steps. In the first step, a process writes its view to a word in memory, possibly concurrently with other processes. In the very next step, it takes a snapshot of some or all of the memory, possibly concurrently with other processes. It is important to understand that that in an immediate snapshot, the snapshot step takes place \emph{immediately after} the write step. Although, modern multicores do not support either the snapshot or the immediate snapshot model directly, either model can be simulated by more conventional models, and vice-versa \cite[Ch. 14]{HerlihyKR2013}. The snapshot model is convenient for expressing specific algorithms, while the immediate snapshot model is convenient because the protocol complex generated by an $N$-round immediate snapshot execution is the subdivision $\Ch^N(\ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}})$ of the input complex \cite[Ch. 4]{HerlihyKR2013}. (Using individual reads and writes, the protocol complexes are not subdivisions, although the can be retracted to subdivisions.) \subsection{Preliminaries} If each process executes Protocol~\ref{alg:csa}, it will decide on a vertex of its color in a simplex on $\Div(\ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}})$, thus solving CSA over $\ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}}$. In this section we show that the protocol terminates, and that processes choose valid outputs. Here is some notation useful to prove correctness of the convergence algorithm. Let $p_1, \ldots, p_{n+1}$ be the processes participating in the convergence algorithm. Let $p$ be any such process. For each round $r > 1$, $p$'s state consists of the following: its \emph{participating set} $P^r_p$, its \emph{core} $c^r_p$, its \emph{convergence complex} $\cC^r_p$, its \emph{starting vertex} $v^r_p$, its \emph{simplex} $s^r_p$, and its view $w^r_p$. Here is how each component is computed during round $r$ of the convergence algorithm: \begin{enumerate} \item The \emph{participating set} $P^r_p$ is the set of processes and corresponding input vertexes that process $p$ sees when it takes a snapshot of the first round's shared memory. \item The \emph{core} $c^r_p$ is the set of vertexes that may be decision values of processes other than $p$ that have finished the protocol. It is defined to be \begin{equation*} c^r_p = \bigcap_{j \in J} w^r_{p_j}, \end{equation*} where $J$ is the index set of processes seen by $p$ in its snapshot of views from the current round $r$. When running LNCSA, the process may see smaller cores, in which case $p$ recomputes its core as \begin{equation*} \bar{c}^r_p = \bigcap_{k \in K} c^r_{p_k} \end{equation*} where $I$ is the index set of processes seen by $p$ during LNCSA. \item The \emph{convergence complex} $\cC^r_p$ is the complex on which $p$ runs the LNCSA protocol to choose a new simplex consistent with current decision values. It is computed as \begin{equation*} \cC^r_p = \Lk(\bigcap_{k \in K} c^r_{p_k}, \bigcup_{k \in K} P^r_{p_k}). \end{equation*} \item The \emph{starting vertex} $v^r_p$ is the vertex on which $p$ begins running the LNCSA protocol. Any vertex from $\cC^r_p$ with the same color as $p$ may be chosen. \item The \emph{simplex} $s^r_p$ is the simplex in $\cC^r_p$ which $p$ chooses as a result of running the LNCSA protocol. They collectively represent the domain of values from which processes may choose decision values in round $r$. \item The \emph{view} $w^r_p$ is the set of vertexes that $p$ sees in round $r$. It is computed as \begin{equation*} w^r_p = \bigcup_{i \in I} s^r_{p_i} \cup \bigcap_{i \in I} \bar{c}^r_{p_i} - \{u^r_p\} \end{equation*} where $I$ is the index set of processes seen by $p$ in its snapshot of simplexes and cores, and $u^r_p$ is the vertex with the same color as $p$, if it exists. \end{enumerate} \subsection{Link-based non-chromatic simplex agreement} Before we can define LNCSA, we need a few technical lemmas. \begin{lemma} \label{lemma:simplexes} All views and cores are simplexes. \end{lemma} \begin{proof} By induction. It is clear that views from round $1$ are simplexes, since they are all subsets of the largest simplex chosen during simplex agreement. The cores computed in round $2$ are also simplexes, since they are intersections of the views from round $1$. Inductively assume that all views from round $r$ are simplexes. Clearly all cores $c^{r+1}_p$ in round $r+1$ are simplexes as well, since they are intersections of views from round $r$. Views in round $r+1$ are computed as \begin{equation*} w^{r+1}_p = \bigcup_{i \in I} s^{r+1}_{p_i} \cup \bigcap_{i \in I} \bar{c}^{r+1}_{p_i} - \{u^{r+1}_p\} \end{equation*} Fix process $p$. We know that \begin{equation*} \bigcup_{i \in I} s^{r+1}_{p_i} = s^{r+1}_{p_\ell} \end{equation*} for some $\ell \in I$, since the simplexes are ordered by inclusion. Then $s^{r+1}_{p_\ell}$ is the largest simplex seen by $p$ in its snapshot. Furthermore, we know that $s^{r+1}_{p_\ell} \cup \bar{c}^{r+1}_{p_\ell}$ is a simplex, by definition of the link of a simplex. But \begin{equation*} \bigcap_{i \in I} \bar{c}^{r+1}_{p_i} \subseteq \bar{c}^{r+1}_{p_\ell} \end{equation*} so \begin{equation*} w^{r+1}_p = \bigcup_{i \in I} s^{r+1}_{p_i} \cup \bigcap_{i \in I} \bar{c}^{r+1}_{p_i} - \{u^{r+1}_p\} \subseteq s^r_{p_\ell} \cup \bar{c}^{r+1}_{p_\ell}. \end{equation*} By downward closure, we conclude that $w^{r+1}_p$ is a simplex. By induction, all views and cores are simplexes. \end{proof} The next lemma states that the convergence complexes of the processes are ordered by inclusion, ensuring that the NCSA tasks solved by different processes are coherent, even though they may have different convergence complexes. \begin{lemma} \label{lemma:links} The convergence complexes of participating processes for any given round are ordered by inclusion. \end{lemma} \begin{proof} Fix round $r$. If exactly one or fewer processes have not decided, then the claim is trivial. So let $p_1$ and $p_2$ be distinct processes that have not decided. Let $\cC_i$ denote the convergence complex for $p_i$. We must show $\cC_1$ and $\cC_2$ are comparable. Without loss of generality, suppose $p_1$ takes a snapshot of the view arrays for rounds $1$ and $k$ before $p_2$. Then $p_2$ sees more views than $p_1$, so it computes a larger intersection for its core, meaning that $c_2 \subseteq c_1$, where $c_i$ is the core of $p_i$ in the current round. Furthermore, if $Q_i$ is the set of processes that $p_i$ sees in round $1$, then $Q_1 \subseteq Q_2$. Since the link operator is order reversing in the first argument, and order preserving in the second, we have $\Lk(c_1, Q_1) \subseteq \Lk(c_2, Q_2)$. We conclude that $\cC_1 \subseteq \cC_2$, which proves the lemma. \end{proof} Since convergence complexes are ordered by inclusion, cores and participating sets are ordered in the same way. The next lemma allows each process to pick a vertex of its own color in its convergence complex when it starts LNCSA. \begin{lemma} \label{lemma:vertex} If process $p$ has not decided by round $r$, then there is at least one vertex of its color in $\cC^r_p$. \end{lemma} \begin{proof} It suffices to show that no vertex in $c^r_p$ has the same color as $p$. The core $c^r_p$ is computed as the intersection of views that $p$ sees in its snapshot of the view array in round $r$. This includes $w^{r-1}_p$. But $w^{r-1}_p$ cannot contain a vertex of color $p$, since any such vertex is explicitly removed in the computation of $w^{r-1}_p$. Since $w^{r-1}_p$ does not contain a vertex of color $p$, neither does $c^r_p$. since $\ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}}$ is chromatic, $\cC^r_p$ must contain at least one vertex of color $p$. \end{proof} The next lemma states that a decision value reached in a given round is contained in all cores and views of subsequent rounds. \begin{lemma} \label{lemma:stable} If a process decides on a vertex, then that vertex is contained in the views and cores of all processes in all subsequent rounds. \end{lemma} \begin{proof} Suppose process $p$ decides on vertex $u$ in round $r_p$. We proceed by induction. As the base case, we show that every view computed in round $r_p$ contains $u$. Let $p'$ be any other process that does not decide this round. There are two cases: when $p'$ computes its new view, either $p'$ sees the simplex that $p$ wrote, or $p'$ does not. In the first case, $p'$ sees what $p$ wrote, which is a simplex $\sigma$ that must contain $u$, otherwise $p$ could not decide this round, since $p$ must have seen $u$ in its own simplex. So $p'$ includes $\sigma$ in the computation of its view, so the view of $p'$ contains $u$. Now consider the second case, where $p'$ does not see the simplex that $p$ wrote. But for $p$ to decide on $u$, $u$ must have been contained in all previously written simplexes, including the simplex of $p'$. Since this simplex contains $u$, the view of $p'$ will also contain $u$. In either case, the view of $p'$ contains $u$. Now, inductively assume that all views from round $r \ge r_p$ contain vertex $u$. We want to show that all views from round $r+1$ also contain $u$. First, consider the cores computed in round $r+1$. As intersections of views from round $r$, all cores computed in round $r+1$ also contain $u$. Furthermore, each process $p'$ computes its view in round $r+1$ as \begin{equation*} w^{r+1}_{p'} = \bigcup_{i \in I} s^{r+1}_{p_i} \cup \bigcap_{i \in I} \bar{c}^{r+1}_{p_i} - \{u^r_{p'}\}. \end{equation*} Since each core contains $u$, we have \begin{equation*} u \in \bigcap_{i \in I} \bar{c}^{r+1}_{p_i} \subseteq w^{r+1}_{p'} \end{equation*} so the view of $p'$ computed in round $r+1$ also contains $u$. Therefore all views in round $r+1$ also contain $u$. By induction, all views in all rounds after $r_p$ contain $u$. Since cores are computed as intersections of views, all cores in rounds $r > r_p$ also contain $u$. \end{proof} We formally define LNCSA and give a protocol similar to that of NCSA. \begin{lemma} \label{lemma:LNCSA} Fix round $r$, and suppose processes have computed their cores. Then there is a wait-free immediate-snapshot protocol for converging to a simplex on $\Lk(\bigcap_{k \in K} c^r_{p_k}, \bigcup_{k \in K} P^r_{p_k})$. \end{lemma} \begin{proof} Let $(\ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}}, \Div(\ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}}), \Div)$ be the chromatic simplex agreement task we want to solve via the convergence algorithm. Fix round $r$, and suppose the processes have just computed their links. They will next collectively converge to a simplex that is consistent with the smallest core among them. That is, they will converge on the largest link among the processes. This is the LNCSA task. We formally define the task. Each process's state is defined by its core $c$, its participating set $p$, and the starting vertex $v$ it chooses in its link (which by Lemma~\ref{lemma:vertex} it can do), so the input complex $\ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}}$ of LNCSA has vertex set consisting of triples $(v, c, P)$ such that $v \in P$ and $\Car(c, \ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}}) \subseteq P$. A set of triples $\{(v_i, c_i, P_i)\}$ is a simplex in $\ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}}$ if the $v_i$ all have distinct colors and $\{c_i\}$ and $\{P_i\}$ are ordered by inclusion. We require the $v_i$ to have different colors since each process chooses a vertex of its own color, and we require $\{c_i\}$ and $\{P_i\}$ to be ordered in the same way by inclusion, since they were computed using snapshots. So $\ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}}$ is a subcomplex of \begin{equation*} \Delta(V) \times \Bary(\Div(\ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}})) \times \Bary(\ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}}), \end{equation*} where $V$ is the vertex set of $\ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}}$. The output complex of LNCSA is $\cB = \Bary(\Div(\ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}}))$, since each process chooses a simplex on $\Div(\ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}})$. Processes that execute in isolation stay where they are. Otherwise, processes converge to a simplex in the largest link they see, so if $\sigma = \{(v_i, c_i, P_i)\}$ is a simplex in $\ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}}$, then we have $\Gamma(\sigma) = \{v\}$ if $\sigma = \{(v, c, P)\}$, and $\Gamma(\sigma) = \Lk(\bigcap c_i, \bigcup P_i)$. By Lemma \ref{lemma:links}, $\Gamma$ is monotonic, so it is a carrier map. Thus LNCSA is the task $(\ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}}, \cB, \Gamma)$. We show that this task is solvable by constructing a continuous \begin{equation*} f : |\ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}}| \rightarrow |\cB| \end{equation*} carried by $\Gamma$. We induct on skeletons to construct an such an $f$ by defining carrier-preserving \begin{equation*} f^m : |\skel^m(\ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}})| \rightarrow |\cB| \end{equation*} for each $m$. As base case, we define $f^0$ as $f^0((v, c, P)) = v$ for each vertex $(v, c, P)$ of $\ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}}$. The function $f^0$ is clearly continuous and carried by $\Gamma$. Now inductively assume we have defined $f^m$. We want to define \begin{equation*} f^{m+1} : |\skel^{m+1}(\ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}})| \rightarrow |\cB|. \end{equation*} Let $\{\sigma_i\}$ be the facets of $\skel^{m+1}(\ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}})$, and for each $i$, let $\sigma_i = \{(v_{ij}, c_{ij}, P_{ij})\}_{j \le m+2}$. Let \begin{equation*} \overline{c}_i = \bigcap_j c_{ij} \text{\quad and \quad} \overline{P}_i = \bigcup_j P_{ij}. \end{equation*} By the inductive hypothesis, $f^m$ is carried by $\Gamma$, which implies that the image of $f^m$ is contained in \begin{equation*} \cL_i = \Lk(\overline{c}_i, \overline{P}_i). \end{equation*} We also know that $\dim(\cL_i) \ge \dim(\sigma_i) = m$, since each $v_{ij} \in \cL_i$, each $v_{ij}$ has different color, and $\cL_i$ is chromatic. Suppose $\dim(\overline{P}_i) = n$. We know that $\cL_i$ a link in the subdivided simplex $\Bary(\Div(\overline{P}_i))$, which is link-connected, so since $\dim(\cL_i) \ge m$, we conclude that $\cL_i$ is at least $n - 2 - (n - m - 1)$ = $(m - 1)$-connected. Using this, along with the fact that $\im(f^m) \subseteq \cL_i$, we can extend $f^m|_{\partial \sigma_i}$ to a function $f^{m+1}_i : |\sigma_i| \rightarrow |\cL_i|$. Next, using the pasting lemma, we can glue the $f^{m+1}_i$ together to obtain a map \begin{equation*} f^{m+1} : |\skel^{m+1}(\ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}})| \rightarrow \cB \end{equation*} extending $f^m$. By construction, $f^{m+1}$ is carried by $\Gamma$. By induction, we have obtained a continuous function $f : |\ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}}| \rightarrow |\cB|$. By the simplicial approximation theorem, the task $(\ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}}, \cB, \Gamma)$ is wait-free solvable using immediate snapshots. \end{proof} \subsection{Termination and Validity} Next, we show that all processes eventually decide. \begin{theorem} \label{theorem:liveness} All processes participating in the convergence algorithm eventually decide. \end{theorem} \begin{proof} We show that at least one process decides each round. Fix a round, and let $\{p_0, \ldots, p_\ell\}$ be the set of participating processes. The processes each run LNCSA protocols over barycentric subdivisions of the convergence complexes, and by Lemma \ref{lemma:LNCSA}, they converge to a simplex $\tau$ on the largest subcomplex, say $\Bary(\cC)$. By definition of $\Bary$, the simplex $\tau \in \Bary(\ensuremath{{\cal A}}} \def\cB{\ensuremath{{\cal B}}} \def\cC{\ensuremath{{\cal C}}} \def\cD{\ensuremath{{\cal D}}_{i_k})$ corresponds to a chain of simplexes $\sigma_{i_0} \subseteq \cdots \subseteq \sigma_{i_\ell}$. Their intersection is $\sigma_{i_0}$, which is clearly nonempty, so choose a vertex $\hat{v} \in \sigma_{i_0}$. The color of $\hat{v}$, denoted as $\chi(\hat{v})$, cannot be the color of any nonparticipating process, because all subcomplexes $\Bary(\cC)$ are all subcomplexes of the processes' carrier, which contains only vertexes whose colors are those of the participating processes, since $\ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}}$ is chromatic. Neither can $\chi(\hat{v})$ be the color of a process that decided in a previous round. Supposing not, this means the largest convergence complex contains vertexes of color $\chi(\hat{v})$, meaning that the corresponding core could not contain a vertex of color $\chi(\hat{v})$, since the link contains vertexes of color exactly those not in the corresponding core. This contradicts Lemma \ref{lemma:stable}, since decided vertexes must be contained in all cores. Let $\hat{p} \in P$ be the process whose color is $\chi(\hat{v})$, and let $K \subseteq \{0, \ldots, \ell\}$ be the index set of processes that $\hat{p}$ saw during its snapshot of the simplex array. Then \begin{equation*} \bigcap_{k \le \ell} \sigma_{i_k} \subseteq \bigcap_{k \in K} \sigma_{i_k}, \end{equation*} so $\hat{v} \in \bigcap_{k \in K} \sigma_{i_k}$. Since $\hat{p}$ sees $\hat{v}$ in all simplexes in its snapshot, $\hat{p}$ decides on $\hat{v}$. It follows that at least one process decides in each round, so all processes decide in at most $n+1$ rounds. \end{proof} \begin{theorem} \label{theorem:safety} Participating processes converge to a simplex in their carrier. \end{theorem} \begin{proof} We show that for each round $r$, the set of vertexes that processes have decided form a simplex. We argue by induction, starting at round $1$. In round $1$, it is clear that decision values form a simplex, since processes decide on vertexes from the largest simplex chosen by running LNCSA. All decision values in round $1$ must be contained in this largest simplex, hence they must form a simplex. Fix round $r$, and inductively assume that the vertexes which processes decided during the rounds up to $r$ form a simplex, which we call $\tau_r$. Consider round $r+1$. Processes in this round choose vertexes on a simplex of the barycentric subdivision of the largest convergence complex, $\Bary(\cC)$, which is determined by the smallest core. So vertexes on which processes decide this round are contained in an ascending chain of simplexes in $\cC$. Call the largest such simplex $\Sigma_{r+1}$. Let $c_{r+1}$ be the smallest core, corresponding to the largest convergence complex. Then by definition of the link, $c_{r+1} \cup \Sigma_{r+1}$ is a simplex in $\cC$, since the largest link is determined by simplex $c_r$. From Lemma \ref{lemma:stable}, we must have $\tau_r \subseteq c_{r+1}$, so $\tau_r \cup \Sigma_{r+1}$ is also a simplex in $\cC$, by downward closure of simplicial complexes. Let $\sigma_{r+1} \subseteq \Sigma_{r+1}$ be the set of all vertexes that processes on decide during round $r+1$. Again by downward closure, \begin{equation*} \tau_r \cup \sigma_{r+1} \subseteq \tau_r \cup \Sigma_{r+1} , \end{equation*} so $\tau_r \cup \sigma_{r+1}$ is a simplex. But by definition of $\tau_r$, $\tau_{r+1} = \tau_r \cup \sigma_{r+1}$, where $\tau_{r+1}$ is exactly the set of vertexes on which processes have decided up to round $r+1$. So $\tau_{r+1}$ is also a simplex. By induction, it follows that the processes' decision values form a simplex. Processes can choose decision only values in their carrier, since all links are computed relative to the observed participating set, and all decision values are chosen from these links. This completes the proof of the theorem, and the proof of correctness of the convergence algorithm. \end{proof} \section{Application to more general tasks} Recall that CSA over a chromatic subdivision $\Div(\mathcal{K})$ is defined as the task $(\mathcal{K}, \Div(\mathcal{K}), \Div)$. The proof of the convergence algorithm shows that this task has a wait-free read-write protocol. To make the convergence algorithm work, we required that $\Div(\mathcal{K})$ be link-connected so that processes can iteratively converge over ever smaller subcomplexes. Phrased in a different way, the convergence algorithm allows us to find a chromatic simplicial map \begin{equation*} \phi : \Ch^N(\ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}}) \rightarrow \Div \ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}} \end{equation*} carried by $\Div$, Given the continuous (identity) map $\mathrm{id} : |\ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}}| \rightarrow |\Div(\ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}})|$ also carried by $\Div$. In fact, link-connectivity is the essential property of the output complex. In particular, the the convergence algorithm may be applied to more general continuous functions $f : |\ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}}| \rightarrow |\cO|$ carried by some $\Gamma$. Given the assumption that $\Gamma(\sigma)$ is link-connected for all $\sigma \in \ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}}$, we can use the convergence algorithm to obtain a chromatic simplicial map $\phi: \Ch^N(\ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}}) \rightarrow \cO$ also carried by $\Gamma$. We state this observation as a theorem. \begin{theorem} Let $f : |\ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}}| \rightarrow |\cO|$ be a continuous map between chromatic complexes and let $\Gamma : \ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}} \rightarrow \cO$ be a carrier map such that $\Gamma(\sigma)$ is link-connected for each $\sigma \in \ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}}$. Suppose $f$ is carried by $\Gamma$. Then there exists a chromatic, carrier-preserving simplicial map $\phi: \Ch^N(\ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}}) \rightarrow \cO$. \end{theorem} \subsection{Non-Chromatic Simplex Agreement} \subsection{Chromatic Simplex Agreement} Borowsky and Gafni first consider a more simple task, called non-chromatic simplex agreement (NCSA), in which processes start on the same input complex $\mathcal{I}$ and must converge to any simplex of $\Div(\mathcal{I})$. Processes do not have to land on vertexes of any specified color, though they must remain where they are if they run solo. NCSA can be solved provided that $\mathcal{I}$ is sufficiently connected. Borowsky and Gafni present a sketch of an inductively constructed protocol, which can be made rigorous via combinatorial topology. While we do not give an explicit protocol here, in the next section we give an explicit protocol for a similar task called \emph{link-based NCSA}, or LNCSA, which is directly used in the construction of the convergence algorithm. Algorithm~\ref{alg:csa} shows the Chromatic Simplex Agreement (CSA) protocol, which is round-based. Recall that participating processes begin on a simplex of $\ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}}$. In the first round, the processes to run a simplex agreement protocol on $\Bary(\Div \ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}})$, so that they collectively choose a nested sequence of simplexes in $\Div \ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}}$. Each process writes its simplex to shared memory and takes an immediate snapshot of the simplexes written by the others. If a process sees a vertex of its color in all simplexes in its snapshot, then the process returns that vertex and finishes. Otherwise, it computes its \emph{view}\footnote{ Borowsky and Gafni called the view the ``core''.} as the union of all simplexes it saw, minus the vertex of its own color, if it exists. The process proceeds to the next round. \vspace{10pt} \begin{algorithm}[H] \begin{mdframed} \caption{The convergence algorithm} \SetAlgoLined \SetKw{shared}{shared} \SetKwArray{participating}{participating} \SetKwArray{views}{views} \SetKwArray{simplexes}{simplexes} \SetKwProg{protocol}{protocol}{:}{end} \SetKwFunction{snapshot}{snapshot} \SetKwFunction{sagree}{simplexAgree} \SetKwFunction{lncsa}{linkNonchromaticSimplexAgree} \SetKwBlock{immediate}{immediate}{} \SetKwFor{uWhile}{while}{do}{} \shared{\participating{n+1}}\; \shared{\views{n+1}}\; \shared{\simplexes{n+1, n+1}}\; \protocol{chromaticSimplexAgree(p, v, $\ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}}$, $\Div$)}{ \participating{p} := $p$\; $s$ := \sagree{v, $\ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}}$, $\Div$}\; \immediate{ \simplexes{1, p} := ($s$, $\varnothing$)\; $snap$ := \snapshot{\simplexes{1}}\; \uIf{$\exists u : u \in \bigcap_{t \in snap} t$ \text{and} $\chi(u) = p$}{ \Return{u}\; } \uElse{ $toss$ := $\{u : u \in \bigcup_{t \in snap} \text{ and } \chi(u) = p\}$\; $w$ := $\bigcup_{t \in snap} t - toss$\; } } $r$ := 2\; \uWhile{True}{ \immediate{ \views{r, p} := $w$\; $snap$ := \snapshot{\views{r}}\; $P$ := \snapshot{\participating}\; } $c$ := $\bigcap_{x \in snap} x$\; $s, \overline{c}$ := \lncsa{$v$, $c$, $P$, $\ensuremath{{\cal I}}} \def\cJ{\ensuremath{{\cal J}}} \def\cK{\ensuremath{{\cal K}}} \def\cL{\ensuremath{{\cal L}}$, $\Div$}\; \immediate{ \simplexes{r, p} := ($s$, $\overline{c}$)\; $snap$ := \snapshot{\simplexes{r}}\; } \uIf{$\exists u : u \in \bigcap_{t \in snap} t \text{ and } \chi(u) = p$}{ \Return{u}\; } \uElse{ $toss$ := $\{u : u \in \bigcup_{t \in snap} \text{ and } \chi(u) = p\}$\; $w$ := $\bigcup_{t \in snap[0]} t \cup \bigcap_{d \in snap[1]} d - toss$\; $r$ := $r + 1$\; } } } \end{mdframed} \label{alg:csa} \end{algorithm} \vspace{10pt} A process entering round $r>1$ has already computed a view. Each process begins round $r$ by writing its view to shared memory and taking immediate snapshots of the shared memory from this round as well as the first round. By retaking a snapshot of the first round, a process updates the \emph{participating set} of processes it observes running the protocol. By taking a snapshot of the views from the current round, the process computes its \emph{core}\footnote{ Borowsky and Gafni called this the ``intersection of cores''.}, defined to be the intersection of the views from the current round's snapshot. Using these two snapshots, the process computes its \emph{convergence complex}, a simplicial neighborhood of the core (defined in the next section). Note that processes typically construct different convergence complexes, though all such complexes will be ordered by inclusion. Each process then chooses a \emph{starting vertex} of its own color in its convergence complex, and runs the LNCSA protocol on the barycentric subdivision of its convergence complex. Processes collectively obtain a nested sequence simplexes, similar to the first round. Each process then replaces its core with the smallest core observed when running LNCSA. Each process writes its simplex and its new core to shared memory and takes a snapshot. If a process sees a vertex of its color in each simplex it saw, it decides on that vertex and finishes. Otherwise, it updates its view and proceeds to the next round. See Algorithm \ref{alg:csa} for pseudocode. In the next section, we give more detailed explanations about how each piece of data is computed.
{'timestamp': '2017-03-27T02:09:45', 'yymm': '1703', 'arxiv_id': '1703.08525', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08525'}
arxiv
\section{Introduction} \label{sec:intro} The addition of processing, measurement, communication and control capability to the electric power grid is leading to smart grids, in which smart generators, accumulators and loads can cooperate to execute Demand Side Management (DSM) programs \cite{alizadeh2012demand}. The goal is to reduce the hourly and daily variations and peaks of electric demand by optimizing generation, storage and consumption. A widely adopted objective in DSM programs is Peak-to-Average Ratio (PAR), defined as the ratio between peak-daily and average-daily power demands. PAR minimization gives raise to a min-max optimization problem if the average daily electric load is assumed not to be affected by the demand response strategy. In \cite{mohsenian2010autonomous} the authors propose a game-theoretic model for PAR minimization and provide a distributed energy-cost-based strategy for the users. A noncooperative-game approach is also proposed in \cite{atzeni2013demand}, where optimal strategies are characterized and a distributed scheme is designed based on a proximal decomposition algorithm. A key difference of the set-up in~\cite{mohsenian2010autonomous,atzeni2013demand}, compared to the one proposed in our paper, is that in those works each agent needs to know the total load and tariffs in the power distribution system. Moreover, the agents do not cooperate to compute the strategy. In~\cite{parisio2014model} a Model Predictive Control scheme is proposed to optimize micro-grid operations while satisfying a time-varying request and operation constraints using a mixed-integer linear model. In this paper we propose a novel distributed optimization framework for min-max optimization problems commonly found in DSM problems. Differently from the references above, we consider a cooperative, distributed computation model in which the agents in the network do not have knowledge of aggregate quantities, communicate only with neighboring agents and perform local computations (with no central coordinator) to solve the optimization problem. Duality is a widely used tool for distributed optimization algorithms as shown, e.g., in the tutorials~\cite{palomar2006tutorial,yang2010distributed}. These standard approaches do not apply to the framework considered in this paper. In~\cite{chang2014distributed} a distributed consensus-based primal-dual algorithm is proposed to solve optimization problems with coupled global cost function and inequality constraints. Min-max optimization is strictly related to saddle-point problems. In~\cite{nedic2009subgradient} the authors propose a subgradient method to generate approximate saddle-points. A min-max problem is also considered in~\cite{srivastava2011distributed} and a distributed algorithm based on a suitable penalty approach has been proposed. Another class of algorithms exploits the exchange of active constraints among the network nodes to solve constrained optimization problems which include min-max problems, \cite{notarstefano2011distributed,burger2014polyhedral}. Although they work under asynchronous, directed communication they do not scale in set-ups as the one in this paper in which the terms of the max function are coupled. Very recently, in~\cite{mateos2015distributed} the authors proposed a distributed projected subgradient method to solve constrained saddle-point problems with agreement constraints. Although our problem set-up fits in those considered in~\cite{mateos2015distributed}, our algorithmic approach and the analysis are different. In~\cite{simonetto2012regularized,koppel2015regret} saddle point dynamics are used to design distributed algorithms for standard separable optimization problems. The contribution of this paper is twofold. First, we propose a novel distributed optimization framework which is strongly motivated by peak power-demand minimization in DSM. The optimization problem has a min-max structure with local constraints at each node. Each term in the max function represents a daily cost (so that the maximum over a given horizon needs to be minimized), while the local constraints are due to the local dynamics and input bounds of the subsystems in the smart grid. The problem is challenging when approached in a distributed way since it is \emph{doubly coupled} (each term of the max function is coupled among the agents, while the local constraints impose a coupling between different ``days'' in the time-horizon). Second, as main paper contribution, we propose a distributed algorithm to solve this class of min-max optimization problems. The algorithm has a very simple and clean structure in which a primal minimization and a dual ascent step are performed. The primal problem has a similar structure to the centralized one. Despite this simple structure, which resembles standard distributed dual methods, the algorithm is not a standard decomposition scheme and the derivation of the algorithm is non-obvious. Specifically, the algorithm is derived by heavily resorting to duality theory and properties of min-max optimization (or saddle-point) problems. In particular, a sequence of equivalent problems is derived in order to decompose the originally coupled problem into locally-coupled subproblems, and thus being able to design a distributed algorithm. An interesting feature of the algorithm is its expression in terms of dual variables of two different problems and of the original primal variables. Since we apply duality more than once and on different problems, this property, although apparently intuitive, was not obvious a priori. Another appealing feature of the algorithm is that every limit point of the primal sequence at each node is a (feasible) optimal solution of the original optimization problem (although this is only convex and not strictly convex). This property is obtained by the minimizing sequence of the local primal subproblems without resorting to averaging schemes, \cite{nedic2009approximate}. Finally, since each node only computes the decision variable of interest, our algorithm can solve both large-scale (many agents are present) and big-data (a large horizon is considered) problems. The paper is structured as follows. In Section~\ref{sec:preliminaries} we provide some useful preliminaries on optimization, duality theory and subgradient methods. In Section~\ref{sec:distributed_algorithm} we formalize our distributed min-max optimization set-up and present the main contribution of the paper, a novel, duality based distributed optimization method. In Section~\ref{sec:analysis} we characterize its convergence properties. Finally, in Section \ref{sec:simulations} we corroborate the theoretical results with a numerical example involving peak power minimization in a smart-grid scenario. Due to space constrains all proofs are omitted in this paper and will be provided in a forthcoming document. \section{Preliminaries} \label{sec:preliminaries} \subsection{Optimization and Duality} Consider a constrained optimization problem, addressed as primal problem, having the form \begin{align} \begin{split} \min_{ z \in Z } \:& \: f(z) \\ \text{subj. to} \: & \: g(z) \preceq 0 \end{split} \label{eq:preliminaries_primal} \end{align} where $Z \subseteq {\mathbb{R}}^N$ is a convex and compact set, $\map{f}{{\mathbb{R}}^N}{{\mathbb{R}}}$ is a convex function and each component $\map{g_s}{{\mathbb{R}}^N}{{\mathbb{R}}}$, $s \in \until{S}$, of $g$ is a convex function. The following optimization problem \begin{align} \begin{split} \max_\mu \:& \: q(\mu) \\ \text{subj. to} \: & \: \mu \succeq 0 \end{split} \label{eq:preliminaries_dual} \end{align} is called the dual of problem~\eqref{eq:preliminaries_primal}, where $\map{q}{{\mathbb{R}}^S}{{\mathbb{R}}}$ is obtained by minimizing with respect to $z \in Z$ the Lagrangian function $\mathcal{L} (z,\mu) := f(z) + \mu^\top g(z)$, i.e., $q(\mu) = \min_{z \in Z} \mathcal{L}(z,\mu)$. Problem~\eqref{eq:preliminaries_dual} is well posed since the domain of $q$ is convex and $q$ is concave on its domain. It can be shown that the following inequality holds \begin{align} \inf_{z \in Z } \sup_{\mu \succeq 0} \mathcal{L}(z, \mu) \ge \sup_{\mu\succeq 0} \inf_{z \in X } \mathcal{L}(z,\mu), \label{eq:preliminaries_weak_duality} \end{align} which is called weak duality. When in~\eqref{eq:preliminaries_weak_duality} the equality holds, then we say that strong duality holds and, thus, solving the primal problem~\eqref{eq:preliminaries_primal} is equivalent to solving its dual formulation~\eqref{eq:preliminaries_dual}. In this case the right-hand-side problem in~\eqref{eq:preliminaries_weak_duality} is referred to as \emph{saddle-point problem} of \eqref{eq:preliminaries_primal}. \begin{definition} A pair $(z^\star , \mu^\star)$ is called an primal-dual optimal solution of problem~\eqref{eq:preliminaries_primal} if $z^\star\in Z$ and $\mu^\star\succeq 0$, and $(z^\star , \mu^\star)$ is a saddle point of the Lagrangian, i.e., \begin{align*} \mathcal{L} (z^\star,\mu ) \le \mathcal{L} (z^\star,\mu^\star) \le \mathcal{L} (z,\mu^\star) \end{align*} for all $z\in Z$ and $\mu\succeq 0$. \oprocend \label{def:primal_dual_pair} \end{definition} A more general min-max property can be stated. Let $Z \subseteq {\mathbb{R}}^N$ and $W \subseteq {\mathbb{R}}^S$ be nonempty convex sets. Let $\phi : Z \times W \to {\mathbb{R}}$, then the following inequality \begin{align*} \inf_{z\in Z} \sup_{w \in W} \phi (z,w) \ge \sup_{w \in W} \inf_{z\in Z} \phi (z,w) \end{align*} holds true and is called the \emph{max-min} inequality. When the equality holds, then we say that $\phi$, $Z$ and $W$ satisfy the \emph{strong max-min} property or the \emph{saddle-point} property. The following theorem gives a sufficient condition for the strong max-min property to hold. \begin{proposition}[{\cite[Propositions~4.3]{bertsekas2009min}}] Let $\phi$ be such that (i) $\phi (\cdot,w) : Z \to {\mathbb{R}}$ is convex and closed for each $w \in W$, and (ii) $-\phi(z,\cdot) : W \to {\mathbb{R}}$ is convex and closed for each $z \in Z$. % Assume further that $W$ and $Z$ are convex and compact sets. Then \begin{align*} \sup_{w \in W} \inf_{z \in Z} \phi (z,w) = \inf_{z \in Z} \sup_{w \in W} \phi (z,w) \end{align*} and the set of saddle points is nonempty and compact.~\oprocend \label{prop:saddle_point} \end{proposition} \subsection{Subgradient Method} \label{sec:subgradient_method} Consider the following (constrained) optimization problem \begin{align} \min_{z\in Z} f (z) \label{eq:preliminaries_convex_problem} \end{align} with $Z \subseteq {\mathbb{R}}^N$ a closed convex set and $\map{f}{{\mathbb{R}}^N}{{\mathbb{R}}}$ convex. The (projected) subgradient method is the iterative algorithm \begin{align} z(t+1) = P_{Z} \Big( z(t) - \gamma(t) \widetilde{\nabla} f( z(t) ) \Big) \label{eq:preliminaries_subgradient_iter} \end{align} where $t\in \mathbb{N}$ denotes the iteration index, $\gamma(t)$ is the step-size, $\widetilde{\nabla} f( z(t) )$ denotes a subgradient of $f$ at $z(t)$, and $P_Z(\cdot)$ is the Euclidean projection onto $Z$. \smallskip \begin{assumption} \label{ass:step-size} The step-size $\gamma(t) \ge 0$ satisfies the following diminishing condition \begin{align}\notag \lim_{t\to \infty} \gamma(t) = 0, \: \sum_{t=1}^{\infty} \gamma(t) = \infty, \: \sum_{t=1}^{\infty} \gamma(t)^2 < \infty. \tag*{$\square$} \end{align} \end{assumption} \smallskip \begin{proposition}[{\cite[Proposition 3.2.6]{bertsekas2015convex}}] Assume that the subgradients $\widetilde{\nabla} f(z)$ are bounded for all $z \in Z$ and the set of optimal solutions is nonempty. Let the step-size $\gamma(t)\ge 0$ satisfy the diminishing condition in Assumption~\ref{ass:step-size}. Then the subgradient method in~\eqref{eq:preliminaries_subgradient_iter} applied to problem~\eqref{eq:preliminaries_convex_problem} converges in objective value and sequence $z(t)$ converges to an optimal solution.~\oprocend \label{prop:subgradient_convergence} \end{proposition} \section{Problem Set-up and Distributed\\Optimization Algorithm} \label{sec:distributed_algorithm} In this section we set-up the distributed min-max optimization problem and propose a distributed algorithm to solve it. \subsection{Distributed min-max optimization set-up} \label{sec:setup} We consider a network of $N$ processors which communicate according to a \emph{connected, undirected} graph $\mathcal{G} = (\until{N}, \mathcal{E})$, where $\mathcal{E}\subseteq \until{N} \times \until{N}$ is the set of edges. That is, the edge $(i,j)$ models the fact that node $i$ and $j$ exchange information. We denote by $\mathcal{N}_i$ the set of \emph{neighbors} of node $i$ in the fixed graph $\mathcal{G}$, i.e., $\mathcal{N}_i := \left\{j \in \until{N} \mid (i,j) \in \mathcal{E} \right\}$. Motivated by applications in Demand Side Management of Smart Grids, we introduce a min-max optimization problem to be solved by the network processors in a distributed way. Specifically, we associate to each processor $i$ a decision vector $\sx{i} = [ \sx{i}_1, \ldots, \sx{i}_S ]^\top \in {\mathbb{R}}^S$, a constraint set $X_i\subseteq {\mathbb{R}}^S$ and local cost functions $g_{is}$, $s\in\until{S}$, and set-up the following optimization problem \begin{align} \begin{split} \min_{\sx{1}, \ldots, \sx{N}} \: & \: \max_{s \in \until{S}} \sum_{i=1}^N g_{i s}(\sx{i}_s) \\ \text{subj. to} \: & \: \sx{i} \in X_i , \quad i\in\until{N} \end{split} \label{eq:minimax_starting_problem} \end{align} where for each $i\in\until{N}$ the set $X_i\subseteq{\mathbb{R}}^S$ is nonempty, convex and compact, and the functions $g_{i s} : {\mathbb{R}} \to {\mathbb{R}} $, $s\in\until{S}$, are convex. Note that we use the superscript $i\in\until{N}$ to indicate that a vector $\sx{i}\in{\mathbb{R}}^S$ belongs to node $i$, while we use the subscript to identify a vector component, i.e., $\sx{i}_s$, $s\in\until{S}$, is the $s$-th component of $\sx{i}$. Using a standard approach for min-max problems, we introduce an auxiliary variable $P$ to write the so called epigraph representation of problem~\eqref{eq:minimax_starting_problem}, given by \begin{align} \begin{split} \min_{\sx{1}, \ldots, \sx{N}, P} \: & \: P \\ \text{subj. to} \: & \: \sx{i} \in X_i , \hspace{1.5cm} i\in\until{N} \\ & \: \sum_{i=1}^N g_{i s}(\sx{i}_s) \le P, \hspace{0.3cm} s \in \until{S}. \end{split} \label{eq:starting_problem} \end{align} Notice that, this problem is convex, but not strictly convex. This means that it is not guaranteed to have a unique solution. This impacts on dual approaches when trying to recover a primal optimal solution, see e.g., \cite{nedic2009approximate} and references therein. \subsection{Algorithm description} \label{sec:alg_description} Next, we introduce our distributed optimization algorithm. Informally, the algorithm consists of a two-step procedure. First, each node $i\in\until{N}$ stores a set of variables $((\sx{i}$, $\srho{i}), \smu{i})$ obtained as the primal-dual optimal solution pair of a local min-max optimization problem with a structure similar to the centralized problem. The coupling with the other nodes in the original formulation is replaced by a term depending on neighboring variables $\slambda{ij}$, $j\in\mathcal{N}_i$. These variables are updated in the second step according to a suitable linear law weighting the difference of neighboring $\smu{i}$. Nodes use a diminishing step-size denoted by $\gamma(t)$ and can initialize the variables $\slambda{ij}$, $j\in\mathcal{N}_i$ to zero. In the next table we formally state our \Dminmax/ distributed algorithm from the perspective of node $i$. \begin{algorithm} \renewcommand{\thealgorithm}{} \floatname{algorithm}{Distributed Algorithm} \begin{algorithmic}[0] \Statex \textbf{Processor states}: $(\sx{i}, \srho{i})$, $\smu{i}$ and $\slambda{ij}$ for $j\in\mathcal{N}_i$ \Statex \textbf{Evolution}: \StatexIndent[0.5] \textbf{Gather} $ \slambda{ji}(t)$ from $j\in\mathcal{N}_i$ \StatexIndent[0.5] \textbf{Compute} $\big((\sx{i}(t+1),\srho{i}(t+1)),\smu{i}(t+1)\big)$ as a primal-dual optimal solution pair of \begin{align} \begin{split} \min_{\sx{i}, \srho{i}} \: & \: \srho{i} \\ \text{subj. to} \: & \: \sx{i} \in X_i \\ & \: g_{i s}(\sx{i}_s ) + \sum_{j\in\mathcal{N}_i} \big( \slambda{ij}(t) - \slambda{ji}(t) \big)_{s} \le \srho{i}, \\ & \hspace{4.0cm}s\in\until{S} \end{split} \label{eq:alg_minimization} \end{align} \StatexIndent[0.5] \textbf{Gather} $ \smu{j}(t+1)$ from $j\in\mathcal{N}_i$ \StatexIndent[0.5] \textbf{Update} for all $j\in\mathcal{N}_i$ \begin{align} \slambda{ij} (t \!+\! 1) = \slambda{ij}(t) - \gamma(t) ( \smu{i}(t \!+\! 1) \!-\! \smu{j}(t \!+\! 1)) \label{eq:alg_update} \end{align} \end{algorithmic} \caption{\Dminmax/} \label{alg:distributed_DSM} \end{algorithm} The structure of the algorithm and the meaning of the updates will be clear in the constructive analysis carried out in the next section. At this point we want to point out that although problem~\eqref{eq:alg_minimization} has the same min-max structure of problem~\eqref{eq:starting_problem}, $\rho^i$ is not a copy of the centralized cost $P$, but rather a local contribution to that cost. That is, as we will see, the total cost $P$ will be the sum of the $\rho^i$s. \section{Algorithm Analysis} \label{sec:analysis} The analysis of the proposed \Dminmax/ distributed algorithm is constructive and heavily relies on duality theory tools. We start by deriving the equivalent dual problem of~\eqref{eq:starting_problem} which is formally stated in the next lemma. \begin{lemma} The optimization problem \begin{align} \label{eq:dual_centr} \begin{split} \max_{ \smu{} \in{\mathbb{R}}^S } \: & \: \sum_{i=1}^N q_i( \smu{} ) \\ \text{subj. to} \: & \: \mathbf{1}^\top \smu{} = 1, \: \smu{} \succeq 0 \end{split} \end{align} % where $\mathbf{1} := [1, \ldots, 1]^\top \in {\mathbb{R}}^S$ and % \begin{align} q_i( \smu{} ) & := \min_{\sx{i} \in X_i} \sum_{s=1}^S \smu{}_s g_{i s}(\sx{i}_s), \hspace{0.5cm} i\in\until{N}, \label{eq:qi_definition} \end{align} is the dual of problem~\eqref{eq:starting_problem} and strong duality holds.\oprocend \label{lem:equivalence_dual_and_initial} \end{lemma} In order to make problem~\eqref{eq:dual_centr} amenable for a distributed solution, we can rewrite it in an equivalent form. To this end, we introduce copies of the common optimization variable $\smu{}$ and coherence constraints having the sparsity of the connected graph $\mathcal{G}$, obtaining \begin{align} \begin{split} \max_{ \smu{1}, \ldots, \smu{N} } \: & \: \sum_{i=1}^N q_i( \smu{i} ) \\ \text{subj. to} \: & \: \mathbf{1}^\top \smu{i} = 1, \: \smu{i} \succeq 0, \: i\in\until{N} \\ & \: \smu{i} = \smu{j}, \: \text{for all } (i,j) \in \mathcal{E}. \end{split} \label{eq:problem_with_copies} \end{align} Notice that we have also duplicated the simplex constraint so that it becomes a local constraint for each node. To solve this problem we can use a dual decomposition approach by designing a dual subgradient algorithm. This can be done since the constraints are convex and the cost function concave. A dual subgradient algorithm applied to problem~\eqref{eq:problem_with_copies} would immediately result into a distributed algorithm if functions $q_i$ were available in a closed form. Intuition suggests that deriving the dual of a dual problem would somehow bring back to a primal formulation. However, we want to stress that: \begin{enumerate} \item problem \eqref{eq:problem_with_copies} is dualized rather than problem \eqref{eq:dual_centr}, \item different constraints are dualized, namely the coherence constraints rather than the simplex ones. \end{enumerate} We start deriving the dual subgradient algorithm by dualizing only the coherence constraints. Thus, we write the partial Lagrangian \begin{align} \begin{split} \mathcal{L}_2( \smu{1},\ldots, & \smu{N}, \{ \slambda{ij} \}_{(i,j) \in \mathcal{E} }) \\ & = \sum_{i=1}^N \Big( q_i( \smu{i} ) + \sum_{j\in\mathcal{N}_i} \slambda{ij}^\top (\smu{i} - \smu{j} ) \Big) \end{split} \label{eq:lagrangian_definition} \end{align} where $\slambda{ij} \in {\mathbb{R}}^S$ for all $(i,j)\in \mathcal{E}$ are Lagrange multipliers associated to the constraints $\smu{i} - \smu{j} = 0$. By exploiting the undirected nature and the connectivity of communication graph $\mathcal{G}$, after some algebraic manipulations, we get \begin{align} \begin{split} \mathcal{L}_2( \smu{1}, \ldots, & \smu{N}, \{ \slambda{ij} \}_{(i,j) \in \mathcal{E} }) \\ & = \sum_{i=1}^N \Big( q_i( \smu{i} ) + {\smu{i} }^\top \!\! \sum_{j\in\mathcal{N}_i} (\slambda{ij} - \slambda{ji}) \Big), \end{split} \label{eq:lagrangian_rearrangement} \end{align} which is separable with respect to $\smu{i}$, $i\in\until{N}$. The dual of problem~\eqref{eq:problem_with_copies} is thus \begin{equation} \min_{ \{\slambda{ij}\}_{(i,j)\in\mathcal{E}} } \eta(\{\slambda{ij}\}_{(i,j)\in\mathcal{E}}) = \sum_{i=1}^N \eta_i\left(\{\slambda{ij},\slambda{ji}\}_{j\in\mathcal{N}_i}\right), \label{eq:dual_dual} \end{equation} where for all $i\in\until{N}$ \begin{align*} \eta_i (\{\slambda{ij},\slambda{ji}\}_{j\in\mathcal{N}_i} ) \! = \! \max_{ \mathbf{1}^\top \smu{i} = 1,\smu{i} \succeq 0 } \! q_i( \smu{i} ) \! +\! {\smu{i} }^\top\!\!\! \sum_{j\in\mathcal{N}_i} (\slambda{ij} \! -\! \slambda{ji}). \end{align*} In order to apply a subgradient method to problem~\eqref{eq:dual_dual}, we recall, \cite[Section~6.1]{bertsekas1999nonlinear}, that \begin{align} \frac{\tilde \partial \eta ( \{\slambda{ij}\}_{(i,j)\in\mathcal{E}} ) }{ \partial \slambda{ij} } = {\smu{i}}^\star - {\smu{j}}^\star, \label{eq:eta_subgradient} \end{align} where $\frac{\tilde \partial \eta (\cdot)}{\partial \slambda{ij}}$ denotes the component associated to the variable $\slambda{ij}$ of a subgradient of $\eta$, and \begin{align*} {\smu{k}}^\star \in \mathop{\operatorname{argmax}}_{ \mathbf{1}^\top \smu{k} = 1,\smu{k} \succeq 0 } \bigg( q_k( \smu{k} ) + {\smu{k}}^\top \sum_{h\in\mathcal{N}_k} (\slambda{kh} - \slambda{hk}) \bigg), \end{align*} for $k=i,j$. The dual subgradient algorithm for problem~\eqref{eq:problem_with_copies} can be summarized as follows, for each node $i\in\until{N}$: \begin{itemize} \item[(S1)]\label{item:s1} receive $\slambda{ji}(t)$, $j \in \mathcal{N}_i$ and compute a subgradient $\smu{i}(t+1)$ by solving \begin{align} \begin{split} \max_{\smu{i} } \: & \: q_i( \smu{i} ) + {\smu{i}}^\top \!\! \sum_{j\in\mathcal{N}_i} (\slambda{ij}(t) - \slambda{ji}(t)) \\ \text{subj. to} \: & \: \mathbf{1}^\top \smu{i} = 1,\smu{i} \succeq 0. \end{split} \label{eq:dual_subgradient} \end{align} \item[(S2)]\label{item:s2} exchange with neighbors the updated $\smu{j}(t+1)$, $j \in \mathcal{N}_i$, and update $\slambda{ij}$, $j\in\mathcal{N}_i$, via \begin{align*} \slambda{ij} (t \!+\! 1) = \slambda{ij}(t) - \gamma(t) (\smu{i}(t \!+\! 1) \!-\! \smu{j}(t + 1)). \end{align*} where $\gamma (t)$ denotes the step-size. \end{itemize} It is worth noting that in~\eqref{eq:dual_subgradient} the value of $\slambda{ij}(t)$ and $\slambda{ji}(t)$, for $j\in\mathcal{N}_i$, is fixed as highlighted by the index $t$. Moreover, we want to stress, once again, that the algorithm is \emph{not} implementable as it is written, since functions $q_i$ are not available in closed form. On this regard, here we slightly abuse notation since in (S1)-(S2) we use $\smu{i}(t)$ as in the \Dminmax/ algorithm, but we have not proven the equivalence yet. Since we will prove it in the next lemmas we preferred not to overweight the notation. \begin{lemma} The dual subgradient updates (S1)-(S2), with step-size $\gamma(t)$ satisfying Assumption~\ref{ass:step-size}, generate sequences $\{ \slambda{ij}(t) \}$, $(i,j)\in \mathcal{E}$ that converge in objective value to $\eta^\star = q^\star = P^\star$, optimal costs of~\eqref{eq:dual_dual},~\eqref{eq:dual_centr} and~\eqref{eq:starting_problem}, respectively.\oprocend \label{lem:dual_subgradient_correcteness} \end{lemma} We can explicitly rephrase update~\eqref{eq:dual_subgradient} by plugging in the definition of $q_i$, given in~\eqref{eq:qi_definition}, thus obtaining the following max-min optimization problem \begin{align} \hspace{-0.2cm} \max_{ \mathbf{1}^\top \smu{i} = 1,\smu{i} \succeq 0 } \! \bigg(\! \min_{\sx{i} \in X_i} \sum_{s=1}^S \smu{i}_s \Big( g_{i s}( \sx{i}_s) \! + \!\! \sum_{j\in\mathcal{N}_i} \!\! (\slambda{ij}(t) \!-\! \slambda{ji}(t))_s \! \Big) \!\! \bigg). \label{eq:maxmin} \end{align} Notice that this is a local problem at each node $i$ once the value for $\slambda{ij}(t)$ and $\slambda{ji}(t)$ for all $j\in\mathcal{N}_i$ are given. \begin{lemma} Max-min optimization problem~\eqref{eq:maxmin} is the saddle point problem associated to problem~\eqref{eq:alg_minimization}. Moreover, a primal-dual optimal solution pair of~\eqref{eq:alg_minimization}, call it $\{ ( \sx{i}(t+1) , \srho{i}(t+1) ), \smu{i}(t+1) \}$, exists and $(\sx{i}(t+1),\smu{i}(t+1))$ is a solution of~\eqref{eq:maxmin}. \label{lem:dual_minmax_equivalence} \end{lemma}% \begin{proof} We give a constructive proof which clarifies how problem~\eqref{eq:alg_minimization} is derived from~\eqref{eq:maxmin}. Define \begin{align} \phi(\sx{i},\smu{i}):=\sum_{s=1}^S \smu{i}_s \Big( g_{i s}( \sx{i}_s) \! + \!\! \sum_{j\in\mathcal{N}_i} (\slambda{ij}(t) \!-\! \slambda{ji} (t) )_s \Big) \end{align} and note that (i) $\phi(\cdot,\smu{i})$ is closed and convex for all $\smu{i} \succeq 0$ and (ii) $\phi(\sx{i}, \cdot )$ is closed and concave (linear over the compact $\mathbf{1}^\top \smu{i} = 1$, $\smu{i}\succeq 0$), for all $\sx{i}\in{\mathbb{R}}^S$. Thus we can invoke the saddle point Proposition~\ref{prop:saddle_point} which allows us to switch the max and min operators, and write \begin{align} \begin{split} & \max_{ \mathbf{1}^\top \smu{i} = 1,\smu{i} \succeq 0 } \! \bigg(\! \min_{\sx{i} \in X_i} \sum_{s=1}^S \smu{i}_s \Big( g_{i s}( \sx{i}_s) \! + \!\!\! \sum_{j\in\mathcal{N}_i} \!\! (\slambda{ij}(t) \!-\! \slambda{ji}(t) )_s \! \Big) \!\! \! \bigg) \\ & \!\!=\!\!\! \min_{\sx{i} \in X_i} \!\! \bigg(\! \max_{ \mathbf{1}^\top \smu{i} = 1, \smu{i} \succeq 0 } \sum_{s=1}^S \smu{i}_s \Big( g_{i s}(\sx{i}_s) \! + \!\!\! \sum_{j\in\mathcal{N}_i} \!\! (\slambda{ij}(t) \!-\! \slambda{ji}(t) )_s \! \Big) \!\!\! \bigg)\!. \end{split} \label{eq:minmax} \end{align} Since the inner maximization problem depends nonlinearly on $\sx{i}$ (which is itself an optimization variable), the solution cannot be obtained without considering the optimization also on $\sx{i}$. We overcome this issue by substituting the inner maximization problem with its equivalent dual. Notice that the inner problem is a linear program when $\sx{i}$ are kept fixed, and thus strong duality can be exploited. Introducing a scalar multiplier $\srho{i}$ associated to the simplex constraint, we have \begin{align} \begin{split} \max_{\smu{i} } \: & \: \sum_{s=1}^S \smu{i}_s \Big( g_{i s}(\sx{i}_s) + \sum_{j\in\mathcal{N}_i} (\slambda{ij}(t) - \slambda{ji}(t) )_{s} \Big) \\ \text{subj. to} \: & \: \mathbf{1}^\top \smu{i} = 1, \smu{i} \succeq 0 \end{split} \label{eq:intermediate_problem} \end{align} is equivalent to its dual \begin{align} \label{eq:rho_formulation} \min_{\srho{i}} \: & \: \srho{i} \\ \notag \text{subj. to} \: & \: g_{i s}(\sx{i}_s ) \!+\!\! \sum_{j\in\mathcal{N}_i} \! (\slambda{ij}(t) \!-\! \slambda{ji}(t) )_{s} \le \srho{i}, s \!\in \! \until{S} \end{align} where the $S$ inequality constraints follow from the minimization of the partial Lagrangian of~\eqref{eq:intermediate_problem} with respect to $\smu{i} \succeq 0$. Plugging formulation~\eqref{eq:rho_formulation} in place of the inner maximization in~\eqref{eq:minmax}, we can write a \emph{joint} minimization, i.e., minimize simultaneously with respect to $\sx{i}$ and $\srho{i}$, which leads to~\eqref{eq:alg_minimization}. To prove the second part, notice that problem~\eqref{eq:alg_minimization} is convex. Then, the problem satisfies the Slater's constraint qualification and, thus, strong duality holds. Therefore, a primal-dual optimal solution pair $(\sx{i}(t+1), \srho{i}(t+1),\smu{i}(t+1))$ exists and from the previous arguments the proof follows.% \end{proof} We point out that the previous lemma shows that performing minimization in~\eqref{eq:alg_minimization} turns out to be equivalent to performing step~(S1). We are now ready to state the main result of the paper, namely the convergence of the \Dminmax/ distributed algorithm. \begin{theorem} Let $\{ (\sx{i}(t), \srho{i}(t))\}$, $i\in\until{N}$, be the sequence generated by the \Dminmax/ distributed algorithm, with $\gamma(t)$ satisfying Assumption~\ref{ass:step-size}. Then, the sequence $\{\sum_{i=1}^N \rho^i(t)\}$ converges to the optimal cost $P^\star$ of~\eqref{eq:minimax_starting_problem} and every limit point of the sequence $\{ \sx{i}(t) \}$, $i\in\until{N}$, is an optimal (feasible) solution of~\eqref{eq:minimax_starting_problem}. \oprocend \label{thm:convergence} \end{theorem} \begin{remark} From condition~\eqref{eq:minmax} it can be shown that each $\srho{i}(t)$ is equal to $\eta_i( \{\slambda{ij},\slambda{ji}\}_{j\in\mathcal{N}_i} )$ for all $ t \ge 0$. Since the optimal cost of \eqref{eq:dual_dual} is equal to the optimal primal cost $P^\star$, then we have that $\lim_{t\to\infty}\sum_i \rho^i(t) = \lim_{t\to\infty}\sum_i \eta_i(t) = P^\star$. \oprocend \label{rem:sum_rho_P} \end{remark} \section{Numerical Simulations} \label{sec:simulations} In this section we propose a numerical example in which we apply the proposed method to a network of Thermostatically Controlled Loads (TCLs) (such as air conditioners, heat pumps, electric water heaters), \cite{Alizadeh2015reduced}. The dynamical model of the $i$-th device is given by \begin{equation} \label{eq:agent_model} \dot{T}^{i}(\tau)= -\alpha \left(T^{i}(\tau)-T^{i}_{out}(\tau)\right)+ Q\sx{i}(\tau), \end{equation} where $T_i(\tau)\geq0$ is the temperature, $\alpha > 0$ is a parameter depending on geometric and thermal characteristics, $T^{i}_{out}(\tau)$ is the air temperature outside the device, $\sx{i}(\tau)\in \left[0,1\right]$ is the control input, and $Q>0$ is a scaling factor. We consider a discretized version of the system with constant input over the sampling interval $\Delta\tau$, i.e., $x^{i}(\tau)=\sx{i}_{s}$ for $\tau\in \left[s \Delta\tau, (s+1) \Delta\tau \right)$, and sampled state $T^{i}_{s}$, \begin{equation} T^{i}_{s+1}= T^{i}_{s}e^{-\alpha \Delta\tau}+\left(1-e^{-\alpha \Delta\tau}\right)\left(\frac{Q}{\alpha} \sx{i}_{s}-T^{i}_{out,s}\right). \label{eq:agent_model_discrete_time} \end{equation} We assume that the power consumption $g_{i s} ( \sx{i}_s)$ of the $i$-th device in the $s$-th slot $[ s \Delta\tau, (s+1) \Delta\tau ]$ is directly proportional to $\sx{i}_s$. For the sake of simplicity we consider $g_{i s} (\sx{i}_s ) = \sx{i}_s$ in the numerical example proposed in this section. Thus, optimization problem \eqref{eq:minimax_starting_problem} for this scenario is \begin{align} \label{eq:simulated_problem} \begin{split} \min_{\sx{1}, \ldots, \sx{N}} \: & \: \max_{s \in \until{S}} \sum_{i=1}^N \sx{i}_s \\ \text{subj. to} \: & \: \sx{i} \in X_i , \quad i\in\until{N} \end{split} \end{align} where $X_i := \{\sx{i} \in {\mathbb{R}}^S \mid A_i \sx{i} \preceq b_i \text{ and } \sx{i}\in[0,1]^S \}$, with $A_i$ and $b_i$ obtained by enforcing the dynamics constraints \eqref{eq:agent_model_discrete_time} and temperature constraints $T^i_s \in \left[T_{min}, T_{max}\right]$. In the proposed numerical example we consider $N=15$ agents communicating according to an undirected connected Erd\H{o}s-R\'enyi random graph $\mathcal{G}$ with parameter $0.2$. We consider a horizon of $S=50$. Finally, a diminishing step-size sequence $\gamma(t) = (\frac{1}{t})^{0.8}$ at iteration $t$, which satisfies Assumption~\ref{ass:step-size}, is used. In Figure~\ref{fig:rho} we show the evolution at each algorithm iteration $t$ of the local objective functions $\srho{i}(t)$, $i\in\until{N}$, (solid lines) which converge to stationary values. We also plot their sum $\sum_{i=1}^N\srho{i}(t)$ (dotted line) that asymptotically converges to the centralized optimal cost $P^\star$ of problem~\eqref{eq:simulated_problem} (see Remark~\ref{rem:sum_rho_P}). \begin{figure}[!htbp] \centering % \includegraphics[scale=0.85]{tikz_fig_rho} % \caption{ Evolution of $\srho{i}$, $i\in\until{N}$, (solid lines), their sum $\sum_{i=1}^N\srho{i}$ (dotted line), and (centralized) optimal cost $P^\star$ (dash-dotted line). } \label{fig:rho} \end{figure} In Figure~\ref{fig:xx} it is shown the profile of an optimal consumption of the devices, i.e., $\sum_{i=1}^N {\sx{i}_s}^\star$, over the horizon $s=1,\ldots,S$. It can be seen that the proposed method effectively shaves off the peak power demand. In the same figure it also shown an optimal consumption strategy ${\sx{i}}^\star$ that each single device locally computes. \begin{figure}[!htbp] \centering % \includegraphics[scale=0.85]{tikz_fig_xx} % \caption{ Profile of optimal solutions ${\sx{i}}^\star$ (solid lines), and $\sum_{i=1}^N{\sx{i}_s}^\star$ (dotted line) on the optimization horizon $\until{S}$. } \label{fig:xx} \end{figure} Finally, in Figure~\ref{fig:cost} it is shown the convergence rate of the distributed algorithm, i.e., the difference between the centralized optimal cost $P^\star$ and the sum of the local costs $\sum_{i=1}^N \srho{i} (t)$, in logarithmic scale. It can be seen that the proposed algorithm converges to the optimal cost with sublinear rate $O(1/\sqrt{t})$ as expected for a subgradient method. \begin{figure}[!htbp] \centering % \includegraphics[scale=0.85]{tikz_fig_cost} % \caption{ Evolution of the cost error, in logarithmic scale. } \label{fig:cost} \end{figure} \section{Conclusions} % \label{sec:conclusions} % In this paper we have introduced a novel distributed min-max optimization framework motivated by peak minimization problems in Demand Side Management. Standard distributed optimization algorithms cannot be applied to this problem set-up due to a highly nontrivial coupling in the objective function and in the constraints. We proposed a distributed algorithm based on the combination of duality methods and properties from min-max optimization. We proved the correctness of the proposed algorithm and corroborated the theoretical results with a numerical example. \begin{small} \bibliographystyle{IEEEtran}
{'timestamp': '2017-03-27T02:06:31', 'yymm': '1703', 'arxiv_id': '1703.08376', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08376'}
arxiv
\chapter*{Abstract} A block cipher is a bijective function that transforms a plaintext to a ciphertext. A block cipher is a principle component in a cryptosystem because the security of a cryptosystem depends on the security of a block cipher. A Feistel network is the most widely used method to construct a block cipher. This structure has a property such that it can transform a function to a bijective function. But the previous Feistel network is unsuitable to construct block ciphers that have large input-output size. One way to construct block ciphers with large input-output size is to use an unbalanced Feistel network that is the generalization of a previous Feistel network. There have been little research on unbalanced Feistel networks and previous work was about some particular structures of unbalanced Feistel networks. So previous work didn't provide a theoretical base to construct block ciphers that are secure and efficient using unbalanced Feistel networks. In this thesis, we analyze the minimal number of rounds of pseudo-random permutation generators that use unbalanced Feistel networks. That is, after categorizing unbalanced Feistel networks as source-heavy structures and target-heavy structures, we analyze the minimal number of rounds of pseudo-random permutation generators that use each structure. Therefore, in order to construct a block cipher that is secure and efficient using unbalanced Feistel networks, we should follow the results of this thesis. Additionally, we propose a new unbalanced Feistel network that has some advantages such that it can extend a previous block cipher with small input-output size to a new block cipher with large input-output size. We also analyze the minimum number of rounds of a pseudo-random permutation generator that uses this structure. \tableofcontents \chapter{Introduction} A block cipher is a symmetric key cryptosystem that encrypts a plaintext into a ciphertext block by block \cite{MenezesOV97}. The block cipher should have the one-to-one correspondence between plaintexts and ciphertexts. The block cipher is the most important element in most cryptographic systems. In particular, it is the essential element used in the implementation of other cryptographic primitives such as pseudo-random number generators, stream ciphers, and hash functions \cite{MenezesOV97,Schneier94}. Since the security of most cryptographic systems depends on the security of block ciphers, a secure block cipher must be implemented to build a secure cryptosystem. A secure block cipher is a block cipher where the output value of the block cipher becomes a random value. That is, when the output value of the block cipher is random, the block cipher becomes a secure one since it is very hard for an attacker to guess the plaintext or the secret key of the cipher from the ciphertext. Mathematically, a block cipher is a secure block cipher if it is a pseudo-random permutation (PRP) generator \cite{LubyR88}. The biggest problem of implementing a block cipher is that it is difficult to implement a function that has the one-to-one correspondence property and the output randomness property at the same time. The way to solve this problem is to use a Feistel network structure. A Feistel network structure is a method that converts an arbitrary function into a one-to-one correspondence function. This structure was designed by H. Feistel in designing the Lucifer cipher \cite{Feistel73,FeistelNS75}. That is, if a block cipher is implemented using a Feistel network, a secure block cipher can be easily implemented by simply implementing an arbitrary function whose output value is random. This is because if the output value of an arbitrary function is random, the Feistel network structure automatically converts it to a one-to-one correspondence function. Therefore, most block ciphers are constructed by using a Feistel network structure or a slightly modified structure of the Feistel network structure \cite{DES77,ShimizuM88,Schneier94,Rivest95}. In addition, some research has been done on the security of block ciphers using the Feistel network structure \cite{BihamS91,MenezesOV97,Matsui94,SadeghiyanP92}. In particular, there have been numerous studies on pseudo-random permutation generators after the work of Luby and Rackoff \cite{LubyR88,Schnorr88,ZhengMI90i, Pieprzyk91,SadeghiyanP91,SadeghiyanP92,Patarin92n,Patarin92h,AiolloV96, Coppersmith96,Patarin98}. However, the problem of the previous (balanced) Feistel network is that it is difficult to construct a block cipher with a large input/output size. That is, when a block cipher that can process a large size of data at one time is implemented, the input size of a round function used in the Feistel network structure also increases as the input/output size of the block cipher increases. In practice, however, the cost of implementing a round function is proportional to the input size of the round function. Therefore, the previous (balanced) Feistel network structure is inappropriate when constructing a block cipher with large input/output size. One of the ways to solve this problem is to use an unbalanced Feistel network structure which is a modification of the previous balanced Feistel network. An unbalanced Feistel network is a Feistel network structure in which the size of a target-block combined with the output of a round function and the size of a source-block which is the input of the round function are different \cite{AndersonB96,Lucks96,SchneierK96}. Therefore, the round function in an unbalanced Feistel network structure can be implemented at a lower cost than a balanced Feistel network since it is possible to control the input size of the round function in the unbalanced Feistel network structure. Especially, as the information processing capability of the computer increases, a block cipher with a large input-output size that is capable of processing a large amount of information will be needed. Therefore, much research is needed on unbalanced Feistel networks suitable for implementing block ciphers with large input-output size. However, there are not many studies on unbalanced Feistel networks. There are some studies to implement a pseudo-random permutation generator, which is a secure block cipher using an unbalanced Feistel network \cite{Jutla98,NaorR99}. However, these studies failed to show the minimum number of rounds for a block cipher using an unbalanced Feistel network to become a secure and efficient block cipher. In fact, the minimum number of rounds is important when constructing a block cipher because the number of rounds greatly affects the speed and cost of the block cipher. That is, when constructing a block cipher, a small number of rounds must be used to implement a fast block cipher at low cost. It is therefore very important to determine the minimum number of rounds to be a secure block cipher. Therefore, in this thesis, we first find the minimum number of rounds for a pseudo-random permutation generator, which is a secure block cipher using a Feistel network. Next, we propose a scalable new unbalanced Feistel network structure and find the minimum number of rounds for this structure to become a secure block cipher. The advantage of a newly proposed structure is that it can easily construct a block cipher with a large input-output size using a previously designed secure block cipher with fixed input-output size. In other words, there is a lot of analysis and research on a new block cipher in order to newly design a block cipher with a large input-output size. However, by using this newly proposed structure, a new block cipher with a large input-output size can be implemented using the previously analyzed secure block cipher. So we do not have to do another analysis and research. The structure of this thesis is as follows. In Chapter 2, we first define a block cipher, a Feistel network, and a pseudo-random number generator. Then we summarize the existing studies on pseudo-random permutation generators. In Chapter 3, we investigate the condition of the number of rounds for a block cipher using an unbalanced Feistel network to be a pseudo-random permutation generator. In Chapter 4, we propose a scalable unbalanced Feistel network structure, and analyze the conditions for a secure block cipher using this new structure to be a pseudo-random permutation generator. In Chapter 5, we compare a balanced Feistel network structure, an unbalanced Feistel network structure, and the newly proposed structure. Finally, in Chapter 6, we conclude the thesis and present the direction of future research. \chapter{Preliminaries} In this chapter, we define the terms used in the thesis and summarize the studies related to a pseudo-random permutation generator. A block cipher is a secret-key cryptosystem that processes messages using the same key when encrypting and decrypting messages. A block cipher is the basis of cryptographic systems for message authentication, data integrity verification, and digital signature. Mathematically, a block cipher is a one-to-one function (permutation) since it must be able to encrypt and decrypt messages using a secret key. A Feistel network structure is most commonly used to build block ciphers because it has the advantage of converting arbitrary functions to permutations. In order for a block cipher to be a secure block cipher, the output value of the block cipher must be a random value. That is, when a block cipher becomes a pseudo-random permutation generator, it becomes a secure block cipher. In this case, the permutation generator $P$ is pseudo-random, meaning that any efficient algorithm can not distinguish between an ideal permutation generator and $P$. This chapter is organized as follows. In Section 2.1, we first define symbols used in this paper. In Section 2.2, we define a block cipher, which is a secret-key cryptosystem, and investigate the characteristics of the block cipher and attack methods for block ciphers. In Section 2.3, we define the most commonly used Feistel networks for building block ciphers and discuss the advantages and disadvantages of them. In Section 2.4, we define the pseudorandomness. In Section 2.5, we finally summarize existing studies on pseudo-random permutation generators \section{Notation} The symbols used in this paper are defined as follows. \begin{itemize} \item $I_n$ represents a set of all $n$-bit strings. That is, $\bits^n$. \item $F: I_s \rightarrow I_t$ is a set of all functions whose inputs are $s$-bits and whose outputs are $t$-bits. \item $F_n$ is a set of functions whose input and output are both $n$-bits in size. That is, $F_n$ is $F: I_n \rightarrow I_n$. \item $P_n$ is a set of permutations (one-to-one functions) whose input and output sizes are both $n$-bits. That is, $P_n \subset F_n$ \item $|x|$ is the length of a bit string $x$. That is, $|x|$ is $n$ if the bit size of $x$ is $n$-bits. \item $x \oplus y$ is an exclusive OR (XOR) per bit unit when the bit size of $x$ and $y$ is equal. \item $x \| y$ is a concatenation of two bit strings $x$ and $y$. In this case, we have $| x \| y | = |x| + |y|$. \item $f \circ g$ is the composition of two functions $f$ and $g$ when $f$ and $g$ are elements of the set $F_n$. That is, $f \circ g(x) = f(g(x))$. \end{itemize} \section{Block Cipher} \begin{figure}[t] \centering \includegraphics[scale=0.75]{fig_block_cipher} \caption{The overview of a secret-key cryptosystem} \label{fig:block_cipher} \end{figure} A block cipher can usually be a private-key cryptosystem or a public-key cryptosystem. However, in this paper, the secret-key cryptosystem is called a block cipher. The structure of a block cipher is given in Figure \ref{fig:block_cipher}. A block cipher is a function that sends an $n$-bit plaintext to an $n$-bit ciphertext \cite{MenezesOV97,Shannon49}. The function of the block cipher is specified by an $\ell$-bit secret key. If a plaintext is encrypted and decrypted again, the original plaintext must be obtained. Therefore, the block cipher must be a one-to-one function (bijection) for $n$-bit plaintexts and $n$-bit ciphertexts when a secret key is specified. That is, each secret key defines a different permutation. The definition of the block cipher is as follows. \begin{definition}[Block Cipher] Let $K$ be the set of $\ell$-bit secret keys. The $n$-bit block cipher is defined as a function $E : I_n \times K \rightarrow I_n$. We have that $E^{-1}(E(p,k), k) = p$ holds for an arbitrary plaintext $p$ and a random key $k$ ($k \in K$). \end{definition} A true random block cipher is a block cipher that generates all permutations between the domain and the range \cite{MenezesOV97}. In the $n$-bit block cipher, the domain corresponds to the set of plaintexts and the number of plaintexts is $2^n$, so the size of the domain is $2^n$. The range corresponds to the set of ciphertexts and the number of ciphertexts is $2^n$, so the size of the range is also $2^n$. Therefore, the number of all permutations is $2^n!$. In the $n$-bit block cipher, one key specifies one permutation, so we need $2^n !$ number of secret keys to enumerate all permutations. That is, the size of a secret key of the ideal block cipher must be $\log (2^n !) \approx (n - 1.44) 2^n$ bits. \begin{definition}[Ideal Block Cipher] An ideal block cipher is a block cipher that implements all $2^n !$ number of one-to-one functions that exist between $2^n$ number of elements. In this case, each secret key specifies each one-to-one function. \end{definition} It is impossible to actually build an ideal block cipher because it requires $(n-1.44) 2^n$ bits for a secret key. Thus, in order for a block cipher using an $\ell$-bit secret key to be secure, the permutations that are specified by $\ell$-bit secret keys must appear randomly chosen from all $2^n !$ permutations. The security of a block cipher is measured by the security against the various attack methods of attackers. The attack on the block cipher is divided into four categories according to the information that the attacker can access: \begin{enumerate} \item Ciphertext-only attack: The attacker uses only ciphertexts to get the secret key of the block cipher. \item Known-plaintext attack: The attacker uses known plaintexts and ciphertexts pairs to find the secret key of the block cipher. \item Chosen-plaintext attack: The attacker finds the secret key of the block cipher by using the pairs of plaintexts and corresponding ciphertexts chosen by the attacker. \item Chosen-ciphertext attack: The attacker finds the secret key using the chosen ciphertexts and its corresponding plaintexts. \end{enumerate} Differential cryptanalysis and linear cryptanalysis are the most powerful methods of attacking block ciphers. Differential cryptanalysis is a chosen-plaintext attack developed by Biham and Shamir \cite{BihamS91}. This attack method exploits the fact that the probability distribution of the difference between the input/output pair of a nonlinear function is not uniform. Linear cryptanalysis is a known-plaintext attack developed by Matsui \cite{Matsui94}. This attack method extracts the information of a related key by using a linear approximation of a nonlinear function. \section{Feistel Network} A Feistel network is the most commonly used structure for designing a block cipher. This structure was first used when designing a Lucifer cipher by H. Feistel \cite{Feistel73,FeistelNS75}. After that, this was used to design block ciphers such as DES, FEAL, Blowfish, and RC5 \cite{DES77,ShimizuM88, Schneier94,Rivest95}. A Feistel network is a method that converts an arbitrary function to a permutation that is a one-to-one correspondence function. The definition of a Feistel network is as follows. \begin{definition}[Feistel Network] \label{def:feistel_network} For any function $f$ belonging to $F:I_s \rightarrow I_t$, one round Feistel network is defined as a function $D_f (L \| R) = (R \| L \oplus f(R))$. Similarly, for the functions $f_1, f_2, \ldots, f_r$, which belong to the set $F:I_s \rightarrow I_t$, an $r$ rounds Feistel network is defined as a function $D_{f_r} \circ \cdots \circ D_{f_2} \circ D_{f_1} (L \| R) \stackrel{def}{=} D_{f_r} \circ \cdots \circ D_{f_2} (D_{f_1} (L \| R))$, where $|L| = t$, $|R| = s$, $|L| + |R| = n$, and $D_f \in P_n$. \end{definition} The above Feistel network can be seen as a permutation. To show that a function is a one-to-one correspondence function (bijection), we should show that it is a one-to-one function and an onto function. However, we only need to show that it is a one-to-one function since the input and output bits of the Feistel network are the same. \begin{theorem} \label{thm:1_round_feistel_network} The function $D_f (L \| R) = (R \| L \oplus f(R))$ is a one-to-one function. \end{theorem} \begin{proof} If the function $D_f$ is a one-to-one function, then $D_f (x) \neq D_f (y)$ for $x$ and $y$ such that $x \neq y$. If $x = (L_1 \| R_1)$ and $y = (L_2 \| R_2)$, then $D_f (x) = (R_1 \| L_1 \oplus f(R_1))$ and $D_f(y) = (R_2 \| L_2 \oplus f(R_2))$. Because of $x \neq y$, we consider two cases. \begin{itemize} \item Case $R_1 \neq R_2$: $D_f (x) \neq D_f(y)$ by the definition of $D_f$. \item Case $L_1 \neq L_2$ and $R_1 = R_2$: $L_1 \oplus f(R_1) \neq L_2 \oplus f(R_2)$ since $f(R_1) = f(R_2)$. \end{itemize} So the function is a one-to-one function. \end{proof} \begin{figure}[t] \centering \includegraphics[scale=0.75]{fig_feistel_network} \caption{Feistel networks: (a) Balanced Feistel network, (b) Unbalanced Feistel network} \label{fig:feistel_network} \end{figure} A Feistel network is divided into a balanced Feistel network and an unbalanced Feistel network \cite{SchneierK96}. A balanced Feistel network is a Feistel network in Definition \ref{def:feistel_network} with the same $L$ and $R$ sizes. In contrast, an unbalanced Feistel network is a Feistel network in Definition \ref{def:feistel_network} with different $L$ and $R$ sizes ($|L| \neq |R|$). The balanced Feistel network and unbalanced Feistel network structures are given in Figure \ref{fig:feistel_network}. The DES algorithm that uses a Feistel network was invented in 1970s and it has been used as the standard block cipher for 20 years \cite{DES77}. Many researchers have studied the security of the DES algorithm \cite{BihamS91, Matsui94,Schneier96}. In addition, many other block ciphers that were invented after DES were also affected by the DES cipher. \begin{example}[DES] The DES algorithm is a 64-bit block cipher with a 56-bit secret key. This cipher has a 16 rounds balanced Feistel network structure. The $i$th round is defined as $$D_{K_i}(L^{i-1} \| R^{i-1}) \stackrel{def}{=} (R^{i-1} \| L^{i-1} \oplus P(S(E(R) \oplus K_i)))$$ where $|L^{i-1}| = |R^{i-1}| = 32$, $|K_i| = 48$, $E:I_{32} \rightarrow I_{48}$ is an expansion function, $S:I_{48} \rightarrow I_{32}$ is a substitution function, and $P:I_{32} \rightarrow I_{32}$ is a permutation function. \end{example} An unbalanced Feistel network is divided into a source-heavy unbalanced Feistel network and a target-heavy unbalanced Feistel network \cite{SchneierK96}. The source-heavy unbalanced Feistel network is a Feistel network where the size of the block $R$ which is the input to the $F$ function, is greater than the size of the block $L$ which is combined with the output of the $F$ function ($|R| > |L|$). Whereas the target-heavy Feistel network is a Feistel network where the size of the block $R$ is smaller than the size of the block $L$ ($|R| < |L|$). The structures of source-heavy and target-heavy Feistel networks are given in Figure \ref{fig:unbalanced_feistel_network}. \begin{figure} \centering \includegraphics[scale=0.75]{fig_unbal_feistel_network} \caption{Unbalanced Feistel networks: (a) Source-heavy Feistel network, (b) Target-heavy Feistel network} \label{fig:unbalanced_feistel_network} \end{figure} The MARS algorithm is a block cipher proposed for the advanced encryption standard (AES) to replace the DES block cipher \cite{BurwickCD+98}. This cipher uses a target-heavy unbalanced Feistel network. \begin{example}[MARS] The MARS algorithm is a 128-bit block cipher proposed for AES and it can have different size of secret keys. This cipher has a 32 rounds unbalanced Feistel network. The $i$th round is defined as $$D_{K_i}(L_1^{i-1} \| L_2^{i-1} \| L_3^{i-1} \| R^{i-1}) \stackrel{def}{=} (R^{i-1} \| L_1^{i-1} \boxplus f_1^i(R^{i-1}) \| L_2^{i-1} \boxplus f_2^i(R^{i-1}) \| L_3^{i-1} \boxplus f_3^i(R^{i-1}))$$ where $\boxplus$ is the addition operator in mod $2^{32}$. \end{example} The main advantage of a block cipher using an unbalanced Feistel network is that it can select the input size of the $F$ function used in the Feistel network. In particular, as the amount of data that the computer has to process due to the development of the Internet, the amount of messages to be encrypted is also increasing. As the information throughput increases, an encryption scheme that can process large amounts of data becomes necessary. Therefore, a block cipher with a large input size is needed. The advanced encryption standard (AES) selected by National Institute of Standards and Technology (NIST) also requires a 128-bit block cipher to reflect this demand \cite{NIST97}. When implementing a block cipher with a large input value, it is difficult to implement the $F$ function of a Feistel network if a balanced Feistel network is used. This is because the cost of implementing the $F$ function is generally proportional to the size of the input value of the $F$ function. However, since the input size of the $F$ function can be selected in an unbalanced Feistel network, it is very effective to use an unbalanced Feistel network in implementing a large block cipher. In other words, a block cipher with a large input size using a target-heavy unbalanced Feistel network can be implemented at a lower cost than a cipher using other Feistel network structures. \section{Pseudo-Randomness} Before defining pseudo-randomness, we first review what two distributions are computationally equivalent. The computational equivalence of two distributions means that no effective algorithm can determine that two distributions are different. In other words, computational indistinguishability is a criterion for judging the equivalence of two distributions. Therefore, the pseudo-randomness distribution is a distribution that can not be distinguished from the truly random distribution by computation \cite{Goldreich95}. At this time, it is necessary to define an algorithm for determining whether two distributions are identical. The definition of an algorithm for determining identical distributions is defined by the following oracle machine. \begin{definition}[Oracle Machine $M$] An oracle machine $M$ is a Turing machine that has an oracle tape as an additional tape and has two special states called ``oracle invocation'' and ``oracle appeared''. The oracle machine has an input value of $1^n$ and an output value of 1. The oracle machine that can access a function $f$ whose input value is $n$ bits in size is called $M^{f} (1^n)$ and operates as follows: If the state of the oracle machine is not ``oracle appeared'', then it operates as the same as a normal Turing machine. If the state of the oracle machine is ``oracle origin'', then the oracle machine writes an oracle query $x_1$ which is $n$ bits string to the oracle tape. Then, the state of the oracle machine is changed to ``oracle appeared'', and the content of the oracle tape is replaced by the oracle reply $y_1 = f(x_1)$. This process repeats $m$ times. The 1-bit output of the oracle machine is calculated from the values $<x_1, y_1>, <x_2, y_2>, \ldots, <x_m, y_m>$. \end{definition} Because the oracle machine determines the equality of the two distributions, the pseudo-randomness is determined by the computational power of the oracle machine. An effective algorithm for determining the equality of two distributions is an oracle machine that calculates the output value within a probabilistic polynomial-time. Thus, the pseudo-random distribution refer to a distribution that can not be distinguished from the true random distribution using probabilistic polynomial-time oracle machines. At this time, the indistinguishability is defined as the following. \begin{definition}[Polynomial-Time Indistinguishability] \label{def:ind} If two distributions $X$ and $Y$ are indistinguishable in polynomial-time, then the following equation holds for all probabilistic polynomial-time algorithms $D$, all polynomials $p(\cdot)$, and sufficiently large $n$ values ​​$$| \Pr (D(X,1^n) = 1) - \Pr (D(Y,1^n) = 1) | <1/p(n)$$ where the output of algorithm $D$ is 1 bit. \end{definition} A cryptographically secure pseudo-random bit generator was first introduced by Blum and Micali \cite{BlumM84}. After that, a number of pseudo-random bit generators have been proposed based on number theoretic problems \cite{BlumBS86,Kaliski87,VaziraniV85}. H{\aa}stard et al. have shown that a pseudo-random bit generator can be constructed using an arbitrary one-way function \cite{HastadILL99}. A pseudo random bit generator is defined as follows. In this case, an ideal random bit generator $R$ has a uniform distribution of all possible output values. \begin{definition}[Pseudo-Random Bit Generator] A pseudo-random bit generator is defined by a deterministic polynomial-time algorithm $G$ and satisfies the following two conditions: \begin{enumerate} \item Scalability: $|G(s)| > |s|$ for all $s \in \bits^*$. \item Pseudo-Randomness: The algorithm $G$ is indistinguishable from the ideal random bit generator $R$ in polynomial time. \end{enumerate} \end{definition} Blum and Micali showed that it is possible to construct a pseudo-random bit generator using the difficulties of the discrete logarithm problem \cite{BlumM84}. The pseudo-random bit generator of Blum and Micali is described in Example \ref{exa:bm_prbg}. \begin{example}[Blum-Micali Pseudo-Random Bit Generator] \label{exa:bm_prbg} Let $p$ be a large prime, and $g$ be a generator of $\Z_p^*$. The set $D$ is defined as $D = \Z_p^* = {0, 1, \ldots, p-1}$. The function $f:D \rightarrow D$ is defined as $f(x) = g^x \mod p$. The function $B:D \rightarrow \bits$ is defined as $B(x)=1$ for $0 \leq \log_g(x) \leq (p-1)/2$ and $B(x)=0$ for $\log_g(x) > (p-1)/2$. The Blum-Micali pseudo-random bit generation algorithm is described as follows. \vs \\ \indent \quad \textbf{generate} a large prime $p$ and a generator $g$ of $\Z_p^*$. \\ \indent \quad \textbf{select} a random integer $x_0$ from $D = \{ 0, 1, \ldots, p-1 \}$. \\ \indent \quad \textbf{for} $1 \leq i \leq \ell$ \textbf{do} \\ \indent \qquad $x_i \leftarrow f(x_{i-1})$. \\ \indent \qquad $b_i \leftarrow B(x_i)$. \\ \indent \quad \textbf{end for} \\ \indent \quad \textbf{output} $b_1, b_2, \ldots, b_\ell$. \end{example} Blum, Blum, and Shub showed that it is possible to construct a pseudo-random bit generator using the difficulties of the quadratic residuacity problem \cite{BlumBS86}. The pseudo-random bit generator of Blum, Blum, and Shub is described in Example \ref{exa:bbs_prbg}. \begin{example}[Blum-Blum-Shub Pseudo-Random Bit Generator] \label{exa:bbs_prbg} Let $LSB(x)$ be a function that outputs the least significant bit of a binary string $x$. The Blum-Blum-Shub pseudo-random bit generation algorithm is described as follows. \vs \\ \indent \quad \textbf{generate} a large prime $p$ such that $p \mod 4 = 3$. \\ \indent \quad \textbf{generate} a large prime $q$ such that $q \mod 4 = 3$. \\ \indent \quad $n \leftarrow pq$. \\ \indent \quad \textbf{select} a random integer $s \in \{ 1, \ldots, n-1 \}$ such that $gcd(s,n) = 1$. \\ \indent \quad $x_0 \leftarrow s^2 \mod n$. \\ \indent \quad \textbf{for} $1 \leq i \leq \ell$ \textbf{do} \\ \indent \qquad $x_i \leftarrow x_{i-1}^2 \mod n$. \\ \indent \qquad $b_i \leftarrow LSB(x_i)$. \\ \indent \quad \textbf{end for} \\ \indent \quad \textbf{output} $b_1, b_2, \ldots, b_\ell$. \end{example} A pseudo-random function generator is a function generator that is indistinguishable from an ideal random function generator $H$ that generates all possible functions with a uniform probability distribution. Goldreich, Goldwasser, and Micali showed that a pseudo-random bit generator can be used to create a pseudo-random function generator \cite{GoldreichGM86}. A pseudo-random function generator is defined as follows. \begin{definition}[Pseudo-Random Function Generator] \label{def:prf} A pseudo-random function generator is defined as an algorithm $F$ that generates a set of functions. For all probabilistic polynomial-time oracle $M$, all polynomials $p(\cdot)$, and sufficiently large $n$ values, it satisfies $$| \Pr(M^F (1^n) = 1) - \Pr(M^H (1^n) = 1) | < 1/p(n)$$ where $H$ is an ideal random function generator that generates all possible functions as a uniform probability distribution. \end{definition} Goldreich, Goldwasser and Micali proposed a pseudo-random function generator as follows. \begin{example}[GGM Pseudo-Random Function Generator] \label{exm:ggm-prf} Let $G$ be a pseudo random bit generator whose input is $k$ bits and whose output is $2k$ bits. That is, $G(x) = b_1^x b_2^x \cdots b_{2k}^x$ for the initial value $x \in I_k$. Let $G_0(x)$ be the first $k$ bit string of $G(x)$ and $G_1(x)$ be the remaining $k$ bit string of $G(x)$. That is, $G_0(x) = b_1^x \cdots b_k^x$ and $G_1(x) = b_{k+1}^x \cdots b_{2k}^x$. For a $t$-bit binary string $\alpha = \alpha_1 \alpha_2 \cdots \alpha_t$, $G_{\alpha}(x)$ is defined as $G_{\alpha_t} (\cdots (G_{\alpha_2} (G_{\alpha_1} (x))))$. For a given $x \in I_k$, a pseudo-random function $f_x: I_k \rightarrow I_k$ is defined as $$f_x(y) \stackrel{def}{=} G_y(x)$$ where $y \in I_k$. For polynomials $P_1$ and $P_2$ and given $x \in I_k$, a pseudo-random function $F : I_{P_1(k)} \rightarrow l_{P_2(k)}$ is defined as $$F_x(y) \stackrel{def}{=} G'(G_y(x))$$ where $y \in I_{P_1(k)}$ and $G'$ is a pseudo-random bit generator with $k$ bits input and $P_2(k)$ bits output. \end{example} Let us look at the performance of the GGM pseudo-random function generator. A pseudo-random function generator $F_x : I_{P_1(k)} \rightarrow I_{P_2(k)}$ must generate a pseudo-random string of approximately $P_1(k) \cdot 2k + P_2(k)$ bits. Assuming that the size $k$ of the string $x$ is properly selected and that $P_2(k)$ is not a value much larger than $P_1(k)$, then the size of pseudo-random bits that the pseudo-random function $F_x$ must generate is proportional to the input bit size $P_1(k)$. So the smaller the input bit size of the function, the faster the function can be generated. A pseudo-random permutation generator was introduced by Luby and Rackoff \cite{LubyR88}. The definition of pseudo-random permutation generator is given as follows. \begin{definition}[Pseudo-Random Permutation Generator] \label{def:prp} A pseudo-random permutation generator is defined as an algorithm $P$ which generates a set of permutations. For all probabilistic polynomial-time oracle $M$, all polynomials $p(\cdot)$, and sufficiently large $n$ values, it satisfies the following equation $$| \Pr(M^P(1^n) = 1) - \Pr(M^H(1^n) = 1) | < 1/p(n)$$ where $H$ is an ideal random permutation generator that produces all possible permutations with a uniform probability distribution. \end{definition} Luby and Rackoff showed that a pseudo-random permutation generator could be constructed by using a pseudo-random function and a three rounds balanced Feistel network structure. \begin{example} A three rounds balanced Feistel network that uses pseudo-random functions $f_1, f_2, f_3$ is a pseudo-random permutation generator and is defined as $$D_{f_3} \circ D_{f_2} \circ D_{f_1} (L \| R) \stackrel{def}{=} D_{f_3} (D_{f_2} (D_{f_1} (L \| R)))$$ where $D_{f_i} (L \| R) = (R \| L \oplus f_i(R))$ and $|L| = |R|$. \end{example} A super pseudo-random permutation generator is a permutation generator, which can not be distinguished from an ideal random permutation generator when an oracle machine is able to access both a permutation and the inverse of the permutation. The definition is given as follows. \begin{definition}[Super Pseudo-Random Permutation Generator] \label{def:sprp} A super pseudo-random permutation generator is defined as an algorithm $P$ that generates the set of permutations. For all probabilistic polynomial-time oracle $M$, all polynomials $p(\cdot)$, and the large $n$ value, it satisfies the following equation $$| \Pr (M^{P, P^{-1}} (1^n) = 1) - \Pr (M^{H, H^{-1}} (1^n) = 1) | < 1/p(n) |$$ where $P^{-1}$ is the inverse of the permutation $P$, $H$ is an ideal random permutation generator that produces a permutation with a uniform probability distribution, and $H^{-1}$ is the inverse of $H$. \end{definition} Luby and Rackoff show that it is possible to build a super pseudo-random permutation generator by using a pseudo-random function and a four rounds balanced Feistel network structure. \begin{example} A four rounds balanced Feistel network that uses pseudo-random functions $f_1, f_2, f_3, f_4$ is a super pseudo-random permutation generator and is defined as $$D_{f_4} \circ D_{f_3} \circ D_{f_2} \circ D_{f_1} (L \| R) \stackrel{def}{=} D_{f_4} (D_{f_3} (D_{f_2} (D_{f_1} (L \| R))))$$ where $D_{f_i} (L \| R) = (R \| L \oplus f_i(R))$ and $|L| = |R|$. \end{example} If a block cipher is a pseudo-random permutation generator, then it becomes a secure block cipher for a chosen-plaintext attack. If a block cipher is a super pseudo-random permutation generator, then it becomes a secure block cipher for a chosen-plaintext attack and a chosen-ciphertext attack. \section{Pseudo-Random Permutation Generator} The research on pseudo-random permutation generators has been started by Luby and Rackoff. They have proved that a three rounds balanced Feistel network that uses pseudo-random functions is a pseudo-random permutation generator \cite{LubyR88}. The proof of pseudo-random permutation is largely divided into two parts. First, the proof show that a three rounds Feistel network that uses ideal random functions becomes a pseudo-random permutation generator. Next, the proof show that that a three rounds Feistel network that uses pseudo-random functions is pseudo-random by using contradiction. The proof that shows the pseudo-randomness of the three rounds Feistel network that uses ideal random functions looks like this. First, we define $BAD$ as an event that a machine can distinguish a balanced Feistel permutation generator $P$ from an ideal permutation generator $K$. Next the proof show that $P$ is the same as $K$ if the $BAD$ event does not occur, and it also show that the probability of the $BAD$ event is very low. To prove that a three rounds Feistel network that uses pseudo-random functions is pseudo-random by using contradiction. In other words, if the three rounds Feistel network that uses ideal random functions is pseudo-random, but the three rounds Feistel network that uses pseudo-random functions is not pseudo-random, then it is possible to derive a contradiction on the assumption that pseudo-random functions are pseudo-random. There have been some studies to simply prove the pseudo-randomness of permutation generators since the work of Luby and Rackoff. Maurer used a local random function instead of a pseudo-random function to show that a three rounds Feistel network is a pseudo-random permutation generator \cite{Maurer92}. Naor and Reingold have proved that a three rounds structure that uses a pairwise independent permutation and a two rounds Feistel network is pseudo-random \cite{NaorR99}. After the work of Luby and Rackoff, much research focused to build pseudo-random permutation generators by using balanced Feistel networks and pseudo-random functions with small number of rounds. That is, if we use pseudo-random functions with small number of rounds, then the size of keys used in the permutation can be decreased since the size of keys for pseudo-random functions is large. Let $f, g, h, e$ be pseudo-random functions, and $f^i$ be the composition of the function $f$ with $i$ times. The results are summarized as follows. \begin{itemize} \item $D_f \circ D_f \circ D_f$ and $D_f \circ D_g \circ D_f$ are not pseudo-random permutations \cite{Rueppel90}. \item $D_g \circ D_g \circ D_f$ and $D_g \circ D_f \circ D_f$ are not pseudo-random permutations \cite{Ohnishi88,ZhengMI90o}. \item $D_g \circ D_g \circ D_f \circ D_f$ is not a super pseudo-random permutation \cite{SadeghiyanP92}. \item For all $i, j, k \geq 1$, $D_{f^k} \circ D_{f^j} \circ D_{f^i}$ is not a pseudo-random permutation \cite{ZhengMI90i}. \item For all $i, j, k, \ell \geq 1$, $D_{f^\ell} \circ D_{f^k} \circ D_{f^j} \circ D_{f^i}$ is not a super pseudo-random permutation \cite{SadeghiyanP92}. \item $D_{f^2} \circ D_{f} \circ D_{f} \circ D_{f}$ is a pseudo-random permutation \cite{Pieprzyk91}. \item If $I$ is an identity function, $D_{f^2} \circ D_{I} \circ D_{f} \circ D_{f^2} \circ D_{I} \circ D_{f}$ is a super pseudo-random permutation \cite{SadeghiyanP92}. \item If $\zeta$ is a simple function like a shift operation, $D_{f \circ \zeta \circ f} \circ D_{f} \circ D_{f} \circ D_{f}$ is a pseudo-random permutation and $D_{f \circ \zeta \circ f} \circ D_{f} \circ D_{f} \circ D_{f} \circ D_{f}$ is a super pseudo-random permutation \cite{Patarin92h}. \end{itemize} Although many studies are concerned with the use of a small number of pseudo-random functions, reducing the size of the secret key using fewer pseudo-random functions is not a huge benefit. This is because it is possible to increase a small key to a large key using a pseudo random bit generator. \begin{figure}[t] \centering \includegraphics[scale=0.75]{fig_naor_reingold_prp} \caption{Naor and Reingold's PRP} \label{fig:nr_prp} \end{figure} \begin{figure}[t] \centering \includegraphics[scale=0.75]{fig_jutla_prp} \caption{Jutla's PRP} \label{fig:jutla_prp} \end{figure} Research to build pseudo-random permutation generators from unbalanced Feistel network structures has only recently begun \cite{NaorR99,Jutla98}. Naor and Reingold showed that an unbalanced Feistel network with total $k+2$ number of rounds is a pseudo-random permutation generator if it uses a pairwise independent permutation in the first round, a source-heavy unbalanced Feistel network where the size of a source block is $k$ times larger than a target-block in the remaining rounds, and the $F$ function of the Feistel network is a pseudo-random function \cite{NaorR99}. The pairwise independent permutation is defined as a permutation in which the distribution of the function output values ​​is uniform even if any two input values ​​are selected. The pseudo-random permutation generator of Naor and Reingold is given in Figure \ref{fig:nr_prp} where $k$ is two, $h_1$ is a pairwise independent of permutation, and $f_1, f_2$, and $f_3$ are pseudo-random functions. Jutla showed that an unbalanced Feistel network with total $2k+2$ number of rounds is a pseudo-random permutation generator if it uses a pseudo-random function for the $F$-function of the Feistel network, and a target-heavy unbalanced Feistel network where a target-block size is larger than a source block by $k$ times \cite{Jutla98}. At this time, the probability that an oracle machine that distinguishes between an ideal random permutation generator and a $2k+2$ rounds target-heavy unbalanced Feistel network is less than $(m^k / 2^{kn})$. The pseudo-random permutation generator of Jutla is given in Figure \ref{fig:jutla_prp} where $k$ is two and total rounds is six. \chapter{Analysis of Unbalanced Feistel Networks} \label{chap:analysis-ufn} In this chapter, we analyze the conditions for permutation generators based on Feistel networks to be pseudo-random. This chapter is summarized as follows. An unbalanced Feistel network is a Feistel network with different sizes of source and target blocks. The unbalanced Feistel network is largely divided into a source-heavy unbalanced Feistel network and a target-heavy unbalanced Feistel network. For a source-heavy unbalanced Feistel network ($kn$:$n$-UFN) where a source block is $k$ times larger than a target block, a $k+2$ rounds $kn$:$n$-UFN using pseudo-random functions is a pseudo-random permutation generator. For a target-heavy unbalanced Feistel network ($n$:$kn$-UFN) where a target-block is $k$ times larger than a source block, a $k+2$ rounds $n$:$kn$-UFN using pseudo-random functions is a pseudo-random permutation generator. Therefore, the minimum number of rounds for a unbalanced Feistel network using pseudo-random functions to be pseudo-random is $k+2$ rounds. The structure of this chapter is as follows. In Section 3.1, we divide unbalanced Feistel networks into two categories. In Section 3.2, we overview the proof method to prove the pseudorandomness of an unbalanced Feistel network. In Section 3.3, we analyze the conditions for a source-heavy unbalanced Feistel network to be pseudo-random. In Section 3.4, we analyze the conditions for a target-heavy unbalanced Feistel network to be pseudo-random. \section{Definition and Category} In a Feistel network, a block that is the input of a round function is called a source block, and a block that is combined with the output of a round function is called a target block. An unbalanced Feistel network is a Feistel network with different source and target block sizes. An unbalanced Feistel network with a source-block size of $s$ bits and a target block size of $t$ bits is denoted as $s$:$t$-UFN. \begin{figure} \centering \includegraphics[scale=0.75]{fig_3r_2nn_ufn} \caption{The structure of a 3 rounds $2n$:$n$-UFN} \label{fig:3r_2nn_ufn} \end{figure} An unbalanced Feistel network is largely classified as a source-heavy unbalanced Feistel network or a target-heavy unbalanced Feistel network. A source-heavy unbalanced Feistel network is an unbalanced Feistel network where the size of a source block is larger than that of a target block. The source-heavy unbalanced Feistel network is denoted by $kn$:$n$-UFN and it is defined as follows. For instance, a 3 rounds $2n$:$n$-UFN structure is described in Figure \ref{fig:3r_2nn_ufn}. \begin{definition}[$kn$:$n$-UFN] \label{def:knn-ufn} For any function $f$ belonging to the set of functions $F:I_{kn} \rightarrow I_n$, one round $kn$:$n$-UFN is defined by the following permutation $$D_f (L \| R_1 \| \cdots \| R_k) \stackrel{def}{=} (R_1 \| \cdots \| R_k \| L \oplus f(R_1 \| \cdots R_k)).$$ Similarly, for any functions $f_1, f_2, \ldots, f_r$ belonging to the set of functions $F:I_{kn} \rightarrow I_n$, an $r$ rounds $kn$:$n$-UFN is defined by the following permutation $$D_{f_r} \circ \cdots \circ D_{f_2} \circ D_{f_1} (L^0 \| R_1^0 \| \cdots \| R_k^0) \stackrel{def}{=} D_{f_r} \circ \cdots \circ D_{f_2} ( D_{f_1} (L^0 \| R_1^0 \| \cdots \| R_k^0) ).$$ In this case, we have $|L| = |R_i| = n$. \end{definition} \begin{figure} \centering \includegraphics[scale=0.75]{fig_3r_n2n_ufn} \caption{The structure of a 3 rounds $n$:$2n$-UFN} \label{fig:3r_n2n_ufn} \end{figure} A target-heavy unbalanced Feistel network is an unbalanced Feistel network where the size of a target block is larger than that of a source block. The target-heavy unbalanced Feistel network is denoted by $n$:$kn$-UFN and it is defined as follows. For instance, a 3 rounds $n$:$2n$-UFN structure is described in Figure \ref{fig:3r_n2n_ufn}. \begin{definition}[$n$:$kn$-UFN] For any function $f$ belonging to the set of functions $F:I_{n} \rightarrow I_{kn}$, one round $n$:$kn$-UFN is defined by the following permutation $$D_f (L_1 \| \cdots \| L_k \| R) \stackrel{def}{=} (R \| ( L_1 \| \cdots \| L_k ) \oplus f(R)) = (R \| L_1 \oplus C_1(f(R)) \| \cdots \| C_k(f(R))).$$ In this case, the function $C(\cdot)$ satisfies $C_1(f(R)) \| \cdots \| C_k(f(R)) = f(R)$. Similarly, for any functions $f_1, f_2, \ldots, f_r$ belonging to the set of functions $F:I_{n} \rightarrow I_{kn}$, an $r$ rounds $n$:$kn$-UFN is defined by the following permutation $$D_{f_r} \circ \cdots \circ D_{f_2} \circ D_{f_1} (L_1^0 \| \cdots \| L_k^0 \| R^0) \stackrel{def}{=} D_{f_r} \circ \cdots \circ D_{f_2} ( D_{f_1} (L_1^0 \| \cdots \| L_k^0 \| R^0) ).$$ In this case, we have $|L_i| = |R| = |C_i(\cdot)| = n$. \end{definition} \section{Overview of the Pseudo-Random Proof} We first overview the way to prove that an $r$ rounds unbalanced Feistel network using a pseudo-random function generator is a pseudo-random permutation generator. The overall method is similar to the method used by Luby and Rackoff \cite{LubyR88}. First, we show that an $r-1$ rounds unbalanced Feistel network is not a pseudo-random permutation generator. For this, we show that there exists a linear relationship between the input and output values ​​of the $r-1$ rounds unbalanced Feistel network. Then we use this linear relationship to build an oracle machine that distinguishes between an ideal random permutation generator and the $r-1$ rounds unbalanced Feistel network permutation generator. Next, we show that if an $r$ rounds unbalanced Feistel network that uses ideal random functions is pseudo-random, then an $r$ rounds unbalanced Feistel network that uses pseudo-random functions is also pseudo-random. This is because if the $r$ rounds unbalanced Feistel network using ideal random functions is pseudo-random but the $r$ rounds unbalanced Feistel network using pseudo-random functions is not pseudo-random, then it is possible to show an contradiction that the pseudo-random function is pseudo-random. The following is a proof strategy to showing that an $r$ rounds unbalanced Feistel network using ideal random functions is pseudo-random. We first define the case where the $r$ rounds unbalanced Feistel network is not a pseudo-random permutation generator as a BAD event. For the BAD event, we prove the following two things. \begin{enumerate} \item If the BAD event does not occur, the output of the $r$ rounds unbalanced Feistel network that uses ideal random functions is uniform. \item The probability of the BAD event is very low. \end{enumerate} By using these two things, we can prove that the $r$ rounds Feistel network using ideal random functions is a pseudo-random permutation generator. \section{The Pseudo-Random Proof of $kn$:$n$-UFN} \label{sec:analysis-knn-ufn} The following theorem show that a $kn$:$n$-UFN is not pseudo-random if the number of rounds is less than or equal to $k+1$. \begin{theorem} \label{thm:k+1_knn_ufn_not_prp} A $k+1$ rounds $kn$:$n$-UFN is not pseudo-random. \end{theorem} \begin{proof} For the proof, we first show that there is a linear relationship between the input and output values ​​of the $kn$:$n$-UFN, and that this linear relationship can be used to create an oracle machine that can distinguish between an ideal random permutation generator and the $kn$:$n$-UFN. From the definition of a $kn$:$n$-UFN, we first obtains the following equation $$L^{k+1} = R_1^k = R_2^{k-1} = \cdots = R_k^1 = L^0 \oplus f(R_1 \| \cdots \| R_k).$$ We select two oracle queries $x_p = (L_p^0 \| R_{p,1}^0 \| \cdots \| R_{p,k}^0 )$ and $x_q = ( L_q^0 \| R_{q,1}^0 \| \cdots \| R_{q,k}^) )$ where $p$ and $q$ are indexes of two oracle queries with $1 \leq p < q \leq m$. Then, we have $L_p^{k+1} = L_p^0 \oplus f_1(R_{p,1}^0 \| \cdots \| R_{p,k}^0 )$ and $L_q^{k+1} = L_q^0 \oplus f_1(R_{q,1}^0 \| \cdots \| R_{q,k}^0 )$. Therefore, if we choose two oracle queries $x_p$ and $x_q$ in which $L_p^0$ and $L_q^0$ are only different, then we can derive the following relation $$L_p^{k+1} \oplus L_q^{k+1} = L_p^0 \oplus L_q^0$$ since $f_1(R_{p,1}^0 \| \cdots \| R_{p,k}^0 ) = f_1(R_{q,1}^0 \| \cdots \| R_{q,k}^0 )$. This linear relation can be used to build an oracle machine $M$ that distinguishes between the $kn$:$n$-UFN and an ideal random permutation generator. First, the oracle machine creates two oracle queries $x_p$ and $x_q$ that differ only in $L^0$ values and receives the responses $<x_p, y_p>, <x_q, y_q>$. If the equation $L_p^{k+1} \oplus L_q^{k+1} = L_p^0 \oplus L_q^0$ is satisfied from the responses of the queries, then the oracle machine outputs $1$. Otherwise, the oracle machine outputs $0$. Thus, if the $x_p$ and $x_q$ values ​​are generated by the $kn$:$n$-UFN, then the output of the oracle machine is always $1$. However, if the $x_p$ and $x_q$ values are generated by the ideal random permutation generator, then the probability that the equation is satisfied is $1 / 2^n$. Therefore we have the following equation $$\big| \Pr (M^P(1^{(k+1)n}) = 1) - \Pr (M^K(1^{(k+1)n} = 1) \big| = 1 - 1/2^n > 1/p(n)$$ where $P$ is the $kn$:$n$-UFN and $K$ is the ideal random permutation generator. From this equation, the $k+1$ rounds $kn$:$n$-UFN is not pseudo-random. \end{proof} We now prove that a $k+2$ rounds $kn$:$n$-UFN permutation generator using pseudo-random functions is pseudo-random. First, we define an event that can be used to distinguish a $k+2$ rounds $kn$:$n$-UFN using ideal random functions from an ideal random permutation generator as the following BAD event. \begin{definition}(The BAD event $\xi$ of a $k+2$ rounds $kn$:$n$-UFN) \label{def:bad-knn-ufn} A random variable $\xi^i$ is defined as an event in which $R_{p,1}^i \| \cdots \| R_{p,k}^i$ and $R_{q,1}^i \| \cdots \| R_{q,k}^i$ of two oracle queries with indexes $p$ and $q$ are equal where $1 \leq p < q \leq m$. The BAD event $\xi$ is a random variable defined as $\vee_{i=1}^{k+1} \xi^i$. \end{definition} If an oracle machine is able to distinguish between a $k+2$ rounds $kn$:$n$-UFN and an ideal random permutation generator, then the BAD event must occur. This means that if the BAD event does not occur, then the $k+2$ rounds $kn$:$n$-UFN is equal to the ideal random permutation generator. In the following lemma, we prove it. \begin{lemma} \label{lem:knn_ufn_not_bad} A $k+2$ rounds $kn$:$n$-UFN permutation generator using an ideal random function generator is equal to an ideal random permutation generator if the BAD event does not occur. That is, for all possible $\sigma_1, \sigma_2, \ldots, \sigma_m \in \bits^{(k+1)n}$, we have $$\Pr (\wedge_{i=1}^m (y_i = \sigma_i) | \neg\xi) = 1/2^{(k+1)nm}$$ where $y_i$ is the output of the $k+2$ rounds $kn$:$n$-UFN permutation generator. \end{lemma} \begin{proof} From the definition of a $k+2$ rounds $kn$:$n$-UFN using ideal random functions, the reply $y_p$ of the $p$th oracle machine query $x_p$ is described as \begin{align*} y_p &= (L_p^{k+2} \| R_{p,1}^{k+2} \| \cdots \| R_{p,k}^{k+2}) \\ &= (L_p^1 \oplus h_2(\cdot) \| L_p^2 \oplus h_3(\cdot) \| \cdots \| L_p^{k+1} \oplus h_{k+2}(\cdot)) \end{align*} where $h_1, h_2, \ldots, h_{k+2}$ are functions generated by an ideal random function generator whose inputs are $kn$ bits and whose outputs are $n$ bits, and the input values ​​of $h_i(\cdot)$ are $(R_{p,1}^{i-1} \| \cdots \| R_{p,k}^{i-1})$. By the definition of the BAD event $\xi$, we obtain the following equation $$\neg \xi = \wedge_{i=1}^{k+1} \neg \xi^i = \wedge_{i=1}^{k+1} (R_{p,1}^{i} \| \cdots \| R_{p,k}^{i} \neq R_{q,1}^{i} \| \cdots \| R_{q,k}^{i})$$ where $p$ and $q$ are the oracle indexes with $1 \leq p < q \leq m$. Thus the output value of $h$ becomes a value with uniform distribution since the input values ​​of $h_2, \ldots, h_{k+2}$ are different for all oracle queries and $h$ is a function generated by the ideal random function generator. Therefore, the value of $L^{i-1} \oplus h_i(\cdot)$ becomes a value with uniform distribution. \end{proof} \begin{lemma} \label{lem:knn_ufn_bad} The probability of the BAD event in a $k+2$ rounds $kn$:$n$-UFN permutation generator is bounded by $$\Pr(\xi) \leq (k+1) m^2 / 2^{n+1}.$$ \end{lemma} \begin{proof} By the definition of the BAD event, we have $\xi = \vee_{i=1}^{k+1} \xi^i$. We first calculate the probability of each event $\xi^i$. A random variable $\xi^i$ represents an event that $R_{p,1}^i \| \cdots \| R_{p,k}^i$ and $R_{q,1}^i \| \cdots \| R_{q,k}^i$ are equal for the indexes $p$ and $q$ of the oracle queries with $1 \leq p < q \leq m$. By the definition of a $kn$:$n$-UFN structure, we obtain the following equation \begin{align*} & R_1^i \| \cdots \| R_{k-i}^i \| R_{k-i+1}^i \| \cdots \| R_k^i \\ &= R_{i+1}^0 \| \cdots \| R_{k}^0 \| L^0 \oplus h_1(\cdot) \| \cdots \| L^{i-1} \oplus h_i(\cdot) \end{align*} where each $h_i(\cdot)$ is a function generated by an ideal random function generator. Thus, the best choice for the event $\xi^i$ to occur is to select an oracle query with $R_{p,j}^0 = R_{q,j}^0$ for $i+1 < j < k$. In this case, the probability of the event $\xi^i$ is $\Pr (\xi^i) = {}_mC_2 \cdot 1 / 2^{in}$. Therefore, we have $\Pr (\xi) < (k +1) m^2 / 2^{n+1}$. \end{proof} In Theorem \ref{thm:k+2_knn_ufn_prp}, we prove that a $k+2$ rounds $kn$:$n$-UFN that uses ideal random functions is pseudo-random from the above two lemmas, and we also prove that a $k+2$ rounds $kn$:$n$-UFN that uses pseudo-random functions is also pseudo-random. \begin{theorem} \label{thm:k+2_knn_ufn_prp} A $k+2$ rounds $kn$:$n$-UFN permutation generator using pseudo-random functions is a pseudo-random permutation generator. \end{theorem} \begin{proof} From Lemma \ref{lem:knn_ufn_not_bad} and Lemma \ref{lem:knn_ufn_bad}, we can show that a $kn$:$n$-UFN permutation generator $P$ using an ideal random function generator is a pseudo-random permutation generator. First, we have $| \Pr (M^P(1^{(k+1)n}) = 1 | \neg \xi) - \Pr (M^K (1^{(k+1)n}) = 1) | = 0$ since $P$ is the same as an ideal random permutation generator $K$ when the BAD event $\xi$ does not occur by Lemma \ref{lem:knn_ufn_not_bad}. We also have $| \Pr (M^P(1^{(k+1)n}) = 1 | \xi) - \Pr (M^K (1^{(k+1)n}) = 1) | \leq 1$ since the absolute value of the probability difference is less than 1. Therefore, we have the following equation \begin{align*} & \big| \Pr (M^P(1^{(k+1)n}) = 1) - \Pr (M^K(1^{(k+1)n}) = 1) \big| \\ &= \big| \Pr (M^P(1^{(k+1)n}) = 1 | \xi) - \Pr (M^K(1^{(k+1)n}) = 1) \big| \cdot \Pr(\xi) + \\ &\quad~ \big| \Pr (M^P(1^{(k+1)n}) = 1 | \neg \xi) - \Pr (M^K(1^{(k+1)n}) = 1) \big| \cdot \Pr(\neg \xi) \\ &\leq \Pr(\xi) \leq (k+1)m^2 / 2^{n+1}. \end{align*} We now show that a $k+2$ rounds $kn$:$n$-UFN permutation generator $P$ using a pseudo-random function generator is a pseudo-random permutation generator. For this, we use the proof by contradiction. That is, if a $k+2$ rounds $kn$:$n$-UFN using an ideal random function generator is pseudo-random but a $k+2$ rounds $kn$:$n$-UFN using a pseudo-random function generator is not pseudo-random, then we can derive a contradiction to the pseudo-randomness of the pseudo-random function generator. Suppose that a $kn$:$n$-UFN permutation generator $P$ using a pseudo-random function generator is not pseudo-random. Then there exists an oracle machine $M$ which distinguishes an ideal random permutation generator $K$ and $P$ with a probability greater than $1/n^c$ for a constant $c$. First, we let $D_{f_{k+2}} \circ \cdots \circ D_{f_{i+1}} \circ D_{h_i} \circ \cdots \circ D_{h_1}(\cdot)$ be a permutation generator in which an ideal random function generator is used from the first round to the $i$th round and a pseudo-random function generator is used from the $i+1$th round to the $k+2$th round in a $kn$:$n$-UFN permutation generator for $i$ with $0 \leq i \leq k + 2$. Let $p_i^D$ be the probability that an oracle machine that has access to this permutation generator will output $1$. That is, \begin{align*} p_i^D = \Pr (M^{D_{f_{k+2}} \circ \cdots \circ D_{f_{i+1}} \circ D_{h_i} \circ \cdots \circ D_{h_1}} (1^{(k+1)n}) = 1) \end{align*} where $f_{i+1}, \ldots, f_{k+2}$ are functions generated by a pseudo-random function generator and $h_1, \ldots, h_i$ are functions generated by an ideal random function generator. Let $p^K$ be the probability that an oracle machine that has access to the ideal random permutation generator will output $1$. Since we supposed that the $k+2$ rounds $kn$:$n$-UFN using a pseudo-random function generator is not pseudo-random, we get the following equation \begin{align*} 1/n^c &\leq | p^K - p_0^D | \\ &\leq | p^K - p_{k+2}^D | + | p_{k+2}^D - p_{k+1}^D | + \cdots + | p_{i+1}^D - p_{i}^D | + \cdots + | p_1^D - p_0^D |. \end{align*} However, since the $k+2$ rounds $kn$:$n$-UFN using an ideal random function generator has been shown to be a pseudo-random permutation generator, we have $| P^K - P_{k+2}^D | \leq (k+1) m^2 / 2^{n+1}$. Therefore, we have $| p_{i+1}^D - p_{i}^D | \geq 1 / (k+3)n^c$ for some $i$. By using this, an oracle machine $C$ that distinguishes an ideal random function generator and a pseudo-random function generator with a probability higher than $1 / (k+3)n^c$ can be constructed as follows. In the oracle machine $C$, we first change the part of $C$ that calculates the oracle query reply to $D_{f_{k+2}} \circ \cdots \circ D_{f_{i+1}} \circ D_X \circ D_{h_{i-1}} \circ \cdots \circ D_{h_1} (\cdot)$. In this case, $X$ is a function whose input is $kn$ bits and whose output is $n$ bits. If $X$ in $C$ is a function generated by a pseudo-random function generator $F$, then we have $p_{i}^D = \Pr (C^F (1^{kn}) = 1)$. On the other hand, if $X$ in $C$ is a function generated by an ideal random function generator $H$, then we have $p_{i+1}^D = \Pr (C^H (1^{kn}) = 1)$. However, it is possible to distinguish the ideal random function generator and the pseudo-random function generator with a probability greater than $1/(k+3)n^c$ since $| p_{i+1}^D - p_{i}^D | \geq 1/(k+3)n^c$. But this contradicts that the pseudo-random function generator is pseudo-random. Therefore, the $k+2$ rounds $kn$:$n$-UFN using a pseudo-random function generator is a pseudo-random permutation generator. \end{proof} From Theorem \ref{thm:k+1_knn_ufn_not_prp} and Theorem \ref{thm:k+2_knn_ufn_prp}, the minimum number of rounds of the $kn$:$n$-UFN permutation generator using a pseudo-random function generator to be pseudo-random is $k+2$. \section{The Pseudo-Random Proof of $n$:$kn$-UFN} \label{sec:analysis-nkn-ufn} The following theorem show that a $n$:$kn$-UFN permutation generator is not pseudo-random if the number of rounds is less than or equal to $k+1$. \begin{theorem} \label{thm:k+1_nkn_ufn_not_prp} A $k+1$ rounds $n$:$kn$-UFN permutation generator is not pseudo-random. \end{theorem} \begin{proof} From the definition of a $n$:$kn$-UFN, we obtain the following equation \begin{align*} L_1^{k+1} &= R^k = L_k^{k-1} \oplus C_k(f_k(R^{k-1})) \\ &= L_{k-1}^{k-2} \oplus C_{k-1}(f_{k-1}(R^{k-2})) \oplus C_{k}(f_{k}(R^{k-1})) \\ &\quad \vdots \\ &= L_1^0 \bigoplus_{i=1}^{k} C_i(f_i(R^{i-1})). \end{align*} If we choose two oracle queries $x_p$ and $x_q$ in which $L_p^0$ and $L_q^0$ are only different, then we have $R_p^i = R_q^i$ for all $i$ with $1 \leq i \leq k-1$. Therefore, from the oracle responses $<x_p, y_p>, <x_q, y_q>$, we can derive the following relation \begin{align*} L_{p,1}^{k+1} \oplus L_{q,1}^{k+1} = L_{p,1}^0 \oplus L_{q,1}^0. \end{align*} By using this linear relation, we can build an oracle machine $M$ that distinguishes between an $n$:$kn$-UFN permutation generator and an ideal random permutation generator. First, the oracle machine creates two oracle queries $x_p$ and $x_q$ that differ only in $L_1^0$ values and receives oracle responses $<x_p, y_p>, <x_q, y_q>$. If the equation $L_{p,1}^{k+1} \oplus L_{q,1}^{k+1} = L_{p,1}^0 \oplus L_{q,1}^0$ is satisfied from the responses of the queries, then the oracle machine outputs $1$. Otherwise, the oracle machine outputs $0$. Thus, if the $x_p$ and $x_q$ values ​​are generated by the $n$:$kn$-UFN, then the output of the oracle machine is always $1$. However, if the $x_p$ and $x_q$ values are generated by the ideal random permutation generator, then the probability that the relation is satisfied is $1/2^n$. Therefore we have the following equation \begin{align*} \big| \Pr (M^P(1^{(k+1)n}) = 1) - \Pr (M^K(1^{(k+1)n} = 1) \big| = 1 - 1/2^n > 1/p(n) \end{align*} where $P$ is the $n$:$kn$-UFN and $K$ is the ideal random permutation generator. Thus the $k+1$ rounds $n$:$kn$-UFN permutation generator is not pseudo-random. \end{proof} We now prove that a $k+2$ rounds $n$:$kn$-UFN permutation generator using pseudo-random functions is pseudo-random. First, we define an event that can be used to distinguish a $k+2$ rounds $n$:$kn$-UFN using ideal random functions from an ideal random permutation generator as the following BAD event. \begin{definition}(The BAD event $\xi$ of a $k+2$ rounds $n$:$kn$-UFN) \label{def:bad-k+2-nkn-ufn} A random variable $\xi^i$ is defined as an event in which $R_{p}^i$ and $R_{q}^i$ of two oracle queries with indexes $p$ and $q$ are equal where $1 \leq p < q \leq m$. The BAD event $\xi$ is a random variable defined as $\vee_{i=k}^{k+1} \xi^i$. \end{definition} \begin{lemma} \label{lem:nkn_ufn_not_bad} A $k+2$ rounds $n$:$kn$-UFN permutation generator using an ideal random function generator is equal to an ideal random permutation generator if the BAD event does not occur. That is, for all possible $\sigma_1, \sigma_2, \ldots, \sigma_m \in \bits^{(k+1)n}$, we have $$\Pr (\wedge_{i=1}^m (y_i = \sigma_i) | \neg \xi) = 1/2^{(k+1)nm}$$ where $y_i$ is the output of the $k+2$ rounds $n$:$kn$-UFN permutation generator. \end{lemma} \begin{proof} From the definition of a $k+2$ rounds $n$:$kn$-UFN, the reply $y_p$ of the $p$th oracle machine query $x_p$ is described as \begin{align*} y_p &= (L_{p,1}^{k+2} \| L_{p,2}^{k+2} \| \cdots \| L_{p,k}^{k+2} \| R_p^{k+2}) \\ &= (R_p^{k+1} \| L_{p,2}^{k+2} \| \cdots \| L_{p,k}^{k+2} \| R_p^{k+2}) \\ &= (R_p^{k+1} \| (L_{p,1}^{k+1} \| \cdots \| L_{p,k-1}^{k+1} \| L_{p,k}^{k+1}) \oplus h_{k+2}(R_p^{k+1})) \\ &= (L_{p,k}^k \oplus C_k(h_{k+1}(R_p^k)) \| (L_{p,1}^{k+1} \| \cdots \| L_{p,k-1}^{k+1} \| L_{p,k}^{k+1}) \oplus h_{k+2}(R_p^{k+1})) \end{align*} where $h_{k+1}, h_{k+2}$ are functions generated by an ideal random function generator whose inputs are $n$ bits and whose outputs are $kn$ bits. By the definition of the BAD event $\xi$, we obtain the following equation \begin{align*} \neg \xi = \wedge_{i=1}^{k+1} \neg \xi^i = (R_p^k \neq R_q^k) \wedge (R_p^{k+1} \neq R_q^{k+1}) \end{align*} where $q$ and $p$ are the oracle indexes with $1 \leq p < q \leq m$. Thus the output values of $h_{k+1}, h_{k+2}$ become values with uniform distribution since the input values ​​of $h_{k+1}, h_{k+2}$ are different for all oracle queries and $h_{k+1}, h_{k+2}$ are functions generated by the ideal random function generator. \end{proof} \begin{lemma} \label{lem:nkn_ufn_bad} The probability of the BAD event in a $k+2$ rounds $n$:$kn$-UFN permutation generator is bounded by $$\Pr(\xi) \leq m^2 / 2^n.$$ \end{lemma} \begin{proof} For the proof, we should show that $\Pr(\xi^k) \leq m^2 / 2^{n+1}$ and $\Pr(\xi^{k+1}) \leq m^2 / 2^{n+1}$ since $Pr(\xi) = \Pr(\xi^k) + \Pr(\xi^{k+1})$ by the definition of the BAD event $\xi$. First, we show that $\Pr(\xi^k) \leq m^2 / 2^{n+1}$. By the definition of $\xi^k$, we have $\Pr(\xi^k) = \Pr(R_p^k = R_q^k)$ for the oracle query indexes $p$ and $q$ with $1 \leq p < q \leq m$. Thus we obtain the following equation \begin{align*} \Pr(R_p^k = R_q^k) &= \left\{ \begin{array}{ll} \Pr(L_{p,k}^{k-1} \| R_p^{k-1} = L_{q,k}^{k-1} \| R_q^{k-1}) & \text{ if } L_{p,k}^{k-1} \| R_p^{k-1} = L_{q,k}^{k-1} \| R_q^{k-1} \\ 1/2^n & \text{ otherwise. } \end{array} \right. \end{align*} Similarly, we can obtain the following equation \begin{align*} &\Pr(L_{p,i+1}^{i} \| \cdots \| R_p^{i} = L_{q,i+1}^{i} \| \cdots \| R_q^{i}) \\ &= \left\{ \begin{array}{ll} \Pr(L_{p,i}^{i-1} \| \cdots \| R_p^{i-1} = L_{q,i}^{i-1} \| \cdots \| R_q^{i-1}) & \text{ if } L_{p,i}^{i-1} \| \cdots \| R_p^{i-1} = L_{q,i}^{i-1} \| \cdots \| R_q^{i-1} \\ 1/2^{(k+1-i)n} & \text{ otherwise } \end{array} \right. \end{align*} Since each oracle query should be different, we have $\Pr(L_{p,1}^0 \| \cdots \| L_{p,k}^0 \| R_p^0 = L_{q,1}^0 \| \cdots \| L_{q,k}^0 \| R_q^0) = 0$ for oracle query indexes $p$ and $q$ with $1 \leq p < q \leq m$. Thus, we have \begin{align*} \Pr(\xi^k) = {}_mC_2 \cdot \Pr(R_p^k = R_q^k) = {}_mC_2 \left( \frac{1}{2^n} + \cdots + \frac{1}{2^{kn}} \right) \leq \frac{m^2}{2^{n+1}}. \end{align*} By using similar approach, we have $\Pr(\xi^{k+1}) \leq m^2 / 2^{n+1}$. Therefore, we obtain $\Pr(\xi) = \Pr(\xi^k) + \Pr(\xi^{k+1}) \leq m^2 / 2^{n}$. \end{proof} In Theorem \ref{thm:k+2_nkn_ufn_prp}, we prove that a $k+2$ rounds $n$:$kn$-UFN that uses ideal random functions is pseudo-random from the above two lemmas, and we also prove that a $k+2$ rounds $n$:$kn$-UFN that uses pseudo-random functions is also pseudo-random. \begin{theorem} \label{thm:k+2_nkn_ufn_prp} A $k+2$ rounds $n$:$kn$-UFN permutation generator using a pseudo-random function generator is a pseudo-random permutation generator. \end{theorem} \begin{proof} From Lemma \ref{lem:nkn_ufn_not_bad} and Lemma \ref{lem:nkn_ufn_bad}, we can show that an $n$:$kn$-UFN permutation generator $P$ that uses an ideal random function generator is a pseudo-random permutation generator. First, we have $| \Pr (M^P(1^{(k+1)n}) = 1 | \neg \xi) - \Pr (M^K (1^{(k+1)n}) = 1) | = 0$ since $P$ is the same as an ideal random permutation generator $K$ when the BAD event $\xi$ does not occur by Lemma \ref{lem:nkn_ufn_not_bad}. We also have $| \Pr (M^P(1^{(k+1)n}) = 1 | \xi) - \Pr (M^K (1^{(k+1)n}) = 1) | \leq 1$ since the absolute value of the probability difference is less than 1. Therefore, we have the following equation \begin{align*} & \big| \Pr (M^P(1^{(k+1)n}) = 1) - \Pr (M^K(1^{(k+1)n}) = 1) \big| \\ &= \big| \Pr (M^P(1^{(k+1)n}) = 1 | \xi) - \Pr (M^K(1^{(k+1)n}) = 1) \big| \cdot \Pr(\xi) + \\ &\quad~ \big| \Pr (M^P(1^{(k+1)n}) = 1 | \neg \xi) - \Pr (M^K(1^{(k+1)n}) = 1) \big| \cdot \Pr(\neg \xi) \\ &\leq \Pr(\xi) \leq m^2 / 2^{n}. \end{align*} We now show that a $k+2$ rounds $n$:$kn$-UFN permutation generator $P$ using a pseudo-random function generator is a pseudo-random permutation generator. For this, we use the proof by contradiction. That is, if a $k+2$ rounds $n$:$kn$-UFN using an ideal random function generator is pseudo-random but a $k+2$ rounds $n$:$kn$-UFN using a pseudo-random function generator is not pseudo-random, then we can derive a contradiction to the pseudo-randomness of the pseudo-random function generator. Suppose that an $n$:$kn$-UFN permutation generator $P$ using a pseudo-random function generator is not pseudo-random. Then there exists an oracle machine $M$ which distinguishes an ideal random permutation generator $K$ and $P$ with a probability greater than $1/n^c$ for a constant $c$. First, we let $D_{f_{k+2}} \circ \cdots \circ D_{f_{i+1}} \circ D_{h_i} \circ \cdots \circ D_{h_1}(\cdot)$ be a permutation generator in which an ideal random function generator is used from the first round to the $i$th round and a pseudo-random function generator is used from the $i+1$th round to the $k+2$th round in the $n$:$kn$-UFN permutation generator for $i$ with $0 \leq i \leq k+2$. Let $p_i^D$ be the probability that an oracle machine that has access to this permutation generator will output $1$. That is, \begin{align*} p_i^D = \Pr (M^{D_{f_{k+2}} \circ \cdots \circ D_{f_{i+1}} \circ D_{h_i} \circ \cdots \circ D_{h_1}} (1^{(k+1)n}) = 1) \end{align*} where $f_{i+1}, \ldots, f_{k+2}$ are functions generated by a pseudo-random function generator and $h_1, \ldots, h_i$ are functions generated by an ideal random function generator. Let $p^K$ be the probability that an oracle machine that has access to the ideal random permutation generator will output $1$. Since we supposed that the $k+2$ rounds $n$:$kn$-UFN using a pseudo-random function generator is not pseudo-random, we get the following equation \begin{align*} 1/n^c &\leq | p^K - p_0^D | \\ &\leq | p^K - p_{k+2}^D | + | p_{k+2}^D - p_{k+1}^D | + \cdots + | p_{i+1}^D - p_{i}^D | + \cdots + | p_1^D - p_0^D |. \end{align*} However, since the $k+2$ rounds $n$:$kn$-UFN using an ideal random function generator has been shown to be a pseudo-random permutation generator, we have $| P^K - P_{k+2}^D | \leq m^2 / 2^{n}$. Therefore, we have $| p_{i+1}^D - p_{i}^D | \geq 1 / (k+3)n^c$ for some $i$. By using this, an oracle machine $C$ that distinguishes an ideal random function generator and a pseudo-random function generator with a probability higher than $1 / (k+3)n^c$ can be constructed as follows. In the oracle machine $C$, we first change the part of $C$ that calculates the oracle query reply to $D_{f_{k+2}} \circ \cdots \circ D_{f_{i+1}} \circ D_X \circ D_{h_{i-1}} \circ \cdots \circ D_{h_1} (\cdot)$. In this case, $X$ is a function whose input is $n$ bits and whose output is $kn$ bits. If $X$ in $C$ is a function generated by a pseudo-random function generator $F$, then we have $p_{i}^D = \Pr (C^F (1^{kn}) = 1)$. On the other hand, if $X$ in $C$ is a function generated by an ideal random function generator $H$, then we have $p_{i+1}^D = \Pr (C^H (1^{kn}) = 1)$. However, it is possible to distinguish the ideal random function generator and the pseudo-random function generator with a probability greater than $1/(k+3)n^c$ since $| p_{i+1}^D - p_{i}^D | \geq 1/(k+3)n^c$. But this contradicts that the pseudo-random function generator is pseudo-random. Therefore, the $k+2$ rounds $n$:$kn$-UFN using the pseudo-random function generator is a pseudo-random permutation generator. \end{proof} From Theorem \ref{thm:k+1_nkn_ufn_not_prp} and Theorem \ref{thm:k+2_nkn_ufn_prp}, the minimum number of rounds of the $n$:$kn$-UFN permutation generator using a pseudo-random function generator to be pseudo-random is $k+2$. \chapter{Analysis of Modified Unbalanced Feistel Networks} \label{chap:analysis-ufn2} In this section, we propose an unbalanced Feistel network structure that can extend an $n$-bit block cipher to a $(k+1)n$-bit block cipher. Then we analyze the conditions for this modified Feistel structure to be pseudo-random. This chapter is summarized as follows. An $n$:$kn$-UFN2 structure, which can extend an $n$-bit block cipher to a $(k+1)n$-bit block cipher, is a target-heavy unbalanced Feistel network where both the input and output of round functions are $n$ bits. The main advantage of the $n$:$kn$-UFN2 structure is that it allows to build a new block cipher with large input size by using an existing block cipher with proven security. In order for an $n$:$kn$-UFN2 permutation generator that uses pseudo-random functions to be pseudo-random, the round number $k$ must be odd and the total number of rounds must be at least $2k+1$. The structure of this chapter is as follows. In Section 4.1, we define an $n$:$kn$-UFN2 structure and examines the properties of this structure. In Section 4.2, we analyze the conditions for the $n$:$kn$-UFN2 structure to be a pseudo-random permutation generator. \section{Definition and Property} \label{sec:ufn2-def-and-prop} As the information throughput increases, a block cipher with a large input is needed to process large amounts of data. In general, however, it is not easy to build a block cipher with a large input. It is also difficult to ensure the security of this new block cipher. However, if we can use a block cipher that is as secure as DES, we can trust the security of the new cipher. However, the DES cipher does not expand to a block cipher with a larger input because the input is fixed at 64 bits. Therefore, we propose an $n$:$kn$-UFN2 permutation generator that can extend an $n$-bit block cipher to a $(k+1)n$-bit block cipher. We also analyze the condition for this structure to be a pseudo-random permutation generator. \begin{figure} \centering \includegraphics[scale=0.75]{fig_3r_n2n_ufn2} \caption{The structure of a 3 rounds $n$:$2n$-UFN2} \label{fig:3r_n2n_ufn2} \end{figure} An $n$:$kn$-UFN2 structure is a target-heavy unbalanced Feistel network in which the input and output of round functions are $n$ bits. It is defined as follows. For instance, a 3 rounds $n$:$2n$-UFN2 structure is described in Figure \ref{fig:3r_n2n_ufn2}. \begin{definition}[$n$:$kn$-UFN2] \label{def:nkn-ufn2} For any function $f$ belonging to the set of functions $F:I_{n} \rightarrow I_{n}$, one round of $n$:$kn$-UFN2 is defined by the following permutation $$D_f (L_1 \| \cdots \| L_k \| R) \stackrel{def}{=} (R \| L_1 \oplus f(R) \| \cdots \| L_k \oplus f(R)).$$ Similarly, for any functions $f_1, f_2, \ldots, f_r$ belonging to the set of functions $F:I_{n} \rightarrow I_{n}$, an $r$ rounds $n$:$kn$-UFN2 is defined by the following permutation $$D_{f_r} \circ \cdots \circ D_{f_2} \circ D_{f_1} (L_1^0 \| \cdots \| L_k^0 \| R^0) \stackrel{def}{=} D_{f_r} \circ \cdots \circ D_{f_2} ( D_{f_1} (L_1^0 \| \cdots \| L_k^0 \| R^0) ).$$ In this case, we have $|L_i| = |R| = n$. \end{definition} \section{The Pseudo-Random Proof of $n$:$kn$-UFN2} \label{sec:analysis-nkn-ufn2} In Theorem \ref{thm:even_nkn_ufn2_not_prp}, we show that an $n$:$kn$-UFN2 permutation generator is not pseudo-random if $k$ is even. In Theorem \ref{thm:odd_2k_nkn_ufn2_not_prp}, we show that an $n$:$kn$-UFN2 permutation generator is not pseudo-random if $k$ is odd and the number of rounds is less than or equal to $2k$. \begin{theorem} \label{thm:even_nkn_ufn2_not_prp} If $k$ is even, then an $n$:$kn$-UFN2 permutation generator is not pseudo-random. \end{theorem} \begin{proof} If $k$ is even, then we obtain the following equation \begin{align*} & L_1^{r} \oplus L_2^r \oplus \cdots \oplus L_k^r \oplus R^r \\ &\stackrel{(a)}{=} R^{r-1} \oplus (L_1^{r-1} \oplus f_r(R^{r-1})) \oplus \cdots \oplus (L_k^{r-1} \oplus f_r(R^{r-1})) \\ &\stackrel{(b)}{=} L_1^{r-1} \oplus L_2^{r-1} \oplus \cdots L_k^{r-1} \oplus R^{r-1} \db \\ &\quad \vdots \db \\ &\stackrel{(c)}{=} L_1^0 \oplus L_2^0 \oplus \cdots L_k^0 \oplus R^0. \end{align*} In this equation, $(a)$ is satisfied from the definition of an $n$:$kn$-UFN2, $(b)$ is satisfied from the property of $\oplus$ and the number of $f$ is even, and $(c)$ is satisfied from the recursive application of the above equation. We can build an oracle machine $M$ that distinguishes between an $n$:$kn$-UFN2 permutation generator and an ideal random permutation generator. First, the oracle machine queries $x = (L_1^0 \| \cdots \| L_k^0 \| R^0)$ and receives a response $y = (L_1^r \| \cdots \| L_k^r \| R^r)$. If the equation $L_1^0 \oplus \cdots L_k^0 \oplus R^0 = L_1^r \oplus \cdots \oplus L_k^r \oplus R^r$ is satisfied, then the oracle machine outputs $1$. Otherwise, it outputs $0$. Thus, if the oracle response is generated by the $n$:$kn$-UFN2, then the output of the oracle machine is always $1$. However, if the oracle response is generated by the ideal random permutation generator, then the probability that the equation is satisfied is $1/2^n$. Therefore the $n$:$kn$-UFN2 permutation generator with even $k$ is not pseudo-random since the oracle machine $M$ exists. \end{proof} \begin{theorem} \label{thm:odd_2k_nkn_ufn2_not_prp} If $k$ is odd, then a $2k$ rounds $n$:$kn$-UFN2 permutation generator is not pseudo-random. \end{theorem} \begin{proof} To prove that a $2k$ rounds $n$:$kn$-UFN2 is not pseudo-random, we show that there is a relation between the input and output of oracle queries. Next, we build an oracle machine that can distinguish an $n$:$kn$-UFN2 permutation generator and an ideal permutation generator by using this relation. From the definition of an $n$:$kn$-UFN2, we obtain the following equation \begin{align*} & L_1^{2k} \oplus \cdots \oplus L_k^{2k} \oplus R^{2k} \\ &= (L_1^{2k-1} \oplus \cdots \oplus L_k^{2k-1} \oplus R^{2k-1}) \oplus f_{2k}(R^{2k-1})) \\ &\quad \vdots \\ &= (L_1^0 \oplus \cdots L_k^0 \oplus R^0) \oplus \bigoplus_{i=1}^{2k} f_i(R^{i-1}). \end{align*} In this case, $R^{2k}$ is represented as \begin{align*} R^{2k} &= R^{2k-(k+1)} \oplus (f_{k+1}(R^k) \oplus \cdots \oplus f_{2k}(R^{2k-1})) \\ &\quad \vdots \\ &= W \oplus \bigoplus_{i=1}^{2k} f_i(R^{i-1}) \oplus f_k(R^{k-1}) \end{align*} where $W$ is defined as \begin{align*} W = \left\{ \begin{array}{ll} L_i^0 & \text{ if } 3(r+1) \mod (k+1) = i-1, \\ R^0 & \text{ if } 3(r+1) \mod (k+1) = k. \end{array} \right. \end{align*} Thus, we obtain the following relation between the input and output of an $n$:$kn$-UFN2 as \begin{align*} (L_1^{2k} \oplus \cdots \oplus L_k^{2k}) \oplus (L_1^0 \oplus \cdots \oplus L_k^0 \oplus R^0) \oplus W = f_k(R^{k-1}). \end{align*} If we choose two oracle queries with different $L_{p,1}^0$ and $L_{q,1}^0$ blocks for the indexes $p$ and $q$ with $1 \leq p < q \leq m$, then we obtain the following equations \begin{align*} & (L_{p,1}^{2k} \oplus \cdots \oplus L_{p,k}^{2k}) \oplus (L_{p,1}^0 \oplus L_2^0 \oplus \cdots \oplus L_k^0 \oplus R^0) \oplus W_p = f_k(R^{k-1}), \\ & (L_{q,1}^{2k} \oplus \cdots \oplus L_{q,k}^{2k}) \oplus (L_{q,1}^0 \oplus L_2^0 \oplus \cdots \oplus L_k^0 \oplus R^0) \oplus W_q = f_k(R^{k-1}). \end{align*} By using these two equations, we have the following relation for two oracle queries and their responses as \begin{align*} (L_{p,1}^{2k} \oplus \cdots \oplus L_{p,k}^{2k}) \oplus (L_{q,1}^{2k} \oplus \cdots \oplus L_{q,k}^{2k}) \oplus (L_{p,1}^0 \oplus L_{q,1}^0) \oplus (W_p \oplus W_q) = 0. \end{align*} An oracle machine $M$ that distinguishes between an $n$:$kn$-UFN2 permutation generator and an ideal random permutation generator can be built as follows. First, the oracle machine queries $x_p$ and $x_q$ and receives responses $y_p$ and $y_q$. If the equation $(L_{p,1}^{2k} \oplus \cdots \oplus L_{p,k}^{2k}) \oplus (L_{q,1}^{2k} \oplus \cdots \oplus L_{q,k}^{2k}) \oplus (L_{p,1}^0 \oplus L_{q,1}^0) \oplus (W_p \oplus W_q) = 0$ is satisfied, then the oracle machine outputs $1$. Otherwise, it outputs $0$. Thus, if the oracle response is generated by the $n$:$kn$-UFN2, then the output of the oracle machine is always $1$. However, if the oracle response is generated by the ideal random permutation generator, then the probability that the equation is satisfied is $1/2^n$. Therefore the $n$:$kn$-UFN2 permutation generator is not pseudo-random since the oracle machine $M$ can distinguish two permutation generators. \end{proof} We now prove that a $2k+1$ rounds $n$:$kn$-UFN2 permutation generator using pseudo-random functions is pseudo-random. First, we define an event that can be used to distinguish a $2k+1$ rounds $n$:$kn$-UFN2 using ideal random functions from an ideal random permutation generator as the following BAD event. \begin{definition}(The BAD event $\xi$ of $2k+1$ rounds $n$:$kn$-UFN2) \label{def:bad-2k+1-nkn-ufn2} A random variable $\xi^i$ is defined as an event in which $R_{p}^i$ and $R_{q}^i$ of two oracle query indexes $p$ and $q$ are equal where $1 \leq p < q \leq m$. The BAD event $\xi$ is a random variable defined as $\vee_{i=k}^{2k} \xi^i$. \end{definition} If an oracle machine is able to distinguish between a $2k+1$ rounds $n$:$kn$-UFN2 and an ideal random permutation generator, then the BAD event must occur. This means that if the BAD event does not occur, then the $2k+1$ rounds $n$:$kn$-UFN2 is equal to an ideal random permutation generator. In the following lemma, we prove it. \begin{lemma} \label{lem:nkn_ufn2_not_bad} A $2k+1$ rounds $n$:$kn$-UFN2 permutation generator using an ideal random function generator is equal to an ideal random permutation generator if $k$ is odd and the BAD event does not occur. That is, for all possible $\sigma_1, \sigma_2, \ldots, \sigma_m \in \bits^{(k+1)n}$, we have $$\Pr (\wedge_{i=1}^m (y_i = \sigma_i) | \neg \xi) = 1/2^{(k+1)nm}$$ where $y_i$ is the output of the $2k+1$ rounds $n$:$kn$-UFN2 permutation generator. \end{lemma} \begin{proof} If the response $y_p$ of the oracle query $x_p$ is generated by an $n$:$kn$-UFN2 permutation generator, then the oracle response is calculated by the following algorithm. In this case, $x_p = (L_{p,1}^0 \| L_{p,2}^0 \| \cdots \| L_{p,k}^0 \| R_p^0)$ and $y_p = (L_{p,1}^{2k+1} \| L_{p,2}^{2k+1} \| \cdots \| L_{p,k}^{2k+1} \| R_p^{2k+1})$. \begin{align*} & \textbf{input } (L_{p,1}^0 \| L_{p,2}^0 \| \cdots \| L_{p,k}^0 \| R_p^0) \\ & \textbf{select } h_p^1, h_p^2, \ldots, h_p^{2k+1} \in \text{ uniform distribution} \\ & \textbf{for } 1 \leq i \leq 2k+1 \textbf{ do } \\ &\quad \ell \leftarrow \text{ min } q: 1 \leq q \leq p \text{ and } R_q^{i-1} = R_p^{i-1} \\ &\quad L_{p,1}^i \leftarrow R_p^{i-1} \\ &\quad L_{p,2}^i \leftarrow L_{p,1}^{i-1} \oplus h_\ell^{i} \\ &\quad \vdots \db \\ &\quad L_{p,k}^i \leftarrow L_{p,k-1}^{i-1} \oplus h_\ell^{i} \db \\ &\quad R_{p}^i \leftarrow L_{p,k}^{i-1} \oplus h_\ell^{i} \\ & \textbf{end for} \\ & \textbf{output } (L_{p,1}^{2k+1} \| L_{p,2}^{2k+1} \| \cdots \| L_{p,k}^{2k+1} \| R_p^{2k+1}). \end{align*} By using this algorithm, the oracle response $y_p$ can be represented by $h_p^k, h_p^{k+1}, \ldots, h_p^{2k+1}$ and the intermediate value $(L_{p,1}^{k-1} \| L_{p,2}^{k-1} \| \cdots \| L_{p,k}^{k-1} \| R_p^{k-1})$ that is used in the algorithm as follows. \begin{align*} \left( \begin{array}{c} L_{p,1}^{k-1} \\ L_{p,2}^{k-1} \\ L_{p,3}^{k-1} \\ \cdots \\ L_{p,k-1}^{k-1} \\ L_{p,k}^{k-1} \\ R_{p}^{k-1} \\ \end{array} \right) \oplus \left( \begin{array}{ccccccc} 1 & 1 & 1 & \cdots & 1 & 1 & 0 \\ 1 & 1 & 1 & \cdots & 1 & 0 & 1 \\ 1 & 1 & 1 & \cdots & 0 & 1 & 1 \\ \multicolumn{7}{c}{\dotfill} \\ 1 & 1 & 0 & \cdots & 1 & 1 & 1 \\ 1 & 0 & 1 & \cdots & 1 & 1 & 1 \\ 0 & 1 & 1 & \cdots & 1 & 1 & 1 \\ \end{array} \right) \left( \begin{array}{c} h_p^k \\ h_p^{k+1} \\ h_p^{k+2} \\ \cdots \\ h_p^{2k-1} \\ h_p^{2k} \\ h_p^{2k+1} \\ \end{array} \right) = \left( \begin{array}{c} L_{p,1}^{2k+1} \\ L_{p,2}^{2k+1} \\ L_{p,3}^{2k+1} \\ \cdots \\ L_{p,k-1}^{2k+1} \\ L_{p,k}^{2k+1} \\ R_{p}^{2k+1} \\ \end{array} \right). \end{align*} Let $y^{k-1} = (L_{p,1}^{k-1}, \cdots, L_{p,k}^{k-1}, R_p^{k-1})$, $y^{2k+1} = (L_{p,1}^{2k+1}, \cdots, L_{p,k}^{2k+1}, R_p^{2k+1})$, and $x = (h_p^k, h_p^{k+1}, \cdots, h_p^{2k+1})$ be column vectors. Let $A$ be a $(k+1) \times (k+1)$ matrix in which only the elements $A_{i,k+2-i}$ are $0$ and the other elements are $1$. Then the above equation can be represented as a linear relation $y^{k-1} \oplus A x = y^{2k+1}$. If we let $y = y^{k-1} \oplus y^{2k+1}$, then the linear relation can be represented as $Ax = y$. This is equal to a function $T: I_{(k+1)n} \rightarrow I_{(k+1)n}$ such that $T(x) = Ax$. Now, we show that the output $y$ of $T(x) = Ax$ has a uniform probability distribution. The value $x$ ​​has a uniform probability distribution since the $n$:$kn$-UFN2 permutation generator uses ideal random functions. That is, the probability that $x_i$ is chosen in $I_{(k+1)n}$ is $1/2^{(k+1)n}$. Therefore, if the function $T$ is a one-to-one correspondence function, then the output $y_i$ value of the function $T$ also has a probability value $1/2^{(k+1)n}$ equal to $x_i$. If the function $T$ is a one-to-one function, then $T$ is a one-to-one correspondence function since the domain and region of $T$ are the same. If the function $T(x) = y$ is a one-to-one correspondence, then the inverse of $T$ must exist. That is, the inverse matrix $A^{-1}$ of the matrix $A$ must exist since $T(x) = Ax$. If the determinant of $A$ is not zero, then there exists an inverse matrix. So we should show that $det (A) \neq 0$. In order to show that the determinant of the square matrix $A$ is not zero, we convert $A$ to an echelon form $A'$. At this time, only row addition and row interchange are used. If the echelon form $A'$ contains a row of zero, then $det(A) = 0$, otherwise $det(A) \neq 0$ \cite{FraleighB95}. Thus, we should show that $A'$ does not contain a row of zero. First, we select an element in $(1,1)$ as the first pivot element and perform row addition. Then we have the following matrix. We also select an element in $(i, k+2-i)$ as $i$th pivot element for $2 \leq i \leq k$. \begin{align*} \left( \begin{array}{ccccccc} 1 & 1 & 1 & \cdots & 1 & 1 & 0 \\ & & & & & \underline{1} & 1 \\ & O & & & \underline{1} & & 1 \\ & & & \iddots & & & \\ & & \underline{1} & & O & & 1 \\ & \underline{1} & & & & & 1 \\ 0 & 1 & 1 & \cdots & 1 & 1 & 1 \\ \end{array} \right). \end{align*} The above matrix contains pivot elements for all columns except the $k+1$ column. Therefore, the element at position $(k+1, k+1)$ should be selected as the $k+1$th pivot. To do so, all values ​​except the $k+1$th element of the $k+1$th row vector must be set to zero. Let $r_i$ be the $i$th row vector of the above matrix. The $k+1$th pivotal element is obtained by performing row addition $r_2 \oplus r_3 \oplus \cdots \oplus r_k \oplus r_{k+1}$. By the property of the XOR operation, the result of row addition is $(0, 0, \ldots, 0, 0, X)$, where $X = 0$ if $k$ is even and $X = 1$ if $k$ is odd depending on the property of the XOR. An echelon form $A'$ is obtained by performing row exchange so that each pivot is located diagonally in the matrix. Thus, when $k$ is an odd number, the echelon form matrix $A'$ does not include a row of zero. Therefore, if $k$ is odd, the output of $2k+1$ rounds $n$:$kn$-UFN2 has a uniform probability distribution. \end{proof} \begin{lemma} \label{lem:nkn_ufn2_bad} The probability of the BAD event in a $2k+1$ rounds $n$:$kn$-UFN2 permutation generator is bounded by $$\Pr(\xi) \leq (k+1)m^2 / 2^{n+1}.$$ \end{lemma} \begin{proof} For the proof, we should show that $\Pr(\xi^i) \leq m^2 / 2^{n+1}$ since $\Pr(\xi) = \vee_{i=k}^{2k} \Pr(\xi^i)$ by the definition of the BAD event $\xi$. By the definition of $\xi^i$, we have $\Pr(\xi^i) = \Pr(R_p^i = R_q^i)$ for the oracle query indexes $p$ and $q$ with $1 \leq p < q \leq m$. Thus we obtain the following equation \begin{align*} \Pr(R_p^i = R_q^i) &= \left\{ \begin{array}{ll} \Pr(L_{p,k}^{i-1} \| R_p^{i-1} = L_{q,k}^{i-1} \| R_q^{i-1}) & \text{ if } L_{p,k}^{i-1} \| R_p^{i-1} = L_{q,k}^{i-1} \| R_q^{i-1} \\ 1/2^n & \text{ otherwise. } \end{array} \right. \end{align*} Similarly, we can obtain the following equation \begin{align*} & \Pr(L_{p,k-j+1}^{i-j} \| \cdots \| R_p^{i-j} = L_{q,k-j+1}^{i-j} \| \cdots \| R_q^{i-j}) \\ &= \left\{ \begin{array}{ll} \Pr(L_{p,k-j}^{i-j-1} \| \cdots \| R_p^{i-j-1} = L_{q,i}^{k-j} \| \cdots \| R_q^{i-j}) & \text{ if } L_{p,k-j}^{i-j-1} \| \cdots \| R_p^{i-j-1} = L_{q,k-j}^{i-j-1} \| \cdots \| R_q^{i-j-1} \\ 1/2^{(j+i)n} & \text{ otherwise } \end{array} \right. \end{align*} Since each oracle query should be different, we have $\Pr(L_{p,1}^0 \| \cdots \| L_{p,k}^0 \| R_p^0 = L_{q,1}^0 \| \cdots \| L_{q,k}^0 \| R_q^0) = 0$ for oracle query indexes $p$ and $q$ with $1 \leq p < q \leq m$. Thus, we have \begin{align*} \Pr(\xi^i) &= {}_mC_2 \cdot \Pr(R_p^i = R_q^i) \\ &= {}_mC_2 \left( \frac{1}{2^n} + \cdots + \frac{1}{2^{kn}} + (i-k) \frac{1}{2^{(k+1)n}} \right) \leq \frac{m^2}{2^{n+1}}. \end{align*} Therefore, we have $\Pr(\xi) = \sum_{i=k}^{2k} m^2 / 2^{n+1} = (k+1) m^2 / 2^{n+1}$. \end{proof} In Theorem \ref{thm:2k+1_nkn_ufn2_prp}, we prove that a $2k+1$ rounds $n$:$kn$-UFN2 that uses ideal random functions is pseudo-random from the above two lemmas, and we also prove that a $2k+1$ rounds $n$:$kn$-UFN2 that uses pseudo-random functions is also pseudo-random. \begin{theorem} \label{thm:2k+1_nkn_ufn2_prp} A $2k+1$ rounds $n$:$kn$-UFN2 permutation generator using a pseudo-random function generator is a pseudo-random permutation generator. \end{theorem} \begin{proof} From Lemma \ref{lem:nkn_ufn2_not_bad} and Lemma \ref{lem:nkn_ufn2_bad}, we can show that an $n$:$kn$-UFN2 permutation generator $P$ that uses an ideal random function generator is a pseudo-random permutation generator. First, we have $| \Pr (M^P(1^{(k+1)n}) = 1 | \neg \xi) - \Pr (M^K (1^{(k+1)n}) = 1) | = 0$ since $P$ is the same as an ideal random permutation generator $K$ when the BAD event $\xi$ does not occur by Lemma \ref{lem:nkn_ufn2_not_bad}. We also have $| \Pr (M^P(1^{(k+1)n}) = 1 | \xi) - \Pr (M^K (1^{(k+1)n}) = 1) | \leq 1$ since the absolute value of the probability difference is less than 1. Therefore, we have the following equation \begin{align*} & \big| \Pr (M^P(1^{(k+1)n}) = 1) - \Pr (M^K(1^{(k+1)n}) = 1) \big| \\ &= \big| \Pr (M^P(1^{(k+1)n}) = 1 | \xi) - \Pr (M^K(1^{(k+1)n}) = 1) \big| \cdot \Pr(\xi) + \\ &\quad~ \big| \Pr (M^P(1^{(k+1)n}) = 1 | \neg \xi) - \Pr (M^K(1^{(k+1)n}) = 1) \big| \cdot \Pr(\neg \xi) \\ &\leq \Pr(\xi) \leq (k+1)m^2 / 2^{n+1}. \end{align*} We now show that a $2k+1$ rounds $n$:$kn$-UFN2 permutation generator $P$ using a pseudo-random function generator is a pseudo-random permutation generator. For this, we use the proof by contradiction. That is, if a $2k+1$ rounds $n$:$kn$-UFN2 using an ideal random function generator is pseudo-random but a $2k+1$ rounds $n$:$kn$-UFN2 using a pseudo-random function generator is not pseudo-random, then we can derive a contradiction to the pseudo-randomness of the pseudo-random function generator. Suppose that an $n$:$kn$-UFN2 permutation generator $P$ using a pseudo-random function generator is not pseudo-random. Then there exists an oracle machine $M$ which distinguishes an ideal random permutation generator $K$ and $P$ with a probability greater than $1/n^c$ for a constant $c$. First, we let $D_{f_{2k+1}} \circ \cdots \circ D_{f_{i+1}} \circ D_{h_i} \circ \cdots \circ D_{h_1}(\cdot)$ be a permutation generator in which an ideal random function generator is used from the first round to the $i$th round and a pseudo-random function generator is used from the $i+1$th round to the $2k+1$th round in an $n$:$kn$-UFN2 permutation generator for $i$ with $0 \leq i \leq 2k+1$. Let $p_i^D$ be the probability that an oracle machine that has access to this permutation generator will output $1$. That is, \begin{align*} p_i^D = \Pr (M^{D_{f_{2k+1}} \circ \cdots \circ D_{f_{i+1}} \circ D_{h_i} \circ \cdots \circ D_{h_1}} (1^{(k+1)n}) = 1) \end{align*} where $f_{i+1}, \ldots, f_{2k+1}$ are functions generated by a pseudo-random function generator and $h_1, \ldots, h_i$ are functions generated by an ideal random function generator. Let $p^K$ be the probability that an oracle machine that has access to the ideal random permutation generator will output $1$. Since we supposed that the $2k+1$ rounds $n$:$kn$-UFN2 using a pseudo-random function generator is not pseudo-random, we get the following equation \begin{align*} 1/n^c &\leq | p^K - p_0^D | \\ &\leq | p^K - p_{2k+1}^D | + | p_{2k+1}^D - p_{2k}^D | + \cdots + | p_{i+1}^D - p_{i}^D | + \cdots + | p_1^D - p_0^D |. \end{align*} However, since the $2k+1$ rounds $n$:$kn$-UFN2 using an ideal random function generator has been shown to be a pseudo-random permutation generator, we have $| P^K - P_{2k+1}^D | \leq (k+1)m^2 / 2^{n+1}$. Therefore, we have $| p_{i+1}^D - p_{i}^D | \geq 1 / (2k+2)n^c$ for some $i$. By using this, an oracle machine $C$ that distinguishes an ideal random function generator and a pseudo-random function generator with a probability higher than $1 / (2k+2)n^c$ can be constructed as follows. In the oracle machine $C$, we first change the part of $C$ that calculates the oracle query reply to $D_{f_{2k+1}} \circ \cdots \circ D_{f_{i+1}} \circ D_X \circ D_{h_{i-1}} \circ \cdots \circ D_{h_1} (\cdot)$. In this case, $X$ is a function whose input is $n$ bits and whose output is $n$ bits. If $X$ in $C$ is a function generated by a pseudo-random function generator $F$, then we have $p_{i}^D = \Pr (C^F (1^{kn}) = 1)$. On the other hand, if $X$ in $C$ is a function generated by an ideal random function generator $H$, then we have $p_{i+1}^D = \Pr (C^H (1^{kn}) = 1)$. However, it is possible to distinguish the ideal random function generator and the pseudo-random function generator with a probability greater than $1/(2k+2)n^c$ since $| p_{i+1}^D - p_{i}^D | \geq 1/(2k+2)n^c$. But this contradicts that the pseudo-random function generator is pseudo-random. Therefore, the $2k+1$ rounds $n$:$kn$-UFN2 using a pseudo-random function generator is a pseudo-random permutation generator. \end{proof} \chapter{Comparison of Unbalanced Feistel Networks} \label{chap:comp-ufn} In this chapter, we compare the amount of memory required for implementation and the time of a pseudo-random permutation generator when implementing the pseudo-random permutation generator using a balanced Feistel network, unbalanced Feistel networks, and the newly proposed Feistel network. To implement a pseudo-random permutation generator, we must implement a pseudo-random function used in a Feistel network. However, the implementation cost of the pseudo-random function and the speed of the pseudo-random function greatly affect the cost and speed of the Feistel network. Therefore, depending on how to implement the pseudo-random function, the comparison value can vary greatly. Therefore, in this chapter, we will compare the method that can most simply implement the pseudo-random function and the method that uses the GGM pseudo-random function generator. In other words, the cost and the execution speed of each pseudo-random permutation generator are investigated by using these two methods. \section{Using Memory and Pseudo-Random Bit Generator} The simplest way to implement a pseudo-random function is to use memory and a pseudo-random bit generator. That is, if the input value $x$ of a function is given, the output value $y$ is calculated by using a pseudo-random bit generator. At this time, the initial value of the pseudo-random bit generator uses an ideal random value such as coin tosses. However, a pseudo-random function must give the same output value for the same input value. Thus, the input value and the output value are stored in memory. That is, given the same input value as before, the output is obtained by referring to the memory instead of using the pseudo-random bit generator. Before describing this algorithm, we assume that the size of the key that specifies a pseudo-random function used in the $i$th round of a Feistel network is $\ell$ bits. We also assume that the input of a pseudo-random bit generator $G$ is $\ell$ bits and the output is $P_2$ bit. That is, $G: I_{\ell} \rightarrow I_{P_2}$. An algorithm that implements a pseudo-random function $F_{k_i}: I_{P_1} \rightarrow I_{P_2}$ whose input is $P_1$ bits and output is $P_2$ bits is as follows. \begin{algorithm} \caption{Calculate $y = F_{k_i}(x)$} \label{alg:prf-from-mem-prbg} \begin{algorithmic}[1] \Require{$|x| = P_1$ and $|y| = P_2$} \Ensure{$y = F_{k_i}(x)$} \Procedure{}{} \If {$mem[i][x] = \text{null}$} \State $\text{generate} \ell-\text{bit string } s \text{ using coin-toss}$. \State $mem[i][x] \gets G(s)$. \EndIf \State $y \gets mem[i][x]$. \EndProcedure \end{algorithmic} \end{algorithm} Since the input of the pseudo-random function is $P_1$ bits and the output is $P_2$ bits, the amount of memory required to implement a pseudo-random function is $2^{P_1} P_2$ bits. Therefore, an $r$ rounds Feistel network using pseudo-random functions requires $r \cdot 2^{P_1} P_2$ bits memory. The time to calculate the output value of a pseudo-random function is proportional to the time to calculate the output of a pseudo-random bit generator. Thus, the execution time of a pseudo-random function whose output is $P_2$ bits is proportional to the $P_2$ value of the output size. Therefore, the execution time of the $r$ rounds Feistel network is proportional to $r \cdot P_2$ value. \begin{table*} \caption{Comparison of PRPs using memory and pseudo-random bit generators} \label{tab:comp-prp-mem-prbg} \vs \small \addtolength{\tabcolsep}{12.0pt} \renewcommand{\arraystretch}{1.4} \newcommand{\otoprule}{\midrule[0.09em]} \begin{tabularx}{6.50in}{lcccc} \toprule & Balanced & \multicolumn{2}{c}{Unbalanced Feistel network} & Proposed structure \\ & Feistel network & $kn$:$n$-UFN & $n$:$kn$-UFN & $n$:$kn$-UFN2 \\ \midrule Number of rounds & 3 & $k+2$ & $k+2$ & $2k+1$ \\ \midrule Memory size & $2^{(k+1)n/2}kn$ & $2^{kn} kn$ & $2^n k^2 n$ & $2^n kn$ \\ Relative ratio & $2^{(k-1)n/2}$ & $2^{(k-1)n}$ & $k$ & $1$ \\ \midrule Running time & $1.5 kn$ & $kn$ & $k^2 n$ & $2kn$ \\ Relative ratio & $1.5$ & $1$ & $k$ & $2$ \\ \bottomrule \end{tabularx} \end{table*} In case of implementing a pseudo-random function by using the algorithm 1, the memory size required for each pseudo-random permutation generator and the execution time of each Feistel network are shown in Table \ref{tab:comp-prp-mem-prbg}. In the total memory size, the pseudo-random permutation generator using a newly proposed structure ($n$:$kn$-UFN2) requires the least memory and the pseudo-random permutation generator using a source-heavy unbalanced Feistel network ($kn$:$n$-UFN) requires the most memory. In the execution time of the whole Feistel network, the pseudo-random permutation generator using a source-heavy unbalanced Feistel network ($kn$:$n$-UFN) is the fastest and the pseudo-random permutation generator using a target-heavy unbalanced Feistel network ($n$:$kn$-UFN) is the slowest. \section{Using the GGM Pseudo-Random Function} Another way to implement a pseudo-random function is to use the pseudo-random function generator of Goldreich, Goldwasser, and Micali. A major advantage of the GGM pseudo-random function generator is that it can implement a pseudo-random function without storing previously generated pseudo-random bits. Let $\ell$ be the size of the entire key of a pseudo-random permutation generator. Then the $i$th pseudo-random function of the pseudo-random permutation generator from an $r$ rounds Feistel network will use $\ell / r$ bits of the key. We first prepare two pseudo-random bit generators $G: I_{\ell/r} \rightarrow I_{2\ell/r}$ and $G': I_{\ell/r} \rightarrow I_{P_2}$. Let $G_0$ be the first $\ell/r$ bits of $G$, and $G_1$ be the next $\ell/r$ bits of $G$. A pseudo-random function $F: I_{P_1} \rightarrow I_{P_2}$ whose the key size is $\ell / r$ is defined by the following algorithm. \begin{algorithm} \caption{Calculate $y = F_{k_i}(x)$} \label{alg:prf-from-ggm} \begin{algorithmic}[1] \Require{$|x| = P_1$, $|k_i| = \ell/r$, and $|y| = P_2$} \Ensure{$y = F_{k_i}(x)$} \Procedure{}{} \For {$1 \leq j \leq P_1$} \If {$x[j] = 0$} \State $T \gets G_0(k_i)$. \Else \State $T \gets G_1(k_i)$. \EndIf \EndFor \State $y \gets G'(T)$. \EndProcedure \end{algorithmic} \end{algorithm} Since the pseudo-random bits that are previously generated by the algorithm can not be stored, the amount of memory required is fixed. By analyzing the above algorithm, the number of pseudo-random bits that the algorithm must generate to compute one pseudo-random permutation is maximum $(2 P_1 \ell / r + P_2) r$ bits. Therefore, the memory size and the time of each Feistel network are shown in Table \ref{tab:comp-prp-ggm-prf}. \begin{table*} \caption{Comparison of PRPs using the GGM pseudo-random function generator} \label{tab:comp-prp-ggm-prf} \vs \small \addtolength{\tabcolsep}{12.0pt} \renewcommand{\arraystretch}{1.4} \newcommand{\otoprule}{\midrule[0.09em]} \begin{tabularx}{6.50in}{lcccc} \toprule & Balanced & \multicolumn{2}{c}{Unbalanced Feistel network} & Proposed structure \\ & Feistel network & $kn$:$n$-UFN & $n$:$kn$-UFN & $n$:$kn$-UFN2 \\ \midrule Number of rounds & 3 & $k+2$ & $k+2$ & $2k+1$ \\ \midrule Memory size & - & - & - & - \\ Relative ratio & - & - & - & - \\ \midrule Running time & $kn\ell$ & $2kn\ell$ & $2n\ell$ & $2n\ell$ \\ Relative ratio & $k$ & $2k$ & $2$ & $2$ \\ \bottomrule \end{tabularx} \end{table*} It can be seen that the pseudo-random permutation generator using a target-heavy ($n$:$kn$-UFN) and the proposed structure ($n$:$kn$-UFN2) is the fastest in the execution time of the entire Feistel network. On the other hand, it can be seen that the pseudo-random permutation generator using a source-heavy ($kn$:$n$-UFN) is the slowest. \chapter{Conclusion} In this paper, we analyze the minimum number of rounds for a block cipher from unbalanced Feistel networks to be a pseudo-random permutation generator which is a safe and efficient block cipher. We also propose a new unbalanced Feistel network structure that can be extended and analyze the minimum number of rounds for this structure to be a pseudo-random permutation generator. The minimum number of rounds for a permutation generator from unbalanced Feistel networks to be a pseudo-random permutation generator is as follows. \begin{itemize} \item In case of a source-heavy unbalanced Feistel network where the source block is $kn$ bits and the target block is $n$ bits: If pseudo-random functions are used in round functions and the total number of rounds is $k+2$ or more, then a source-heavy unbalanced Feistel network is a pseudo-random permutation generator. \item In case of a target-heavy unbalanced Feistel network where the source-block is $n$ bits and the target block is $kn$ bits: If pseudo-random functions are used in round functions and the total number of rounds is more than $k+2$, then a target-heavy unbalanced Feistel network is a pseudo-random permutation generator. \end{itemize} A newly proposed architecture is an unbalanced Feistel network architecture that can extend an $n$-bit block cipher to a $(k+1)n$-bit block cipher. The minimum number of rounds of a permutation generator from this structure to be pseudo-random is as follows. \begin{itemize} \item If $k$ is even, then a newly proposed structure is not a pseudo-random permutation generator. \item If $k$ is odd, pseudo-random functions are used, and the total number of rounds is $2k+1$ or more, then a newly proposed structure is a pseudo-random permutation generator. \end{itemize} In all three structures, the probability that an arbitrary algorithm can distinguish between an ideal random permutation generator and a pseudo-random permutation generator is less than $m^2 / 2^n$ after obtaining $m$ plaintext and ciphertext pairs. Therefore, when a block cipher is implemented using an unbalanced Feistel network structure, it can be a safe and efficient block cipher only if the number of rounds shown in this paper is satisfied. In this paper, we examined only the condition of the number of rounds for an unbalanced Feistel network using pseudo-random functions to be pseudo-random. If a permutation generator from an unbalanced Feistel network is a super pseudo-random permutation, it becomes a secure block cipher for both chosen plaintext and chosen ciphertext attacks. Therefore, in the future, it is necessary to analyze the condition of the round number for a block cipher from an unbalanced Feistel network to be the super pseudo-random permutation generator. \bibliographystyle{plain}
{'timestamp': '2017-03-27T02:04:35', 'yymm': '1703', 'arxiv_id': '1703.08306', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08306'}
arxiv
\section{Introduction} Co-inductive logic programming extends traditional logic programming by enabling co-inductive reasoning to deal with infinite SLD-derivation, which has practical implication in different fields of computing such as model checking, planning as well as type inference~\cite{SimonCoSLD2006,SimonThesis2006,AbstractCompAnconaCLD10,CoALPSemanImpKKJPMS16}. One operational semantics of co-inductive logic programming is co-inductive SLD resolution (co-SLD)~\cite{SimonCoSLD2006,SimonThesis2006}, which combines loop detection with traditional SLD resolution, so that it can be used to reason co-inductively about infinite rational terms. An alternative operational semantics for co-inductive logic programming is co-algebraic logic programming ~\cite{CoALPSemanImpKKJPMS16,StrResoKomendantskayaJ15}, which adopts a more general co-induction rule and uses structural resolution instead of SLD resolution as its induction rule. The distinctive features of co-algebraic logic programming, compared with co-SLD, include that the co-inductive reasoning mechanism of the former goes beyond loop detection; as a result the computed formulae by the former are allowed to be either rational terms or (finite observation of) irrational terms. Moreover, structural resolution \cite{StrResoKomendantskayaJ15,RewTreeJohannKK15} allows for analysis of productivity \cite{StrResoKomendantskayaJ15} of logic programs. Productivity, also known as computations at infinity \cite[ch. 4]{FoundOfLPLloyd1987}, concerns computation of infinite data structures by non-terminating derivations. Productivity is studied not only in logic programming community, but also in functional programming community, where they developed decision algorithm for co-recursive list and stream definitions \cite{SijtsmaProductivityOfRecursiveListDefn,Endrullis2010PoductiveStream}. Those distinctive features make co-algebraic logic programming an ideal basis for developing productivity decision algorithms. In this paper we explore a combination of co-SLD style loop detection with structural resolution, resulting in a novel operational semantics called \emph{co-inductive structural resolution} (co-S-resolution for short), and we prove its soundness with respect to the greatest complete Herbrand model. An implementation is also presented as a contribution. Co-inductive structural resolution is created as an intermediate semantics between co-SLD and co-algebraic logic programming. On the one hand, it inherits loop detection from co-SLD, which is a simpler co-inductive reasoning mechanism compared with the co-inductive mechanism of co-algebraic logic programming. On the other hand, it uses structural resolution as co-algebraic logic programming does, allowing for analysis of productivity. Introducing such an intermediate semantics has its practical implication: there are two challenges involved in the design of productivity decision algorithms, which are 1) productivity analysis with structural resolution and 2) co-inductive reasoning beyond loop detection; introducing the intermediate semantics makes it possible to deal with these \emph{two} challenges \emph{one at a time}, so co-S-resolution prepares future development of a productivity decision algorithm that uses loop detection, which in turn will prepare even further algorithm development that goes beyond loop detection. These points will be further discussed in Section~\ref{sec:related work}. An overview of the rest of the paper is as follows. In Section~\ref{sec: prelim} we will introduce preliminary concepts that cover substitution and unification with rational trees, co-SLD and structural resolution, and greatest fix point, which will prepare us for further theory construction in later sections. In Section~\ref{sec: co-SR} we will introduce the semantics for co-inductive structural resolution and prove its soundness. In Section~\ref{sec:related work} we will have a review of related work, discuss the importance of co-S-resolution for productivity decision, and conclude the paper. Appendix~\ref{app: imple} presents the implementation. \section{Preliminaries}\label{sec: prelim} We assume readers' understanding of standard definition of \emph{first order term} and the modelling of (possibly infinite) terms by \emph{trees}. ``Term'' and ``tree'' are used interchangeably in this paper. Details about these concepts can be found in~\cite{FoundOfLPLloyd1987,TreeByCOURCELLE1983}. \begin{defn}[Rational Term] A \emph{rational term} \cite{PrologIn10Figures,JaffarInfTreeLP,AnconaCoSLD15,SimonCoSLD2006} refers to a (possibly non-ground and possibly infinite) term (or tree) that has a \emph{finite} amount of distinct sub-terms (or sub-trees). A rational term is also known as a \emph{regular term} \cite{TreeByCOURCELLE1983,Gupta2007}. \end{defn} Our definition for \emph{substitution with rational trees} (referred to as \emph{substitution} for short hereinafter) inherits the principle of substitution with finite trees in logic programming \cite{FoundOfLPLloyd1987}. \begin{defn}[Substitution] A substitution is a mapping of the form $S=\{x_1/t_1,\ldots,x_n/t_n\}$ where $x_1,\ldots,x_n$ are distinct variables, $t_1,\ldots,t_n$ are rational terms, and $\forall\ i,j\in\{1,\ldots,n\}$, $x_i$ does not occur in $t_j$. Moreover, $\epsilon$ denotes the empty substitution. \end{defn} \begin{exmp} Let $\theta=\{x_1/f(f(\ldots)), x_2/g(x_3)\}$ be a substitution. Applying $\theta$ to the term $p(x_1,x_2)$ is denoted by $p(x_1,x_2)\theta$, which evaluates to $p(f(f(\ldots)),g(x_3))$. \end{exmp} Composition of substitutions is defined in the same way as in~\cite[Sec. 4]{FoundOfLPLloyd1987}. \begin{defn}[Unification]\label{defn: unification} Given two rational terms $t_1$ and $t_2$, unification is the process of finding a substitution (unifier) $\theta$ such that $t_1\theta=t_2\theta$, i.e. applying $\theta$ separately to $t_1$ and $t_2$ yields the same tree. This relation is denoted by $t_1\sim_\theta t_2$. \end{defn} The standard approach to rational term unification \cite{MartelliUnification,TreeByCOURCELLE1983,PrologIn10Figures,ALogicalReconstructionOfPrologII,SemanOfPrologWithoutOccursCheckWeijland1988} involves \emph{systems of equations of finite terms}, and \emph{transforms} that turn equation systems to their \emph{reduced form} as the output of the unification algorithm. The reduced form equation system can further be \emph{solved} to obtain a solution in the domain of rational trees \cite{TreeByCOURCELLE1983}. We omit the details of the unification algorithm for rational trees and the details of solving equation systems, which can be found in the above literature. \begin{rmk} Our definition of substitution refers to solutions of reduced form equation systems. Consider the unification problem $p(X)\sim p(f(X))$. The standard approach regards $p(X)\sim p(f(X))$ as an equation system $\{p(X)=p(f(X))\}$ and reduces it to the reduced form $\{X= f(X)\}$, which is called a substitution in the standard sense. Locally in this paper we \emph{solve} the reduced form $\{X= f(X)\}$ to obtain the solution $\{X=f(f(\ldots))\}$ and call this solution a substitution. We believe that our treatment of substitution can emphasize the variables that are to be instantiated and will make the theory about co-inductive structure resolution easier to formulate and understand. \end{rmk} \emph{Term matching} is a concept closely related to unification, and is prerequisite for rewriting reduction in structural resolution \cite{StrResoKomendantskayaJ15,RewTreeJohannKK15}. We extend applicable terms for matching from finite trees to rational trees by building the concept of rational tree term matching on the concept of rational tree unification. \begin{defn}[Term Matching]\label{defn: term matching} Given two rational terms $t_1$, $t_2$ and a unifier $\sigma$, if $\sigma$ also satisfies that $t_1\sigma=t_2$, then it is said that $t_1$ \emph{subsumes} $t_2$, or $t_1$ \emph{matches against} $t_2$. This relation is denoted by $t_1\prec_\sigma t_2$. $\sigma$ is called a \emph{matcher} for $t_1$ against $t_2$. \end{defn} \begin{rmk}[Uniqueness of matcher] If two terms have matchers $\sigma_1$ and $\sigma_2$, then $\sigma_1$ equals to $\sigma_2$ when restricted to variables that occur in the terms. Nevertheless, a matcher $\sigma$ for term $t_1$ against $t_2$ is intended to be identity on variables not in $t_1$. \end{rmk} The symbolic notation for unification ($\sim$) and matching ($\prec$) follows~\cite{StrResoKomendantskayaJ15}. Note that ($\sim$) is a symmetric relation but ($\prec$) is not symmetric. Sometimes $t_1\prec t_2$ may fail to convey which term subsumes (i.e. matches against) which. A mnemonic tip is to regard the ``precede'' symbol ($\prec$) as the ``less than'' symbol ($<$) and derive from $t_1\prec t_2$ that $t_2$ might be bigger (i.e. contains more symbols) than $t_1$. \begin{exmp} \begin{enumerate}[a)] \item$p(x)\sim_\theta p(f(x))$ where $\theta=\{x/f(f(f(\ldots)))\}$. $\theta$ is not a matcher. \item $p(x_1,x_1)\sim_\theta p(f(y_1),y_1)$ where $\theta=\{x_1/f(f(f(\ldots))), y_1/f(f(f(\ldots)))\}$. $\theta$ is not a matcher. \item $p(x_1,x_2)\sim_\theta p(f(y_1),y_1)$ where $\theta=\{x_1/f(y_1),x_2/y_1\}$. $\theta$ is a matcher and $p(x_1,x_2)\prec_\theta p(f(y_1),y_1)$. \end{enumerate} \end{exmp} We now introduce the operational semantics of the well-known SLD-resolution ($\mathbf{L}$inear resolution for $\mathbf{D}$efinite clauses with $\mathbf{S}$election function) \cite{FoundOfLPLloyd1987,KowalVESemanLP76} as a precursor of co-SLD and of structural resolution. \begin{defn}[SLD-resolution] Given a logic program P and goal \[G={\leftarrow A_1,\ldots,A_n}\] if there exists in P a clause $B_0\leftarrow B_1,\ldots,B_m$ (with freshly renamed variables), such that $B_0\sim_\theta A_k$ for some $k\in\{1,\ldots,n\} $, then by SLD-resolution we derive \[G'={\leftarrow (A_1,\ldots,A_{k-1},B_1,\ldots,B_m,A_{k+1},\ldots,A_n)\theta}\] \end{defn} \begin{rmk} The notation of the form $(A_1,\ldots,A_n)\theta$ denotes application of $\theta$ to every $A_i,\ i\in\{1,\ldots,n\}$. \end{rmk} In the following definition of co-SLD we introduce a set $S$ for each predicate $A$ in a goal \cite{AnconaCoSLD15}, where $S$ records all previous goals (or their instances) that are relevant to the co-inductive proof of $A$. \begin{defn}[co-SLD resolution]\label{defn: co-SLD reso} Given a logic program P and a goal \[G={\leftarrow (A_1,S_1),\ldots,(A_n, S_n)}\] the next goal $G'$ can be derived by one of the following two rules: \begin{enumerate} \item If there exists in P a clause $B_0\leftarrow B_1,\ldots,B_m$ (with freshly renamed variables), such that $B_0\sim_\theta A_k$ for some $k\in\{1,\ldots,n\}$, then let $S'=S_k\cup \{A_k\}$, we derive \[G'={\leftarrow \big((A_1, S_1),\ldots,(A_{k-1}, S_{k-1}),(B_1, S'),\ldots,(B_m, S'),(A_{k+1}, S_{k+1}),\ldots,(A_n,S_n)\big)\theta}\] \item (Loop Detection) If $A_k\sim_\theta B$ for some $k\in\{1,\ldots,n\}$ and some $B\in S_k$, we derive \[G'={\leftarrow \big((A_1, S_1),\ldots,(A_{k-1}, S_{k-1}),(A_{k+1}, S_{k+1}),\ldots,(A_n,S_n)\big)\theta}\] \end{enumerate} \end{defn} \begin{rmk} The notation of the form $\big((A_1,S_1),\ldots,(A_n, S_n)\big)\theta$ denotes application of $\theta$ to every $A_i$ and to every member of every $S_i$, $i\in\{1,\ldots,n\}$. \end{rmk} \begin{defn}[co-SLD Derivation/Refutation] A co-SLD derivation consists of a possibly infinite sequence of goals $G_0,G_1,\ldots$ where $G_0$ is of the form $\leftarrow (A_1,\emptyset),\ldots,(A_m, \emptyset)\ (m\geq 0)$, and for all $i\geq 0$, $G_{i+1}$ is derived from $G_i$ using co-SLD resolution. A finite co-SLD derivation ending with the empty goal is called an co-SLD refutation\footnote{Logic programming works by refuting the goal, which is the negation of the proposition that is to be proven. }. \end{defn} \begin{defn}[Computed Substitution] Given a co-SLD refutation $\mathcal{D}$, let $\theta_1,\theta_2,\ldots,\theta_n$ be the sequence of unifiers computed in $\mathcal{D}$ in the same order as they were computed, their composition $\theta_1\theta_2\cdots\theta_n$ is called the computed substitution from $\mathcal{D}$. \end{defn} Co-SLD is co-inductively sound \cite{AnconaCoSLD15,SimonCoSLD2006}. Co-inductive soundness is defined in terms of the \emph{greatest complete Herbrand model}. We assume the standard definition of complete Herbrand interpretation and complete Herbrand base \cite[Sec. 25]{FoundOfLPLloyd1987}, which, compared with Herbrand interpretation/base, allow for infinite ground terms and atoms in addition to finite ones. \begin{defn}[$T'_P$ operator] Let P be a logic program and $B'_P$ be P's complete Herbrand base. The complete immediate consequence operator $T'_P:\ 2^{B'_P}\mapsto2^{B'_P}$ is defined as follows. Let $I\subseteq B'_P$ be a complete Herbrand interpretation. Then \[T'_P(I)=\{A\in B'_P\mid A\gets A_1,\ldots,A_n\text{ is a ground instance of a clause in P and }\{A_1,\ldots,A_n\}\subseteq I \}\] \end{defn} \begin{defn}[Greatest complete Herbrand model] Let P be a program. The greatest fix point $\text{gfp}(T'_P)=\cup\{I\mid I \subseteq T'_P(I)\}$ of $T'_P$ is called the greatest complete Herbrand model of P. \end{defn} More details on $T'_P$ operator and its fix points can be found in e.g.~\cite[Sec. 26]{FoundOfLPLloyd1987}. We now justify the loop detection rule of co-SLD with an example. \begin{exmp} Consider the following program P which defines co-recursively all streams of 0's and 1's. \begin{flushleft} \hspace{1em}bit(0)$\leftarrow$ \hspace{1em}bit(1)$\leftarrow$ \hspace{1em}bit-stream(cons(X,Xs)) $\gets$ bit(X), bit-stream(Xs) \end{flushleft} The co-SLD refutation for goal $\gets$bit-stream(cons(0,Xs)), following the left-first computation rule, is finished by one step of loop detection which unifies bit-stream(Xs) and bit-stream(cons(0,Xs)) with unifier $\theta$=\{Xs/cons(0,cons(0,\ldots))\}. Note that \begin{flushleft} \hspace{1em}bit-stream(cons(0,Xs)) $\gets$ bit(0), bit-stream(Xs) \hfill (*) \end{flushleft} is an instance of the program clause, to which we can apply unifier $\theta$ and we get another program clause instance \begin{flushleft} \hspace{1em}bit-stream(cons(0,cons(0,\ldots))) $\gets$ bit(0), bit-stream(cons(0,cons(0,\ldots))) \hfill (**) \end{flushleft} We regard (*) and (**) as proof trees \cite[Sec. 1.6]{clark1980predicate}, and notice that applying the loop detection rule extends (*) into (**), whose set $I$ of nodes satisfies $I \subseteq T'_P(I)$, therefore $I$ is a subset of gfp($T'_P$). The establishment of the relation $I \subseteq T'_P(I)$ is mainly due to the reasoning that for each atom $A\in I$ (or, for each node $A$ of proof tree (**)), there exists a program clause instance whose head is $A$, and whose body is a subset of $I$, so that if $A$ is in $I$, then $A$ is in $T'_P(I)$, indicating $I \subseteq T'_P(I)$. Such reasoning applies to all co-SLD refutation that involves use of loop detection. \end{exmp} \begin{defn}[Structural Resolution] Given a logic program P and goal \[G={\leftarrow A_1,\ldots,A_n}\] the next goal $G'$ is derived using one of the following two rules: \begin{enumerate} \item (Rewriting Reduction) If there exists in P a clause $B_0\leftarrow B_1,\ldots,B_m$ (with freshly renamed variables), such that $B_0\prec_\theta A_k$ for some $k\in\{1,\ldots,n\}$, then we derive \[G'={\leftarrow (A_1,\ldots,A_{k-1},B_1,\ldots,B_m,A_{k+1},\ldots,A_n)\theta}\] \item (Substitution Reduction) If there exists in P a clause $B_0\leftarrow B_1,\ldots,B_m$ (with freshly renamed variables), such that $B_0\sim_\theta A_k$ but not $B_0\prec_\theta A_k$ for some $k\in\{1,\ldots,n\}$, then we derive \[G'={\leftarrow (A_1,\ldots,A_n)\theta}\] \end{enumerate} \end{defn} \begin{rmk} About rewriting reduction, notice that it is a special case of SLD-resolution, and since matcher $\theta$ only instantiates variables from the renamed clause $B_0\leftarrow B_1,\ldots,B_m$ without instantiating variables from goal $G$, the derived goal $G'$ can also be written as $G'={\leftarrow A_1,\ldots,A_{k-1},(B_1,\ldots,B_m)\theta,A_{k+1},\ldots,A_n}$. About substitution reduction, notice that it is, by nature, instantiation of universal quantifier. \end{rmk} \begin{defn}[S-Derivation/Refutation] A structural resolution derivation (S-derivation for short) consists of a possibly infinite sequence $G_0,G_1,\ldots$ of goals such that for all $i\geq 0$, $G_{i+1}$ is derived from $G_i$ using structural resolution, without consecutive use of substitution reduction. A finite S-derivation ending with the empty goal is called an S-refutation. \end{defn} \begin{defn}[Computed Substitution] Given a S-refutation $\mathcal{D}$, let $\theta_1,\theta_2,\ldots,\theta_n$ be the sequence of unifiers computed in $\mathcal{D}$ due to application of substitution reduction, sorted in the same order as they were computed, their composition $\theta_1\theta_2\cdots\theta_n$ is called the computed substitution from $\mathcal{D}$. \end{defn} \begin{exmp}\label{exmp: struc reso} Consider the program: \begin{center} \begin{tabularx}{\textwidth}{ XXX } \hspace{1em} $p(f(X))\leftarrow q(X)$ & $q(a)\leftarrow$ & $r(f(a))\leftarrow$ \end{tabularx} \end{center} Given goal $\leftarrow p(X),r(X)$ the next goal is $\leftarrow p(f(X_1)),r(f(X_1))$ by substitution reduction on $p(X)$ (with renamed clause $p(f(X_1))\leftarrow q(X_1)$ and unifier $\theta_1=\{X/f(X_1)\}$), then the next goal is $\leftarrow q(X_1),r(f(X_1))$ by rewriting reduction on $p(f(X_1))$ (with renamed clause $p(f(X_2))\leftarrow q(X_2)$ and matcher $\{X_2/X_1\}$), then the next goal is $\leftarrow q(a),r(f(a))$ by substitution reduction on $q(X_1)$ (with unifier $\theta_2=\{X_1/a\}$). Two more steps of rewriting reduction derive the empty goal $\leftarrow$ which terminates successfully the resolution and the computed substitution is the composition $\theta_1\theta_2=\{X/f(a),X_1/a\}$. \end{exmp} For more details on structural resolution, see \cite{StrResoKomendantskayaJ15,RewTreeJohannKK15,CoALPSemanImpKKJPMS16}. Next we introduce the combination of structural resolution and co-SLD style loop detection. \section[Co-inductive Semantics]{Co-inductive Structural Resolution}\label{sec: co-SR} We introduce the declarative and operational semantics of co-inductive structural resolution. For the operational semantics we introduce how it was formulated and prove its co-inductive soundness. \subsection{Declarative Semantics} The declarative semantics of co-inductive structural resolution is chosen to be the greatest fixed point over the complete Herbrand base \cite[ch. 4]{FoundOfLPLloyd1987}\cite{SemanOfPrologWithoutOccursCheckWeijland1988}, as for co-SLD \cite{SimonCoSLD2006,SimonThesis2006,AnconaCoSLD15}. In fact, it was a conjecture \cite{KatyaCommunication} that some form of combination of structural resolution and loop detection is correct w.r.t.\ the greatest complete Herbrand model as co-SLD is, since they share the same co-induction mechanism and their inductive components (structural resolution and SLD resolution, respectively) are both sound and complete w.r.t.\ the least Herbrand model \cite{StrResoKomendantskayaJ15}. \subsection{Operational Semantics} The implementation presented in Appendix~\ref{app: imple} played important role in formulation of the operational semantics. The implementation was created by integrating existing implementation of structural resolution \cite{Yue17SresoImple} and co-SLD \cite{Ancona13coSLDinProlog}, which showed plausible behaviour. So the implementation was then abstracted to obtain the operational semantics, whose soundness was later proved. The upshot is that the implementation had come before the formulation of the operational semantics, but was then verified as the soundness of the operational semantics was proved. In this section we present the operational semantics. \begin{defn}[Co-inductive Structural Resolution]\label{defn: co-s-reso} Given a logic program P and goal \[G={\leftarrow (A_1,S_1),\ldots,(A_n, S_n)}\] the next goal $G'$ can be derived by one of the following three rules: \begin{enumerate} \item (Rewriting Reduction) If there exists in P a clause $B_0\leftarrow B_1,\ldots,B_m$ (with freshly renamed variables), such that $B_0\prec_\theta A_k$ for some $k\in\{1,\ldots,n\}$, then let $S'=S_k\cup \{A_k\}$, we derive \[G'={\leftarrow (A_1, S_1),\ldots,(A_{k-1}, S_{k-1}),(B_1\theta, S'),\ldots,(B_m\theta, S'),(A_{k+1}, S_{k+1}),\ldots,(A_n,S_n)}\] \item (Substitution Reduction) If there exists in P a clause $B_0\leftarrow B_1,\ldots,B_m$ (with freshly renamed variables), such that $B_0\sim_\theta A_k$ but not $B_0\prec_\theta A_k$ for some $k\in\{1,\ldots,n\}$, then we derive \[G'={\leftarrow \big((A_1, S_1),\ldots,(A_n,S_n)\big)\theta}\] \item (Loop Detection) If $A_k\sim_\theta B$ for some $k\in\{1,\ldots,n\}$ and some $B\in S_k$, we derive \[G'={\leftarrow \big((A_1, S_1),\ldots,(A_{k-1}, S_{k-1}),(A_{k+1}, S_{k+1}),\ldots,(A_n,S_n)\big)\theta}\] \end{enumerate} \end{defn} Notice that the Loop Detection rule for co-inductive structural resolution is the same as its counterpart in co-SLD, and rule-1 of co-inductive structural resolution is a special case of rule-1 of co-SLD. \begin{defn}[co-S-Derivation/Refutation]\label{defn: co-s-deriv} A co-inductive structural resolution derivation is a possibly infinite sequence $G_0,G_1,\ldots$ where $G_0$ is of the form $\leftarrow(A_1, \emptyset),\ldots,(A_m,\emptyset)\ (m\geq 0)$, and for all $i\geq 0$, $G_{i+1}$ is derived from $G_i$ by co-S-resolution without consecutive use of substitution reduction. A finite co-S-derivation ending with the empty goal is called a co-S-refutation. \end{defn} \begin{defn}[Computed Substitution] Given a co-S-refutation $\mathcal{D}$, let $\theta_1,\theta_2,\ldots,\theta_n$ be the sequence of unifiers computed in $\mathcal{D}$ due to application of rule-2 or rule-3, sorted in the same order as they were computed, their composition $\theta_1\theta_2\cdots\theta_n$ is called the computed substitution from $\mathcal{D}$. \end{defn} \begin{exmp}\label{exmp: compreh co-s-reso} Consider program: \begin{center} \begin{tabularx}{\textwidth}{ XXX } \hspace{1em}$p(s(X)) \leftarrow q(X)$ & $ q(X)\leftarrow p(X),r(X)$ & $r(X) \leftarrow$ \\ \end{tabularx} \end{center} In the following co-S-refutation, for each goal we always select the left most predicate to resolve. \vspace{1em} \begin{enumerate}[{\textrm{Goal} 1:}] \item $\leftarrow\big(q(X),\emptyset\big)$ \item $\leftarrow\big(p(X),\{q(X)\}\big),\big(r(X),\{q(X)\}\big)$ \hfill (rule-1.~$ q(X_1)\leftarrow p(X_1),r(X_1).~\{X_1/X\}$) \item $\leftarrow\big(p(s(X_2)),\{q(s(X_2))\}\big),\big(r(s(X_2)),\{q(s(X_2))\}\big)$ \hfill (rule-2.~$ p(s(X_2))\leftarrow q(X_2).~\theta_1=\{X/s(X_2)\}$) \item $\leftarrow\big(q(X_2),\{p(s(X_2)),q(s(X_2))\}\big),\big(r(s(X_2)),\{q(s(X_2))\}\big)$ \hfill (rule-1.~$ p(s(X_3))\leftarrow q(X_3).~\{X_3/X_2\}$) \item $\leftarrow\big(r(s(s(s(\ldots)))),\{q(s(s(s(\ldots))))\}\big)$ \hfill (rule-3.~$ q(X_2)\sim_{\theta_2} q(s(X_2)).~\theta_2=\{X_2/s(s(s(\ldots)))\}$) \item $\leftarrow$ \hfill (rule-1.~$ r(X_4)\leftarrow.~\{X_4/s(s(s(\ldots)))\}$) \end{enumerate}\vspace{1em} The answer to Goal 1 is given by computed substitution $\theta_1\theta_2=\{X/s(s(s(\ldots))),X_2/s(s(s(\ldots)))\}$. Loop detection is used once for reduction from Goal 4 to Goal 5, and predicate $q(X_2)$ in Goal 4 is co-inductively proved. \end{exmp} \subsection{Soundness Proof} In this section, the main result shows that given a goal $G$, if there is a co-S-refutation for $G$, with computed substitution $\sigma$, then there is a co-SLD refutation for $G\sigma$, with computed substitution $\epsilon$ (i.e. the empty substitution). Therefore if co-SLD is sound, then $G\sigma\epsilon=G\sigma$ is in the greatest complete Herbrand model, meaning that co-S-resolution is also sound. We will define a transformation algorithm that step-by-step transforms a co-S-refutation of goal $G$ into a co-SLD refutation of goal $G\sigma$. The transformation is via an intermediate derivation, called \emph{co-rewriting-id derivation}, which simply consists of co-SLD resolution steps interleaved with identity reduction steps (c.f. Definition~\ref{defn: id reduction}). So given a co-S-refutation, it will be firstly transformed into a co-rewriting-id refutation, which will then be trivially transformed into a co-SLD refutation. The transformation from a co-S-refutation to a co-rewriting-id refutation is done during a sequential traverse of the co-S-refutation, starting from the initial goal. According to the three lemmas (i.e. Lemma~\ref{lem: rew preserv},~\ref{lem: instant preserv} and~\ref{lem: loop detect preserve}, defined later), each goal reduction step in the co-S-refutation establishes a co-rewriting-id reduction step, and all co-rewriting-id reduction steps established during the traverse form the co-rewriting-id refutation. The following are details of the proof. \begin{defn}[Identity Reduction]\label{defn: id reduction} Given some goal $G$, the reduction from $G$ to itself, is called identity reduction, denoted by \[G\xrightarrow{\textrm{id}}G \] \end{defn} \begin{defn}[co-Rewriting-ID Resolution]\label{defn: co-rew-id reso} Given a program and some goal $G$, the next goal $G'$ can be derived from $G$ using one of following three rules: \begin{enumerate} \item The same as rule 1 in Definition~\ref{defn: co-s-reso}. \item Identity reduction. \item The same as rule 3 in Definition~\ref{defn: co-s-reso}. \end{enumerate} \end{defn} \begin{defn}[co-Rewriting-ID Derivation/Refutation]\label{defn: co-rew-id deriv} A co-rewriting-id derivation is a possibly infinite sequence $G_0,G_1,\ldots$ where $G_0$ is of the form $\leftarrow(A_1, \emptyset),\ldots,(A_m,\emptyset)\ (m\geq 0)$, and for all $i\geq 0$, $G_{i+1}$ is derived from $G_i$ by co-rewriting-id resolution without consecutive use of identity reduction. A finite co-rewriting-id derivation ending with the empty goal is called a co-rewriting-id refutation. \end{defn} \begin{defn}[Computed Substitution] Given a co-rewriting-id refutation $\mathcal{D}$, let $\theta_1,\theta_2,\ldots,\theta_n$ be the sequence of unifiers computed in $\mathcal{D}$ due to application of rule-3, sorted in the same order as they were computed, their composition $\theta_1\theta_2\cdots\theta_n$ is called the computed substitution from $\mathcal{D}$. \end{defn} \begin{prop}\label{thm: co-rew-id to cosld} Given a program, for any goal $G$, if there is a co-rewriting-id refutation for $G$ with computed substitution $\theta$, then there is a co-SLD refutation for $G$ with the same computed substitution $\theta$. \end{prop} \begin{proof} Suppose $\mathcal{D}=G_0,\ldots,G_n$ is a co-rewriting-id refutation for $G=G_0$ with computed substitution $\theta$. By simultaneously removing from $\mathcal{D}$ all $G_{i+1}\ (i\in [0,n-1])$ such that $G_i\xrightarrow{\textrm{id}} G_{i+1}$, the resulting derivation $\mathcal{D'}$ constitutes a co-SLD derivation with computed substitution $\theta$. Moreover, $\mathcal{D'}$ is a special case of co-SLD derivation since Definition~\ref{defn: co-rew-id reso}-rule 1 is a special case of Definition~\ref{defn: co-SLD reso}-rule 1. \end{proof} \begin{thm}\label{thm: co-s to co-r-id} Given a program, for any goal $G$, if there is a co-S-refutation for $G$ with computed substitution $\sigma$, then there is a co-rewriting-id refutation for $G\sigma$ with computed substitution $\epsilon$ (the empty substitution). \end{thm} The proof of Theorem~\ref{thm: co-s to co-r-id} is based on properties of co-inductive structural resolution rules, formulated in the following three lemmas. \begin{lem}[Rewriting Preservation]\label{lem: rew preserv} Let \[G\xrightarrow[B]{\textrm{rule-1}}G'\] be a goal reduction using rule-1 (as defined in Definition~\ref{defn: co-s-reso}), and $B$ the program clause involved in the reduction. Then for any substitution $\sigma$, it holds that \[G\sigma\xrightarrow[B]{\textrm{rule-1}}G'\sigma\] \end{lem} \begin{proof} Assume \begin{itemize} \item $G={\leftarrow(A_1,S_1),\ldots,(A_k,S_k),\ldots,(A_n,S_n)}$ and \item $B$ has the form $B_0\leftarrow B_1,\ldots,B_m\ (m\geq 0)$ and \item $B_0\prec_\gamma A_k$, for some $k\in[1,n]$. \end{itemize} By Definition~\ref{defn: co-s-reso}, rule-1, \begin{equation}\label{equa: G prime in rew preserve} G'={\leftarrow(A_1,S_1),\ldots,(A_{k-1},S_{k-1}),(B_1\gamma,S'),\ldots,(B_m\gamma,S'),(A_{k+1},S_{k+1}),\ldots,(A_n,S_n)} \end{equation} where $S'=S_k\cup\{A_k\}.$ Since $B_0\prec_\gamma A_k$ (by the above assumption), it means (by Definition~\ref{defn: term matching}) that \begin{equation}\label{equa: B 0 gamma equals to A k in rew pres} B_0\gamma=A_k \end{equation} Then for all $\sigma$, if we apply $\sigma$ to both sides of \eqref{equa: B 0 gamma equals to A k in rew pres}, we have $B_0\gamma\sigma=A_k\sigma$, which means (by associativity of substitution \cite[Sec. 4]{FoundOfLPLloyd1987} and Definition~\ref{defn: term matching}) that \begin{equation}\label{equa: B0 also subsumes A k sigma} B_0\prec_{\gamma\sigma} A_k\sigma. \end{equation} Now consider $G\sigma$, by notational convention, \begin{equation}\label{equa: G sigma form in rew preserv} G\sigma={\leftarrow(A_1\sigma,S_1\sigma),\ldots,(A_k\sigma,S_k\sigma),\ldots(A_n\sigma,S_n\sigma)} \end{equation} Because of \eqref{equa: B0 also subsumes A k sigma} and \eqref{equa: G sigma form in rew preserv}, we can have reduction \begin{equation}\label{equa: reduction of G sigma in rew preserv} G\sigma\xrightarrow[B]{\textrm{rule-1}}G'' \end{equation} where, by Definition~\ref{defn: co-s-reso}, rule-1, \begin{equation}\label{equa: G double prime in rew preserv} G''={\leftarrow(A_1\sigma,S_1\sigma),\ldots,(A_{k-1}\sigma,S_{k-1}\sigma),(B_1\gamma\sigma,S''),\ldots,(B_m\gamma\sigma,S''),(A_{k+1}\sigma,S_{k+1}\sigma),\ldots,(A_n\sigma,S_n\sigma)} \end{equation} where $S''=S_k\sigma \cup \{A_k\sigma\}.$ Compare \eqref{equa: G prime in rew preserve} and \eqref{equa: G double prime in rew preserv}, we have, by notational convention, \begin{equation}\label{equa: G double prime is G prime sigma} G''=G'\sigma \end{equation} By \eqref{equa: reduction of G sigma in rew preserv} and \eqref{equa: G double prime is G prime sigma}, we reach the conclusion of Lemma~\ref{lem: rew preserv}. \end{proof} Hereinafter we adopt the following notation for substitution compositions. Given a sequence of substitutions $\theta_1,\theta_2,\ldots,\theta_n$, for all $k\in\{1,\ldots,n\}$, let $\sigma_k$ denote the composition $\theta_k\theta_{k+1}\cdots\theta_n$. For example, let $\theta_1,\theta_2,\theta_3,\theta_4$ be a sequence of 4 substitutions, then $\sigma_1=\theta_1\theta_2\theta_3\theta_4$, $\sigma_2=\theta_2\theta_3\theta_4$, $\sigma_3=\theta_3\theta_4$ and $\sigma_4=\theta_4$. \begin{lem}[Instantiation Preservation]\label{lem: instant preserv} Let \[G\xrightarrow[\theta_k]{\textrm{rule-2}}G'\] be a goal reduction using rule-2 (as defined in Definition~\ref{defn: co-s-reso}), where $\theta_k$ is the unifier involved in the reduction, and let \[\sigma_k=\theta_k\theta_{k+1}\cdots\theta_n\] for some $n> k$ and some (arbitrary and possibly $\epsilon$) substitutions $\theta_{k+1},\ldots,\theta_n$. Then \[G\sigma_k\xrightarrow{\ \textrm{id}\ }G'\sigma_{k+1}\] \end{lem} \begin{rmk} The sequence of $\theta$'s in Lemma~\ref{lem: instant preserv} will come from co-S-resolution steps when Lemma~\ref{lem: instant preserv} is used to prove Theorem~\ref{thm: co-s to co-r-id}. \end{rmk} \begin{proof} From the premise of Lemma~\ref{lem: instant preserv}, we have \begin{equation}\label{equa: G prime equals to G theta k in instan pres} G\theta_k=G' \end{equation} Applying $\sigma_{k+1}(=\theta_{k+1}\cdots\theta_n)$ to both sides of \eqref{equa: G prime equals to G theta k in instan pres} we have \begin{equation}\label{equa: sigma k plus one applied to both sides in instan pres} G\theta_k\sigma_{k+1}=G'\sigma_{k+1} \end{equation} Note that in \eqref{equa: sigma k plus one applied to both sides in instan pres} \[\theta_k\sigma_{k+1}=\sigma_k\] therefore by associativity of substitution, \eqref{equa: sigma k plus one applied to both sides in instan pres} can be written as \[G\sigma_k=G'\sigma_{k+1}\] hence the identity reduction $G\sigma_k\xrightarrow{\ \textrm{id}\ }G'\sigma_{k+1}$. \end{proof} \begin{lem}[Loop Detection Preservation]\label{lem: loop detect preserve} Let \[G\xrightarrow[\theta_k]{\textrm{rule-3}}G'\] be a goal reduction using rule-3 (as defined in Definition~\ref{defn: co-s-reso}), where $\theta_k$ is the unifier involved in the reduction, and let \[\sigma_k=\theta_k\theta_{k+1}\cdots\theta_n\] for some $n> k$ and some (arbitrary and possibly $\epsilon$) substitutions $\theta_{k+1},\ldots,\theta_n$. Then \[G\sigma_k\xrightarrow[\epsilon]{ \textrm{rule-3} }G'\sigma_{k+1}\] \end{lem} \begin{proof} Assume \begin{equation} G={\leftarrow(A_1,S_1),\ldots,(A_k,S_k),\ldots,(A_n,S_n)} \end{equation} and \begin{equation}\label{equa: loop pres A k unifies B} A_k\sim_{\theta_k}B \end{equation} for some $k\in[1,n]$ and some \begin{equation}\label{equa: B in S k loop pres} B\in S_k \end{equation} By Definition~\ref{defn: co-s-reso}, rule-3, \begin{equation}\label{equa: G prime verbose} G'={\leftarrow\big((A_1,S_1),\ldots,(A_{k-1},S_{k-1}),(A_{k+1},S_{k+1}),\ldots,(A_n,S_n)\big)\theta_k} \end{equation} From \eqref{equa: loop pres A k unifies B} and Definition~\ref{defn: unification}, \begin{equation}\label{equa: A k theta k equals to b theta k} A_k\theta_k = B\theta_k \end{equation} Applying $\sigma_{k+1}(=\theta_{k+1}\cdots\theta_n)$ to both sides of \eqref{equa: A k theta k equals to b theta k}, we have $A_k\theta_k\sigma_{k+1} = B\theta_k\sigma_{k+1}$, then due to $\sigma_k=\theta_k\sigma_{k+1}$ and associativity of substitution, \begin{equation} A_k\sigma_{k} = B\sigma_{k} \end{equation} which means \begin{equation}\label{equa: loop new unif} A_k\sigma_{k}\sim_\epsilon B\sigma_k \end{equation} Consider $G\sigma_k$, which can be written as \begin{equation}\label{equa: loop G sigma k form} G\sigma_k={\leftarrow(A_1\sigma_k,S_1\sigma_k),\ldots,(A_k\sigma_k,S_k\sigma_k),\ldots,(A_n\sigma_k,S_n\sigma_k)} \end{equation} Due to \eqref{equa: B in S k loop pres}, it holds that \begin{equation}\label{equa: B sigma k in S k sigma k loop} B\sigma_k\in S_K\sigma_k \end{equation} From \eqref{equa: loop new unif} and \eqref{equa: B sigma k in S k sigma k loop}, $G\sigma_k$ as in \eqref{equa: loop G sigma k form} can be reduced using Definition~\ref{defn: co-s-reso} rule 3, resulting in \begin{equation*} G''={\leftarrow(A_1\sigma_k,S_1\sigma_k),\ldots,(A_{k-1}\sigma_k,S_{k-1}\sigma_k),(A_{k+1}\sigma_k,S_{k+1}\sigma_k),\ldots,(A_n\sigma_k,S_n\sigma_k)} \end{equation*}which can be rewritten in a simpler form \begin{equation}\label{equa: G sigma k reduced loop} G''={\leftarrow\big((A_1,S_1),\ldots,(A_{k-1},S_{k-1}),(A_{k+1},S_{k+1}),\ldots,(A_n,S_n)\big)\sigma_k} \end{equation} The reduction of $G\sigma_k$ is denoted by \begin{equation}\label{equa: loop pres reduction rule-3} G\sigma_k\xrightarrow[\epsilon]{ \textrm{rule-3} }G'' \end{equation} Comparing \eqref{equa: G prime verbose} with \eqref{equa: G sigma k reduced loop}, we conclude, by associativity of substitution, that \[G''=G'\sigma_{k+1}\] and with \eqref{equa: loop pres reduction rule-3} we reach the conclusion of Lemma~\ref{lem: loop detect preserve}. \end{proof} Next we give an algorithm that outputs co-rewriting-id refutations, giving a co-S-refutation as input. This algorithm constitutes our proof of Theorem~\ref{thm: co-s to co-r-id} and we will provide an example to demonstrate the algorithm at work. \begin{proof}[Proof of Theorem~\ref{thm: co-s to co-r-id}] Given a goal $G=G_0$, assume $\mathcal{D}=G_0,\ldots,G_n$ is a co-S-derivation, and $\theta_1,\ldots\theta_m$ is the sequence of unifiers computed during derivation $\mathcal{D}$ due to the use of Definition~\ref{defn: co-s-reso} rule 2 or 3. Let $\theta_{m+1}=\epsilon$ so $\sigma_1=\theta_1,\ldots\theta_m\theta_{m+1}$ is the computed substitution for goal $G$. Definition~\ref{defn: co-s-reso} is the default domain when we mention rule 1,2 or 3 in this proof. We build the co-rewriting-id derivation $\mathcal{D'}$ of $G\sigma_1$ using the following algorithm. For each $i\in\{0,\ldots,n-1\}$, \emph{starting from $i=0$ and in the ascending order of $i$}, \hfill (*) \begin{itemize} \item If \[G_i\xrightarrow[B]{\textrm{rule-1}}G_{i+1}\] then write down, by Lemma~\ref{lem: rew preserv}, \[G_i\sigma_x\xrightarrow[B]{\textrm{rule-1}}G_{i+1}\sigma_x\] where \[ x= \begin{cases} 1 & \quad \text{If }i=0;\\ k & \quad \text{If } i>0\text{ and }G_i\sigma_k\text{ is in }\mathcal{D'}.\\ \end{cases} \] $x$ is well-defined in the second case because of the condition (*). \item If \[G_i\xrightarrow[\theta_k]{\textrm{rule-2}}G_{i+1}\] then write down, by Lemma~\ref{lem: instant preserv}, \[G_i\sigma_k\xrightarrow{\textrm{id}}G_{i+1}\sigma_{k+1}\] \item If \[G_i\xrightarrow[\theta_k]{\textrm{rule-3}}G_{i+1}\] then write down, by Lemma~\ref{lem: loop detect preserve}, \[G_i\sigma_k\xrightarrow[\epsilon]{\textrm{rule-3}}G_{i+1}\sigma_{k+1}\] \end{itemize} \end{proof} \begin{rmk} Compare the specific co-S-refutation for goal $G_0$, which has computed substitution $\sigma_1=\theta_1\theta_2\theta_3\theta_4$ where $\theta_4=\epsilon$, with the co-rewriting-id refutation for goal $G_0\sigma_1$ generated by the algorithm. \begin{align*} G_0\textcolor{white}{\sigma_1} & \xrightarrow[B_1]{rule-1} & G_1\textcolor{white}{\sigma_1} & \xrightarrow[B_2]{rule-1} & G_2\textcolor{white}{\sigma_1} & \xrightarrow[\theta_1]{rule-2} & G_3\textcolor{white}{\sigma_1} & \xrightarrow[\theta_2]{rule-3} & G_4\textcolor{white}{\sigma_1} & \xrightarrow[B_3]{rule-1} & G_5\textcolor{white}{\sigma_1} &\xrightarrow[\theta_3]{rule-3} & (G_6\textcolor{white}{\sigma_1}=\leftarrow)\\ G_0\sigma_1 & \xrightarrow[B_1]{rule-1} & G_1\sigma_1 & \xrightarrow[B_2]{rule-1} & G_2\sigma_1 & \xrightarrow{\textcolor{white}{ab}id\textcolor{white}{-3}} & G_3\sigma_2& \xrightarrow[\epsilon]{rule-3} & G_4\sigma_3& \xrightarrow[B_3]{rule-1} & G_5\sigma_3& \xrightarrow[\epsilon]{rule-3} & (G_6\sigma_4=\leftarrow) \end{align*} \end{rmk} \begin{thm}[Soundness] Co-inductive structural resolution is sound with respect to the greatest complete Herbrand model. In other words, if a goal $G$ has a co-S-derivation with computed substitution $\sigma$, then $G\sigma$ is in the greatest model. \end{thm} \begin{proof} Given a program and some goal $G$, assume $G$ has a co-S-derivation with computed substitution $\sigma$. By Theorem~\ref{thm: co-s to co-r-id} $G\sigma$ has a co-rewriting-id derivation with computed substitution $\epsilon$, then by Proposition~\ref{thm: co-rew-id to cosld} $G\sigma$ has a co-SLD derivation with computed substitution $\epsilon$. Since co-SLD is sound with respect to the greatest complete Herbrand model, $G\sigma\epsilon=G\sigma$ is in the model. \end{proof} \section{Related Work and Conclusion}\label{sec:related work} Existing soundness proof for co-SLD helped this work. A soundness proof of co-SLD, based on co-induction, is provided in~\cite{SimonThesis2006}, in which it was established by a lemma that if some goal $G$ has co-SLD derivation with computed substitution $\sigma$, then $G\sigma$ also has a co-SLD derivation. This idea inspired the author to explore if a goal has a co-S-derivation, whether there is also a co-S-derivation for the same goal with computed answer applied. Another soundness proof of co-SLD is given in~\cite{AnconaCoSLD15}, which is based on the theory of infinite tree logic programming formulated in~\cite{JaffarInfTreeLP}. The infinite tree derivation proposed in \cite{JaffarInfTreeLP} selects all sub-goal altogether rather than one sub-goal at a time, and it is sound with respect to the greatest model. In \cite{AnconaCoSLD15} the soundness of co-SLD is proved by showing that any co-SLD derivation can be unfolded into an infinite tree derivation, therefore the soundness of co-SLD derivation is backed by the soundness of infinite tree derivation. Our proof in this paper obviously is inspired by such technique in \cite{AnconaCoSLD15}, which relates different derivations and reuses previous results. As a by-product of our proof, we can use the same arguments to show that soundness and completeness of structural resolution can be proved based on soundness and completeness of SLD resolution. For soundness, if a goal $G$ has a successful structural resolution derivation with computed substitution $\sigma$, then $G\sigma$ has a successful rewriting-id derivation, which is a special case of SLD derivation. For completeness, it needs to be shown that every SLD derivation has a corresponding structural resolution derivation, by splitting each non-rewriting step in SLD derivation into one step of substitution reduction followed by one step of rewriting reduction. Future work will involve development of a productivity semi-decision algorithm based on co-inductive structural resolution. Now we have a sketch of the role that will be played by co-S-resolution. Given a non-terminating SLD derivation, necessarily some (maybe none) of its SLD resolution steps are rewriting reductions. A class of programs are characterized for their termination for rewriting \cite{StrResoKomendantskayaJ15,KatyaProductivityChecker16}, called \emph{observationally productive} programs. Since all consecutive rewriting steps are finite for such programs, in a non-terminating SLD derivation of some observationally productive program, there necessarily are infinite steps of non-rewriting SLD resolution steps. This fact will be crucial for productivity analysis since only non-rewriting steps can produce unifiers that may accumulate and instantiate the original goal into an infinite tree at infinity. Since the notion of productivity relies on rewriting reduction, productivity analysis is made easier by S-resolution compared with using SLD resolution; hence the advantage of structural resolution over SLD resolution. Moreover, loop detection needs to be combined with S-resolution to serve as a finite implementation of non-terminating productive S-derivations; finding a way for such a combination, proving its co-inductive soundness, and implementing it, are the contributions of this paper. \paragraph{Acknowledgement} I would like to thank my supervisor Dr.~Ekaterina Komendantskaya for her support and discussion. I would like to thank Dr.~Joe Wells and anonymous reviewers for their constructive comments. \bibliographystyle{eptcs}
{'timestamp': '2017-09-15T02:07:39', 'yymm': '1703', 'arxiv_id': '1703.08336', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08336'}
arxiv
\subsection{Disjunctive Defaults} \label{sec:orgheadline1} In \cite{Gelfond_et-al_PKRR_1991} a generalization of default logic, \emph{disjunctive default logic}, is proposed that is more apt to deal with disjunctions than Reiter's original approach. For instance, given the default theory with \(p \vee q\) and the defaults \(p \Rightarrow r\) and \(q \Rightarrow r\), \(r\) is not a default consequence in Reiter's approach since the only extension of this theory is \(Cn(p\vee q)\). In disjunctive default logic, an alternative disjunction \(\mid\) is available: \(p \mid q\) enforces that \(p\) or \(q\) is in any extension of the theory. So, for the default theory consisting of \(p \mid q\), and the defaults \(p \Rightarrow r\) and \(q \Rightarrow r\) we have two extensions, \(Cn(\{p,r\})\) and \(Cn(\{q,r\})\). Now \(r\) is a skeptical consequence. Default consequents can also make use of \(\mid\): a disjunctive default is of the form: \[ \frac{\phi : \psi_1, \ldots, \psi_n}{\gamma_1 \mid \ldots \mid \gamma_m}\] where \(\phi\) is the prerequisite, \(\psi_1, \ldots, \psi_n\) are justifications, and \(\gamma_1, \ldots, \gamma_m\) are consequents of the default. A set of formulas \(\Xi\) is an extension of a disjunctive default theory consisting of the disjunctive defaults in \(\Delta\) (we here follow the convention in \cite{Gelfond_et-al_PKRR_1991} according to which 'facts' are considered as disjunctive defaults with empty prerequisite and empty justification) if it satisfies the following requirements: (i) for any \(\frac{\phi : \psi_1, \ldots, \psi_n}{\gamma_1 \mid \ldots \mid \gamma_m} \in \Delta\), if \(\phi \in \Xi\) and \(\neg \psi_1, \ldots, \neg \psi_n \notin \Xi\) then \(\gamma_i \in \Xi\) for some \(1 \le i \le m\), (ii) \(Cn(\Xi) = \Xi\), and (iii) \(\Xi\) is minimal with properties (i) and (ii).\footnote{This definition in \cite{Gelfond_et-al_PKRR_1991} is suboptimal in that it gives undesired results: e.g.\ for the theory $\Delta = \{\frac{\top ~:~ \neg p}{\neg p}\}$ also $Cn(p)$ will form an extension. The problem can easily be fixed though by defining extensions analogous to Reiter.} We compare our approach to disjunctive default logic by thinking of \(\Rightarrow\) as a default conditional: \(\psi \Rightarrow \phi\) encodes the normal default \(\frac{\psi : \phi}{\phi}\). We start our comparison with the example given above. Let \(\Delta_1 = \lbrace p \mid q, p \Rightarrow r, q \Rightarrow r \rbrace\). \(\Delta_1\) has two extensions, \(Cn(\lbrace p, r \rbrace)\) and \(Cn(\lbrace q, r \rbrace)\) and so \(r\) is a skeptical consequence. This outcome corresponds to our approach for the theory ${\rm AT}_1 = (\{p\Rightarrow r, q\Rightarrow r\},\{p\vee q\})$: the argument \(\langle\langle p \vee q\rangle, [\langle p\rangle \Rightarrow r], [\langle q\rangle \Rightarrow r] \leadsto r\rangle\) is in all complete extensions of \({\rm AT}_1\). Next, consider Poole's \emph{broken arm} example \cite{Poole_KR_1989}. Let \(l\) be ``having a left broken arm'', \(r\) ``having a right broken arm'', \(w\) ``writing legibly''. On our approach, the theory ${\rm AT}_{\rm arm} = (\{w\Rightarrow\neg r\},\{l\vee r,w\})$ gives rise to the argument \(\langle\langle\langle w \rangle \Rightarrow \neg r\rangle, \langle l \vee r\rangle \rightarrow l\rangle\), which is in all complete extensions of ${\rm AT}_{\rm arm}$. In contrast, the disjunctive default theory \(\Delta_{\rm arm} = \lbrace l \mid r, w, w\Rightarrow \neg r \rbrace\) has two extensions \(Cn(\lbrace l, w, \neg r \rbrace)\) and \(Cn(\lbrace r, w \rbrace)\). Since \(l \notin Cn(\lbrace r,w \rbrace)\), \(l\) is not a skeptical consequence in disjunctive default logic. Finally, reconsider the AT from Example \ref{motivation_att_1}. There are various ways in which we can translate this AT into a disjunctive default theory, e.g.\footnote{Our discussion also applies if we translate $p \Rightarrow q \vee r$ by $\frac{p ~:~ q \wedge r}{q \mid r}$.} \[\Delta_3 = \left\lbrace \frac{p : q \vee r}{q \mid r}, \frac{q : s}{s}, \frac{s : v}{v}, \frac{r : v}{v}, \frac{t : \neg s}{\neg s},p , t \right\rbrace\] For \(\Delta_3\) we have the extensions \(Cn(\lbrace p, t, q, s, v \rbrace)\), \(Cn(\lbrace p, t, q, \neg s \rbrace)\), and \(Cn(\lbrace p, t, \neg s, r, v \rbrace)\), so \(v\) is not a skeptical consequence. This corresponds to our approach in which the argument $A_1$ from Example \ref{motivation_att_1} is excluded due to the attack by $A_2$. However, on our approach $A_2$ is in all complete extensions, so contrary to disjunctive default logic we obtain $\neg s$ as a skeptical consequence. \subsection{The OR meta-rule} \label{sec:orgheadline2} A different approach for dealing with disjunctive information is to allow for inference rules that produce new conditionals from given conditionals. We, for instance, find the following rule in system \textbf{P} \cite{KrLeMa90} and in several Input/Output logics \cite{MakTor00}: \[ \frac{\psi \Rightarrow \phi ~~ \psi' \Rightarrow \phi}{\psi \vee \psi' \Rightarrow \phi}~~[{\rm OR}]\] One could define an $ASPIC^+$-like system where arguments are constructed as in rules 1--3 in Definition \ref{def_arg}, and in which the defeasible rules are closed under OR. For instance, given \({\rm AT}_1\) from Section \ref{sec:orgheadline1} this allows to derive \(p \vee q \Rightarrow r\) from \(p \Rightarrow r\) and \(q \Rightarrow r\), so that we can construct the argument \(\langle p \vee q\rangle \Rightarrow r\) and obtain \(r\) as a consequence. Adding OR is not sufficient to always get the intuitive outcome. Let \({\rm AT}_4 = (\{p \Rightarrow q \vee r, q \Rightarrow s, s \Rightarrow v, r \Rightarrow u, u \Rightarrow v\},\{p\})\). One would want to build an argument for \(v\), but we cannot put OR to much use (except for deriving \(s \vee u \Rightarrow v\)). We would have to combine OR with e.g.\ right-weakening (RW: \(\frac{\psi \vdash \phi ~~ \psi' \Rightarrow \psi}{\psi' \Rightarrow \phi}\)), or generalize OR to \[ \frac{\psi \Rightarrow \phi ~~ \psi' \Rightarrow \phi'}{\psi \vee \psi' \Rightarrow \phi \vee \phi'}~~[{\rm gOR}]\] in order to produce \(q \vee r \Rightarrow s \vee u\). Since also \(s \vee u \Rightarrow v \vee v\) can be derived, we now have the means to construct the argument \(\langle \langle \langle p \Rightarrow q \vee r\rangle \Rightarrow s \vee u\rangle \Rightarrow v \vee v\rangle \rightarrow v\). In many systems of nonmonotonic logic, e.g.\ in system \textbf{P} and in many Input/Output logics, OR and RW are available (and thus gOR is a derived rule). We now contrast our approach with such (g)OR-based approaches. A striking difference concerns the handling of Example \ref{motivation_att_1}. In the gOR-based system we can construct: \[ A_3 = \langle \langle \langle p \Rightarrow q \vee r\rangle \Rightarrow s \vee v\rangle \Rightarrow v \vee v\rangle \rightarrow v \] This argument is not attacked by the argument \(t \Rightarrow \neg s\). An alternative argument for \(v\) is given by \(\langle t \Rightarrow \neg s\rangle, \langle \langle p \Rightarrow q \vee r\rangle \Rightarrow s \vee v\rangle \rightarrow v\). Recall that neither in our approach nor in disjunctive default logic \(v\) is a skeptical consequence. Even if we add \(\neg r\) to the knowledge base $\mathcal{F}$ in Example \ref{motivation_att_1}, \(v\) remains derivable in the gOR-based approach since \(A_3\) remains unchallenged. This is counter-intuitive: both the argumentative path via \(q \Rightarrow s \Rightarrow v\) and the path via \(r \Rightarrow v\) are barred in view of the unchallenged arguments \(t \Rightarrow \neg s\) and \(\neg r\). An advantage of using the reasoning-by-cases rule 4 in Definition \ref{def_arg} is that it provides more fine-grained ways of tracking commitments in sub-arguments. This enables us to block the undesired consequence \(v\) in this example.\footnote{An additional advantage is that argument strength can be tracked in a more fine-grained way when using RbC in contrast to OR-based approaches. See also Section \ref{sec:conclusion-outlook}. } \subsection{Arguments}\label{sub_argdefs} \def{\rm AT}{{\rm AT}} We illustrate our framework using the propositional fragment of classical logic (\sys{CL}) as our core logic. We denote the consequence relation of \sys{CL} by $\vdash$. To obtain the formal language $\mathcal{L}$ of \sys{CL}, we close a denumerable stock $\mathcal{P}=\{p,q,r,\ldots\}$ of propositional letters under the usual \sys{CL}-connectives $\neg, \vee, \wedge, \supset, \equiv$. We also add the verum constant $\top$ and the falsum constant $\bot$ to $\mathcal{L}$. For reasons of transparency we will sometimes use subscripted letters $p_1,p_2,q_1,q_2,\ldots$ as names for propositional letters. \begin{definition}[Argumentation theory]\label{def_AT} An argumentation theory (AT) is a triple ${\rm AT} = (\mathcal{L},\mathcal{R},\mathcal{F})$ where: \begin{itemize}[itemsep=1pt] \item $\mathcal{L}$ is our formal language defined above; \item $\mathcal{R}=\mathcal{S}\cup\mathcal{D}$ is a set of strict ($\mathcal{S}$) and defeasible ($\mathcal{D}$) inference rules of the form $\varphi_1,\ldots,\varphi_n \ensuremath{\rightarrow} \psi$ and $\varphi_1,\ldots,\varphi_n \ensuremath{\Rightarrow} \psi$ respectively (where $\varphi_1,\ldots,\varphi_n,\psi\in\mathcal{L}$); and \item $\ensuremath{\mathcal{F}}\subseteq\mathcal{L}$ is a \sys{CL}-consistent knowledge base.\footnote{$\ensuremath{\mathcal{F}}\subseteq\mathcal{L}$ is \emph{\sys{CL}-consistent} iff $\ensuremath{\mathcal{F}}\not\vdash\bot$.} \end{itemize} \end{definition} We assume in addition that $\varphi_1,\ldots,\varphi_n\ensuremath{\rightarrow} \psi \in \mathcal{S}$ iff $\{\varphi_1,\ldots,\varphi_n\}\vdash \psi$. Since we keep $\mathcal{L}$ and $\mathcal{S}$ fixed, we will in the remainder refer to ATs as pairs $(\mathcal{D,F})$. \begin{definition}[Arguments]\label{def_arg} Given an argumentation theory ${\rm AT} = (\ensuremath{\mathcal{D}},\ensuremath{\mathcal{F}})$, the set of arguments $\ensuremath{{\tt Arg}}^{\bot}({\rm AT})$ contains: \begin{enumerate}[itemsep=1pt] \item \(A = \langle \phi \rangle\) where \(\phi \in \ensuremath{\mathcal{F}}\) \begin{itemize}[itemsep=1pt,topsep=1pt] \item \(\ensuremath{{\tt Conc}}(A) = \phi\) \item \(\ensuremath{{\tt Sub}}(A) = \lbrace A \rbrace\) \item \(\ensuremath{{\tt HSub}}(A) = \emptyset\) \end{itemize} \item \(A = \langle A_{1} , \ldots, A_n \rightarrow \phi \rangle\) where \(A_1, \ldots, A_n \in \ensuremath{{\tt Arg}}^\bot({\rm AT})\) and \(\ensuremath{{\tt Conc}}(A_1), \ldots, \ensuremath{{\tt Conc}}(A_n) \ensuremath{\rightarrow} \phi\in \mathcal{S}\) \begin{itemize}[itemsep=1pt,topsep=1pt] \item \(\ensuremath{{\tt Conc}}(A) = \phi\) \item \(\ensuremath{{\tt Sub}}(A) = \lbrace A \rbrace \cup \ensuremath{{\tt Sub}}(A_1) \cup \ldots \cup \ensuremath{{\tt Sub}}(A_n)\) \item \(\ensuremath{{\tt HSub}}(A) = \ensuremath{{\tt HSub}}(A_1) \cup \ldots \cup \ensuremath{{\tt HSub}}(A_n)\) \end{itemize} \item \(A = \langle A_{1} , \ldots, A_n \Rightarrow \phi \rangle\) where \(A_1, \ldots, A_n \in \ensuremath{{\tt Arg}}^\bot({\rm AT})\) and \(\ensuremath{{\tt Conc}}(A_1), \ldots, \ensuremath{{\tt Conc}}(A_n) \Rightarrow \phi \in \ensuremath{\mathcal{D}}\) \begin{itemize}[itemsep=1pt,topsep=1pt] \item \(\ensuremath{{\tt Conc}}(A) = \phi\) \item \(\ensuremath{{\tt Sub}}(A) = \lbrace A \rbrace \cup \ensuremath{{\tt Sub}}(A_1) \cup \ldots \cup \ensuremath{{\tt Sub}}(A_n)\) \item \(\ensuremath{{\tt HSub}}(A) = \ensuremath{{\tt HSub}}(A_1) \cup \ldots \cup \ensuremath{{\tt HSub}}(A_n)\) \end{itemize} \item \(A = \langle A_{1} , [A_2], \ldots, [A_n] \leadsto \phi\rangle\) where $n \ge 3$ \begin{itemize}[itemsep=1pt,topsep=1pt] \item \(\phi = \bigvee \lbrace \ensuremath{{\tt Conc}}(A_2), \ldots, \ensuremath{{\tt Conc}}(A_n) \rbrace\), \item \(\ensuremath{{\tt Conc}}(A_1) = \bigvee_{i=2}^n \psi_i\), \(A_i \in \ensuremath{{\tt Arg}}^\bot((\ensuremath{\mathcal{D}}, \ensuremath{\mathcal{F}} \cup \lbrace \psi_i \rbrace))\), \item and $\ensuremath{{\tt HSub}}(A_i)=\emptyset$ for all \(2 \le i \le n\). \end{itemize} We have: \begin{itemize}[itemsep=1pt,topsep=1pt] \item \(\ensuremath{{\tt Conc}}(A) = \phi\) \item \(\ensuremath{{\tt Sub}}(A) = \lbrace A \rbrace \cup \ensuremath{{\tt Sub}}(A_1)\) \item \(\ensuremath{{\tt HSub}}(A) = \ensuremath{{\tt HSub}}(A_1) \cup \lbrace (A_2, \psi_2), \ldots, (A_n, \psi_n) \rbrace\) \end{itemize} \end{enumerate} \end{definition} Definition \ref{def_arg} departs in two respects from the way arguments are usually defined in $ASPIC^+$. First, there is a new class of arguments constructed by means of rule 4: these arguments are called \emph{rbc-arguments}. They correspond to applications of the reasoning by cases scheme outlined in Section \ref{sec_intro}. \begin{example} Let \(\ensuremath{\mathcal{D}} = \lbrace \top \Rightarrow p \vee q; \:\: p \Rightarrow p_1; \:\: p_1 \Rightarrow p_2; \:\: p_2 \Rightarrow r; \:\: q \Rightarrow q_1; \:\: q_1 \Rightarrow r \rbrace\) and ${\rm AT} = (\ensuremath{\mathcal{D}}, \{\top\})$. The following are arguments in \(\ensuremath{{\tt Arg}}^{\bot}({\rm AT})\): \begin{itemize}[itemsep=1pt,label=,leftmargin=*] \item \(A_1 =\langle \langle \top\rangle \Rightarrow p \vee q \rangle\) \item \(A_2 = \langle A_1, [\langle\langle \langle p\rangle \Rightarrow p_1 \rangle \Rightarrow p_2\rangle \Rightarrow r], [\langle\langle q\rangle \Rightarrow q_1\rangle\Rightarrow r] \leadsto r \rangle\) \item \(A_3 = \langle A_{1}, [\langle p \rangle \Rightarrow p_1], [\langle q \rangle \Rightarrow q_1] \leadsto p_1 \vee q_1 \rangle\) \end{itemize} \end{example} $A_2$ and $A_3$ are rbc-arguments constructed on the basis of the `cases' $p$ and $q$ in the disjunctive conclusion of $A_1$. Argument $A_2$ concludes that $r$, while $A_3$ concludes that $p_1\vee q_1$. The second novel feature of Definition \ref{def_arg} is that we not only keep track of an argument $A$'s conclusion ($\ensuremath{{\tt Conc}}(A)$) and its sub-arguments ($\ensuremath{{\tt Sub}}(A)$), but also of its \emph{hypothetical sub-arguments} ($\ensuremath{{\tt HSub}}(A)$). These are pairs consisting of an argument $B$ and a formula $\phi$, where $B$ is constructible on the basis of the extended AT obtained by adding $\phi$ to the knowledge base of the original AT. For instance, $\ensuremath{{\tt HSub}}(A_2)= \bigl\{ \bigl(\langle\langle\langle\langle p\rangle \Rightarrow p_1 \rangle \Rightarrow p_2\rangle \Rightarrow r\rangle, p \bigr), \bigl(\langle\langle\langle q\rangle \Rightarrow q_1\rangle\Rightarrow r\rangle, q \bigr) \bigr\}$. $A_2$'s hypothetical sub-argument $(\langle\langle\langle\langle p\rangle \Rightarrow p_1 \rangle \Rightarrow p_2\rangle \Rightarrow r\rangle,p)$ contains the argument $\langle\langle\langle\langle p\rangle \Rightarrow p_1 \rangle \Rightarrow p_2\rangle \Rightarrow r\rangle$ constructible on the basis of the AT $(\mathcal{D},\{\top, p\})$. \begin{remark} If one is interested in reducing the size of \(\ensuremath{{\tt Arg}}^{\bot}({\rm AT})\), one may only allow for minimal disjunctions when generating arguments of type 4. More precisely, where \(A_{1}\) is of the form \(\langle B_1, \ldots, B_m \rightarrow \bigvee_{i=1}^{n} \psi_i \rangle\) or \(\langle B_1, \ldots, B_m \Rightarrow \bigvee_{i=1}^{n} \psi_i \rangle\), \(A = \langle A_{1} , [A_2], \ldots, [A_n] \leadsto \phi\rangle \in \ensuremath{{\tt Arg}}^{\bot}({\rm AT})\) only if there is no \(\bigvee_{j \in J} \psi_j\) where \(J \subset \lbrace 2, \ldots, n \rbrace\) for which \(\ensuremath{{\tt Conc}}(B_{1}), \ldots, \ensuremath{{\tt Conc}}(B_{m}) \rightarrow \bigvee_{j \in J} \psi_{j} \in \mathcal{S}\). \end{remark} Definition \ref{def_arg} allows for the construction of arguments containing sub-arguments the conclusions of which are jointly inconsistent, such as arguments $A_1$ and $A_2$ in the following example, both of which rely on both $p$ and $\neg p$ in their construction. \begin{example} Let ${\rm AT} = (\{\top \ensuremath{\Rightarrow} s,\top\ensuremath{\Rightarrow} p, p\ensuremath{\Rightarrow} \lnot p\}, \{\top\})$. \[ \begin{array}{l@{\ \ \ \ \ \ \ \ }l} A_0 = \langle \langle\top\rangle\ensuremath{\Rightarrow} p\rangle & A_2 = \langle A_0,A_1\ensuremath{\rightarrow} \lnot s\rangle \\[1ex] A_1 = \langle A_0\ensuremath{\Rightarrow} \lnot p\rangle & A_3 = \langle\langle\top\rangle \ensuremath{\Rightarrow} s\rangle \\ \end{array} \] \end{example} When \sys{CL} is used as the underlying logic, inconsistent arguments like $A_1$ and $A_2$ may contaminate our formalism by blocking intuitively acceptable arguments like $A_3$. (This is because the conclusions of $A_2$ and $A_3$ are conflicting, causing $A_2$ to attack and exclude $A_3$, cfr.\ infra.) Contamination problems of this kind have been studied and tackled in $ASPIC^+$ \cite{CamCarDun12,Wu12}. We can avoid them by filtering out inconsistent arguments. \begin{definition}\label{def_dagger} We define \(\dagger A\) for an argument \(A\) recursively as follows: \begin{itemize}[itemsep=1pt] \item \(\dagger\langle\phi\rangle = \phi\) \item \(\dagger A = \phi \wedge \dagger B_1 \wedge \ldots \wedge \dagger B_n\) where \(A = \langle B_1, \ldots, B_n \rightarrow \phi \rangle\) \item \(\dagger A = \phi \wedge \dagger B_1 \wedge \ldots \wedge \dagger B_n\) where \(A = \langle B_1, \ldots, B_n \Rightarrow \phi \rangle\) \item \(\dagger A = \phi \wedge \dagger B_1 \wedge (\dagger B_2 \vee \ldots \vee \dagger B_n)\) where \(A = \langle B_1, [B_2],\ldots [B_n] \leadsto \phi \rangle\). \end{itemize} \end{definition} \begin{definition}\label{def_inconsistent} An argument \(A\) is \emph{inconsistent} iff \(\dagger A \vdash \bot\). Otherwise \(A\) is \emph{consistent}. Relative to ${\rm AT} = (\ensuremath{\mathcal{D}},\ensuremath{\mathcal{F}})$, \(\ensuremath{{\tt Arg}}({\rm AT})\) is \(\ensuremath{{\tt Arg}}^{\bot}({\rm AT})\) without inconsistent arguments. \end{definition} For arguments without occurrences of \(\leadsto\) our definition of inconsistent arguments is equivalent to that of \cite{Wu12}. In the remainder we will focus on the set \(\ensuremath{{\tt Arg}}({\rm AT})\) rather than \(\ensuremath{{\tt Arg}}^{\bot}({\rm AT})\), avoiding contamination problems. \subsection{Attacks}\label{sub_attacks} \def{\rm SAF}{{\rm SAF}} \def{\rm AT}{{\rm AT}} In $ASPIC^+$, attacks are defined in terms of a generic contrariness operator. We define them in terms of `$\neg$', so that arguments the conclusions of which are classical contradictories attack each other. We have to be careful when defining argumentative attacks when rbc-arguments are involved, since we must take into account the hypothetical sub-arguments of an rbc-argument. New questions arise here. For instance, an argument's hypothetical sub-argument may conflict with a non-hypothetical argument. \begin{example}\label{motivation_att_1} Let ${\rm AT} = (\mathcal{D,F})$, with $\mathcal{D}=\{p\ensuremath{\Rightarrow} q\vee r; \ q\ensuremath{\Rightarrow} s; \ s\ensuremath{\Rightarrow} v; \ r\ensuremath{\Rightarrow} v; \ t\ensuremath{\Rightarrow} \lnot s\}$ and $\mathcal{F}=\{p,t\}$. \begin{itemize}[itemsep=1pt,label=] \item $A_1= \bigl\langle\langle\langle p\rangle \ensuremath{\Rightarrow} q\lor r\rangle,[\langle\langle q\rangle\ensuremath{\Rightarrow} s\rangle\ensuremath{\Rightarrow} v],[\langle r\rangle\ensuremath{\Rightarrow} v]\leadsto v \bigr\rangle$ \item $A_2= \bigl\langle\langle t\rangle\ensuremath{\Rightarrow} \lnot s \bigr\rangle$ \end{itemize} \end{example} In Example \ref{motivation_att_1}, the non-hypothetical argument $A_2$ is in conflict with the argument $\langle\langle q\rangle\ensuremath{\Rightarrow} s\rangle\ensuremath{\Rightarrow} v$, which belongs to $A_1$'s hypothetical sub-argument $(\langle\langle\langle q\rangle\ensuremath{\Rightarrow} s\rangle\ensuremath{\Rightarrow} v\rangle,q)$. The desirable outcome in this example is that $A_2$ attacks $A_1$, but not vice versa. As a further illustration, consider the following scenario. \begin{example}\label{motivation_att_2} ${\rm AT} = (\mathcal{D},\mathcal{F})$, with $\mathcal{D} = \{p\ensuremath{\Rightarrow} (q\lor r); \ q\ensuremath{\Rightarrow} s_1; \ s_1\ensuremath{\Rightarrow} s_2; \ s_2\ensuremath{\Rightarrow} v; \ r\ensuremath{\Rightarrow} v; \ q\ensuremath{\Rightarrow} \lnot s_1\}$ and $\mathcal{F} = \{p\}$. \begin{itemize}[itemsep=0pt,label=] \item $A_0 = \langle\langle p \rangle\Rightarrow q\vee r\rangle$ \item $A_1 = \langle A_0, [\langle\langle\langle q\rangle\Rightarrow s_1\rangle\Rightarrow s_2\rangle\Rightarrow v], [\langle r\rangle\Rightarrow v] \leadsto v \rangle$ \end{itemize} The following argument is constructible on the basis of the extended theory ${\rm AT}' = (\mathcal{D},\mathcal{F}\cup\{q\})$: \begin{itemize}[itemsep=0pt,label=] \item $A_2 =$ $\langle\langle q\rangle \Rightarrow \neg s_1\rangle$. \end{itemize} \end{example} $A_1$ contains the intermediate conclusion $s_2$ based on the assumption $q$. However, $A_2$ concludes that $\neg s_2$ on the basis of the same assumption, $q$. The desirable outcome in this example is to let $A_1$ and $A_2$ attack each other, since these arguments were both constructed on the basis of our knowledge base plus the assumption that $q$, and since their conclusions are contradictories. To handle examples like these, we introduce the set $\ensuremath{{\tt HArg}}(\ensuremath{\mathcal{D}},\ensuremath{\mathcal{F}})$ of all arguments that can be constructed on the basis of some disjunct used in the construction of an rbc-argument in $\ensuremath{{\tt Arg}}(\ensuremath{\mathcal{D}},\ensuremath{\mathcal{F}})$. Where $A$ is an argument and $\phi$ a formula, $\pi_1(A,\phi)= A$ and $\pi_2(A,\phi) = \phi$. We lift the definition as usual: where $i \in \{1,2\}$, $\pi_i(\Delta) = \{\pi_i(A,\phi) \mid (A,\phi) \in \Delta\}$. Where $\phi \in \mathcal{L} \setminus \ensuremath{\mathcal{F}}$, ${\rm AT} = (\ensuremath{\mathcal{D}},\ensuremath{\mathcal{F}})$ and ${\rm AT}' = (\ensuremath{\mathcal{D}},\ensuremath{\mathcal{F}} \cup \{\phi\})$, we denote $\ensuremath{{\tt Arg}}({\rm AT}') \setminus \ensuremath{{\tt Arg}}({\rm AT})$ by $\ensuremath{{\tt Arg}}^{\phi}({\rm AT})$. \begin{definition}[Hypothetical Arguments]\label{def_hyp} Where ${\rm AT} = (\ensuremath{\mathcal{D}},\ensuremath{\mathcal{F}})$, \(\ensuremath{{\tt HArg}}({\rm AT})\) is the set of all \(A \in \ensuremath{{\tt Arg}}^{\phi}({\rm AT})\) such that \(\phi \in \pi_2(\ensuremath{{\tt HSub}}(B))\) for some $B\in \ensuremath{{\tt Arg}}({\rm AT})$. \end{definition} \begin{definition}[Attacks, Rebuts]\label{def_attack} For a given theory ${\rm AT}$, we define a direct attack relation \begin{multline*} {\tt Att}({\rm AT}) \subseteq (\ensuremath{{\tt Arg}}({\rm AT}) \times \ensuremath{{\tt Arg}}({\rm AT})) \\ \cup (\ensuremath{{\tt Arg}}({\rm AT}) \times \ensuremath{{\tt HArg}}({\rm AT})) \\ \cup ( \ensuremath{{\tt HArg}}({\rm AT}) \times \ensuremath{{\tt HArg}}({\rm AT})) \end{multline*} as follows: \(A\) directly attacks \(B\) iff \(B\) is of the form \(\langle \ldots \Rightarrow \ensuremath{{\tt Conc}}(B) \rangle\), (\(\ensuremath{{\tt Conc}}(A) = \neg\ensuremath{{\tt Conc}}(B)\) or \(\ensuremath{{\tt Conc}}(B) = \neg\ensuremath{{\tt Conc}}(A)\)), and \begin{itemize}[itemsep=0pt] \item \(A \in \ensuremath{{\tt Arg}}({\rm AT})\) and \(B \in \ensuremath{{\tt Arg}}({\rm AT})\) or \item \(A \in \ensuremath{{\tt Arg}}({\rm AT})\) and \(B \in\ensuremath{{\tt HArg}}({\rm AT})\) or \item \(A \in \ensuremath{{\tt Arg}}^{\phi}({\rm AT})\) and \(B \in \ensuremath{{\tt Arg}}^{\phi}({\rm AT})\) for some $\phi \in \mathcal{L} \setminus \mathcal{F}$. \end{itemize} We lift the definition recursively in the following way: \(A\) attacks \(B\) if \(A\) directly attacks \(B\) or it attacks some \(C \in (\ensuremath{{\tt Sub}}(B) \setminus \lbrace B \rbrace) \cup\bigcup \frak{\pi}_1(\ensuremath{{\tt HSub}}(B))\). \end{definition} For an argument $A$ to directly attack an argument $B$, the following requirements need to be fulfilled: The conclusion of $A$ conflicts with the conclusion of $B$ and (either $A$ is non-hypothetical, or $A$ and $B$ are hypothetical arguments based on the same assumption $\phi$). To illustrate how this works, reconsider our examples. In Example \ref{motivation_att_1}, $\langle\langle q\rangle\ensuremath{\Rightarrow} s \rangle \in {\sf HArg}({\rm AT})$ and $A_2$ directly attacks $\langle\langle q\rangle\ensuremath{\Rightarrow} s\rangle$, so $A_2$ attacks $A_1$ (but not vice versa). In Example \ref{motivation_att_2} the arguments $\langle\langle q\rangle\Rightarrow s_1\rangle$ and $A_2$ are in $\ensuremath{{\tt Arg}}^q({\rm AT})$, so these arguments directly attack each other. Consequently, $A_2$ also attacks $A_1$. \subsection{Consequence relations}\label{sub_conseq} \def{\rm SAF}{{\rm SAF}} \def{\rm AT}{{\rm AT}} \begin{definition} The \it{structured argumentation framework} (in short, SAF) defined by the theory ${\rm AT}$ is the pair $( \ensuremath{{\tt Arg}}({\rm AT})\cup\ensuremath{{\tt HArg}}({\rm AT}), {\tt Att}({\rm AT}))$. \end{definition} Given a SAF, we can use the argumentation semantics from Section \ref{sec_abstractarg} to define consequence relations: \begin{definition} Let ${\rm SAF} = (\ensuremath{{\tt Arg}}({\rm AT})\cup\ensuremath{{\tt HArg}}({\rm AT})$, ${\tt Att}({\rm AT}))$, let ${\sf sem}\in\{\sf Cmp, \sf Prf, \sf Grd\}$, and let ${\sf Cmp}({\rm SAF})$, ${\sf Prf}({\rm SAF})$, and ${\sf Grd}({\rm SAF})$ denote the sets of ${\rm SAF}$'s complete extensions, ${\rm SAF}$'s preferred extensions, and ${\rm SAF}$'s grounded extension respectively. \begin{itemize} \item ${\rm SAF} \mathop{\mid\!\sim}^{\cap}_{\sf sem} \phi$ iff for every $\mathcal{B} \in {\sf sem}({\rm SAF})$ there is an $A\in \mathcal{B}\cap{\tt Arg}({\rm AT})$ with ${\rm conc}(A)=\phi$. \item ${\rm SAF} \mathop{\mid\!\sim}^{\Cap}_{\sf sem} \phi$ iff there is a $\mathcal{B} \in \bigcap{\sf sem}({\rm SAF}) \cap \ensuremath{{\tt Arg}}({\rm AT})$ with ${\rm conc}(A)=\phi$. \end{itemize} Since the grounded extension is unique both definitions coincide for ${\sf sem}={\sf Grd}$. \end{definition} Relative to a theory ${\rm AT}$, the `virtual' arguments in $\ensuremath{{\tt HArg}}({\rm AT})$ are capable of attacking arguments in $\ensuremath{{\tt Arg}}({\rm AT})$ (in their hypothetical subarguments), and consequently of preventing the derivability of conclusions of arguments in $\ensuremath{{\tt Arg}}({\rm AT})$. However, the conclusions of virtual arguments are never themselves derivable from AT. \section{Introduction}\label{sec_intro} \input{jelia-rbc_intro.tex} \section{Abstract argumentation}\label{sec_abstractarg} \input{jelia-rbc_abstractarg.tex} \section{Argumentation by cases}\label{sec_aspichyp} In this section we define structured argumentation frameworks (SAFs) for reasoning by cases. Our point of departure is an instantiation of the $ASPIC^+$ framework (without priorities, without defeasible premises and without undercuts). We adjust $ASPIC^+$ in the following ways. (i) We define a new type of argument called an \emph{rbc-argument} (see point 4 in Definition \ref{def_arg}). By means of rbc-arguments, we can argue by cases in an argumentation formalism (Section \ref{sub_argdefs}). (ii) We generalize the attack relation so as to include argumentation by cases, using the concept of a \emph{hypothetical argument} (Section \ref{sub_attacks}), and we define a logical consequence relation for the resulting SAFs (Section \ref{sub_conseq}). We briefly discuss the meta-theoretical properties of our framework (Section \ref{sub_ratpostulates}). \input{jelia-rbc_definitions.tex} \subsection{Rationality postulates}\label{sub_ratpostulates} \input{jelia-rbc_ratpostulates.tex} \section{Related work}\label{sec_related} \input{jelia-comparisons} \section{Conclusion and outlook} \label{sec:conclusion-outlook} \input{furtherwork.tex} \bibliographystyle{plain}
{'timestamp': '2017-03-27T02:07:04', 'yymm': '1703', 'arxiv_id': '1703.08397', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08397'}
arxiv
\section{Introduction} More details about the mini-series, whose ``Part 2'' is the present article, can be found in [W, Sec.9.3]. Other than that [W] will not be relevant here. In the sequel we merely assume a basic familiarity Boolean functions [CH] and with BDD's, as e.g. provided in [K]. In Section 2 we review the standard methods for calculating the {\it cardinality} of the model set Mod$(\varphi)$ from a BDD of a Boolean function $\varphi:\{0,1\}^n\ra\{0,1\}$, respectively for enumerating ($=$ generating) the whole of Mod$(\varphi)$ in compressed form. Here ``compressed'' means using the don't-care symbol ``2'' which e.g. in the $012$-{\it row} $(1,1,2,0,1)$ signifies that both bitstrings $(1,1,0,0,1)$ and $(1,1,1,0,1)$ are allowed. Let Mod$(\varphi, k): = \{x \in \mbox{Mod}(\varphi): |x| =k\}$, where $|x|$ denotes the number of bits $x_i =1$ of the bitstring $x$. As shown (as an Exercise) in [K] all cardinalities $|\mbox{Mod}(\varphi, k)|$ can be retrieved elegantly as the coefficients of a polynomial which can be calculated fast recursively. A slight notational improvement of this nice but little known result is presented in Section 3. Section 4, the article's main contribution, aims to not just count but enumerate Mod$(\varphi, k)$ in polynomial\footnote{More specifically in time $O(p(n,N))$ where $p(n,N)$ is a polynomial in $n$ and the number $N=Mod(\varphi,k)$ of $k$-models. Observe that $p(n,N)$ is independent of $k$.} total time. This is noteworthy, even if enumeration was {\it one-by-one}, because in other contexts polynomial total time enumeration of models doesn't automatically carry over to the $k$-element models. However, our enumeration of Mod$(\varphi, k)$ can again be carried out in {\it compressed} fashion: Beyond the don't-care symbol 2 we use the wildcard $g_t g_t \cdots g_t$ which means ``exactly $t$ many 1's in this area''. Thus the $012${\it g-row} $(g_2, 0,1, g_2, g_2)$ is the set $\{({\bf 1}, 0, 1, {\bf 1}, {\bf 0}), ({\bf 1}, 0, 1, {\bf 0}, {\bf 1}), ({\bf 0},0,1, {\bf 1}, {\bf 1})\}$. The practical relevance of it all e.g. concerns optimization. To fix ideas, suppose Mod$(\varphi)$ (provided by a BDD) is the family of all hitting sets of a set system. Often only small hitting sets are sought. The smallest $k$ for which Mod$(\varphi,k)$ is non-empty can be determined fast {\it beforehand} using the method of Section 3. Then, with the picked $k$, all $k$-models can be delivered using the main algorithm of Section 4 (specifically: the third method). The compact representation of Mod$(\varphi, k)$ via $012g$-rows facilitates a potential further pruning (=optimization) of Mod$(\varphi, k)$. While real-life applications are intended for future research, the numerical experiments in Section\footnote{The author awaits BDD-savvy collaboration before embarking on this systematically.} 5 provide evidence of our method's potential. \section{Calculating $|\mbox{Mod}(\varphi)|$ and $\mbox{Mod}(\varphi)$ from a BDD of $\varphi$} Consider the BDD in Figure 1 which defines the Boolean function $\psi: \{0,1\}^{10} \ra \{0,1\}$. Here the node $x_1$ is the {\it root} and all nodes other than $\perp$ and $\top$ are called {\it branching nodes}. Recall how one decides whether or not a bitstring like $$u = ({\bf u}_1, u_2, {\bf u}_3, u_4, u_5, u_6, u_7, {\bf u}_8, u_9, u_{10}) : = ({\bf 0}, 0, {\bf 1}, 1, 0, 1, 0, {\bf 1}, 0,0)$$ belongs to Mod$(\psi$). Start at the root $x_1$ in Figure 1. Because $u_1 =0$, go down on the dashed line to the {\it $0$-son} $x_3$. From there, because of $u_3 =1$, branch on the solid line and visit the {\it $1$-son} $x_8$. Finally, in view of $u_8 =1$, the solid line brings us to $\top$, which signals that $u \in \mbox{Mod}(\psi)$. In all of this the values $u_i$ for $i \not\in \{1, 3, 8\}$ were irrelevant. For many purposes we need a {\it shelling} of a given BDD from below, i.e. we keep pruning, in any order, the minimal branching nodes of the BDD until we reach the empty set. For instance, upon relabelling the nodes in Figure 1 we get, $a, b, c, d, e, f$ in Figure 2 as one of several shellings from below. \includegraphics[scale=0.6]{KmodelsBDDFig1and2} For any Boolean function $\varphi = \varphi (x_1, \cdots, x_n)$ and any branching node $\alpha$ of a given BDD of $\varphi$, we let $\mbox{var}(\alpha)$ be the index of the variable coupled to $\alpha$. Thus if $\varphi = \psi$ then $\mbox{var}(e) = 3$ and $\mbox{var}(a) = \mbox{var}(c) = 7$. For any $\varphi$ and $\alpha$ we denote by $\varphi_\alpha$ the unique Boolean function defined by the induced BDD with root $\alpha$. Thus $\varphi_\alpha = \varphi_\alpha (x_j, x_{j+1}, \cdots, x_n)$ where $j = \mbox{var}(\alpha)$. {\bf 2.1} As to calculating $|\mbox{Mod}(\varphi)|$, suppose we know the {\it acception probability} $p$ that a random bitstring $u = (u_1, \cdots, u_n)$ will be accepted by the BDD of $\varphi = \varphi (x_1, \cdots, x_n)$, i.e. the probability that $u \in \mbox{Mod}(\varphi)$. Then obviously (1) \qquad $|\mbox{Mod}(\varphi)| = p \cdot 2^n$. As is well known\footnote{See e.g. Algorithm $C$ in [K, p.7]. It directly calculates $|\mbox{Mod}(\varphi)|$ rather than $p$ but works along the same lines.}, $p$ is readily calculated as follows. Let $\beta$ and $\gamma$ be the $0$-son and $1$-son of some branching node $\alpha$. If $p(\alpha), p(\beta), p(\gamma)$ are the acception probabilities of $\varphi_\alpha, \varphi_\beta,\varphi_\gamma$ respectively then obviously (2) \qquad $p(\alpha) = \frac{1}{2} p(\beta) + \frac{1}{2} (\gamma)$ Inductively applying (2) based on any shelling of the BDD yields $p$. Thus for $\varphi = \psi$ and the shelling in Figure 2 we have $p(a) = p(b) =\frac{1}{2}, p(c) = 0 + \frac{1}{4} = \frac{1}{4}, p(d) = \frac{1}{2} + \frac{1}{8} = \frac{5}{8}$, $p(e) =\frac{1}{4} + \frac{1}{4} = \frac{1}{2}$ and finally $p = p(f) = \frac{1}{2} p(d) + \frac{1}{2} p(e) = \frac{9}{16}$. Therefore (1) implies (3) \qquad $|\mbox{Mod}(\psi )| = \frac{9}{16} \cdot 2^{10} = 576$. {\bf 2.2} As to calculating the model set Mod$(\varphi)$ itself, it is well-known [CH, p.48] and easy to see that the paths from the root of the BDD to $\top$ yield at once the terms of an orthogonal\footnote{By definition an {\it orthogonal} DNF, also called exclusive sum of products, has the property that the model set of any two distinct terms are disjoint [CH, chapter 7]. In our situation disjointness occurs because each $y \in \ \mbox{Mod}(\varphi)$ determines a {\it unique} path from $x_1$ to $\top$.} DNF for $\varphi$. For instance the path $x_1 \ra x_3 \ra x_8 \ra \top$ in Figure 1 yields the term $\ol{x}_1 \wedge x_3 \wedge x_8$. This in turn matches the $012$-{\it row} $(0,2,1,2,2,2,2,1,2,2)$ which is a handy shorthand for Mod$(\ol{x}_1 \wedge x_3 \wedge x_8)$, i.e. for the set of $2^7$ many bitstrings $y \in \{0,1\}^{10}$ satisfying $y_1 =0$ and $y_3=y_8 =1$. One verifies ad hoc that there are four paths from $x_1$ to $\top$ in Figure 1. Correspondingly (4) \quad Mod$(\psi) = (0,2,0,2,2,2,0,2,2,2) \ \uplus \ (0,2,1,2,2,2,2,1,2,2)$\\ \hspace*{2.2cm} $\uplus \ (1,2,2,0,2,2,2,2,2,2) \ \uplus \ (1,2,2,1,2,2,1,1,2,2)$. Here and henceforth we denote disjoint union by $\uplus$ as opposed to $\cup$. \section{Calculating $|\mbox{Mod}(\varphi, k)|$ from a BDD of $\varphi$} As opposed to calculating $|\mbox{Mod}(\varphi)|$ like in Section 2, it is lesser known how to get the cardinalities $N_k: = |\mbox{Mod}(\varphi, k)|$. We present the method of [K, Exercise 25]; without proof but with trimmed notation. Namely, additionally to our definition of $\mbox{var}(\alpha)$ for branching nodes $\alpha$, it will be handy to set $\mbox{var}(\top) : =n+1$. As in [K] we pack the unknown values $N_k$ in a generating function (5) \qquad $G(z) = G(z, \varphi) : = \ds\sum_{k=0}^n N_kz^k$. For all branching nodes $\alpha$ put $G_\alpha (z) : = G(z, \varphi_\alpha)$, as well as $G_\perp(z): = 0$ and $G_\top (z) : = 1$. Let $\alpha, \beta, \gamma$ be such that $\beta$ and $\gamma$ are the $0$-son and $1$-son of $\alpha$ respectively (possibly $\beta \in \{\perp, \top \}$ or $\gamma \in \{\perp, \top\}$). Putting $\ol{\alpha} = \mbox{var}(\alpha), \ol{\beta} = \mbox{var}(\beta), \ol{\gamma} = \mbox{var}(\gamma)$ it is shown\footnote{If say $\beta = \perp$ (similarly for $\gamma = \perp$) then $\ol{\beta} = \mbox{var}(\perp)$ is undefined. In this case we replace the exponent $\ol{\beta} - \ol{\alpha} -1$ in (6) by the acronym $ir$ ($=$ irrelevant), in view of the fact that $G_\beta (z) = 0$ anyway.} in [K] that (6) \qquad $G_\alpha (z) = (1+z)^{\ol{\beta} - \ol{\alpha} -1} G_\beta(z) + z(1+z)^{\ol{\gamma} - \ol{\alpha}-1} G_\gamma(z)$. Using (6) let us calculate $G(z) = G(z, \psi) = G(z, \psi_f)$: (7) \qquad $G_a(z) = (1+z)^{11 -7-1}G_\top(z) + z(1+z)^{ir}G_\perp(z) = (1+z)^3 \cdot 1+0 = (1+z)^3$ \hspace*{1.2cm} $G_b(z) = (1+z)^{ir} G_\perp(z) + z(1+z)^{11-8-1}G_\top(z) = z(1+z)^2$ \hspace*{1.4cm} $\vdots$ \hspace*{1.2cm} $G_f(z) = (1+z)^{3-1-1} G_e(z) + z(1+z)^{4-1-1} G_d(z) \ = \cdots =$ \hspace*{1.5cm} $1+ 8z + 30z^2 + 70z^3+113z^4 + 132z^5 + 113z^6 + 70z^7 + 30z^8 + 8z^9 + z^{10}$ As it must be, the coefficients add up to $576$. That they happen to be symmetric is irrelevant. \section{Enumerating Mod$(\varphi, k)$ from a BDD of $\varphi$} We describe three methods to achieve the task in the title, the first in 4.1, the second in 4.2, and the third (the article's core) in 4.3. {\bf 4.1} The {\it first method} proceeds as follows. Enumerate Mod$(\varphi)$ as shown in Section 2 and sieve Mod$(\varphi, k)$ from it. Thus if $\varphi = \psi$ and $k= 4$ then from the four $012$-rows that constitute Mod$(\psi) = \mbox{Mod}(\psi_f)$ in (4) one reads off that (8) \qquad Mod$(\psi, 4) = (0, g_4, 0, g_4, g_4, g_4, 0, g_4, g_4, g_4) \uplus (0, g_2, 1, g_2, g_2, g_2, g_2, 1, g_2, g_2)$ \hspace*{1.5cm} $\uplus\, (1, g_3, g_3, 0, g_3, g_3, g_3, g_3, g_3, g_3) \uplus (1, 0, 0, 1, 0, 0, 1, 1, 0, 0)$ Generally the gadget $(g_t, g_t, \cdots, g_t)$ means ``exactly $t$ digits 1 in this area''. Here $t \geq 1$ and the number of symbols $g_t$ must be strictly larger than $t$; thus instead of $(g_3, g_3, g_3)$ we stick to $(1, 1, 1)$, and $(g_4, g_4, g_4)$ is nonsense anyway. From (8) it follows that (9) \qquad $|\mbox{Mod}(\psi, 4)| = {7 \choose 4} + {7 \choose 2} + {8 \choose 3} +1 = 113,$ which matches the coefficient at $z^4$ in (7). Representing Mod$(\varphi, k)$ with the first method works well when the number of $012$-rows $r$ that constitute Mod$(\varphi)$ is small. However, it can be that $r \cap \mbox{Mod}(\varphi, k) = \emptyset$, for instance $r \cap \mbox{Mod}(\psi, 8) = \emptyset$ for $r = (0, 2, 0, 2, 2, 2, 0, 2, 2, 2)$ in (4). If many rows $r$ have an empty intersection with Mod$(\phi, k)$ then the procedure becomes inefficient. {\bf 4.2} The {\it second method} was kindly pointed out to me by Fabio Somenzi. Let $B_1$ be our given BDD with model set Mod$(\varphi)$. Construct a second BDD $B_2$ whose models are exactly the $k$-ones bitstrings in $\{0,1\}^n$. This is straightforward (see Figure 3 for $n=7,\ k=3$) and costs $O(nk)=O(n^2)$. \begin{center} \includegraphics[scale=0.8]{KmodelsBDDFig3} \end{center} Building the conjunction $B_3$ of $B_1$ and $B_2$ has polynomial compexity, and evidently the model set of $B_3$ equals Mod$(\varphi,k)$. This seems like a crisp polynomial total time procedure to the $k$-models of $\varphi$. Trouble is, $B_3$ may be much larger than $B_1$ (never mind 'polynomial'). Furthermore, the models of $B_3$ necessarily get enumerated one-by-one because, as opposed to 2.2, no proper $012$-row can possibly consist entirely of $k$-models. {\bf 4.3} Our third method runs in polynomial total time while simultaneously (as opposed to 4.2) compressing the model set. In a nutshell the four-fold subdivision of 4.3 is as follows. In 4.3.1 we recursively compute a {\it cardinality set} of the ``first kind'', i.e. (10) \quad card$1(\alpha) : = \{i \in [0, n]: \ \mbox{Mod}(\varphi_\alpha, i) \neq \emptyset\}$ for each node $\alpha$ of the BDD of $\varphi$. (For integers $0 \leq u < v$ we put $[u,v] : = \{u, u+1, \cdots, v]$.) Observe that Mod$(\varphi, k) = \emptyset$ if and only if $k \not\in$ card$1(\alpha)$ for the root $\alpha$ of the BDD. In this case our task to enumerate Mod$(\varphi, k)$ is accomplished. If Mod$(\varphi, k) \neq \emptyset$ then the second step (in 4.3.2) applies. It demands that we set up the {\it schedule} for a subsequent enumeration of Mod$(\varphi, k)$. This schedule points out, for each branching node $\alpha$, the ``second kind'' cardinality set card2$(\alpha)$ of all cardinalities $i$ for which Mod$(\varphi_\alpha, i)$ needs to be constructed. Necessarily card$2(\alpha) \subseteq$ card$1(\alpha)$. We illustrate in detail the instance $Mod(\varphi,k)=Mod(\psi,4)$ where, remember, $\psi$ matches Figure 1. In 4.3.3 follows the explicit construction of Mod$(\varphi, k)$ according to the schedule. In 4.3.4 the complexity of it all is assessed in a Theorem. {\bf 4.3.1} We put $j+S : = \{j +i : i \in S\}$ for any set of integers, in particular $j + \emptyset = \emptyset$. It is obvious that card$1(\alpha)$ as defined in (10) can be obtained recursively. For instance, if $\varphi = \psi$ and $\alpha = e$ then a glance at Figures 1 and 2 shows that (11) \quad card$1(e) = \ds\bigcup_{j=0}^3(j + \mbox{card}1(a)) \cup \ds\bigcup_{j=1}^5 (j+ \mbox{card} 1(b))$ Shelling the BDD of $\varphi$ from below and using type (11) recursion thus delivers all sets card$1(\alpha)$. Spelling it out for $\varphi = \psi$ we get: (12) \quad card$1(a) = [0,3], \quad \mbox{card}1(b) = [1,3]$ \ (by inspection) \hspace*{1.1cm} card$1(c) = 1 + \mbox{card}1(b) = [2,4]$ \hspace*{1.1cm} card$1(d) = [0,6] \cup (1 + [2,4]) \cup (2 + [2,4]) \cup (3+[2,4]) = [0,7]$ \hspace*{1.1cm} card$1(e) = (0 + [0,3]) \cup \cdots \cup (3 + [0,3]) \cup (1 + [1,3]) \cup \cdots \cup (5 + [1,3] ) = [0,8]$ \hspace*{1.1cm} card$1(f) = (0+[0,8]) \cup (1+ [0,8]) \cup (1 + [0,7]) \cup (2+[0,7]) \cup (3 + [0,7])= [0,10]$ {\bf 4.3.2} Consider first $\varphi = \psi = \psi_f$ and $k = 4$. From Figure 1 and 2 it is clear that each $u \in \mbox{Mod}(\psi_e, 4)$ yields a concatenated model $(0,0) \times u \in \mbox{Mod}(\psi_f, 4) = \mbox{Mod}(\psi, k)$. Similarly $u \in \mbox{Mod}(\psi_e, 3)$ triggers $(0,1) \times u \in \mbox{Mod}(\psi_f, 4)$. In other words, $u \in \mbox{Mod}(\psi_e)$ induces a cardinality 4 model of $\psi_f$ iff $|u| \in \{3,4\}$. Accordingly we put card$2(e) = [3,4]$, and by the same token card$2(d) = [1,3]$. One may think that card$2(c) = [0,2]$ because $u \in \mbox{Mod}(\varphi_c)$ can only trigger $v \in \mbox{Mod}(\varphi_d)$ with $|v| \in [1,3]$ when $|u| \in[0,2]$. Trouble is that card$1(c) = [2,4]$ by (12), and so we conclude $$\mbox{card}2(c) = [0,2] \cap [2,4] = [2].$$ Calculating card$2(b)$ leads to another twist because node $b$ has {\it two} upper covers $c$ and $e$. The cardinality interval of $\varphi_b$-models that is useful (in the obvious sense) for card$2(c) = [2]$ is [1]; and the cardinality interval useful for card$2(e) = \{3,4\}$ is $[0,3]$. Consequently (13) \quad card$2(b) = ([1] \cup [0,3]) \cap \mbox{card}1(b) \ {(12) \atop =} \ [1,3]$. In general, suppose that a BDD of $\varphi$ is known and all numbers card$1(\alpha)$ have been calculated. The cardinalities card$2(\alpha)$ are then obtained by shelling the BDD from above and by proceeding as in (13). There is no harm spelling it out once more. Thus card$2(\alpha)$ is obtained by treating each upper neighbour $\beta$ of $\alpha$ as follows. Determine (in obvious ways as illustrated) the set $S(\beta)$ of cardinalities of ``hypothetic'' $\varphi_\alpha$-models $u$ for which $u$ could be used to construct a $\varphi_\beta$-model of a sought cardinality (i.e. belonging to card$2(\beta)$). If $S$ is the union of all $S(\beta)$'s then evidently each $k \in S$ is a ``useful cardinality'', yet constructing $\varphi_\alpha$-models $u$ with $|u| \not\in S$ would be a waste. On the other hand, there may be numbers $k \in S$ such that no $\varphi_\alpha$-model $u$ has $|u| = k$. Therefore card$2(\alpha) = S \cap \mbox{card}1(\alpha)$ is both: all we {\it need} and all we {\it can get}. Figure 4 displays the {\it schedule}, i.e. all sets card$2(\alpha)$, for $\varphi = \psi$. (In view of $k = 4$ we have to put card$2(f) : = \{4\}$.) \begin{center} \includegraphics[scale=0.8]{KmodelsBDDFig4} \end{center} {\bf 4.3.3} Taking again $\varphi = \psi$ let us show how processing the schedule of $\psi$ in Figure 4 from below\footnote{{\it Any} shelling from below of the branch-nodes will do; we take $a, b, c, d, e, f$.} yields a systematic (i.e. not as in (8)) compression of Mod$(\psi, 4)$. For instance Mod$(\psi_b, [1,3])$ is defined as Mod$(\psi_b,1) \cup \mbox{Mod}(\psi_b, 2) \cup \mbox{Mod}(\psi_b, 3)$. $\begin{array}{lll} \mbox{Mod}(\psi_a, [0,3]) & =& (0,0,0,0) \cup (0, g_1, g_1, g_1) \cup (0, g_2, g_2, g_2) \cup (0,1, 1, 1)\\ \\ \mbox{Mod}(\psi_b, [1,3]) & =& (1, 0, 0) \cup (1, g_1, g_1) \cup (1, 1, 1)\\ \\ \mbox{Mod}(\psi_c, 2) & = & (1) \times \mbox{Mod}(\psi_b, 1) = (1, 1, 0,0)\\ \\ \mbox{Mod}(\psi_d, [1,3]) & =& (0, g_1, g_1, g_1, g_1, g_1, g_1) \cup (0, g_2, g_2, g_2, g_2, g_2, g_2)\\ \\ & \cup & (0, g_3, g_3, g_3, g_3, g_3, g_3) \cup ((1, 0, 0) \times \mbox{Mod}(\psi_c,2)) \end{array}$ $\begin{array}{lll} \mbox{Mod}(\psi_e, [3,4]) & =& (0, 0, 0, 0) \times \mbox{Mod}(\psi_a, 3) \ \cup \ (0, g_1, g_1, g_1) \times \mbox{Mod}(\psi_a,2)\\ \\ & \cup & (0, g_2, g_2, g_2) \times \mbox{Mod}(\psi_a,1) \ \cup \ (0, 1, 1, 1) \times \mbox{Mod}(\psi_a,0)\\ \\ & \cup & (0, g_1, g_1, g_1) \times \mbox{Mod}(\psi_a,3) \ \cup \ (0, g_2, g_2, g_2) \times \mbox{Mod}(\psi_a,2)\\ \\ & \cup & (0, 1, 1, 1) \times \mbox{Mod}(\psi_a, 1)\\ \\ & \cup & (1, 0, 0, 0, 0) \times \mbox{Mod}(\psi_b, 2)\\ \\ & \cup & (1, g_1, g_1, g_1, g_1) \times \mbox{Mod}(\psi_b,1) \\ \\ & \cup & (1, 0, 0, 0, 0) \times \mbox{Mod}(\psi_b,3) \\ \\ & \cup & (1, g_1, g_1, g_1, g_1) \times \mbox{Mod}(\psi_b,2)\\ \\ & \cup & (1, g_2, g_2, g_2, g_2) \times \mbox{Mod}(\psi_b,1) \end{array}$ Table 1 rearranges the pieces in order to have a {\it weight-trimmed} representation of Mod$(\psi_d,[1,3])$. Table 2 does the same for Mod$(\psi_e, [3,4])$. \begin{tabular}{|c|c|c|c|c|c|c|c|} $x_4$ & $x_5$ & $x_6$ & $x_7$ & $x_8$ & $x_9$ & $x_{10}$ & weight \\ \hline & & & & & & & \\ 0 & $g_1$ & $g_1$ & $g_1$ & $g_1$ & $g_1$ & $g_1$ & 1 \\ 0 & $g_2$ & $g_2$ & $g_2$ & $g_2$ & $g_2$ & $g_2$ & 2 \\ 0 & $g_3$ & $g_3$ & $g_3$ & $g_3$ & $g_3$ & $g_3$ & 3 \\ 1 & 0 & 0 & 1 & 1 & 0 & 0 & 3\\ \hline \end{tabular} Table 1: Weight-trimmed representation of Mod$(\psi_d, [1,3])$ \begin{tabular}{|c|c|c|c|c|c|c|c|c|} $x_3$ & $x_4$ & $x_5$ & $x_6$ & $x_7$ & $x_8$ & $x_9$ & $x_{10}$ & weight \\ \hline & & & & & & & & \\ \hline 0 & 0 & 0 & 0 & 0 & 1 & 1 & 1 & 3 \\ 0 & $g_1$ & $g_1$ & $g_1$ & 0 & $g_2$ & $g_2$ & $g_2$ & 3 \\ 0 & $g_2$ & $g_2$ & $g_2$ & 0 & $g_1$ & $g_1$ & $g_1$ & 3 \\ 0 & 1 & 1 & 1 & 0 & 0 & 0 & 0 & 3 \\ 1 & 0 & 0 & 0 & 0 & 1 & $g_1$ & $g_1$ & 3\\ 1 & $g_1$ & $g_1$ & $g_1$ & $g_1$ & 1 & 0 & 0 & 3 \\ 0 & $g_1$ & $g_1$ & $g_1$ & 0 & 1 & 1 & 1 & 4 \\ 0 & $g_2$ & $g_2$ & $g_2$ & 0 & $\ol{g}_2$ & $\ol{g}_2$ & $\ol{g}_2$ & 4 \\ 0 & 1 & 1 & 1 & 0 & $g_1$ & $g_1$ & $g_1$ & 4\\ 1 & 0 & 0 & 0 & 0 & 1 & 1 & 1 & 4\\ 1 & $g_1$ & $g_1$ & $g_1$ & $g_1$ & 1& $\ol{g}_1$ & $\ol{g}_1$ & 4\\ 1 & $g_2$ & $g_2$ & $g_2$ & $g_2$ &1 & 0 & 0 & 4 \\ \hline \end{tabular} Table 2: Weight-trimmed representation of Mod$(\psi_e, [3,4])$ Concatenating suitable $012g$-valued rows with matching $012g$-valued rows in Tables 1 or 2 yields the desired compressed representation of Mod$(\psi, 4)$: \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|l} $x_1$ & $x_2$ & $x_3$ & $x_4$ & $x_5$ & $x_6$ & $x_7$ & $x_8$ & $x_9$ & $x_{10}$ & card &\\ \hline 0 & 1 & 0 & 0 & 0 & 0 & 0 & 1 & 1 & 1 & 1 &\\ & & & & & & & & & & &\\ 0 & 1 & 0 & $g_1$ & $g_1$ & $g_1$ & 0 & $g_2$ & $g_2$ & $g_2$ & ${3 \choose 1} {3 \choose 2}$ & \\ & & & & & & & & & & & \\ 0 & 1 & 0 & $g_2$ & $g_2$ & $g_2$ & 0 & $g_1$ & $g_1$ & $g_1$ & ${3 \choose 2} {3 \choose 1}$ &\\ & & & & & & & & & & &\\ 0 & 1 & 0 & 1 & 1 & 1 & 0 & 0 & 0 & 0 & 1 & $({\bf 0}, 1) \times \mbox{Mod}(\psi_e, 3)$\\ & & & & & & & & & & &\\ 0 & 1 & 1 & 0 & 0 & 0 & 0 & 1 & $g_1$ & $g_1$ & ${2 \choose 1}$ &\\ & & & & & & & & & & & \\ 0 & 1 & 1 & $g_1$ & $g_1$ & $g_1$ & $g_1$ & 1 & 0 & 0 & ${4 \choose 1}$ & \\ \hline & & & & & & & & & & & \\ 0 & 0 & 0 & $g_1$ & $g_1$ & $g_1$ & 0 & 1 & 1 & 1 & ${3 \choose 1}$ & \\ & & & & & & & & & & & \\ 0 & 0 & 0 & $g_2$ & $g_2$ & $g_2$ & 0 & $\ol{g}_2$ & $\ol{g}_2$ & $\ol{g}_2$ & ${3 \choose 2} {3 \choose 2}$ &\\ & & & & & & & & & & &\\ 0 & 0 & 0 & 1 & 1 & 1 & 0 & $g_1$ & $g_1$ & $g_1$ & ${3 \choose 1}$ & \\ & & & & & & & & & & &\\ 0 & 0 & 1 & 0 & 0 & 0 & 0 & 1 & 1 & 1 & 1 & $({\bf 0}, 0) \times \mbox{Mod}(\psi_e, 4)$\\ & & & & & & & & & & & \\ 0 & 0 & 1 & $g_1$ & $g_1$ & $g_1$ & $g_1$ & 1 & $\ol{g}_1$ & $\ol{g}_1$ & ${4 \choose 1} {2 \choose 1}$ & \\ & & & & & & & & & & & \\ 0 & 0 & 1 & $g_2$ & $g_2$ & $g_2$ & $g_2$ & 1 & 0 & 0 & ${4 \choose 2}$ & \\ \hline & & & & & & & & & & & \\ 1 & 1 & 1 & 0 & $g_1$ & $g_1$ & $g_1$ & $g_1$ & $g_1$ & $g_1$ & ${6 \choose 1}$ & $({\bf 1}, 1, 1) \times \mbox{Mod}(\psi_d,1)$\\ \hline & & & & & & & & & & & \\ 1 & $g_1$ & $g_1$ & 0 & $g_2$ & $g_2$ & $g_2$ & $g_2$ & $g_2$ & $g_2$ & ${2 \choose 1} {6 \choose 2}$ & $({\bf 1}, g_1, g_1) \times \mbox{Mod}(\psi_d, 2)$ \\ \hline & & & & & & & & & & & \\ 1 & 0 & 0 & 0 & $g_3$ & $g_3$ & $g_3$ & $g_3$ & $g_3$ & $g_3$ & ${6 \choose 3}$ & \\ & & & & & & & & & & & \\ 1 & 0 & 0 & 1 & 0 &0 & 1 & 1 & 0 & 0 & 1 & $({\bf 1}, 0,0) \times \mbox{Mod}(\psi_d, 3)$\\ \hline \end{tabular} Table 3: Systematic compression of Mod$(\psi, 4)$ (as opposed to (8)) Adding up the cardinalities of the $012g$-valued rows in Table 3 yields $1+ {3 \choose 2}{3 \choose 2} + \cdots + {6 \choose 3} + 1 = 113$ which matches (7) and (9). Here's why it works for general Boolean functions $\varphi$ with a known BDD. We argued already that the sets card$2(\alpha)$ in the schedule are both sufficient and non-redundant. The anchor being evident, suppose by induction that node $\alpha$ has $\beta$ and $\gamma$ as $0$-son and $1$-son respectively, and that both Mod$(\varphi_\beta, \mbox{card}2(\beta)) = r'_1 \uplus r'_2 \uplus \cdots$ and Mod$(\varphi_\beta, \mbox{card}2(\gamma)) = \ol{r}_1 \uplus \ol{r}_2 \uplus \cdots$ are represented as disjoint unions of $012g$-rows. Concatenating suitable $012g$-rows with matching rows $r'_i$ or $\ol{r}_i$ yields rows $r_j$ such that $r_j \subseteq \mbox{Mod}(\varphi_\alpha, \mbox{card}2(\alpha))$. These rows $r_j$ are again mutually disjoint: For instance in Table 3 any two rows constituting $\{0,1\} \times \mbox{Mod}(\psi_e, 3)$ are disjoint because by induction the rows constituting Mod$(\psi_e, 3)$ are disjoint. And each row in (say) $(0,1) \times \mbox{Mod}(\psi_e, 3)$ is disjoint to each row in $(0,0) \times \mbox{Mod}(\psi_e, 4)$ since $(0,1) \cap (0,0) = \emptyset$. Furthermore, the disjoint union of the rows $r_j$ {\it exhausts} Mod$(\varphi_\alpha, \mbox{card}2(\alpha))$ by the careful definition of card$2(\beta)$ and card$2(\gamma)$. {\bf 4.3.4} What remains to be done is assessing the complexity of the algorithm. Note that in the Theorem below the constant within $O(...)$ is independent of $k$. \begin{tabular}{|l|} \hline \\ {\bf Theorem:} There is an algorithm which achieves the following. For any Boolean function\\ $\varphi : \{0,1\}^n \ra \{0,1\}$ given by a BDD with $s$ branching nodes, and any fixed $k \in [n]$, it\\ calculates Mod$(\varphi, k)$ as a disjoint union of $N$ many $012g$-rows in time $O(s^2n^2 \log n + N sn)$.\\ \\ \hline \end{tabular} {\it Proof.} Adding two integers $\leq n$ costs $O(\log n)$, whence calculating a set of type $j+S$ in 4.1 costs $O(n \log n)$. As illustrated by (11) calculating card$1(\alpha)$ from card$1(\beta)$ and card$1(\gamma)$ (where $(\beta, \gamma)$ are the $0$-son and $1$-son of $\alpha$) hence costs $O(n^2 \log n)$. Thus getting all sets card$1(\alpha)$ costs $O(sn^2\log n)$. As we shall now see, getting all sets card$2(\alpha)$ is more expensive. Consider a fixed node $\alpha$ and a fixed upper cover $\beta$. A moment's thought shows that calculating the set $S(\beta)$ (as defined in 4.3) costs $O(n^2 \log n)$ (since each $i \in \mbox{card}2(\beta)$ causes work $O(n \log n)$). The number of sets $S(\beta)$ (for $\alpha$ fixed) can only be bounded by $s$, which brings us to $O(sn^2 \log n)$. Uniting all sets $S(\beta)$ and intersecting the result with card$1(\alpha)$ yields card$2(\alpha)$ and brings the cost to $O(sn^2\log n) + O(sn) = O(sn^2 \log n)$. Thus getting all sets card$2(\alpha)$ costs $O(s^2n^2\log n)$. Let $\beta, \gamma$ be the sons of the branching node $\alpha$. Then the compressed representation of \hfill Mod$(\varphi_\alpha, \mbox{card}2(\alpha))$ can be calculated from the representations of Mod$(\varphi_\beta, \mbox{card}2(\beta))$ and Mod$(\varphi_\gamma, \mbox{card}2(\gamma))$ in time $O(Nn)$; this is evident from the comments made about $\varphi = \psi$. It follows that the whole algorithm runs in total time $O(s^2n^2 \log n) + sO(Nn)$. $\square$ \section*{References} \begin{enumerate} \item[{[CH]}] Y. Crama, P.L. Hammer, Boolean Functions, Enc. of Math. Appl. 142, Cambridge University Press 2011. \item [{[K]}] D.E. Knuth, The Art of Computer Programming, Pre-Fascicle 1B, A draft of Section 7.1.4: Binary Decision Diagrams. \item[{[W]}] M. Wild, ALLSAT compressed with wildcards. Part 1: Converting CNF's to orthogonal DNF's, submitted. \end{enumerate} \end{document}
{'timestamp': '2017-08-24T02:06:54', 'yymm': '1703', 'arxiv_id': '1703.08511', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08511'}
arxiv
\section{Introduction} \label{sec:intro} Previous works on object interaction recognition, captured using egocentric cameras, use semantically distinct verbs as class labels. Labels are chosen by a majority vote~\cite{Motwani12} or by specifically selecting verbs that make annotating unambiguous~\cite{de2008guide, Fathi2012, Pirsiavash12, yumi2014first}. In this work, we argue that recognising object interactions as a standard one-vs-all classification problem stems from three incorrect assumptions (IAs), see Figure~\ref{fig:magic_example}: \begin{figure}[t] \begin{center} \includegraphics[width=\linewidth]{magic_example4.png} \end{center} \caption{For three annotation verbs \textit{Take, Hold, Open}, and seven object interactions, the class boundaries overlap. For the act of `Taking a Bowl' (top), human annotators would use \textit{hold} and \textit{take} as valid labels, but not \textit{open}. Single-label one-vs-all classifiers cannot capture these class overlaps.} \label{fig:magic_example} \end{figure} \noindent \textit{\underline{IA1:} object interaction classes can be self-contained and have strict boundaries}. As the number of verbs increases, classes overlap. For instance take three verbs: \textit{open}, \textit{switch~on} and \textit{turn~on}. The act of \textit{turning~on} a tap could be referred to as \textit{opening} the tap but not as \textit{switching} it \textit{on}. On the contrary, \textit{turning~on} the hob is \textit{switching} it \textit{on}. A classifier would struggle to define boundaries between these verbs when no hard boundary may exist semantically. \noindent \textit{\underline{IA2:} a sequence can be split into segments, each with exactly one object interaction}. Temporal granularities are difficult to define in practice. A video could show someone \textit{holding} and \textit{filling} a cup whereas another could include the user \textit{holding} a knife to \textit{cut}, and a third \textit{holding} and \textit{cracking} an egg. Frequently, multiple object interactions are performed simultaneously like \textit{turning on} a tap to \textit{fill} a cup. \noindent \textit{\underline{IA3:} it is a binary decision whether a verb could be used to label an object interaction.} Given crowdsourced annotations, we show that some verbs are more likely to be chosen than others to annotate object interactions. Human annotators are more likely to use the verb \textit{open} when referring to \textit{pulling} a fridge door open. A method that can learn the probability of using a verb to annotate a video would better emulate a human annotator. We present the following contributions in this paper: \vspace*{-8pt} \begin{itemize} \item We employ crowdsourcing to annotate egocentric videos using a list of $90$ verbs. We collect annotations that offer meaningful statistics and informative semantics on multi-label recognition for two public datasets. \vspace*{-3pt} \item We reformulate object interaction recognition as a probabilistic multi-label classifier, trained using a two-stream CNN. We show that this model can better capture the relationships between observations and annotations, as well as the co-occurrences of labels. \vspace*{-3pt} \item We demonstrate that using a multi-label probabilistic classifier, as opposed to a single label chosen from majority vote, provides higher recognition accuracy. \end{itemize} \vspace*{-4pt} The rest of the paper is as follows: A review of recent and relevant works is contained in Section~\ref{sec:related_work} . Details into how we collected the annotations for the two datasets can be read in Section~\ref{sec:annotations}. We then formulate the method in Section~\ref{sec:method} and Section~\ref{sec:experiments} contains the experiments and results. \vspace*{-3pt} \section{Related Work} \label{sec:related_work} \noindent \textbf{Action Recognition} \hspace{3pt} Action Recognition has largely focussed on a single label classification approach. Hand crafted features dominated most seminal action recognition works ranging from those that have used spatio-temporal interest points~\cite{scovanner20073, laptev2008learning, willems2008efficient, klaser2008spatio} with a bag of word representation to trajectory-based methods~\cite{Wang2011, Wang2013}, encoded using Fisher Vectors~\cite{perronnin2010improving}. Features were typically classified using one-vs-all SVMs. Within the egocentric domain other features such as gaze~\cite{Fathi2012}, hand~\cite{ishihararecognizing,kumarfly} or object specific features~\cite{fathi2013modeling, Damen2014a, McCandless13,ren11,Pirsiavash12} were also incorporated. More recently, CNNs have been trained end-to-end to determine actions for traditional~\cite{ji20133d, karpathy2014large, tran2015learning, lea2016segmental, feichtenhofer2016convolutional} and egocentric~\cite{poleg2016compact, zhou2016cascaded, Ma16} datasets. These approaches have consistently outperformed hand crafted features for recognising actions and use both spatial information and temporal information via optical flow. For instance, Ma~\etal~\cite{Ma16} use an appearance-based CNN to localise objects and a temporal CNN to detect actions. These are then fused to detect the activity. All previous approaches on object interaction recognition, though, define an object interaction class label as a verb-noun combination, attempting to distinguish `take cup' from `take knife'. This makes them less generalisable to the same interactions but with novel objects. In this work, we attempt to label object interactions using \textit{verb} labels solely in order to study class boundaries, \ie~\textit{what is the space of interactions that could be labelled with `take'?}. \noindent \textbf{Semantics and Multiple Labels} \hspace{3pt} Predicting multiple labels for the same input has not been attempted for action recognition, but is increasingly popular for predicting multiple objects present in the scene (\eg predicting the presence of a person, a TV and a table in the same image). These works are motivated by the variety of appearances of objects within the scene, which makes global CNN features unable to correctly predict multiple labels. Approaches thus use object proposals ~\cite{gong2013deep, yang2016exploit} or learn spatial co-occurrences of labels using RNNs/LSTMs~\cite{zhang2016multi, wang2016cnn}. We note that our work differs from other multiple label classifiers in that previous works are focussed on predicting multiple, unrelated -- though co-occuring -- labels, \eg human and table, whereas we are also interested in predicting annotations that can be used to describe the same action, such as \textit{place} and \textit{put}. There is little related work in action recognition that deals with semantics or differing verbs. Motwani and Mooney~\cite{Motwani12} collect sentences for action videos. Their method chooses the most frequent verb out of the annotated sequences which is then, using {W}ord{N}et~\cite{miller1995wordnet}, clustered into activity clusters. Wray~\etal~\cite{wray2016sembed} showed that when annotators were given freedom of choice over which verbs to label, a variety of verbs were chosen, such as \textit{kick}, \textit{pedal} and \textit{fumble}. In most cases, a small number of common verbs were chosen showing a long tail distribution for verbs. In their work, videos are labelled with a single verb but they use semantic knowledge in an attempt to relate these verbs. Another work to use free annotations is Alayrac~\etal~\cite{Alayrac15learning}. The authors automatically use narrations in {Y}ou{T}ube videos to align and cluster action sequences of the same task. A new activity dataset was collected by Sigurdsson~\etal~\cite{sigurdsson2016hollywood} containing videos acted out using scripts which were created by users from a list of verbs and nouns. The authors use a diverse set of actions and vocabulary to describe their dataset. \noindent \textbf{Caption Generation} \hspace{3pt} Semantics and annotations have also been studied by the recent surge in generating captions for images~\cite{mao2014deep, devlin2015language, anne2016deep} and video~\cite{venugopalan2014translating, yao2015describing, yu2016video}. These works assess success by the acceptability of the generated caption, and do not focus on generating multiple valid captions per object or action. For instance, Yu~\etal~\cite{yu2016video} use a hierarchical RNN to generate paragraphs of captions for longer activity videos by feeding sentences through a second RNN. In summary, while many works have attempted similar problems, none have focussed on multi-label classification for action recognition. We are particularly interested in classification, i.e. predicting whether a label could be used to describe an input video, yet wish to accommodate semantically related labels, or co-occurring actions common in daily object interactions. We aim for an approach that extends beyond the handful list of verbs commonly used in action recognition works. \vspace*{-6pt} \section{Annotations} \label{sec:annotations} \vspace*{-5pt} As all previous works label an action or interaction sequence with a single label/verb, no previously published datasets are suitable for training/testing probabilistic or multi-label classification of object interactions. Instead of collecting a new dataset, we provide annotations for the two largest egocentric datasets for object interactions: CMU~\cite{de2008guide} and GTEA+~\cite{Fathi2012 In this Section, we describe the procedure followed to collect annotations (\ref{subsec:ann_procedure}), as well as the statistics of the collected annotations (\ref{subsec:ann_statistics}). \subsection{Annotation Procedure} \label{subsec:ann_procedure} We accumulated a list of potential verbs for labelling by merging all unique verbs or phrasal verbs in the ground-truth annotations of three egocentric datasets~\cite{de2008guide, Fathi2012, wray2016sembed}. The three datasets have a total of $427$ verb-noun classes of which there are $93$ unique verbs. For example: `Spray Pam' from~\cite{de2008guide} contributed \textit{spray}, `Compress Sandwich' from~\cite{Fathi2012} gave \textit{compress} and `Touch Card' from~\cite{wray2016sembed} added \textit{touch}. We found some overlaps between datasets, a total of $23$ verbs are present in at least two datasets, with generic verbs such as \textit{open}, \textit{put} and \textit{take} being present in all three. Due to the kitchen activities taking place in~\cite{de2008guide, Fathi2012}, these have common verbs like \textit{crack}. Additionally,~\cite{wray2016sembed} introduced 62 new verbs, such as \textit{pedal}, \textit{scan} and \textit{screw}, as the annotators were given free verb choice and the activities in this dataset extend beyond the kitchen to include using gym equipment. From the list of $93$ verbs, we removed $3$ verbs; \{\textit{read, rest, walk}\} as we focused solely on object interactions, resulting in the $90$ verbs that form the basis for all collected annotations (see Figure~\ref{fig:annotation}(a) for a complete list). We annotated both datasets, CMU~\cite{de2008guide} and GTEA+~\cite{Fathi2012}, by selecting a reference video from each class. The reference video was chosen such that the ground truth action was clearly visible with good lighting in an attempt to reduce annotation noise. We instructed Amazon Mechanical Turk (AMT) workers to choose all verbs out of the list of $90$ verbs that were correct labels for the reference video. Each video was annotated by a minimum of $30$ and a maximum of $50$ workers to give a distribution for each of the videos. In total, we collected annotations from $1933$ AMT workers \begin{figure}[t] \centering \begin{subfigure}[b]{0.48\textwidth} \centering \includegraphics[width=\textwidth]{Verb_dist_take_cup.pdf} \label{fig:crack_egg} \end{subfigure} \\[-3ex] \begin{subfigure}[b]{0.48\textwidth} \centering \includegraphics[width=\textwidth]{Verb_dist_pour_oil.pdf} \label{fig:take_cup} \end{subfigure} \\[-3ex] \begin{subfigure}[b]{0.48\textwidth} \centering \includegraphics[width=\textwidth]{Verb_dist_compress_sandwich.pdf} \label{fig:take_cup} \end{subfigure} \\[-3ex] \caption{Annotation distributions over $90$ verbs for three object interactions, collected from AMT (30-50 annotators).} \label{fig:verb_distribution} \end{figure} \begin{figure*}[t] \centering \makebox[\linewidth][c]{% \begin{subfigure}[b]{0.535\textwidth} \centering \includegraphics[width=\textwidth]{verb_frequency.pdf} \label{fig:verb_freq} \end{subfigure} \hfill \begin{subfigure}[b]{0.535\textwidth} \centering \includegraphics[width=\textwidth]{Unique_Verbs_BOTH.pdf} \label{fig:annotation_unique} \end{subfigure} } \\[-3ex] \makebox[\linewidth][c]{% \begin{subfigure}[b]{0.53\textwidth} \centering \includegraphics[width=\textwidth]{Verbs_Chosen_BOTH.pdf} \label{fig:annotation_chosen} \end{subfigure} \hfill \begin{subfigure}[b]{0.53\textwidth} \centering \includegraphics[width=\textwidth]{Co_Occur_symmetric_BOTH2.pdf} \label{fig:annotation_symm} \end{subfigure} } \caption{\textbf{Annotation Statistics.} Figure best viewed in colour - CMU (red), GTEA+ (green) (a) Number of annotations per verb. (b) Number of unique annotations per class. (c) Box plot for the number of verbs chosen per annotator for each class. (d) Top 40 symmetric co-occurrences of verb pairs ordered for both datasets and displayed to show the contribution of each dataset separately.} \label{fig:annotation} \end{figure*} Accordingly, for each object interaction, the annotations record the frequency, i.e. number of times, an annotator selected the verb to label that object interaction. We normalised these frequencies by the number of annotators per video, and refer to these as \textit{the probability of annotating the video sequence with the corresponding verb by a human annotator}. We do not filter the annotations as due to the large amount of annotators per video noisy verbs will be negligible. In Figure~\ref{fig:verb_distribution}, examples of three distributions of probabilities over the $90$ verbs can be seen. The original class `Take Measuring Cup' from~\cite{de2008guide} is correctly annotated with many common verbs such as \textit{move}, \textit{pick~up} and \textit{take}. \textit{Put~down} also has a high probability, as the video concludes with the user placing the cup down on the counter. The action `Pour Oil', from~\cite{Fathi2012}, has a high probability for verbs \textit{pour} and \textit{hold}, representing the user holding the oil container whilst performing the action. For the action `Compress Sandwich' from~\cite{Fathi2012}, three visible labels have high probability -- \textit{press, press~down} and \textit{push}. The original label \textit{compress} was picked with a probability of 0.47. \subsection{Annotation Statistics} \label{subsec:ann_statistics} In Figure~\ref{fig:annotation}(a) we show the number of annotations for each of the $90$ verbs -- an expected tail distribution -- with the top-5 used verbs being: \textit{move, pick~up, hold, open} and \textit{put}. In Figure~\ref{fig:annotation}(b) we see that for CMU the classes which had the highest number of verbs chosen comprised of the most sub-actions. `Crack Egg' involves the user both cracking the egg on the side as well as opening the egg shell and finally pouring the egg into the bowl. Similarly `Spray Pam' includes the user opening the can, shaking it and spraying. Further analysis showed little correlation between the length of the action and the number of annotations that were chosen, $R^2=0.0854$ as well as no correlation between the length of the sequence and the number of unique verbs that were chosen, $R^2=0.0972$. It is interesting to note that the lowest number of unique verbs chosen, $20$ for `Open Microwave', is still higher than the number of verbs present in the original annotations for both CMU and GTEA+. Figure~\ref{fig:annotation}(c) shows that all annotators chose several verbs per video, with the average number of annotations ranging from $10$ for `Take Pam' to an average of $3$ for `Close Fridge'. We also checked whether any of the $90$ verbs chosen are redundant, \ie~could be fully replaced by another verb. We do this by using symmetric co-occurrences of these verbs in the AMT annotations. Assume $\mathcal{C}_{ij}$ is the number of times the $i$th verb was annotated with the $j$th verb across all annotators and classes for both datasets. If $\mathcal{N} (i,j) = {\mathcal{C}_{ij}}/{\sum_k \mathcal{C}_{ik}}$, then the symmetric co-occurrence is calculated, $\mathcal{S}(i,j) = \frac{\mathcal{N}(i,j) + \mathcal{N}(j,i)}{2}$. We report the top $40$ co-occurrences in Figure~\ref{fig:annotation}(d), by combining co-occurrences from both datasets. Verbs with high symmetrical occurrences should be interchangeable regardless of context, \eg~(\textit{switch~on}, \textit{turn~on}), (\textit{put}, \textit{place}) and (\textit{rotate}, \textit{turn}). In two cases, \textit{(wash, rinse)} and \textit{(kick, check)}, the co-occurrence originates from only one dataset, namely GTEA+. However, all the remaining top co-occurrences are present in both datasets. Importantly, we find that none of the $90$ verbs were fully redundant or interchangeable, {$\mathcal{S}(i,j)_{CMU} + \mathcal{S}(i,j)_{GTEA+} < 2$}, with the highest co-occurrence being $1.46$. \section{Method} \label{sec:method} We first review the standard recognition approach and then introduce the new probabilistic multi-label action recognition approach. For both approaches, given a list of verbs, \;$\mathcal{C}$, we wish to learn a mapping between video sequences and the annotation verbs. In the first case, only one annotation verb can be used as a label. In the second probabilistic approach, which we propose here, we not only allow multiple annotation verbs but wish to learn the probability of a human using that verb to annotate the video. In this section, we refer to the traditional approach using $\mathcal{T}$ and for the proposed approach using $\mathcal{P}$. We define the standard recognition problem $\mathcal{T}$ as a set of videos, $X = \{x_i; i = 1..K\}$, each with a single label $Y = \{y_i; i = 1.. K\}$, out of a total number of classes $|\mathcal{C}|$, thus ${1 \le y_i \le |\mathcal{C}|}$. The learnt model, $f$, with a set of parameters, $\omega$, would then aim for the prediction $\hat{y_i} = f(\omega, x_i)$, typically trained using a logistic regression loss function: \begin{equation} L_\mathcal{T}(\omega) = -\frac{1}{K} \sum_i \big(y_i \log(\hat{y_i}) + (1-y_i) log (1-\hat{y_i})\big) \label{eq:loss} \end{equation} \vspace*{-8pt} \noindent For a test set with $M$ videos, the accuracy for this recognition model, can then be calculated to be \begin{equation} A_\mathcal{T}(\omega) = \frac{1}{M}\sum_i (\hat{y_i} = y_i) \end{equation} \vspace*{-8pt} We can similarly define the \textit{same standard recognition approach} using a one-hot vector; labels $\bm{y_i}$ of length $|\mathcal{C}|$. The $j$th element in $\bm{y_i}(j)$ is $1$ if the single label of the video is the $j$th class in $\mathcal{C}$ which we denote as $\mathcal{C}_j$ for brevity. The recognition model can then predict a vector $\bm{\hat{y_i}}$ with continuous elements limited to the range $[0,1]$. The accuracy is updated to account for the label vectors, \begin{equation} A_\mathcal{T}(\omega) = \frac{1}{M} \sum_i (\arg\max{\bm{\hat{y_i}}} = \arg\max{\bm{y_i}}) \label{eq:accuracy1} \end{equation} \vspace*{-8pt} \noindent Note that we use $\arg\max$ here in that is common that a classifier may output a score of $x_i$ belonging to a certain class and as such we choose to classify the video as the most likely class. As semantically ambiguous verbs are added, and so the number of verbs $|\mathcal{C}|$ increases, verbs that are semantically correlated (\eg~\textit{put}, \textit{place}) or are only correlated in certain contexts (\eg~\textit{turn~on}, \textit{rotate}) will result in an increased error in classification. To accommodate for a large number of verbs and overlaps in annotations (ref. Figure~\ref{fig:magic_example}), we re-define $\bm{y_i}$ not as a one-hot vector but instead as a distribution of probabilities where $\bm{y_i}(j) = P(\mathcal{C}_j|x_i)$. The probabilities assigned to the class labels allow for capturing verbs that are less frequently used to describe the action albeit still correct. Note that while $0 \le \bm{y_i}(j) \le 1$, the distribution $\bm{y_i}$ is not normalised, i.e. $\sum_j \bm{y_i}(j) \neq 1$. This is intentional so correct multiple labels are not penalised. Each element $\bm{y_i}(j)$ measures the probability of a human annotator selecting that verb, and accordingly, {$\forall \mathcal{C}_j, P(\lnot \mathcal{C}_j | x_i) = 1 - P(\mathcal{C}_j | x_i)$}. In this case the output $\bm{y_i}$ is a set of linear neurons, trained from the frequency of annotations. We adjust the loss function to calculate the Euclidean loss between the two distributions of probabilities $\bm{y_i}$ and $\bm{\hat{y_i}}$, \begin{equation} L_\mathcal{P}(\omega) = -\frac{1}{K} \sum_i \bigl((\bm{y_i}-\bm{\hat{y_i}})^T(\bm{y_i}-\bm{\hat{y_i}})\bigr)^{\frac{1}{2}} \label{eq:loss_euclidean} \end{equation} In Eq.~\ref{eq:loss_euclidean}, errors in estimating probabilities are penalised without a preference for high or low probabilities. We evaluate the proposed probabilistic classifier in two ways, first using a threshold on probabilities $\alpha$. Assume, \begin{equation} \bm{Y}_{i}^\alpha = \{\mathcal{C}_j; \quad \forall \bm{y_i}(j) > \alpha\} \end{equation} is the list of all verbs annotated with a probability higher than $\alpha$, and the corresponding top estimated list of verbs, \begin{equation} \bm{\hat{Y}}_{i}^\alpha = \{\mathcal{C}_j; \quad \forall \bm{\hat{y}_i}(j) \in top_k(\bm{\hat{y}_i}) \land k = |\bm{Y}_{i}^\alpha|\} \end{equation} The accuracy of the proposed system can then be calculated for a certain threshold $\alpha$ as \begin{equation} A_\mathcal{P}(\omega, \alpha) = \frac{1}{M} \sum_i \frac{|\bm{Y}_{i}^\alpha \cap \bm{\hat{Y}}_{i}^\alpha|}{|\bm{Y}_{i}^\alpha|} \label{eq:accuracyOverall} \end{equation} Specifically, assume $k$ verbs were annotated with a probability greater than a threshold $\alpha$, we then find the $top_k$ verbs estimated by the model and measure the overlap. For example, assume $\alpha = 0.7$ and a video is annotated with three verbs where $\bm{y}_i(j) > \alpha$, namely: \textit{put, place} and \textit{move}. We find the top 3 estimated verbs and compare the sets. If the three top estimated verbs were \textit{put, move} and \textit{open}, the accuracy for this video would be set to $\frac{2}{3}$. Eq.~\ref{eq:accuracyOverall} measures the ability of the model to retrieve the right set of annotation verbs. We also measure the mean squared error in predicting probabilities for each verb using, \begin{equation} E_\mathcal{P} (C_j) = \frac{1}{M} \sum_i ||\bm{y}_i(j) - \bm{\hat{y}}_i(j)|| \label{eq:mse} \end{equation} We next present results for the probabilistic classifier, starting with the datasets and the experimental setup. \section{Experiments and Results} \label{sec:experiments} For our experiments we use the two publicly available egocentric datasets aforementioned CMU~\cite{de2008guide} ($404$ video segments) and GTEA+~\cite{Fathi2012} ($1001$ video segments) with the AMT annotations described in Section~\ref{sec:annotations}. Both datasets include videos of daily activities in the kitchen, recorded using a head mounted camera. For each dataset, $5$ cross-fold validation was used where we equally distribute videos from each class across the folds. In Section~\ref{subsec:implementation}, we describe the implementation details for the two stream CNN model used, and then report subsections on results, namely: testing against classification (\ref{subsec:exp1}), evaluation of estimated probabilities (\ref{subsec:exp3}) and evaluation of verb co-occurrences (\ref{subsec:exp2}). \begin{figure*}[t] \begin{center} \includegraphics[width=1.0\linewidth]{qualitative2.png} \end{center} \caption{Qualitative results of the proposed method. Top $5$ ground truth annotations (in black) from the AMT workers. The top 5 predicted verbs from the method are shown in green if correct and red if incorrect.} \label{fig:qualitative} \end{figure*} \subsection{Implementation Details} \label{subsec:implementation} We trained and tested using the two stream fusion CNN model from~\cite{feichtenhofer2016convolutional} that uses two VGG-16 architecture networks as a base, pre-trained on the UCF101 dataset~\cite{soomro2012ucf101}. The last layer of the network was replaced with a Euclidean loss layer, and a number of nodes equal to the number of annotation verbs $|\mathcal{C}| = 90$. The base spatial and temporal networks were each fine-tuned on the videos in the training splits before being used to train the fusion network. Each network was trained for 10 epochs which we found was enough for the network to converge due to using UCF101 pre-trained models. We set a fixed learning rate for spatial, $10^{-3}$, and used a variable learning rate for temporal and fusion networks in the range of $10^{-({2,3,4,5})}$ to $10^{-({3,4,5,6})}$ depending on the training epoch. For the spatial network a dropout ratio of 0.85 was used for the first two fully-connected layers. We fused the temporal network into the spatial network after ReLU5 using convolution for the spatial fusion as well as using both 3D convolution and 3D pooling for the spatio-temporal fusion and we propagated back to the fusion layer. For training we use a batch size of 128, a weight decay of $0.0005$, a momentum of 0.9 and did not use batch normalisation as in~\cite{feichtenhofer2016convolutional}. \subsection{Testing Against Classification} \label{subsec:exp1} We first test our method against a standard classification approach. For this baseline, we select the majority vote per video, that is, the verb with the highest number of annotators, and construct a one-hot vector $\bm{y_i}$ for training labels. This matches the standard classification approach where each video is assigned a single label. The accuracy is calculated for traditional classification using Eq.~\ref{eq:accuracy1}, and for the proposed probabilistic classifier using Eq.~\ref{eq:accuracyOverall}. We report results for $\alpha = 0.5$ as this is the threshold where, for both datasets, each video has at least one annotated verb. predicting multiple labels. At $\alpha = 0.5$, the number of verbs per video is $\mu_{CMU}=3.49$, $\sigma_{CMU}=1.66$ and $\mu_{GTEA+}=3.14$ and $\sigma_{GTEA+}=1.41$. \begin{table}[t] \centering \begin{tabular}{|l|c|c|} \hline & CMU & GTEA+ \\ \hline Prev. &48.6 \cite{spriggs2009temporal} &60.5 \cite{li2015delving}, 65.1~\cite{Ma16}\\ \hline Classification ($\mathcal{T}$) & 52.0 & 61.8 \\ \hline Proposed ($\mathcal{P}$) & 63.3 & 67.9 \\ \hline \end{tabular} \caption{Accuracy results comparing the proposed method to standard classification. Results of the proposed use Eq.~\ref{eq:accuracyOverall} [$\alpha = 0.5$].} \label{tab:baseline} \end{table} Table~\ref{tab:baseline} shows that our classification results are comparable to published results on these datasets, albeit using the majority verb from AMT annotations. It also shows that the proposed method is able to obtain a higher accuracy over the classification approach while In viewing the result, note that the proposed method is attempting a harder problem than the classification task. Assume that $4$ verbs for one video were annotated with a probability $\bm{y}_i(j) > \alpha$, correctly retrieving the majority vote would add $1.0$ to the accuracy of the classifier, but only $0.25$ for the proposed method. The proposed method would achieve an accuracy of 1.0 for the video if the top 4 estimated verbs matched the top 4 annotated verbs. There is no correlation between the number of verbs chosen above the threshold $\alpha$ and the accuracy, for CMU or GTEA+ ($R^2=0.144$ and $R^2=0.0004$ respectively). \begin{table*}[t] \centering \resizebox{\textwidth}{!}{% \begin{tabular}{|r|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|} \hline & \multicolumn{9}{c|}{CMU} & \multicolumn{9}{c|}{GTEA+} \\ \hline $\alpha$ & 0.1 & 0.2 & 0.3 & 0.4 & 0.5 & 0.6 & 0.7 & 0.8 & 0.9 & 0.1 & 0.2 & 0.3 & 0.4 & 0.5 & 0.6 & 0.7 & 0.8 & 0.9 \\ \hline Number of Videos & 404 & 404 & 404 & 404 & 404 & 390 & 304 & 269 & 53 & 1001 & 1001 & 1001 & 1001 & 1001 & 975 & 748 & 732 & 319 \\ \hline Avg. Verbs per Video & 20.1 & 13.0 & 8.58 & 5.80 & 3.49 & 2.44 & 1.73 & 1.04 & 1 & 13.2 & 9.08 & 6.32 & 4.46 & 3.14 & 1.92 & 1.90 & 1.22 & 1 \\ \hhline{|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|} Scores from Classification & 31.2 & 29.1 & 31.6 & 35.1 & 33.9 & 36.0 & 50.3 & \textbf{69.3} & \textbf{54.7} & 26.2 & 25.4 & 29.1 & 33.5 & 40.3 & 53.1 & \textbf{54.6} & \textbf{65.7} & \textbf{78.7} \\ \hline Proposed Method & \textbf{79.1} & \textbf{73.7} & \textbf{69.1} & \textbf{66.2} & \textbf{63.3} & \textbf{57.4} & \textbf{63.7} & \textbf{69.3} & \textbf{54.7} & \textbf{74.8} & \textbf{71.9} & \textbf{70.4} & \textbf{68.3} & \textbf{67.9} & \textbf{59.2} & 52.5 & 59.8 & 71.2 \\ \hline \end{tabular} } \caption{Accuracy results of the proposed method against scores from training one-hot vector baseline with $0.1 \le \alpha \le 0.9$. \label{tab:baseline_full} \end{table*} We next show qualitative results for the top $5$ verbs in Figure~\ref{fig:qualitative}. The proposed method is able to predict the correct verbs in the correct order. We find that it often predicts \textit{move} highly for actions it cannot recognise. In several examples, we note that for cases where the estimated verb does not match the top $5$ ground truth annotations, it still is present with high probability in annotations, typically within the top $10$ verbs, for example \textit{pour} in `Crack Egg', \textit{grasp} in `Open Fridge' and \textit{grab} in `Take Bowl'. While Table~\ref{tab:baseline} compares the proposed method against classification, we also test whether the model trained for classification could be used to estimate probabilities. Instead of capturing $\arg\max\bm{\hat{y}_i}$, we consider the scores from the network $\bm{\hat{y}_i}$ and compare the output using Eq.~\ref{eq:accuracyOverall} for $\alpha \in[0.1,0.9]$ in Table~\ref{tab:baseline_full}. Note that the number of videos with at least one verb annotated with a probability $> \alpha$ differs. For $\alpha > 0.7$, the number of videos with at least one verb annotated drops to 75\% for both datasets. When $\alpha > 0.7$, for videos with clear (few) high peaks, the classifier performs equally or better than the proposed method. This is expected as the majority vote classifier is tuned to recognise annotations with high probabilities solely. \subsection{Evaluation of the Proposed Verb Probabilities} \label{subsec:exp3} We next evaluate the ability of the method to retrieve the distribution of probabilities per video. Figure~\ref{fig:distributions_comp} includes two example distributions of probabilities where the method has been able to fit well to the ground truth. In the top example, the method is tested on a video with a large number of annotated verbs, while the bottom example shows that the method is equally successful in recognising distributions with few visible peaks. Generally, the method seems to underestimate the probabilities of the dominant verbs, causing slight differences in the predicted verb rankings. \begin{figure} \centering \begin{subfigure}[b]{0.45\textwidth} \centering \includegraphics[width=\textwidth]{verb_dist_CMU_take_baking_pan.pdf} \label{fig:dist_stir} \end{subfigure} \\[-3ex] \begin{subfigure}[b]{0.45\textwidth} \centering \includegraphics[width=\textwidth]{verb_dist_GTEA_close_fridge.pdf} \label{fig:dist_take} \end{subfigure} \\[-3ex] \caption{Two different videos with the ground truth and predicted verb probabilities. Top: Take baking pan from CMU. Bottom: Close fridge from GTEA+.} \label{fig:distributions_comp} \end{figure} \begin{figure}[t] \begin{center} \includegraphics[width=\linewidth]{verb_prob_error.pdf} \end{center} \caption{Mean square error of each of the predicted verbs calculated using Eq.~\ref{eq:mse}.} \label{fig:mse} \end{figure} \begin{figure*}[t] \begin{center} \includegraphics[width=0.86\linewidth]{qualitative_joint.png} \end{center} \caption{Examples of the method predicting co-occurrences between verbs. The top two rows show pairs of verbs with high co-occurrence with the last row showing an example of two verbs with low co-occurrence. Ground truth and predicted probabilities are also shown for each verb. The proposed method is able to not only recognise when two verbs should co-occur with high probability, first column, but also predict sensible probabilities when one of the verbs has a lower probability, second column. Failure cases are shown in the last column.} \label{fig:qualitative_co_occur} \end{figure*} Figure~\ref{fig:mse} shows the mean square error for the predicted probabilities of each verb (Eq.~\ref{eq:mse}). The median MSE is below $0.1$ for $88$ verbs - excluding \textit{put~down} and \textit{pull~out} where the median is below $0.15$. We note that the error in predicting the probability for the verb \textit{move} is low, compared to the frequency of the annotation. Results also show low error bars for specific actions such as \textit{hold}, \textit{grip} and \textit{open} suggesting that the proposed method is able to learn these actions well. Verbs with the highest error, \textit{pick~up}, \textit{pull~out} and \textit{place} for example, correspond to actions that often occur at the start or end of other actions; \textit{pick~up} a knife before \textit{cutting}. We finally test whether the method predicts annotations with high or low probabilities more accurately, and note no correlation between the annotated probability of a verb with $\alpha>0.1$ and the MSE ($R^2=0.0383$) for all verbs and all videos. \subsection{Evaluation of Learning Co-Occurrences} \label{subsec:exp2} \begin{figure}[t] \begin{center} \includegraphics[width=\linewidth]{Co_Occur_symmetric_BOTH_pred2.pdf} \end{center} \caption{The top 40 symmetric co-occurrences predicted from the method found with $\alpha=0.5$ for both CMU and GTEA+. The verbs are ordered by both datasets but plotted to show the contribution of each dataset separately.} \label{fig:co_occur_pred} \end{figure} We next look at class overlaps, which correspond to predicting annotation co-occurrences. A co-occurrence between two verbs $\mathcal{C}_{ij}$ occurs when a video is annotated using both verbs with a probability $> \alpha$. Figure~\ref{fig:qualitative_co_occur} shows examples of correct and incorrect predicted co-occurrences. For the two verbs (\textit{pull~out}, \textit{pick~up}), we study three cases of their co-occurrence. For the action `Take Egg', the person pulls the egg out of the box and picks it up. Ground truth annotations indicate high probability for both verbs. Our proposed method is indeed able to predict the co-occurrence with high accuracy. For a different interaction of `Opening the Freezer's drawer', the method correctly predicts a high accuracy for annotating the video using the verb \textit{pull~out}, and correctly estimates that the verb \textit{pick~up} is not a suitable verb to annotate this video. The figure shows cases of failure where the co-occurrences are incorrectly predicted. The final row shows two verbs, \textit{stir} and \textit{push}, that have a very low co-occurrence. The model is able to define the soft boundaries between these classes. Using the same co-occurrence metric in Figure~\ref{fig:annotation}(d), we study the top co-occurrences that the method has learned. Figure~\ref{fig:co_occur_pred} shows the top 40 symmetric co-occurrences with $\alpha=0.5$ for both datasets. We find that a few verbs with a small number of instances are always (and sensibly) predicted together, such as (\textit{swirl}, \textit{stir}) and (\textit{spread}, \textit{distribute}). This suggests that the method is able to learn meaningful semantic relationships between verbs. As opposed to Figure~\ref{fig:annotation}(d), where co-occurrences are detected in annotations from both datasets, Figure~\ref{fig:co_occur_pred} shows co-occurrences are strongly discovered in one of the two datasets. Recall that we fine-tune different models for the two datasets. Training a single model might result in common co-occurrences. While in this work we attempted multi-label classification, the model does not localise the various labels in space or time. This will be particularly interesting for cases where antonyms are picked with high probability - picking up a baking pan before putting it down. This direction of investigation is left for future work. \section{Conclusion and Future Work} \label{sec:conc} \vspace*{-6pt} In this paper, we present the case for multi-label annotations of object interactions, in egocentric video, and provide a comprehensive set of AMT multi-verb annotations for two datasets. We provide a model that estimates the probability of a label being used to annotate the video, out of a list of possible verbs. When using a two-stream fusion CNN, we show that the method is able to predict not only the correct verb labels but also sensible probabilities for two public datasets outperforming single label classification. We discuss success and failure cases for multi-label classification, and show the method is able to learn co-occurrences of semantically related verbs and simultaneous interactions. In the introduction, we highlighted three incorrect assumptions when using single-labels to annotate object interactions. We plan to investigate next how the proposed probabilistic multi-label classifier addresses each of these assumptions, towards further refinement of the model and its performance. {\small \bibliographystyle{ieee}
{'timestamp': '2017-04-24T02:07:41', 'yymm': '1703', 'arxiv_id': '1703.08338', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08338'}
arxiv
\section{Introduction} \IAENGPARstart{A}{} common problem in machine learning is the task of having to group a set of $N$ data points or objects into $K$ clusters. This is termed \textit{clustering}. These objects are collected together into a set denoted as $\mathbb{D}$. Clustering can occur in varied settings. As an example, consider the case of classifying $N$ organisms into $K$ different kingdoms based on their features. This can be construed as a clustering problem where the number of features being considered is $d$. In the more general sense, $d$ denotes the dimensionality of the set $\mathbb{D}$. Furthermore, the collection of feature vectors of all the organisms forms the set $\mathbb{D}$, while the clusters denoted as $\mathbb{C}_k$ are represented by the different kingdoms. In machine learning, clustering falls under the domain of unsupervised learning since there are no class labels to the objects in $\mathbb{D}$. Nonetheless, it can also be performed as a precursor to some supervised learning techniques. An example of this latter application is in the implementation of the radial basis function (RBF) with $K$ centers \cite{1}. The clusters, denoted as $\mathbb{C}_k$ $(k=1,...,K)$, are to be determined such that objects in any one cluster are similar to each other, but different from objects in all other clusters. It is assumed that the objects in $\mathbb{D}$ lend themselves to some natural grouping \cite{2}. Otherwise, any partitioning of the data can be considered valid, which would make the problem undefined. However, in the $K$-center RBF, such an assumption is not binding since the objective is to use the $K$ centers as representative points in the dataset for the construction of basis functions. Clustering is, however, an ill-posed problem \cite{3} for the following reasons. First, the question of how to tell if any two objects are similar has no definitive answer. To illustrate this, in Fig. 1 (a), the similarity among objects in either of the natural clusters indicated by + or o is based on the distance of a point from the center. On the other hand, in Fig. 1 (b), the closeness of the points to one another provides the measure of similarity among the two natural clusters indicated by + and o. Thus, there is no general similarity measure by which objects are clustered. The second reason why the problem of clustering is ill-defined is that the number of clusters $K$ to which the objects must be classified is not known \textit{a priori}. A rough estimate of $K$ is usually assumed to be available from domain expertise or from the distribution of the data. If such an estimate is not available, the common practice is that existing algorithms are run for different $K$. The value of $K$ which minimizes some predefined criterion like the Akaike Information Criterion (AIC) or the Bayes Information Criterion \cite{3} is then chosen. Clustering algorithms may yield poor results if the $K$ chosen is inappropriate \cite{3}. The most widely used algorithm for clustering in the context of machine learning is Lloyds algorithm, more commonly referred to as K-Means algorithm. It is so called because it essentially computes the $K$ means or centroids of the different clusters. The ease of implementation of the algorithm as well as its fast runtime has accounted for its ubiquity in use. Nevertheless, it has the major drawback of yielding solutions that are only locally optimal, and which may not necessarily be the global optimal solution. For this reason, several other methods have been applied to solving the clustering problem \cite{4}-\cite{7}. Notable among these is the approach of Al-Sultan \cite{7} which is based on the Tabu Search (TS) algorithm developed by Glover \cite{8}. We henceforth refer to this approach, i.e. \cite{7} (our reference work) as the Tabu Search Clustering (TSC) algorithm. The performance reported was shown to be superior to that of the K-Means algorithm. The TS algorithm is a metaheuristic procedure that accepts an initial solution as input, and performs a local search using neighborhood and memory structures until some stopping criterion is met. It is able to escape local minima by allowing for solutions that do not improve the objective function. TS has been applied in solving varied problems including the traveling salesman problem (TSP) \cite{9} and signal detection in multiple input multiple output (MIMO) antenna systems \cite{10}. However, with regards to the clustering problem, the high computational complexity and difficulty in parameter selection required in the TS approach does not make it an attractive alternative to the K-Means algorithm. Our main contributions in this paper are as follows: \begin{enumerate} \item We introduce a quantized means TS scheme for solving the clustering problem. We target the optimization of the $K$ centers by evolving them through a series of neighboring solutions in such a manner that leads to an efficient exploration of the search space. This procedure is well described in Section IV. The scheme requires only two parameters to be set, and is of a relatively low complexity. \item We present experimental results obtained from the proposed approach on some test datasets (Section V). \end{enumerate} \section{Problem Description} For the purpose of this paper, we assume that the number of clusters $K$ is given. We refer the reader to the works by Hamerly et al. \cite{11} and Pan et al. \cite{12} for a detailed treatment on how to choose $K$. The dataset $\mathbb{D}$ is assumed to come from a mixture distribution where the mixture component label (which is the cluster index) for any object in the dataset is hidden. In the most general sense, an object can belong to more than one cluster. Thus, for such an interpretation, the problem of clustering is simply that of finding the clusters to which an object belongs with a high probability. Mathematically, this can be stated concisely as maximizing the following probability for different models $\textbf{S}$ for a given $\textbf{x}_n \in \mathbb{D}$: \begin{equation} p(\textbf{x}_n \mid \textbf{S})=\sum_{k=1}^{K}w_kp(\textbf{x}_n \mid \mathbb{C}_k,\textbf{S}) \end{equation} where $\textbf{S}$ comprises the cluster memberships for all the objects in the dataset, as well as the mixture weights $w_k$. Maximizing (1) requires knowledge of the cluster memberships and the mixture weights, as well as knowledge of the mixture distribution. In general, none of these is known, and so the following set of simplifying assumptions \cite{4} are made in practice. \begin{enumerate} \item Each object in $\mathbb{D}$ belongs to a single cluster; \item Each cluster is distributed as a multivariate Gaussian; \item The mixture components have equal weights $w_k$. \end{enumerate} \begin{figure}[tbph] \centering \begin{subfigure}{0.5\textwidth} \centering \includegraphics[width=\textwidth, height=60mm]{similar6} \caption{} \label{m1} \end{subfigure} \begin{subfigure}{0.5\textwidth} \centering \includegraphics[width=\textwidth, height=60mm]{similar7} \caption{} \label{m2} \end{subfigure} \caption{Similarity Measures} \end{figure} The consequence of the above assumptions is that the similarity measure is now based on the Euclidean norm so that points closest to each other in Euclidean space are grouped under one and only one cluster. It is conceivable that a dataset may have some similarity measure other than the Euclidean distance. Indeed, \cite{13}-\cite{15} explore the use of other distance measures for clustering. Yet, for some datasets, an appropriate representation of the points can make the Euclidean distance measure valid. As an example, transformation of the points in Fig. 1 (a) into polar co-ordinates yields the representation in Fig. 1 (b) which has the Euclidean distance as a valid similarity measure. The clustering problem then yields itself to a treatment as a mathematical optimization whose aim is to minimize a parameter $J$ known as the intra cluster sum of squares (ICSS) or the distortion \cite{4}. This may be stated as: \begin{equation} \min J=\sum_{k=1}^{K}\sum_{\textbf{x}_n\in \mathbb{C}_k}{\|\textbf{x}_n-\bm{\mu}_k\|}^2 \end{equation} where $\textbf{x}_n \in \mathbb{C}_k$ are all data points in cluster $k$ and $\bm{\mu}_k$ is the mean or center of that $k$th cluster. This is the problem termed as K-Means clustering. It must be mentioned that neither the cluster memberships nor the means are known. Thus, this problem is computationally difficult, and is NP-hard \cite{6}. The K-Means algorithm provides an efficient way of solving (2). It is based on the observation that the optimal placement of the $K$ centers is at the centroids of the respective clusters. The algorithm is typically initialized with some random means, usually chosen from objects in the dataset $\mathbb{D}$. Since the K-Means algorithm is a special case of the Expectation-Maximization (EM) algorithm \cite{4}, it proceeds in two stages namely, the expectation and the maximization stages. \begin{enumerate} \item Expectation: Compute the centroid of each cluster: \begin{equation} \bm{\mu}_k=\frac{1}{N_k}\sum_{\textbf{x}_n\in \mathbb{C}_k}\textbf{x}_n \end{equation} where $N_k$ is the number of objects in the $k$th cluster. \item Maximization: Compute the cluster memberships: \begin{align} \mathbb{C}_k = \left\{ \textbf{x}_n: \|\textbf{x}_n-\bm{\mu}_k\|^2 < \|\textbf{x}_n-\bm{\mu}_l\|^2, \right. \nonumber \\ \quad \left. l=1,...,K, \quad l\not=k \right\} \end{align} \end{enumerate} The expectation-maximization steps are carried out iteratively until there is no cluster change, at which point the algorithm is terminated. The major drawback of the K-Means algorithm is as follows. First, the objective function of (2) is non-convex and may thus have several local minima. Therefore, being only a local search method, the K-Means algorithm is not guaranteed to find a global minimum; it often yields solutions that are only locally optimal. This is due in part to the nature of the stopping criterion. The algorithm terminates when there is no change in cluster memberships; this period corresponds to a local minimum. It makes no provision to consider other local minima which may be present in other areas of the search space. Again, as with all local search methods, the performance of the K-Means algorithm is directly tied to the quality of the initial solution. If this solution is poor, i.e., if it is too far away from the global optimum, the algorithm may likely converge to a local minimum. Our approach is motivated by the above limitation, and is based on the TS algorithm in \cite{8}. \section{Tabu Search} Tabu Search is a metaheuristic technique used for combinatorial optimization. It does not require the optimization problem to be convex. The algorithm makes use of neighborhood structures to explore the search space. It also utilizes a short term memory structure called a \textit{tabu}, which is essentially a list of forbidden moves or solutions. Tabus prevent the back and forth movements between solutions that have already been considered in the search, a phenomenon called \textit{cycling}. Moreover, TS allows for moves to solutions that do not yield any improvement in the objective function. It does so with the view that the poor solution may lead to a better one at a later time in the search. Thus, it is able to escape from local minima. TS keeps in memory the best solution found at any point in the search, and returns that solution when the algorithm is terminated. In its most basic form, it follows the procedure outlined below: \begin{enumerate} \item Select an initial solution $\textbf{M}^{(0)}$. This solution can be randomly generated or obtained by more formal means. Set $\textbf{M}_c$ and $\textbf{M}_b$ to $\textbf{M}^{(0)}$. $\textbf{M}_c$ and $\textbf{M}_b$ are the current and best solutions respectively. \item Evaluate the objective function $J$ for the current solution $\textbf{M}_c$. \item Find neighboring solutions of $\textbf{M}_c$. Let $\textbf{V}$ denote this set. The neighbors of $\textbf{M}_c$ are all those solutions that are similar to, but differ in a minor aspect from $\textbf{M}_c$. \item Find the set of solutions in $\textbf{V}$ that are not in the Tabu list $\textbf{T}$. Let this set be denoted by $\textbf{V}\setminus\textbf{T}$. The Tabu is a list of solutions or moves that have already been considered in the search. Tabus, as algorithmic structures, force the algorithm to other areas of the search space, thus enhancing the diversification of the search. \item Evaluate the objective function for all the solutions in $\textbf{V}\setminus\textbf{T}$. Find the best solution among this set. Let this be $\textbf{M}_n$. \item If $J_n < J_b$, let $\textbf{M}_b=\textbf{M}_n$. $J_n$ and $J_b$ are the objective function evaluations of $\textbf{M}_n$ and $\textbf{M}_b$ respectively. \item Put the solution $\textbf{M}_c$ into the Tabu list, and let $\textbf{M}_n$ be the new current solution $\textbf{M}_c$. If the maximum number of iterations (which is chosen beforehand) has elapsed, terminate. Else, go to Step 3. \end{enumerate} \section{Quantized Means TS Clustering} In this section, we discuss the proposed algorithm. As with any TS implementation, the Quantized Means TS Clustering follows the skeleton of the description of the TS algorithm in Section III with the following modifications and specificities. \subsection{Search Space} In this formulation, a vector $\textbf{M}^{(0)}$ defined as $\textbf{M}^{(0)}=[\bm{\mu}_1^T,...,\bm{\mu}_K^T]^T$ is considered as the initial solution, where $\bm{\mu}_1,...,\bm{\mu}_K$ are $K$ randomly chosen observations from the dataset $\mathbb{D}$. $\textbf{M}^{(0)}$ is then assigned to $\textbf{M}_c$. To navigate the search space then, neighbors of $\textbf{M}_c$ have to be found. Neighboring solutions are typically drawn from a finite set that includes the current solution itself. Alternatively, they can be obtained via a simple transformation of the current solution. It is worth mentioning that in the context of TS, neighboring solutions are not necessarily those that are closest to the current solution. To obtain neighbors of $\textbf{M}_c$, we change its individual components i.e. $\bm{\mu}_k$ $(k=1,...,K)$, by replacing them with some new means or centers. However, the means are real-valued in general, and do not constitute any finite set. Therefore, the set of all possible neighbors obtained in this manner is necessarily an infinite set. This set is the feasible search space. The fact of the search space being infinite makes TS ill-suited to optimizing $\textbf{M}_c$, since TS is used for combinatorial optimization. A finite subset of the search space is thus necessary. For this reason, the proposed scheme makes the assumption that the $K$ means take on values exclusively from objects in the dataset $\mathbb{D}$. We refer to this as \textit{quantized means}. Our proposed algorithm is divided into two stages, namely, exploration and refinement; we make the aforementioned assumption on the means only in the initial exploration stage. Thus, in the exploration stage, for $k=1,...,K$, $\bm{\mu}_k \in \textbf{M}_c$ is replaced with some other point $\textbf{x}$ taken from the dataset. This procedure yields the neighboring solution denoted as $\textbf{M}_n$. More specifically, for every $k \in \left\lbrace 1,...,K\right\rbrace $, we constrain the point $\textbf{x}$ to the $k$th cluster $\mathbb{C}_k$ (which is a subset of the dataset). This quantization of the means makes the problem formulation combinatorial. Nevertheless, the resulting set of all possible combinations of $\textbf{M}_c$ (i.e. the search space denoted as $\mathbb{W}$), although finite, is still large. \tikzstyle{decision} = [diamond, draw, fill=blue!20, text width=5em, text badly centered, node distance=3cm, inner sep=0pt] \tikzstyle{block} = [rectangle, draw, fill=blue!20, text width=8em, text centered, rounded corners, minimum height=4em] \tikzstyle{line} = [draw, -latex'] \tikzstyle{cloud} = [draw, ellipse,fill=red!20, node distance=3cm, minimum height=2em] \subsection{Neighborhood Construction} Due to the large size of $\mathbb{W}$, one has to choose only $R$ ($R \ll \left| \mathbb{W}\right| $) points from the set $\mathbb{W}$ via a simple transformation of the solution $\textbf{M}_c$ and consider those as the neighbors of $\textbf{M}_c$ in any one iteration of the TS algorithm. The difficulty, however, is in the choice of which $R$ neighbors. If we randomly select neighbours, the search is unguided and thus likely to be slow to converge on the optimal solution. A simple guiding mechanism might be to choose nearest neighbours. However, this seems a poor choice intuitively because for many cases it will cause no change to the clustering and where it does, it might not be a change in the right direction. \subsubsection*{Analytic Neighbors} We therefore use the gradient information of the objective function to guide the neighbor selection. In any TS iteration, we choose $R$ points in $\mathbb{W}$ that result in the steepest descent along the trajectory of the objective function. We consider the selection of a single neighbor, i.e $R=1$ in this paper. The following approach is then taken to find one high-quality neighbor of $\textbf{M}_c$. Since the objective function of (2) is non-convex, the aim is to find a neighbor $\textbf{M}_n\in\mathbb{W}$ that corresponds to a local minimum of $J$. A necessary and sufficient condition for this is to have the gradient of $J$ to be zero at the local minimum, i.e. \begin{equation} \nabla_{\textbf{M}_c}J=\textbf{0} \end{equation} where the notation $\nabla$ represents the gradient. By definition, \begin{equation} \nabla_{\textbf{M}_c}J= \frac{\partial J}{\partial \bm{\mu}_1}\textbf{e}_1 +... + \frac{\partial J}{\partial \bm{\mu}_K}\textbf{e}_K=\textbf{0} \end{equation} where $\textbf{e}_k$ $(k=1,...,K)$ is a unit vector in the $\bm{\mu}_k$ direction. By (6), it has implicitly been assumed that each $\bm{\mu}_k$ is independent of the other. This assumption is not generally true of the K-Means algorithm, as a change in some $\bm{\mu}_k$ may change the cluster memberships and hence change the location of the other means. However, in the exploration stage of our proposed algorithm, the means are not defined as the cluster centroids as in (3), but are chosen independently of each other in the procedure below. This permits the evaluation of the $K$ partial derivatives independently as: \begin{equation} \frac{\partial J}{\partial \bm{\mu}_k}=0, \quad \forall k=1,...,K \end{equation} However, since $\bm{\mu}_k$ has been constrained to the dataset $\mathbb{D}$, the change in the means $\partial \bm{\mu}_k$ being considered is not necessarily infinitesimal. For this reason, we approximate the partial derivative in (6) as a partial difference quotient as: \begin{equation} \frac{\partial J}{\partial \bm{\mu}_k}\approx\frac{\Delta J}{\Delta \bm{\mu}_k}\approx 0, \quad \forall k=1,...,K \end{equation} which can be evaluated from first principles as follows: \begin{equation} J=\sum_{i=1}^{K}\sum_{\textbf{x}_n\in \textbf{C}_i}{\|\textbf{x}_n-\bm{\mu}_i\|}^2 \end{equation} A change in the mean $\Delta\bm{\mu}_i$ would then cause a change $\Delta J$ in the objective function, i.e., \begin{equation} J+\Delta J=\sum_{i=1}^{K}\sum_{\textbf{x}_n\in \textbf{C}_i}{\|\textbf{x}_n-(\bm{\mu}_i+\Delta\bm{\mu}_i)\|}^2 \end{equation} \begin{align} & J+\Delta J =\nonumber \\ & \sum_{i=1}^{K}\sum_{\textbf{x}_n\in \textbf{C}_i} \big ({\|\textbf{x}_n-\bm{\mu}_i\|}^2-2{(\textbf{x}_n-\bm{\mu}_i)}^T\Delta\bm{\mu}_i+{\|\Delta\bm{\mu}_i\|}^2 \big ) \end{align} \begin{equation} \Delta J=\sum_{i=1}^{K}\sum_{\textbf{x}_n\in \textbf{C}_i}\big (-2{(\textbf{x}_n-\bm{\mu}_i)}^T\Delta\bm{\mu}_i+{\|\Delta\bm{\mu}_i\|}^2 \big ) \end{equation} For the purpose of evaluating (8), $\Delta\bm{\mu}_i=0$ for $i\not=k$ due to the assumption of the independence of the means, hence \begin{equation} \Delta J=\sum_{\textbf{x}_n\in \mathbb{C}_k}\big (-2{(\textbf{x}_n-\bm{\mu}_k)}^T\Delta\bm{\mu}_k+{\|\Delta\bm{\mu}_k\|}^2 \big ) \end{equation} \begin{equation} \frac{\Delta J}{\Delta\bm{\mu}_k}=\sum_{\textbf{x}_n\in \mathbb{C}_k}\big(-2{(\textbf{x}_n-\bm{\mu}_k)}+\Delta\bm{\mu}_k \big )\approx 0 \end{equation} where $\Delta\bm{\mu}_k=\textbf{x}-\bm{\mu}_k$. In order to evaluate (14), we find $\textbf{x} \in \mathbb{C}_k$ that minimizes (13), having constrained the means to the dataset $\mathbb{D}$. This minimizing parameter is denoted as $\textbf{x}_k^*$. The neighboring solution $\textbf{M}_n$ is then the aggregation of all $\textbf{x}_k^*$ $(k=1,...,K)$, i.e. $\textbf{M}_n=[\textbf{x}_1^{*T},...,\textbf{x}_K^{*T}]^T$. It must be noted that if the means were to be unconstrained to $\mathbb{D}$, (7) could be evaluated directly instead of solving (14), and the solution of (7) would be the centroids of the clusters, which is essentially what the K-Means algorithm evaluates. However, the initial assumption on the means would be violated, and there would still be the risk of getting trapped at local minima. Rather, this procedure allows for the consideration of solutions that worsen the objective function $J$ since (13) would not always yield negative values, thereby escaping from local minima. The intuitive alternative of finding the cluster centroids, and then quantizing them to the dataset $\mathbb{D}$ introduces a quantization loss and yields an inferior performance to the procedure described. \begin{figure}[tbph] \begin{tikzpicture}[node distance = 2cm, auto] \node [block, fill=white] (init) {Generate an initial solution $\textbf{M}^{(0)}$. Let $\textbf{M}_c=\textbf{M}_b=\textbf{M}^{(0)}$.}; \node [block, below of=init, fill=white] (Jb) {Evaluate $J_b$ corresponding to $M_b$}; \node [block, below of=Jb, fill=white] (identify) {For $k=1,...,K$, find $\textbf{x}_k^*= \arg \min_{\textbf{x} \in \mathbb{C}_k\setminus\textbf{T}} \Delta J$}; \node [block, below of=identify, fill=white] (evaluate) {Form neighboring solution $\textbf{M}_n=[\textbf{x}_1^{*T},...,\textbf{x}_K^{*T}]^T$ }; \node [block, below of=evaluate, fill=white] (Jn) {Evaluate $J_n$ corresponding to $\textbf{M}_n$}; \node [decision, below of=Jn, node distance=2.5cm, fill=white] (decide1) {Is $J_n<J_b$?}; \node [block, below left of=decide1, node distance =3cm, fill=white] (expert1) {Let $J_b=J_n, \textbf{M}_b=\textbf{M}_n$ and $r=0$}; \node [block, below right of=decide1, node distance =3cm, fill=white] (expert2) {$r=r+1$}; \node [block, below of=decide1, node distance =4cm, fill=white] (current) {Put $\textbf{M}_c$ into Tabu list. Let $\textbf{M}_c=\textbf{M}_n$}; \node [decision, below of=current, fill=white] (decide3) {Are termination criteria satisfied?}; \node [block, below of=decide3, node distance =3cm, fill=white] (refine) {Refine $\textbf{M}_b$}; \node [block, below of=decide1, node distance=12cm, fill=white] (stop) {Stop}; \path [line] (init) -- (Jb); \path [line] (Jb) -- (identify); \path [line] (identify) -- (evaluate); \path [line] (evaluate) -- (Jn); \path [line] (Jn) -- (decide1); \path [line] (decide1) -| node [near start] {Yes} (expert1); \path [line] (decide1) -| node [near start] {No} (expert2); \path [line] (expert1) |- (current); \path [line] (expert2) |- (current); \path [line] (current) -- (decide3); \path [line] (decide3) -- node {Yes} (refine); \path[line] (decide3) -- node [near start] {No} ++(-4cm,0) |- (identify); \path [line] (refine) -- (stop); \end{tikzpicture} \caption{Proposed Algorithm} \end{figure} Once the means have been computed, the cluster memberships can then be determined from: \begin{align} \mathbb{C}_k = \left\{ \textbf{x}_n: \|\textbf{x}_n-\textbf{x}_k^*\|^2 < \|\textbf{x}_n-\textbf{x}_l^*\|^2, \right. \nonumber \\ \quad \left. l=1,...,K, \quad l\not=k \right\} \end{align} from which the objective function in (1) can be evaluated. \subsection{Tabu} The Tabu structure used in this formulation is a list of all the means $\textbf{x}_k^*$ that have been considered in the search. Since there are $K$ means, the Tabu considered is an array with $K$ rows whose column length increases as the TS algorithm proceeds. If for some $k$, $\textbf{x}_k^*$ obtained from minimizing (13) is in the Tabu list, it is discarded and the next point $\textbf{x} \in \mathbb{C}_k$ in increasing order of their $\Delta J$ evaluation is chosen. If all points in the $k$th cluster are in the Tabu list for any $k$, the last entry in the $k$th row of the Tabu list is deleted in order to allow for at least one solution to be valid. \subsection{Termination Criterion} The termination criterion employed in the proposed algorithm is two-fold. First, after the maximum number of TS iterations $IT_{max}$ has been reached, the algorithm is terminated. Secondly, there is an early termination criterion whereby the algorithm is cut off after a predefined number of iterations (called the cut-out parameter $r_{max}$) within which there is no improvement in the best found solution $\textbf{M}_b$. This is an indicator of the convergence of the algorithm. The early termination is done on the assumption that the global minimum may have already been achieved. In order for this assumption to be mostly valid, the neighboring solutions generated in any iteration must not be random. Otherwise, there is a good chance the global optimal solution would be found in any TS iteration. Therefore, the process of generating $R$ random neighbors of $\textbf{M}_c$ from $\mathbb{W}$ would not yield good results with regards to the early termination. The early termination cuts down the computational complexity as the algorithm does not need to be run for all $IT_{max}$ iterations. \subsection{Refinement} The essence of the initial restriction on the means $\bm{\mu}_k$ to belong to the finite set $\mathbb{D}$ is to make the optimization problem combinatorial, and enable the efficient exploration of the search space. Once that has been achieved at the end of the TS algorithm, the means can then be unconstrained. As a result, the components of the best found solution $\textbf{M}_b$ are recomputed as the centroids of the clusters obtained at the end of the TS algorithm. Alternatively, one may use $\textbf{M}_b$ as an initial solution to the K-Means algorithm to obtain a refined solution. The proposed TS scheme (i.e. using the analytic neighborhoods) is illustrated in the flow chart of Fig. 2. \section{Simulations and Results} For our simulations, we use four real-world datasets namely: the Bavaria Postal code dataset \cite{16} (for two different values of $K$), the Fisher's \textit{Iris} dataset, the Glass Identification dataset, and the normalized Cloud dataset \cite{17} (also for two different values of $K$). These datasets are chosen to cut across a wide range of $d$, $K$, and $N$ values. We simulate our proposed scheme in MATLAB on an Intel Core i5-2400 processor using the following parameters: $IT_{max}=400$ and $r_{max}=0.25IT_{max}$. We compare the performance of this scheme to the TSC, the K-Means++ \cite{18}, and the K-Means algorithms in terms of the objective function of (2) and the time taken for completion. We use the following parameter settings for the TSC algorithm: $NTS=20,\mathit{MTLS}=15,IT_{max}=1000, P=0.95$ as suggested by Al-Sultan \cite{5}. For each dataset, we run each algorithm $100$ times, and provide the worst, average and best objective function values, as well as the average time for completion. The results of our simulations are summarized in Tables I-VI. \begin{table}[H] \centering \caption{Iris Flower dataset\\ $N=150, K=3, d=4$} {\begin{tabular}{|c|c|c|c|c|} \hline Algorithm & Worst $J$ & Average $J$ & Best $J$ & Time (s)\\ \hline K-Means & $ 145.76 $ & $ 90.50 $ & $ 78.85 $ & $ 0.17 $ \\ K-Means++ & $ 145.45 $ & $ 80.16 $ & $ 78.85 $ & $ 0.18 $ \\ TSC & $ 310.48 $ & $ 282.94 $ & $ 249.93 $ & $ 72.98 $ \\ Proposed & $ 78.86 $ & $ \textbf{78.85} $ & $ 78.85 $ & $ 3.58 $ \\ \hline \end{tabular}}{} \label{iris} \end{table} \begin{table}[H] \centering \caption{Glass dataset\\ $N=214, K=6, d=9$} {\begin{tabular}{|c|c|c|c|c|} \hline Algorithm & Worst $J$ & Average $J$ & Best $J$ & Time (s)\\ \hline K-Means & $ 580.02 $ & $ 394.32 $ & $ 336.29 $ & $ 0.36 $ \\ K-Means++ & $ 480.82 $ & $ 376.25 $ & $ 336.06 $ & $ 0.38 $ \\ TSC & $ 928.51 $ & $ 904.08 $ & $ 873.68 $ & $ 68.26 $ \\ Proposed & $ 382.13 $ & $ \textbf{352.28} $ & $ 338.75 $ & $ 5.33 $ \\ \hline \end{tabular}}{} \label{glass} \end{table} \begin{table}[H] \centering \caption{Bavaria dataset\\ $N=89, K=4, d=3$} {\begin{tabular}{|c|c|c|c|c|} \hline Algorithm & Worst $J$ & Average $J$ & Best $J$ & Time (s)\\ \hline K-Means & $ 2.79$e$+11 $ & $ 2.67$e$+11$ & $ 1.04$e$+11$ & $ 0.25 $ \\ K-Means++ & $ 2.79$e$+11$ & $ 1.16$e$+11$ & $1.04$e$+11$ & $ 0.15 $ \\ TSC & $ 4.38$e$+11$ & $ 4.10$e$+11$ & $3.84$e$+11$ & $55.66$ \\ Proposed & $ 1.05$e$+11$ & $ \textbf{1.05$e$+11} $ & $ 1.04$e$+11$ & $ 3.84 $ \\ \hline \end{tabular}}{} \label{bav1} \end{table} \begin{table}[H] \centering \caption{Bavaria dataset\\ $N=89, K=5, d=4$} {\begin{tabular}{|c|c|c|c|c|} \hline Algorithm & Worst $J$ & Average $J$ & Best $J$ & Time (s)\\ \hline K-Means & $ 2.62$e$+11$ & $ 2.56$e$+11$ & $ 0.74$e$+11$ & $ 0.35 $ \\ K-Means++ & $ 8.65$e$+10$ & $ \textbf{6.83$e$+10} $ & $ 5.98$e$+10$& $ 0.23 $ \\ TSC & $3.76$e$+11$ & $ 3.17$e$+11$ &$ 2.16$e$+11$ & $ 64.19 $ \\ Proposed & $8.07$e$+10$ & $8.02$e$+10$ & $ 5.98$e$+10$ & $ 6.57 $ \\ \hline \end{tabular}}{} \label{bav2} \end{table} \begin{table}[H] \centering \caption{Cloud dataset\\ $N=1024, K=10, d=10$} {\begin{tabular}{|c|c|c|c|c|} \hline Algorithm & Worst $J$ & Average $J$ & Best $J$ & Time (s)\\ \hline K-Means & $ 1646.53$ & $ 1580.19$ & $ 1504.08$ & $ 6.57 $ \\ K-Means++ & $ 1664.17$ & $ 1550.40$ & $ 1504.58$ & $ 7.21 $ \\ TSC & $ 9140.61$ & $ 9058.90$& $ 8895.18$& $ 810.97 $ \\ Proposed & $ 1596.17$ & $ \textbf{1530.95} $ & $ 1503.18$ & $ 29.32 $ \\ \hline \end{tabular}}{} \label{cloud1} \end{table} \begin{table}[H] \centering \caption{Cloud dataset\\ $N=1024, K=25, d=10$} {\begin{tabular}{|c|c|c|c|c|} \hline Algorithm & Worst $J$ & Average $J$ & Best $J$ & Time (s)\\ \hline K-Means & $ 1105.65$ & $ 944.94$ & $ 847.10$ & $ 15.40 $ \\ K-Means++ & $ 937.12$& $ 848.73$ & $ 820.46$ & $ 19.28$ \\ TSC & $ 8897.38$ & $ 8746.27$& $ 8576.96$ & $ 814.79 $ \\ Proposed & $ 920.42$ & $ \textbf{845.25} $ & $ 816.87$ & $ 83.76 $ \\ \hline \end{tabular}}{} \label{cloud2} \end{table} From the tables, it can be seen that the proposed scheme achieves the best average objective function in five of the six tests performed. The best average objective function for all the tests have been highlighted in boldface. The proposed scheme consistently outperforms the TSC algorithm in terms of the computational time, average, best and worst objective function values. Specifically, on the Cloud dataset for $K=25$, our algorithm achieves as much as $90\%$ improvement on the average $J$, while doing so $90\%$ faster. It must be noted that both the proposed scheme and the TSC algorithm can actually be used to obtain lower values of $J$ than the ones reported, by increasing the value of $IT_{max}$ (and $NTS$ in the case of the TSC). However, that would be at the expense of greater computational time. Compared to the K-Means and K-Means++, our algorithm also performs favorably. In particular, it outperforms the K-Means algorithm by as much as $69\%$ in terms of the average $J$ on the Bavaria postal code dataset for $K=5$. Compared to the K-Means++ algorithm, our approach achieves a marginal performance improvement in the average $J$, reaching to $9\%$ on the Bavaria postal code dataset for $K=4$. The proposed scheme also achieves the lowest worst objective function as compared to the K-Means and K-Means++ algorithms on all datasets. However, in terms of the rate of convergence, the K-Means++ algorithm is shown to be the best. \section{Related Work} The TS algorithm has been applied to the K-Means clustering problem with a different formulation by Al-Sultan \cite{7} where a candidate solution in the form of an array of length $N$ is used. This array denoted as $\textbf{A}_c$ is made up of the cluster indices of all the $N$ objects in $\mathbb{D}$. In order to obtain neighboring solutions (also known as trial solutions), the cluster indices in $\textbf{A}_c$ are changed according to some criterion. This method can lead to bad cluster memberships. This is because while two close objects in the dataset may show a tendency of belonging to one cluster, this scheme may assign different cluster indices to them. The algorithm also involves setting the following parameters: the number of trial solutions $NTS$, the maximum tabu list size $\mathit{MTLS}$, the maximum number of TS iterations $IT_{max}$, and a probability threshold $P$. Extensive parametric study has to be carried out for a particular dataset in order to obtain the optimal values. The TS clustering algorithm in \cite{19} discusses essentially the same procedure as the TSC algorithm with two additional neighborhood structures presented. The process of generating neighboring solutions in both of these algorithms is largely random, causing the algorithm to behave to some degree like a random search with memory. The implication of this randomness is that the global optimal solution has an equal chance of being generated in the first TS iteration as it has in the $IT_{max}$th iteration. Consequently, the probability that a global solution may have been found after $r_{max}$ iterations of non-improving solutions is rather low. Thus, the early termination described in Section IV-B cannot be applied to these algorithms without a significant performance loss. The TS algorithm has also been applied to the Fuzzy C-Means clustering problem \cite{20}, where an object in the dataset $\mathbb{D}$ can belong to more than one cluster to varying degrees. The TS procedure taken in that formulation aims at optimizing the cluster means, which is similar to the approach taken in our proposed scheme. However, that is as far as the similarity goes. While our scheme constrains the means to objects in the dataset and use gradient information to generate a new neighbor, this approach generates neighboring means by perturbing the current mean along a random direction. Other TS approaches for clustering includes the \textit{packing-releasing} algorithm \cite{21} which is also based on \cite{7}, but with the following fundamental difference: a pair of objects in the dataset that are close to each other are packed together and treated as one object. These packed objects are later released. This procedure reduces the size of the search space and guides the search to a local minimum more quickly. While we have assumed in this work that the number of clusters $K$ is known beforehand, the evolution-based tabu search algorithm \cite{12} uses TS for the determination of the number of clusters in the dataset, by considering $K$ as another variable to be optimized in the TS procedure. \section{Conclusion} In this paper, we have presented an efficient Tabu Search procedure for solving the K-Means clustering problem. This involves constraining the $K$ means to objects in the dataset, and optimizing these means via a series of neighbors that are obtained using gradient information of the objective. We have compared the proposed scheme to an existing TS algorithm as well as the K-Means and K-Means++ algorithms. We have shown that this approach performs favorably with these well-known algorithms, as well as not requiring too many parameter settings. This is a promising result for a lot of machine learning applications that use K-Means clustering. We note, however, that the nature of the tabu structure used in our TS implementation might require a large memory, especially for big datasets where the maximum number of TS iterations is correspondingly large. For this reason, ongoing work is focused on identifying a more compact representation of the entries in the tabu structure and consequently reducing the runtime of the algorithm. \ifCLASSOPTIONcaptionsoff \newpage \fi
{'timestamp': '2017-03-27T02:08:03', 'yymm': '1703', 'arxiv_id': '1703.08440', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08440'}
arxiv
\section{Introduction} \label{sec:intro} The query log of a SQL database gives us precious hints about what its users are interested in. From this dataset, we can infer query auto-completions~\cite{akbarnejad2010sql, khoussainova2010snipsuggest, sarawagi1998discovery}. We can simulate realistic queries, for testing purposes~\cite{tran2015oracle}. We can even reduce the latency of the queries, thanks to speculative execution~\cite{sapia2000promise}. Furthermore, the log describes the database itself: it describes which queries succeeded or failed, how long they took, and how many tuples they returned. Combined with predictive algorithms, this information could help us emit warnings, chose efficient query plans and build more robust engines. Yet, mining query logs is subject to a fundamental problem: SQL queries do not live in a vector space. In their na\-tural form, queries are structured, symbolic objects - not vectors of real numbers. Hence, the vast majority of statistical concepts are undefined. Elementary methods such as means, correlations or regression do not apply. The same problem arises with advanced methods such as neural networks or SVMs. Consequently, most authors resort to \emph{appli\-ca\-tion-specific frameworks}~\cite{agrawal2006context, ghosh2002plan, giacometti2009query, yang2009recommending, yao2005finding, zhang2011data}: they devise some encoding specifically for the problem at hand, and feed it to a custom algorithm. This approach is neither practical nor efficient, because each use case requires a complete new representation system and a new algorithm. A few authors have developed more general, application-independent solutions: \emph{neighborhood-based algorithms}~\cite{akbarnejad2010sql, aligon2014similarity, chatzopoulou2009query, Nguyen2015Ident}. These algorithms are popular because they require no encoding. Instead, they rely on a \emph{pairwise dissimilarity function}, which quantifies the similarity or difference between two queries. Once the authors have defined such a function, they apply it to all the pairs of queries in the log. They obtain a neighborhood graph, in which they detect discrete patterns. But these methods are limited: we observed that few papers, if any, venture beyond the strict realm of clustering and $k$ Nearest Neighbors (kNN). One explanation is that statistical textbooks and software provide little support for other tasks. To illustrate, the official R Website does not even mention NN-regression on its machine \mbox{learning} page (cf. footnote). Besides, these approaches suffer from quali\-tative drawbacks. They cannot interpolate between training examples, e.g., to compute centroids. They have little to no notion of prediction confidence. Finally, they are very sensitive to small training sets, local sparsity, and class imbalance. Several empirical studies reveal cases where they are under-optimal~\cite{desrosiers2011comprehensive, koren2008factorization}. Our ambition is to unlock the rest of the statistical toolbox. We want to perform kNN and clustering, but also density estimation, sampling, regression, classification, dimen\-sionality reduction, reinforcement learning and visualization, directly over SQL queries. To do so, we develop me\-thods to encode the query log in such a way that it becomes subject to these tasks. We envision software ``converters'', to process query logs in R, Weka or Matlab as if they were classic tables of numbers. Thus, database designers will be\-nefit from the rich libraries offered by these platforms. They will be able to focus on insights and functionalities rather than implementation. \pagebreak In this paper, we describe promising methods to represent query logs in an application-independent fashion. We present three families of encodings: \begin{itemize} \item \emph{Feature maps} directly transform queries into vectors. \item \emph{Kernel methods} manipulate queries as if they were vectors, but without actually transforming them. \item \emph{Bayesian methods} rely on probabilistic graphical mo\-dels rather than vector spaces. \end{itemize} We highlight the advantages and drawbacks of each solution, and present mathe\-matical transformations to switch from one representation to the other. For all three families, we make the case for longer term investigations. The rest of the paper is organized as follows. In Section~\ref{sec:motivation}, we motivate our work and we present our requirements. In Sections~\ref{sec:explicit}, \ref{sec:kernel} and \ref{sec:generative}, we introduce our solutions. We highlight their relationships in Section~\ref{sec:bridge}. We discuss related work in Section~\ref{sec:RelatedWork}, and conclude in Section~\ref{sec:conclusion}. \section{Overview} \label{sec:motivation} We established that queries do not live in a vector space. But what if we could devise a function $\Phi$ to transform SQL statements into vectors? In this section, we present the immense range of practical applications which would follow. We then discuss how realistic this vision is. \subsection{Visions for Query Log Mining} \label{sec:visions} \begin{figure}[!t] \centering \includegraphics[width=\columnwidth]{Images/Mapping} \caption{Example of feature map $\Phi$.} \label{pic:featuremap} \end{figure} \textbf{From Queries to Vectors.} Suppose that we could access a function $\Phi$, to map any SQL query $Q \in \mathbb{Q}_{SQL}$ to a vector $\phi \in \mathbb{R}^D$. We illustrate it in Figure~\ref{pic:featuremap}. To be consistent with the machine learning literature, we name it \emph{feature map}~\cite{bishop2006pattern}, and we suppose that it is one-to-one. How could this function be useful? \begin{figure}[!t] \centering \includegraphics[width=.9\columnwidth]{Images/DensityEstimation} \caption{Heatmap of the log's density. The dashed rectangle represents the recommendation window, defined by the user's input.} \label{pic:hotzones} \end{figure} First, we could perform \emph{density estimation}: for each query $Q$, we could estimate the probability function $p(\Phi(Q))$, as illustrated in Figure~\ref{pic:hotzones}. The density function is a powerful tool, because it lets us perform many classic tasks from the log mining literature. For instance, we could detect ``hot zones'' in the query log (i.e. clusters). We could also re\-commend queries: when users start typing SQL statements, they implicitly define a window of interest, as shown in Figure~\ref{pic:hotzones}. To help them, we could highlight the most popular queries in this window. More importantly, a function $\Phi$ would allow us to perform \emph{regression} and \emph{classification}. In regression, we infer quantities from SQL statements, based on past observations. Thanks to this method, we could estimate the runtime of a query, the cardinality of its output, or or the number of machines involved in a cluster. In classification, we predict a discrete variable. Thus, we could detect which user is currently querying the database, and pre-fetch some data accordingly. We could also emit warnings, if the user's query is dangerously close to one that failed previously. Finally, we could machine-learn tasks which were previously coded by hand: among others, we could train a neural network to associate SQL queries with visualizations. To conclude, the combination of the function $\Phi$ and statistical algorithms would lead to dozens of applications. A few of them have been proposed in the literature before (those related to density estimation), others are new. In any case, they would all run on top of a unified, complete formalism. \textbf{From Vectors to Queries.} We now go one step further: what if we had access to an \emph{inverse feature map} $\Phi^{-1}$ to reconstitute queries from vectors? The function $\Phi^{-1}$ would have a dramatic effect: it would let us create new queries from scratch. Observe the density function pictured in Figure~\ref{pic:hotzones}. By \emph{sampling} from this distribution, we could produce queries that have never been written before, but which are likely to occur. Thus, we could generate artificial, but realistic workloads. This technique could be useful for testing and exploration. Combined with adaptive indexing mechanisms such as database cracking~\cite{halim2012stochastic}, it could also help us build more efficient indices. \begin{figure}[!t] \centering \includegraphics[width=0.95\columnwidth]{Images/Extrapolation} \caption{Example of querying pattern based on time.} \label{pic:timeseries} \end{figure} Another application of this idea is \emph{query regression}: we could extrapolate SQL queries from other SQL queries. Consequently, we could detect usage patterns, and exploit those to predict which query will come next, using time series models. Figure~\ref{pic:timeseries} provides an example. This scenario is fictive, and we suspect that real workloads are more chaotic in practice. But we do not need to predict precise queries. Predicting general areas of interest would already be helpful, and probabilistic methods excel at that. Finally, more applications could come from \emph{active learning}. In particular, we envision adaptive DBMS benchmarks. Such systems would pose queries, observe how the database reacts and adapt their behavior accordingly. Thus, they would automatically identify performance bottlenecks, and report them to DBMS designers. \subsection{How Far Are We?} \label{sec:discussion} In fact, constructing a function to map queries to vectors is not a difficult task. For example, we could count $n$-grams, as in information retrieval. The whole challenge is to build an application-independent transformation. Such a transformation should be \emph{lossless}, that is, non destructive. The vector representation of a query should convey all the information contained in its SQL form. It should contain lexical and grammatical information: which keywords are used, and what are their roles. But it should also convey the \emph{set relationships} between the queries. By nature, queries represent sets of tuples, which can be disjoint, overlapping, or nested. With continuous variables, they can even be ordered. These properties should be preserved in the encoding. The actual feature selection, which depends on the use case, should be left to the user. Unfortunately, we suspect that if such a mapping $\Phi$ exists, then the vector space it yields will have a huge, unpractical dimensionality. We discuss this point further in Section~\ref{sec:explicit}. In the rest of this paper, we present several restricted versions of the function $\Phi$. Two of these methods are lossless: dummy coding and Bayesian modeling. However, their scope is limited: we have not yet found any practical way to process all the possible queries from SQL. The remaining approaches are more flexible, but they are lossy. The users must specify the properties of interest in advance. For instance, they may focus on the syntactical structure of the queries, or their extent. The encoding will reflect these attributes, and destroy the remaining information. Consequently, two distinct queries can have the same encoding, and the inverse mapping $\Phi^{-1}$ is undefined. \section{Feature Maps} \label{sec:explicit} We now present two methods to build feature maps, \emph{dummy coding} and \emph{dissimilarity-based feature maps} (DBFMs). \subsection{Dummy Coding} \label{sec:dummy} \begin{figure}[!t] \centering \includegraphics[width=\columnwidth]{Images/Dummy} \caption{Example of dummy coding.} \label{pic:dummy} \end{figure} \textbf{Method.} The idea behind dummy coding is to represent queries with vectors of binary variables, where each component represents a degree of freedom offered by SQL. For example, a variable could signal the presence or absence of a certain table in the \texttt{WHERE} clause, or an aggregation in the \texttt{SELECT} section. Additionally, we include continuous columns to deal with numeric selection predicates. Figure~\ref{pic:dummy} illustrates this method with a fictive example. In fact, dummy coding has a fundamental flaw: to support all of SQL, it requires vectors of infinite length. In consequence, we must limit its scope. One option is to represent only the queries in the log, as we did in Figure~\ref{pic:dummy}. An other is to specify a subset of SQL a priori. For example, we can restrict the encoding to Select-Project-Join queries with a limited number of components. Additionally, we can compress the resulting vectors with dimensionality reduction methods, such as factor analysis or autoencoders~\cite{bishop2006pattern}. \textbf{Discussion.} Dummy coding is the naive approach. It is straightforward and lossless. It produces flat tables, which effectively make it possible to mine query logs with mainstream statistical tools. But we foresee that it will return huge, sparse vector spaces with complex queries. The subsequent vectors will be costly to store, to process, and statistical methods will be prey to overfitting (as per the curse of dimensionality~\cite{bishop2006pattern}). Dimensionality reduction algorithms can help, but they are lossy, expensive, and they require careful tuning. Besides, binary variables are not real numbers, thus not all statistical methods can cope with them (for example, k-means is excluded). For all these reasons, we need alternative encoding schemes. \subsection{Dissimilarity-Based Mapping} \label{sec:dbfm} We now present dissimilari\-ty-based feature maps (DBFMs), which generalize of existing work on query log mining. \textbf{Method.} To build a DBFM, we operate in three steps. First, we chose one or several pairwise dissimilarity measures from the literature. Second, we embed them into an enco\-ding function. Thanks to this function, we can represent the log with a large matrix. In the last step, we compress it. Defining the dissimilarity between two queries is subject to all the problems presented in Section~\ref{sec:discussion}. Currently, we know no perfect measure of dissimilarity. However, several authors have already proposed specific functions, in the context of neighborhood-based approaches. Chatzopoulou et al.~\cite{chatzopoulou2009query} have reported a measure based on query results: two queries are similar if they involve the same tuples. Akbarnejad et al.~\cite{akbarnejad2010sql} have used fragments of text. More recently, Nguyen et al.~\cite{Nguyen2015Ident} have developed a method to exploit the results of queries without running them. In a recent paper, Aligon et al. review 14 of these functions~\cite{aligon2014similarity}. Collectively, those cover a wide range of use cases. Our idea is to embed them in an encoding $\Phi$. For a given dissimilarity measure, the square matrix $\ensuremath{\mathbf}{D}$ represents the \emph{dissimilarity matrix} of the query log. This matrix contains the pairwise dissimilarities between all the couples $(Q_i, Q_j)$ in the log, as follows: \begin{equation} \ensuremath{\mathbf}{D} \equiv \begin{bmatrix} d(Q_1, Q_1) & d(Q_1, Q_2) & \ldots & d(Q_1, Q_N)\\ d(Q_2, Q_1) & \ddots & &\vdots \\ \vdots & & \ddots&\vdots \\ d(Q_N, Q_1)& \ldots & \ldots &d(Q_N, Q_N)\\ \end{bmatrix} \end{equation} It turns out that we can derive a trivial feature map from this representation: we map each query $Q_i$ to the vector $\phi_i = [d(Q_i, Q_1), \ldots, d(Q_i, Q_N)]^\top$. In other words, we associate each query to its corresponding line in $\ensuremath{\mathbf}{D}$. Hence, DBFMs represent queries by their difference with regards to the other queries in the log. The resulting space is called \emph{dissimilarity space}, and its theoretical properties were described by Pekalska and Duin~\cite{duin2012dissimilarity}. Observe that this method lets us combine several dissimilarity measures: we simply concatenate the resulting dissimilarity matrices. To deal with the dimensions of the result, we apply dimensionality reduction. Specifically, we can use PCA, or we can cluster the columns and pick a few representative dimensions. \textbf{Discussion.} The advantage of the DBFM method is its flexibility. In comparison with dummy coding, DBFMs can deal with complex queries. Also, they generate continuous variables, which involves a broader class of algorithms. However, these functions are lossy: the user must specify the properties of interest. Also, the compression step is costly and it requires tuning, as discussed in Section~\ref{sec:dummy}. Finally, DBFMs are by definition sensitive to the queries in the log. If those are similar to each other, then the columns of the dissimilarity matrix $\ensuremath{\mathbf}{D}$ will be highly correlated. Therefore this matrix will contain little information. The physical dimensionality of the dissimilarity space will be high, but its intrinsic dimensionality will be low. In conclusion, DBFMs appear as viable substitutes for dummy coding in cases where the log is small and the queries diverse. But we need more general methods for larger and sparser data sets. \textbf{Multidimensional Scaling.} An alternative approach is Multidimensional Scaling~\cite{borg2005modern}. This method takes the dissimilarity matrix $\ensuremath{\mathbf}{D}$ as input, and generates a vector space in which the pairwise distances between the objects are preserved. Multidimensional scaling is relevant, but it suffers from the exact same problems as DBFMs: it is costly, it requires tuning and it depends crucially on the queries in the log. \section{Kernel Functions} \label{sec:kernel} In the previous section, we presented two general classes of feature maps. We now discuss \emph{implicit} alternatives: kernel approaches. \subsection{Introducing Kernel Functions} \label{sec:introkernel} The aim of this section is to communicate the intuition behind kernels. We refer the reader to Bishop~\cite{bishop2006pattern} for a more rigorous introduction. In this paper, we mention a number of statistical methods applicable to vectors, such as regression, classification and clustering. In fact, we do not need all of algebra to perform them. We need only one fundamental operation: \emph{the dot-product}. If we can compute the dot-product $\phi_i \cdot \phi_j$ between two vectors $\phi_i$ and $\phi_j$, then we can run linear regression, Support Vector Machines, K-means, PCA and many others. The process of rewriting a statistical method in terms of dot-products is known as \emph{kernelization}~\cite{bishop2006pattern}. At this point, computing the dot-product $\phi_i \cdot \phi_j$ is problematic because we need to compute the vectors $\phi_i = \Phi(Q_i)$ and $\phi_i = \Phi(Q_j)$. To do so, we need the mapping function~$\Phi$. Kernel functions let us bypass this operation. A kernel function $K(Q_i, Q_j)$ is analog to a dissimilarity measure: it has a low value if $Q_i$ and $Q_j$ are similar, and it has a high value otherwise. But kernels have a convenient mathematical property: for every such function $K$, there exists a feature map $\Phi$ such that: \begin{equation} K(Q_i, Q_j) = \Phi(Q_i) \cdot \Phi(Q_j) \end{equation} In plain words, computing the similarity between two queries according to $K$ is equivalent to mapping them to some feature space and applying the dot-product. Therefore, each kernel defines an \emph{implicit} feature map. This property is powerful: we can manipulate SQL queries as if they lived in a vector space, but without actually materializing the space. In essence, kernel methods offer a middle way between neighborhood-based approaches and feature mapping. \subsection{Kernels for the Query Log} \label{sec:syntax} In the past, authors have successfully built kernel functions for complex objects, such as texts, DNA strings, \mbox{images} or even videos~\cite{gartner2003survey}. Our task is now to design a kernel function for SQL queries. \textbf{Dissimilarity-Based Kernels.} Not all dissimilarity measures are kernel functions. To qualify, a measure must obey \emph{Mercer's conditions}~\cite{bishop2006pattern}. Those imply that the eigenvalues of the dissimilarity matrix are positive. We know no function that guarantees these conditions. However, authors have presented methods to turn arbitrary dissimilarity measures into kernels, such as \emph{spectral shifting} or \emph{spectral clipping}~\cite{chen2009learning,wu2005analysis}. These methods compute the spectrum of the dissimilarity matrix, and correct the eigenvalues to meet Mercer's conditions. In effect, they let us reuse the dissimilarity measures from the literature, similarly to DBFMs. But they are costly, i.e., cubic with the number of items. Also, it is not clear how to maintain their results as new queries come in. \textbf{Custom Kernels.} An alternative approach is to engineer new kernels from scratch. Authors have developed such functions for graphs, sets, and even logic programs~\cite{gartner2003survey}. We could extend those to SQL queries. To tackle different use cases, we could generate several kernels. For example, we envision a function to describe the syntax of the queries, and another to describe their set properties. We could easily aggregate them, because the weighted sum of two kernels is itself a kernel. But we could also attempt to design a lossless solution. Indeed, kernels can encode infinite dimension spaces. The Gaussian dissimilarity is a popular illustration of this property~\cite{bishop2006pattern}. Therefore, we do not exclude the existence of a ``perfect'' kernel function for SQL queries. \textbf{Discussion.} Compared to feature maps, kernel methods have many advantages. They are possibly more space efficient, because they do not materialize the vectors. The underlying encoding $\Phi$ is robust: it does not involve arbitrary restrictions, and it is independent from the other queries in the log. Lastly, kernels bypass the costly compression operations of feature maps: the whole space is embedded in the dissimilarity function. Nevertheless, our quest for a transformation $\Phi$ does not stop here. Even if we had access to a perfect kernel, it is likely that its implicit feature space would remain theoretical: we would know that the inverse feature map $\Phi^{-1}$ exists, but we could not access it. Also, not all statistical methods were kernelized, hence kernel approaches are less general than explicit methods. Finally, their accuracy for SQL log mining remains to be studied. In particular, we must evaluate their sensitivity to the curse of dimensionality. \section{Graphical Models} \label{sec:generative} \begin{figure}[!t] \centering \includegraphics[width=\columnwidth]{Images/Bayesian} \caption{Simple Bayesian model to describe the distribution of \texttt{SELECT-FROM} queries, in a database made of three tables with two columns each. The full circles represent constants, the empty circles represent random variables.} \label{pic:bayesselectfrom} \end{figure} So far, we have only considered methods related to vector spaces. But there exists an alternative conceptual framework for which many statistical methods were developed: \emph{probabilistic graphical models}, also called \emph{Bayesian networks}. \textbf{Presentation.} The aim of graphical models is to decompose complex probability distributions into elementary, low-dimension components. Let us introduce an example. We wish to describe the distribution of all the \texttt{SELECT-FROM} queries from the log of a DBMS. In other words, we want to estimate the function $p_{SF}: \mathbb{Q}_{\texttt{SELECT-FROM}} \to [0,1]$, which maps each query to its probability. Finding a closed mathematical form for this function is difficult: it involves complex operations, many parameters, and the number of these parameters is variable. Bayesian networks give us a mean to express $p_{SF}$ in a graphical way. Figure~\ref{pic:bayesselectfrom} displays an example of model. This graph can be understood as an algorithm to generate new queries. We read it as follows: \begin{itemize} \item Set the constant vectors $\Pi_\text{Tables}$, $\Pi_{\text{Columns}, 1}$, $\Pi_{\text{Columns}, 2}$, and $\Pi_{\text{Columns}, 3}$. The vector $\Pi_\text{Tables}$ describes the probability of occurrence of all the tables. The vectors $\Pi_{\text{Columns}, t}$ describes the probability of occurrence of the columns in each table $t$. \item Chose $T$ random tables $\{\text{From}_1, \ldots, \text{From}_T\}$, picking them randomly with probabilities $\Pi_\text{Tables}$ \item For each table $t \in \{\text{From}_1, \ldots, \text{From}_T\}$, chose $N_{t}$ random columns $\{\text{Select}_{t,1}, \ldots, \text{Select}_{t,N_t}\}$, picking randomly with probabilities $\Pi_{\text{Columns}, t}$. \end{itemize} Thus, the network describes a method to sample from the distribution $p_{SF}$. In fact, it also gives us a tractable way to compute the probability $p_{SF}(Q)$ for any given query $Q$. Here again, we refer readers to Bishop~\cite{bishop2006pattern} for more details. \begin{figure}[!t] \centering \includegraphics[width=\columnwidth]{Images/BayesianClustering} \caption{Extension of the \texttt{SELECT-FROM} model to support clusters. The latent variable $Class$ influences the distribution of the parameters $\Pi_\text{Tables}$, $\Pi_{\text{Columns}, 1}$, $\Pi_{\text{Columns}, 2}$, and $\Pi_{\text{Columns}, 3}$, which themselves influence the query, as illustrated in Figure~\ref{pic:bayesselectfrom}. The distribution of the variables $\Pi_{\text{Columns}, t}$ have form as that of $\Pi_\text{Tables}$, for $t \in\{1,2,3\}$.} \label{pic:bayesclustering} \end{figure} \textbf{Extensions.} With graphical models, we can compute complex probability functions and generate samples. Accordingly, if we had a complete model for SQL queries, we could detect ``typical'' or ``outlying'' queries, and we could generate realistic SQL statements. But we could also extend the model to cover more complex tasks. In the machine learning literature, authors have described dozens of statistical methods with Bayesian networks, including all those that interest us~\cite{bishop2006pattern}. We could exploit them, by ``plugging in'' our own SQL network. As an illustration, we present an elementary clustering model in Figure~\ref{pic:bayesclustering}. To build this model, we plugged our \texttt{SELECT-FROM} model into a mixture of distributions. In Section~\ref{sec:bridge}, we will introduce more general methods, to support all types of machine learning algorithms. \textbf{Discussion.} Aside from dummy coding, Bayesian modeling is the only method which provides both the mapping $\Phi$ and its inverse $\Phi^{-1}$. To obtain the image $\Phi(Q)$ of a given query $Q$, we instantiate the variables in the network. To obtain its inverse $\Phi^{-1}(Q)$, we execute the generative process. Additionally, graphical models are more flexible than vectors. For instance, they support variable numbers of parameters and recursivity. Besides, they are interpretable, and they have convenient statistical properties: among \mbox{others}, Bayesian methods natively incorporate regularization and adaptivity (cf. empirical Bayes~\cite{bishop2006pattern}). Yet, producing a complete Bayesian network for SQL que\-ries remains a challenge. Also, adapting its parameters to the log may involve costly computation methods, such as Monte-Carlo simulations. Finally, as with feature maps and kernel functions, the empirical performance of this method remains to be studied. At this point, we do not know how accurate it is for log mining. \section{Bridging Graphical Models and Vector Spaces} \label{sec:bridge} \begin{figure}[!t] \centering \includegraphics[width=\columnwidth]{Images/Roadmap} \caption{Summary of the methods discussed in this paper.} \label{pic:bayesselectfrom} \end{figure} To close our presentation, we highlight a powerful feature of probabilistic graphical models: they can yield vector spaces, both implicitly and explicitly. For a start we can embed graphical models into kernel functions. We know at least two methods to do so, \emph{probabi\-li\-ty product kernels} and \emph{Fisher kernels}~\cite{bishop2006pattern}. Thanks to these solutions, we can benefit from both the generative features of graphical models and the libraries of kernel methods. Furthermore, we conjecture that we can generate vectors directly from graphical models. In Figure~\ref{pic:bayesclustering}, we show an example of latent variable model, where the discrete variable $Cluster$ influences the distribution of the query's components. We could generalize this model to \emph{continuous latent variables}. In this case, a fixed-size random vector would condition the distribution of the parameters $\Pi_\text{Tables}$ and $\Pi_{\text{Columns}, t}$. The exact parametric form of the dependency has yet to be determined. Finally, observe that we can operate in the opposite direction, and convert query-vectors $\phi_i$ into instances of a Bayesian network. Several methods exist to learn such models automatically from matrices. Nevertheless, their practical interest is limited: we have no guarantee that the generated graphical models will be complete, or interpretable. And they have no way to recover the information destroyed by the feature maps. We summarize all the methods in this paper and their relationships in Figure~\ref{pic:bayesselectfrom}. Bayesian models seem to offer the ``best of all worlds'': they are lossless, reversible, and they can yield vector spaces. For this reason, we chose to place them on top of our agenda. But we should not underestimate their competitors. Even dummy coding may come in handy, in conjunction with advanced compression algorithms such as autoencoders. Now, our task is to implement these ideas and conduct extensive benchmarks. Eventually, only practice and experiments will reveal which of these solutions truly fulfills our vision. \section{Related Work} \label{sec:RelatedWork} Several authors have developed methods to infer know\-ledge from the query log, either to improve the performance of the database or to help users write queries. \textbf{Application-Specific Methods.} On the performance side, Ghosh et al.~\cite{ghosh2002plan} associate each query from the log with a vector of predefined scores (e.g., number of tables mentioned, number of joins, presence of index) to recommend query plans. Aouiche and Darmont~\cite{aouiche2009data} mine the co\-lumn names mentioned in the log to chose materialized views and indices. The optimizer LEO~\cite{stillger2001leo} monitors the execution of queries to predict cardinalities. On the user side, Agrawal et al.~\cite{agrawal2006context} have presented a method to recommend individual tuples. Yang et al.~\cite{yang2009recommending} mine the log for join predicates. SnipSuggest~\cite{khoussainova2010snipsuggest} suggests context-sensitive snippets. Zhang has developed an interface to explore the Sloan Digital Sky Survey database~\cite{zhang2011data}. Giacometti et al.~\cite{giacometti2009query} present a method to detect unexpected patterns. Finally, Yao et al.~\cite{yao2005finding} exploit cluster analysis to detect so-called query sessions. Each of these papers use a different, task-specific enco\-ding. Our ambition is to develop one framework to encompass all those cases. \textbf{Neighborhood-Based Methods.} We discuss these me\-thods in detail in our introduction. We generalize them with DBFMs, in Section~\ref{sec:explicit}. \textbf{Hierarchical Modelling of Queries.} In Section~\ref{sec:generative}, we present generative approaches. In fact, the early system PROMISE~\cite{sapia2000promise}, based on Markov Models, is remarkably close to our vision. However, it targets very specific OLAP workloads. SnipSuggest also represents the queries with a tree~\cite{khoussainova2010snipsuggest}, but the leaves represent fragments of plain text. Finally, the Oracle Workload Intelligence also uses a Bayesian model~\cite{tran2015oracle}, but it operates at the user session level: each node represents a complete query. \textbf{Log Analysis in Information Retrieval.} Authors have developed many methods to mine search engine query logs~\cite{silvestri2010mining}. In principle, we could use those, exploiting natural language models such as $n$-grams or tf-idf. But these me\-thods incur a major loss of information. First, they neglect the grammar of SQL. This is wasteful, because the language is simple, highly structured, and well-known. Second, they neglect the set relationships between the queries, such as inc\-lusion, overlap or order. Those are crucial for many of the applications we target. \section{Conclusion} \label{sec:conclusion} Too many methods to mine SQL query logs are isolated. They are isolated from each other: each paper uses its own conventions and its own algorithms. They are also isolated from the rest of machine learning research: they only exploit a narrow subset of its literature. In this paper, we presented three research directions to unify and broaden the scope of DBMS log mining. We purposely stepped out of specific applications, and presented frameworks to apply general statistical inference on SQL queries. We now envision two lines of research. First, we will implement all the methods discussed in this paper, compare them, and understand which one performs best and why. Once we have solid tools to encode SQL queries, we will experiment with new machine learning algorithms. Given the recent advances in this field, with e.g. deep learning, we are convinced that this agenda holds a bright future. \section{Introduction} \label{sec:intro} The query log of a SQL database gives us precious hints about what its users are interested in. From this dataset, we can infer query auto-completions~\cite{akbarnejad2010sql, khoussainova2010snipsuggest, sarawagi1998discovery}. We can simulate realistic queries, for testing purposes~\cite{tran2015oracle}. We can even reduce the latency of the queries, thanks to speculative execution~\cite{sapia2000promise}. Furthermore, the log describes the database itself: it describes which queries succeeded or failed, how long they took, and how many tuples they returned. Combined with predictive algorithms, this information could help us emit warnings, chose efficient query plans and build more robust engines. Yet, mining query logs is subject to a fundamental problem: SQL queries do not live in a vector space. In their na\-tural form, queries are structured, symbolic objects - not vectors of real numbers. Hence, the vast majority of statistical concepts are undefined. Elementary methods such as means, correlations or regression do not apply. The same problem arises with advanced methods such as neural networks or SVMs. Consequently, most authors resort to \emph{appli\-ca\-tion-specific frameworks}~\cite{agrawal2006context, ghosh2002plan, giacometti2009query, yang2009recommending, yao2005finding, zhang2011data}: they devise some encoding specifically for the problem at hand, and feed it to a custom algorithm. This approach is neither practical nor efficient, because each use case requires a complete new representation system and a new algorithm. A few authors have developed more general, application-independent solutions: \emph{neighborhood-based algorithms}~\cite{akbarnejad2010sql, aligon2014similarity, chatzopoulou2009query, Nguyen2015Ident}. These algorithms are popular because they require no encoding. Instead, they rely on a \emph{pairwise dissimilarity function}, which quantifies the similarity or difference between two queries. Once the authors have defined such a function, they apply it to all the pairs of queries in the log. They obtain a neighborhood graph, in which they detect discrete patterns. But these methods are limited: we observed that few papers, if any, venture beyond the strict realm of clustering and $k$ Nearest Neighbors (kNN). One explanation is that statistical textbooks and software provide little support for other tasks. To illustrate, the official R Website does not even mention NN-regression on its machine \mbox{learning} page (cf. footnote). Besides, these approaches suffer from quali\-tative drawbacks. They cannot interpolate between training examples, e.g., to compute centroids. They have little to no notion of prediction confidence. Finally, they are very sensitive to small training sets, local sparsity, and class imbalance. Several empirical studies reveal cases where they are under-optimal~\cite{desrosiers2011comprehensive, koren2008factorization}. Our ambition is to unlock the rest of the statistical toolbox. We want to perform kNN and clustering, but also density estimation, sampling, regression, classification, dimen\-sionality reduction, reinforcement learning and visualization, directly over SQL queries. To do so, we develop me\-thods to encode the query log in such a way that it becomes subject to these tasks. We envision software ``converters'', to process query logs in R, Weka or Matlab as if they were classic tables of numbers. Thus, database designers will be\-nefit from the rich libraries offered by these platforms. They will be able to focus on insights and functionalities rather than implementation. \pagebreak In this paper, we describe promising methods to represent query logs in an application-independent fashion. We present three families of encodings: \begin{itemize} \item \emph{Feature maps} directly transform queries into vectors. \item \emph{Kernel methods} manipulate queries as if they were vectors, but without actually transforming them. \item \emph{Bayesian methods} rely on probabilistic graphical mo\-dels rather than vector spaces. \end{itemize} We highlight the advantages and drawbacks of each solution, and present mathe\-matical transformations to switch from one representation to the other. For all three families, we make the case for longer term investigations. The rest of the paper is organized as follows. In Section~\ref{sec:motivation}, we motivate our work and we present our requirements. In Sections~\ref{sec:explicit}, \ref{sec:kernel} and \ref{sec:generative}, we introduce our solutions. We highlight their relationships in Section~\ref{sec:bridge}. We discuss related work in Section~\ref{sec:RelatedWork}, and conclude in Section~\ref{sec:conclusion}. \section{Overview} \label{sec:motivation} We established that queries do not live in a vector space. But what if we could devise a function $\Phi$ to transform SQL statements into vectors? In this section, we present the immense range of practical applications which would follow. We then discuss how realistic this vision is. \subsection{Visions for Query Log Mining} \label{sec:visions} \begin{figure}[!t] \centering \includegraphics[width=\columnwidth]{Images/Mapping.pdf} \caption{Example of feature map $\Phi$.} \label{pic:featuremap} \end{figure} \textbf{From Queries to Vectors.} Suppose that we could access a function $\Phi$, to map any SQL query $Q \in \mathbb{Q}_{SQL}$ to a vector $\phi \in \mathbb{R}^D$. We illustrate it in Figure~\ref{pic:featuremap}. To be consistent with the machine learning literature, we name it \emph{feature map}~\cite{bishop2006pattern}, and we suppose that it is one-to-one. How could this function be useful? \begin{figure}[!t] \centering \includegraphics[width=.9\columnwidth]{Images/DensityEstimation} \caption{Heatmap of the log's density. The dashed rectangle represents the recommendation window, defined by the user's input.} \label{pic:hotzones} \end{figure} First, we could perform \emph{density estimation}: for each query $Q$, we could estimate the probability function $p(\Phi(Q))$, as illustrated in Figure~\ref{pic:hotzones}. The density function is a powerful tool, because it lets us perform many classic tasks from the log mining literature. For instance, we could detect ``hot zones'' in the query log (i.e. clusters). We could also re\-commend queries: when users start typing SQL statements, they implicitly define a window of interest, as shown in Figure~\ref{pic:hotzones}. To help them, we could highlight the most popular queries in this window. More importantly, a function $\Phi$ would allow us to perform \emph{regression} and \emph{classification}. In regression, we infer quantities from SQL statements, based on past observations. Thanks to this method, we could estimate the runtime of a query, the cardinality of its output, or or the number of machines involved in a cluster. In classification, we predict a discrete variable. Thus, we could detect which user is currently querying the database, and pre-fetch some data accordingly. We could also emit warnings, if the user's query is dangerously close to one that failed previously. Finally, we could machine-learn tasks which were previously coded by hand: among others, we could train a neural network to associate SQL queries with visualizations. To conclude, the combination of the function $\Phi$ and statistical algorithms would lead to dozens of applications. A few of them have been proposed in the literature before (those related to density estimation), others are new. In any case, they would all run on top of a unified, complete formalism. \textbf{From Vectors to Queries.} We now go one step further: what if we had access to an \emph{inverse feature map} $\Phi^{-1}$ to reconstitute queries from vectors? The function $\Phi^{-1}$ would have a dramatic effect: it would let us create new queries from scratch. Observe the density function pictured in Figure~\ref{pic:hotzones}. By \emph{sampling} from this distribution, we could produce queries that have never been written before, but which are likely to occur. Thus, we could generate artificial, but realistic workloads. This technique could be useful for testing and exploration. Combined with adaptive indexing mechanisms such as database cracking~\cite{halim2012stochastic}, it could also help us build more efficient indices. \begin{figure}[!t] \centering \includegraphics[width=0.95\columnwidth]{Images/Extrapolation} \caption{Example of querying pattern based on time.} \label{pic:timeseries} \end{figure} Another application of this idea is \emph{query regression}: we could extrapolate SQL queries from other SQL queries. Consequently, we could detect usage patterns, and exploit those to predict which query will come next, using time series models. Figure~\ref{pic:timeseries} provides an example. This scenario is fictive, and we suspect that real workloads are more chaotic in practice. But we do not need to predict precise queries. Predicting general areas of interest would already be helpful, and probabilistic methods excel at that. Finally, more applications could come from \emph{active learning}. In particular, we envision adaptive DBMS benchmarks. Such systems would pose queries, observe how the database reacts and adapt their behavior accordingly. Thus, they would automatically identify performance bottlenecks, and report them to DBMS designers. \subsection{How Far Are We?} \label{sec:discussion} In fact, constructing a function to map queries to vectors is not a difficult task. For example, we could count $n$-grams, as in information retrieval. The whole challenge is to build an application-independent transformation. Such a transformation should be \emph{lossless}, that is, non destructive. The vector representation of a query should convey all the information contained in its SQL form. It should contain lexical and grammatical information: which keywords are used, and what are their roles. But it should also convey the \emph{set relationships} between the queries. By nature, queries represent sets of tuples, which can be disjoint, overlapping, or nested. With continuous variables, they can even be ordered. These properties should be preserved in the encoding. The actual feature selection, which depends on the use case, should be left to the user. Unfortunately, we suspect that if such a mapping $\Phi$ exists, then the vector space it yields will have a huge, unpractical dimensionality. We discuss this point further in Section~\ref{sec:explicit}. In the rest of this paper, we present several restricted versions of the function $\Phi$. Two of these methods are lossless: dummy coding and Bayesian modeling. However, their scope is limited: we have not yet found any practical way to process all the possible queries from SQL. The remaining approaches are more flexible, but they are lossy. The users must specify the properties of interest in advance. For instance, they may focus on the syntactical structure of the queries, or their extent. The encoding will reflect these attributes, and destroy the remaining information. Consequently, two distinct queries can have the same encoding, and the inverse mapping $\Phi^{-1}$ is undefined. \section{Feature Maps} \label{sec:explicit} We now present two methods to build feature maps, \emph{dummy coding} and \emph{dissimilarity-based feature maps} (DBFMs). \subsection{Dummy Coding} \label{sec:dummy} \begin{figure}[!t] \centering \includegraphics[width=\columnwidth]{Images/Dummy} \caption{Example of dummy coding.} \label{pic:dummy} \end{figure} \textbf{Method.} The idea behind dummy coding is to represent queries with vectors of binary variables, where each component represents a degree of freedom offered by SQL. For example, a variable could signal the presence or absence of a certain table in the \texttt{WHERE} clause, or an aggregation in the \texttt{SELECT} section. Additionally, we include continuous columns to deal with numeric selection predicates. Figure~\ref{pic:dummy} illustrates this method with a fictive example. In fact, dummy coding has a fundamental flaw: to support all of SQL, it requires vectors of infinite length. In consequence, we must limit its scope. One option is to represent only the queries in the log, as we did in Figure~\ref{pic:dummy}. An other is to specify a subset of SQL a priori. For example, we can restrict the encoding to Select-Project-Join queries with a limited number of components. Additionally, we can compress the resulting vectors with dimensionality reduction methods, such as factor analysis or autoencoders~\cite{bishop2006pattern}. \textbf{Discussion.} Dummy coding is the naive approach. It is straightforward and lossless. It produces flat tables, which effectively make it possible to mine query logs with mainstream statistical tools. But we foresee that it will return huge, sparse vector spaces with complex queries. The subsequent vectors will be costly to store, to process, and statistical methods will be prey to overfitting (as per the curse of dimensionality~\cite{bishop2006pattern}). Dimensionality reduction algorithms can help, but they are lossy, expensive, and they require careful tuning. Besides, binary variables are not real numbers, thus not all statistical methods can cope with them (for example, k-means is excluded). For all these reasons, we need alternative encoding schemes. \subsection{Dissimilarity-Based Mapping} \label{sec:dbfm} We now present dissimilari\-ty-based feature maps (DBFMs), which generalize of existing work on query log mining. \textbf{Method.} To build a DBFM, we operate in three steps. First, we chose one or several pairwise dissimilarity measures from the literature. Second, we embed them into an enco\-ding function. Thanks to this function, we can represent the log with a large matrix. In the last step, we compress it. Defining the dissimilarity between two queries is subject to all the problems presented in Section~\ref{sec:discussion}. Currently, we know no perfect measure of dissimilarity. However, several authors have already proposed specific functions, in the context of neighborhood-based approaches. Chatzopoulou et al.~\cite{chatzopoulou2009query} have reported a measure based on query results: two queries are similar if they involve the same tuples. Akbarnejad et al.~\cite{akbarnejad2010sql} have used fragments of text. More recently, Nguyen et al.~\cite{Nguyen2015Ident} have developed a method to exploit the results of queries without running them. In a recent paper, Aligon et al. review 14 of these functions~\cite{aligon2014similarity}. Collectively, those cover a wide range of use cases. Our idea is to embed them in an encoding $\Phi$. For a given dissimilarity measure, the square matrix $\ensuremath{\mathbf}{D}$ represents the \emph{dissimilarity matrix} of the query log. This matrix contains the pairwise dissimilarities between all the couples $(Q_i, Q_j)$ in the log, as follows: \begin{equation} \ensuremath{\mathbf}{D} \equiv \begin{bmatrix} d(Q_1, Q_1) & d(Q_1, Q_2) & \ldots & d(Q_1, Q_N)\\ d(Q_2, Q_1) & \ddots & &\vdots \\ \vdots & & \ddots&\vdots \\ d(Q_N, Q_1)& \ldots & \ldots &d(Q_N, Q_N)\\ \end{bmatrix} \end{equation} It turns out that we can derive a trivial feature map from this representation: we map each query $Q_i$ to the vector $\phi_i = [d(Q_i, Q_1), \ldots, d(Q_i, Q_N)]^\top$. In other words, we associate each query to its corresponding line in $\ensuremath{\mathbf}{D}$. Hence, DBFMs represent queries by their difference with regards to the other queries in the log. The resulting space is called \emph{dissimilarity space}, and its theoretical properties were described by Pekalska and Duin~\cite{duin2012dissimilarity}. Observe that this method lets us combine several dissimilarity measures: we simply concatenate the resulting dissimilarity matrices. To deal with the dimensions of the result, we apply dimensionality reduction. Specifically, we can use PCA, or we can cluster the columns and pick a few representative dimensions. \textbf{Discussion.} The advantage of the DBFM method is its flexibility. In comparison with dummy coding, DBFMs can deal with complex queries. Also, they generate continuous variables, which involves a broader class of algorithms. However, these functions are lossy: the user must specify the properties of interest. Also, the compression step is costly and it requires tuning, as discussed in Section~\ref{sec:dummy}. Finally, DBFMs are by definition sensitive to the queries in the log. If those are similar to each other, then the columns of the dissimilarity matrix $\ensuremath{\mathbf}{D}$ will be highly correlated. Therefore this matrix will contain little information. The physical dimensionality of the dissimilarity space will be high, but its intrinsic dimensionality will be low. In conclusion, DBFMs appear as viable substitutes for dummy coding in cases where the log is small and the queries diverse. But we need more general methods for larger and sparser data sets. \textbf{Multidimensional Scaling.} An alternative approach is Multidimensional Scaling~\cite{borg2005modern}. This method takes the dissimilarity matrix $\ensuremath{\mathbf}{D}$ as input, and generates a vector space in which the pairwise distances between the objects are preserved. Multidimensional scaling is relevant, but it suffers from the exact same problems as DBFMs: it is costly, it requires tuning and it depends crucially on the queries in the log. \section{Kernel Functions} \label{sec:kernel} In the previous section, we presented two general classes of feature maps. We now discuss \emph{implicit} alternatives: kernel approaches. \subsection{Introducing Kernel Functions} \label{sec:introkernel} The aim of this section is to communicate the intuition behind kernels. We refer the reader to Bishop~\cite{bishop2006pattern} for a more rigorous introduction. In this paper, we mention a number of statistical methods applicable to vectors, such as regression, classification and clustering. In fact, we do not need all of algebra to perform them. We need only one fundamental operation: \emph{the dot-product}. If we can compute the dot-product $\phi_i \cdot \phi_j$ between two vectors $\phi_i$ and $\phi_j$, then we can run linear regression, Support Vector Machines, K-means, PCA and many others. The process of rewriting a statistical method in terms of dot-products is known as \emph{kernelization}~\cite{bishop2006pattern}. At this point, computing the dot-product $\phi_i \cdot \phi_j$ is problematic because we need to compute the vectors $\phi_i = \Phi(Q_i)$ and $\phi_i = \Phi(Q_j)$. To do so, we need the mapping function~$\Phi$. Kernel functions let us bypass this operation. A kernel function $K(Q_i, Q_j)$ is analog to a dissimilarity measure: it has a low value if $Q_i$ and $Q_j$ are similar, and it has a high value otherwise. But kernels have a convenient mathematical property: for every such function $K$, there exists a feature map $\Phi$ such that: \begin{equation} K(Q_i, Q_j) = \Phi(Q_i) \cdot \Phi(Q_j) \end{equation} In plain words, computing the similarity between two queries according to $K$ is equivalent to mapping them to some feature space and applying the dot-product. Therefore, each kernel defines an \emph{implicit} feature map. This property is powerful: we can manipulate SQL queries as if they lived in a vector space, but without actually materializing the space. In essence, kernel methods offer a middle way between neighborhood-based approaches and feature mapping. \subsection{Kernels for the Query Log} \label{sec:syntax} In the past, authors have successfully built kernel functions for complex objects, such as texts, DNA strings, \mbox{images} or even videos~\cite{gartner2003survey}. Our task is now to design a kernel function for SQL queries. \textbf{Dissimilarity-Based Kernels.} Not all dissimilarity measures are kernel functions. To qualify, a measure must obey \emph{Mercer's conditions}~\cite{bishop2006pattern}. Those imply that the eigenvalues of the dissimilarity matrix are positive. We know no function that guarantees these conditions. However, authors have presented methods to turn arbitrary dissimilarity measures into kernels, such as \emph{spectral shifting} or \emph{spectral clipping}~\cite{chen2009learning,wu2005analysis}. These methods compute the spectrum of the dissimilarity matrix, and correct the eigenvalues to meet Mercer's conditions. In effect, they let us reuse the dissimilarity measures from the literature, similarly to DBFMs. But they are costly, i.e., cubic with the number of items. Also, it is not clear how to maintain their results as new queries come in. \textbf{Custom Kernels.} An alternative approach is to engineer new kernels from scratch. Authors have developed such functions for graphs, sets, and even logic programs~\cite{gartner2003survey}. We could extend those to SQL queries. To tackle different use cases, we could generate several kernels. For example, we envision a function to describe the syntax of the queries, and another to describe their set properties. We could easily aggregate them, because the weighted sum of two kernels is itself a kernel. But we could also attempt to design a lossless solution. Indeed, kernels can encode infinite dimension spaces. The Gaussian dissimilarity is a popular illustration of this property~\cite{bishop2006pattern}. Therefore, we do not exclude the existence of a ``perfect'' kernel function for SQL queries. \textbf{Discussion.} Compared to feature maps, kernel methods have many advantages. They are possibly more space efficient, because they do not materialize the vectors. The underlying encoding $\Phi$ is robust: it does not involve arbitrary restrictions, and it is independent from the other queries in the log. Lastly, kernels bypass the costly compression operations of feature maps: the whole space is embedded in the dissimilarity function. Nevertheless, our quest for a transformation $\Phi$ does not stop here. Even if we had access to a perfect kernel, it is likely that its implicit feature space would remain theoretical: we would know that the inverse feature map $\Phi^{-1}$ exists, but we could not access it. Also, not all statistical methods were kernelized, hence kernel approaches are less general than explicit methods. Finally, their accuracy for SQL log mining remains to be studied. In particular, we must evaluate their sensitivity to the curse of dimensionality. \section{Graphical Models} \label{sec:generative} \begin{figure}[!t] \centering \includegraphics[width=\columnwidth]{Images/Bayesian} \caption{Simple Bayesian model to describe the distribution of \texttt{SELECT-FROM} queries, in a database made of three tables with two columns each. The full circles represent constants, the empty circles represent random variables.} \label{pic:bayesselectfrom} \end{figure} So far, we have only considered methods related to vector spaces. But there exists an alternative conceptual framework for which many statistical methods were developed: \emph{probabilistic graphical models}, also called \emph{Bayesian networks}. \textbf{Presentation.} The aim of graphical models is to decompose complex probability distributions into elementary, low-dimension components. Let us introduce an example. We wish to describe the distribution of all the \texttt{SELECT-FROM} queries from the log of a DBMS. In other words, we want to estimate the function $p_{SF}: \mathbb{Q}_{\texttt{SELECT-FROM}} \to [0,1]$, which maps each query to its probability. Finding a closed mathematical form for this function is difficult: it involves complex operations, many parameters, and the number of these parameters is variable. Bayesian networks give us a mean to express $p_{SF}$ in a graphical way. Figure~\ref{pic:bayesselectfrom} displays an example of model. This graph can be understood as an algorithm to generate new queries. We read it as follows: \begin{itemize} \item Set the constant vectors $\Pi_\text{Tables}$, $\Pi_{\text{Columns}, 1}$, $\Pi_{\text{Columns}, 2}$, and $\Pi_{\text{Columns}, 3}$. The vector $\Pi_\text{Tables}$ describes the probability of occurrence of all the tables. The vectors $\Pi_{\text{Columns}, t}$ describes the probability of occurrence of the columns in each table $t$. \item Chose $T$ random tables $\{\text{From}_1, \ldots, \text{From}_T\}$, picking them randomly with probabilities $\Pi_\text{Tables}$ \item For each table $t \in \{\text{From}_1, \ldots, \text{From}_T\}$, chose $N_{t}$ random columns $\{\text{Select}_{t,1}, \ldots, \text{Select}_{t,N_t}\}$, picking randomly with probabilities $\Pi_{\text{Columns}, t}$. \end{itemize} Thus, the network describes a method to sample from the distribution $p_{SF}$. In fact, it also gives us a tractable way to compute the probability $p_{SF}(Q)$ for any given query $Q$. Here again, we refer readers to Bishop~\cite{bishop2006pattern} for more details. \begin{figure}[!t] \centering \includegraphics[width=\columnwidth]{Images/BayesianClustering} \caption{Extension of the \texttt{SELECT-FROM} model to support clusters. The latent variable $Class$ influences the distribution of the parameters $\Pi_\text{Tables}$, $\Pi_{\text{Columns}, 1}$, $\Pi_{\text{Columns}, 2}$, and $\Pi_{\text{Columns}, 3}$, which themselves influence the query, as illustrated in Figure~\ref{pic:bayesselectfrom}. The distribution of the variables $\Pi_{\text{Columns}, t}$ have form as that of $\Pi_\text{Tables}$, for $t \in\{1,2,3\}$.} \label{pic:bayesclustering} \end{figure} \textbf{Extensions.} With graphical models, we can compute complex probability functions and generate samples. Accordingly, if we had a complete model for SQL queries, we could detect ``typical'' or ``outlying'' queries, and we could generate realistic SQL statements. But we could also extend the model to cover more complex tasks. In the machine learning literature, authors have described dozens of statistical methods with Bayesian networks, including all those that interest us~\cite{bishop2006pattern}. We could exploit them, by ``plugging in'' our own SQL network. As an illustration, we present an elementary clustering model in Figure~\ref{pic:bayesclustering}. To build this model, we plugged our \texttt{SELECT-FROM} model into a mixture of distributions. In Section~\ref{sec:bridge}, we will introduce more general methods, to support all types of machine learning algorithms. \textbf{Discussion.} Aside from dummy coding, Bayesian modeling is the only method which provides both the mapping $\Phi$ and its inverse $\Phi^{-1}$. To obtain the image $\Phi(Q)$ of a given query $Q$, we instantiate the variables in the network. To obtain its inverse $\Phi^{-1}(Q)$, we execute the generative process. Additionally, graphical models are more flexible than vectors. For instance, they support variable numbers of parameters and recursivity. Besides, they are interpretable, and they have convenient statistical properties: among \mbox{others}, Bayesian methods natively incorporate regularization and adaptivity (cf. empirical Bayes~\cite{bishop2006pattern}). Yet, producing a complete Bayesian network for SQL que\-ries remains a challenge. Also, adapting its parameters to the log may involve costly computation methods, such as Monte-Carlo simulations. Finally, as with feature maps and kernel functions, the empirical performance of this method remains to be studied. At this point, we do not know how accurate it is for log mining. \section{Bridging Graphical Models and Vector Spaces} \label{sec:bridge} \begin{figure}[!t] \centering \includegraphics[width=\columnwidth]{Images/Roadmap} \caption{Summary of the methods discussed in this paper.} \label{pic:bayesselectfrom} \end{figure} To close our presentation, we highlight a powerful feature of probabilistic graphical models: they can yield vector spaces, both implicitly and explicitly. For a start we can embed graphical models into kernel functions. We know at least two methods to do so, \emph{probabi\-li\-ty product kernels} and \emph{Fisher kernels}~\cite{bishop2006pattern}. Thanks to these solutions, we can benefit from both the generative features of graphical models and the libraries of kernel methods. Furthermore, we conjecture that we can generate vectors directly from graphical models. In Figure~\ref{pic:bayesclustering}, we show an example of latent variable model, where the discrete variable $Cluster$ influences the distribution of the query's components. We could generalize this model to \emph{continuous latent variables}. In this case, a fixed-size random vector would condition the distribution of the parameters $\Pi_\text{Tables}$ and $\Pi_{\text{Columns}, t}$. The exact parametric form of the dependency has yet to be determined. Finally, observe that we can operate in the opposite direction, and convert query-vectors $\phi_i$ into instances of a Bayesian network. Several methods exist to learn such models automatically from matrices. Nevertheless, their practical interest is limited: we have no guarantee that the generated graphical models will be complete, or interpretable. And they have no way to recover the information destroyed by the feature maps. We summarize all the methods in this paper and their relationships in Figure~\ref{pic:bayesselectfrom}. Bayesian models seem to offer the ``best of all worlds'': they are lossless, reversible, and they can yield vector spaces. For this reason, we chose to place them on top of our agenda. But we should not underestimate their competitors. Even dummy coding may come in handy, in conjunction with advanced compression algorithms such as autoencoders. Now, our task is to implement these ideas and conduct extensive benchmarks. Eventually, only practice and experiments will reveal which of these solutions truly fulfills our vision. \section{Related Work} \label{sec:RelatedWork} Several authors have developed methods to infer know\-ledge from the query log, either to improve the performance of the database or to help users write queries. \textbf{Application-Specific Methods.} On the performance side, Ghosh et al.~\cite{ghosh2002plan} associate each query from the log with a vector of predefined scores (e.g., number of tables mentioned, number of joins, presence of index) to recommend query plans. Aouiche and Darmont~\cite{aouiche2009data} mine the co\-lumn names mentioned in the log to chose materialized views and indices. The optimizer LEO~\cite{stillger2001leo} monitors the execution of queries to predict cardinalities. On the user side, Agrawal et al.~\cite{agrawal2006context} have presented a method to recommend individual tuples. Yang et al.~\cite{yang2009recommending} mine the log for join predicates. SnipSuggest~\cite{khoussainova2010snipsuggest} suggests context-sensitive snippets. Zhang has developed an interface to explore the Sloan Digital Sky Survey database~\cite{zhang2011data}. Giacometti et al.~\cite{giacometti2009query} present a method to detect unexpected patterns. Finally, Yao et al.~\cite{yao2005finding} exploit cluster analysis to detect so-called query sessions. Each of these papers use a different, task-specific enco\-ding. Our ambition is to develop one framework to encompass all those cases. \textbf{Neighborhood-Based Methods.} We discuss these me\-thods in detail in our introduction. We generalize them with DBFMs, in Section~\ref{sec:explicit}. \textbf{Hierarchical Modelling of Queries.} In Section~\ref{sec:generative}, we present generative approaches. In fact, the early system PROMISE~\cite{sapia2000promise}, based on Markov Models, is remarkably close to our vision. However, it targets very specific OLAP workloads. SnipSuggest also represents the queries with a tree~\cite{khoussainova2010snipsuggest}, but the leaves represent fragments of plain text. Finally, the Oracle Workload Intelligence also uses a Bayesian model~\cite{tran2015oracle}, but it operates at the user session level: each node represents a complete query. \textbf{Log Analysis in Information Retrieval.} Authors have developed many methods to mine search engine query logs~\cite{silvestri2010mining}. In principle, we could use those, exploiting natural language models such as $n$-grams or tf-idf. But these me\-thods incur a major loss of information. First, they neglect the grammar of SQL. This is wasteful, because the language is simple, highly structured, and well-known. Second, they neglect the set relationships between the queries, such as inc\-lusion, overlap or order. Those are crucial for many of the applications we target. \section{Conclusion} \label{sec:conclusion} Too many methods to mine SQL query logs are isolated. They are isolated from each other: each paper uses its own conventions and its own algorithms. They are also isolated from the rest of machine learning research: they only exploit a narrow subset of its literature. In this paper, we presented three research directions to unify and broaden the scope of DBMS log mining. We purposely stepped out of specific applications, and presented frameworks to apply general statistical inference on SQL queries. We now envision two lines of research. First, we will implement all the methods discussed in this paper, compare them, and understand which one performs best and why. Once we have solid tools to encode SQL queries, we will experiment with new machine learning algorithms. Given the recent advances in this field, with e.g. deep learning, we are convinced that this agenda holds a bright future. \section{Acknowledgments} This work was supported by the Dutch national program \\COMMIT. \balance \bibliographystyle{abbrv} \balance
{'timestamp': '2017-03-28T02:05:11', 'yymm': '1703', 'arxiv_id': '1703.08732', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08732'}
arxiv
\section{Introduction} The transition from the legacy power distribution network to the new power grid paradigm, the so-called \emph{smart grid} (SG), is rapidly ongoing. An SG provides many advantages for energy generation, transmission, distribution and consumption thanks to the use of information and communication technologies that enable SGs to monitor and control the power network more effectively \cite{Mo:2012}. In addition, an SG eases the integration of renewable energy sources (RESs), which is a fundamental factor in reducing our dependence on fossil fuels and moving on to a low carbon economy. A key feature of an SG is the advanced metering infrastructure, and in particular smart meters (SMs), which record and report the electricity consumption of a household. SMs that are currently being rolled out in the United Kingdom send measurements every $30$ minutes \cite{smartEnergyGB}, whereas those in Texas send every $15$ minutes \cite{SMT}. The frequency of SM measurements is expected to increase drastically in the near future when renewable energy integration increases and the energy market becomes more efficient by incorporating time-of-usage pricing and demand shifting \cite{Segovia:2011}. The installation of SMs is rapidly advancing worldwide. For example, all European Union countries are required to have 80\% SM adoption by 2020 and 100\% by 2022 \cite{EurDir:2009}. On the other hand, the information that is collected by SMs may be potentially used for other purposes, thereby raising the question of data privacy. By using nonintrusive appliance load monitoring (NILM) techniques, power consumption load profiles can reveal sensitive information, such as the users' habits, presence at home and working hours, potential illnesses or disabilities, equipment being used, and even which TV channel is being watched \cite{Rouf:2012}. First NILM devices were built in the 80s and were already able to detect the activity of some appliances by knowing their power signature \cite{Hart:1992}. Molina-Markham \textit{et al.} \cite{Molina:2010} showed that it is possible to detect users' activity by simply using off-the-shelf clustering and pattern recognition methods, even without any a priori knowledge of the appliances' power signature. The current state of the art is to consider a factorial hidden Markov model to model the total consumption of various household appliances, whose solution is, however, NP hard. To solve this issue, \cite{Shaloudegi:2016} describes a computationally efficient method based on a semidefinite relaxation combined with randomized rounding. \subsection{Privacy-Aware SM Techniques} To date, there are two main families of approaches that have been investigated to provide privacy to consumers. The first family includes approaches that process SM data before sending it to the UP, while approaches in the second family aim at modifying the actual user energy demand. Considered within the first family are methods such as \emph{data obfuscation}, \emph{data aggregation} and \emph{data anonymization}. Data obfuscation, i.e., the perturbation of metering data by adding noise, is a classic method, and has been adapted to SGs in \cite{Kim:2011} and \cite{Bohli:2010}. Among these methods, differential privacy \cite{Dwork:2006}, a well-established concept in the data mining literature based on distorting data to protect the privacy of individuals, is applied to SMs in \cite{Backes:2014}. Along these lines, authors in \cite{Sankar:2013TSG} provide a framework that measures the trade-off between altering data (privacy) and sharing them (utility). Data aggregation, proposed in \cite{Bohli:2010}, \cite{Garcia:2010} and \cite{Li:2011}, considers aggregating power measurements over a group of households so that the UP is prevented from knowing individual consumptions. The aggregation can be performed with or without the help of a trusted third party. Data anonymization mainly considers resorting to pseudonyms rather than the real identities, as in \cite{Petrlic:2010} and \cite{Efthymiou:2010SGC}. The first family of approaches, however, suffer from a further privacy risk. In fact, the energy consumed by a user is provided directly from the grid, which is fully controlled by the distribution system operator (DSO), i.e., the entity that manages the power grid; and hence, the DSO can embed additional sensors to monitor the energy requested by a household or a business, without fully relying on SM readings. Moreover, any attacker, e.g., a thief or an intelligence agency, may decide to install a sensor for directly monitoring a specific household or business. Another disadvantage of data obfuscation methods is the mismatch between the reported values and the real energy consumption. This prevents the DSO from accurately monitoring the grid states and rapidly reacting to outages, energy theft or other problems. To address these problems, the second family of privacy-preserving approaches directly modifies the actual energy consumption profile of the user, called the \textit{input load} rather than simply modifying the data sent to the UP. This can be done, for example, by filtering the energy via an energy storage device, i.e., a rechargeable battery (RB), as in \cite{Kalogridis:2010SGC,Kalogridis:2011,Yang:2012,Varodayan:2011,Tan:2013JSAC,Tan:2017JIFS,Li:2016Arxiv}, or by using an RES, as originally proposed in \cite{Tan:2013JSAC}. If we denote the energy received from the grid as the \textit{output load}, the idea is to physically differentiate the output load with respect to the input load. Different heuristic algorithms have been proposed, such as the best-effort water-filling algorithm in \cite{Kalogridis:2011} that aims at keeping the output load at its most recent value, or the stepping algorithm in \cite{Yang:2012} that quantizes the power demand into a step function. In \cite{Tan:2017JIFS} the problem is solved in the offline setting by taking the energy cost into account, while the online privacy problem is formulated as a Markov decision process in \cite{Li:2016Arxiv}, and solved numerically in general, while a ``single-letter'' expression is provided for an independent and identically distributed (i.i.d.) input load. In \cite{Farokhi:2017TSM} Fisher information is used as a measure of privacy and, by using the Cram\'{e}r-Rao bound, the variance of the estimation error of any unbiased estimator of the household consumption is maximized by minimizing the trace of the Fisher information matrix. When considering also the presence of an RES, a single-letter solution is given for this problem in \cite{Gunduz:2013ICC,Gomez:2013ISIT,Gomez:2015TIFS} under average and peak power constraints on the available RES. In \cite{Chin:2016TSG} model predictive control is adopted to jointly optimize cost and and privacy in the presence of a battery and local energy generation. In this paper, we adopt the latter approach, and focus on providing privacy by considering the presence of both an RES and an RB. We study privacy from an information theoretic point of view, and, for some scenarios, provide closed-form expressions for the best privacy performance achievable. A similar model, studied in \cite{Gomez:2015TIFS}, imposes only average and peak power constraints on the RES, which can be a microgrid, capable of providing any amount of energy at each time instant. However, the energy produced by an RES at each time instant is typically random, and its statistics depend on the energy source (e.g., solar, wind) and the energy generator specifications. In addition, the finite-capacity battery imposes further limitations on the available energy. Thus, in this paper we study the minimum amount of user's energy consumption information leaked to the UP by taking into account instantaneous power constraints, as initially proposed in \cite{Giaconi:2015}. While the analysis in \cite{Giaconi:2015} is limited to the two extreme scenarios of zero and infinite battery capacity with a discrete-alphabet input load, here we also study the more practical scenario with a finite-capacity storage device, as well as a continuous-alphabet input load. Following up on \cite{Varodayan:2011}, \cite{Tan:2013JSAC} and \cite{Gomez:2015TIFS}, we model user's energy consumption profile as a randomly generated time series whose statistics are known by the UP, and measure the user's information leakage by the average mutual information between the input and output load vectors, i.e., between the real energy consumption profile of the appliances and the SM readings, which is called the \textit{information leakage rate}. Mutual information between random variables $X$ and $Y$, $I(X;Y)$, is as a measure of dependence between $X$ and $Y$, which is equal to zero if and only if $X$ and $Y$ are independent. We can also interpret mutual information as the reduction in the uncertainty of the UP about the real energy consumption of the appliances, $X^n$, after receiving the SM measurements, $Y^n$. Thus, minimizing mutual information can be interpreted as a way of improving privacy for SM users. Moreover, mutual information as a privacy measure does not depend on the technological implementation of load monitoring algorithms, and therefore, provides statistical privacy guarantees independent of the computational power of the attacker or the particular monitoring algorithm employed. Mutual information as a measure of privacy leakage has also been considered in other domains, see for example \cite{Chatzikokolakis:2008, Kopf:2007, Clark:2002}. \subsection{Current Home Batteries and Typical Household Input Loads} \begin{table*}[!t] \caption{Specifications of some currently available residential batteries.} \centering \begin{tabular}{ |c|c|c|c| } \hline \textbf{Residential Battery} & \textbf{Capacity (kWh)} & \begin{tabular}[x]{@{}c@{}} \textbf{RB Charging} \\ \textbf{Peak Power (kW)} \end{tabular} & \begin{tabular}[x]{@{}c@{}} \textbf{RB Discharging} \\ \textbf{Peak Power (kW)} \end{tabular}\\ \hline Sunverge SIS-6848 \cite{Sunverge} & $7.7$, $11.6$, $15.5$, $19.4$ & $6.4$ & $6$\\ \hline SonnenBatterie eco \cite{sonnen} & $4-16$ & $3-8$ & $3-8$\\ \hline Tesla Powerwall \cite{tesla} & $13.5$ & $5$ & $5$\\ \hline LG RESU 48V \cite{LGresu} & $2.9$, $5.9$, $8.8$ & $3$, $4.2$, $5$ & $3$, $4.2$, $5$\\ \hline Panasonic Battery System LJ-SK84A \cite{panasonic} & $8$ & $2$ & $2$\\ \hline Powervault G200-LI-2/4/6KWH \cite{powervault} & $2$, $4$, $6$ & $0.8$, $1.2$ & $0.7$, $1.4$\\ \hline Orison Panel \cite{orison} & $2.2$ & $1.8$ & $1.8$\\ \hline Simpliphi PHI 3.4 - 48V \cite{simpliphi} & $3.4$ & $1.5$ & $1.5$\\ \hline \end{tabular} \label{tab:batteryCapacity} \end{table*} In this section we briefly summarize the specifications of residential batteries available in the market and the general statistics of household energy consumption and generation to illustrate the feasibility of privacy-protection through energy management. Table \ref{tab:batteryCapacity} lists the storage capacity and peak power for some of the currently available batteries for residential use. It is noteworthy that the capacities are in the range of few kWh. A typical household's average energy consumption also lies within the same range, as shown in Table \ref{tab:SManalitics}, where we report the distribution of the average user power consumption over different years obtained from various databases, with different time resolutions. From the Dataport database \cite{pecanstreet} we observe that, independently from the period considered, the average user demand is less than $2$ kWh for $80-90\%$ of the time. Current batteries charged at full capacity would then be able to satisfy the demand for a few hours only. \begin{table*}[!t] \caption{Distribution of average household power consumption (resolution refers to the measurement frequency). Values in each column indicate the percentage of time the average consumption falls into the corresponding interval.} \centering \resizebox{\textwidth}{!}{ \begin{tabular}{ |c|c|c|c|c|c|c|c|c|c|c| } \hline \textbf{Source} & \textbf{Location} & \textbf{Resolution} & \textbf{Time Frame} & \textbf{\# of Houses} & $\mathbf{[0,0.5]}$ \textbf{kW} & $\mathbf{(0.5, 1]}$ \textbf{kW} & $\mathbf{(1, 2]}$ \textbf{kW} & $\mathbf{(2,3]}$ \textbf{kW} & $\mathbf{(3, 4]}$ \textbf{kW} & $\mathbf{(4,+\infty)}$ \textbf{kW}\\ \hline \multirow{5}{*}{\cite{pecanstreet}} & \multirow{5}{*}{Texas} & \multirow{5}{*}{$60$ mins} & 01/01/2016 - 31/05/2016 & $512$ & $38$ & $30$ & $20$ & $7$ & $3$ & $2$\\ \cline{4-11} & & & 01/01/2015 - 31/12/2015 & $703$ & $36$ & $26$ & $20$ & $9$ & $5$ & $4$\\ \cline{4-11} & & & 01/01/2014 - 31/12/2014 & $720$ & $39$ & $25$ & $20$ & $8$ & $4$ & $4$\\ \cline{4-11} & & &01/01/2013 - 31/12/2013 & $419$ & $35$ & $25$ & $21$ & $9$ & $5$ & $5$\\ \cline{4-11} & & &01/01/2012 - 31/12/2012 & $182$ & $31$ & $26$ & $24$ & $10$ & $5$ & $5$\\ \hline \cite{intertek} & UK & $2$ mins & 01/05/2010 - 31/07/2011 & $251$ & $18$ & $24$ & $47$ & $11$ & $0$ & $0$\\ \hline \cite{dred} & Netherlands & $1$ sec &05/07/2015 - 05/12/2015 & $1$ & $98$ & $1.8$ & $0.4$ & $0$ & $0$ & $0$\\ \hline \cite{Lichman:2013} & France & $1$ min & 16/12/2006 - 26/11/2010 & $1$ & $47$ & $9$ & $28$ & $8$ & $4$ & $2$\\ \hline \end{tabular} } \label{tab:SManalitics} \end{table*} \begin{table*}[!t] \caption{Distribution of average power generated by residential photovoltaic systems. Values in each column indicate the percentage of time the average generation falls into the corresponding interval.} \centering \resizebox{\textwidth}{!}{ \begin{tabular}{ |c|c|c|c|c|c|c|c|c|c|c|c|c|c|c| } \hline \textbf{Source} & \textbf{Location} & \textbf{Resolution} & \textbf{Time Frame} & \textbf{\# of Houses} & $\mathbf{0}$ \textbf{kW}& $\mathbf{(0,0.5]}$ \textbf{kW} & $\mathbf{(0.5,1]}$ \textbf{kW}& $\mathbf{(1,2]}$ \textbf{kW}& $\mathbf{(2,3]}$ \textbf{kW}& $\mathbf{(3,4]}$ \textbf{kW}& $\mathbf{(4,+\infty)}$ \textbf{kW}\\ \hline \cite{pecanstreet} & Texas & $60$ min & 01/01/2012 - 31/05/2016 & $351$ & $49$ & $17$ & $7$ & $9$ & $7$ & $6$ & $5$\\ \hline \cite{microgen} & UK & $30$ min & 01/01/2015 - 31/12/2015 & $100$ & $51.7$ & $36.4$ & $9.8$ & $2$ & $0.1$ & $0$ & $0$\\ \hline \end{tabular} } \label{tab:photovoltaic} \end{table*} \begin{table*}[!t] \caption{Specifications of the solar panels studied in \cite{microgen}. The values in each column indicate the percentage of solar panels that satisfy the corresponding property.} \centering \begin{tabular}{ |c|c|c|c|c||c|c||c|c|c|c| } \hline \multicolumn{5}{|c||}{\textbf{Solar Panel Area ($m^2$)}} & \multicolumn{2}{c||}{\textbf{Solar Panel Cell Type}} & \multicolumn{4}{c|}{\textbf{Nominal Installed Capacity (kWp)}}\\ \hline $(0,15]$ & $(15,20]$ & $(20,25]$ & $(25,30]$ & $(30,+\infty)$ & Monocrystalline & Polycrystalline & $(0,2]$ & $(2,3]$ & $(3,4]$ & $(4,\infty)$ \\ \hline $5$ & $35$ & $44$ & $15$ & $1$ & $93$ & $7$ & $4$ & $36$ & $59$ & $1$\\ \hline \end{tabular} \label{tab:photovoltaicSpecifications} \end{table*} In Table \ref{tab:photovoltaic} we have also included information about the amount of average power generated via a rooftop solar panel. Locations, technology as well as inclinations and sizes of panels vary, as shown in Table \ref{tab:photovoltaicSpecifications} for one of the databases considered, where kWp denotes the kilowatt peak, i.e., the output power achieved by a panel under full solar radiation. As expected, around $50\%$ of time, i.e., at night, no energy is generated at all, while there are differences in the distribution of the average values for the two databases considered, due to the different areas considered. If we compare these values with those in Table \ref{tab:batteryCapacity}, we can see that the capacities of current batteries are sufficient to store many hours of average solar energy generated by the solar panels most of the time, for which the infinite battery assumption may be an accurate model. \subsection{Main Contributions} The main contributions of this paper can be summarized as follows: \begin{enumerate} \item We provide computable closed-form single-letter expressions for the minimum information leakage rate when the battery capacity is zero and infinite. We provide detailed proofs for these results, which have been stated in \cite{Giaconi:2015} without proofs. These two asymptotic performance results can also be considered as upper and lower bounds on the achievable privacy performance for a more practical SM system with a finite-capacity battery. \item For these scenarios, we study the information leakage rate also considering the availability of the RES information at the UP, which provides additional side information to the UP. \item For a finite-capacity battery scenario, we propose a suboptimal parameterized energy management policy, and optimize the policy parameters using a policy search technique that exploits stochastic gradient descent. We show numerically that the performance of the proposed energy management policy approaches the one with an infinite battery even with a relatively small battery size. This shows the efficacy of the proposed privacy preservation scheme. \item We show that the information leakage rate decreases with the rate of the available RES, and that a larger RB is needed to fully exploit the available energy to improve the privacy. \end{enumerate} The remainder of the paper is organized as follows. In Section \ref{sec:SystemModel} the system model is introduced. In Section \ref{sec:infinite} an ideal system with an infinite-capacity battery is studied, while in Section \ref{sec:zero} another extreme case with no energy storage is considered. For both scenarios, we also study the case in which the UP knows the realizations of the renewable energy process. In Section \ref{sec:binary} we study the binary scenario, while in Section \ref{sec:finite} we propose achievable schemes for the generic finite battery capacity scenario, and present the corresponding numerical results. In Section \ref{sec:continuous} a continuous input load is considered, while conclusions are drawn in Section \ref{sec:conclusion}. \subsection{Notation} Random variables (RVs) are denoted by capital letters $X, Y$, their realizations by lower-case letters $x, y$, and the corresponding alphabets by calligraphic letters $\mathcal{X}, \mathcal{Y}$. The probability distribution of a RV $X$ taking values in $\mathcal{X}$ is denoted by $p_{X}$. For integers $0 < a < b$, $X_{a}^{b}$ denotes the sequence $(X_a,X_{a+1},\ldots,X_b)$, while $X^b \triangleq X_{1}^b$. All logarithms and exponentials are in base $2$, unless specified otherwise. \section{System Model}\label{sec:SystemModel} \begin{figure}[!t] \centering \includegraphics[width=\columnwidth]{Figures/SystemModelRES.eps} \caption{System model. $X_t$, $Y_t$, $E_t$ and $B_t$ denote the consumer's energy demand, the SM readings, the energy produced by the RES, and the state of the RB at time $t$, respectively. The dashed line represents the meter readings being reported to the UP.} \label{fig:SystemModel} \end{figure} A discrete time system model is adopted as depicted in Figure \ref{fig:SystemModel}. $X_t \in \mathcal{X}$ is the total amount of power demanded by a user in time slot $t$, where $\mathcal{X}=[0,\ldots,X_{\max}]$, while $Y_t \in \mathcal{Y}$ is the energy received from the UP at time $t$, where $\mathcal{Y}=[0,\ldots,Y_{\max}]$. We call $X_t$ as the \textit{input load} and $Y_t$ as the \textit{output load} to simplify the terminology. For simplicity, we assume that the entries of the input load sequence $\{X_t\}_{t=1}^{\infty}$ are i.i.d. with distribution $p_X$. In time slot $t$, $E_t\in \mathcal{E}$ units of energy are generated from the RES, which becomes available to the energy management unit (EMU) at the beginning of time slot $t$. The entries of the renewable energy sequence $\{E_t\}_{t=1}^{\infty}$ are also i.i.d. with distribution $p_E$ and alphabet $\mathcal{E}=[0,\ldots,E_{\max}]$, while the average renewable energy rate is denoted by $\bar{P}_E \triangleq \mathbbm{E}[E]$. We further consider the presence of an RB in which the renewable energy can be stored for future use. The state of charge (SOC) of the battery at time $t$ is $B_t \in [0,\ldots,B_{\max}]$, and its capacity is $B_{\max}$. We assume no losses in the battery charging and discharging processes. The EMU always satisfies user's energy demands by drawing energy from either the UP or the RB; that is, outages or demand shifting are not allowed. As a consequence, we have $X_{\max} \geq Y_{\max} \geq X_{\max}-B_{\max}$. We do not allow extra energy to be drawn from the grid and then wasted. This could provide additional privacy, albeit at a significantly higher energy cost. Also, the battery is exclusively for storing the generated renewable energy, and it cannot be recharged with grid energy. While storing grid energy in the battery to be supplied later to the appliances can provide additional privacy \cite{Varodayan:2011}, here we limit the use of the battery to renewable energy storage to isolate and understand the privacy benefits of RESs. Hence, we impose \begin{equation}\label{eq:constraintY} 0 \leq Y_t \leq X_t, \quad \forall t, \end{equation} while $X_t - Y_t$ is the amount of energy obtained from the RB in time slot $t$. The energy retrieved from the battery must be smaller than the energy available in it, i.e., \begin{equation}\label{eq:constraintXY} X_t-Y_t \leq B_t + E_t, \quad \forall t. \end{equation} We also consider a peak power constraint $\hat{P}$ on the amount of energy that can be requested at any time from the RB, i.e., \begin{equation}\label{eq:constraintPeak} 0 \leq X_t - Y_t \leq \hat{P}, \quad \forall t, \end{equation} and for the rest of the paper we assume that $\bar{P}_E \leq \hat{P}$. Given $(X_t, E_t, B_t)=(x_t, e_t, b_t)$ and the constraints (\ref{eq:constraintY}), (\ref{eq:constraintXY}), and (\ref{eq:constraintPeak}), the set of feasible energy requests at time $t$ is \begin{equation}\label{eq:feasibleSetY} \bar{\mathcal{Y}}(x_t,e_t,b_t) \triangleq \\ \Big\{ y_t \in \mathcal{Y}: [x_t-\min\{b_t+e_t,\hat{P}\}]^+ \leq y_t \leq x_t \Big\}, \end{equation} where $[a]^+=a$ if $a>0$, and $0$ otherwise. The battery update equation can be written as \begin{align}\label{battery_constraint} B_{t+1} = \min \Big\{B_{t} + E_t - (X_t - Y_t), B_{\max} \Big\}, \quad \forall t. \end{align} We aim at designing \emph{energy management policies} $f=(f_1,f_2,\ldots)$ that decide on the amount of energy to request from the UP at each time $t$, given the previous values of input load $X^t$, renewable energy $E^{t}$, battery SOCs $B^t$, and output load $Y^{t-1}$, i.e., \begin{equation*} f_t: \mathcal{X}^t \times \mathcal{E}^t \times \mathcal{B}^t \times \mathcal{Y}^{t-1} \rightarrow \mathcal{Y}, \quad \forall t, \end{equation*} while satisfying (\ref{eq:feasibleSetY}) and (\ref{battery_constraint}), where $f \in \mathcal{F}$ and $\mathcal{F}$ denotes the set of feasible policies, i.e., which produce output load values that satisfy the RB and RES constraints at any time, as well as the battery update equation. We measure privacy via the \textit{information leakage rate}, defined as the average mutual information rate between the actual user energy consumption and the energy received from the grid, which also corresponds to the reported SM data, i.e., \begin{equation}\label{eq:generalForm} \mathcal{I}_f^{i}(B_{\max},\hat{P}) \triangleq \lim_{n \rightarrow \infty} \frac{1}{n} I \left( X^n; Y^n \right), \end{equation} where the subscript $f$ denotes the specific energy management policy employed, and the superscript $i$ stresses the fact that we are considering instantaneous power constraints. Thus, the optimization problem can be written as the minimization of (\ref{eq:generalForm}) over all feasible policies $f \in \mathcal{F}$, i.e., \begin{equation}\label{eq:generalMinimization} \mathcal{I}^{i}(B_{\max},\hat{P}) \triangleq \inf_{f \in \mathcal{F}} \lim_{n \rightarrow \infty} \frac{1}{n} I(X^n;Y^n). \end{equation} A single-letter expression for the information leakage rate is provided in \cite{Gunduz:2013ICC,Gomez:2013ISIT,Gomez:2015TIFS} when the EMU is constrained only by the average and peak power constraints. In general, because of the memory effects introduced by the RB and the RES, satisfying the input load from the RB or the RES at some time period may come at the expense of revealing more information about the energy consumption at future time periods. For this reason, the information theoretic analysis typically focuses on the average performance, measured over a period of $n$ time slots, and aims at understanding the fundamental performance bounds by letting this time period go to infinity, i.e., $n \rightarrow \infty$, as in (\ref{eq:generalForm}). However, the definition of the information leakage rate in (\ref{eq:generalForm}) involves $n$-length sequences $X^n$ and $Y^n$, and the asymptotic performance limit corresponds to an infinite-dimensional optimization problem, which cannot be solved numerically. On the contrary, characterizing a single-letter expression allows the optimal solution to be to described as an optimization problem in terms of the single-letter random variables, which can be a finite-dimensional optimization problem when the involved random variables are defined over finite alphabets. Therefore, a single-letter characterization of the information theoretic privacy is desirable to be able to evaluate the minimum possible information leakage rate. In \cite{Gomez:2013ISIT} the \textit{privacy-power function} $\mathcal{I}(\bar{P},\hat{P})$ is defined as the minimum information leakage rate that can be achieved when the energy management policy satisfies the average power constraint $\mathbbm{E}\big[\sum_{t=1}^n (X_t - Y_t)\big] \leq \bar{P}$, as well as the peak power constraint $0 \leq X_t - Y_t \leq \hat{P}$, $\forall t$. The privacy-power function has the single-letter characterization provided by the following theorem. \begin{theorem}\label{th:average_peak} \cite[Theorem 1]{Gomez:2013ISIT} The privacy-power function $\mathcal{I}(\bar{P},\hat{P})$ for an i.i.d. input load vector $X$ with distribution $p_{X}(x)$ and output load vector $Y$, when the average and peak values of the power provided by the RES are limited by $\bar{P}$ and $\hat{P}$, respectively, is given by \begin{equation}\label{expr_privacy_power} \mathcal{I}(\bar{P},\hat{P}) = \inf_{p_{Y|X} \in \mathcal{P}} I\left(X;Y\right), \end{equation} where $\mathcal{P} \triangleq \{ p_{Y|X}: y \in \mathcal{Y}, \mathbbm{E}[(X-Y)] \leq \bar{P}, 0 \leq X-Y \leq \hat{P}\}$. \end{theorem} \begin{lemma} \cite[Lemma 1]{Gomez:2013ISIT} The privacy-power function $\mathcal{I}(\bar{P},\hat{P})$, given above, is a non-increasing convex function of $\bar{P}$ and $\hat{P}$. \end{lemma} It is shown in \cite{Gomez:2015TIFS} that, when the input load alphabet is discrete, i.e., $\mathcal{X}=\{0,1,\ldots,X_{\max}\}$, the output load alphabet $\mathcal{Y}$, which is not necessarily discrete, can be restricted to the input load alphabet, i.e., $\mathcal{Y} = \mathcal{X}$, without loss of optimality. Given this restriction and the convexity of the privacy-power function, $\mathcal{I}(\bar{P},\hat{P})$ can be numerically evaluated, e.g., by the efficient Blahut-Arimoto (BA) \cite{Blahut:1972} algorithm. The following lemma states that this property holds also in our setting for the various battery capacities we analyze in the following. Thus, in the discrete case, we can assume that all the involved random processes are defined over finite alphabets and that there is a minimum quantum of energy such that all the aforementioned quantities are integer multiples of this quantum. \begin{lemma}\label{lemma:discreteAlphabets} If the input alphabet $\mathcal{X}$ is discrete, the output alphabet $\mathcal{Y}$ can be constrained to the input alphabet without loss of optimality. \end{lemma} \begin{proof} The proof is similar to that of \cite[Theorem 2]{Gomez:2015TIFS}. Let $\mathcal{X}$ be the discrete input load alphabet and let $X(y)=\min_{x \in \mathcal{X}}\{x\geq y\}$. Then, for any given energy management policy, and the resultant output load $Y^n$, we define a new output load as $\hat{Y}(t) = X(Y(t))$, that is, $\hat{Y}$ is a post-processed version of $Y$, and $\hat{\mathcal{Y}}=\mathcal{X}$. By construction, we have that $X(t) \geq \hat{Y}(t) \geq Y(t), \forall t$, i.e., the power demanded by the battery cannot have a larger peak value than the original demanded power. Similarly, the new output load satisfies all the instantaneous power constraints as well. This proves that the policy is feasible. Also, the information leakage rate is not increased as $\hat{Y}$ is a deterministic function of $Y$, and thus $X - Y - \hat{Y}$ forms a Markov chain, and $I(X,Y)\geq I(X,\hat{Y})$ by the data processing inequality. \end{proof} Here we introduce a generic energy management policy, which we later specialize to the different scenarios we consider. This is a stationary and memoryless policy that generates $Y_t$ randomly using a conditional probability distribution that is based only on the current input load $X_t$ and the available total renewable energy $B_t+E_t$, i.e., \begin{equation}\label{eq:generalizedPolicy} \tilde{p}_{Y|X,B+E} : \mathcal{X} \times (\mathcal{B+E}) \rightarrow \mathcal{Y}. \end{equation} Note that, in the presence of an RB, in which the generated renewable energy is stored and used for privacy, a memoryless energy management policy is suboptimal in general, as it ignores the history. However, in the following we show that a memoryless policy is able to achieve the minimum information leakage rate in the two extreme scenarios of $B_{\max}=\infty$ and $B_{\max}=0$. \begin{figure*}[!b] \vspace{-3mm} \hrulefill \setcounter{equation}{11} \begin{equation}\label{eq:bestEffort} \tilde{p}_{Y|X,B+E}(y|x,b+e)= \begin{cases} p^*_{Y|X}(y|x), &\text{if } x-y^* \leq b+e \text{ and } y^* \neq x,\\ p^*_{Y|X}(y|x) + \sum_{ \{y' \in \mathcal{Y}: x-y'>b+e\}} p^*_{Y|X}(y'|x),&\text{if } y^*=x,\\ 0, &\text{if } x-y^* > b+e. \end{cases} \end{equation} \setcounter{equation}{9} \end{figure*} \section{Infinite Battery Capacity}\label{sec:infinite} In this section we relax the constraint on the battery capacity and consider $B_{\max}=\infty$. This is an extreme situation that may model a battery with a relatively large capacity compared to the average generation rate of renewable energy, $\bar{P}_E$, and the average input load. This scenario provides useful insights on the best achievable privacy performance, and also serves as a bound on the performance achievable with a finite-capacity RB. In each time slot, the EMU is limited by both the peak power constraint (\ref{eq:constraintPeak}) and the energy available in the RB, which is the difference between the total renewable energy generated and the total energy that has been requested from the battery up to that time, i.e., \begin{equation} \label{eq:constrInf} \sum_{t=1}^n (X_t - Y_t) \leq \sum_{t=1}^n E_t, \quad \forall n. \end{equation} \subsection{Generated Renewable Energy not Known by the UP}\label{sec:BinfiniteNotKnown} In this section $E^n$ is treated as a random sequence whose realization is known only to the consumer in a causal manner. This scenario may occur if the renewable energy originates from sources which could be extremely difficult, if not impossible, for the UP to track. The following theorem states that the minimum information leakage rate when $B_{\max} = \infty$ is equivalent to the average and peak power-constrained scenario, as in \cite{Gomez:2013ISIT}; that is, the cumulative constraints on the EMU policy do not reduce the achievable privacy if the battery capacity is sufficiently large. \setcounter{equation}{10} \begin{theorem}\label{th:Binfinite_peak} If $B_{\max}=\infty$ and the peak power constraint on the amount of energy taken from the RB is $\hat{P}$, then the minimum information leakage rate for an i.i.d. input load $X$ and a renewable energy generation process with average power $\bar{P}_E$, is \begin{equation} \mathcal{I}^i(\infty,\hat{P}) = \mathcal{I}(\bar{P}_E, \hat{P}). \end{equation} \end{theorem} \setcounter{equation}{12} $\mathcal{I}(\bar{P}_E, \hat{P})$ is a trivial lower bound on $\mathcal{I}^i(\infty,\hat{P})$. In the following section an energy management policy that achieves $\mathcal{I}^i(\infty,\hat{P})$ is presented. The proposed policy is a specialization of the generalized memoryless policy introduced in (\ref{eq:generalizedPolicy}). \subsection{Optimal Energy Management Policy for \texorpdfstring{$B_{\max}=\infty$}{BInfinite}}\label{sec:optimalPolicyBinfinite} Consider the following energy management policy. In each time slot $t$, the EMU, based on the instantaneous input load $X_t$, decides on the optimal portion of the input load to be received from the grid, $Y^{*}_{t}$, by using the optimal conditional probability distribution $p^*_{Y|X}$ that minimizes (\ref{expr_privacy_power}). If there is enough energy available to fully satisfy the EMU requests, i.e., $B_{t} + E_{t}\geq X_t-Y^{*}_{t}$, the EMU uses $X_t - Y^*_{t}$ units of renewable energy and $Y^*_{t}$ units of energy from the grid, i.e., $Y_t=Y_t^*$; otherwise, all the input load is satisfied directly from the grid, i.e., $Y_t = X_t$, thus leading to the maximum information leakage for that time instant, i.e., the UP learns $X_t$ perfectly. The time instants at which such leakage occurs cannot be computed beforehand, since they depend on the realizations of the renewable energy process, input and output loads. Given the nature of this policy, which tries to follow the optimal policy generated by ignoring the current SOC, we name it the \emph{best-effort energy management policy}. Algorithm \ref{alg:bestEffortPrivacy} summarizes this policy. Equation (\ref{eq:bestEffort}), shown at the bottom of the page, specializes policy (\ref{eq:generalizedPolicy}) to the best-effort policy. The second case in (\ref{eq:bestEffort}) includes all the instances for which $p^*_{Y|X}$ outputs either $y^*=x$, or an infeasible output, i.e, for which $x-y^*>b+e$. \begin{algorithm}[t] \begin{algorithmic}[1] \Statex \State{Initial battery SOC: $B_0$.} \State{Find $p^*_{Y|X}$ that minimizes (\ref{expr_privacy_power}) for given $\bar{P}_E$ and $\hat{P}$.} \For {$t = 1, \ldots, n$} \State{Input: $X_t, B_t, E_t$.} \State{Generate $Y^*_t$ according to $p^*_{Y|X}$.} \If{$B_t + E_t \geq X_t-Y^*_{t}$} \State{Optimal policy is followed: $Y_t=Y^*_t$ and $X_t-Y^*_{t}$} \StatexIndent[3] taken from the battery. \Else \State{Full leakage occurs: $Y_t=X_t$.} \EndIf \State{Next battery state: $B_{t+1}=\min\{B_t+E_t-(X_t-$} \StatexIndent[2] $Y_{t}),B_{\max}\}$. \EndFor \end{algorithmic} \caption{Best-Effort Privacy Policy for $B_{\max}=\infty$.} \label{alg:bestEffortPrivacy} \end{algorithm} Since the energy arrival is stochastic, it may seem that very little can be said about the information leakage rate. However, if the condition $\mathbbm{E}[X-Y^*] < \bar{P}_{E}$ holds, then it is possible to show that the number of times full leakage of information occurs due to unavailability of energy is relatively small compared to the operating time of the system. This is proved in the following lemma. \begin{lemma}\label{lemma:BestEffort} If $\mathbbm{E}[X-Y^*] < \bar{P}_E$, and the EMU follows the best-effort energy management policy, then almost surely the condition $B_{t}+E_{t}< X_t - Y^*_t$ holds only in finitely many time slots in the limit of infinite horizon. \end{lemma} \begin{proof} Let $\mathbbm{E}[X-Y^*] = \bar{P}_{E} - \epsilon$, for some $\epsilon > 0$. The sequence $E - (X-Y^*) - \epsilon$ has zero mean. By the strong law of large numbers, the sample average of the sequence converges almost surely to its expected value, i.e., the sequence of events $\{\frac{1}{n} \sum_{t=1}^{n} (E_t - (X_t-Y^*_t) - \epsilon) < -\epsilon \}_{n=1}^{\infty}$, and thus the sequence $\{\frac{1}{n} \sum_{t=1}^{n}(E_t- (X_t-Y^*_t))<0\}_{n=1}^{\infty}$ occurs only for finitely many times. This implies that, with $Y^*_t$ generated according to the best-effort policy, the unavailability of energy at any time, $B_t+E_t < X_t - Y^*_t$, occurs only for finitely many times. \end{proof} \begin{lemma}\label{lemma:BestEffortPPF} If $\mathbbm{E}[X-Y^*] < \bar{P}_E$, then the minimum information leakage rate of the best-effort policy tends to $\mathcal{I}^i(\infty,\hat{P})$, as $n \rightarrow \infty$. \end{lemma} \begin{proof} Divide the sequence of input and output loads according to the time instants in which a private SM operation is achieved, i.e., the time instants the EMU can fully emulate $p^*_{Y|X}$, and time instants in which full leakage occurs. From Lemma \ref{lemma:BestEffort} we know that as $n \rightarrow \infty$, there is only a finite number of time instants, say $m$, in which the level of privacy induced by $p^*_{Y|X}$ is not achieved, i.e., for which the condition $B_t+E_t < X_t - Y^*_t$ holds, when $Y^*_t$ is generated based on $p^*_{Y|X}$. We remind that the condition $X_t - Y^*_t < \hat{P}$ always holds. Then, we can write \begin{subequations} \begin{align} &\frac{1}{n} I(X^n;Y^n) = \frac{1}{n} \Big[H(X^{n})-H(X^{n}|Y^{n}) \Big] \label{Binfty_Enotknown_BEpolicy1} \\ &= \frac{1}{n} \Bigg[ \sum_{t=1}^n H(X_t)-H(X_t|X^{t-1},Y^n )\Bigg] \label{Binfty_Enotknown_BEpolicy2} \\ &\geq \frac{1}{n} \Bigg[ \sum_{t=1}^{n} H(X_t) - H(X_t|Y_t) \Bigg] \label{Binfty_Enotknown_BEpolicy3} \\ &= \frac{1}{n} \Bigg[ \sum_{t \in \mathcal{T}^C} I(X_t;Y_t=Y^*_t) + \sum_{t \in \mathcal{T}} I(X_t;Y_t=X_t) \Bigg] \\ &\geq \frac{n-m}{n}\mathcal{I}^i(\infty,\hat{P}) + \frac{m}{n} H(X) \xrightarrow{n \rightarrow \infty} \mathcal{I}^i(\infty,\hat{P}) \label{eq:be3}, \end{align} \end{subequations} where $\mathcal{T}$ is the set of instants when full leakage of information takes place, i.e., for which $Y_t=X_t$, and $\mathcal{T}^C$ is the set of time instants in which the output is generated through $p^*_{Y|X}$, i.e., $Y_t=Y^*_t$; (\ref{Binfty_Enotknown_BEpolicy3}) follows since conditioning reduces entropy; (\ref{eq:be3}) follows since $m$ is finite. \end{proof} \subsection{Store-and-Hide Energy Management Policy} Here we provide an alternative energy management policy in the case of an infinite-capacity battery. The \textit{store-and-hide energy management policy} consists of an initial \emph{storage} phase, during which all the energy requests of the user are satisfied from the grid while all the generated renewable energy is stored in the battery, and a second \emph{hiding} phase, during which the EMU deploys the optimal policy $p^*_{Y|X}$. More formally, consider $n$ time slots. In the first $s(n)$ time slots, the so-called \textit{storage phase}, no privacy is achieved because we have $Y_t=X_t$, for $t=1,2,\ldots,s(n)$. In the remaining $n-s(n)$ time slots, the so-called \textit{hiding phase}, user demand is satisfied by taking energy from both the grid and the battery according to the optimal policy $p^*_{Y|X}$. We assume that $s(n) = o(n)$, with $ \lim_{n \to \infty} s(n)= \infty $, and $\lim_{n \to \infty} n-s(n)= \infty $. The initial waiting time $s(n)$ enables the battery to store on average $s(n) \bar{P}_E$ units of energy. In the following lemma we show that the energy stored in the initial storage phase is sufficient to let the EMU follow the optimal energy management policy $p^*_{Y|X}$ during the hiding phase, without energy outages almost surely. After $s(n)$ units of time, thanks to the energy already stored in the RB, the system is able to overcome the uncertainty in the energy arrival, and is able to adopt the optimal privacy-preserving energy management policy for the remaining time. \begin{remark}\label{rem:noInfo} It is noteworthy that no information about the recharge process of the battery is required, and all the EMU needs to know is the average power generated by the renewable energy process, $\bar{P}_E$. \end{remark} \begin{lemma}\label{lemma:storeAndHide} With a storage phase of length $s(n) = o(n)$, where $ \lim_{n \to \infty} s(n)= \infty $, and $ \lim_{n \to \infty} n-s(n)= \infty $, the store-and-hide policy satisfies the energy constraints in (\ref{eq:constrInf}) almost surely provided that $\mathbbm{E}[X-Y^*] < \bar{P}_E$. \end{lemma} The proof can be found in Appendix \ref{ap:storeAndHide}. By means of Lemma \ref{lemma:storeAndHide} it is possible to show that the minimum information leakage rate of the store-and-hide policy approaches $\mathcal{I}^i(\infty,\hat{P})$ as $n \rightarrow \infty$, as shown in the following lemma, whose proof can be found in Appendix \ref{ap:storeAndHidePPF}. \begin{lemma}\label{lemma:storeAndHidePPF} If $\mathbbm{E}[X-Y^*] < \bar{P}_E$, then the information leakage rate of the store-and-hide policy with $s(n)$ as specified in Lemma \ref{lemma:storeAndHide} approaches $\mathcal{I}^i(\infty,\hat{P})$ as $n \rightarrow \infty$. \end{lemma} \begin{remark}Even though the two schemes described above achieve the same privacy performance as $n \rightarrow \infty$, they do have some conceptual differences. During the initial phase of energy saving, the store-and-hide policy satisfies all the user demands from the grid leaking full information. Therefore, the SM readings reveal user's activity completely in this period. While the impact of this on the information leakage rate vanishes as $n \rightarrow \infty$, this might not be preferable in practice. Therefore, we believe that the best-effort policy is more appropriate for practical applications. \end{remark} \subsection{Generated Renewable Energy Known by the UP} \begin{figure}[!t] \centering \includegraphics[width=\columnwidth]{Figures/BinfiniteEknownToUP.eps} \caption{The UP has perfect knowledge about the realizations of the renewable energy generation process, in addition to the energy used from the grid that is reported through the SM readings.} \label{fig:BinfiniteEknownToUP} \end{figure} Here we assume that the UP knows the realization of the renewable energy process $E^n$, as highlighted in Figure \ref{fig:BinfiniteEknownToUP}. This scenario can occur if, for example, we consider solar energy as the RES, and the UP can accurately estimate the renewable energy produced from its own observations in nearby locations, weather forecast of the area, and the specifications of the solar panel. This is a worst-case situation and we expect the amount of leaked information in this case to be greater than or equal to that of the previous scenario, in which only the EMU knows the current state of the renewable energy produced. In this setting, the information leakage rate is defined as \begin{equation}\label{eq:Binfinite_Eknown} \bar{\mathcal{I}}^{i}(\infty, \hat{P}) \triangleq \inf_{f \in \mathcal{F}} \lim_{n \rightarrow \infty} \frac{1}{n}I(X^n;Y^n|E^n). \end{equation} The following theorem states that $E^n$ does not necessarily provide more information to the UP compared to the scenario where the UP does not have access to this information. \begin{theorem}\label{th:BinfiniteKnown_rate} If $B_{\max}=\infty$, the minimum information leakage rates for the cases in which $E^n$ is either known or not known to the UP are the same, i.e., $\bar{\mathcal{I}}^{i}(\infty, \hat{P}) = \mathcal{I}^{i}(\infty, \hat{P})$. \end{theorem} \begin{proof} We have the following chain of inequalities: \begin{subequations}\label{sub} \begin{align} \lim_{n \rightarrow \infty} &\frac{1}{n} I(X^n;Y^n|E^n) = \lim_{n \rightarrow \infty} \frac{1}{n} I(X^n;Y^n,E^n) \label{eq:Binfinite_Eknown1}\\ &= \lim_{n \rightarrow \infty} \frac{1}{n} [I(X^n;Y^n) + I(E^n;X^n|Y^n)]\\ &\geq \lim_{n \rightarrow \infty} \frac{1}{n} I(X^n;Y^n), \label{eq:Binfinite_Eknown2} \end{align} \end{subequations} where (\ref{eq:Binfinite_Eknown1}) follows as $X$ and $E$ are independent from each other, and (\ref{eq:Binfinite_Eknown2}) is due to the non negativity of mutual information. Thus, we have $\bar{\mathcal{I}}^{i}(\infty, \hat{P}) \geq \mathcal{I}^{i}(\infty, \hat{P})$. The inequality in (\ref{eq:Binfinite_Eknown2}) becomes an equality if $I(E^n; X^n|Y^n)=0$. This condition can be achieved by the store-and-hide policy. In fact, at the end of the storage phase the battery is filled up with an infinite amount of energy, and, as a consequence, the optimal policy during the hiding phase $p^*_{Y|X}$ does not need to take the information about the RES into account. This implies that $\lim_{n \rightarrow \infty} I(E^n; X^n|Y^n)=0$; and therefore, $\lim_{n \rightarrow \infty} \frac{1}{n} I(X^n;Y^n|E^n) = \lim_{n \rightarrow \infty} \frac{1}{n} I(X^n;Y^n)$, and that $\bar{\mathcal{I}}^{i}(\infty, \hat{P}) = \mathcal{I}^{i}(\infty, \hat{P})$. \end{proof} \section{SM System Without Energy Storage} \label{sec:zero} In this section we focus on another extreme scenario in which there is no RB for storing extra renewable energy, i.e., $B_{\max}=0$. The renewable energy available at time slot $t$, $E_t$, can be considered as an i.i.d. state information, and could be known, or not, to the UP. Given $E_t$ and $X_t$, the EMU decides on the amount of energy to use from the grid and from the RES. In each time slot $t=1,\ldots,n$ the energy that can be obtained from the RES, $X_t-Y_t$, is limited by the energy generated in time slot $t$, $E_t$, i.e., $0 \leq X_t-Y_t\leq E_t$. Thus, this is an SM system with a stochastic peak power constraint on the energy that the EMU can obtain from the RES. Therefore, this section can be considered as a generalization of \cite{Gomez:2015TIFS}, where the authors consider a fixed peak power constraint. \begin{remark} We note that a peak power constraint other than $E_t$ can be easily incorporated to the model, as this would simply correspond to a new instantaneous power constraint of $X_t-Y_t \leq \min\{E_t,\hat{P}\}$. Therefore, for the brevity of the presentation we do not consider a peak power constraint in this section. \end{remark} Note that, as opposed to the infinite-capacity battery scenario, here the past has no influence on the energy constraint, since there is no battery, and thus, no memory, in the system. To analyze this scenario, we first consider the minimum information leakage rate when the generated renewable energy is constant in every time slot, i.e., $\mathcal{E} = \{e\}$, which is known by both the EMU and the UP. The privacy-power function is obtained by considering only a peak power constraint, which can be obtained as a special case of Theorem \ref{th:average_peak}. \begin{lemma}\label{c:ppfsingle} If $B_{\max}=0$ and $\mathcal{E} = \{e\}$, the privacy-power function for an i.i.d. input load $X$ is given by $\mathcal{I}(e,e)$. \end{lemma} \subsection{Generated Renewable Energy not Known by the UP}\label{sec:BzeroNotKnown} As in Section \ref{sec:BinfiniteNotKnown}, here the realization of the renewable energy process is assumed to be known only by the EMU, while the UP only knows the probability distribution $p_E$. \begin{theorem}\label{th:IT} If $B_{\max}=0$, and the renewable energy produced by the RES is i.i.d. with distribution $p_E$, the optimal information leakage rate, denoted by $\mathcal{I}^i(0)$, is given by \begin{equation}\label{expr_zero} \mathcal{I}^i(0) \triangleq \inf_{\substack{p_{Y|X} : p_{Y|X} = \sum_{e \in \mathcal{E}} p_{Y|X,E}(y|x,e);\\ p_{Y|X,E} \in \mathcal{P}^i}} I\left(X;Y\right), \end{equation} where $\mathcal{P}^i \triangleq \{p_{Y|X,E}:p_{Y|X,E}(y|x,e)=0 \text{ if } y > x \text{ or } y < x - e \}$. \end{theorem} \begin{proof} \textit{Achievability.} We consider a conditional probability distribution $p_{Y| X, E}(y|x, e)$ that satisfies the conditions of Theorem \ref{th:IT}. At each time instant, for given $x_t$ and $e_t$, $y_t$ is generated independently using the conditional distribution $p_{Y| X,E}(y_t| X_t=x_t, E_t=e_t)$. Since the input and output load sequences are generated i.i.d. with the induced joint distribution $p_X(x)p_{Y|X}(y|x)$, the information leakage rate is given by $I(X;Y)$, whereas the instantaneous peak power constraint is satisfied for all conditional distributions in $\mathcal{P}^i$. \textit{Converse}. We assume that there is an energy management policy that satisfies the instantaneous peak power constraints, i.e., $x_t - y_t \leq e_t, \forall t$. Then, the information leakage rate satisfies the following chain of inequalities: \begin{subequations} \begin{align} &\frac{1}{n} I(X^{n};Y^{n}) =\frac{1}{n}\left[H(X^{n})-H(X^{n}|Y^{n} )\right] \label{B0_Eknown_Converse1} \\ &= \frac{1}{n} \left[ \sum_{t=1}^n H(X_t) - \sum_{t=1}^n H(X_t|X^{t-1},Y^n) \right] \label{B0_Eknown_Converse2} \\ &\ge \frac{1}{n} \left[ \sum_{t=1}^n H(X_t)-H(X_t|Y_t)\right] \label{B0_Eknown_Converse3} \\ &= \frac{1}{n} \sum_{t=1}^n I\left(X_t;Y_t\right) \ge \frac{1}{n} \sum_{t=1}^n \mathcal{I}^i(0) = \mathcal{I}^i(0), \label{B0_Eknown_Converse5} \end{align} \end{subequations} where (\ref{B0_Eknown_Converse2}) follows since $X$ is i.i.d.; (\ref{B0_Eknown_Converse3}) follows since conditioning reduces entropy; and (\ref{B0_Eknown_Converse5}) follows from the definition of $\mathcal{I}^i(0)$ in (\ref{expr_zero}). \end{proof} \subsection{Generated Renewable Energy Known by the UP} Here we assume the UP also knows the state $E_t$, $\forall t$. \begin{theorem}\label{th:ITR} If $B_{\max}=0$, the input load is i.i.d. with distribution $p_X$, and the amount of generated renewable energy is also known by the UP at each time $t$, then the optimal information leakage rate $\bar{\mathcal{I}}^i(0)$ is given by \begin{equation}\label{eq:leakage_TR} \bar{\mathcal{I}}^i(0) = \inf_{p_{Y|X,E} \in \mathcal{P}^i} I\left(X;Y|E \right) = \mathbbm{E}_E [\mathcal{I}(E,E)], \end{equation} where $\mathcal{P}^i \triangleq \{p_{Y|X,E}: p_{Y|X,E}(y|x,e)=0 \enspace \textit{if} \enspace y>x \enspace \textit{or} \enspace y<x-e\}$. \end{theorem} \begin{IEEEproof} \textit{Achievability} of (\ref{eq:leakage_TR}) follows trivially by employing the optimal $p_{Y|X,E}$ that minimizes (\ref{eq:leakage_TR}) at each time slot. To prove the converse, we show that any energy management policy that satisfies the stochastic peak power constraint at each time instant satisfies the following chain of inequalities: \begin{subequations} \begin{align} \frac{1}{n} &I(X^{n};Y^{n}|E^n) \nonumber \\ &= \frac{1}{n} \left[H(X^{n}|E^n)-H(X^{n}|Y^{n},E^n ) \right]\\ &= \frac{1}{n} \Bigg[ \sum_{t=1}^n H(X_t|X^{t-1},E^{n}) - H(X_t|X^{t-1},Y^n,E^n) \Bigg] \\ &\ge \frac{1}{n} \left[ \sum_{t=1}^n H(X_t|E_t)-H(X_t|Y_t,E_t)\right] \label{B0_Eknown_converse3} \\ &= \frac{1}{n} \sum_{t=1}^n \sum_{k=1}^{|\mathcal{E}|} p_{E}(E=e_k) I\left(X_t;Y_t|E_t=e_k\right) \label{B0_Eknown_converse4} \\ &\ge \frac{1}{n} \sum_{t=1}^n \sum_{k=1}^{|\mathcal{E}|} p_{E}(E=e_k) \mathcal{I}\left(e_k,e_k\right) \label{B0_Eknown_converse5} \\ &= \sum_{k=1}^{|\mathcal{E}|} p_{E}(E=e_k) \mathcal{I}\left(e_k,e_k\right) = \mathbbm{E}_E \left[ \mathcal{I}(E,E) \right], \label{B0_Eknown_converse6} \end{align} \end{subequations} where (\ref{B0_Eknown_converse3}) follows because $X$ and $E$ are independent of each other and across time, and conditioning reduces entropy; (\ref{B0_Eknown_converse4}) follows by explicitly considering all the states of $E_t$; and (\ref{B0_Eknown_converse5}) follows from Lemma \ref{c:ppfsingle}. \end{IEEEproof} From the chain rule of mutual information, we have \begin{subequations} \begin{align} I(X;Y,E) &= I(X;E) + I(X;Y|E) = I(X;Y|E), \label{B0_Eknown_chain1}\\ I(X;Y,E) &= I(X;Y) + I(X;E|Y) \label{B0_Eknown_chain2}, \end{align} \end{subequations} where (\ref{B0_Eknown_chain1}) follows since $X$ and $E$ are independent of each other. From (\ref{B0_Eknown_chain1}) and (\ref{B0_Eknown_chain2}), we get $I(X;Y) \leq I(X;Y|E)$. Hence, from Theorems \ref{th:IT} and \ref{th:ITR}, we have $\mathcal{I}^{i}(0) \leq \bar{\mathcal{I}}^{i}(0)$, as expected. \section{Binary Scenario} \label{sec:binary} In order to provide further insights into the behavior of the information leakage rate, here we consider a simple scenario with binary energy demands, binary energy generation and binary output load, i.e., $\mathcal{X}= \mathcal{E} = \mathcal{Y}=\{0,1\}$. This scenario may represent appliances that are either on or off/standby. $X$ and $E$ follow independent Bernoulli distributions with $\Pr\{X=1\}=q_x$ and $\Pr\{E=1\} = p_e$, respectively. We compare the minimum information leakage rates for the infinite and zero battery scenarios. If $B_{\max}= \infty$, the minimum information leakage rate can be characterized explicitly as \begin{multline}\label{eq:binaryBinfinite} \mathcal{I}^{i}(\infty,1) = \mathcal{I}(p_e, 1) =\\ \begin{cases} p_e \log p_e - q_x \log q_x \\ \quad- (1 - q_x+ p_e) \times \log (1- q_x + p_e), & \text{if } p_e \leq q_x,\\ 0, & \text{otherwise}, \end{cases} \end{multline} where we set the peak power constraint to $\hat{P}=1$. When $B_{\max}=0$, there are two scenarios. If the generated renewable energy is known only by the EMU, the minimum information leakage rate for this scenario is given by \begin{equation} \mathcal{I}^{i}(0;p_e,p_v,q_x) = h(1 - q_x + q_x p_e p_v ) - q_x h(p_e p_v) \label{B0_Ekonwn_binary2} , \end{equation} where $h(\cdot)$ is the binary entropy function defined as $h(p) \triangleq - p \log p - (1-p) \log(1-p)$, $q_x$ is fixed, and $p_v$ is the probability of using the energy available in the battery whenever $X=1$ and $E=1$. \begin{proposition} For every $p_e$ and $q_x$, the information leakage rate $\mathcal{I}^{i}(0;p_e,p_v,q_x)$ is minimized with $p_v=1$. \end{proposition} \begin{IEEEproof} The proof follows from observing that $\frac{\mathrm{d}\mathcal{I}^i(0,p_v)}{\mathrm{d}p_v} \leq 0, \forall p_e, q_x$. Thus, the minimum of $\mathcal{I}^{i}(0;p_e,p_v,q_x)$ is reached when $p_v$ takes its maximum value, i.e., $p_v=1$. \end{IEEEproof} When $E_t$ is known also by the UP, if the peak power constraint is $e=1$, no information is leaked, whereas if $e=0$, the input load is known perfectly by the UP, leading to a leakage of $H(X)$. Hence, the minimum information leakage rate when the state information is known by the UP is \begin{equation} \bar{\mathcal{I}}^i(0;p_e,q_x)=(1-p_e) h(q_x). \end{equation} Numerical comparison of the information leakage rate for zero and infinite battery capacities in the binary scenario will be presented in the next section together with the results corresponding to a finite battery capacity. \section{Finite Battery Capacity} \label{sec:finite} A closed-form expression for the finite-capacity battery scenario is elusive as the presence of a finite battery brings memory into the system, and the future energy usage depends on how much renewable energy has been generated in the previous time slots, how much of that energy has already been used by the EMU, and how much is available in the RB. Instead, we propose a low-complexity energy management policy and compare it to the two previous scenarios, which represent upper and lower bounds on the system performance for the finite battery scenario. \subsection{Binary Alphabet: \texorpdfstring{$\mathcal{X}=\mathcal{E}=\mathcal{Y}=\{0,1\}$}{Binary}}\label{sec:binaryFinite} In this setting $X$, $E$ and $Y$ have binary alphabets and we consider a discrete-time system, modeled via a finite state machine. As in Section \ref{sec:binary}, we set $\Pr\{X=1\} = q_x$ and $\Pr\{E=1\} = p_e$, while $V^n \triangleq X^n-Y^n$ represents the energy taken by the EMU from the battery, with $\mathcal{V}=\{0,1\}$. \begin{figure}[!t] \centering \includegraphics[width=1\columnwidth]{Figures/FiniteBatteryModel.eps} \caption{Finite state diagram for the evolution of the battery with $\mathcal{B}=\{0,1,\ldots B_{\max}\}$ and $\mathcal{X}=\mathcal{E}=\mathcal{Y}=\{0,1\}$ for the battery-independent policy. The $4$-tuple $(x,e,v,y)$ represent for every time $t$ the values of the input load, the renewable energy produced, the energy taken out of the battery by the EMU, and the output load, respectively.} \label{fig:unitSizeModelMulti} \end{figure} \subsubsection{Battery-independent Policy}\label{sec:batteryInvariantPolicy} Here we consider a time-invariant policy according to which the evolution of the battery state can be modeled as the Markov chain of Figure \ref{fig:unitSizeModelMulti}, where the $4$-tuples $(x,e,v,y)$ represent the realization at time $t$ of the input load $X$, the renewable energy $E$, the energy taken from the battery by the EMU $V$, and the output load $Y$, respectively. At every time, the RB can be charged, discharged or remain in the current SOC, depending on the transition probabilities. We note that a similar model has been adopted in \cite{Tan:2013JSAC}, with the difference that in \cite{Tan:2013JSAC} the RB can also store energy from the grid. We define $p_{v}$ as the probability that the energy is taken from the battery provided that the user is asking for energy and that there is energy available for use, i.e., $p_v\triangleq\Pr\{V=1\big|X=1,E+B\geq1\}$. Since the value of $p_v$ does not change according to the current battery state, we name this policy \textit{battery-independent policy}. Table \ref{tab:summaryTransFinite} lists all the possible states and transition probabilities for this scenario. In particular, the table shows for each transition from $B_t$ to $B_{t+1}$ and each combination of the tuple $(X_t,E_t,V_t,Y_t)$ the corresponding transition probability. To compute the information leakage rate, all the distributions are considered to be Bernoulli. For $B_{\max}=\infty$ and $B_{\max}=0$ we use the single-letter expressions derived in Section \ref{sec:binary}, and set $\hat{P}=1$ for $B_{\max}=\infty$. For a finite-capacity battery, we implement the achievable scheme described above, and by means of the algorithm in \cite{Arnold:2006} we simulate the system for very long sequences and evaluate the information leakage between the input and the output loads numerically and for different battery capacities. Moreover, for each $p_e$, we find the value of $p_v$ that achieves the minimum information leakage rate by searching over a discretized set of $p_v$ values. As an example, Figure \ref{fig:B_1optimalPVBinary} represents the optimal $p_v$ values for each $p_e$, when the input load is uniformly distributed and $B_{\max}=\{1,2,5,10\}$. In the figure, $p_e=0$ is not represented because, regardless of $p_v$, the leakage when $p_e=0$ is always equal to the entropy of the input load. Also, the figure shows that for higher $p_e$ values, the minimum leakage is achieved for $p_v=1$, i.e., it is better to always use the energy when available. \begin{table}[!t] \caption{Tuples and transition probabilities for the battery-independent policy when $\mathcal{X}=\mathcal{E}=\mathcal{Y}=\{0,1\}$.} \centering \resizebox{\columnwidth}{!}{ \begin{tabular}{ |c|c|c|c|c|c|c| } \hline $\mathbf{B_t}$ & $\mathbf{X_t}$ & $\mathbf{E_t}$ & $\mathbf{V_t}$ & $\mathbf{Y_t}$ & $\mathbf{B_{t+1}}$ & \textbf{Transition Probability}\\ \hline \multirow{5}{*}{$B_t=0$} & $0$ & $0$ & $0$ & $0$ & $0$ & $(1-q_x)(1-p_e)$\\ \cline{2-7} & $0$ & $1$ & $0$ & $0$ & $1$ & $(1-q_x)p_e$ \\ \cline{2-7} & $1$ & $0$ & $0$ & $1$ & $0$ & $q_x(1-p_e)$ \\ \cline{2-7} & $1$ & $1$ & $0$ & $1$ & $1$ & $q_x p_e (1-p_v)$ \\ \cline{2-7} & $1$ & $1$ & $1$ & $0$ & $0$ & $q_x p_e p_v$ \\ \hline \hline \multirow{6}{*}{$0< B_t \leq B_{\max}$} & $0$ & $0$ & $0$ & $0$ & $B_t$ & $(1-q_x)(1-p_e)$ \\ \cline{2-7} & $0$ & $1$ & $0$ & $0$ & $\min\{B_t+1,B_{\max}\}$ & $(1-q_x)p_e$\\ \cline{2-7} & $1$ & $0$ & $0$ & $1$ & $B_t$ & $q_x(1-p_e)(1-p_v)$ \\ \cline{2-7} & $1$ & $0$ & $1$ & $0$ & $B_t-1$ & $q_x (1-p_e) p_v$ \\ \cline{2-7} & $1$ & $1$ & $0$ & $1$ & $\min\{B_t+1,B_{\max}\}$ & $q_x p_e (1-p_v)$ \\ \cline{2-7} & $1$ & $1$ & $1$ & $0$ & $B_t$ & $q_x p_e p_v$ \\ \hline \end{tabular}} \label{tab:summaryTransFinite} \end{table} \begin{figure}[!t] \centering \includegraphics[width=0.8\columnwidth]{Figures/OptimalpvVSpe_Improved.eps} \caption{Optimal $p_v$ for the binary scenario and various battery capacities, when $q_x = 0.5$.} \label{fig:B_1optimalPVBinary} \end{figure} \subsubsection{Battery-conditioned Policy}\label{sec:batteryConditioned} Here we consider a policy, in which $p_v$, as defined before, can differ for different battery SOCs, i.e., the policy is characterized by a specific $p_{v_i}$ for each battery SOC $B_t=i$, for $i=\{0,\ldots,B_{\max}\}$. Thus, we now have the vector \begin{equation} \bar{p}_v=[p_{v_0},p_{v_1}, \ldots, p_{v_{B_{\max}}}]. \end{equation} To find the optimal $\bar{p}_v$ for each $p_e$ and $B_{\max}$ we deploy a stochastic gradient descent algorithm, specifically we use the least square-based finite difference method to approximate the gradient \cite{Deisenroth:2013}. Briefly, the algorithm works as follows. At any step, small perturbations are applied to each $p_{v_i}$ according to a uniform distribution over a predefined interval, and the leakage corresponding to the resulting perturbed vector $\bar{p}_v$ is computed. The gradient of the leakage function can thus be approximated numerically by employing the leakage corresponding to a number of different perturbations. A new $\bar{p}_v$ is finally computed using the gradient estimate and a predefined learning rate, and its corresponding leakage is determined and compared with that of the previous step. If the difference between the two leakage rates is below a certain threshold, the algorithm stops. Otherwise, the algorithm keeps on iterating. Figure \ref{fig:comparison} shows the information leakage rate with respect to the renewable energy generation rate $p_e$, for different battery capacities. For $B_{\max}=\{1,2,5,10\}$, we adopt the battery-conditioned policy, which has only a small gain with respect to the battery-independent policy. In particular, this gain is focused around smaller $p_e$ values. As expected, the least information leakage rate is achieved when $B_{\max}=\infty$ and $\hat{P}=1$, while the maximum leakage occurs when $B_{\max}=0$ and the UP knows the renewable energy process realizations. When $B_{\max}=0$ the information leakage rate reduces significantly if the state is not known by the UP and, more interestingly, we observe that the performance of the proposed suboptimal memoryless scheme approaches that of the infinite-capacity battery with relatively small battery sizes. In addition, we can see that the gain from the battery is much higher when the renewable generation rate is higher, i.e., when $p_e$ is high. This is expected because when $p_e$ is low, there is less energy to be stored for future time slots. \begin{figure}[!t] \centering \includegraphics[width=1\columnwidth]{Figures/m=2_Bvaried_batteryCONDpolicies.eps} \caption{Minimum information leakage with respect to the renewable energy generation rate $p_e$ with $\mathcal{X}=\mathcal{E}=\mathcal{Y}=\{0,1\}$ for the battery-conditioned policy. As $B_{\max}$ increases, the performance rapidly approaches that of $B_{\max}=\infty$ and $\hat{P}=1$.} \label{fig:comparison} \end{figure} \subsection{Larger Alphabets: \texorpdfstring{$|\mathcal{X}|=|\mathcal{Y}|=|\mathcal{E}|>2$}{GeneralCase}} Here we consider larger alphabets for $X$, $E$ and $Y$. As the alphabet sizes grow, so does the complexity of searching for the optimal policy. Instead, we consider the following suboptimal policy. At each time instant, the policy chooses among using all of the available energy, half of it, or no energy at all and we model the probability $p_v$ as in the following: \begin{equation}\label{eq:transProbModerate} p_v(B_t+E_t,X_t)= \begin{cases} (p_1,p_4), &\text{if } B_t + E_t < X_t, \\ (p_2,p_5), & \text{if } B_t + E_t = X_t, \\ (p_3,p_6), & \text{if } B_t + E_t > X_t. \end{cases} \end{equation} The probability pairs in (\ref{eq:transProbModerate}) refer to the probability of using all the available energy and the probability of using half of it. Therefore, we have $0 \leq p_i \leq 1$, for $i=1,\ldots, 6$, and $p_i+p_{i+3}\leq 1$, for $i=1,2,3$. For example, if $B_t + E_t < X_t$, all of the available energy is used with probability $p_1$, half of it, or the nearest integer value lower than that, is used with probability $p_4$, and none of it is used with probability $1-p_1-p_4$. Figure \ref{fig:comparisonFinite} shows the results for the scenario for $|\mathcal{X}|=|\mathcal{E}|=|\mathcal{Y}|=5$ when $B_{\max}=\{0,1,2,\infty\}$. The input load is uniformly distributed over the alphabet $\mathcal{X}$, while the renewable energy generation follows a binomial distribution with parameters $|\mathcal{X}|$ and $p_e$. The information leakage rate for the infinite and zero battery scenarios is computed by using the single-letter expressions which are evaluated by efficient numerical algorithms, specifically the BA algorithm \cite{Blahut:1972} and the CVX package \cite{cvx}. In particular, for $B_{\max}=\infty$ we set $\hat{P}=X_{\max}$. For the finite battery scenario, we adopt the aforementioned policy and optimize the performance by trying different combinations of the probabilities $p_i$, $1 \leq i \leq 6$. Similar considerations to that of Figure \ref{fig:comparison} can be drawn for Figure \ref{fig:comparisonFinite} as well \begin{figure}[!t] \centering \includegraphics[width=1\columnwidth]{Figures/ZeroOneTwoBatteryNew.eps} \caption{Minimum information leakage with respect to the renewable energy generation rate $p_e$ with $\mathcal{X}=\mathcal{E}=\mathcal{Y}=\{0,1,2,3,4\}$. The leakage for $B_{\max}=\infty$ has been found by setting $\hat{P}=4$.} \label{fig:comparisonFinite} \end{figure} \begin{remark} We remark here that, in order to isolate the privacy benefits of RESs, we do not allow charging the battery directly from the grid, which can potentially reduce the information leakage. It is known that modulating grid energy intake by employing a storage device provides privacy even in the absence of an RES \cite{Varodayan:2011,Li:2016Arxiv}, or jointly with an RES \cite{Giaconi:2016}. The additional privacy benefits of allowing charging of the RB from the grid will depend on the battery capacity. When $B_{\max}=\infty$, perfect privacy can be achieved by charging the battery initially, and using the battery throughout the operation. In the other extreme scenario, that is, when $B_{\max}=0$, obviously it is not possible to charge a non-existent battery from the grid. We leave a more detailed study of a finite-capacity storage device that can be charged by both the RES and the grid as a future work. \end{remark} \section{Continuous Input Loads} \label{sec:continuous} In the simulation results presented above, we have considered discrete alphabets for all the involved random variables. A set of fixed discrete values for the energy demands may not be an accurate model for all the appliances in the real world. However, as discussed in Section \ref{sec:SystemModel}, such hypothesis enables to constrain the output alphabet to the input alphabet without loss of optimality and to apply efficient algorithms to find the minimum amount of information leakage. For continuous input loads, the optimal alphabet is also continuous. Thus, low-complexity numerical algorithms, such as the BA algorithm, cannot be applied. However, one can provide a lower bound on the privacy-power function by using the Shannon lower bound (SLB) \cite{Cover:1991,Berger:1971}, which has been introduced by Shannon, and widely used in the literature to provide a computable lower bound to the rate-distortion function. Although it is not always a tight bound, it is shown in \cite{Gomez:2015TIFS} that the SLB provides a tight bound for the information leakage rate for an exponentially distributed input load. The SLB for the rate distortion function $R(D)$ is defined as $H(X)-\phi(D)$ where $\phi(D)= \max_{\substack{p: \sum_{i=1}^{m} p_i d_i \leq D}} H(p)$. The truncated exponential distribution maximises the entropy for a given mean value $\bar{P}$ and a peak power constraint $0 \leq X \leq \hat{P}$ \cite{Cover:1991} and has the form \cite{Gomez:2013ISIT} \begin{equation} f_X(x)= \begin{cases} \frac{1}{\lambda_0} e^{-\frac{x}{\lambda_1}},& \text{if } 0 \leq x \leq \hat{P},\\ 0, & \text{otherwise}, \end{cases} \end{equation} where $\lambda_0 \geq 0$ and $\lambda_1 \geq 0$ are chosen to satisfy the constraints on the moments. Thus, the SLB for the privacy-power function introduced in Theorem \ref{th:average_peak} is given by \begin{equation} \mathcal{I}_{SLB}(\bar{P},\hat{P}) = h(X) - \frac{1}{\ln{2}}\bigg( \log(\lambda_0) + \frac{\bar{P}}{\lambda_1}\bigg). \end{equation} Authors in \cite{Gomez:2013ISIT} show that the SLB is indeed achievable for peak and average power constraints, by finding the conditional distribution $f_{Y|X}(y|x)$ that satisfies the SLB with equality, provided that the energy coming from the battery $X-Y$ is distributed according to a truncated exponential distribution with mean $\bar{P}$ and peak $\hat{P}$. Authors in \cite{Gomez:2015TIFS} provide the SLB for the average power constraint, which, as we have shown, is equivalent to the infinite-capacity battery scenario. \subsection{No Battery - Renewable Energy not Known by the UP} Here only a peak power constraint is considered, i.e., $X-Y$ is constrained by $0 \leq X-Y \leq \hat{P}$. The distribution that maximises the entropy over an interval is the uniform distribution \begin{align} \label{eq:SLBzero} f_X(x)= \begin{cases} \frac{1}{\hat{P}}, & \text{if } 0 \leq x \leq \hat{P},\\ 0, & \text{otherwise}. \end{cases} \end{align} For a fixed $\hat{P}$, the differential entropy of this distribution is $\log(\hat{P})$. Then, the SLB in the case of zero capacity battery is \begin{equation} \mathcal{I}_{SLB}(\hat{P}) = h(X) - \log(\hat{P}), \end{equation} where $\hat{P}$ is a RV with a certain known distribution. \subsection{No Battery - Renewable Energy Known by the UP} As in the previous scenario, only peak power constraints are considered and thus the entropy maximising distribution is still the uniform distribution (\ref{eq:SLBzero}). The privacy-power function is given by the expected value over the distribution of the states of the privacy-power function related to every state. Hence, the SLB is \begin{equation} \mathcal{I}_{SLB}(\hat{P}) = \mathbbm{E}_{\hat{P}}[h(X) - \log(\hat{P})]. \end{equation} \section{Conclusions} \label{sec:conclusion} We have studied information leakage in an SM system by considering an RES along with an RB. For infinite and zero battery capacities, we have provided single-letter information theoretic expressions for the minimum information leakage rate, which can be efficiently evaluated when the input load has a discrete alphabet. For these scenarios, we have also studied the information leakage rate when the UP knows the exact amount of renewable energy generated in each time slot. In addition, for the finite-capacity battery scenario, we have proposed a suboptimal low-complexity energy management policy, and evaluated the corresponding privacy performance using a stochastic gradient descent algorithm. Our results show that the privacy achieved by the proposed low-complexity policy approaches the theoretical lower bound obtained by assuming an infinite-capacity battery with a relatively small battery capacity, especially when the generation rate of the RES is low or high. \begin{appendices} \section{Proof of Lemma \ref{lemma:storeAndHide}}\label{ap:storeAndHide} \begin{proof} During the hiding phase, the random variable $Q=E-X+Y^*$ is i.i.d., as $E$ and $X$ are i.i.d and $Y^*$ is generated from $X$ through a memoryless policy. $Q$ can assume both positive and negative values with positive probability. The stochastic process \begin{equation} S_t = Q_1 + Q_2 + \ldots Q_t, \quad \forall t, \end{equation} is a random walk based on $Q$ that moves along the battery SOC axis. Since by hypothesis $\mathbbm{E}[E]=\bar{P}_E > \mathbbm{E}[X-Y^*]$, then $\mathbbm{E}[Q]=\mathbbm{E}[E-X+Y^*]>0$, meaning that the random walk $S_t$ has a positive drift, i.e., as $t \rightarrow \infty$, $S_t$ drift towards the positive values of the SOC axis. By the law of large numbers, when $s(n) \rightarrow \infty$ the amount of energy stored in the battery at the end of the \emph{storage phase} is $s(n)\bar{P}_E$, almost surely. Let $\alpha\triangleq -s(n)\bar{P}_E$. When $s(n) \rightarrow \infty$, $\alpha \rightarrow -\infty$. At $s(n)+1$, when the \emph{hiding phase} begins, the energy in the battery is used according to the optimal privacy-preserving policy $p^*_{Y|X}$ and the random walk state is $S_1=Q_1=E_1-X_1+Y^*_1$. For any $t$, $s(n)\bar{P}_E+S_t$ represents the battery SOC at time $t$. Our objective is to prove that the battery is never emptied, i.e., that the probability of crossing the threshold $\alpha$ for any time $t$ is zero: \begin{equation} \Pr\{S_t \leq \alpha\}=0, \quad \forall t. \end{equation} \begin{figure}[!t] \centering \includegraphics[width=1\columnwidth]{Figures/randomWalk.eps} \caption{The battery SOC evolution is represented by a random walk that starts at the beginning of the hiding phase and has a drift towards the positive direction of the battery SOC axis. We want to guarantee that the threshold $\alpha$ is never crossed by the random walk.} \label{fig:randomWalk} \end{figure} This scenario is represented in Figure \ref{fig:randomWalk}. We recall a corollary of Wald's Identity \cite[Chapter 7.5, Corollary 2]{Gallager:1996}, which is applied to find exponential bounds on the probability of threshold crossing. In particular, the corollary states that if we consider $Q$ as having a finite moment-generating function $\gamma(r)=\ln\{\mathbbm{E}[\exp(rQ)]\}$ over an interval $(r_{-},r_{+})$, a negative drift $\mathbbm{E}[Q]<0$ and $r^*$ being the positive root of $\gamma(r)$, then the probability of crossing threshold $\alpha>0$ by the random walk $S_t=Q_1+Q_2+\ldots +Q_t$ is \begin{equation}\label{eq:Waldidentity} \Pr\{S_{\tau} \geq \alpha \} \leq \exp(-r^* \alpha), \end{equation} where $\tau$ is the minimum $t$ for which the threshold $\alpha$ is crossed. Having a finite moment generating function means that $Q$ must have moments of all orders and the tails of its distribution function must decay at least exponentially in $q$ as $q \rightarrow \infty$ and $q \rightarrow -\infty$. In our specific setting, $\mathbbm{E}[Q]>0$, $\alpha<0$, and $r^*<0$. We can still apply Wald's identity by changing the signs of $r^*$ and $\alpha$ and by considering the probability of crossing a negative threshold. Thus, we have \begin{equation} \Pr\{S_{\tau} \leq \alpha \} \leq \exp(-r^* \alpha), \end{equation} where $\alpha<0$ and $r^*<0$. When $\lim_{n \rightarrow \infty} n-s(n) = \infty$ and $\lim_{n \rightarrow \infty} s(n) = \infty$, $\alpha \rightarrow -\infty$ and $\exp(-r^* \alpha) \rightarrow 0$. Thus, we obtain \begin{equation} \lim_{n \rightarrow \infty} \Pr\{S_{\tau} \leq \alpha \} = 0. \end{equation} \end{proof} \section{Proof of Lemma \ref{lemma:storeAndHidePPF}}\label{ap:storeAndHidePPF} \begin{proof} Split the sequence of input and output symbols into the storage and hiding phases of duration $s(n)$ and $n-s(n)$, respectively and let $s(n) = o(n)$. Then, it is possible to write \begin{subequations} \begin{align} \frac{1}{n} &I(X^n;Y^n) = \frac{1} {n} \Bigg[ \sum_{i=1}^n H(X_i|X^{i-1})-H(X_i|X^{i-1},Y^n)\Bigg] \\ &\geq \frac{1} {n} \Bigg[ \sum_{i=1}^n H(X_i) - H(X_i|Y_i), \label{eq:proofSAH2}\Bigg]\\ &= \frac{1}{n} \Bigg[ \sum_{i=1}^{s(n)} I(X_i;Y_i) + \sum_{i=s(n)+1}^{n} I(X_i;Y_i) \Bigg]\label{eq:proofSAH3}\\ &= \frac{1}{n} \Big\{ s(n) H(X) + [n-s(n)] \mathcal{I}^i(\infty,\hat{P}) \Big\} \label{eq:proofSAH4}\\ &= \frac{s(n)H(X)}{n} + \frac{[n-s(n)]\mathcal{I}^i(\infty,\hat{P})}{n}, \label{eq:proofSAH5} \end{align} \end{subequations} where (\ref{eq:proofSAH2}) follows because $X$ is i.i.d. and conditioning reduces entropy; (\ref{eq:proofSAH4}) follows since in the first $s(n)$ time instants leakage of full information $H(X)$ takes place, while in the following $n-s(n)$ time slots private operation is assured via the optimal strategy of Theorem \ref{th:Binfinite_peak}. If we take the limit $n \rightarrow \infty$, since $s(n) = o(n)$ and $H(X)$ is finite, we obtain the leakage rate \begin{equation} \lim_{n \rightarrow \infty} \frac{s(n)}{n}H(X) + \frac{n-s(n)}{n}\mathcal{I}^i(\infty,\hat{P}) = \mathcal{I}^i(\infty,\hat{P}). \end{equation} \end{proof} \end{appendices} \bibliographystyle{IEEEtran}
{'timestamp': '2018-01-30T02:15:09', 'yymm': '1703', 'arxiv_id': '1703.08390', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08390'}
arxiv
\section{Introduction}\label{introduction} In the context of latent variable, reducing the complexity of models can come in many forms: selecting among multiple predictors of a latent variable, simplifying factor structure by removing cross-loadings, determining whether the addition of nonlinear terms are necessary in longitudinal models, and many others. The aim of performing variable selection in structural equation models could be motivated by either an inadequate sample size (in relation to the number of parameters), or simply to present a more parsimonious relationship between variables.Particularly when the number of variables are high, reducing the model complexity in a globally optimal way can be challenging. As a simple running example, Figure 1 depicts a linear latent growth curve model \citep[e.g.][]{meredith1990latent} with four time points and ten predictors for a simulated dataset. In this, a researcher may want to test this model, but may only have a relatively small sample size (e.g.~80). There are 29 estimated parameters in this model, resulting in a estimated parameter to sample size ratio far below even the most liberal recommendations \citep[e.g.~10:1 parameters to sample size;][]{kline2015principles}. In lieu of finding additional respondents, reducing the number of parameters estimated is one effective strategy for reducing bias. Specifically, the 20 estimated regressions from \textit{c1-c10} could be reduced to a number that makes the ratio of the parameters estimated to sample size more reasonable. To explore this further, the next section provides an overview of regularization, and how different forms can be used to perform variable selection across a broad range of models. \begin{figure} \centering \includegraphics[width=.5\linewidth]{growth_fig} \caption{Growth curve model with 10 predictors of both the intercept and slope} \end{figure} \section{Regularization}\label{regularization} Although a host of methods exist to perform variable selection, the use of regularization has seen a wide array of application in the context of regression, and more recently, in areas such as graphical modeling, as well as a host of others. The two most common procedures for regularization in regression are the \textit{ridge} \citep{hoerl1970} and the least absolute shrinkage and selection operator \citep[\textit{lasso};][]{Tibshirani1996}; however, there are various alternative forms that can be seen as subsets or generalizations of these two procedures. Given an outcome vector \textit{y} and predictor matrix \(X \in {R}^{n \times p}\) , ridge estimates are defined as \[\tag{1} \hat{\beta}^{ridge}= argmin \Big\{ \sum_{i=1}^{N} (y_{i} = \beta_{0} - \sum_{j=1}^{p}x_{ij} \beta_{j})^{2} + \lambda \sum_{j=1}^{p} \beta_{j}^{2}\Big\}, \] where \(\beta_{0}\) is the intercept, \(\beta_{j}\) is the coefficient for \(x_{j}\), and \(\lambda\) is the penalty that controls the amount of shrinkage. Note that when \(\lambda = 0\), Equation 3 reduces to ordinary least squares regression. As \(\lambda\) is increased, the \(\beta\) parameters are shrunken towards zero. The lasso estimates are defined as \[\tag{2} \hat{\beta}^{lasso}= argmin \Big\{ \sum_{i=1}^{N} (y_{i} = \beta_{0} - \sum_{j=1}^{p}x_{ij} \beta_{j})^{2} + \lambda \sum_{j=1}^{p}|\beta_{j}|\Big\}. \] In lasso regression, the \(l_{1}\)-norm is used, instead of \(l_{2}\)-norm as in ridge, which also shrinks the \(\beta\) parameters, but additionally drives the parameters all the way to zero, thus performing a form of subset selection. In the context of our example depicted in Figure 1, to use lasso regression to select among the covariates, the growth model would need to be reduced to two factor scores, which neglects both the relationship between both the slope and intercept, reducing both to independent variables. Particularly in models with a greater number of latent variables, this becomes increasingly problematic. A method that keeps the model structure, while allowing for penalized estimation of specific parameters is regularized structural equation modeling \citep[RegSEM;][]{jacobucci2016regularized}. RegSEM adds a penalty function to the traditional maximum likelihood estimation (MLE) for structural equation models (SEMs). The maximum likelihood cost function for SEMs can be written as \[\tag{3} F_{ML}=log(\left|\Sigma\right|)+tr(C*\Sigma^{-1})-log(\left|C\right|)- p. \] where \(\Sigma\) is the model implied covariance matrix, \(C\) is the observed covariance matrix, and \(p\) is the number of estimated parameters. RegSEM builds in an additional element to penalize certain model parameters yielding \[\tag{4} F_{regsem} = F_{ML} + \lambda P(\cdot) \] where \(\lambda\) is the regularization parameter and takes on a value between zero and infinity. When \(\lambda\) is zero, MLE is performed, and when \(\lambda\) is infinity, all penalized parameters are shrunk to zero. \(P(\cdot)\) is a general function for summing the values of one or more of the model's parameter matrices. Two common forms of \(P(\cdot)\) include both the lasso (\(\| \cdot \|_{1}\)), which penalizes the sum of the absolute values of the parameters, and ridge (\(\| \cdot \|_{2}\)), which penalizes the sum of the squared values of the parameters. In our example, the twenty regression parameters from the covariates to both the intercept and slope would be penalized. Using lasso penalties, the absolute value of these twenty parameters would be summed and after being multiplied by the penalty \(\lambda\), added to equation 4, resulting in: \[\tag{5} F_{lasso} = F_{ML} + \lambda * \left\| \begin{matrix} c1_{i} \\ c2_{i}\\ \vdots \\ c10_{i}\\ c1_{s}\\ \vdots \\ c10_{s}\\ \end{matrix} \right\|_{1} \] Although the fit of the model is easily calculated given a set of parameter estimates, traditional optimization procedures for SEM cannot be used given the non-differentiable nature of lasso penalties, and as detailed later, sparse extensions. \subsection{Optimization}\label{optimization} One method that has become popular for optimizing penalized likelihood method is that of proximal gradient descent \citep[e.g.~p.~104 in][]{hastie2015statistical}. In comparison to one-step procedures common in SEM optimization, that only involve a method for calculating the step size and the direction (typically using the gradient and an approximation of the Hessian), proximal gradient descent can be formulated as a two-step procedure. With a stepsize of \(s^{t}\) and parameters \(\theta^{t}\) at iteration \textit{t}: \begin{enumerate} \item First, take a gradient step size $z = \theta^{t} - s^{t} \nabla g(\theta^{t})$. \item Second, perform elementwise soft-thresholding $\theta^{t+1} = S_{s^{t} \lambda}(z)$. \end{enumerate} where \(S_{s^{t} \lambda}(z)\) is the soft-thresholding operator \citep{donoho1995noising} used to overcome non-differentiability of the lasso penalty at the origin: \begin{equation} S_{s^{t} \lambda}(z_{j}) = sign(\theta_{j})(|\theta_{j}|-s^{t} \lambda)_{+}. \end{equation} In this, \((x)_{+}\) is shorthand for max(x,0) and \(s^{t}\) is the step size. Henceforth, \(\lambda\) is assumed to encompass both the penalty and the step size \(s^{t}\). This procedure is only used to update parameters that are subject to penalty. Non-penalized parameters are updated only using step 1 from above. However, in testing with larger SEMs, the use of only the gradient for minimization has been found to cause problems. Particularly at higher penalties, estimation of both observed and latent variances can become difficult, as these parameter estimates can become inflated if the optimization routine has a hard time finding an optima. Due to this, for larger models it is recommended to use a quasi-Newton method, specifically the BFGS (Broyden-Fletcher-Goldfarb-Shanno) algorithm. This method involves computing approximations to the Hessian matrix of the objective function, in which step 1 above is replaced with: \begin{equation} z = \theta^{t} - s^{t} H^{-1} \nabla g(\theta^{t}). \end{equation} Although calculating the approximation to the Hessian is computationally intensive, this minimization method paired with a backtracking rule for finding the step size (\(s^{t}\)) has been found to be only slightly slower than gradient descent. However, more testing is needed to determine more specifically which settings each of the optimization methods may be preferential. \section{Types of Penalties}\label{types-of-penalties} Outside of both ridge and lasso penalties, a host of additional forms of regularization exist. \subsection{Elastic Net}\label{elastic-net} Most notably, the elastic net \citep{zou2005regularization} encompasses both the ridge and lasso, reaching a compromise between both through the addition of an additional parameter \(\alpha\), manifesting itself as \[ P_{enet}(\theta_{j}) = (1-\alpha)\| \theta_{j} \|_{2} + \alpha\| \theta_{j} \|_{1} \] with a soft-thresholding update of \[ S(\theta_{j})= \begin{cases} 0,& |\theta_{j}| < \alpha\lambda\\ \frac{sgn(\theta_{j})(|\theta_{j}|-\alpha\lambda)}{1+(1-\alpha)\lambda}, & |\theta_{j}|\geq\alpha\lambda \end{cases} \] When \(\alpha\) is zero, ridge is performed, and conversely when \(\alpha\) is 1, lasso regularization is performed. This method harnesses the benefits of both methods, particularly when variable selection is warranted (lasso), but there may be collinearity between the variables (ridge). \subsection{Adaptive Lasso}\label{adaptive-lasso} In using lasso penalties, difficulties emerge when the scale of variables differ dramatically. By only using one value of \(\lambda\), this can add appreciable bias to the resulting estimates \citep[e.g.][]{fan2001variable}. One method proposed for overcoming this limitation is the adaptive lasso \citep{zou2006adaptive}. Instead of penalizing parameters directly, each parameter is scaled by the un-penalized estimated (MLE parameter estimates in SEM). The adaptive lasso results in: \[ F_{alasso} = F_{ML} + \lambda \| \theta_{ML}^{-1} * \theta_{pen} \|_{1} \] with, following the same form for the lasso, the soft-thresholding update is: \[ S(\theta_{j})= sign(\theta_{j})(|\theta_{j}|-\frac{\lambda}{2|\theta_{j}|})_{+} \] In this, larger penalties are given for non-significant (smaller) parameters, limiting the bias in estimating larger, significant parameters. Note that one limitation of this approach for SEM models is that the model needs to be estimable with MLE. Particularly for models with large numbers of variables, in relation to sample size, this may not be possible. \subsection{Sparse Extensions}\label{sparse-extensions} \begin{figure} \centering \includegraphics[width=.5\linewidth]{penalties} \caption{Comparison of types of penalties with $\lambda=0.5$} \end{figure} Two additional penalties that overcome some of the deficiencies of the lasso, producing sparser solutions, include the smoothly clipped absolute deviation penalty \citep[SCAD;][]{fan2001variable} and the minimax concave penalty \citep[MCP;][]{zhang2010nearly}. In comparison to the lasso, both the SCAD and MCP have much smaller penalties for large parameters, where the amount of penalty for small penalties is similar to the lasso, as is evident in Figure 2. The SCAD takes the form of: \[ pen_{\lambda,\gamma}(\theta_{j}) = \lambda \big\{I(\theta_{j}\leq\lambda) + \frac{(\gamma \lambda-0)_{+}}{(\gamma-1)\lambda}I(\theta_{j}>\lambda)\big\} \] with a soft-thresholding update of \[ S(\theta_{j})= \begin{cases} S(\theta_{j},\lambda),& |\theta_{j}| \geq 2\lambda\\ \frac{\gamma-1}{\gamma-2}S(\theta_{j},\frac{\lambda\gamma}{\gamma-1}), & 2\lambda < |\theta_{j}|\leq\alpha\lambda\\ \theta_{j} & |\theta_{j}| > \lambda \gamma \end{cases} \] for \(\gamma > 2\). As the the penalty in equation 11 is non-convex (as is the MCP), this makes the computation more difficult. However, in the context of SEM this can be seen as less problematic, as equation 3 is also non-convex. Additionally, the MCP takes the form of: \[ pen_{\lambda,\gamma}(\theta_{j}) = \lambda\bigg(|\theta_{j}|-\frac{\theta_{j}^{2}}{2\lambda\gamma}\bigg)I(|\theta_{j}|<\lambda\gamma) +\frac{\lambda^{2}\gamma}{2}I(|\theta_{j}|\geq \lambda\gamma) \] with a soft-thresholding update of \[ S(\theta_{j})= \begin{cases} \frac{\gamma}{\gamma-1}S(\theta_{j},\lambda),& |\theta_{j}| \leq \lambda\gamma\\ \theta_{j} & |\theta_{j}| > \lambda \gamma \end{cases} \] for \(\gamma > 0\). As seen in Figure 2, this results in similar amount of shrinkage for smaller estimates in comparison to the SCAD, however, less for larger estimates. For both the SCAD and MCP, both the \(\gamma\) and \(\lambda\) parameters are used as hyper-parameters. This involves testing models over a two-dimensional array of parameters, however, in \textit{regsem}, \(\gamma\) is by default fixed to 3.7 per \citet{fan2001variable}. \section{Implementation}\label{implementation} RegSEM is implemented as the \textit{regsem} package \citep{jacobucci2016package} in the \textit{R} statistical environment \citep{statspackage}. To estimate the maximum likelihood fit of the model, \textit{regsem} uses \textit{Reticular Action Model} \citep[RAM;][]{McArdle_1984, mcardle2005} notation to derive an implied covariance matrix. The parameters of each SEM are translated into three matrices: the \textit{filter} (\textit{F}), the \textit{asymmetric} (\textit{A}; directed paths; e.g.~factor loadings or regressions), and the \textit{symmetric} (\textit{S}; undirected paths; e.g.~covariances or variances). See \citet{jacobucci2016regularized} for more detail on RAM notation and its application to RegSEM. Syntax for using the \textit{regsem} package is based on the \textit{lavaan} package \citep{rosseel2012} for structural equation models. \textit{lavaan} is a general SEM software program that can fit a wide array of models with various estimation methods. To use \textit{regsem}, the user has to first fit the model in \textit{lavaan}. Note that particularly in cases that the number of variables is larger than the sample size, the model in lavaan does not need to converge, let alone run. In this case, the \textbf{do.fit=FALSE} argument in lavaan can be used. Additionally, regsem only works with models that assume the variables are continuous, thus none of the additional options in lavaan that accomodate categorical variables (e.g.~the WLSMV estimator with ordered indicators) are available. As a canonical example, below is the code for a confirmatory factor analysis model with one latent factor and seven indicators from the \textit{bfi} dataset from the \textit{psych} package \citep{revelle2014psych}. \begin{Shaded} \begin{Highlighting}[] \KeywordTok{library}\NormalTok{(psych);}\KeywordTok{library}\NormalTok{(lavaan)} \NormalTok{bfi2 <-}\StringTok{ }\NormalTok{bfi[}\DecValTok{1}\NormalTok{:}\DecValTok{250}\NormalTok{,}\KeywordTok{c}\NormalTok{(}\DecValTok{1}\NormalTok{:}\DecValTok{5}\NormalTok{,}\DecValTok{18}\NormalTok{,}\DecValTok{22}\NormalTok{)]} \NormalTok{bfi2[,}\DecValTok{1}\NormalTok{] <-}\StringTok{ }\KeywordTok{reverse.code}\NormalTok{(-}\DecValTok{1}\NormalTok{,bfi2[,}\DecValTok{1}\NormalTok{])} \NormalTok{mod <-}\StringTok{ "} \StringTok{f1 =~ NA*A1+A2+A3+A4+A5+O2+N3} \StringTok{f1~~1*f1} \StringTok{"} \NormalTok{out <-}\StringTok{ }\KeywordTok{cfa}\NormalTok{(mod,bfi2)} \CommentTok{#summary(out)} \end{Highlighting} \end{Shaded} After a model is run in lavaan, using \textbf{lavaan()} or any of the wrapper functions for fitting a model (i.e. \textbf{sem()}, \textbf{cfa()}, or \textbf{growth()}), the object is then used by the regsem package to translate the model into RAM notation and run using one of three functions: \textbf{regsem()}, \textbf{multi\_optim()}, or \textbf{cv\_regsem()}. The \textbf{regsem()} function runs a model with one penalty value, whereas \textbf{multi\_optim()} does the same but allows for the use of random starting values. However, the main function is \textbf{cv\_regsem()}, as this not only runs the model, but runs it across a vector of varying penalty values. textbf\{cv\_regsem()\} was originally created to solely use k-fold cross-validation to test penalties and choose a final model (hence the name). However, as it currently stands, it is recommended to run the model using the entire sample, paired with the use of an information criteria to choose a final model. The use of bootstrapping or k-fold cross-validation requires additional research and is discussed further in the Discussion. In the above one-factor model, each of the factor loadings can be tested with lasso penalties to determine whether each indicator is a necessary component of the latent factor. The first step is to identify which parameters are to be penalized, and pass this information to regsem. The easiest way to accomplish this is through the use of \textbf{extractMatrices()}: \begin{Shaded} \begin{Highlighting}[] \KeywordTok{library}\NormalTok{(regsem)} \KeywordTok{extractMatrices}\NormalTok{(out)$A} \end{Highlighting} \end{Shaded} \begin{verbatim} ## A1 A2 A3 A4 A5 O2 N3 f1 ## A1 0 0 0 0 0 0 0 1 ## A2 0 0 0 0 0 0 0 2 ## A3 0 0 0 0 0 0 0 3 ## A4 0 0 0 0 0 0 0 4 ## A5 0 0 0 0 0 0 0 5 ## O2 0 0 0 0 0 0 0 6 ## N3 0 0 0 0 0 0 0 7 ## f1 0 0 0 0 0 0 0 0 \end{verbatim} In this, \textbf{extractMatrices()} allows the user to examine how the lavaan model is translated into RAM matrices. Further, by looking at the \textit{A} matrix (directed paths which originate at the column name and go to the row name), one can identify the parameter numbers corresponding to the factor loadings of interest for regularization. For this model, the factor loadings represent parameter numbers one through seven, of which we pass directly to the \textbf{pars\_pen} argument of the \textbf{cv\_regsem()} function (if \textbf{pars\_pen=NULL} then all directed effects, outside of intercepts, are penalized). Additionally, if parameter labels are used in the lavaan model specification, these can be directly passed to regsem in the \textbf{pars\_pen} argument. Additionally, we pass the arguments of how many values of penalty we want to test (\textbf{n.lambda=15}), how much the penalty should increase for each model (\textbf{jump=.05}), and finally that lasso estimation is used (\textbf{type="lasso"}). \begin{Shaded} \begin{Highlighting}[] \NormalTok{out.reg <-}\StringTok{ }\KeywordTok{cv_regsem}\NormalTok{(out, }\DataTypeTok{type=}\StringTok{"lasso"}\NormalTok{, } \DataTypeTok{pars_pen=}\KeywordTok{c}\NormalTok{(}\DecValTok{1}\NormalTok{:}\DecValTok{7}\NormalTok{),}\DataTypeTok{n.lambda=}\DecValTok{23}\NormalTok{,}\DataTypeTok{jump=}\NormalTok{.}\DecValTok{05}\NormalTok{)} \end{Highlighting} \end{Shaded} The \textbf{out.reg} object contains two components, \textbf{out.reg\$fits} has the parameter estimates for each of the 15 models, \begin{Shaded} \begin{Highlighting}[] \KeywordTok{head}\NormalTok{(}\KeywordTok{round}\NormalTok{(out.reg$parameters,}\DecValTok{2}\NormalTok{),}\DecValTok{5}\NormalTok{)} \end{Highlighting} \end{Shaded} \begin{verbatim} ## f1 -> A1 f1 -> A2 f1 -> A3 f1 -> A4 f1 -> A5 f1 -> O2 f1 -> N3 ## [1,] 0.56 0.77 1.08 0.70 0.90 -0.03 -0.08 ## [2,] 0.53 0.74 1.05 0.66 0.87 0.00 -0.05 ## [3,] 0.50 0.72 1.03 0.62 0.84 0.00 -0.01 ## [4,] 0.47 0.69 1.01 0.58 0.81 0.00 0.00 ## [5,] 0.44 0.67 0.99 0.55 0.79 0.00 0.00 ## A1 ~~ A1 A2 ~~ A2 A3 ~~ A3 A4 ~~ A4 A5 ~~ A5 O2 ~~ O2 N3 ~~ N3 ## [1,] 1.52 0.69 0.53 1.84 0.88 2.45 2.29 ## [2,] 1.53 0.70 0.52 1.84 0.89 2.45 2.29 ## [3,] 1.53 0.70 0.52 1.85 0.90 2.45 2.30 ## [4,] 1.54 0.71 0.52 1.86 0.90 2.45 2.30 ## [5,] 1.55 0.71 0.51 1.87 0.91 2.45 2.30 \end{verbatim} while \textbf{out.reg\$fits} contains information pertaining to the fit of each model: \begin{Shaded} \begin{Highlighting}[] \KeywordTok{head}\NormalTok{(}\KeywordTok{round}\NormalTok{(out.reg$fits,}\DecValTok{2}\NormalTok{))} \end{Highlighting} \end{Shaded} \begin{verbatim} ## lambda conv rmsea BIC ## [1,] 0.00 0 0.08 5713.57 ## [2,] 0.05 0 0.08 5708.76 ## [3,] 0.10 0 0.08 5710.45 ## [4,] 0.15 0 0.08 5707.20 ## [5,] 0.20 0 0.09 5709.89 ## [6,] 0.25 0 0.09 5713.11 \end{verbatim} In this, the user can examine the penalty (lambda), whether the model converged (``conv''=0 means converged, whereas either 1 or 99 is non-convergence), and the fit of each model. By default, two fit indices are output, both the root mean square error of approximation \citep[RMSEA;][]{steiger1980}, and the Bayesian information criteria \citep[BIC;][]{schwarz1978estimating}. Both the RMSEA and BIC take into account the degrees of freedom of the model, an important point for model selection in the presence of lasso penalties (and other penalties that set parameters to zero). \citet{Zou2007} proved that the number of nonzero coefficients is an unbiased estimate of the degrees of freedom for regression. As the penalty increases, select parameters are set to zero, thus increasing the degrees of freedom, which for fit indices that include the degrees of freedom in the calculation, means that although \(F_{ML}\) may only get worse (increase), both the RMSEA and BIC can improve (decrease). Instead of examining the \textbf{out.reg\$fits} output matrix of parameter estimates, users also have the option to plot the trajectory of each of the penalized parameters. This is accomplished with \begin{Shaded} \begin{Highlighting}[] \KeywordTok{plot}\NormalTok{(out.reg,}\DataTypeTok{show.minimum=}\StringTok{"BIC"}\NormalTok{)} \end{Highlighting} \end{Shaded} \includegraphics{unnamed-chunk-7-1.pdf} After a final model (penalty) is chosen, users have the option either just use the output from \textbf{cv\_regsem()}, or the final model can be re-run with either \textbf{regsem()} or \textbf{multi\_optim()} to attain additional information. In the model above, the best fitting penalty, according to the BIC, is \(\lambda=0.15\). \begin{Shaded} \begin{Highlighting}[] \KeywordTok{summary}\NormalTok{(out.reg)} \end{Highlighting} \end{Shaded} \begin{verbatim} ## CV regsem Object ## Number of parameters regularized: 7 ## Lambda ranging from 0 to 1.1 ## Lowest Fit Lambda: 0.15 ## Metric: BIC ## Number Converged: 23 \end{verbatim} Instead of having to re-run the model with \textbf{regsem()} to get the final parameter estimates, a user can specify what fit index should be used to choose a final model with \textbf{metric = }in \textbf{cv\_regsem()}. These estimates are printed in: \begin{Shaded} \begin{Highlighting}[] \NormalTok{out.reg$final_pars} \end{Highlighting} \end{Shaded} \begin{verbatim} ## f1 -> A1 f1 -> A2 f1 -> A3 f1 -> A4 f1 -> A5 f1 -> O2 f1 -> N3 A1 ~~ A1 ## 0.467 0.692 1.006 0.584 0.811 0.000 0.000 1.540 ## A2 ~~ A2 A3 ~~ A3 A4 ~~ A4 A5 ~~ A5 O2 ~~ O2 N3 ~~ N3 ## 0.707 0.515 1.859 0.903 2.448 2.298 \end{verbatim} Additional fit indices can be attained through the \textbf{fit\_indices()} function if only one model was run with either \textbf{regsem()} or \textbf{multi\_optim()}. These same fit measures can be accessed through \textbf{cv\_regsem()} through changing the defaults with the \textbf{fit.ret=c("rmsea","BIC")} argument. Finally, instead of assessing these fit indices on the same sample that the models were run on, a holdout dataset could be used. This can be done two ways: either with \textbf{cv\_regsem(...,fit.ret2="test")} or with \textbf{fit\_indices(model,CV=TRUE,CovMat=)} and specifying the name of the holdout covariance matrix. Structural equation modeling is hard, and pairing with regularization doesn't make it any easier. Given this, and the number of options available in the \textit{regsem} package, a Google group forum was created in order to answer questions and trouble shoot at \url{https://groups.google.com/forum/#!forum/regsem}. \section{Comparison}\label{comparison} To compare the different types of penalties in \textit{regsem}, we return to the the initial example of the latent growth curve model displayed in Figure 1. Using the same simulated data, the model can be run in \textit{lavaan} as \begin{Shaded} \begin{Highlighting}[] \NormalTok{mod1 <-}\StringTok{ "} \StringTok{i =~ 1*x1 + 1*x2 + 1*x3 + 1*x4} \StringTok{s =~ 0*x1 + 1*x2 + 2*x3 + 3*x4} \StringTok{i ~ c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9 + c10} \StringTok{s ~ c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9 + c10} \StringTok{"} \NormalTok{lav.growth <-}\StringTok{ }\KeywordTok{growth}\NormalTok{(mod1,dat,}\DataTypeTok{fixed.x=}\NormalTok{T)} \end{Highlighting} \end{Shaded} Comparing different types of penalties in \textit{regsem} requires a different specification of the \textbf{type} argument. The options currently include maximum likelihood (\textbf{"none"}), ridge (\textbf{"ridge"}), lasso (\textbf{"lasso"}; the default), adaptive lasso (\textbf{"alasso"}), elastic net (\textbf{"enet"}), SCAD (\textbf{"scad"}), and MCP (\textbf{"mcp"}). For the elastic net, there is an additional hyperparameter, \textbf{alpha} that controls the tradeoff between ridge and lasso penalties. This is specified as \textbf{alpha=} , which has a default of 0.5. Additionally, both the SCAD and MCP have the additional hyper parameter of \textbf{gamma}, which is specified as \textbf{gamma=} and defaults to 3.7 per \citet{fan2001variable}. For the purposes of comparison, each of the 20 covariate regressions were penalized using the lasso, adaptive lasso, SCAD, and MCP, and compared to the maximum likelihood estimates. In this model, the data were simulated to have two large effects (both \textbf{c1} parameters), two small effects (both \textbf{c2} parameters) and sixteen true zero effects (\textbf{c3-c10} parameters). Note that the covariates were simulated to have zero covariance among each variable. If there was substantial collinearity among covariates, the elastic net would be more appropriate to simultaneously select predictors while also accounting for the collinearity. The parameter estimates corresponding the the best fit of the BIC are has the fit of each model, resulting in Table 1, created using the \textit{xtable} package \citep{dahl2009xtable}. \begin{table}[ht] \centering \begin{tabular}{rrrrrr} \hline & MLE & lasso & alasso & SCAD & MCP \\ \hline $c1_{i}$ & 0.92* & 0.72 & 0.91 & 0.94 & 0.92 \\ $c2_{i}$ & 0.07 & 0.00 & 0.00 & 0.00 & 0.00 \\ $c3_{i}$ & 0.10 & 0.00 & 0.00 & 0.00 & 0.00 \\ $c4_{i}$ & 0.07 & 0.00 & 0.00 & 0.00 & 0.00 \\ $c5_{i}$ & 0.04 & 0.00 & 0.00 & 0.00 & 0.00 \\ $c6_{i}$ & -0.25 & 0.00 & 0.00 & 0.00 & -0.19 \\ $c7_{i}$ & 0.11 & 0.00 & 0.00 & 0.00 & 0.00 \\ $c8_{i}$ & -0.13 & 0.00 & 0.00 & 0.00 & 0.00 \\ $c9_{i}$ & -0.03 & 0.00 & 0.00 & 0.00 & 0.00 \\ $c10_{i}$ & 0.09 & 0.00 & 0.00 & 0.00 & 0.00 \\ $c1_{s}$ & 1.18* & 1.09 & 1.22 & 1.24 & 1.24 \\ $c2_{s}$ & 0.29* & 0.19 & 0.28 & 0.35 & 0.35 \\ $c3_{s}$ & 0.18 & 0.09 & 0.00 & 0.00 & 0.00 \\ $c4_{s}$ & -0.08 & 0.00 & 0.00 & 0.00 & 0.00 \\ $c5_{s}$ & -0.18 & 0.00 & 0.00 & 0.00 & 0.00 \\ $c6_{s}$ & 0.25* & 0.00 & 0.00 & 0.00 & 0.00 \\ $c7_{s}$ & -0.18 & -0.04 & 0.00 & 0.00 & 0.00 \\ $c8_{s}$ & 0.26* & 0.10 & 0.00 & 0.00 & 0.00 \\ $c9_{s}$ & -0.06 & 0.00 & 0.00 & 0.00 & 0.00 \\ $c10_{s}$ & 0.08 & 0.00 & 0.00 & 0.00 & 0.00 \\ BIC & 3465.28 & 3427.46 & 3415.05 & 3414.38 & 3417.20 \\ \hline \end{tabular} \caption{Parameter estimates for the final models across five estimation methods. Note that * represent significant parameters at p < .05 for maximum likelihood estimation.} \end{table} While every regularization method erroneously set both simulated true intercept effects as zero (non-significant in MLE), both the adaptive lasso and SCAD correctly identified every true zero effect. The lasso identified two false effects while the MCP mistakenly identified one. Additionally, the lasso estimation of the true effects was attentuated in comparison to the other regularization methods. This is in line with previous research \citep{fan2001variable}, necessitating the use of a two-step relaxed lasso method \citetext{\citealp{meinshausen2007relaxed}; \citealp[see][]{jacobucci2016regularized}} As expected given the small ratio between number of estimated parameters and sample size, MLE mistakenly identified 3 false effects as significant. To compare the performance of each penalization method further, particularly in the presence of a small parameter to sample size ratio, a small simulation study was conducted. The same model and effects was kept, but the sample size was varied to include 80, 200, and 1000 to demonstrate how MLE improves as sample size increases, while each of the regularization methods performs well regardless of sample size. Each run was replicated 200 times. For each regularization method, the BIC was used to choose a final model among the 40 penalty vales. The results are displayed in Table 2. \begin{table}[ht] \centering \begin{tabular}{rrrrrrr} \hline & N & ML & lasso & alasso & SCAD & MCP \\ \hline & 80.00 & 0.08 & 0.08 & \textbf{0.04} & 0.05 & 0.20 \\ False Positives & 200.00 & 0.06 & 0.05 & \textbf{0.02} & 0.03 & 0.06 \\ & 1000.00 & 0.05 & 0.08 & \textbf{0.01} & \textbf{0.01} & 0.02 \\ & 80.00 & 0.33 & \textbf{0.31} & 0.35 & 0.35 & 0.31 \\ False Negatives & 200.00 & \textbf{0.19} & \textbf{0.19} & 0.23 & 0.26 & 0.27 \\ & 1000.00 & \textbf{0.00} & \textbf{0.00} & \textbf{0.00} & 0.01 & 0.03 \\ \hline \end{tabular} \caption{Results from the simulation using the model in Figure 1. Each condition was replicated 200 times. False positives represent concluding that the simulated regressions of zero were concluded as nonzero. False negatives are concluding that either the simulated regression values of 1 or 0.2 are in fact zero. Bolded values represent the smallest error per condition.} \end{table} For false positives, the adaptive lasso demonstrated the best performance, where the performance of MLE leveled off at the 0.05 level at a sample size of 1000 as expected. For false negatives, lasso penalties demonstrated similar results to MLE. This was expected given the tendency of the lasso to under-penalize small coefficients in comparison to the other regularization methods. The adaptive lasso and SCAD demonstrated slightly worse results, however, outside of the MCP, each method made either zero or near zero errors at a sample size of 1000. The poor performance of the MCP may be in part due to fixing the \(\gamma\) penalty to 3.7. Varying this parameter may improve the performance of the method. In summary, the regularization methods demonstrated an improvement over maximum likelihood, particularly at small samples, for a model that had a large number of estimated parameters. \section{Discussion}\label{discussion} This paper provides an introduction to the \textit{regsem} package, outlining the mathematical details of regularized structural equation modeling \citep[RegSEM;][]{jacobucci2016regularized} and the usage of the \textit{regsem} package. RegSEM allows the use of regularization while keeping the structural equation model intact, adding penalization directly into the estimation of the model. The application of RegSEM was detailed using two example models: a latent growth curve model with 20 predictors of both the latent intercept and slope, along with a factor analysis with one latent factor. With the latent growth curve model, the small parameter to sample size ratio resulted in a larger number of false positives in using maximum likelihood estimation. In both the simulated example and the small simulation, the different types of regularization in \textit{regsem} demonstrated better false positive and negative rates in comparison to maxiumum likelihood across sample sizes. Broadly speaking, there is a growing amount of research into the integration between data mining methods and latent variable models. Specifically, beyond RegSEM, this has taken the form of item response theory and regularization \citep{sun2016latent}, other regularization and latent variable formulations \citep{fanc, huang2017penalized}, pairing both structural equation models with decision trees \citep{brandmaier2013}, exploratory psychological network analaysis \citep[e.g.][]{epskamp2016generalized}, along with many others. The amount of pairing between methods that have generally been housed in separate camps will only increase into the future. This type of research will be facilitated by the general upsurge in the creation of open source software that gives users a general framework to test models. This was the motivation behind creating the \textit{regsem} package, in that users can estimate models ranging from simple factor analysis models, to latent longitudinal models with few to many time points, and finally to models with a large number of latent and observed variables. The use of regularization allows for the estimation of much larger structural equation models than before. However, sample sizes in the social and behavioral sciences are typically not large. To estimate large models with small sample sizes invites increasing amounts of bias as demonstrated with the simulated data in this paper. Regularization can be used to reduce the complexity of the model, thus decreasing both the bias and variance. With highly constrained structural equation models, achieving model convergence can be particularly problematic in using \textit{regsem}. For instance, with the latent change score model \citep{mcardle2001latent}, Bayesian regularization methods have less difficulty in reaching convergence across chains \citep{jacobucci2017JackChapter}. With the recent advent of additional sparsity inducing priors, along with new forms of software such as Stan \citep{carpenter2016stan}, for some models it may be more appropriate to use these Bayesian regularization methods over their frequentist counterparts. In the realm of Bayesian regularization for structural equation models, although some research exists \citep{feng2017bayesian}, much more is warranted. Future research with \textit{regsem} should focus on a number of avenues. One is comparing the different forms of regularization, delineating which method may be best in which setting. Additionally, as structural equation models become larger, with the advent of much larger datasets, computational speed will become a principal concern. Although 40 penalties in the models tested above can be run in a matter of seconds on a standard laptop, larger models can take much longer. To handle this, future implementation with \textit{regsem} will test the inclusion of different types of optimization, specifically testing whether coordinate descent algorithms \citep{friedman2010regularization} can speed up convergence. Finally, although the use of bootstrapping or k-fold cross-validation is computationally intensive, these forms of resampling (paired with a fit index that does not have a penalty for the number of parameters, i.e. \(\chi^{2}\)) may produce better results for both ridge and elastic net penalties, where it is less clear how to take into account parameter shrinkage for choosing a final model. \subsection{Conclusion}\label{conclusion} This paper provided a brief overview on the use of the \textit{regsem} package as an implementation of regularized structural equation modeling. Because structural equation modeling encompasses a wide array of latent variable models, the \textit{regsem} package was created as a general package for including different forms of regularization into a host of latent variable models. RegSEM, and thus the \textit{regsem} package, has been evaluated in a wide array of SEM models, including confirmatory factor analysis \citep{jacobucci2016regularized}, latent change score models \citep{jacobucci2017JackChapter}, and mediation models \citep{serang2017xmed}. Future updates to \textit{regsem} will focus on decreasing the computational time of large latent variable models in order to provide an avenue of testing for researchers collecting larger and larger datasets. RegSEM is a method that operates at all ends of the data size spectrum: allowing for a reduction in complexity when the sample size is small, along with dimension reduction in the presence of large data (both \(N\) and \(P\)). \renewcommand\refname{References}
{'timestamp': '2017-09-11T02:11:02', 'yymm': '1703', 'arxiv_id': '1703.08489', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08489'}
arxiv
\section{\label{sec:level1}Introduction} Granger causality (GC) is a powerful tool for assessing directional interactions from time series data according to the notion of time lagged influence first proposed by Wiener \cite{wiener1956theory} and then formalized by Granger \cite{granger1969} and Geweke \cite{geweke1982, geweke1984} in the framework of vector autoregressive (AR) modeling of stochastic processes. Since its formulation, GC has gained increasing popularity and is nowadays ubiquitously employed in several scientific fields ranging from econometrics to social and climate sciences, neuroscience and physiology \cite{freeman1983granger,Smirnov2009,bressler2011,Porta2015}. The great success of this measure comes from its conceptual simplicity, data-driven nature, and relative ease of implementation. An additional appealing property of GC is the principled interpretation of its generalized probabilistic formulation, which is closely related to the the information-theoretic concept of transfer entropy \cite{barnett2009granger}. Many processes in physics, biology and other fields exhibit dynamics spanning multiple temporal scales \cite{Ivanov1999461,Thakor2009,Valencia20092202,chou2011wavelet,wang2013multiscale}. The multiscale properties of an observed stochastic process can be explored first resampling at different temporal scales the originally measured realization of the process, and then assessing the dynamical complexity of the rescaled series \cite{costa2002multiscale}. This approach has been followed with great success to quantify the multiscale behavior of the individual dynamics of scalar processes \cite{Thakor2009,Valencia20092202,chou2011wavelet,wang2013multiscale}. However, its extension to the multiscale computation of the information transfer between processes, though attempted in empirical studies \cite{Lungarella2007,paluvs2014cross}, is far less straightforward. In fact, the multiscale evaluation of lagged influence measures such as the GC is severely complicated by theoretical and practical issues \cite{barnett2015granger,solo2016state}. These issues arise from the rescaling procedure, which essentially consists in a filtering step eliminating the fast temporal scales (classically performed by averaging \cite{costa2002multiscale}) followed by a downsampling step that coarse-grains the time series around the selected scale. The filtering step leaves theoretically unchanged the GC values, but degrades severely their estimation affecting reliability, stability and data demand \cite{Barnett2011404}. The downsampling step is even more problematic, as it alters GC values in a way that was unknown until very recently \cite{barnett2015granger,solo2016state} and impacts consistently detectability and accuracy of GC estimates. For these reasons, research on the data-driven inference of the multiscale structure of coupled processes, though holding a great potential, is still largely undeveloped. In order to provide a formal extension of GC to multiscale analysis, here we introduce for the first time an analytical frame for its computation on linear multivariate stochastic processes subjected to averaging and downsampling. We exploit the theory of state space (SS) models \cite{Aoki1991,barnett2015granger,solo2016state} to yield exact GC values for for coupled processes observed at different time scales. The high computational reliability of the associated multiscale GC estimator is demonstrated in simulated AR processes and then used to explore, spanning a wide range of time scales, the patterns of information transfer between anthropogenic emissions and global temperatures. \section{Granger Causality} \subsection{Definition} To lay the groundwork for multiscale GC computation and introduce notations, we start resuming the calculation of GC for general multivariate processes \cite{granger1969,geweke1984}. Let us consider a discrete-time, stationary vector stochastic process composed of \textit{M} real-valued zero-mean scalar processes, $Y_n=[y_{1,n}\cdots y_{M,n}]^T$, $-\infty < n < \infty$, and assume the process $y_{j}$ as the \textit{target} and the process $y_{i}$ as the \textit{driver} (the remaining $M-2$ processes form the vector $Y_k$, where $k=\{1,\ldots,M \} \backslash \{i,j \}$). Then, denoting the present and the past of vector and scalar variables respectively as $Y_n$, $y_n$, and $Y_n^- = [Y_{n-1}^T Y_{n-2}^T \cdots]$, $y_n^-=[y_{n-1}y_{n-2}\cdots]$, GC from $y_{i}$ to $y_{j}$ (conditional on $Y_k$) quantifies the extent to which $y_{i,n}^-$ improves the prediction of $y_{j,n}$ above and beyond the extent to which $y_{j,n}$ is predicted by $y_{j,n}^-$ and $Y_{k,n}^-$. This definition is assessed in the time domain performing a regression of the present of the target on the past of all processes, yielding the prediction error $e_{j|ijk,n}=y_{j,n}-\mathbb{E}[y_{j,n}|Y_n^-]$, and on the past of all processes except the driver, yielding the prediction error $e_{j|jk,n}=y_{j,n}-\mathbb{E}[y_{j,n}|y_{j,n}^-,Y_{k,n}^-]$ ($\mathbb{E}$ is the expectation operator). The prediction error variances resulting from these "full" and "restricted" regressions, $\lambda_{j|ijk}=\mathbb{E}[e_{j|ijk,n}^2]$ and $\lambda_{j|jk}=\mathbb{E}[e_{j|jk,n}^2]$ are then combined to yield GC from $y_{i}$ to $y_{j}$ as \cite{geweke1984} \begin{equation} \label{eq:GC} F_{i\rightarrow j} = \ln \frac {\lambda_{j|jk}}{\lambda_{j|ijk}} . \end{equation} The measure (\ref{eq:GC}) is the log-likelihood ratio for the two linear regressions associated with the projections $\mathbb{E}[y_{j,n}|Y_n^-]$ and $\mathbb{E}[y_{j,n}|y_{j,n}^-,Y_{k,n}^-]$ \cite{barnett2015granger}. According to the axiomatic definition of transfer entropy and its equivalence (up to a factor 2) to Eq.(\ref{eq:GC}) for Gaussian variables \cite{barnett2009granger}, the GC can be interpreted as the rate of "information transfer" from driver to target. \subsection{State-Space Formulation} Following the derivations of a recent work by Barnett et al. \cite{barnett2015granger}, now we move to describe the computation of GC for state state space (SS) processes. The very well known linear SS representation of an observed multivariate process $Y$ is given by \cite{anderson1979optimal} \begin{subequations} \label{eq:eqSS} \begin{align} X_{n+1} &= \mathbf{A} X_{n} + W_{n} \label{eq:eqSSstate} \\ Y_n &= \mathbf{C} X_{n} + V_{n} \label{eq:eqSSobs} \end{align} \end{subequations} where $X$ is the state (unobserved) process, and $W$ and $V$ are zero-mean white noise processes with covariances {\boldmath$\Xi$}$\equiv$$\mathbb{E}[W_nW_n^T]$ and {\boldmath$\Psi$}$\equiv$$\mathbb{E}[V_nV_n^T]$, and cross-covariance {\boldmath$\Theta$}$\equiv$$\mathbb{E}[W_nV_n^T]$. The SS process has an equivalent representation, referred to as "innovations form" SS (ISS), evidencing the \textit{innovations} $E_n=Y_n-\mathbb{E}[Y_n|Y_n^-]$, i.e., the residuals of the linear regression of $Y_n$ on its infinite past $Y_n^-$, whose covariance matrix is {\boldmath$\Phi$}$\equiv$$\mathbb{E}[E_nE_n^T]$. The ISS representation, which is typically associated with Kalman filtering, is characterized by the state process $Z_n=\mathbb{E}[X_n|Y_n^-]$ and by the Kalman Gain matrix $\mathbf{K}$: \begin{subequations} \label{eq:eqISS} \begin{align} Z_{n+1} &= \mathbf{A} Z_{n} + \mathbf{K} E_{n} \label{eq:eqISSstate} \\ Y_n &= \mathbf{C} Z_{n} + E_{n} . \label{eq:eqISSobs} \end{align} \end{subequations} The SS and ISS representations share the state and observation matrices $\mathbf{A}$ and $\mathbf{C}$, and differ in the noise matrices ($\mathbf{\Xi},\mathbf{\Psi},\mathbf{\Theta}$) and ($\mathbf{K}, \mathbf{\Phi}$). To find the ISS parameters ($\mathbf{A},\mathbf{C},\mathbf{K},\mathbf{\Phi}$) from the SS parameters ($\mathbf{A},\mathbf{C},\mathbf{\Xi},\mathbf{\Psi},\mathbf{\Theta}$) it is necessary to solve a so-called discrete algebraic Ricatti equation (\textit{DARE}), formulated in terms of the state error variance matrix $\mathbf{P}$: \begin{equation} \label{eq:DARE} \begin{aligned} \mathbf{P} &= \mathbf{A}\mathbf{P}\mathbf{A}^T + \mathbf{\Xi} \\ &-(\mathbf{A}\mathbf{P}\mathbf{C}^T+\mathbf{\Theta}) (\mathbf{C}\mathbf{P}\mathbf{C}^T+\mathbf{\Psi})^{-1} (\mathbf{C}\mathbf{P}\mathbf{A}^T+\mathbf{\Theta}^T), \end{aligned} \end{equation} from which $\mathbf{K}$ and $\mathbf{\Phi}$ are obtained as \begin{equation} \label{eq:SStoISS} \begin{aligned} \mathbf{\Phi} &= \mathbf{C}\mathbf{P}\mathbf{C}^T + \mathbf{\Psi} \\ \mathbf{K} &= (\mathbf{A}\mathbf{P}\mathbf{C}^T + \mathbf{\Theta})\mathbf{\Phi}^{-1}. \end{aligned} \end{equation} Then, GC can be computed from the ISS parameters as follows \cite{barnett2015granger}. The error variance of the full regression is simply the $j-th$ diagonal element of the innovation covariance, $\lambda_{j|ijk}=\mathbf{\Phi}(j,j)$. The error of the restricted regression is obtained by forming a $submodel$ that excludes the driver process, i.e. considering a state space model with state equation (\ref{eq:eqISSstate}) and observation equation \begin{equation} \label{eq:SSreduced} Y_n^{(jk)}=\mathbf{C}^{(jk)} Z_n + E_n^{(jk)} \end{equation} where the superscript $^{(a)}$ denotes selection of the rows with indices $a$ of a matrix. Of note, this technique represents one of the key elements in the derivation of a rigorous formalism for defining the information flow between the states of both discrete stochastic mappings and continuous time stochastic systems \cite{XSLiang2016}. Here, we have that the submodel (\ref{eq:eqISSstate}, \ref{eq:SSreduced}) is an SS model with parameters ($\mathbf{A},\mathbf{C}^{(jk)},\mathbf{K}\mathbf{\Phi}\mathbf{K}^T, \mathbf{\Phi}(jk,jk),\mathbf{K}\mathbf{\Phi}(:,jk)$), which can be converted to an ISS model with innovation covariance $\mathbf{\Phi}^R$ solving the \textit{DARE} (\ref{eq:DARE},\ref{eq:SStoISS}), so that the restricted error variance becomes $\lambda_{j|jk}=\mathbf{\Phi}^R(j,j)$. This shows that GC can be computed numerically from the ISS parameters ($\mathbf{A},\mathbf{C},\mathbf{K},\mathbf{\Phi}$) of an observed process $Y$. \section{Multiscale Granger Causality} In this Section we develop our framework for the multiscale computation of GC for linear multivariate processes. Here we consider the most common operalization of GC, i.e. that grounded on the AR representation of multivariate processes \cite{granger1969,barnett2009granger,bressler2011,Porta2015}: \begin{equation} \label{eq:VAR} Y_n = \sum_{k=1}^{p}{\mathbf{A}_k Y_{n-k} + U_n}, \end{equation} where $p$ is the model order, $A_k$ are $M\times M$ matrices of coefficients, and $U_n=[u_{1,n}\cdots u_{M,n}]^T$ is a vector of $M$ zero mean Gaussian innovation processes with covariance matrix {\boldmath$\Sigma$}$\equiv$$\mathbb{E}[U_nU_n^T]$. To study the observed process $Y$ at the temporal scale identified by the scale factor $\tau$, we apply to each constituent process $y_m, m=1,\ldots,M$,the following transformation which performs a weighted average of $q$ consecutive samples of the process: \begin{equation} \label{eq:MSY} \bar{y}_{m,n} = \sum_{l=0}^{q}{b_{l} y_{m,n\tau-l}}. \end{equation} This rescaling operation corresponds to transform the original process $Y$ through a two-step procedure that consists of the following \textit{filtering} and \textit{downsampling} steps, performed respectively with a filter of order $q$ and a rate of downsampling equal to $\tau$. The filtering and downsampling steps yield respectively the processes $\tilde{Y}$ and $\bar{Y}$ defined as: \begin{subequations} \label{eq:AvgDws} \begin{align} \tilde{Y}_n &= \sum_{l=0}^{q}{b_l Y_{n-l}} , \label{eq:Avg} \\ \bar{Y}_n &= \tilde{Y}_{n\tau} , n=1,\ldots,N/\tau .\label{eq:Dws} \end{align} \end{subequations} The change of scale in (\ref{eq:MSY}) generalizes the averaging procedure originally proposed in \cite{costa2002multiscale}, which sets $q=\tau-1$ and $b_l=1/\tau$. In this study we identify the $b_l$ as the coefficients of a linear lowpass filter with cutoff frequency set at $f_{\tau}=1/2\tau$ to avoid aliasing in the subsequent downsampling step. Here, we develop a FIR filter of order $q$ using the window method and implementing a Hamming window \cite{oppenheimdigital}. The design of a causal filter which performs one-side filtering was chosen on purpose to avoid that past and future samples mix up in the filtering process with potentially harmful consequences on the evaluation of causality. The use of one-side filtering is in agreement with the adoption of a Euler forward scheme, rather than a central differencing scheme, in the definition of causal measures of information flow (see, e.g., \cite{XSLiang2014,XSLiang2015}). Moreover, the use of a FIR filter achieves better elimination of the fast temporal scales with respect to the averaging procedure commonly adopted in multiscale complexity analysis \cite{costa2002multiscale}; in our preliminary work \cite{faes2016multiscale} we have shown indeed that the use of simple averaging may induce the detection of spurious causal influences over uncoupled directions. Substituting (\ref{eq:VAR}) in (\ref{eq:Avg}), the filtering step leads to the process representation: \begin{equation} \label{eq:VARMAAvg} \tilde{Y}_n = \sum_{k=1}^{p}{\mathbf{A}_k \tilde{Y}_{n-k}} + \sum_{l=0}^{q}{\mathbf{B}_l U_{n-l}} \end{equation} where $\mathbf{B}_l= b_l \mathbf{I}_M$ ($\mathbf{I}_M$ is the $M\times M$ identity matrix). Hence, the change of scale introduces a moving average (MA) component of order $q$ in the original AR$(p)$ process, transforming it into an ARMA$(p,q)$ process. Then, exploiting the close relation between ARMA and SS models \cite{Aoki1991}, the process (\ref{eq:VARMAAvg}) is turned into an ISS model by defining the state process $\tilde{Z}_n=[Y_{n-1}^T \cdots Y_{n-p}^T U_{n-1}^T \cdots U_{n-q}^T]^T$ that, together with $\tilde{Y}_n$, obeys the state equations (\ref{eq:eqISS}) with parameters ($\tilde{\mathbf{A}},\tilde{\mathbf{C}}, \tilde{\mathbf{K}},\tilde{\mathbf{\Phi}}$), where \[\tilde{\mathbf{C}} = \begin{bmatrix} \mathbf{A}_1&\cdots&\mathbf{A}_p & \mathbf{B}_1&\cdots&\mathbf{B}_{q} \end{bmatrix}, \] \[\tilde{\mathbf{A}} = \begin{bmatrix} \tilde{\mathbf{C}}& & \\ \mathbf{I}_{M(p-1)}&\mathbf{0}_{M(p-1)\times M(q+1)}& \\ \mathbf{0}_{M\times M(p+q)}& & \\ \mathbf{0}_{M(q-1)\times Mp}&\mathbf{I}_{M(q-1)}&\mathbf{0}_{M(q-1)\times M} \end{bmatrix}, \] \[\tilde{\mathbf{K}} = \begin{bmatrix} \mathbf{I}_M & \mathbf{0}_{M\times M(p-1)} &\mathbf{B}_0^{-T} & \mathbf{0}_{M\times M(q-1)} \end{bmatrix}^T, \] and where $\tilde{\mathbf{\Phi}} = \mathbf{B}_0 \mathbf{\Sigma} \mathbf{B}_0^T$ is the covariance of the innovations $\tilde{E}_n=\mathbf{B}_0 U_n$. Moreover, the downsampled process $\bar{Y}_n$ can be put in ISS form directly from the ISS formulation of the filtered process $\tilde{Y}_n$: exploiting a recent result (theorem III in \cite{solo2016state}), we find that $\bar{Y}_n=\tilde{Y}_{n\tau}$ has an ISS representation with state process $\bar{Z}_n=\tilde{Z}_{n\tau}$, innovation process $\bar{E}_n=\tilde{E}_{n\tau}$, and parameters ($\bar{\mathbf{A}},\bar{\mathbf{C}},\bar{\mathbf{K}},\bar{\mathbf{\Phi}}$), where $\bar{\mathbf{A}}=\tilde{\mathbf{A}}^\tau$, $\bar{\mathbf{C}}=\tilde{\mathbf{C}}$, and where $\bar{\mathbf{K}}$ and $\bar{\mathbf{\Phi}}$ are obtained solving the \textit{DARE} (\ref{eq:DARE},\ref{eq:SStoISS}) for the SS model ($\bar{\mathbf{A}},\bar{\mathbf{C}},\mathbf{\Xi}_\tau, \tilde{\mathbf{\Phi}},\mathbf{\Theta}_\tau$) with \begin{equation} \label{eq:QSdown} \begin{aligned} \mathbf{\Theta}_\tau &= \tilde{\mathbf{A}}^{\tau-1} \tilde{\mathbf{K}}\tilde{\mathbf{\Phi}} \\ \mathbf{\Xi}_\tau &= \tilde{\mathbf{A}} \mathbf{\Xi}_{\tau-1} \tilde{\mathbf{A}}^T + \tilde{\mathbf{K}}\tilde{\mathbf{\Phi}}\tilde{\mathbf{K}}^T, \tau\geq 2 \\ \mathbf{\Xi}_1 &= \tilde{\mathbf{K}} \tilde{\mathbf{\Phi}} \tilde{\mathbf{K}}^T, \tau=1 . \end{aligned} \end{equation} \begin{figure}[ht] \includegraphics{Fig1_flt.png} \caption{\label{fig:scheme} Schematic representation of a linear multivariate AR process (left) and of its multiscale representation obtained through filtering (FLT) and downsampling (DWS) steps. At each step, an innovation state space (ISS) model can be defined which describes the multivariate process; then ISS submodels can be formed and, after solving a discrete algebraic Ricatti Equation (DARE), GC can be computed for any scale factor $\tau \geq 1$ ($\tau=1$ yields GC for the non-rescaled processes).} \end{figure} The overall procedure for multiscale analysis is depicted in Fig.~\ref{fig:scheme}: filtering with cutoff $f_{\tau}$ the AR($p$) process $Y$ yields an ARMA($p,q$) process, which is equivalent to an ISS process; the subsequent downsampling yields a different SS process, which in turn can be converted to the ISS form solving the \textit{DARE}. Thus, both filtered and downsampled processes are described by ISS models, whose parameters can be used to compute GC by forming a submodel in which the target is observed without considering the driver process (eq. (\ref{eq:SSreduced})) and solving the \textit{DARE} for this submodel. This procedure allows analytical computation of GC measures for multiscale (filtered and downsampled) processes, which is illustrated in the following for simulated and real time series. \section{Simulation Study} \label{sec:simu} \subsection{VAR process with time delayed causal interactions} Theoretical analysis and simulations are first performed for the bivariate AR process with equations: \begin{subequations} \label{eq:simuVAR} \begin{align} y_{1,n} &= c_{11} y_{1,n-d_{11}} + c_{12} y_{2,n-d_{12}} + u_{1,n} \\ y_{2,n} &= c_{22} y_{2,n-d_{22}} + c_{21} y_{1,n-d_{21}} + u_{2,n} \end{align} \end{subequations} with iid noise processes $u_{1,n}, u_{2,n} \sim \mathcal{N}(0,1)$. The parameters in (\ref{eq:simuVAR}) are set to generate autonomous dynamics with strength $c_{ii}$ and lag $d_{ii}$ for each scalar process $y_i$, and causal interactions with strength $c_{ij}$ and lag $d_{ij}$ from $y_j$ to $y_i$ ($i,j=1,2$). We consider two parameter configurations: unidirectional interaction at lag 2 from $y_1$ to $y_2$, obtained setting $c_{12}=0$ and $c_{21}=0.5, d_{21}=2$, where also autonomous dynamics are generated for $y_1$ but not for $y_2$ ($c_{11}=0.5, d_{11}=1, c_{22}=0$); bidirectional interactions with different lags and strengths ($c_{12}=0.75, d_{12}=2; c_{21}=0.5, d_{21}=7$) in the presence of autonomous dynamics for both processes ($c_{11}=c_{22}=0.5, d_{11}=d_{22}=1$). First, we study the exact values of multiscale GC obtained from the true AR parameters. The theoretical trends depicted in Figs.~\ref{fig:simu1} and ~\ref{fig:simu2} (black solid lines) document from the perspective of SS modeling the invariance of GC under filtering, already proven in \cite{Barnett2011404}. The behavior of the information transfer across multiple temporal scales is thus shaped by the downsampling step, revealing the tendency of GC to peak at scales corresponding with the lag of the imposed causal interactions: maximal information transfer is found at $\tau=2$ for $F_{1\rightarrow2}$ in the unidirectional scheme (Fig.~\ref{fig:simu2}a,b), and at $\tau=7$ for $F_{1\rightarrow2}$ and $\tau=2$ for $F_{2\rightarrow1}$ in the bidirectional scheme (Fig.~\ref{fig:simu2}c). The behavior is general, in the sense that it was observed also for different parameter configurations. \begin{figure}[ht] \includegraphics[width=8.8 cm]{simu1est.png} \caption{\label{fig:simu1} Multiscale GC analysis of the AR process (\ref{eq:simuVAR}) configured to unidirectional coupling from $y_1$ to $y_2$. Plots depict the theoretical values (black lines) and distribution of estimates (median: white lines; interquartile range: grey areas) of GC computed as a function of the time scale after filtering (FLT) and downsampling (DWS). Estimates are obtained using the na\"{\i}ve AR approach (a) and the proposed framework implemented using a lowpass FIR filter of order $q=6$ (b).} \end{figure} \begin{figure}[ht] \includegraphics[width=8.8 cm]{simu2est.png} \caption{\label{fig:simu2} Multiscale GC analysis of the AR process (\ref{eq:simuVAR}) configured to bidirectional coupling between $y_1$ and $y_2$. Plots and symbols are as in Fig.~\ref{fig:simu1}.} \end{figure} Next, we test reliability of multiscale GC estimates obtained from finite length realizations of (\ref{eq:simuVAR}) (a) following a na\"{\i}ve approach whereby GC is computed performing full and restricted regressions on the filtered and downsampled time series, and (b) performing AR identification on the original time series and then applying the new proposed framework to the estimated AR parameters \cite{[in this study AR models were identified through ordinary least squares and using the Bayesian Information Criterion (BIC) to set the model order as seen e.g. in ]marple1987digital}. Application of the two approaches to 100 process realizations of 500 points is depicted in Figs.~\ref{fig:simu1}a,~\ref{fig:simu2}a and in Figs.~\ref{fig:simu1}b,~\ref{fig:simu2}b respectively, and indicates the need of state-space analysis: while the computation of GC after filtering and downsampling returns strongly biased and highly variable estimates, the new framework yields accurate detection of GC across multiple scales. \subsection{VAR process with multiscale causal interactions} As a second simulation example, we consider the case of coupled stochastic processes displaying multiscale structure and scale-dependent causal interactions. Specifically, we consider the bivariate process $Y_n=[y_{1,n} y_{2,n}]^T$ obtained as the instantaneous mixing of pairs of scalar processes taken from the two bivariate AR processes $X_n=[x_{1,n} x_{2,n}]^T$ and $Z_n=[z_{1,n} z_{2,n}]^T$ : \begin{subequations} \label{eq:simuVARmix} \begin{align} x_{1,n} &= 1.9 x_{1,n-1} - 0.9025 x_{1,n-2} + u_{1,n} \\ x_{2,n} &= 0.5 x_{1,n-1} + u_{2,n} , \\ z_{1,n} &= 1.6929 z_{1,n-1} - 0.9025 z_{1,n-2} + w_{1,n} \\ z_{2,n} &= z_{1,n-1} + w_{2,n} , \\ y_{1,n} &= x_{1,n} + z_{2,n} \\ y_{2,n} &= x_{2,n} + z_{1,n} . \end{align} \end{subequations} In the bivariate processes $X$ and $Z$, autonomous dynamics are set for the subprocesses $x_1$ and $z_1$ according to Eqs. (\ref{eq:simuVARmix}a, \ref{eq:simuVARmix}c); the autonomous rhythms are obtained by placing a pole with modulus $\rho_{x_1}=\rho_{z_1}=0.95$ in the complex plane representation of each individual subprocess, and the phase of the poles is varied to obtain slow oscillations for $x_1$ ($\phi_{x_1}=0$) and faster oscillations for $z_1$ ($\phi_{z_1}=0.47$). Moreover, causal interactions are imposed from $x_1$ to $x_2$ and from $z_1$ to $z_2$ according to Eqs. (\ref{eq:simuVARmix}b, \ref{eq:simuVARmix}d); in this study, the variances of the uncorrelated innovations are set to $\lambda_{u_1}=0.25, \lambda_{u_2}=0.5,$ for the process $U$, and to $\lambda_{w_1}=1, \lambda_{w_2}=0.5,$ for the process $W$. Then, the mixing obtained with Eqs. (\ref{eq:simuVARmix}e, \ref{eq:simuVARmix}f) is such that the bivariate process $Y$ exhibits causal interactions from $y_2$ to $y_1$ visible at small time scales for the faster oscillations, as well as causal interactions from $y_1$ to $y_2$ visible at larger time scales for the slower oscillations. To test the ability of our framework to detect these multiscale behaviors, we performed VAR identification on realizations of 1000 data points of the observed process $Y$ and then computed the GC for temporal scales ranging from 1 to 15; the model order was optimized using the BIC criterion, and the order of the lowpass FIR filter was set to $q=6$. The results of the analysis are reported in Fig. \ref{fig:Simu_Rev}. The exemplary realizations shown in Fig. \ref{fig:Simu_Rev}(a) display multiscale patterns characterized by a slow rhythm (cycle of $\sim 70$ points) superimposed to faster oscillations (cycle of $\sim 13$ points); the multiscale GC analysis reveals that the direction of interaction is from $y_2$ to $y_1$ for the fast oscillations ($F_{y_2\to y_1}$ is maximum at low time scales), and from $y_1$ to $y_2$ for the slower rhythm ($F_{y_1 \to y_2}$ emerges at higher time scales when fast oscillations are filtered out). These results are confirmed by the analysis extended to several process realizations reported in Fig. \ref{fig:Simu_Rev}(b), which indicates that GC peaks at scale $\tau=2$ along the direction $y_2 \to y_1$, and at scales $\tau=4$ and $\tau=8$ along the direction $y_1 \to y_2$, thus detecting the multiscale patterns of bidirectional interaction imposed in the simulation. \begin{figure}[ht] \centering \includegraphics[width=8.7 cm]{Simu_Rev.png} \caption{\label{fig:Simu_Rev} Multiscale GC analysis of the bivariate process $Y$ defined as in Eq. (\ref{eq:simuVARmix}). Plots depict two exemplary realizations of the observed process $Y_n=[y_{1,n} y_{2,n}]$ together with the GC computed as a function of the time scale $\tau$ along the two directions of interaction (a) and the distribution of estimates (median: solid lines; interquartile range: shaded areas) obtained over 100 realizations of the process (b).} \end{figure} \section{Practical Application} \label{sec:appl} As a practical application, we consider the multiscale analysis of GC between carbon dioxide concentration ($CO_2$) and global temperature ($GT$). It is widely considered that the raise of $CO_2$ is a main cause of global warming \cite{Booth2012}, although the validity of such causal relation is still under debate. The problem of understanding the causes of climate change is usually tackled by numerical experiments using Global Climate Models \cite{Delworth2006} which aim at catching the complexity of climate dynamics. However, data-driven approaches, as GC, are also fruitful in assessing cause-effect relationships between temperature and external forcings. In \cite{Kodra2011} it has been shown that $CO_2$ Granger causes temperature, based on data from 1860 to 2008, partly from ice cores, and analyzing second differences of both $CO_2$ and $GT$. Similar conclusions were found in \cite{Attanasio2012}, using GC, in \cite{Stips2016} by estimating the time rate of information flowing from one time series to the other, and in \cite{Smirnov2009} using a physical approach. Here, we first analyze the global land-ocean temperature index \cite{GISS} and $CO_2$ concentration \cite{CO2} measured at monthly resolution from March 1958 to February 2017. The measured time series, lasting 708 data points, are shown in Fig.~\ref{fig:climate1}(a). To fulfill stationarity criteria, we de-trended the two series applying an L1 norm filter. The analyzed time series, normalized to zero mean and unit variance, are shown in Fig.~\ref{fig:climate1}(b). We applied the proposed framework to compute GC along the two directions of interaction for time scales ranging from 1 to 100 years. To test the statistical significance of the estimated multiscale patterns of causality, the analysis was performed both for the original time series and for a set of 100 pairs of uncoupled time series sharing the autocorrelation and amplitude distribution of the original series; these surrogate series are generated using the iterative amplitude-adjusted Fourier transform (IAAFT) algorithm \cite{SchreiberIAAFT}. The results depicted in Fig.~\ref{fig:climate1}(c) show that the GC along both directions is not distinguishable from the corresponding surrogate counterparts at $\tau$ equal one year, i.e. when standard GC analysis not encompassing multiple time scales is performed. On the other hand, the multiscale approach reveals, at longer time scales ($>$ 10 years), that GC is significantly higher than the surrogate threshold along both directions of interaction, thus showing the need of a multiscale approach to put in evidence this mutual interdependency between $CO_2$ and $GT$. Moreover we remark that the GC along the direction $CO_2 \to GT$ is characterized by a higher value of the statistics computed on the original time series, but also by higher values for the surrogate time series, compared with the direction $GT \to CO_2$. \begin{figure}[ht!] \includegraphics [width=8.5 cm] {TempCO2_modern_surro.png} \caption{\label{fig:climate1} Multiscale GC analysis of global temperature (GT) and CO$_2$ concentration for modern climate data. Plots depict: (a) the original GT and CO$_2$ time series; (b) the time series superimposed after de-trending and normalization; and (c) the multiscale GC computed on the normalized time series (solid lines) and over 100 IAAFT surrogates (median: white lines; $5^{th}-95^{th}$ percentiles: shaded areas). Computations are performed using the proposed framework implemented with an order-6 FIR lowpass filter. The AR model order, set by the BIC criterion, is $p=14$.} \end{figure} \begin{figure}[ht!] \includegraphics [width=8.5 cm] {TempCO2_paleo_surro.png} \caption{\label{fig:climate2} Multiscale GC analysis of global temperature (GT) and CO$_2$ concentration for paleoclimate data. Plots depict: (a) the original paleoclimatological time series; (b) the time series superimposed after uniform resampling of the time axis and normalization; and (c) the multiscale GC computed on the normalized time series (solid lines) and over 100 IAAFT surrogates (median: white lines; $5^{th}-95^{th}$ percentiles: shaded areas). Computations are performed using the proposed framework implemented with an order-6 FIR lowpass filter. The AR model order, set by the BIC criterion, is $p=3$.} \end{figure} Next, we dramatically change the time scales and turn to consider paleoclimatological data, so as to analyze the GC between $GT$ and $CO_2$ concentration on the Vostok Ice Core data from 400,000 to 6,000 years ago, extended by the EPICA Dome C data which go back to 800,000 years ago \cite{ICECORE}. The two time series, which are sampled with non-uniform time spacing, are shown in Fig.~\ref{fig:climate2}(a). Here, we studied the data resampled to an uniform time spacing of 729.77 years, corresponding to a time series length of 1095 points, and after normalization to zero mean and unit variance (Fig.~\ref{fig:climate2}(b)); results of multiscale GC analysis did not change substantially if the original non-uniformly sampled time series were considered, or applying slightly different uniform resampling. In \cite{Kang2014}, empirical evidences for the existence of Granger causal influences along both directions $CO_2 \to GT$ and $GT \to CO_2$ have been found after correcting for deterministic trends on the same data. Here, applying our framework for multiscale causality analysis we obtained the GC curves reported in Fig.~\ref{fig:climate2}(c). We find that, at paleolithic time scales, the GC $GT \to CO_2 $ is highly significant and peaks around 1000 and 10000 years. This result may be related to the lags between Antarctic deglacial warming and $CO_2$ increase reported in \cite{Caillon2003}, and also confirms the good evidences reported on the fact that higher global temperatures do promote a rise of greenhouse gas levels \cite{Scheffer2006}. The opposite causal influence from $CO_2$ to GT is much less pronounced and exceeds the IAAFT threshold for statistical significance only at very small time scales. Summarizing, our results show that carbon dioxide and temperature changes are interdependent at multiple time scales, with a predominance of $GT \to CO_2$ effects at paleolithic scales, and the presence of bidirectional causal interactions between $GT$ and $CO_2$ at the time scales of modern climate. These results support the expectations that changing temperatures could be held responsible for changes in greenhouse gas concentrations on paleolithic time scales, while during the last 60 years the effect of human activities becomes evident as anthropogenic radiactive forcings are seemingly driving the global temperature changes. These causal relationships between $CO_2$ and global warming have been recently demonstrated in \cite{Stips2016}: in that work, the use of the rigorous formulation of information flow provided by \cite{XSLiang2014} led to evidence a clear unidirectional nature for the causal relation $GT \to CO_2$ in paleoclimatological data, and for the causal relation $CO_2 \to GT$ in modern climate data; in the same work, the application of the standard GC index to modern climate data suggested the presence of bidirectional effects $CO_2 \to GT$ and $GT \to CO_2$, thus pointing to some ambiguity in the assessment of a predominant direction of interaction using GC. Our results agree with this interpretation, as we do not find a prevalent causal direction using the classical GC index computed at the smallest time scale, and the use of surrogate data indicates the lack of statistical significance (Fig. 5). Nevertheless, the analysis performed at higher time scales reveals the existence of significant GC $CO_2 \to GT$ and, for the first time to our knowledge, a nontrivial GC $GT \to CO_2$ also in modern climate. Although this result needs to be confirmed by the implementation of more robust measures of information flow, it may be of great relevance for climate studies as it is indicative of a positive feedback which will increase the effect of anthropogenic emissions on global temperatures. \section{Conclusions} \label{sec:concl} The present study makes the first step toward the theoretical understanding of multiscale causal relations between coupled stochastic processes, and opens the way to the reliable estimation of these relations starting from simple AR identification. This will likely boost new impetus for research in the area of data-driven causality analysis, both in physics and in a wide variety of applicative fields. The proposed framework is flexible enough to encompass more general model representations that may unveil important multiscale features of coupled processes. For instance, integrating the standard AR representation with fractional integrated (FI) innovation modeling \cite{sela2009computationally} would be straightforward as ARFI models have an SS representation, and would easily lead to assess multiscale GC in the presence of long-range correlations. The proposed setting provides also the basis to expand the applicability of multiscale GC to nonstationary and nonlinear SS processes \cite{kitagawa1987non}, and to formalize exact computation of cross-scale information transfer within and between multivariate processes \cite{paluvs2014cross}, thus opening new avenues of research in the evaluation of causal interactions among coupled processes. Of particular interest in this context is the recent formalization of the notion of information flow based on first principles, rather than axiomatic postulates or empirical proposals, implemented in \cite{XSLiang2016}. The latter work completes the rigorous formalism introduced in \cite{LIANG20071,LIANG2007173} and provides a well-principled alternative to the operational implementation of GC, and of transfer entropy intended as its non-parametric generalization, which are known to be complicated in many practical settings to an extent that spurious causalities may be revealed (e.g., in the presence of unobserved variables, measurement noise, or inappropriate time resolution) \cite{SmirnovSpurious, HahsPethel, NalatoreMitigating, ChicharroAlgorithms}. Hence, the availability of a rigorous derivation of the information flowing among the components of discrete time stochastic mapping, provided in \cite{XSLiang2016} and extended therein to continuous time stochastic mappings and to deterministic systems, certainly constitutes a firm basis for the design of a more faithful analysis of causality between dynamical system components operated across multiple temporal scales. \nocite{*}
{'timestamp': '2017-10-27T02:01:00', 'yymm': '1703', 'arxiv_id': '1703.08487', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08487'}
arxiv
\section{Introduction} \IEEEPARstart{P}{eer-to-peer} systems are autonomous and distributed dynamic resource-sharing networks. Collectively, the resources of many autonomous users builds an economic and highly scalable platform for data-sharing, storage and distributed computing etc. In these systems, it is peremptory for peers to voluntarily contribute resources which includes storage, bandwidth and data content etc. However, instinctively, each peer would prefer to ''free ride'' on the part of other peers by consuming available resources and services without contributing anything back, and thus avoid the corresponding costs. It was reported that nearly 70\% of Gnutella users share nothing with other users (these users simply free-ride on other users who share information), and nearly 50\% of all file search responses come from the top 1\% of information sharing nodes \cite{adar2000free}. In a follow-up study (5 yr later), it was found that 85\% of users share nothing \cite{hughes2005free}, which implies the free-riding problem had got worse in the intervening years. Generally, the lack of cooperation and so free riding is a major problem in these autonomous resource sharing networks \cite{karakaya2009free}, \cite{karakaya2008counteracting}, \cite{feldman2005overcoming}. Designer of P2P system can consider either of two ways for resource management in these systems: resource allocation in which the designer should decide whether and what percentage of a good (with given predefined capacity) each peer should consume and resource provision in which the designer's task is to entice independent participant to provide resource (with its right share). Both mechanisms in a way or other use the reputation of the peers. Ideally, reputation should be the measure of cooperative behavior of a node which is an abstract quantity and a private information of a node. So, it is difficult to measure the cooperative behavior of a node and we can only measure its implications with some degree of uncertainty. However, it can be estimated with certain accuracy on the basis of behavior observed by a node. A number of mechanisms have been proposed in literature \cite{buragohain2003game, lee2003cooperative, dutta2003design, papaioannou2006reputation, andrade2004discouraging, marti2004limited, kamvar2003eigentrust, xiong2004peertrust, zhou2007powertrust, zhou2008gossiptrust} for calculation of reputation. A considerable amount of work has already been done on resource allocation \cite{satsiou2010reputation}, \cite{gupta2015reputation} and resource provisioning \cite{wang2015vpef} using reputation. Reputation based resource allocation mechanisms play a crucial role to encourage cooperation among autonomous nodes. Research till now reveals that reputation calculation is useful to entice the cooperation, but the evolutionary stability of the reputation system is yet to be investigated. In this work, we have analyzed the reputation system for understanding the conditions of evolutionary stability of the system. Reputation systems always tend to give more benefit to those nodes which are contributing more to the system. But as calculation of reputation of the node requires some cost so, cooperators ($C$ strategy users) who are not calculating reputation always gets more benefit when they interact with reputation calculators ($R$) as compare to $R$ users when they interact with another $R$ users. Due to this $R$ strategy is not evolutionary stable strategy if there is not extra benefit. In this work, we have analyzed a payment based mechanism which gives the required benefit to the reputation strategy so that it could be evolutionary stable. In our work, for the sake of simplicity we considered only discrete value full contribution, full defection and reputation calculation with full contribution as a strategic choice. Main findings of this paper are listed as follows: \begin{enumerate} \item The threshold of the number of `reputation calculator' $R$ strategy users which if keep fixed then cooperators always gets higher payoff than defectors and so `free riding' can be controlled. \item The threshold of the number of $R$ strategy users which if keep fixed then reputation strategy users always gets higher payoff than defectors. \item If we allow reputation as the optional strategy then in general conditions (without any extra benefit to $R$ and $C$ strategy users) $R$ strategy is not an equilibrium strategy. \item If we impose some initial payment and distribute that initial payment among the players who are calculating the reputation then reputation is evolutionary stable strategy for a threshold of initial payment. \end{enumerate} \section{Related Work} In literature a lot of study has been done for estimation of reputation. Buragohain et.al. \cite{buragohain2003game} take the ratio of resource contributed by the node to the ratio of absolute measure of contribution, whether they does not discuss the mechanism to measure of contributions of a node by the receiving node. In \cite{lee2003cooperative} the receiving node computes the trust value of a node on the basis of received data in the transactions with the sending node. Duttay et.al. \cite{dutta2003design} suggest that each node should provide rating to the other node on the basis of service provided by the user and then this rating is supervised by a group of users. This scheme uses the reputation in the form of rating. In \cite{papaioannou2006reputation} each node calculates reputation of other node on the basis of service received from the other nodes depending upon number of transactions done with those nodes, delay in the transactions and the download speed. Andrade et.al. \cite{andrade2004discouraging} calculates the reputation of a node by taking the difference of resources received from and provided to the node. In \cite{marti2004limited},\cite{kamvar2003eigentrust},\cite{xiong2004peertrust},\cite{zhou2007powertrust} and \cite{zhou2008gossiptrust}, a node adjusts the reputation of other node on the basis of quality of transactions with that node. Eigen-Trust \cite{kamvar2003eigentrust} uses sum of positive and negative ratings, Peer-Trust \cite{xiong2004peertrust} normalises the rating on each transaction whereas Power-Trust \cite{zhou2007powertrust} uses Bayesian approach to calculate reputation locally. Some resource allocation and resource provision schemes using generosity level of the peers has been investigated. Feldman et al.\cite{feldman2004robust} estimated generosity of node as the ratio of the service provided by the node to the service received by the node. Nodes will be served as per their estimated generosity. Kung et al. \cite{kung2003differentiated} proposed selection of a peer for allocation of resource according to its contribution to the network and usage of resources. Nodes desirous to receive resources have to contribute above a certain level to the network. Meo et al. \cite{meo2005rational} model the resource allocation problem as competition among all requesters on the basis of resource request amount. Resource is allocated to the requesters who are demanding least. In this work author asumed all the requesters as generous means: it does not want not to share, but to share as little as possible. Later the term generosity level of the peer is replaced by the reputation of the peer and some new resource allocation and resource provision schemes worked on this. In \cite{satsiou2010reputation} Satsiou et al. proposes the distributed reputation-based system. They propose the algorithm which maximizes requesters satisfactions as well as maximizes the download capacity of the user so as to its utility. In \cite{gupta2015reputation} Gupta et al. uses the probabilistic approach to allocate the resources on the basis of reputation. They argue that by using this scheme nodes that don't have very good reputation about each other, may also serve each other at least some amount of resource with finite probability. For avoiding whitewashing in unstructured peer to peer to network Gupta et al in \cite{gupta2013avoiding} proposes a reputation based resource allocation mechanism in which the initial reputation is adjusted according to the level of whitewashing in the network. In \cite{lai2003incentives} Lai et al. uses the decision function that takes shared and subjective history of the previous interactions in deciding whether to cooperate or defect with the requester. Ma et al. in \cite{ma2006incentive} proposes a water filling squared bucket algorithm. In which the width of the bucket is the contribution level of the user and the height is the required demand of the user. The allocation is given on the basis of shorter height first. This mechanism ensures the maximization of individual and social utility. In \cite{ma2006demand} Ma et al. allocate the resources to the users on the basis of their contribution level and requested bandwidth. Yan et al. in \cite{yan2007ranking} uses the contribution level as the ranking of the user and allocate the resources on the basis of the ranking of the user. All of these schemes considered reputation calculation as compulsory for all the nodes and on the basis of reputation they impose their allocation scheme. But we in this work analyze reputation calculation as a strategy of the user and found that whether a lot of resource allocation mechanism has been given but even reputation calculation is not an evolutionary stable strategy. For making reputation as an evolutionary stable strategy we devise a mechanism for the autonomous peer-to-peer system so that it could be an evolutionary stable strategy. In \cite{wang2015vpef} VPEF propose Evolutionary Game Theory based mechanism, VPEF (Voluntary Principle and round-based Entry Fee), to enforce cooperation in the society. In VPEF author modeled the interaction among the users as public goods game, whereas we modeled the interaction as two player strategic game because all the reciprocation in peer-to-peer network are pairwise interaction. Same as in VPEF we also incorporate round based entry fees. VPEF highlights the role of selection of different strategies whereas we highlight the role of stability of strategies against mutation. In \cite{seredynski2009evolutionary} author, evolutionary game theoretically analysed the reputation strategy in a mobile ad hoc network using simulation and as of their strategic game reputation strategy is not evolutionarily stable strategy. They are minimizing the possibilities of invading of reputation strategy by always defect strategy. As of the anonymous, autonomous and dynamic nature of the peer-to-peer network author in \cite{wang2011effectiveness} proposes the mechanism in which some cooperators first behave like generous,and then like harsh according to peers' current behaviors. One of the weak-point of the above scheme is whether the punisher will dominate the system, but neither punishment nor cooperation is evolutionary stable strategy. \section{Modeling of Reputation system as a game} In this paper, we have used peer, user, node and agent interchangeably. Peer-to-peer network has been assumed as pure i.e., without any central server with total $N$ number of peers . We also assume that any two peers in the network can interact with each other. A P2P system without any punishment and reward mechanism can simply be modeled as famous Prisoners' Dilemma game in which defection always strictly dominates cooperation strategy. The cooperation strategy can only survive in the system when it can dominate the defection strategy. In the reputation based resource allocation mechanisms, reputation is calculated by the peers. Resources are allocated to the resource requesting peers based on their reputation. Reputation management is a tool to punish the defectors but on the cost of reputation calculation. Peers prefer to save this additional cost involved in reputation calculation. Therefore, most of the cooperators does not calculate reputation and only cooperate. If the fraction of reputation calculators in the population comes to lower than a threshold, this leads to the domination of defectors and consequent collapse of system. The threshold can be calculated by modeling whole situation as a strategic game. Although, a user can interact with multiple other users at a time but as each interaction is independent from other interactions, hence we can model all these interactions as pairwise interaction game between two users. We model this phenomena as a symmetric simultaneous game where both players make their moves simultaneously. \subsection{General Reputation Game} Here peer's strategy may be classified into three types viz. Reputation Calculation with cooperation ($R$), Cooperation ($C$), Defection ($D$). Users playing $R$ strategy always provide requested services as per the reputation of the requesters; Users playing $C$ strategy always provide the requested services to all users; Users playing $D$ strategy always deny any requested service. Therefore, reputation system is modeled as the strategic game.\\ \textbf{Players}:- User1, User2\\ \textbf{Strategies}:- Reputation Calculation with cooperation ($R$), Cooperation ($C$), Defection ($D$)\\ \textbf{Preferences} \begin{eqnarray} \nonumber && U_i(A_i,A_{-i})= (^C l_{-i} \cdot (1- ^Rl_{-i}) + ^Cl_{i} \cdot ^Rl_{-i} \cdot ^Cl_{-i}) \cdot d \\\nonumber && - (^Cl_{i} \cdot (1- ^Rl_i) + ^Cl_{-i} \cdot ^Rl_i)\cdot a - ^Rl_i \cdot \alpha + \\ && (^Cl_i \cdot ^Rl_{-i}) \cdot \beta \end{eqnarray} where $A_i$ and $A_{-i}$ are the actions of player $i$ and other than player $i$ respectively. $^Cl_i$ is the cooperation level of player $i$ and $^Rl_i$ is the reputation calculation level of player $i$ respectively.\\ For $C$ (cooperation) strategy : $^Cl = 1$ and $^Rl = 0$. Because these users are always cooperating and not calculating reputation. Similarly for R (reputation calculation with cooperation) strategy : $^Cl = 1$ and $^Rl = 1$, for $D$ (defection) strategy : $^Cl = 0$ and $^Rl = 0$\\ In the preference function the first term represents the `benefit of sharing', the benefit of sharing resources can only be obtained by first user when the second user is either cooperator ($C$) or when the first player is either cooperator or reputation calculator user ($C$ and $R$) and second player is reputation calculator ($R$) user. The second term represents the `cost of sharing', the cost of sharing will only be imposed when the player is either cooperator or he is reputation calculator and second player is cooperator. Third term represents the `cost of reputation calculation' which is always incurred when the first user is reputation calculator ($R$) user. Fourth term is the `benefit of reputation increment'. The payoff matrix of the game is illustrated in table \ref{First_Game}. In this matrix, row corresponds to the possible actions of peer A whereas, column corresponds to the possible actions of peer B and the values in each box are the players' payoffs to the action profile to which the box corresponds, with A's payoff listed first. Each first value $a_{ij}$ of this table symbolizes the payoff of A with strategy $S_i$, when B opts for strategy $S_j$. Take the first value $a_{12}$ for instance, the value $d-a-\alpha$ is the payoff of A with R strategy when B opts $C$ strategy where $a$ and $\alpha$ is the cost incurred due to providing the service to the other player and the cost incurred due to calculation of reputation respectively. In this $\alpha<a$ as the `cost of reputation calculation' is always less than `cost of sharing', otherwise $R$ strategy users loss is more than $C$ strategy users when they play with $D$ strategy users and so will always prefer only to cooperate without calculation of reputation. If a user with $R$ strategy meets a user with $C$ strategy, it will always grant a service to $C$ strategy user and get a service from the $C$ strategy user. Thus, it would obtain a benefit $d-a$. However, to calculate the reputation of the peers, the user with $R$ strategy has to communicate to the other peers for information. So it has to bear an extra cost $\alpha$. Therefore, the total payoff of user with $R$ strategy in this transaction is $d-a-\alpha$. In this $d>a$ as the benefit received by shared data is always greater than the cost of sharing. Now consider the second value $b_{12}$ that is the payoff of A with $C$ strategy when B opts $R$ strategy. If a user with $C$ strategy meets a user with $R$ strategy it will always grant service and get a service from the $R$ strategy user. Thus, it would obtain a benefit $d-a$. However, due to its cooperative behavior its reputation would also increase, so it would get the extra benefit for reputation increment $\beta$. Therefore, the total payoff of a user with $C$ strategy in this transaction is $d-a+\beta$. \begin{table}[!t] \renewcommand{\arraystretch}{1.3} \caption{Simplistic Model} \label{First_Game} \centering \begin{tabular}{c c c c} { }&{R(B)} & {C (B)} & {D(B)}\\ \hline {R (A)} & \shortstack{$d-a-\alpha+\beta$,\\ $d-a-\alpha + \beta$} & \shortstack{$d-a-\alpha$,\\$d-a+\beta$} & {$-\alpha$,0}\\ \hline {C (A)} & {$d-a+\beta$,$d-a-\alpha$} & {$d-a$,$d-a$} & {$-a$,$d$}\\ \hline {D (A)} & {0,$-\alpha$} & {$d$,$-a$} & { 0,0}\\ \hline \end{tabular} \end{table} \begin{table}[!t] \renewcommand{\arraystretch}{1.3} \caption{symbols used in modeling the reputation game} \centering \begin{tabular}{c | c} \hline {Symbol} & {Definition} \\ \hline {$d$} & \shortstack{Benefit received by getting the service from the cooperator} \\ \hline {$a$} & {The cost incurred due to providing the service to the other player}\\ \hline {$\beta$} & {The benefit received due to improving the reputation}\\ \hline {$\alpha$} & {The cost incurred due to calculation of reputation}\\ \hline {$P_R$} & {Average Payoff of $R$ strategic Players}\\ \hline {$P_C$} & {Average Payoff of C strategic Players}\\ \hline {$P_D$} & {Average Payoff of D strategic Players}\\ \hline {$x_i$} & {The proportion of peers with strategy $i$}\\ \hline {$n_d$} & {Total number of D strategy users}\\ \hline {$n_r$} & {Total number of $R$ strategy users}\\ \hline {$n_c$} & {Total number of C strategy users}\\ \hline {$p$} & { Round based payment payed by users}\\ \hline \end{tabular} \end{table} \textbf{Analysis}:- In this game if $R$ strategy user interacts with $D$ strategy user, then he gets payoff $-\alpha$ and if $C$ strategy user interacts with $D$ strategy user, then he gets payoff $-a$ which are less than $0$. This shows that users does not have higher payoff in unilaterally deviation from profile $(D,D)$. Therefore $(D,D)$ is the pure strategic strict Nash equilibrium and consequently $D$ is the evolutionary stable strategy (ESS). \begin{equation} U_{1}(D,D) > U_{1}(x,D) \end{equation} where $x$ is any strategy other than $D$. \\ Let us assume that the population fraction of $R$, $C$ and $D$ strategies are $x_{R}$, $x_{C}$, and ($1-x_{R}-x_{C}$) respectively. Therefore, the average payoff of each strategy is written as \begin{eqnarray} P_{R} &=& d \cdot (x_{R}+x_{C}) - a \cdot(x_{R}+x_{C}) + x_{R} \cdot \beta - \alpha\\ P_{C} &=& d \cdot (x_{R}+x_{C}) - a + x_{R} \cdot \beta\\ P_{D} &=& x_{C} \cdot d. \end{eqnarray} From the above equations following observations can be made. \begin{itemize} \item If the reputation calculation cost $\alpha$ is assumed to be negligible, then the expected payoff for $R$ strategy users will always be greater than the $C$ strategy users till there are $D$ strategy users as in this case $x_{R}+x_{C}$ is less than 1 and it will be equal when there is no $D$ strategy user \item The payoff received by $R$ strategy will be higher than the $D$ strategy i.e., $P_{R}> P_{D}$ when $x_{R} > \frac{a\cdot(x_{R}+x_{C}) +\alpha } {(d+\beta)}$ i.e., when fraction of $R$ strategy user is greater than the ratio of total expected cost incurred to $R$ strategy users by population and individual benefit received by $R$ strategy user when played with $R$ strategy user. The payoff received by $C$ strategy will be higher than the $D$ strategy i.e., $P_{C} > P_{D}$ when $x_{R} > \frac{a}{(d+\beta)}$ i.e., when the fraction of $R$ strategy user is greater than the ratio of total expected cost payed by $C$ strategy user and individual benefit received by $C$ strategy user when played with $R$ strategy user. \item If fraction of $R$ strategy users are lesser than both the ratio mentioned above, then the payoff of $D$ strategy users becomes highest in the population and therefore users imitates to $D$ strategy, because now $P_{D}>P_{R}$ and $P_{D} >P_{C}$. \item The payoff to $R$ strategy users will be higher than $C$ and $D$ strategy when $P_{R}>P_{C}$ and $P_{R}>P_{D}$ i.e., $x_{D} > \frac{\alpha}{a}$ i.e., when the fraction of $D$ strategy users is greater than the ratio of cost of reputation calculation and cost of sharing, and also when $x_{R} > \frac{a\cdot(x_{R}+x_{C}) +\alpha } {(d+\beta)}$. \end{itemize} We have already examined pure strategy equilibrium now let us examine the mixed strategy equilibriums of the game. \textbf{Existence of mixed strategy Nash Equilibrium} For the mixed strategy equilibrium first we will examine the mixed strategy with any two strategies, then we will take the combination of all three strategies. Let us consider the combination of two strategies. First take $C$ and $R$ strategy. In this combination $C$ always dominates the $R$ strategy which is then dominated by the $D$ strategy. If we take $C$ and $D$ strategy, then $D$ always dominates the $C$ strategy. If we take $R$ and $D$ strategy, then although in this combination $R$ and $D$ strategy is in itself pure strategy Nash equilibrium but only $D$ strategy fulfills the condition for pure strategy Nash equilibrium in the presence of $C$ strategy. This two strategy combination provides another mixed strategy Nash equilibrium with zero payoff. The equilibrium can be obtained by solving following equations. \begin{eqnarray} x_{R}\cdot (d-a-\alpha+\beta) + (-\alpha) \cdot (1-x_R)=0 \end{eqnarray} By this equality we got \begin{subequations} \label{MNE2_game1} \begin{align} x_R &= \frac{\alpha}{(d-a+\beta)}\\ x_C &= 0\\ x_D &= 1-\frac{\alpha}{(d-a+\beta)} \end{align} \end{subequations} The second mixed strategy equilibrium \ref{MNE2_game1} is only possible when the payoff of $C$ strategy with the above combination is less than or equal to the payoff of $R$ and $D$ strategy users i.e., $P_C <= 0 $ i.e., $(d-\beta) \geq \frac{a^2}{a-\alpha}$. This equilibrium leads to zero payoff so this is not useful from system designer perspective. Now we will analyze the mixed strategy equilibrium with all three strategy. For mixed strategic equilibrium with all three strategies:\\ \begin{eqnarray} \label{game1_first} \nonumber && x_{R} \cdot (d-a-\alpha+\beta) + x_{C} \cdot (d-a-\alpha) + (1-x_{R}-x_{C}) \cdot\\\nonumber && (- \alpha) = x_{R} \cdot (d-a+\beta) + x_{C} \cdot (d-a) + (1-x_{R}-x_{C}) \cdot\\ && (-a) = x_{R} \cdot 0 + x_{C} \cdot d + (1-x_{R}-x_{C}) \cdot 0 \end{eqnarray} By this equality we got \begin{subequations} \label{MNE1_game1} \begin{align} x_{R} &= \frac{a}{d+\beta} \\ x_{C} &= \frac{(d+\beta)(a-\alpha)- a^2}{(d+\beta) \cdot a}\\ x_{D} = 1-x_{R}-x_{C} &= \frac{\alpha}{ a} \end{align} \end{subequations} \subsubsection{Theoretical Analysis of Mixed Strategy Equilibrium with All Three Strategies} In this game, ($D$,$D$) is a strict Nash equilibrium but this equilibrium state leads to no sharing from all the peers and results in collapse of the system. The only equilibrium state which allow the survival of the system is polymorphic mixed strategy equilibrium depicted by equation (\ref{MNE1_game1}). In this section we analyzed the mixed strategy equilibrium equation for varying a single parameter value (viz. $d$, $a$, $\alpha$, $\beta$) while other parameters remain fixed.\\ By this analysis of the mixed strategy equilibrium in equation \ref{MNE1_game1} following things can be observed:- \begin{itemize} \item With the increment in `cost of the reputation calculation' $\alpha$, $D$ strategy users increases, $C$ strategy users decreases and $R$ strategy users remains same in resulting mixed strategy equilibrium \item With the increment in `cost of sharing' $a$ , $R$ strategy users increases, $D$ strategy users decreases. \item With the increment in `benefit of sharing' $d$, $C$ strategy users increases, $R$ strategy users decreases and $D$ strategy users remains same in resulting mixed strategy equilibrium. \item With the increment in `benefit of reputation increment' $\beta$ the fraction of $R$ strategy users decreases, fraction of $C$ strategy users decreases and fraction of $D$ strategy users remains constant. \end{itemize} \begin{figure} \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{dVsF1G} \includegraphics[width=1\linewidth]{Reputation/Plots/dVsF1G.png}\hfill \end{minipage}% } \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{alphaVF1G} \includegraphics[width=1\linewidth]{Reputation/Plots/alphaVF1G.jpg}\hfill \end{minipage}% }\par \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{aVF1G} \includegraphics[width=1\linewidth]{Reputation/Plots/aVF1G.jpg} \end{minipage}% } \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{betaVF1G} \includegraphics[width=1\linewidth]{Reputation/Plots/betaVsF1G.png}\hfill \end{minipage}% }\par \caption{Fraction of population in mixed Nash equilibrium for the network (a) vs benefit of shared data $d$ with other parameters\{ $a=3$, $\alpha=3$, $\beta=4$, $p=0.5$\} (b)vs cost of reputation calculation $\alpha$ with other parameters \{$d=8$, $a=3$, $\beta=4$, $p=0.5$\} (c)vs cost of sharing $a$ with other parameters \{$d=8$, $\alpha=2$, $\beta=4$, $p=0.5$\}} \end{figure} The reasoning behind first observation is that as `cost of reputation calculation' $\alpha$ increases, then the payoff to $R$ strategy users decreases and therefore the $R$ strategy becomes less lucrative to the users so they switches to $C$ strategy and $D$ strategy users. As $R$ strategy users decreases and $C$ strategy users increases, then the payoff to $C$ strategy users also decreases and payoff to $D$ strategy users increases. Due to this the $C$ strategy users also switches to $D$ strategy users. As $D$ strategy users increases the payoff to $C$ strategy users decreases more and comes to lower than $R$ strategy. Due to this $C$ strategy users now switches to $R$ strategy till the payoff of all the strategy equalizes. Due to this in new equilibrium $D$ strategy users increases, $C$ strategy users decreases and $R$ strategy users remains same as shown in figure \ref{alphaVF1G}. The reasoning behind second observation is that as `cost of sharing' $a$ increases, then the payoff of $R$ and $C$ strategy users decreases. Due to this most of the $R$ and $C$ strategy users switches to $D$ strategy users. As $C$ strategy users decreases the payoff to $D$ strategy also decreases and so $D$ strategy users also switches to $R$ strategy. As $R$ strategy users increases the payoff to $C$ strategy users increases and so $D$ strategy users also switches to $C$ strategy. Due to this in final equilibrium $R$ strategy users increases, $D$ strategy users decreases. The reasoning behind third observation is, at one equilibrium state when the expected payoff of all the three strategies are same, then as benefit of shared data increases the expected payoff of $R$ user and $C$ user increases equally whereas the expected payoff of $D$ user increases $x_{R}$ fraction lesser than $R$ and $C$ strategy users. Due to this $D$ strategy users switches to $C$ strategy users and $R$ strategy users equally. But as the fraction $x_{R}$ and $x_{C}$ increases, then the expected payoff of reputation $R$ users increases lesser than expected payoff of $C$ strategy users and as fraction of $C$ strategy users increases the expected payoff to $D$ strategy users also increases. So $R$ strategy users switches to cooperation and defection users. As $x_{R}$ decreases the payoff to $C$ strategy users also decreases so $C$ strategy users switches to $D$ strategy. This drift process comes with next equilibrium state in which $R$ strategy users decreases, $C$ strategy users increases and $D$ strategy users remains same as shown in figure \ref{dVsF1G}. The reasoning behind fourth observation is same as the `benefit of shared resources'. In this as the `benefit of reputation increment' $\beta$ would increase the expected payoff of reputation and $C$ strategy users would increase whereas the expected payoff of $D$ strategy users remain same. Due to this $D$ strategy users switches to $R$ and $C$ strategy users. As the $C$ strategy users increases the payoff of $D$ strategy users again increases. As the fraction of reputation and cooperation increases the expected payoff of $R$ users increases lesser than $C$ strategy. So $R$ strategy users switches to $D$ and $C$ strategy users and in next equilibrium $D$ strategy users remain unchanged and fraction of $R$ strategy users decreases and fraction of $C$ strategy users increases. \subsection{Reputation system with round based initial payment distributed to cooperative users} In the previous subsection, we have analyzed the reputation system in which there is no initial payment required for the peers. Now in this subsection we will analyze the reputation system with round based initial payment imposed to the peers, which is distributed among the cooperation and reputation with cooperation peers ($C$ and $R$ strategy). The game can be defined as follows.\\ \textbf{Players}:- User1, User2\\ \textbf{Strategies}:- Reputation with cooperation ($R$), Cooperation ($C$), Defection (D)\\ \textbf{Preferences} \begin{eqnarray} \nonumber && U_i(A_i,A_{-i})= (^C l_{-i} \cdot (1- ^Rl_{-i}) + ^Cl_{i} \cdot ^Rl_{-i} \cdot ^Cl_{-i}) \cdot d \\\nonumber && - (^Cl_{i} \cdot (1- ^Rl_i) + ^Cl_{-i} \cdot ^Rl_i)\cdot a - ^Rl_i \cdot \alpha + \\\nonumber && (^Cl_i \cdot ^Rl_{-i}) \cdot \beta + ^Cl_i \cdot \frac{N \cdot p}{N-n_d} -p \end{eqnarray} where $A_i$ and $A_{-i}$ are the actions of player $i$ and player other than $i$ respectively. $^Cl_i$ is the cooperation level of player $i$ and $^Rl_i$ is the reputation calculation level of player $i$ respectively.\\ For $C$ (cooperation) strategy : $^Cl = 1$ and $^Rl = 0$. Because these users are always cooperating and not calculating reputation. Similarly for $R$ (reputation calculation) strategy : $^Cl = 1$ and $^Rl = 1$ and for $D$ (defection) strategy : $^Cl = 0$ and $^Rl = 0$\\ In the preference function the first term represents the benefit of sharing, the benefit of sharing the resources can only be obtained by first user when the second user is either cooperator ($C$) or when the first player is either cooperator or reputation calculator user ($C$ and $R$) and second player is reputation calculator ($R$) user. The second term represents the `cost of sharing', the cost of sharing will only be imposed when the player is either cooperator or he is reputation calculator and second player is cooperator. Third term represents the cost of reputation calculation cost which is always incurred when the first user is reputation calculator ($R$) user. Fourth term is the benefit of reputation increment. Fifth term is the benefit due to initial payment distribution. Payoff matrix of the game is shown in table \ref{Second_Game}. \begin{table}[!t] \renewcommand{\arraystretch}{1.3} \caption{Initial Payment With Distribution To Cooperative Users} \label{Second_Game} \centering \begin{center} \begin{tabular}{c c c c} { }&{R(B)} & {C (B)} & {D(B)}\\ \hline {R (A)} & \shortstack{$d-a-\alpha+\beta+$\\ $\frac{n_d \cdot p}{n_r+n_c}$, \\$d-a-\alpha + \beta +$ \\ $\frac{n_d \cdot p}{n_r+n_c}$} & \shortstack{$d-a-\alpha +$ \\$ \frac{n_d \cdot p}{n_r+n_c}$,\\$d-a+\beta+$ \\ $\frac{n_d \cdot p}{n_r+n_c}$} & {$\frac{n_d \cdot p}{n_r+n_c} - \alpha$,$-p$}\\ \hline {C (A)} & \shortstack{$d-a+\beta+$\\ $\frac{n_d \cdot p}{n_r+n_c}$,\\$d-a-\alpha+$\\ $\frac{n_d \cdot p}{n_r+n_c}$} & \shortstack{$d-a+\frac{n_d \cdot p}{n_r+n_c}$,\\$d-a+\frac{n_d \cdot p}{n_r+n_c}$} & \shortstack{$-a+\frac{n_d \cdot p}{n_r+n_c}$,\\$d-p$}\\ \hline {D (A)} & {$-p$,$\frac{n_d \cdot p}{n_r+n_c} - \alpha$} & \shortstack{$d-p$,\\$-a+\frac{n_d \cdot p}{n_r+n_c}$} & { $-p$,$-p$}\\ \hline \end{tabular} \end{center} \end{table} \textbf{Analysis} In this game we claim that \begin{equation} \label{G2NSScond} \begin{split} if\ \ \ \ p \geq a \cdot (1-\frac{n_d}{N}) \end{split} \end{equation}\\ then cooperation strategy profile i.e., ($C$,$C$) will be the Nash equilibrium and \begin{equation} \label{G2ESScond} \begin{split} if\ \ \ \ p > a \cdot (1-\frac{n_d}{N}) \end{split} \end{equation}\\ then cooperation strategy profile will be Evolutionarily stable strategy.\\ If the condition in equation \ref{G2NSScond} is not fulfilled and \begin{equation} \label{G2ND} \begin{split} if\ \ \ \ p < \alpha \cdot (1-\frac{n_d}{N}) \end{split} \end{equation}\\ then the defection strategy profile i.e., ($D$,$D$) will be the pure strategy Nash equilibrium profile. The argument for strategy profile ($C$,$C$) as Nash equilibrium, given condition (\ref{G2NSScond}), is as follows.\\ We can observe that if condition (\ref{G2NSScond}) is true, then $U_1(C,C) \geq U_1(D,C)$ and $U_1(C,C) \geq U_1(R,C)$ that means the payoff of cooperation strategy when played with itself is always greater than or equal to other two strategy while played with cooperation.\\ The argument for strategy profile ($C$,$C$) as Evolutionary Stable, given condition (\ref{G2ESScond}), is as follows.\\ We can observe that if condition (\ref{G2ESScond}) is true, then $U_1(C,C) > U_1(D,C)$ and $U_1(C,C) > U_1(R,C)$ that means the payoff of cooperation strategy when played with itself is always strictly greater than $D$ and $R$ strategy while played with $C$ strategy.\\ The argument for strategy profile ($D$,$D$) as Nash equilibrium as well as Evolutionary stable, given condition (\ref{G2ND}), is as follows\\ We can observe that if condition (\ref{G2ND}) is true, then $U_1(D,D) > U_1(R,D)$ and $U_1(D,D) > U_1(C,D)$ that means the payoff of Defection strategy when played with itself is always greater than R and $C$ strategy when played with $D$ strategy. If condition \ref{G2NSScond} and \ref{G2ND} is not satisfied, then there is no pure strategic Nash equilibrium in this game. Therefore, now we will compute the mixed strategy Nash equilibrium profile. For this the expected payoff of each strategy can be written as\\ \begin{subequations} \begin{align} \label{PayoffR} P_{R} &=d \cdot (x_{R}+x_{C}) - a \cdot(x_{R}+x_{C}) + x_{R} \cdot \beta - \alpha + \frac{n_d \cdot p}{N-n_d}\\ \label{PayoffC} P_{C} &=d \cdot (x_{R}+x_{C}) + x_{R} \cdot \beta - a + \frac{n_d \cdot p}{N-n_d}\\ \label{PayoffD} P_{D} &=x_{C} \cdot d - p \end{align} \end{subequations} First we will consider the mixed strategy in the combination of two strategies. If we take the combination of only $R$ and $C$ strategies, then in this combination $C$ strategy always dominates $R$, so no mixed strategy equilibrium exist. Now we consider the combination of $R$ and $D$ strategies, then if condition (\ref{G2ND}) is not fulfilled, this results in the domination of $R$ strategy over $D$ strategy and hence again mixed strategy equilibrium does not exist. But if condition (\ref{G2ND}) is fulfilled, then there exist a mixed strategy Nash equilibrium which can be obtained by equating the expected payoffs of $R$ and $D$ strategy users such that, \begin{eqnarray} \nonumber && x_{R} \cdot (d-\alpha - a + \beta + \frac{n_d \cdot p}{N-n_d}) + (1-x_R)\cdot\\\nonumber &&(\frac{n_d \cdot p}{N-n_d} - \alpha) = -p\\ && x_R \cdot (d-a+\beta) = \alpha - \frac{p \cdot N}{N-n_d} \end{eqnarray} \begin{subequations} \begin{align} x_R & = \frac{\alpha - p\cdot(\frac{N}{N-n_d})}{(d-a+\beta)}\\ x_C & = 0\\ x_D & = 1-\frac{\alpha - p\cdot(\frac{N}{N-n_d})}{(d-a+\beta)} \end{align} \end{subequations} This equilibrium leads to negative payoff so this is not useful from system designer perspective. Now we consider the combination of $C$ and $D$ strategy. If condition \ref{G2ESScond} is fulfilled, then $C$ strategy dominates $D$ strategy and so no mixed strategy equilibrium presents. But if $p = a \cdot (1-\frac{n_d}{N})$, then $U_1(C,C) = U_1(D,C)$ and $U_1(C,D) = U_1(D,D)$. So at this condition although cooperation is pure strategic weak Nash equilibrium, but as $D$ strategy users are also getting the same payoff so there exist a mixed strategy Nash equilibrium which can be obtained by equating the payoff of $D$ and $C$ strategy users such that, \begin{eqnarray} \nonumber && x_C \cdot (d-a+\frac{n_d \cdot p}{N-n_d}) + (1-x_C)\cdot(-a+\frac{n_d \cdot p}{N-n_d}) =\\ && x_C \cdot (d-p) + (1-x_C)\cdot(-p) \end{eqnarray} this drift would be there till the payoff of reputation strategy is lesser than these two strategies i.e., \begin{equation} \begin{split} x_C \cdot (d-a+\frac{n_d \cdot p}{N-n_d}) + (1-x_C)\cdot(-a+\frac{n_d \cdot p}{N-n_d}) >\\ x_C \cdot (d-a-\alpha+\frac{n_d \cdot p}{N-n_d}) + (1-x_C) \cdot (-\alpha +\frac{n_d \cdot p}{N-n_d} ) \end{split} \end{equation} By solving above inequality we get \begin{equation} x_D < \frac{\alpha}{a} \end{equation} This shows that till the fraction of defectors remains lesser than the ratio of reputation cost and cost of sharing, reputation users will not be there in the system. This is because when the defectors are less in the society, then paying the reputation cost seems less useful. But as defectors increase, the payoff to reputation strategy increases and users mutates to the reputation strategy. Now we will find out the mixed strategy with all the three strategies. For this equilibrium, the expected payoff to all three strategies should be equal. \begin{eqnarray} \nonumber && (d-a-\alpha + \beta + \frac{n_d \cdot p}{N-n_d})\cdot x_{R} + (d-a-\alpha \\ \nonumber && + \frac{n_d \cdot p}{N-n_d}) \cdot x_{C} + (\frac{n_d \cdot p}{N-n_d} - \alpha)(1-x_{R}-x_{C}) \\ \nonumber && = (d-a + \beta +\frac{n_d \cdot p}{N-n_d})\cdot x_{R} + (d-a+\frac{n_d \cdot p}{N-n_d}) \cdot x_{C} \\ \nonumber && + (-a + \frac{n_d \cdot p}{N-n_d})(1-x_{R}-x_{C}) \\ && =(-p) \cdot x_{R} + (d-p) \cdot x_{C} + (1-x_{R}-x_{C}) \cdot (-p) \end{eqnarray} By solving above equality \begin{subequations} \label{MNE3_game2} \begin{align} x_{D} &= \frac{\alpha}{a}\\ x_{R} &= \frac{(a-p \cdot (\frac{N}{N-n_d}))}{d+\beta} \\ x_{C} &= \frac{(a-\alpha)}{a} - \frac{a-p \cdot (\frac{N}{N-n_d})}{(d+\beta)} \end{align} \end{subequations} Putting this fraction of $D$ strategy users in the fraction of reputation and cooperation strategy we got \begin{subequations} \begin{align} x_{R} &= \frac{(a-p \cdot (\frac{a}{a-\alpha}))}{d+\beta} \\ x_{C} &= \frac{(a-\alpha)}{a} - \frac{a-p \cdot (\frac{a}{a-\alpha})}{(d+\beta)} \end{align} \end{subequations} In this mixed strategy equilibrium described by (\ref{MNE3_game2}), following things can be observed:- \begin{itemize} \item With the increment in `cost of the reputation calculation' $\alpha$, $D$ strategy users increases, $C$ and $R$ strategy users decreases in resulting mixed strategy equilibrium \item With the increment in `cost of sharing' $a$, $R$ strategy users increases whereas $D$ strategy users decreases in resulting mixed strategy equilibrium \item The fraction of $R$ strategy is inversely proportional to `initial payment' $p$ whereas the fraction of $C$ strategy users is directly proportional to $p$. Moreover, the mixed strategy equilibrium is not defined for $p$ greater than $a\cdot(1-x_D)$ \item The fraction of $R$ strategy users decreases, fraction of $C$ strategy users increases and fraction of $D$ strategy users remain same with the increment in `benefit of reputation increment' $\beta$ \end{itemize} The reasoning of first observation is, as the `cost of the reputation calculation' $\alpha$ increases, the expected payoff to $R$ strategy users decreases so they switches to cooperation and defection users. As the cooperation increases the payoff to $D$ strategy users increases and as $R$ strategy users decreases the payoff to $C$ strategy users also decreases so $C$ strategy users also switches to $D$ strategy. As $D$ strategy users increases the payoff to reputation and cooperation users slightly increases because now they are getting benefit of the payment $p$. As defection increases and cooperation decreases the payoff to defection also decreases and so they switches to $R$ strategy users. As $R$ strategy users increases the payoff to $C$ strategy users increases so some $D$ strategy users now switches to cooperation. This whole process shifts the equilibrium where $x_{R}$ and $x_{C}$ decreases and $x_{D}$ increases. Unlike previous game in this game fraction of $R$ strategy users decreases as $\alpha$ increases because as defection increases the payoff to cooperation also increases due to payment so some $R$ strategy users switches to cooperation in equilibrium as shown in figure \ref{alphaVF2G}\\ \begin{figure} \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{aVF2G} \includegraphics[width=1\linewidth]{Reputation/Plots/aVsF2Game.jpg}\hfill \end{minipage}% } \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{alphaVF2G} \includegraphics[width=1\linewidth]{Reputation/Plots/alphaVF2G.jpg}\hfill \end{minipage}% }\par \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{betaVF2G} \includegraphics[width=1\linewidth]{Reputation/Plots/betaVF2Game.jpg} \end{minipage}% } \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{pVF2G} \includegraphics[width=1\linewidth]{Reputation/Plots/payVF2Game.jpg}\hfill \end{minipage}% }\par \caption{parameter vs Fraction of population in mixed Nash equilibrium for the network with (a) vs cost of sharing $a$ with other parameters \{$d=8$, $\alpha=2$, $\beta=4$, $p=0.5$\} (b) vs cost of reputation calculation $alpha$ with other parameters \{$d=8$, $a=3$, $\beta=4$, $p=0.5$\} (c) vs benefit of reputation increment with other parameters \{ $d=8$, $\alpha=2$, $a=3$, $p=0.5$\} (d) vs round based initial payment $p$ with other parameters \{$\beta=4$, $\alpha=2$, $a=3$, $d=8$\}} \end{figure} The reasoning behind second observation is, as `cost of sharing' $a$ increases, the expected payoff to $R$ and $C$ strategy users decreases, but the payoff to $C$ strategy users decreases more so $C$ strategy users switches to $D$ strategy users which currently has highest payoff. As the fraction of $C$ strategy users decreases the expected payoff to $D$ strategy users also decreases and it comes to lowest. So now $D$ strategy users switches to $C$ strategy users and $R$ strategy users. Like previous game in this game the next equilibrium comes at point where fraction of $R$ strategy users increases and fraction of $D$ strategy users decreases but as compare to previous game the rate of change is low because now the $R$ strategy users also getting benefit of the payment from $D$ strategy users.\\ The reasoning behind third observation is, as the `initial payment' $p$ increases, the expected payoff of $C$ and $R$ strategy users increases whereas the expected payoff to $D$ strategy users($d \cdot x_{C} -p$) decreases. As the payoff to $R$ and $C$ strategy users increases the $D$ strategy users switches to $R$ and $C$ strategy users. As $D$ strategy users decreases and $R$ strategy users increases the payoff to $C$ strategy users increases more than $R$ strategy users due to this $R$ strategy users switches to $C$ strategy users. As $R$ strategy users decreases and $C$ strategy users increases the payoff to $D$ strategy users increases so some $R$ and $C$ strategy users switches to $D$ strategy. Due to this process fraction of $R$ strategy users decreases, $C$ strategy users increases and $D$ strategy users remains same in new Nash equilibrium as shown in Figure \ref{pVF2G}. If the initial payment satisfies the condition \ref{G2ESScond} i.e., C strategy is evolutionary stable, then mixed strategy equilibrium is not defined and hence, it can be observed in figure \ref{pVF2G} that the $R$ strategy users fraction becomes negative for initial payment greater than $a\cdot(1-x_D)$ i.e., $0.99$. The reasoning behind fourth observation is, as the `benefit of reputation' $\beta$ increases the expected payoff of $C$ and $R$ strategy users increase equally whereas the expected payoff of $D$ strategy users remain same. Due to this $D$ strategy users switches to $R$ and $C$ strategy users. As the fraction of $R$ strategy users increases and $D$ strategy users decreases, the payoff of $C$ strategy users increases more than $R$ strategy users so $R$ strategy users also switches to $C$ strategy. As $C$ strategy users increases the payoff of $D$ strategy users again increases and $C$ and $R$ strategy users also switches to $D$ strategy. Due to this whole process fraction of $R$ strategy users decreases, fraction of $C$ strategy users increases and fraction of $D$ strategy users remain same in the new Nash equilibrium as shown in Figure \ref{betaVF2G}. \subsection{Reputation system with round based initial payment distributed to reputation calculator $R$ users} In the last subsection, we have analyzed the reputation system in which initial payment is distributed among the cooperation and reputation with cooperation peers ($C$ and R strategy). Now, in this subsection, we will analyze the reputation system with round based initial payment imposed to the peers, which is distributed among only reputation (R) strategy users. The game can be defined as follows.\\ \textbf{Players}:- User1, User2\\ \textbf{Strategies}:- Reputation with cooperation (R), Cooperation (C), Defection (D)\\ \textbf{Preferences} \begin{eqnarray} \nonumber && u_i(A_i,A_{-i})= (^C l_{-i} \cdot (1- ^Rl_{-i}) + ^Cl_{i} \cdot ^Rl_{-i} \cdot ^Cl_{-i}) \cdot d \\\nonumber && - (^Cl_{i} \cdot (1- ^Rl_i) + ^Cl_{-i} \cdot ^Rl_i)\cdot a - ^Rl_i \cdot \alpha + \\ && (^Cl_i \cdot ^Rl_{-i}) \cdot \beta + ^Rl_i \cdot ^Cl_i \cdot \frac{N \cdot p}{N-n_d} -p \end{eqnarray} where $A_1$ and $A_2$ are the actions of player 1 and player 2 respectively. $^Cl_i$ is the cooperation level of player $i$ and $^Rl_i$ is the reputation calculation level of player $i$ respectively.\\ For $C$ (cooperation) strategy : $^Cl = 1$ and $^Rl = 0$. Because these users are always cooperating and not calculating reputation. Similarly \\ For $R$ (reputation calculation) strategy : $^Cl = 1$ and $^Rl = 1$\\ For D (defection) strategy : $^Cl = 0$ and $^Rl = 0$\\ In the preference function the first term represents the benefit of sharing, the benefit of sharing the resources can only be obtained by first user when the second user is either cooperator ($C$) or when the first player is either cooperator or reputation calculator user ($C$ and $R$) and second player is reputation calculator ($R$) user. The second term represents the cost of sharing, the cost of sharing will only be imposed when the player is either cooperator or he is reputation calculator and second player is cooperator. Third term represents the cost of reputation calculation cost which is always incurred when the first user is reputation calculator ($R$) user. Fourth term is the benefit of reputation increment. Fifth term is the benefit due to initial payment distribution. Payoff matrix of the game is shown in table \ref{Third_Game}.\\ \begin{table}[!t] \renewcommand{\arraystretch}{1.3} \caption{Initial Payment with Distribution To Reputation Users} \label{Third_Game} \centering \begin{center} \begin{tabular}{c c c c} { }&{R(B)} & {C (B)} & {D(B)}\\ \hline {R (A)} & \shortstack{$d-a-\alpha+\beta+$\\ $ \frac{(N-n_r) \cdot p}{n_r}$, \\$d-a-\alpha + \beta +$\\$ \frac{(N-n_r) \cdot p}{n_r}$} & \shortstack{$d-a-\alpha +$\\ $\frac{(N-n_r) \cdot p}{n_r}$,\\$d-a+\beta-p$} & {$\frac{(N-n_r) \cdot p}{n_r} -\alpha$,$-p$}\\ \hline {C (A)} & \shortstack{$d-a+\beta - p$,\\$d-a-\alpha +$\\ $\frac{(N-n_r) \cdot p}{n_r}$} & \shortstack{$d-a-p$,\\$d-a-p$} & {$-a-p$,$d-p$}\\ \hline {D (A)} & {$-p$,$\frac{(N-n_r) \cdot p}{n_r} -\alpha$} & {$d-p$,$-a-p$} & { $-p$,$-p$}\\ \hline \end{tabular} \end{center} \end{table} \textbf{Analysis} In this game\\ \begin{equation} \label{G3ESScond} \begin{split} if\ \ \ p > \frac{n_r \cdot \alpha}{N} \\ \end{split} \end{equation} then we claim that reputation ($R$) strategy will be pure strategic strict Nash equilibrium and hence evolutionarily stable. Where $n_r$ is the number of $R$ strategy users in the population.\\ If (\ref{G3ESScond}) is not fulfilled and \begin{equation} \label{G3ESScond_2} \begin{split} if\ \ \ \ p < \frac{n_r \cdot \alpha}{N} \\ \end{split} \end{equation} then we claim that $D$ strategy is a pure strategy Nash equilibrium, and hence evolutionarily stable. The argument for strategy profile ($R$,$R$) as strict Nash equilibrium, given condition (\ref{G3ESScond}), is as follows.\\ We can observe that if condition (\ref{G3ESScond}) is true, then $U_{1}(R,R) > U_{1}(C,R)$ and $U_1(R,R) \geq U_1(D,R)$ that means the payoff of R strategy when played with itself is always greater than or equal to other two strategy while played with $R$.\\ The argument for strategy profile ($D$,$D$) as strict Nash equilibrium, given condition (\ref{G3ESScond_2}), is as follows.\\ We can observe that if condition (\ref{G3ESScond_2}) is true, then $U_{1}(D,D) > U_{1}(C,D)$ and $U_1(D,D) \geq U_1(R,D)$ that means the payoff of $D$ strategy when played with itself is always greater than or equal to other two strategy while played with $D$.\\ Now we will compute the mixed strategy Nash equilibrium profile. For this the expected payoff of each strategy can be written as \begin{subequations} \begin{align} \nonumber P_R &= d \cdot (x_R + x_C) - a \cdot (x_R + x_C) + \beta \cdot x_R \\ & + p \cdot \frac{N-n_r}{n_r} - \alpha \\ P_C &= d \cdot (x_R + x_C) + \beta \cdot x_R - a - p \\ P_D &= d \cdot x_C - p \end{align} \end{subequations} In this game if condition (\ref{G3ESScond}) is fulfilled, then no mixed strategy equilibrium presents as $R$ is strictly dominating strategy. If this condition is not fulfilled, then we check for multiple equilibrium in the system. Let us first take the combination of $C$ and $D$ strategies. In this combination $D$ strategy always dominates the $C$ strategy, hence no mixed strategy equilibrium presents. If we take the combination of $R$ and $D$ strategy, then if $p = \frac{n_r \cdot \alpha}{N}$, then ($D$,$D$) will be pure strategic weak Nash equilibrium and ($R$,$R$) will be pure strategic strict Nash equilibrium. In this condition no mixed strategy equilibrium presents. If the condition is $p < \frac{n_r \cdot \alpha}{N}$, then the negative payoff mixed strategic Nash equilibrium presents but this is of no use to the system designers. Now we take the combination of $R$ and $C$ strategies. In this if $p = \frac{n_r \cdot \alpha}{N}$, then drift occurs among these two strategies and it will be continued till the expected payoff of $D$ strategy will be less than the expected payoff to these strategies, \begin{subequations} \begin{align} \nonumber & x_R \cdot (d-a + \beta -\alpha +\frac{N-n_r}{n_r} \cdot p) + (1-x_R)\cdot(d-a -\alpha \\ &+\frac{N-n_r}{n_r} \cdot p) > x_R \cdot (-p) + (1-x_R) \cdot (d-p) \end{align} \end{subequations} By using above equation we got \begin{equation} x_R > \frac{a}{d+\beta} \end{equation} This means that when $R$ strategy users are more in the system, then playing $D$ strategy will not be lucrative. In the combination of $R$ and $C$ strategy if $p < \frac{n_r \cdot \alpha}{N}$, then $C$ strategy dominates $R$ strategy and so no mixed strategy equilibrium presents in this condition. Now let us take the combination of all three strategies for the mixed strategy equilibrium. For this, the equality is, \begin{eqnarray} \nonumber && (d-a-\alpha + \beta + \frac{(N-n_r) \cdot p}{n_r}) x_{R} + (d-a-\alpha \\ \nonumber && + \frac{(N-n_r) p}{n_r}) \cdot x_{C} + (\frac{(N-n_r) \cdot p}{n_r} - \alpha)(1-x_{R}-x_{C}) \\ \nonumber && = (d-a + \beta -p) x_{R} + (d-a-p) \cdot x_{C} + \\ \nonumber && (-a-p)(1 -x_{R} -x_{C}) =(-p) \cdot x_{R} + (d-p) \cdot x_{C} \\ && + (1-x_{R}-x_{C}) \cdot (-p) \end{eqnarray} By this equality we got \begin{subequations} \label{MNE_game3} \begin{align} x_{R} & = \frac{a}{d+\beta} \\ x_{C} & = 1 - \frac{\alpha - p \cdot \frac{N}{n_r} }{a} - \frac{a}{d+\beta}\\ x_{D} & = \frac{\alpha - p \cdot \frac{N}{n_r} }{a} \end{align} \end{subequations} In this mixed strategy equilibrium described by (\ref{MNE_game3}), following things can be observed:- \begin{itemize} \item With the increment in `cost of the reputation calculation' $\alpha$, $D$ strategy users increases, C strategy users decreases and $R$ strategy users remains same in resulting mixed strategy equilibrium \item With the increment in `benefit of reputation increment' $\beta$, the fraction of $R$ and $D$ strategy users decreases whereas fraction of $C$ strategy users increases \item With the increment in the `initial payment' $p$, the fraction of $D$ strategy users decreases, whereas the fraction of $C$ strategy users increases \item With the increment in `cost of sharing' $a$, $C$ strategy users decreases, $R$ and $D$ strategy users increases in resulting mixed strategy equilibrium. \end{itemize} The reasoning behind first observation is that as `cost of reputation calculation' $\alpha$ increases, then the payoff to $R$ strategy users decreases and therefore the $R$ strategy becomes less lucrative to the users so they switches to C strategy and $D$ strategy users. As $R$ strategy users decreases and $C$ strategy users increases, then the payoff to $C$ strategy users also decreases and payoff to $D$ strategy users increases. Due to this the $C$ strategy users also switches to $D$ strategy users. As $D$ strategy users increases the payoff to $C$ strategy users decreases more and comes to lower than $R$ strategy. Due to this $C$ strategy users now switches to $R$ strategy till the payoff of all the strategy equalizes. Due to this in new equilibrium $D$ strategy users increases, $C$ strategy users decreases and $R$ strategy users remains same as shown in figure \ref{alphaVF1G}. The reasoning behind second observation is that as the `benefit of reputation increment' $\beta$ increases the payoff to $R$ and $C$ strategy users increases whereas the payoff to $D$ strategy users remains same due to this $D$ strategy users switches to $R$ and $C$ strategy users. As the fraction of $D$ strategy users decreases and fraction of $R$ strategy users increases the benefit of payment to $R$ strategy users decreases so they also switches to $C$ strategy users. This whole process continues till the payoff to all three strategies equalizes. This results in the increment to the $C$ strategy fraction and decrement in the $R$ and $D$ strategy fraction of population. The reasoning behind third observation is that as the `initial payment' $p$ increases the payoff to $R$ strategy users increases whereas the payoff to $C$ and $D$ strategy users decreases. Due to this the $C$ and $D$ strategy users switches to $R$ strategy users. As $R$ strategy users increases the payoff to $C$ strategy increases due to this $R$ strategy users switches to $C$ strategy users till the payoff to all three strategies equalizes. This process results in increment in the fraction of $C$ strategy, decrement in the fraction of $D$ strategy and remain same in the fraction of $R$ strategy. The reasoning behind fourth observation is that as the `cost of sharing' $a$ increases the payoff to $C$ strategy users and $R$ strategy users decreases and payoff to $D$ strategy users remains constant. This results in switching of $C$ and $R$ strategy users to $D$ strategy. As the fraction of $C$ strategy users decreases this results in the decrement the payoff to $D$ strategy users and increment the payoff to $R$ strategy users as they are getting benefit from initial payment. So now the users switch to $R$ strategy users till the payoff to all three strategies equalizes and in new equilibrium fraction of the $D$ and $R$ strategy users increases whereas the fraction of $C$ strategy users decreases. \begin{figure} \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{bVF3G} \includegraphics[width=1\linewidth]{Reputation/Plots/betaVF3G.jpg}\hfill \end{minipage}% } \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{aVsF3G} \includegraphics[width=1\linewidth]{Reputation/Plots/aVsF3Game.jpg}\hfill \end{minipage}% }\par \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{pVF3G} \includegraphics[width=1\linewidth]{Reputation/Plots/payVF3G.jpg} \end{minipage}% } \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{alphaVF3G} \includegraphics[width=1\linewidth]{Reputation/Plots/alphaVF3G.jpg}\hfill \end{minipage}% }\par \caption{Fraction of population in mixed Nash equilibrium for the network (a) vs benefit of reputation increment $\beta$ with other parameters \{$p=0.5$, $\alpha=2$, $a=3$, $d=8$\} (b) vs cost of sharing $a$ with other parameters \{$p=0.5$, $\alpha=2$, $d=8$, $\beta=4$\} (c) vs round based initial payment $p$ with other parameters \{$\alpha=2$, $a=3$, $d=8$, $\beta=4$\} (d) vs cost of reputation calculation $\alpha$ with other parameters \{$p=0.5$, $a=3$, $d=8$, $\beta=4$\}} \end{figure} \section{Numerical Analysis of different models of Reputation Game} All the above three explained system model is analyzed by simulation as well. By simulation, we have shown the final evolution of the system. The simulation experiments have been conducted for 10000 nodes. We assume the fully connected topology of the network in which any two peer in the network can interact with each other at random in a large and well-mixed population. On the part of each user, system constitutes three strategy viz. $R$ (Reputation calculation with cooperation), $C$ (Cooperation) and $D$ (Defection). To show the relationship between the final evolved fraction and the initial fraction of different strategy users, we have taken different initial fractions of population for different strategy users and plotted their evolution separately. The evolution process contains the repetition of three phases viz. selection phase, transaction phase and reproduction phase. Initially each node selects any of the other node for pairwise interaction with equal probability so the probability that user will interact with any other strategy user is the fraction of that strategy users in the population. This phase is called selection phase. After this phase each node simultaneously calculates its payoff using the utility function based on game. This phase is called transaction phase. After each transaction, there is a reproduction phase in which all users imitate any other strategy with the probability proportional to the difference between the strategy's expected payoff and the population expected payoff. In our system model we assume that each node has the knowledge of all his neighbor's payoff and strategy. So the nodes adopts a new strategy according to the natural selection. For the simulation we also chooses the parameter values viz. $d$ (benefit of sharing), $a$ (cost of sharing), $\alpha$ (cost of reputation calculation), $\beta$ (benefit of reputation increment) and $p$ (initial payment). In the selection of the parameter values we follow constraints that is necessary and sufficient for modeling this game viz. the `cost of sharing' $a$ should always be less than or equal to the `benefit of the shared resources' $d$ and greater than `cost of reputation calculation' $\alpha$. We have examined these parameters for different values in ordinal fashion and observed that final evolution is still same. \subsection{First Reputation Game} \begin{figure} \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{FGNrca} \includegraphics[width=1\linewidth]{Reputation/Plots/Plots/Game1/plotGame1EvolutionNrc.png}\hfill \end{minipage}% } \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{FGNrcb} \includegraphics[width=1\linewidth]{Reputation/Plots/Plots/Game1/plotGame1EvolutionNrc2.png}\hfill \end{minipage}% }\par \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{FGNrcc} \includegraphics[width=1\linewidth]{Reputation/Plots/Plots/Game1/plotGame1EvolutionNrc3.png} \end{minipage}% } \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{FGNrcd} \includegraphics[width=1\linewidth]{Reputation/Plots/Plots/Game1/plotGame1EvolutionNrc4.png}\hfill \end{minipage}% }\par \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{FGNrce} \includegraphics[width=1\linewidth]{Reputation/Plots/Plots/Game1/plotGame1EvolutionNrc9.png}\hfill \end{minipage}% } \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{FGNrcf} \includegraphics[width=1\linewidth]{Reputation/Plots/Plots/Game1/plotGame1EvolutionNrc6.png}\hfill \end{minipage}% }\par \caption{Round vs Fraction of population for the network with d=8, a=3, $\beta=4$, $p=0.5$, $\alpha=0$} \end{figure} \subsubsection{Reputation cost $\alpha$ negligible} In first scenario we have taken $\alpha$ negligible. We run our simulation for different initial fractions of $R$, $C$ and $D$ strategies and fixed parameter values ($d=8$, $a=3$, $\beta=4$, $\alpha=0$). Figure \ref{FGNrca} and \ref{FGNrcb} shows that the final fraction of $R$ and $C$ strategy depends on the initial fraction of the strategies, which substantiate the theoretical analysis of the first game. We observe that as $\frac{\alpha}{a}$ is zero so the payoff to $R$ strategy users is greater than the payoff to $C$ strategy until $D$ strategy user's fraction are greater than zero and becomes equal to the payoff of $C$ strategy users when all $D$ strategy users dies out. At first we run the simulation with 0.1, 0.2, 0.7 fraction of $R$, $C$ and $D$ strategies users respectively (figure \ref{FGNrca}). As mentioned earlier, in the selection phase user selects other user with equal probability so the probability that it will meet with $R$ strategy users is 0.1, with $C$ strategy users is 0.2 and with $D$ strategy users is 0.7. Then in transaction phase each node simultaneously calculates the payoff. Node selects other strategy with probability proportional to the difference between his neighbor's payoff and his payoff. Each node imitates to the higher payoff strategy with positive probability. In this scenario initially as $x_R<\frac{a}{d+\beta}$ i.e., $0.1<0.25$ and $x_R>\frac{a(x_R+x_C)+\alpha}{d+\beta}$ i.e., $0.1>0.075$ , results in the expected payoff order as $P_R > P_D > P_C$, so $C$ strategy imitates to $D$ and $R$ strategy whereas $D$ strategy imitates to $R$ strategy. This results in increment in the $R$ strategy and $D$ strategy fraction and decrement in $C$ strategy fraction initially. As the fraction of $R$ strategy users increases and becomes greater than $0.25$, then the expected payoff of $D$ strategy users comes to lower than $C$ strategy users which results in payoff order as $P_R > P_C > P_D$ and so from now $D$ strategy users imitates to $R$ and $C$ strategy, and $C$ strategy users imitates to only $R$ strategy. This results in increment to $R$ and $C$ strategy users whereas decrement in $D$ strategy fraction. After this as $D$ strategy fraction becomes zero which is equal to $\frac{\alpha}{a}$, then the payoff order becomes $P_R=P_C>P_D$ which further results in constant fraction of all three strategies. We observe that in this scenario as discussed in the model 1, in final evolution system composed with only $R$ and $C$ strategy users as in figure \ref{FGNrca}. After this we run the simulation with 0.1, 0.7, 0.2 initial fraction of $R$, $C$ and $D$ strategies users respectively (figure \ref{FGNrcb}). The same process as of explained earlier again happens but in this scenario the fraction of $C$ strategy users are almost greater than $0.35$ when the fraction of $R$ strategy becomes greater than $\frac{a}{d+\beta}$. So in final evolution again there is only $R$ and $C$ strategy but in this $C$ strategy users are higher than previous. In third initial setting, we took very less $R$ and $C$ user fraction i.e., $0.002$ and $0.001$ respectively and we observe that $C$ strategy dies out before the fraction of $R$ strategy becomes greater than $\frac{a}{d+\beta}$ so only $R$ strategy users remains in the final evolution. With this simulation scenario, it can be observed that as $\frac{a(x_R+x_C)+\alpha}{d+\beta}$ is zero when all the population imitates to $D$ strategy, therefore the payoff of $R$ and $D$ strategy is equal when $x_R,x_C=0$ and $x_D=1$. As $x_R$ slightly increases, the payoff of $R$ strategy users becomes greater than $D$ strategy users and $D$ strategy users imitates to $R$ strategy as in figure \ref{FGNrcc} and \ref{FGNrcd} that even with very small initial fraction from mutation, $R$ strategy is there in the final evolution. In figure \ref{FGNrcc}, \ref{FGNrcd} and \ref{FGNrce} with initial $R$ strategy fraction as 0.002, 0.005 and 0.0005 respectively, it can also be observed that as the initial fraction of $R$ strategy decreases, the final evolution time of the system increases. In figure \ref{FGNrcf} from beginning, the fraction of $D$ strategy users decrease because from beginning initial fraction of $R$ strategy remains greater than $0.25$ value. \begin{figure} \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{FGNa} \includegraphics[width=1\linewidth]{Reputation/Plots/Plots/Game1/plotGame1Evolution.png}\hfill \end{minipage}% } \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{FGNb} \includegraphics[width=1\linewidth]{Reputation/Plots/Plots/Game1/plotGame1Evolution1.png}\hfill \end{minipage}% }\par \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{FGNc} \includegraphics[width=1\linewidth]{Reputation/Plots/Plots/Game1/plotGame1Evolution2.png} \end{minipage}% } \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{FGNd} \includegraphics[width=1\linewidth]{Reputation/Plots/Plots/Game1/plotGame1Evolution3.png}\hfill \end{minipage}% }\par \caption{Round vs Fraction of population for the network with d=8, a=3, $\beta=4$, $\alpha=2$} \label{EvoluionGame1} \end{figure} \subsubsection{Reputation cost $\alpha$ is not negligible} In the second scenario $\alpha$ is not negligible. Results of this scenario also substantiate the theoretical results of Game 1. First we have taken the fraction of different strategies as 0.6, 0.2, 0.2 fraction of $R$, $C$ and $D$ strategies users respectively as shown in figure \ref{FGNa}. Initially when the $R$ strategy users are more than $\frac{a}{d+\beta}$ and $\frac{a(x_R+x_C) + \alpha}{d+\beta}$, and $D$ strategy users are lesser than $\frac{\alpha}{a}$ so the order of expected payoff becomes $P_C>P_R>P_D$. Due to this initially $R$ strategy users imitates to $C$ strategy users whereas $D$ strategy users imitates to $R$ and $C$ strategy users. The fraction of $R$ strategy users increases till the expected payoff of $R$ strategy remains greater than the expected payoff of population. This is the point where $x_R > \frac{\alpha}{\alpha+x_D(d+\beta-a)}$ i.e., $0.61$. After this point as the fraction of $R$ strategy decreases and comes to lower than $\frac{a}{d+\beta}$ i.e., $0.25$, then the expected payoff order becomes $P_D>P_C>P_R$ so now $R$ strategy users start to imitate to both $C$ and $D$ strategy users as shown in figure \ref{FGNa}. At this point as $C$ strategy users are more than 70\% and $D$ strategy users are lesser than 10\% so $R$ strategy users interacts with more $C$ strategy users and so they imitates to more $C$ strategy users. This continues till the expected payoff of $C$ strategy users is greater than the expected payoff of the population which is the point where $x_R > \frac{a}{(d+\beta-a)+\frac{\alpha}{x_D}}$. After this point more $R$ and $C$ strategy imitates to $D$ strategy and so $C$ strategy users also decrease and in final evolution all population imitates to the $D$ strategy. After this we run the simulation with 0.9, 0.05, 0.05 initial fraction of $R$, C and $D$ strategies users respectively (figure \ref{FGNb}). In this simulation $D$ strategy users almost dies out before the fraction of $R$ strategy users comes to lower than $\frac{a}{d+\beta}$ and only $C$ strategy users remained in the system. As system consist of most of $C$ strategy users, the payoff of $D$ strategy again start to increase but for some time until some user mutate to $D$ strategy only $C$ strategy remains in the system. As mutation takes place and some users mutates to $D$ strategy, $C$ strategy users also start to imitate $D$ strategy and finally $D$ strategy invades whole the population. After this we also run the simulation with two more different initial fraction and we found the same evolution in the system as in figure \ref{FGNc} and \ref{FGNd}. \begin{figure} \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{FGNpca} \includegraphics[width=1\linewidth]{Reputation/Plots/Plots/Game1/plotGame1EvolutionPC1.png} \end{minipage}% } \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{FGNpcb} \includegraphics[width=1\linewidth]{Reputation/Plots/Plots/Game1/plotGame1EvolutionPC2.png}\hfill \end{minipage}% }\par \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{FGNpcc} \includegraphics[width=1\linewidth]{Reputation/Plots/Plots/Game1/plotGame1EvolutionPC3.png} \end{minipage}% } \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{FGNpcd} \includegraphics[width=1\linewidth]{Reputation/Plots/Plots/Game1/plotGame1EvolutionPC4.png}\hfill \end{minipage}% }\par \caption{Round vs Fraction of population for the network with parameter values (a) $d=4$, $a=2.5$, $\beta=3$, $\alpha=2$ (b) $d=6$, $a=2.5$, $\beta=3$, $\alpha=2$ (c) $d=6$, $a=5$, $\beta=3$, $\alpha=4$ (d) $d=8$, $a=5$, $\beta=1$, $\alpha=2$} \end{figure} We also run the simulation with different parameter for the same initial fraction (0.4, 0.4 and 0.2 of $R$, $C$ and $D$ respectively). At first simulation we took $d=4$, $a=2.5$, $\beta=3$ and $\alpha=2$. In this setting initially as the $R$ strategy users are more than $\frac{a}{d+\beta}$ i.e., $0.35$ and lesser than $\frac{a(x_R+x_C) + \alpha}{d+\beta}$, and $D$ strategy users are lesser than $\frac{\alpha}{a}$, so expected payoff order becomes $P_C>P_D>P_R$. Due to this $R$ strategy users imitates to $C$ and $D$ strategy users. As $R$ strategy users decreases and comes to lower than $0.35$, the payoff to $D$ strategy users becomes greater than $C$ strategy users and so $C$ strategy users also start to imitate to $D$ strategy users due to this $C$ strategy users start to decrease. In this way the final evolution reaches with all $D$ strategy users in the population. In second simulation we increases the value of parameter $d$ to 6. We found that now in this setting initially more $R$ strategy users imitates to $C$ strategy, as now the $\frac{a}{d+\beta}$ is $0.27$ which is more lesser than $x_R$ than previous and so the rate of imitation is more than previous, but again in final evolution all users imitates to $D$ strategy. In third simulation we increases both cost of sharing $a$ and cost of reputation calculation $\alpha$ to 5 and 4 respectively. Due to this the increment in $C$ strategy population stops early from previous and users start to imitate to $D$ strategy earlier than previous setting. In fourth setting as we decreases the benefit of reputation increment the $C$ strategy users start to decrease earlier than previous setting. We found that even with different parameter setting the final evolution is same. \subsection{Numerical Analysis of Second Reputation Game} \begin{figure} \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{SGNa} \includegraphics[width=1\linewidth]{Reputation/Plots/Plots/Game2/plotGame2Evolution1C1.png}\hfill \end{minipage}% } \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{SGNb} \includegraphics[width=1\linewidth]{Reputation/Plots/Plots/Game2/payGame2Evolution1C1.png}\hfill \end{minipage}% }\par \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{SGNc} \includegraphics[width=1\linewidth]{Reputation/Plots/Plots/Game2/plotGame2Evolution1C2.png} \end{minipage}% } \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{SGNd} \includegraphics[width=1\linewidth]{Reputation/Plots/Plots/Game2/payGame2Evolution1C2.png}\hfill \end{minipage}% }\par \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{SGNe} \includegraphics[width=1\linewidth]{Reputation/Plots/Plots/Game2/plotGame2EvolutionFirstC4.png}\hfill \end{minipage}% } \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{SGNf} \includegraphics[width=1\linewidth]{Reputation/Plots/Plots/Game2/payGame2EvolutionFirstC4.png}\hfill \end{minipage}% }\par \caption{Round vs Fraction of population with corresponding varying payment vs time for the network with $d=8$, $a=3$, $\beta=4$, $\alpha=2$} \end{figure} In first simulation scenario, round based initial payment $p$ varies according to equation \ref{G2ESScond} for different initial fractions of strategies. We observe that when $D$ strategy users are more, then less $p$ is required and as $D$ strategy users decreases, $p$ increases, this is due to the fact that as $D$ strategy users are more, then $p$ is distributed among less users. Although initial payment in the defection free population is high but this initial payment is given back to the users during redistribution. The initial payment is not distributed back only to the users who defects and their part is distributed among the users who cooperates in the form of reward. First we run the simulation with fraction 0.05, 0.3 and 0.65 of $R$, $C$ and $D$ strategy as shown in figure \ref{SGNa}. As in this game if $x_D>\frac{\alpha}{a}$ then $P_R > P_C$ and initially the fraction of $D$ strategy users are almost equal to $\frac{\alpha}{a}$ i.e., $0.66$, therefore the payoff to $C$ strategy users are almost equal to $R$ strategy users. Also as if $x_R > \frac{a(1-x_D) + \alpha -\frac{p}{1-x_D}}{d+\beta}$ then $P_R > P_D$ and initially $x_R$ is greater than $\frac{a(1-x_D) + \alpha -\frac{p}{1-x_D}}{d+\beta}$ i.e $0.05 > 0.02$. Due to this the order of expected payoff becomes $P_C>P_R>P_D$ and $D$ strategy users imitates to $R$ and $C$ strategy. Therefore initially $R$ and $C$ both strategy users increase but as $D$ strategy users fraction decreases and $p$ increases then the fraction $\frac{a(1-x_D) + \alpha -\frac{p}{1-x_D}}{d+\beta}$ increases and at point when $x_D$ becomes $0.25$ than $x_R$ comes to lower than this fraction and so from now the expected payoff of $D$ strategy users becomes greater than $R$ strategy users and so $R$ strategy users also start to imitate to $D$ and $C$ strategy users. This process continues and in final evolution all users imitates to $C$ strategy. The same process repeats in other two evolution with initial fraction 0.6, 0.05 and 0.35 of $R$, $C$ and $D$ strategy respectively as shown in figure \ref{SGNb}, and with initial fraction 0.025, 0.025 and 0.95 of $R$, $C$ and $D$ strategy respectively as shown in figure \ref{SGNc}. In second simulation scenario the round based initial payment fulfills the condition \ref{G2ND}. This evolution is same as first game evolution figure \ref{EvoluionGame1}. \subsection{Numerical Analysis of Third Reputation Game} \begin{figure} \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{TGNa} \includegraphics[width=1\linewidth]{Reputation/Plots/Plots/Game3/plotGame3Evolution1.png}\hfill \end{minipage}% } \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{TGNap} \includegraphics[width=1\linewidth]{Reputation/Plots/Plots/Game3/payGame3Evolution1.png}\hfill \end{minipage}% }\par \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{TGNb} \includegraphics[width=1\linewidth]{Reputation/Plots/Plots/Game3/plotGame3Evolution2.png}\hfill \end{minipage}% } \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{TGNbp} \includegraphics[width=1\linewidth]{Reputation/Plots/Plots/Game3/payGame3Evolution2.png}\hfill \end{minipage}% }\par \caption{Round vs Fraction of population with corresponding varying payment vs time for the network with $d=8$, $a=2.5$, $\beta=4$, $\alpha=2$} \end{figure} In this simulation scenario round based initial payment is varied according to equation \ref{G3ESScond}. First we run the simulation for different initial fraction. At first we took fraction 0.002, 0.3 and 0.698 of $R$, $C$ and $D$ strategy respectively. As initially $R$ strategy users are lesser than $\frac{a}{d+\beta}$ so the payoff order becomes $P_R>P_D>P_C$. But as $D$ strategy are more so $C$ strategy users interact more $D$ strategy users and so they imitates to more $D$ strategy users initially. But as $R$ strategy users population increases, then $D$ strategy payoff start to decrease as $p$ is distributed among only $R$ strategic users so they got higher payoff than $C$ and $D$ strategy users and so $C$ and $D$ strategy users imitates to $R$ strategy users. In this scenario $p$ varies according to the fraction of $R$ strategy users so the payoff also varies accordingly. This results in getting more payoff to $R$ strategic users as they are getting higher payoff from $C$ strategy in the form of initial payment distribution. This process continues and in final evolution all population converges to all the $R$ strategy users as shown in figure \ref{TGNap}. We run the second simulation with 0.4, 0.3 and 0.3 fraction of $R$, $C$ and $D$ strategy as shown in figure \ref{TGNb}. In this fraction as $R$ strategy users are greater than $\frac{a}{d+\beta}$ so $D$ strategy users does not get better payoff and so both $D$ and $C$ strategy users imitates to $R$ strategy. This process continues and in final evolution again all population converges to all $R$ strategy users as in figure \ref{TGNb}. \begin{figure} \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{TGNpca} \includegraphics[width=1\linewidth]{Reputation/Plots/Plots/Game3/plotGame3EvolutionPC1.png} \end{minipage}% } \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{TGNpcb} \includegraphics[width=1\linewidth]{Reputation/Plots/Plots/Game3/plotGame3EvolutionPC2.png}\hfill \end{minipage}% }\par \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{TGNpcc} \includegraphics[width=1\linewidth]{Reputation/Plots/Plots/Game3/plotGame3EvolutionPC3.png} \end{minipage}% } \subfloat[]{% \begin{minipage}{0.5\linewidth} \label{TGNpcd} \includegraphics[width=1\linewidth]{Reputation/Plots/Plots/Game3/plotGame3EvolutionPC4.png}\hfill \end{minipage}% }\par \caption{Round vs Fraction of population for the network with parameter values (a) $d=8$, $a=7.5$, $\beta=4$, $\alpha=1$ (b) $d=8$, $a=3$, $\beta=4$, $\alpha=2.5$ (c) $d=8$, $a=7.5$, $\beta=4$, $\alpha=3$ (d) $d=8$, $a=7.5$, $\beta=4$, $\alpha=5$} \label{EvolutionG3PC} \end{figure} Now we fix the initial fraction to 0.4,0.3 and 0.3 for $R$, $C$ and $D$ respectively and varies the parameter values as in figure \ref{EvolutionG3PC}. We observe that as the difference between $d$ and $a$ increases, $D$ strategy reduction rate increases and $C$ strategy reduction rate decrease as shown in figure \ref{TGNpca}, \ref{TGNpcb}. This is because, with the increment of this difference $C$ strategy users payoff increases. We observed that when the number of $R$ strategy users are less in the population then less $p$ is required for motivating the players to imitate $R$ strategy. But as number of $R$ strategy users becomes more, more $p$ required which is redistributed among these $R$ strategy users. Therefore the contribution of this varying round based initial payment is that, when the system consists of only $R$ strategy users, then the value of $p$ will be $\alpha$ which is distributed back to all the $R$ strategy users and so no burden of the initial payment because whatever they are paying, they are getting the same. But as any player defects then he will not get his part and also his part is distributed among other $R$ strategy users. So this mechanism is punishing users who are not calculating reputation as well as rewarding the $R$ strategy users. \section{Discussion and Future Work} In our analysis we have observed that if varying round based initial payment is distributed among $R$ strategy users then $R$ strategy is evolutionary stable. In this analysis $R$ strategy users fully cooperates with cooperating users and fully defects with defectors. But as the reputation of users may be in analog form and not in binary form \cite{satsiou2010reputation}, the reputation strategy should be modified accordingly. With this setting of the game, we would have the continuum of the pure strategies with all the varying level. This setting of the game would allow us to study more practical reputation system based peer-to-peer network. Furthermore the payment distribution mechanism and recognition of reputation calculator users would also needs to be further investigated. In future a reputation system may be built that will overcome these limitations. \section{Conclusion} We analyse the reputation game in peer-to-peer network and found that without any additional incentive, reputation strategy is not an evolutionary stable strategy. In systems, where reputation strategy is used for promoting the cooperation, even on these systems, reputation is not an evolutionary stable strategy. For making the reputation strategy as evolutionary stable strategy first varying round based initial payment has to be incorporated and then this initial payment should be distributed among $R$ strategy users. We also analysed a game in which varying initial payment is to be distributed among $C$ and $R$ strategy users and in that game cooperation strategy would be an evolutionary stable strategy for varying initial payment. We also found that whether a number of different strategies has been found for stopping free-riding using reputation, but reputation alone is not an evolutionary stable strategy.
{'timestamp': '2017-03-27T02:03:50', 'yymm': '1703', 'arxiv_id': '1703.08286', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08286'}
arxiv
\section{Introduction} \sloppy The rapid developments of large-scale learning platforms (e.g., MOOCs (edx.org, coursera.org) and OpenStax Tutor (openstaxtutor.org)) have enabled not only access to high-quality learning resources to a large number of students, but also the collection of student data at very large scale. The scale of this data presents a great opportunity to revolutionize education by using machine learning algorithms to \emph{automatically} deliver personalized analytics and feedback to students and instructors in order to improve the quality of teaching and learning. \fussy \subsection{Detecting misconceptions from\\ student-response data} The predominant form of student data, their \emph{responses} to assessment questions, contain rich information on their knowledge. Analyzing why a student answers a question incorrectly is of crucial importance to deliver timely and effective feedback. Among the possible causes for a student to answer a question incorrectly, exhibiting one or more \emph{misconceptions} is critical, since upon detection of a misconception, it is very important to provide targeted feedback to a student to correct their misconception in a timely manner. Examples of using misconceptions to improve teaching include incorporating misconceptions to design better distractors for multiple-choice questions \cite{pavliklick}, implementing a dialogue-based tutor to detect misconceptions and provide corresponding feedback to help students self-practice \cite{dialoguetutor}, preparing prospective instructors by examining the causes of common misconceptions among students \cite{teachertrain}, and incorporating misconceptions into item response theory (IRT) for learning analytics \cite{tatsuokarule1}. The conventional way of leveraging misconceptions is to rely on a set of pre-defined misconceptions provided by domain experts \cite{grade12chem,pavliklick,teachertrain,dialoguetutor}. However, this approach is not scalable, since it requires a large amount of human effort and is domain-specific. With the large scale of student data at our disposal, a more scalable approach is to automatically detect misconceptions from data. Recently, researchers have developed approaches for data-driven misconception detection; most of these approaches analyze students' response to \emph{multiple-choice} questions. Examples of these approaches include detecting misconceptions in multiple-choice mathematics questions and modeling students' progress in correcting them \cite{kenlick} via the additive factor model \cite{afm}, and clustering students' responses across a number of multiple-choice physics questions \cite{april}. However, multiple-choice questions have been shown to be inferior to open-response questions in terms of pedagogical value \cite{ofvsmc}. Indeed, students' responses to open-response questions can offer deeper insights into their knowledge state. To date, detecting misconceptions from students' responses to open-response questions has largely remained an unexplored problem. A few recent developments work exclusively with \emph{structured} responses, e.g., sketches \cite{sketchopenformmc}, short mathematical expressions \cite{mathopenformmc}, group discussions in a chemistry class \cite{schmidtchem}, and algebra with simple syntax \cite{elmadanidatadriven}. \subsection{Contributions} In this paper, we propose a natural language processing framework that detects students' common misconceptions from their \emph{textual} responses to open-response, short-answer questions. This problem is very difficult, since the responses are, in general, \emph{unstructured}. Our proposed framework consists of the following steps. First, we transform students' textual responses to a number of short-answer questions into low-dimensional textual feature vectors using several well-known word-vector embeddings. These tools include the popular Word2Vec embedding \cite{word2vec}, the GLOVE embedding \cite{pennington2014glove}, and an embedding based on the long-short term memory (LSTM) neural network \cite{Palangi:2016,SHochreiter1997}. We then propose a new statistical model that jointly models both the transformed response textual feature vectors and expert labels on whether a response exhibits one or more misconceptions; these labels identify only \emph{whether or not} a response exhibits one or more misconceptions but not \emph{which} misconception it exhibits. Our model uses a series of latent variables: the feature vectors corresponding to the correct response to each question, the feature vectors corresponding to each misconception, the tendency of each student to exhibit each misconception, and the confusion level of each question on each misconception. We develop a Markov chain Monte Carlo (MCMC) algorithm for parameter inference under the proposed statistical model. We experimentally validate the proposed framework on a real-world educational dataset collected from high school classes on AP biology. Our experimental results show that the proposed framework excels at classifying whether a response exhibits one or more misconceptions compared to standard classification algorithms and significantly outperforms a baseline random forest classifier. We also compare the prediction performance across all three embeddings. More importantly, we show examples of common misconceptions detected from our dataset and discuss how this information can be used to deliver targeted feedback to help students correct their misconceptions. \section{Dataset and pre-processing} In this section, we first detail our short-answer response dataset, and then detail our pre-processing approach to convert responses into vectors using word-to-vector embeddings. \subsection{Dataset} Our dataset consists of students' textual responses to short-answer questions in high school classes on AP Biology administered on OpenStax Tutor \cite{ost}. Every response was labeled by an expert grader as to whether it exhibited one or more misconceptions. A total of $N = 386$ students each responded to a subset of a total of $Q = 1668$ questions; each response was manually labeled by one or multiple expert graders, resulting in a total of $\sim 60,000$ labeled responses. Since there is no clear rubric defining what is a misconception, graders might not necessarily agree on what label to assign to each response. Therefore, we trim the dataset to only keep responses that are labeled by multiple graders and they also assigned the same label, resulting in $13,099$ responses. We also further trim the dataset by filtering out students who respond to less than 5 questions and questions with less than 5 responses in every dataset. This subset contains $6,152$ responses. The questions in our dataset are drawn from the OpenStax AP biology textbook; we divide the full dataset into smaller subsets corresponding to each of the first four units \cite{osbio}, since different units correspond to entirely different sub-areas in biology. These units cover the following topics: \begin{itemize} \item{Unit 1: The Chemistry of Life, Chapters 1-3} \item{Unit 2: The Cell, Chapters 4-10} \item{Unit 3: Genetics, Chapters 11-17} \item{Unit 4: Evolutionary Processes, Chapters 18-20} \end{itemize} To summarize, we show the dimensions of the subsets of the data corresponding to each unit in Table~\ref{tbl:dataStat}. Since not every student was assigned to every question, the dataset is sparsely populated; Table~\ref{tbl:dataStat} also shows the portion of responses that are observed in the trimmed data subsets, denoted as ``sparsity''. \begin{table}[tp] \centering \caption{Statistics of subsets of the AP Biology datasets that correspond to each unit.} \label{tbl:dataStat} \vspace{0.2cm} \scalebox{1.00}{ \begin{tabular}{cccc} \toprule & $N$ & $Q$ & Sparsity (\%)\\ \midrule Unit 1 & 47 & 77 & 0.280\\ \midrule Unit 2 & 101 & 104 & 0.243\\ \midrule Unit 3 & 73 & 91 & 0.236\\ \midrule Unit 4 & 43 & 75 & 0.315\\ \bottomrule \end{tabular} } \end{table} \subsection{Response embeddings} We first perform a pre-processing step by transforming each textual student response into a corresponding real-valued vector via three different word-vector embeddings. Our first embedding uses the Word2Vec embedding \cite{word2vec} trained on the OpenStax Biology textbook (an approach also mentioned in \cite{openformtext}), to learn embeddings that put more emphasis on the technical vocabulary specific to each subject. We create the feature vector for each response by mapping each individual word in the response to its corresponding feature vector, and then adding them together. Concretely, denote $\mathbf{x}_{i,j} = \{w_1, w_2,...,w_{T_{i,j}} \}$ as the collection of words in the textual response of student~$j$ to question~$i$, where $T_{i,j}$ denotes the total number of words in this response (excluding common stopwords). We then map each word $w_t$ to its corresponding $D$-dimensional feature vector $r(w_t) \in \mathbb{R}^D$ using the trained Word2Vec model. We use $D = 10$ for the Word2Vec embedding. We then compute the student response feature vector as $\mathbf{f}_{i,j} = \sum_{t=1}^{T_{i,j}} r(w_t)$. Our second word-vector embedding is a pre-trained GLOVE embedding with $D=25$ \cite{pennington2014glove}. The GLOVE embedding is very similar to the Word2Vec embedding, with the main difference being that it takes corpus-level word co-occurrence statistics into account. Moreover, the quality of the GLOVE embedding for common words is likely higher since it is pre-trained on a huge corpus (comparing to only the OpenStax Biology textbook for Word2Vec). Both the Word2Vec embedding and the GLOVE embedding do not take word ordering into account, and for misconception classification, this drawback can lead to problems. For example, responses ``If X then Y'' and ``If Y then X'' may have completely different meanings depending on the context, where it's possible for one to exhibit a common misconception while the other one does not. Using the Word2Vec and GLOVE embeddings, these responses will be embedded to the same feature vector $\mathbf{f}_{i,j}$, making them indistinguishable from each other. Therefore, our third word-vector embedding is based on the long short-term memory (LSTM) neural network, which is a recurrent neural network that excels at capturing long-term dependencies in sequential data. Therefore, it can take word ordering into account, a feature that we believe is critical for misconception detection. We implement a 2-layer LSTM network with 10 hidden units and train it on the OpenStax Biology textbook. For each student response, we use the text as character-by-character inputs to the LSTM network and use the last layer's hidden unit activation values (stacked in a $D=10$ dimensional vector) as its textual feature $\mathbf{f}_{i,j}$. \section{Statistical Model} We now detail our statistical model; its graphical model is visualized in Figure~\ref{fig:plate}. Concretely, let there be a total of $N$ students, $Q$ questions, and $K$ misconceptions. Let $M_{i,j} \in \{0,1\}$ denote the binary-valued misconception label on the response of student~$j$ to question~$i$ provided by an expert grader, with $j \in \{ 1, \ldots, N\}$ and $i \in \{ 1, \ldots, Q\}$, where $1$ represents the presence of (one or more) misconceptions, and $0$ represents no misconceptions. We transform the raw text of student~$j$'s response to question~$i$ into a $D$-dimensional real-valued feature vector, denoted by $\vecf_{i,j} \in \mathbb{R}^D$, via a pre-processing step (detailed in the previous section). Let $\Omega \subseteq \{ 1, \ldots, Q\} \times \{ 1, \ldots, N\}$ denote the subset of student responses that are labeled, since every student only responds to a subset of the questions. \begin{figure}[t] \vspace{0.0cm} \centering \includegraphics[width=\columnwidth]{misconception-lite-eps-converted-to.pdf} \vspace{-0.0cm} \caption{Visualization of the statistical model. Black nodes denote observed data; white nodes denote latent variables to be inferred.} \label{fig:plate} \vspace{-0.0cm} \end{figure} We denote the \emph{tendency} of student~$j$ to exhibit misconception~$k$, with $k \in \{1,\ldots,K\}$ as $c_{k,j} \in \mathbb{R}$, and the \emph{confusion level} of question~$i$ on misconception~$k$, as $d_{i,k} \in \mathbb{R}$. Then, let $P_{i,j,k} \in \{0,1\}$ denote the binary-valued latent variable that represents whether student~$j$ exhibits misconception~$k$ in their response to question~$i$, with $1$ denoting that the misconception is present and $0$ otherwise. We model $P_{i,j,k}$ as a Bernoulli random variable \begin{align} \label{eq:p} p(P_{i,j,k} = 1) = \Phi(c_{k,j} + d_{i,k}), \quad (i,j) \in \Omega, \end{align} where $\Phi(x) = \int_{-\infty}^x \mathcal{N}(t;0,1) \mathrm{d}t$ denotes the inverse probit link function (the cumulative distribution function of the standard normal random variable). Given $P_{i,j,k} \; \forall k$, we model the observed misconception label $M_{i,j}$ as \begin{align} \label{eq:m} M_{i,j} = \left \{ \begin{array}{ll} 0 &\text{if} \; P_{i,j,k} = 0 \;\, \forall k, \\[0.1cm] 1 & \text{otherwise}, \end{array} \right. \quad (i,j) \in \Omega. \end{align} In words, a response is labeled as having a misconception if one or more misconceptions is present (given by the latent misconception exhibition variables $P_{i,j,k}$). Given $P_{i,j,k} \; \forall k$, the textual response feature vector that corresponds to student~$j$'s response to question~$i$, $\vecf_{i,j}$, is modeled as \begin{align} \label{eq:f} \vecf_{i,j} \distas \mathcal{N}(\boldsymbol{\gamma}_i + \sum_k P_{i,j,k} \boldsymbol{\theta}_k, \boldsymbol{\Sigma}_F), \quad \forall (i,j) \in \Omega, \end{align} where $\boldsymbol{\gamma}_i$ denotes the feature vector that corresponds to the correct response to question~$i$, $\boldsymbol{\theta}_k$ denotes the feature vector that corresponds to misconception~$k$, and $\boldsymbol{\Sigma}_F$ denotes the covariance matrix of the multivariate normal distribution characterizing the feature vectors. In other words, the feature vector of each response is a \emph{mixture} of the feature vectors corresponding to the correct response to the question and each misconception the student exhibits. In the next section, we develop an MCMC inference algorithm to infer the values of the latent variables $\boldsymbol{\gamma}_i$, $\boldsymbol{\theta}_k$, $\boldsymbol{\Sigma}_F$, $P_{i,j,k}$, $c_{k,j}$, and $d_{i,k}$, given observed data $\vecf_{i,j}$ and $M_{i,j}$. \section{Parameter Inference} \label{sec:algo} We use a Gibbs sampling algorithm \cite{gelmanbook} for parameter inference under the proposed statistical model. The prior distributions of the latent variables are listed as follows: \begin{align*} \boldsymbol{\gamma}_i & \distas \mathcal{N}(\boldsymbol{\mu}_\gamma, \boldsymbol{\Sigma}_\gamma), \\ \boldsymbol{\theta}_k & \distas \mathcal{N}(\boldsymbol{\mu}_\theta, \boldsymbol{\Sigma}_\theta), \\ \boldsymbol{\Sigma}_F & \distas IW(h_F, \bV_F), \\ c_{k,j} & \distas \mathcal{N}(\mu_c,\sigma_c^2), \\ d_{i,k} & \distas \mathcal{N}(\mu_d,\sigma_d^2), \end{align*} where $IW(\cdot)$ denotes the inverse-Wishart distribution and $\boldsymbol{\mu}_\gamma$, $\boldsymbol{\Sigma_\gamma}$, $\boldsymbol{\mu}_\theta$, $\boldsymbol{\Sigma_\theta}$, $h_F$, $\bV_F$, $\mu_c$, $\sigma_c^2$, $\mu_d$, and $\sigma_d^2$ are hyperparameters. We start by randomly initializing the values of the latent variables $\boldsymbol{\gamma}_i$, $\boldsymbol{\theta}_k$, $\boldsymbol{\Sigma}_F$, $P_{i,j,k}$, $c_{k,j}$, $d_{i,k}$, $a_j$, and $\mu_i$ by sampling from their prior distributions. Then, in each iteration of our Gibbs sampling algorithm, we iteratively sample the value of each random variable from its full conditional posterior distribution. Specifically, in each iteration, we perform the following steps: \begin{itemize} \item[a) Sample $P_{i,j,k}$:] We first sample the latent misconception indicator variable $P_{i,j,k}$ from its posterior distribution as \begin{align*} P_{i,j,k} \! = \! \left \{ \!\!\! \begin{array}{cl} 0 &\text{if} \; M_{i,j} = 0, \\[0.1cm] 1 & \text{if} \; M_{i,j} = 1 \; \text{and} \; P_{i,j,k'} = 0 \; \forall \; k' \neq k, \\ \frac{r}{r+1} & \text{if} \; M_{i,j} = 1 \; \text{and} \; \exists \; k' \neq k \; \text{s.t.} \; P_{i,j,k'} \!\! = \!\! 1, \end{array} \right. \end{align*} where \begin{align*} r & = \frac{p(\vecf_{i,j} | \boldsymbol{\gamma}_i, \boldsymbol{\theta}_k, \forall k, \boldsymbol{\Sigma}_F, P_{i,j,k' \neq k}, P_{i,j,k} = 1)}{p(\vecf_{i,j} | \boldsymbol{\gamma}_i, \boldsymbol{\theta}_k, \forall k, \boldsymbol{\Sigma}_F, P_{i,j,k' \neq k}, P_{i,j,k} = 0)} \cdot \\ & \quad \quad \frac{p(P_{i,j,k} = 1 | c_{k,j}, d_{i,k} )}{p(P_{i,j,k} = 0 | c_{k,j}, d_{i,k})}. \end{align*} The terms in the expression above are given by \fref{eq:p} and \fref{eq:f}. \item[b) Sample $\boldsymbol{\gamma}_i$:] We then sample the feature vector that corresponds to the correct response to each question, $\boldsymbol{\gamma}_i$, from its posterior distribution as $\boldsymbol{\gamma}_i \! \distas \! \mathcal{N}(\boldsymbol{\mu}_{\gamma_i},\boldsymbol{\Sigma}_{\gamma_i})$ where \begin{align*} \boldsymbol{\mu}_{\gamma_i} & = \boldsymbol{\Sigma}_{\gamma_i} \!\!\! \left(\boldsymbol{\Sigma}_\gamma^{-1} \boldsymbol{\mu}_\gamma + \boldsymbol{\Sigma}_F^{-1} \!\!\!\!\!\! \sum_{j: (i,j) \in \Omega} \!\!\!\!\!\! (\vecf_{i,j} - \sum_k P_{i,j,k} \boldsymbol{\theta}_k)\right),\\ \boldsymbol{\Sigma}_{\gamma_i} & = (\boldsymbol{\Sigma}_\gamma^{-1} + n_i \boldsymbol{\Sigma}_F^{-1})^{-1}, \end{align*} where $n_i = \sum_j I\left((i,j) \in \Omega \right)$. \item[c) Sample $\boldsymbol{\theta}_k$:] We then sample the feature vector that corresponds to each misconception, $\boldsymbol{\theta}_k$, from its posterior distribution as $\boldsymbol{\theta}_k \distas \mathcal{N}(\boldsymbol{\mu}_{\theta_k},\boldsymbol{\Sigma}_{\theta_k})$ where \begin{align*} \boldsymbol{\mu}_{\theta_k} & \! = \! \boldsymbol{\Sigma}_{\theta_k} \!\!\! \left( \!\! \boldsymbol{\Sigma}_\theta^{-1} \boldsymbol{\mu}_\theta \! + \! \boldsymbol{\Sigma}_F^{-1} \!\!\!\!\!\!\!\! \sum_{i,j: P_{i,j,k} = 1} \!\!\!\!\!\!\! (\vecf_{i,j} \!- \! \boldsymbol{\gamma}_i \! - \!\! \sum_{k' \neq k} \!\! P_{i,j,k'} \boldsymbol{\theta}_{k'}) \!\! \right) \!\!,\\ \boldsymbol{\Sigma}_{\theta_k} & = (\boldsymbol{\Sigma}_\theta^{-1} + n_k \boldsymbol{\Sigma}_F^{-1})^{-1}, \end{align*} where $n_k = \sum_{i,j} I\left( P_{i,j,k} = 1 \right)$. \item[d) Sample $\boldsymbol{\Sigma}_F$:] We then sample the covariance matrix $\boldsymbol{\Sigma}_F$ from its posterior distribution as \begin{align*} \boldsymbol{\Sigma}_F & \distas IW \left(h_F + n, \bV_F + \bM) \right), \end{align*} where $n \!\! = \!\! \sum_{i,j} I \left((i,j) \in \Omega\right)$ and $\bM = \sum_{i,j: (i,j) \in \Omega} (\vecf_{i,j} - \boldsymbol{\gamma}_i - \sum_k P_{i,j,k} \boldsymbol{\theta}_k) (\vecf_{i,j} - \boldsymbol{\gamma}_i - \sum_k P_{i,j,k} \boldsymbol{\theta}_k)^T$. \item[e) Sample $c_{k,j}$ and $d_{i,k}$:] In order to sample $c_{k,j}$ and $d_{i,k}$, we first sample the value of the auxiliary variable $z_{i,j,k}$ (following the standard approach proposed in \cite{albertchib}) as \begin{align*} z_{i,j,k} \distas \mathcal{N}^\pm(c_{k,j} + d_{i,k}, 1), \forall (i,j) \in \Omega, \end{align*} where $\mathcal{N}^\pm(\cdot)$ denotes the truncated normal random distribution truncated to the positive side when $P_{i,j,k} = 1$ and negative side when $P_{i,j,k} = 0$. We then sample $c_{k,j}$ from its posterior distribution as \begin{align*} c_{k,j} \distas \mathcal{N}(\mu_{c_{k,j}},\sigma_{c_{k,j}}^2), \end{align*} where $n_j = \sum_i I\left((i,j) \in \Omega \right)$, $\sigma_{c_{k,j}}^2 = 1/(1/\sigma_c^2 + n_j)$, and $\mu_{c_{k,j}} \!\! = \!\!\sigma_{c_{k,j}}^2 \!\! \left(\mu_c /\sigma_c^2 + \sum_{i: (i,j) \in \Omega} (z_{i,j,k} - d_{i,k}) \right)$. We then sample $d_{i,k}$ from its posterior distribution as \begin{align*} d_{i,k} \distas \mathcal{N}(\mu_{d_{i,k}},\sigma_{d_{i,k}}^2), \end{align*} where $\sigma_{d_{i,k}}^2 \!\! = \!\! 1/(1/\sigma_d^2 + n_i)$, and $\mu_{d_{i,k}} = \sigma_{d_{i,k}}^2 (\mu_d /\sigma_d^2 + \sum_{j: (i,j) \in \Omega} (z_{i,j,k} - c_{k,j}) )$. \end{itemize} We run the iterations detailed above for a number of $T$ total iterations with a certain burn-in period, and use the samples of each latent variable to approximate their posterior distributions. \sloppy \paragraph{Label switching} Parameter inference under our model suffers from the label-switching issue that is common in mixture models \cite{gelmanbook}, meaning that the mixture components might be permuted between iterations. We employ a post-processing step to resolve this issue. Specifically, we first calculate the augmented data likelihood at each iteration (indexed by $\ell$) as \begin{align*} L^\ell & = \prod_{i,j} p(\vecf_{i,j} \!\mid\! \boldsymbol{\gamma}_i^\ell, P_{i,j,k}^\ell, \boldsymbol{\theta}_k^\ell, \forall k) \prod_{i,j,k} p(P_{i,j,k}^\ell \!\mid\! c_{k,j}^\ell, d_{i,k}^\ell) \\ & = \prod_{i,j} \mathcal{N}(\vecf_{i,j} \!\mid\! \boldsymbol{\gamma}_i^\ell + \sum_k P_{i,j,k}^\ell \boldsymbol{\theta}_k^\ell, \boldsymbol{\Sigma}_F^\ell) \times \\ & \quad \prod_{i,j,k} \Phi( (2 P_{i,j,k}^\ell -1) (c_{k,j}^\ell + d_{i,k}^\ell)). \end{align*} Then, we identify the iteration $\ell_\text{max}$ with the largest augmented data likelihood, and permute the variables $\boldsymbol{\theta}_k^\ell$, $c_{k,j}^\ell$, and $d_{i,k}^\ell$ that best match the variables $\boldsymbol{\theta}_k^{\ell_\text{max}}$, $c_{k,j}^{\ell_\text{max}}$, and $d_{i,k}^{\ell_\text{max}}$. After this post-processing step, we can simply calculate the posterior means of each one of these sets of variables by taking averages of their values across non burn-in iterations. \begin{figure*}[t] \centering \subfigure[Unit 1 ]{\includegraphics[scale=0.095]{figures/LSTM10_unit1_shadow.png}} \hspace{0cm} \subfigure[Unit 2 ]{\includegraphics[scale=0.095]{figures/LSTM10_unit2.png}} \hspace{0cm} \subfigure[Unit 3 ]{\includegraphics[scale=0.095]{figures/LSTM10_unit3.png}} \hspace{0cm} \subfigure[Unit 4 ]{\includegraphics[scale=0.095]{figures/LSTM10_unit4.png}} \caption{Comparison of the prediction performance of the proposed model against RF on our AP Biology dataset using the ACC metric as the number of latent misconceptions $K$ varies, with the LSTM embedding.} \label{fig:D_LSTM10_accuracy} \end{figure*} \fussy \section{Experiments} We experimentally validate the efficacy of the proposed framework using our AP Biology class dataset. We first compare the proposed framework against a baseline random forest (RF) classifier that classifies whether a student response exhibits one or more misconceptions. We then show common misconceptions detected in our datasets and discuss how the proposed framework can use this information to deliver meaningful targeted feedback to students that helps them correct their misconceptions. \subsection{Experimental setup} We run our experiments with $K \in \{ 2,4,6,8,10 \} $ latent misconceptions with hyperparameters $\boldsymbol{\mu}_\gamma = \boldsymbol{\mu}_\theta = \mathbf{0}_D$, $\boldsymbol{\Sigma}_\gamma = \boldsymbol{\Sigma}_\gamma = \bV_F = \bI_D$, $h_F = 10$, $\mu_c = \mu_d = 0$, and $\sigma_c^2 = \sigma_d^2 = 1$, for a total of $T = 500$ iterations with the first $250$ iterations as burn-in. We compare the proposed framework against a baseline random forest (RF) classifier\footnote{The RF classifier achieves the best performance among a number of off-the-shelf baseline classifiers, e.g., logistic regression, support vector machines, etc. Therefore, we do not compare it against other baseline classifiers.} using the textual response feature vectors $\vecf_{i,j}$ to classify the binary-valued misconception label $M_{i,j}$, with 200 decision trees. We randomly partition each dataset into 5 folds and use 4 folds as the training set and the other fold as the test set. We then train the proposed framework and RF on the training set and evaluate their performance on the test set, using two metrics: i) prediction accuracy (ACC), i.e., the portion of correct predictions, and ii) area under curve (AUC), i.e., the area under the receiver operating characteristic (ROC) curve of the resulting binary classifier \cite{accauc}. Both metrics take values in $[0,1]$, with larger values corresponding to better prediction performance. We repeat our experiments for $20$ random partitions of the folds. For the proposed framework, the predictive probability that a response with its feature vector $\vecf_{i,j}$ exhibits a misconception, i.e., the probability that at least one of the $K$ latent misconception exhibition state variables take the value of $1$, is given by $1 - \widehat{p}_{i,j}$, where \begin{align*} \widehat{p}_{i,j} & = p(M_{i,j} = 0 \!\mid\! \vecf_{i,j}, \boldsymbol{\gamma}_i, \boldsymbol{\Sigma}_F, \boldsymbol{\theta}_k, \forall k, c_{k,j}, d_{i,k}) \\ & = \frac{p(\vecf_{i,j} \!\!\mid\!\! \boldsymbol{\theta}_k, P_{i,j,k} = 0, \forall k) \prod_k p(P_{i,j,k} = 0 \!\!\mid\!\! c_{k,j}, d_{i,k})}{\sum_{P_{i,j,k}, \, \forall k} \! (p(\vecf_{i,j} \!\mid\! \boldsymbol{\theta}_k, P_{i,j,k} \forall k) \prod_k p(P_{i,j,k} \!\!\mid\!\! c_{k,j}, d_{i,k}))}, \end{align*} where in the last expression we omitted the conditional dependency of $\vecf_{i,j}$ on $\boldsymbol{\gamma}_i$ and $\boldsymbol{\Sigma}_F$ due to spatial constraints. For RF, the predictive probability is given by the fraction of decision trees that classifies $M_{i,j} = 1$ given $\vecf_{i,j}$. \subsection{Results and discussions} \sloppy The number of latent misconceptions $K$ is an important parameter controlling the granularity of the misconceptions that we aim to detect. Figure~\ref{fig:D_LSTM10_accuracy} shows the comparison between the proposed framework using different values of $K$ and RF using the ACC metric with the LSTM embedding. We see an obvious trend that, as $K$ increases, the prediction performance decreases. The likely cause of this trend is that the proposed framework tends to overfit as the number of latent misconceptions grows very large since some of our datasets do not contain very rich misconception types. Moreover, the number of common misconceptions varies across different units, with Unit~$2$ likely containing more misconception types than Units~$1$ and $4$. \fussy We then compare the performance of the proposed framework against RF on misconception label classification in \fref{tbl:word2vec} using $K=2$ and all three embeddings. Tables~\ref{tbl:word2vec}-\ref{tbl:lstm} show comparisons of the proposed framework against RF using both the ACC and AUC metrics on all three different word embeddings. The proposed framework significantly outperforms RF (1--4\% using the ACC metric and 4-18\% using the AUC metric) on almost all 4 data subsets using every embedding. The only case where the proposed framework does not outperform RF is on Unit~$1$ using the GLOVE embedding. We postulate that the reason for this result is that this unit is about chemistry and has a lot of responses with more chemical molecular expressions than words; therefore, the proposed framework does not have enough textual information to exhibit its advantages (grouping responses that share the same misconceptions into clusters) over the simple classifier RF. Both the proposed framework and RF perform much better using the GLOVE and LSTM embeddings than the Word2Vec embedding. This result is likely due to the fact that these embeddings are more advanced than the Word2Vec embedding: the GLOVE embedding considers additional word co-occurrence statistics than the Word2Vec embedding, is trained on a much larger corpus, and has a higher dimension $D=25$, while the LSTM embedding is the only embedding that takes word ordering into account. Moreover, both algorithms perform best on Unit~$4$, which is likely due to two reasons: i) the Unit~$4$ subset has a larger portion of its responses labeled, and ii) Unit~$4$ is about evolution, which results in responses that are much longer and thus contains richer textual information. \begin{table*}[t] \centering \caption{Performance comparison on misconception label classification of a textual response in terms of the prediction accuracy (ACC) and area under the receiver operating characteristic curve (AUC) of the proposed framework against a random forest (RF) classifier, using the AP Biology dataset and the Word2Vec embedding.} \label{tbl:word2vec} \vspace{-0.0cm} \scalebox{0.8}{ \begin{tabular}{ccccccccc} \toprule & \multicolumn{2}{c}{Unit 1} & \multicolumn{2}{c}{Unit 2} & \multicolumn{2}{c}{Unit 3} & \multicolumn{2}{c}{Unit 4} \\ \cmidrule(l){2-3} \cmidrule(l){4-5} \cmidrule(l){6-7} \cmidrule(l){8-9} & ACC & AUC & ACC & AUC & ACC & AUC & ACC & AUC \\ \midrule Proposed framework & ${\bf 0.789\!\pm\! 0.014}$ & ${\bf 0.762 \!\pm\! 0.027}$ & ${\bf 0.774 \!\pm\! 0.015}$ & ${\bf 0.758 \!\pm\! 0.023}$ & ${\bf 0.779 \!\pm\! 0.019}$ & ${\bf 0.752 \!\pm\! 0.020}$ & $ {\bf0.887 \!\pm\! 0.011}$ & ${\bf 0.774 \!\pm\! 0.029}$ \\ \midrule RF & $0.762\!\pm\! 0.019$ & $0.645\!\pm\! 0.025$ & $0.735\!\pm\! 0.011$ & $0.676\!\pm\! 0.014$ & $0.758\!\pm\! 0.017$ & $0.630\!\pm\! 0.024$ & $0.873\!\pm\! 0.009$ & $0.604\!\pm\! 0.034$ \\ \bottomrule \end{tabular} } \end{table*} \begin{table*} \centering \caption{Performance comparison on misconception label classification of a textual response in terms of the prediction accuracy (ACC) and area under the receiver operating characteristic curve (AUC) of the proposed framework against a random forest (RF) classifier, using the AP Biology dataset and the GLOVE embedding.} \label{tbl:glove} \vspace{-0.0cm} \scalebox{0.8}{ \begin{tabular}{ccccccccc} \toprule & \multicolumn{2}{c}{Unit 1} & \multicolumn{2}{c}{Unit 2} & \multicolumn{2}{c}{Unit 3} & \multicolumn{2}{c}{Unit 4} \\ \cmidrule(l){2-3} \cmidrule(l){4-5} \cmidrule(l){6-7} \cmidrule(l){8-9} & ACC & AUC & ACC & AUC & ACC & AUC & ACC & AUC \\ \midrule Proposed framework & $0.867 \!\pm\! 0.014$ & ${\bf 0.762 \!\pm\! 0.048}$ & ${\bf 0.870 \!\pm\! 0.010}$ & ${\bf 0.821 \!\pm\! 0.024}$ & ${\bf 0.893 \!\pm\! 0.017}$ & ${\bf 0.794 \!\pm\! 0.039}$ & ${\bf 0.953 \!\pm\! 0.015}$ & ${\bf 0.892 \!\pm\! 0.047}$ \\ \midrule RF & ${\bf 0.876\!\pm\! 0.014}$ & $0.697\!\pm\! 0.022$ & $0.859\!\pm\! 0.013$ & $0.771\!\pm\! 0.040$ & $0.883\!\pm\! 0.008$ & $0.616\!\pm\! 0.043$ & $0.948\!\pm\! 0.019$ & $0.731\!\pm\! 0.006$ \\ \bottomrule \end{tabular} } \end{table*} \begin{table*} \centering \caption{Performance comparison on misconception label classification of a textual response in terms of the prediction accuracy (ACC) and area under the receiver operating characteristic curve (AUC) of the proposed framework against a random forest (RF) classifier, using the AP Biology dataset and the LSTM embedding.} \label{tbl:lstm} \vspace{-0.0cm} \scalebox{0.8}{ \begin{tabular}{ccccccccc} \toprule & \multicolumn{2}{c}{Unit 1} & \multicolumn{2}{c}{Unit 2} & \multicolumn{2}{c}{Unit 3} & \multicolumn{2}{c}{Unit 4} \\ \cmidrule(l){2-3} \cmidrule(l){4-5} \cmidrule(l){6-7} \cmidrule(l){8-9} & ACC & AUC & ACC & AUC & ACC & AUC & ACC & AUC \\ \midrule Proposed framework &${\bf 0.873 \!\pm\! 0.042}$ & ${\bf 0.772 \!\pm\! 0.093}$ & ${\bf 0.865 \!\pm\! 0.025}$ & ${\bf 0.829 \!\pm\! 0.044}$ & ${\bf 0.873 \!\pm\! 0.027}$ & ${\bf 0.792 \!\pm\! 0.061}$ & ${\bf 0.936 \!\pm\! 0.032}$ & ${\bf 0.832 \!\pm\! 0.094}$ \\ \midrule RF & ${ 0.865\!\pm\! 0.035}$ & $0.711\!\pm\! 0.086$ & $0.838\!\pm\! 0.028$ & $0.722\!\pm\! 0.043$ & $0.854\!\pm\! 0.028$ & $0.697\!\pm\! 0.057$ & $0.931\!\pm\! 0.025$ & $0.709\!\pm\! 0.105$ \\ \bottomrule \end{tabular} } \end{table*} \subsection{Uncovering common misconceptions} We emphasize that, in addition to the proposed framework's significant improvement over RF in terms of misconception label classification, it features great interpretability since it identifies common misconceptions from data. As an illustrative example, the following responses from multiple students across two questions are identified to exhibit the same misconception in the Unit~$4$ subset using the Word2Vec embedding: \medskip \begin{mdframed} {\em Question~1}: People who breed domesticated animals try to avoid inbreeding even though most domesticated animals are indiscriminate. Evaluate why this is a good practice.\\ {\em Correct Response}: A breeder would not allow close relatives to mate, because inbreeding can bring together deleterious recessive mutations that can cause abnormalities and susceptibility to disease. \\ {\bf Student Response~1}: Inbreeding can cause a rise in unfavorable or detrimental traits such as genes that cause individuals to be prone to disease or have unfavorable mutations. \\ {\bf Student Response~2}: Interbreeding can lead to harmful mutations. \end{mdframed} \begin{mdframed} {\em Question~2}: When closely related individuals mate with each other, or inbreed, the offspring are often not as fit as the offspring of two unrelated individuals. Why? \\ {\em Correct Response}: Inbreeding can bring together rare, deleterious mutations that lead to harmful phenotypes. \\ {\bf Student Response~3}: Leads to more homozygous recessive genes thus leading to mutation or disease.\\ {\bf Student Response~4}: When related individuals mate it can lead to harmful mutations. \end{mdframed} \medskip Although these responses are from different students to different questions, they exhibit one common misconception, that inbreeding leads to harmful mutations. Once this misconception is identified, course instructors can deliver the targeted feedback that inbreeding only brings together harmful mutations, leading to issues like abnormalities, rather than directly leading to harmful mutations. Moreover, the proposed framework can automatically discover common misconceptions that students exhibit without input from domain experts, especially when the number of students and questions are very large. Specifically, in the example above, we are able to detect such a common misconception that 4 responses exhibit by analyzing the 1016 responses in the AP Biology Unit 4 dataset; however, it would not likely be detected if the number of responses was smaller and fewer students exhibited the misconception. This feature makes it an attractive data-driven aid to domain experts in designing educational content to address student misconceptions. We show another example that the proposed framework can automatically group student responses to the same group according to the misconceptions they exhibit. The example shows two detected common misconceptions among students' responses to a single question in the Unit~$2$ subset using the LSTM embedding: \medskip \begin{mdframed} {\em Question}: What is the primary energy source for cells? \\ {\em Correct response}: Glucose. \\ {\bf Student responses with misconception~$1$:}\\ sunlight \\ sun \\ The sun \\ he sun? \\ {\bf Student responses with misconception~$2$:}\\ ATP \\ adenosine triphosphate \\ ATPPPPPPPPPPPPP \\ atp mitochondria \end{mdframed} \medskip We see that the proposed framework has successfully identified two common misconception groups, with incorrect responses that list ``sun'' and ``ATP'' as the primary energy source for cells. Note that the LSTM embedding enables it to assign the full and abbreviated form of the same entity (``adenosine triphosphate'' and ``ATP'') into the same misconception cluster, without employing any pre-processing on the raw textual response data. The likely reason for this result is that our LSTM embedding is trained on a character-by-character level on the OpenStax Biology textbook, where these terms appear together frequently, thus enabling the LSTM to transform them into similar vectors. This observation highlights the importance of using good, information-preserving word-vector embeddings for the proposed framework to maximize its capability of detecting common misconceptions. \section{Conclusions and Future Work} In this paper, we have proposed a natural language processing-based framework for detecting and classifying common misconceptions in students' textual responses. Our proposed framework first transforms their textual responses into low-dimensional feature vectors using three existing word-vector embedding techniques, and then estimates the feature vectors characterizing each misconception, among other latent variables, using a proposed mixture model that leverages information provided by expert human graders. Our experiments on a real-world educational dataset consisting of students' textual responses to short-answer questions showed that the proposed framework excels at classifying whether a response exhibits one or more misconceptions. Our proposed framework is also able to group responses with the same misconceptions into clusters, enabling the data-driven discovery of common misconceptions without input from domain experts. Possible avenues of future work include i) automatically generate the appropriate feedback to correct each misconception, ii) leverage additional information, such as the text of the correct response to each question, to further improve the performance on predicting misconception labels, iii) explore the relationship between the dimension of the word-vector embeddings and prediction performance, and iv) develop embeddings for other types of responses, e.g., mathematical expressions \cite{mlp} and chemical equations. \newpage \balance \bibliographystyle{abbrv}
{'timestamp': '2017-03-31T02:02:47', 'yymm': '1703', 'arxiv_id': '1703.08544', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08544'}
arxiv
\section{Conclusion}\label{sec:conclusion} \noindent In this paper, we addressed the problem of nearest-neighbor optimization for a given quantum circuit, an arbitrary topology graph and an initial configuration specifying the location of qubits in the topology graph. We formulated the problem using two ILP variants --- one of the variant for obtaining the optimal solution and a simpler variant that can obtain a bounded solution. In addition, our problem formulation allows the optimization to be performed as a large set of small optimizations or a smaller set of larger optimization problems, by setting appropriate block sizes. We demonstrated the effectiveness of our approach by running it on a set of benchmark circuits. Further research can be undertaken to solve the same problem for arbitrary topologies by heuristic based approaches that would allow scaling for larger circuits. \section{Experimental Results}\label{sec:exp} \noindent In this section, we present the benchmarking results for multiple quantum circuits from~\cite{revlib} for various topologies. We used Gurobi~\cite{gurobi} as ILP solver. For all the block sizes, we set TIME\_LIMIT parameter of Gurobi to 600 seconds to limit the time of execution of the solver, except for solving full circuit optimization for which we set TIME\_LIMIT to 7200. We set the number of threads parameter in Gurobi to 8. For the experiments, we used 64-bit Ubuntu 14.04 running on Intel(R) Xeon(R) CPU E5-1650 [email protected] with 15.6 GB RAM. \begin{table}[h] \def3pt{3pt} \centering \vspace{0.1cm} \caption{Realisation of all configurations of 4-qubits for 1D-topology} \label{table:perm} \begin{tabular}{|c|cc|c|cc|c|cc|}\bottomrule \textbf{Config.} & \textbf{\#}S & \textbf{D} & \textbf{Config.} & \textbf{\#S} & \textbf{D} & \textbf{Config.} & \textbf{\#S} & \textbf{D} \\ \hline a b c d &0& 0&b c a d &2& 2&c d a b &2& 1\\ a b d c &1& 1&b c d a &3& 3&c d b a &1& 1\\ a c b d &1& 1&b d a c &3& 2&d a b c &3& 3\\ a c d b &2& 2&b d c a &2& 2&d a c b &2& 2\\ a d b c &2& 2&c a b d &2& 2&d b a c &2& 2\\ a d c b &3& 3&c a d b &3& 2&d b c a &1& 1\\ b a c d &1& 1&c b a d &3& 3&d c a b &1& 1\\ b a d c &2& 1&c b d a &2& 2&d c b a &0& 0\\\toprule \end{tabular} \end{table} Table~\ref{table:perm} demonstrates realization of all possible configurations of 4-variables for 1D topology. The initial configuration is assumed to [a,b,c,d]. \#S and D is the number of swap gates required and the corresponding delay to realise the target configuration respectively. This table has been obtained using Problem formulation $P_2$ with $k$=1. We would like to highlight that configuration [a b c d] and [d c b a] are identical since for both the configuration the pair of nearest-neighbor variables is same. \begin{table}[h] \def3pt{3pt} \centering \caption{Benchmarking results for various block size for 1D-topology} \label{table:1D} \begin{tabular}{|lrrrc|rr|rr|rr|rr|rr|r} \bottomrule \textbf{Benchmark} & \textbf{\#Var} & \textbf{\#Gates} & \textbf{\#L} & \textbf{Tech.} & \multicolumn{2}{c|}{\textbf{b=1}} & \multicolumn{2}{c|}{\textbf{b=2}} & \multicolumn{2}{c|}{\textbf{b=4}} & \multicolumn{2}{c|}{\textbf{b=8}} & \multicolumn{2}{c|}{\textbf{b=16}} \\ & & & & & \#S & D & \#S & D & \#S & D & \#S & D & \#S & D \\ \hline 3\_17\_14 & 3 & 6 & 6 & $P_2$ & 3 & 9 & 3 & 8 & 3 & 8 & 3 & 8 & 3 & 8 \\ & & & & $P_3$ & 3 & 9 & 3 & 8 & 3 & 8 & 3 & 8 & 3 & 8 \\ 4gt11-v1\_85 & 5 & 4 & 3 & $P_2$ & 5 & 7 & 5 & 7 & 8 & 7 & 8 & 7 & 8 & 7 \\ & & & & $P_3$ & 5 & 7 & 5 & 7 & 7 & 7 & 7 & 7 & 7 & 7 \\ 4mod5-v1\_25 & 5 & 4 & 3 & $P_2$ & 3 & 5 & 3 & 5 & 3 & 5 & 3 & 5 & 3 & 5 \\ & & & & $P_3$ & 3 & 5 & 3 & 5 & 4 & 5 & 4 & 5 & 4 & 5 \\ alu-bdd\_288 & 7 & 9 & 8 & $P_2$ & 22 & 19 & 19 & 17 & --- & --- & --- & --- & --- & --- \\ & & & & $P_3$ & 22 & 19 & 26 & 18 & --- & --- & --- & --- & --- & --- \\ ex-1\_166 & 3 & 4 & 4 & $P_2$ & 1 & 5 & 1 & 5 & 1 & 5 & 1 & 5 & 1 & 5 \\ & & & & $P_3$ & 1 & 5 & 1 & 5 & 1 & 5 & 1 & 5 & 1 & 5 \\ ex1\_226 & 6 & 7 & 5 & $P_2$ & 7 & 9 & 7 & 9 & 8 & 9 & 8 & 9 & 8 & 9 \\ & & & & $P_3$ & 8 & 9 & 8 & 9 & 8 & 7 & 8 & 7 & 8 & 7 \\ fredkin\_7 & 3 & 1 & 1 & $P_2$ & 0 & 1 & 0 & 1 & 0 & 1 & 0 & 1 & 0 & 1 \\ & & & & $P_3$ & 0 & 1 & 0 & 1 & 0 & 1 & 0 & 1 & 0 & 1 \\ graycode6\_48 & 6 & 5 & 5 & $P_2$ & 0 & 5 & 0 & 5 & 0 & 5 & 0 & 5 & 0 & 5 \\ & & & & $P_3$ & 0 & 5 & 0 & 5 & 0 & 5 & 2 & 5 & 2 & 5 \\ ham3\_103 & 3 & 4 & 4 & $P_2$ & 4 & 7 & 3 & 6 & 3 & 6 & 3 & 6 & 3 & 6 \\ & & & & $P_3$ & 4 & 7 & 3 & 6 & 3 & 6 & 3 & 6 & 3 & 6 \\ mod5d2\_70 & 5 & 8 & 7 & $P_2$ & 6 & 12 & 6 & & 8 & 12 & 9 & 10 & 10 & 10 \\ & & & & $P_3$ & 6 & 12 & 8 & 10 & 6 & 12 & 10 & 10 & 10 & 10 \\ one-two-three-v3\_101 & 5 & 8 & 7 & $P_2$ & 11 & 13 & 11 & 13 & 10 & 13 & 10 & 13 & 10 & 13 \\ & & & & $P_3$ & 12 & 15 & 14 & 14 & 9 & 12 & 9 & 12 & 9 & 12 \\ peres\_9 & 3 & 2 & 2 & $P_2$ & 2 & 4 & 2 & 4 & 2 & 4 & 2 & 4 & 2 & 4 \\ & & & & $P_3$ & 2 & 4 & 2 & 4 & 2 & 4 & 2 & 4 & 2 & 4 \\ rd32\_272 & 5 & 6 & 5 & $P_2$ & 12 & 11 & 9 & 11 & 9 & 11 & 9 & 11 & 9 & 11 \\ & & & & $P_3$ & 10 & 11 & 12 & 11 & 9 & 11 & 9 & 11 & 9 & 11 \\ toffoli\_double\_4 & 4 & 2 & 2 & $P_2$ & 3 & 4 & 3 & 4 & 3 & 4 & 3 & 4 & 3 & 4 \\ & & & & $P_3$ & 3 & 4 & 3 & 4 & 3 & 4 & 3 & 4 & 3 & 4 \\ xor5\_254 & 6 & 7 & 5 & $P_2$ & 7 & 9 & 7 & 9 & 6 & 9 & 9 & 8 & 9 & 8 \\ & & & & $P_3$ & 8 & 9 & 8 & 8 & 8 & 7 & 8 & 7 & 8 & 7 \\ \toprule \end{tabular} \end{table} Table~\ref{table:1D} presents the results of 1D-Nearest neighbors for multiple block size $b=$\{1, 2, 4, 8, 16\}. The column Tech. indicates whether the solution for a benchmark is obtained using the problem formulations $P_2$ or $P_3$. Using a large block size is expected to reduce overall circuit delay, since the optimization solver can search a larger solution space to obtain optimal solution in that space instead of hitting a locally optimal solution. For circuit {\em xor5\_254} , the delay for block side $b=1$ is 9 while that with block size $b=4$ is 7. On the other hand, by using a smaller block, it is possible to obtain a feasible solution within the time limits specified for the solver, since the solver has to solve a smaller instance of the formulated ILP. For example, solutions could not be obtained for $b \ge 4$ within the specified time limits for circuit {\em alu-bdd\_288}. It should be noted that for all block sizes $b < L$, where $L$ is the number of levels in the circuit, the overall circuit is not guaranteed to have least delay, even when using formulation $P_3$ since combining the optimal solutions of the subproblems does not guarantee globally optimal solution. \begin{table}[h] \def3pt{3pt} \centering \vspace{0.1cm} \caption{Benchmarking results for {\em 4gt10-v1\_81} using $P_3$ formulation, $w=1$} \label{table:b2} \begin{tabular}{|c|cc|cc|cc|cc|cc|cc|cc|} \bottomrule & \textbf{\#G} & D & \multicolumn{2}{c|}{\textbf{1D}} & \multicolumn{2}{c|}{\textbf{Cycle}} & \multicolumn{2}{c|}{\textbf{2D-Mesh}} & \multicolumn{2}{c|}{\textbf{Torus}} & \multicolumn{2}{c|}{\textbf{3D-Grid}} & \multicolumn{2}{c|}{\textbf{CBN}} \\ & & &\#S & D & \#S & D & \#S & D & \#S & D & \#S & D & \#S & D \\\hline Original & 6 & 6 & \multicolumn{2}{c|}{NF} & \multicolumn{2}{c|}{NF} & 11 & 11 & 5 & 9 & 7 & 11 & ---&--- \\ Decomposed & 12 & 12 & 25&26 & 14 & 21 & 10&22 & 6&15 & 15&23 & --- & ---\\ \toprule \end{tabular} \end{table} We demonstrate the impact of topology on feasibility of nearest neighbor mapping for a given circuit. For this purpose, we used the circuit $4gt10-v1\_81$ shown in Fig.~\ref{fig:4gt}. The circuit has a Toffoli gate with 3-control lines. This cannot be mapped using 1D-NN or cycle topology because a qubit can have at most two-neighbors in 1D or cycle topology. However, for other topologies, the mapping is feasible and the results using formulation $P_3$ are presented in Table~\ref{table:b2}. In order to make the nearest neighbor mapping feasible, the Toffoli gate with $n$-controls can be decomposed into a sequence of 2-control Toffoli gates~\cite{barenco1995elementary,maslov2008quantum}. We used the RC-Viewer+ tool~\cite{rcviewer} to decompose the circuit as shown in Fig.~\ref{fig:4gtdecom}, followed by problem formulation $P_3$ to solve the nearest neighbor mapping problem for the same. As evident from the results, the decomposed circuit is now feasible to be mapped to 1D-NN and cycle topologies. For the other topologies, the mapping of the decomposed circuit has worser delay compared to the mapping of the original circuit, due the higher number of levels in the decomposed circuit. \begin{figure}[h] \centering \begin{minipage}{1.8in} \centering \includegraphics[height=0.8in]{figs/4gt10-v1_81.pdf} \caption{\em Benchmark circuit } \label{fig:4gt} \end{minipage}% \begin{minipage}{2in} \centering \includegraphics[height=0.8in]{figs/4gt10-v1_81_decomposed.pdf} \caption{\em Decomposed Circuit} \label{fig:4gtdecom} \end{minipage} \end{figure} For the first time, we report results for multiple topologies for various standard benchmark quantum circuits in Table~\ref{table:topo}. For each circuit, we consider the smallest topology graph with number of nodes greater than or equal to number of variables in the circuit. We have considered an arbitrary initial placement of the qubits on the topology graph. As expected, topologies with greater number of edges have lower delay. For example, the delay obtained for $cycle$ topology is less than that for $1D$ topology. Multiple benchmarks for the 3D-Grid and cyclic butterfly network~(CBN) did not complete execution within the specified time limit, due to the relatively large size of the topology graphs. \begin{table}[h] \def3pt{3pt} \centering \caption{Benchmarking results for entire circuit} \label{table:topo} \scalebox{0.9}{ \begin{tabular}{|lrrrc|rr|rr|rr|rr|rr|rr|} \bottomrule \textbf{Benchmark} & \textbf{\#Var} & \textbf{\#Gates} & \textbf{\#L} & \textbf{Tech.} & \multicolumn{2}{c|}{\textbf{1D}} & \multicolumn{2}{c|}{\textbf{Cycle}} & \multicolumn{2}{c|}{\textbf{2D-Mesh}} & \multicolumn{2}{c|}{\textbf{Torus}} & \multicolumn{2}{c|}{\textbf{3D-Grid}} & \multicolumn{2}{c|}{\textbf{CBN}}\\ & & & & & \#S & D & \#S & D & \#S & D & \#S & D & \#S & D & \#S & D \\ \hline 3\_17\_14.real & 3 & 6 & 6 & $P_2$ & 3 & 7 & 0 & 6 & 10 & 7 & 0 & 6 & 7 & 8 & 0 & 6 \\ & & & & $P_3$ & 3 & 7 & 0 & 6 & 14 & 7 & 0 & 6 & --- & --- & 0 & 6 \\ 4gt11-v1\_85.real & 5 & 4 & 3 & $P_2$ & 8 & 7 & 3 & 5 & 1 & 4 & 3 & 4 & 0 & 3 & 1 & 4 \\ & & & & $P_3$ & 7 & 7 & 4 & 5 & 4 & 4 & 9 & 4 & --- & --- & --- & ---- \\ 4mod5-v1\_25.real & 5 & 4 & 3 & $P_2$ & 3 & 5 & 2 & 4 & 3 & 5 & 2 & 4 &--- & --- & --- & ----\\ & & & & $P_3$ & 4 & 5 & 3 & 4 & 3 & 5 & 6 & 4 &--- & --- & --- & ---- \\ alu-bdd\_288.real & 7 & 9 & 8 & $P_2$ & 18 & 15 & --- & --- & --- & --- & --- & --- & --- &--- &--- &--- \\ & & & & $P_3$ & --- & --- & --- & --- & 16 & 10 & 15 & 9 & --- & --- & --- & ---- \\ ex-1\_166.real & 3 & 4 & 4 & $P_2$ & 1 & 4 & 0 & 3 & 1 & 4 & 0 & 3 & 1 & 4 & 0 & 3 \\ & & & & $P_3$ & 1 & 5 & 0 & 4 & 4 & 5 & 2 & 4 & 6 & 5 & 8 & 4 \\ ex1\_226.real & 6 & 7 & 5 & $P_2$ & 8 & 9 & 7 & 8 & 4 & 7 & 2 & 6 & --- & --- & --- & --- \\ & & & & $P_3$ & 8 & 7 & 8 & 7 & 12 & 6 & 9 & 5 & --- & --- & --- & ---- \\ fredkin\_7.real & 3 & 1 & 1 & $P_2$ & 0 & 1 & 0 & 1 & 0 & 1 & 0 & 1 & 0 & 1 & 0 & 1 \\ & & & & $P_3$ & 0 & 1 & 0 & 1 & 0 & 1 & 0 & 1 & 0 & 1 & 0 & 1 \\ graycode6\_48.real & 6 & 5 & 5 & $P_2$ & 0 & 5 & 0 & 5 & 5 & 6 & 4 & 6 &--- & --- & 0 & 5 \\ & & & & $P_3$ & 2 & 5 & 0 & 5 & 7 & 5 & 8 & 5 & --- & --- & --- & ---- \\ ham3\_103.real & 3 & 4 & 4 & $P_2$ & 3 & 6 & 1 & 4 & 3 & 6 & 1 & 4 & 3 & 6 & 1 & 4 \\ & & & & $P_3$ & 3 & 6 & 1 & 4 & 8 & 6 & 2 & 4 & 11 & 6 & 21 & 4 \\ mod5mils\_71.real & 5 & 5 & 5 & $P_2$ & 4 & 7 & 4 & 7 & 3 & 5 & 2 & 5 & --- & --- & ---- & --- \\ & & & & $P_3$ & 6 & 7 & 4 & 6 & 5 & 5 & 6 & 5 & --- & --- & --- & ---- \\ one-two-three-v3\_101.real & 5 & 8 & 7 & $P_2$ & 10 & 13 & 7 & 11 & 10 & 11 & 6 & 9 & & & & \\ & & & & $P_3$ & 9 & 12 & 7 & 11 & --- & --- & 13 & 8 & --- & --- & --- & ---- \\ peres\_9.real & 3 & 2 & 2 & $P_2$ & 2 & 4 & 0 & 2 & 3 & 4 & 0 & 2 & 14 & 4 & 0 & 2 \\ & & & & $P_3$ & 2 & 4 & 0 & 2 & 9 & 4 & 2 & 2 & 2 & 4 & 0 & 2 \\ rd32\_272.real & 5 & 6 & 5 & $P_2$ & 9 & 11 & 4 & 8 & 5 & 7 & 7 & 7 & & & & \\ & & & & $P_3$ & 9 & 11 & 6 & 8 & 12 & 7 & 8 & 6 & --- & --- & --- & ---- \\ toffoli\_double\_4.real & 4 & 2 & 2 & $P_2$ & 3 & 4 & 1 & 3 & 4 & 4 & 2 & 3 & 14 & 3 & 1 & 3 \\ & & & & $P_3$ & 3 & 4 & 1 & 3 & 4 & 3 & 5 & 3 & 4 & 3 & 4 & 3 \\ \toprule \end{tabular} } \end{table} Direct comparison of our method to obtain nearest-neighbor compliant circuits with existing works could not be performed for primarily three reasons. The existing works~\cite{lye2015determining, kole2016heuristic,shafaei2013optimization,saeedi2011synthesis} focus on determining linear nearest neighbors~(LNN), with the objective of reducing number of swap gates. Our proposed method is for obtaining the LNN circuits with minimal depth which is contrary to the goal of reducing swap gate count. Secondly, the initial placement of the qubit is assumed to be given as input to the problem, but other works consider this as part of the optimization. Finally, most of the existing works decompose the gates into two qubit gates~\cite{wille_aspdac16,shafaei2014qubit,kole2016heuristic,saeedi2011synthesis}. In our work, we used unmodified circuits from RevLib~\cite{revlib}. For reference of the readers, we provide a brief summary of the existing results in terms of number of swap gates against the solution of our proposed methodology using problem formulation $P_3$ with block size $b=4$, for the decomposed circuits in Table~\ref{table:existing}. Due to non-availability of the depth of the transformed circuits, we cannot compare the performance of our method against the existing works. \begin{table} \centering \caption{Comparison with existing works on LNN} \label{table:existing} \begin{tabular}{|lll|cccc|}\bottomrule \textbf{Benchmark} & \textbf{\#Var} & \textbf{\#Gates} & $P_3$($b=4$) & N=4\cite{kole2016heuristic} & \cite{saeedi2011synthesis} & \cite{shafaei2013optimization}\\\hline 3\_7\_13 & 3 & 14 & 7 & 6 & 6 & 4 \\ 4\_49\_17 & 7 & 32 &15 & 15 & 20 & 12 \\ 4gt10-v1\_81 & 5 & 36 & 33 & 22 & 30 & 20 \\ 4gt11\_84 & 5 & 7 & 5 & 5 & 3 & 1 \\ 4gt13-v1\_93 & 5 & 17 & 18 & 10 & 11 & 6 \\ 4gt5\_75 & 5 & 22 & 25 & 15 & 17 & 12 \\ 4mod5-v1\_23 & 5 & 24 & 22 & 13 & 16 & 9 \\ alu-v4\_36 & 5 & 32 & 26 & 22 & 23 & 18 \\ hwb4\_52 & 4 & 23 & 13 & 9 & 14 & 10 \\ ham7\_104 & 7 & 87 & 140 & 83 & 84 & 68 \\ mod5adder\_128 & 6 & 87 & 94 & 65 & 85 & 51 \\ \toprule \end{tabular} \end{table} \section{Simple pic} \begin{figure} \centerline{ \begin{tikzpicture}[thick] % \tikzstyle{operator} = [draw,fill=white,minimum size=1.5em] \tikzstyle{phase} = [fill,shape=circle,minimum size=5pt,inner sep=0pt] \tikzstyle{surround} = [fill=blue!10,thick,draw=black,rounded corners=2mm] % \node at (0,0) (q1) {\ket{0}}; \node at (0,-1) (q2) {\ket{0}}; \node at (0,-2) (q3) {\ket{0}}; % \node[operator] (op11) at (1,0) {H} edge [-] (q1); \node[operator] (op21) at (1,-1) {H} edge [-] (q2); \node[operator] (op31) at (1,-2) {H} edge [-] (q3); % \node[phase] (phase11) at (2,0) {} edge [-] (op11); \node[phase] (phase12) at (2,-1) {} edge [-] (op21); \draw[-] (phase11) -- (phase12); % \node[phase] (phase21) at (3,0) {} edge [-] (phase11); \node[phase] (phase23) at (3,-2) {} edge [-] (op31); \draw[-] (phase21) -- (phase23); % \node[operator] (op24) at (4,-1) {H} edge [-] (phase12); \node[operator] (op34) at (4,-2) {H} edge [-] (phase23); % \node (end1) at (5,0) {} edge [-] (phase21); \node (end2) at (5,-1) {} edge [-] (op24); \node (end3) at (5,-2) {} edge [-] (op34); % \draw[decorate,decoration={brace},thick] (5,0.2) to node[midway,right] (bracket) {$\frac{\ket{000}+\ket{111}}{\sqrt{2}}$} (5,-2.2); % \begin{pgfonlayer}{background} \node[surround] (background) [fit = (q1) (op31) (bracket)] {}; \end{pgfonlayer} % \end{tikzpicture} } \caption{ A quantum circuit for producing a GHZ state using Hadamard gates and controlled phase gates. } \end{figure} \end{document} \section{Introduction}\label{sec:intro} Quantum computation~\cite{NC:2000} promises to expand the reach of computing beyond classical --- both theoretically and practically. In quantum computing, the operations take place on so called Qubits, which is a linear combination of the conventional Boolean states in the two dimensional complex Hilbert space. Each operation on these qubits can be defined by a unitary matrix~\cite{NC:2000} which is represented by means of quantum gates. A \emph{quantum gate} over the inputs \mbox{$X=\{x_1,\dots , x_n\}$} consists of a single target line~$t\in X$ and, one or more control line(s)~$c\in X$ with~\mbox{$t\neq c$}. The following gates define the commonly used quantum gate library. \emph{NOT gate}: The qubit on the target line~$t$ is inverted. \emph{Controlled NOT gate} (CNOT): The target qubit~$t$ is inverted if the control qubit~$c$ is 1. This gate belongs to the general class of Toffoli gates, when accomodating larger number of control qubits. \emph{Controlled $V$ gate}: The $V$ operation is performed on the target qubit~$t$ if the control qubit~$c$ is 1. The $V$ operation is also known as the square root of NOT, since two consecutive $V$ operations are equivalent to an inversion. \emph{Controlled $V^\dagger$ gate}: The $V^\dagger$ gate performs the inverse operation of the $V$ gate, i.e.~$V^{\dagger}=V^{-1}$. \emph{SWAP gate}: The SWAP gate, as the name suggests, exchanges two qubits. This gate belongs to the general class of Fredkin gates, when accommodating control qubits. A major challenge towards the realization of practical and scalable quantum computing is to achieve quantum error correction~\cite{Cross:2009:CCS:2011814.2011815}. Long-distance interacting Qubits is particularly susceptible to the noise. Therefore, prominent quantum technologies and quantum error correction codes, e.g. surface codes~\cite{2012PhRvA..86c2324F} require that the quantum gates must be formed with a nearest neighbour interaction. In the resulting circuits, the interacting Qubits may form a chain, as in a 1D Qubit layout, and therefore, these circuits are referred to as Linear Nearest Neighbor (LNN) circuits. Conversion of a quantum circuit to an LNN one can be achieved by using SWAP gates. These SWAP gates allow for making all control lines and target lines adjacent and, by this, help to convert a given quantum circuit to a nearest neighbor one. More precisely, a cascade of adjacent SWAP gates can be inserted in front of each gate $g$ with non-adjacent circuit lines in order to shift the control line of $g$ towards the target line, or vice versa, until they are adjacent. This is shown using the following example. \begin{example}\label{example:naive} Consider the circuit depicted in Fig.~\ref{fig:example_naive_qua}. As can be seen, gates~$g_1$, $g_4$, and $g_5$ are non-adjacent. Thus, in order to make this circuit nearest neighbor compliant, SWAP gates in front and after all these gates are inserted as shown in Fig.~\ref{fig:example_naive_qua_nn}. \end{example} \begin{figure} \begin{minipage}{0.4\textwidth} \includegraphics[height=0.75in]{./figs/fig1.pdf} \caption{Given Circuit} \label{fig:example_naive_qua} \end{minipage} \begin{minipage}{0.6\textwidth} \includegraphics[height=0.75in]{./figs/fig2.pdf} \caption{Nearest Neighbour Compliant Circuit} \label{fig:example_naive_qua_nn} \end{minipage} \end{figure} Quite a few works have been done in recent past to convert a quantum circuit to an LNN one by introducing additional swap gates, which, naturally impact the circuit performance by increasing the logical depth and gate count. To that effect, heuristic\cite{wille_aspdac16,mazdar_nnmmd16,Alireza2014,Rahman:2014:AQT:2711453.2629537,amlan_graph_partitioning,maslov_placement} and exact~\cite{wille_exact_nn} solutions are proposed, which balance the LNN conversion with other performance metrics. It is pointed out in~\cite{amlan_graph_partitioning} that the problem of nearest neighbour quantum circuit construction is equivalent to an NP-complete problem. Hence, it is unlikely that this problem can be solved optimally for large instances. In parallel to the previous works, efficient LNN circuit construction has been studied for important quantum benchmarks, such as, quantum error correction~\cite{PhysRevA.69.042314} for Clifford+T gates~\cite{biswal}. In this work, we are primarily interested in the automated flow and for generic quantum circuits. \subsection{Qubit Topology}\label{ssec:qubit_topo} As noted in~\cite{maslov_placement}, the qubit topologies, on which the quantum circuit is to be mapped, are not necessarily of LNN structure. We provide a few examples here. Recently, quantum error detection code is demonstrated on a square lattice~\cite{corcoles2015demonstration}. It also highlights the fact that for a classical bit-flip, linear array of qubits suffices, while for general fault detection, extending to higher-dimensional lattice structures is needed. Nuclear Magnetic Resonance (NMR) quantum computing achieved early success with realization of Shor's factorization algorithm~\cite{shor1999polynomial}. Liquid state NMR quantum computing utilizes the atomic spin states to realize the qubit and hence, has the molecular structures as qubit topologies. Solid state NMR has been also demonstrated~\cite{kampermann2002} using crystal of $NaNO_3$, essentially leading to molecular topologies. A recent proposition for scalable quantum computer indicates that multiple, parallel quantum gates can be formed between distant qubits by controlling the lasers on Trapped Atomic Ions~\cite{brown2016co}. Harnessing atomic spins in endohedral fullerene molecules as qubits have also been reported~\cite{fullerene_quantum}. It has been further argued that molecular structures serve as a natural candidate for quantum technology by holding superpositions for longer period and ability to scaffold multiple molecules in a larger array. Hence, an automated algorithm for achieving nearest neighbour interactions for a given quantum circuit while mapping on diverse qubit topologies are of significant practical interest. This is the main focus of current paper. \subsection{Related Works} To the best of our knowledge,~\cite{maslov_placement} and~\cite{whitney_grid_07} were the first to look into arbitrary topologies for quantum circuits with nearest neighbour constraints. So far, most of the other works in this domain have concentrated on 1D qubit layout or 2D qubit lattice structures~\cite{wille_aspdac16,Alireza2014}. The work presented in~\cite{whitney_grid_07} focuses on identifying the qubit topology best suited for a given quantum circuit placement. In contrast, our focus is towards evaluating a given qubit topology and performing mapping on it. This particular problem has been dealt with in~\cite{maslov_placement} with examples taken from liquid state NMR molecules as the topologies. There, a graph partitioning-based approach is proposed and it is claimed to be asymptotically optimal for the case of chain nearest neighbour architecture. We address the same problem, by formulating it as an instance of ILP and show that optimal results are achievable for a wide variety of benchmarks and different topologies. Independently, efficient qubit topology identification and the mapping flows for specific interaction graphs have been done in~\cite{beals2013efficient,brierley_butterfly}. For example, it is proved that for cyclic butterfly topology, the depth overhead for mapping a given quantum gate to a nearest neighbour one is $6\log n$. Subsequently, the mapping algorithm is also derived. Communication and computation over networks is of major interest in quantum networks~\cite{quantum_butterfly} as well as for classical telecommunication networks. The problem of permutation routing on variety of graphs has been studied in the past~\cite{habermann1972parallel,spanke1987n,sau2007optimal}. \subsection{Motivation and Contribution} Despite the presence of diverse qubit topologies and need for an automated mapping flow of quantum circuits to such topologies, the current literature focuses mostly on 1D chain qubit and 2D lattice structures. \begin{itemize} \item In order to address this gap, we present an ILP-based algorithm to realize depth-optimal nearest neighbour quantum circuits. Our algorithm is also applicable, naturally, to simpler structures. \item We benchmark the algorithm for diverse topologies and quantum circuits and compare the scalability and performance against previous exact NN optimization approaches. \end{itemize} \section{Methodology}\label{sec:method} \noindent In this section, we initially present an ILP formulation for the problem $P_2$. Description of the variables used in the formulation is presented summarily in Table~\ref{var:p2}. Thereafter, we present the modified ILP for problem $P_3$. \begin{table} \centering \caption{Parameters/constants used in ILP} \label{table:param} {\small \begin{tabular}{cl}\bottomrule \textbf{Param/const.} & \textbf{Description} \\ \midrule $G$ & Toplogy graph \\ $C$ & Input/start configuration \\ $n$ & Number of inputs \\ $k+1$ & Number of levels \\ $L_i$ & Number of qubit interaction pairs in level $i$ \\ $T$ & Maximum number of cycles used for the problem \\ \toprule \end{tabular} } \end{table} \begin{table} \centering \caption{Variable description used in ILP} \label{var:p2} {\small \begin{tabular}{|c|p{5cm}|c|p{5cm}|}\hline \textbf{Var.} & \textbf{Description} & \textbf{Var.} & \textbf{Description}\\\hline $delay$ & Delay due to insertion of swap gates &$c_{v,q,t}$ & 1 indicates qubit $q$ will move to new location $v$ in cycle $t$ \\ \hline $m_{i,t}$ & 0 indicates Interaction $i$ met in cycle $t$ &$a_{i,t}$ & 1 indicates gates in Level $i$ are scheduled in cycle $t$ \\ \hline $n_{p,q,t}$ & 1 indicates qubit $p$ and $q$ are NN in cycle $t$ &$eb_{I_i,t}$ & 1 indicates interaction $I_i$ has been met in cycle $t$ and gates of level $i$ can be placed in the current or following cycles. \\ \hline $p_{(p,v),(q,w),t}$ & 1 indicates qubit $p$ is in location $v$ and $q$ is in location $w$ in cycle $t$ &$b_{q,t}$ & 1 indicates qubit $q$ cannot be involved in a swap in cycle $t$ \\ \hline $x_{v,p,t}$ & 1 indicates qubit $p$ is in location $v$ in cycle $t$ &$b_{v,q,t}$ & 1 indicates qubit $q$ in location $v$ cannot be involved in a swap in cycle $t$ \\ \hline $u_{v,q,t}$ & 1 indicates qubit $q$ will remain in location $v$ in cycle $t$ &$sb_{m,n,t}$ & 1 indicates swap is not permitted between locations $m$ and $n$ in cycle $t$ \\ \hline \end{tabular} } \end{table} \subsection{ILP formulation for $P_2$}\label{subsec:p2} \head{Objective function:} \begin{align}\text{Minimize } &delay \\ \sum_{t=0}^T m_{k,t} - delay &= 0 \end{align} \head{Chronological interaction constraints:} If an interaction is met in cycle $t$, then the status should not change to not met after that cycle. In addition, interaction $i$ must be met before ${i-1}^{th}$ interaction is met. \begin{align} m_{i,t+1} - m_{i,t} &\ge 0 & 0 \le t \le T-1, 0 \le i \le k \\ m_{i+1,t} - m_{i,t} &\ge 0 &0 \le t \le T, 0 \le i \le k-1 \end{align} \head{Successful interaction constraints:} An interaction is met if all the qubit pairs in the interaction are nearest neighbors. If an interaction has been met in cycle $t$, then in all cycles $t' > t$, the qubit positions do not matter any longer. \begin{align} L_i.m_{i,t} + (\sum_{(p,q) \in I_i} n_{p,q,t}) + (\sum_{t'=0}^{t-1}L_i.(1 - m_{i,t'})) &\ge L_i &0\le t \le T \end{align} \head{Nearest neighbor constraints:} Two qubits $p$ and $q$ are nearest neighbors if the qubits are in two locations $v$ and $w$ respectively or in $w$ and $v$ respectively, such that $(v,w) \in G_{\mathcal{E}}$. \begin{align} p_{(p,v),(q,v),t} &= x_{v,p,t} \wedge x_{w,q,t} &(p,q) \in I, (v,w) \in G_{\mathcal{E}} \\ p_{(p,w),(q,v),t} &= x_{w,p,t} \wedge x_{v,q,t}; &(p,q) \in I, (v,w) \in G_{\mathcal{E}} \\ n_{p,q,t} &= \vee_{(v,w) \in G_{\mathcal{E}}} (p_{(p,v),(q,w),t} \vee p_{(p,w),(q,v),t}) & (p,q) \in I \end{align} \head{Qubit position update constraints:} A qubit $q$ is at location $v$ in cycle $t+1$ if it was in location $v$ in cycle $t$ and there were no swaps performed involving the location $v$ or if $q$ was in a location $w$ which is nearest neighbor with $v$ and a swap was performed between $v$ and $w$. \begin{align} u_{v,q,t+1} &= (\wedge_{(v,w) \in G_{\mathcal{E}}} (1 - s_{v,w,t}))\wedge x_{v,q,t}; \\ c_{v,q,t+1} &= \vee_{(v,w) \in G_{\mathcal{E}}} s_{v,w,t}~\wedge ~x_{w,q,t}\\ x_{v,q,t+1} &= u_{v,q,t+1} ~\vee~ c_{v,q,t+1} \end{align} \head{Qubit location and swap constraints:} A qubit $q$ can be at exactly one position in any given cycle. In a given cycle, a location can be involved in atmost one swap. \begin{align} \sum_{v \in G_{\mathcal{V}}} x_{v,q,t} &= 1; &0 \le t \le T, q \in Q \\ \sum_{(v,w) \in G_{\mathcal{E}}} s_{v,w,t} &\le 1; &0 \le t \le T, v \in G_{\mathcal{V}} \end{align} \head{Initialization constraints:} A qubit $q$ is at location $v$ in cycle 0, based on input configuration $C$. \begin{align} x_{v,q,0} &= 1; &(v,q) \in C \end{align} \noindent This concludes the description of the ILP formulation for problem $P_2$. The following subsection presents the modifications needed in the ILP for optimally solving $P_3$. \subsection{ILP formulation for $P_3$}\label{subsec:p3} \head{Objective function:} \begin{equation}\text{Minimize }\sum_{i=0}^k\sum_{t = 0}^T t. a_{i,t} \end{equation} \head{Level scheduling constraints:} Each level can be scheduled/activated exactly once. \begin{align} \sum_{t=0}^{T} a_{i,t} &= 1; &0 \le i \le k \end{align} \noindent Only one level can be activated per time step. \begin{align} \sum_{i=0}^{k} a_{i,t} &= 1; &0 \le t \le T \end{align} \noindent Activation for a level $i$ can happen only if corresponding interaction $i$ is met. \begin{align} a_{i,t} + m_{i,t} &\le 1; &0 \le t \le T, 0 \le i \le k \end{align} \head{Swap blocking constraints:} If an interaction $i'$ is met and all the gates in any Level $i$ such that $(i < i')$ have been scheduled, then swaps involving the qubits in interaction $i$ cannot be performed and interaction $i'$ is blocked till Level $i$ has been scheduled. Qubit involved in an interaction $i$ cannot be swapped in the cycle, when the Level $i$ is scheduled. \begin{align} eb_{i',t} &= a_{i,t} \wedge (1 - m_{i',t}); & 0 \le i \le k-1, i+1 \le i' \le k, 0 \le t \le T \\ b_{q,t} &= \vee_{i} (a_{i,t} \vee eb_{i,t}); &\forall i~ \exists ~q \in I_i, 0 \le t \le T \\ b_{v,q,t} &= b_{q,t} \wedge x_{v,q,t} &0 \le t \le T \\ sb_{m,n,t} &= \vee_q (b_{m,q,t} \vee b_{n,q,t}); &\forall q \in Q , 0 \le t \le T \end{align} \noindent In addition to these constraints, {\em Chronological interaction constraints, Successful interaction constraints, Nearest neighbor constraints, Qubit position update constraints, Qubit location and swap constraints} and {\em Initialization constraints} presented in ILP formulation for $P_2$ are applicable to $P_3$. This completes the description of the ILP formulation of $P_3$. \section{Preliminaries and problem statement}\label{sec:prelim} \noindent In this section, we introduce the notations and terminologies for formally defining the nearest-neighbor optimization problem of quantum computing. Thereafter, we present three variants of the problem. \begin{definition} A \textbf{quantum circuit}, defined over $n$-qubits $q_1$, $q_2$,...,$q_n$ is a series of levels $L_i$, where each level $L_i$ consists of a set of quantum gates $G_i^1$, $G_i^2$, $\cdots$, $G_i^k$ with each gate $G_i^j$ operating on one or more qubits. Any two pair of gates $G_i^j$ and $G_i^k$ in a level $L_i$ do not operate on any common qubit and therefore can be executed in parallel. We assume that each level $L_i$ takes one cycle to execute. A quantum circuit with $k$ levels has a delay of $k$ cycles. \end{definition} \begin{figure}[!htb] \centering \begin{minipage}{2.5in} \centering \includegraphics[height=1.2in]{figs/ex1_226.pdf} \caption{\em A quantum circuit\protect\footnotemark with delay 5} \label{fig:qc} \end{minipage}% \begin{minipage}{2.5in} \centering \includegraphics[height=1.2in]{figs/ex1_226_block.pdf} \caption{\em Interactions for block size b = 2} \label{fig:qc_block} \end{minipage} \end{figure} \footnotetext{xor5\_254.real file from RevLib} Given a quantum gate with $m$-control lines $l_1, ... , l_m$ and target line $l_t$, qubits $q_l$ and $q_{t}$ have to be nearest-neighbors, $ 1 \le l \le m$. For level $L_i$, we define \textbf{interaction} $I_i$ as the set of nearest neighbors for the all the gates in $L_i$. The levels and corresponding interactions of a quantum circuit is determined using Algorithm~\ref{algo:level}. \begin{example} Fig.~\ref{fig:qc} shows a quantum circuit with 5 two-input Toffoli gates and 2 CNOT gates. The circuit has 5 levels and hence has a delay of 5. \begin{itemize} \item[$L_1$] : {\tt \small [t2 x2 f0, t1 x1, t1 x3]} \item[$L_2$] : {\tt \small [t2 x4 f0]} \item[$L_3$] : {\tt \small [t2 x0 f0]} \item[$L_4$] : {\tt \small [t2 x3 f0]} \item[$L_5$] : {\tt \small [t2 x1 f0]} \end{itemize} Corresponding to level $L_1$, interaction $I_1$ is [{\tt(x2, f0), (x1), (x3)}]. Similarly, $I_2, I_3, I_4$ and $I_5$ is [{\tt (x4,f0)}], [{\tt(x0,f0)}], [{\tt (x3,f0)}] and [({\tt x1,f0})] respectively. \end{example} \begin{algorithm} \SetKwFunction{proc}{ComputeLevel} \SetKwProg{myproc}{Procedure}{}{QCkt} \myproc{\proc{devUseTable}}{ levelList = []\; processedGate = set()\; L = set()\; Lvar = set()\; \For { $G_i$ $\in$ QCkt}{ \If { $G_i$ $\notin$ processedGate}{ \If {$G_i.var \bigcap Lvar == \phi$} { L.add($G_i$)\; Lvar.add($G_i.var$)\; processedGate.add($G_i$)\; \For{$G_j$ $\in$ QCkt}{ \If {$G_j.var \bigcap Lvar == \phi$} { L.add($G_j$)\; Lvar.add($G_j.var$)\; processedGate.add($G_j$) } } levelList.add(L)\; L = set()\; Lvar = set()\; } } } } \textbf{return} reassignMap\; \caption{Level Computation Algorithm}\label{algo:level} \end{algorithm} \begin{table}[h] \centering \caption{Minimum number of nodes in the smallest graph of each topology } \label{table:minnodes} \begin{tabular}{ll}\bottomrule \textbf{Topology} & \textbf{Min. \#Nodes} \\ \midrule 1D & 2 \\ Cycle & 3 \\ 2D-Mesh & 9 \\ Torus & 9 \\ 3D-Grid & 8 \\ Cyclic butterfly & 24 \\\toprule \end{tabular} \end{table} Physically, qubits can be arranged in various topologies, as discussed in the subsection~\ref{ssec:qubit_topo}. Such topologies allow interaction between only between some pairs of qubit positions. We introduce this constraint in the form of a topology graph. \begin{definition} A \textbf{topology graph} is an ordered pair $T$=($T_\mathcal{V},T_\mathcal{E}$). $T_\mathcal{V}$ is the vertex set, where each vertex $v \in T_\mathcal{V}$ represents a physical location where one qubit can reside. $T_\mathcal{E}$ is the edge-set, which contains a set of edges. An edge $e_{vw} \in T_\mathcal{E}$ indicates that qubit at location/vertex $v$ and $w$ can interact. In other words, qubits at location $v$ and $w$ are nearest-neighbors~(NN). \end{definition} \noindent Fig.~\ref{fig:topo} presents various topologies. The minimum number of nodes for the smallest graph of each topology is presented in Table~\ref{table:minnodes}. Given a quantum circuit with $n$-qubits, and a specific topology, we use the smallest topology graph $T$ such that $T_\mathcal{V} \ge n$ for realizing the quantum circuit. \begin{figure}[b] \vspace{-0.2cm} \centering \includegraphics[width=4in]{figs/topo_new.pdf} \caption{\em Topology (a) 1D-nearest neighbor (b) Cycle (c) 2D-Mesh (d) Torus \mbox{(e) Fully connected graph} (f) 3D-Grid (g) Cyclic butterfly network} \label{fig:topo} \end{figure} \begin{definition} A \textbf{configuration} $C_t$ is the set of ordered tuples $(q_i, v)$, which indicates that in cycle $t$, qubit $q_i$, is at location $v$, $ 1\le i \le n$ and $v \in T_\mathcal{V}$. Configuration $C_0$ represents the initial configuration. \end{definition} \subsection{Problem statement}\label{subsec:problem} \noindent We now define three variants the nearest-neighbor optimization problem of quantum circuits for arbitrary topologies and also present the relation between the variants. \head{Problem $P_1$:} Given an initial configuration $C$ of $n$-inputs, an interaction $I$ and a topology graph $T$, the objective is to determine the series of swap gates needed to transform the location of the qubits from configuration $C$ such that all qubit pairs in interaction I are nearest-neighbors and the delay due to insertion of swap gates is minimum. \vspace{\baselineskip} \head{Problem $P_2$:} Given an initial configuration $C$ of $n$-inputs, a series of interactions $I_1, I_2, \ldots, I_k$ and a topology graph $T$, the objective is to determine the series of swap gates needed to transform the location of the qubits from configuration $C$ such that all qubits pairs in interaction $I_1$ are nearest-neighbor, and then again location of qubits are transformed to be nearest neighbors for $I_2$ and so on, till interaction $I_k$ is met and the delay due to insertion of swap gates is minimum for the overall problem. \vspace{\baselineskip} \head{Problem $P_3$:} Given an initial configuration $C$ of $n$-inputs, a series of levels $L_1, L_2, \ldots, L_k$ and a topology graph $T$, the objective is to determine the series of swap gates needed to transform the location of the qubits from configuration $C$ such that all qubits pairs in interaction $I_1$~(corresponding on level $L_1$) are nearest-neighbor, and then again location of qubits are transformed to be nearest neighbors for $I_2$~(corresponding on level $L_2$) and so on, till interaction $I_k$~(corresponding on level $L_k$) is met and the combined delay of swap gates and gates present in the actual circuit is minimum. \vspace{\baselineskip} The Problem formulation $P_1$ has been popularly used for showing effectiveness of various topologies to realize arbitrary permutations. Table~\ref{table:bounds} shows the depth and space requirements for realization of arbitrary permutations on various topologies. \begin{table}[] \centering \caption{Depth $D$ and Space $S$ complexity of realizing arbitrary permutations using a given topology.} \label{table:bounds} \begin{tabular}{llll} \hline \textbf{Topology} & \textbf{Degree} & $\mathbf{D}$ & $\mathbf{S}$ \\ \hline Fully Connected Graph & $n$-1 & 1 & 1 \\ 1D nearest-neighbor~\cite{hirata2011efficient} & 2 & 2$n$-3 & 1 \\ 2D nearest-neighbor~\cite{beals2013efficient} & 4 & $O$($\sqrt n$) & 1 \\ Cyclic butterfly network~\cite{brierley_butterfly} & 4 & 6log $n$ & 2 \\ Hypercube~\cite{beals2013efficient} & log $n$ & $O($log$^2n)$ & 1 \\ \hline \end{tabular} \end{table} Problem $P_2$ with $k$ = 1 is equivalent to Problem $P_1$. Therefore, finding an optimal solution for $P_2$ with $k$ = 1 is equivalent to solving $P_1$. Problem $P_2$ does not consider the scheduling of the swap gates in parallel to quantum gates present in the original circuit, if possible. $P_2$ transforms the qubit locations on the topology graph such that the interactions needed to execute a level in quantum circuit is met. Problem $P_3$ addresses this issue and considers the quantum gates as well and can find the optimal solution with minimum delay. \begin{theorem}\label{theo:delay} For a topology graph $T$ and a quantum circuit $C$ with $k+1$~levels, the delay $d_I$ of solution $S_I$ obtained by optimally solving problem $P_2$ is at most $k$-cycles more than the delay $d_O$ of optimal solution $S_O$ of problem $P_3$ i.e. $d_I - d_O \le k$. \end{theorem} \begin{proof} Consider an initial configuration and a quantum circuit two levels. Let us assume that the delay of solution be $d_I$ and $d_O$ be the optimal solution. Optimal solution for $P_3$ would have been able to insert additional gates at only one level $L_0$, which was not considered by $P_2$. If $d_I - d_O > 1$, this would imply that $d_I$ is not the optimal solution for $P_2$, since there exists a solution to solve $P_2$ with $d_O+1$ delay which is a contradiction. This idea can be extended for any number of gates to derive Theorem~\ref{theo:delay}. \end{proof} \noindent It is possible to split the circuits into equal size blocks, with $b$-levels in each block, except the last block which might have less than $b$ levels. Fig.~\ref{fig:qc_block} shows the blocks with size $b$=2, with the last block having a single interaction. Each block can solved using $P_2$ or $P_3$ to make the qubits nearest-neighbors and the output configuration of the solution is used as input configuration for the next block. For a quantum circuit with $k+1$-levels and $b \ge k$, \begin{itemize} \item Optimal solution with minimum delay $d_O$ can be determined using $P_3$. \item A bounded delay solution with delay $d_I$ can be determined using $P_2$ such that $d_I - d_O \le k$. \end{itemize} Various suboptimal solutions can be obtained using $b < k$, using both $P_2$ and $P_3$. Choosing a small block size $b$ makes it easier to solve each sub-problem and therefore it becomes feasible to solve the nearest neighbor technology mapping problem for circuits with large number of gates. Corresponding to circuit in Fig.~\ref{fig:qc}, the 1D-nearest neighbor compliant circuit, obtained using problem formulation $P_2$ and $P_3$ for block size $b=4$, is shown in Fig.~\ref{fig:nnexample}~(a) and Fig.~\ref{fig:nnexample}~(b) respectively. \begin{figure}[t!] \centering \subfloat[\em $P_2$ Solution with $b$ = 4]{\includegraphics[height= 1.4in]{figs/fig_interact_b4.pdf}}\\ \subfloat[\em $P_3$ Solution with $b$ = 4]{\includegraphics[height= 1.4in]{figs/fig_opti_b4.pdf}} \caption{\em 1D-Nearest neighbor optimization solution} \label{fig:nnexample} \end{figure}
{'timestamp': '2017-03-28T02:00:10', 'yymm': '1703', 'arxiv_id': '1703.08540', 'language': 'en', 'url': 'https://arxiv.org/abs/1703.08540'}
arxiv