\chapter{Stopping Criterion for Randomized Low-Rank Approximations}
\label{chap:random}

There has been work in recent years to understand
structured matrices: matrices with off-diagonal blocks that
are (or can be approximated as) low-rank.
The goal is to develop methods which allow us to compute
matrix-vector products and matrix inverses faster than
standard algorithms; that is, multiplication in $O(n\log^{\beta}n)$
flops and inversion in $O(n^{\alpha}\log^{\beta}n)$ flops
for $\alpha\in\brackets{1,2}$ and $\beta$ small.
Another benefit is reduced storage requirements,
frequently $O(n\log^{\beta}n)$.
The simplest of these are banded matrices, but also include
Sequentially Semi-Separable matrices~\cite{chandrasekaran2005some},
Hierarchically Semi-Separable (HSS)
matrices~\cite{Chandrasekaran2005HSS,chandrasekaran2006fast},
H-matrices~\cite{hackbusch1999sparse}, and others.
Recent work involving randomized HSS construction can be found in
\cite{martinsson2011fast,rouet2016distributed,ghysels2017robust}.
The main contribution of this chapter is related to
a stochastic estimate of $\norm{\cdot}_{F}$ which
allows us to accurately measure the low-rank approximation
and determine when it is well-approximated;
portions of this material first appeared in~\cite{randomHSSLBL}.
In particular, we develop a method to compute a \emph{relative}
stopping criterion for an adaptive low-rank approximation.

Throughout this chapter we assume $A\in\R^{m\times n}$
with rank $r\ll \min(m,n)$.
For simplicity, we will assume $m\ge n$.
We let $N(0,1)$ refer to the standard normal distribution
with mean $0$ and variance $1$.
Finally, some of the notation in this chapter may conflict with those
from previous chapters.
While other adaptive randomized algorithms have frequently used
an absolute tolerance $\eps$, we will focus on allowing both
an absolute tolerance $\epsa$ and a relative tolerance $\epsr$.


\chapter{Bayesian inference and learning}

\section{Learning described as Bayesian inference}

The central problem of learning from data can be verbalized as: given that some agent have access to data $\mathcal{D}$, what knowledge can the learner extract from it? One way to approach this problem is by assuming that learning does not take place in a vacuum, but in a world that the learner has uncertain knowledge about, translated into beliefs. The fact that those beliefs are uncertain is important, given that if the learner knew exactly everything he should know about the world, access to data $\mathcal{D}$ could not teach him nothing more.

Given this general framework of "informed uncertainty", one natural way to describe it, mathematically, is by using probability theory for describing the problem. More specifically, it is used the \textit{Bayesian} viewpoint of probability, where degrees of uncertainty about quantities are mapped into probabilities about those \cite{MacKay2003,jaynes03}.

In this interpretation, probability theory does not just deal with random events, but with anything that an agent is uncertain about. So, given some proposition $A$, and given that the learner knows $I$ about the world, $P(A|I)$ represents what he knows about $A$. Thus $A|I$ becomes a random variable, \textit{even if $A$ is not a random event}. Cox's theorem \cite{jaynes03},\cite{Cox_1963} says that, under some certain common sense assumptions about how the learner should ideally reason about beliefs, the rules of probability theory holds, as an extension to logic.

In a simplification of this setting, when learning from the data $\mathcal{D}$, and previous information $I$, the learner must have some set of hypothesis (assuming finite for now) $\mathcal{H} = \{H_1,\ldots,H_t\}$, such that the learner assumes one and only one of then is true, and with each of them associated with a probability $P(H_k)$ such that
\begin{displaymath}
\sum_{H_k \in \mathcal{H}} P(H_k|I) = 1.
\end{displaymath}
Furthermore, each hypothesis $H_k$ should say something about how likely it is for the data to be generated, given $H_k$ is true, and this information is encoded in $P(\mathcal{D}|H_k,I)$. In this case, Bayes' theorem says that it is possible to obtain the updated probabilities (thus degree of beliefs) $P(H_k|\mathcal{D},I)$ by Bayes' rule:
\begin{equation}\label{bayes_theorem_1}
 P(H_k|\mathcal{D},I) = \frac{P(\mathcal{D}|H_k,I)}{P(\mathcal{D}|I)}P(H_k|I),
\end{equation}
with $p(\mathcal{D}|I)$ being available by marginalization
\begin{equation}\label{marginalization_1}
 P(\mathcal{D}|I) = \sum_{H_k \in \mathcal{H}} P(\mathcal{D}|H_k,I) P(H_k|I).
\end{equation}

In practice, usually hypothesis does not comes in discrete chunks, but one assumes a \textit{model} $M$. The model is usually endowed with free parameters $\theta \in \Theta \subset \mathbb{R}^D$, so that, assuming those to be continuous\footnote{This is not necessary at all, but it simplifies the notation}, the hypotheses are encoded by those parameter through a probability density function $p(\theta|M)$. Then, given the data $\mathcal{D}$, one seeks the posterior density function $p(\theta|\mathcal{D},M)$. In this case, we also have a version of Bayes' theorem for the densities
\begin{equation}\label{bayes_theorem_2}
 p(\theta | \mathcal{D},M) = \frac{p(\mathcal{D} | \theta,M)}{p(\mathcal{D}|M)} p(\theta | M),
\end{equation}
with
\begin{equation}\label{marginalization_2}
p(\mathcal{D}|M) = \int_\Theta p(\mathcal{D}|\theta',M) p(\theta'|M) d \theta'.
\end{equation}

In the Bayesian framework, the problem of learning is reduced to one of inference about $\theta$, in a manner that if a specific parameter $\theta$ is sufficient to make a prediction $Q|\theta,M$, with density $p(Q|\theta,M)$, then the learner has access to $Q|\mathcal{D},M$ by marginalization
\begin{equation}\label{marginalizationpred}
p(Q|\mathcal{D},M) = \int_{\Theta} p(Q|\theta,M) p(\theta|\mathcal{D},M) d\theta.
\end{equation}
Thus, there is no fundamental difference between learning and inference from a Bayesian point of view.

\section{Decision theory}\label{decision_theory_section}
Following the Bayesian procedure, an agent can learn something about the world. However, ultimately what one wants to do with beliefs about the world is to convert those into actions. This can be formalized in \textit{Bayesian decision theory} \cite{Robert_2001}, where the components required for belief updating are combined with a \textit{loss function} $L : \Theta \times \mathcal{A} \to \mathbb{R}^+$,
with $L(\theta,a)$ being the cost of taking action $a$ when the state of the world is $\theta$ \footnote{This language refers back to the continuously parameterized model setting described above, and this will be assumed through the text. However, one can refer also to a more general setting, \textit{mutatis mutandis}}. Then, the action that minimizes the expected loss, given the posterior distribution $p(\theta|\mathcal{D},M)$,
\begin{equation}\label{generalloss}
 a^* = \argmin_{a \in \mathcal{A}} \int_\Theta L(\theta,a) p(\theta|\mathcal{D},M) d \theta,
\end{equation}
is the Bayes-optimal decision for the agent to make \cite{Robert_2001}.

From this point of view, parameter estimation is simply when the action taken is choosing a parameter, that is, $\mathcal{A} = \Theta$. In this setting, we have that, for some loss functions $L(\theta,\tilde{\theta})$, one can find the desired \textit{Bayes estimator},
\begin{equation}
\hat{\theta} = \argmin_{\tilde{\theta}} \int L(\theta,\tilde{\theta}) p(\theta|\mathcal{D},M) d \theta,
\end{equation}
by calculating the minimum analytically:
\begin{itemize}
	\item The $l_2$ (quadratic) loss $L(\theta,\tilde{\theta}) = ||\theta - \tilde{\theta}||_2^2$, for which $\hat{\theta} = \Ev[\theta|\mathcal{D},M]$
	\item The $l_1$ (absolute) loss $L(\theta,\tilde{\theta}) = ||\theta - \tilde{\theta}||_1$, for which, at each coordinate $i$, $\hat{\theta}_i = \text{median}(\theta_i|\mathcal{D},M)$.
\end{itemize}

However, loss functions can be much more general, allowing, for example, to encode asymmetry in the gravity of mistakes. For instance, if $\theta$ is the maximum load of some structural component, underestimating it may result in a bigger waste of resources, while overestimating it may result in collapse.

One way of choosing $\hat{\theta}$ that does not exactly enter the framework above, at least for continuous parameters, are either by the \textit{maximum a posteriori} MAP of the probability density function
\begin{equation}\label{map_definition}
 \hat{\theta}_{\text{MAP}} = \argmax_\theta p(\theta | \mathcal{D},M) =
       \argmax_\theta p(\mathcal{D} | \theta,M) p(\theta | M).
\end{equation}
The MAP estimation can be regarded however as a limit of minimizers of loss functions of the form
\begin{equation}
L_c(\theta,\tilde{\theta}) =
\begin{cases}
0, & \text{if } ||\theta - \tilde{\theta}|| < c \\
1, & \text{otherwise},
\end{cases}
\end{equation}
so that \footnote{Provided some conditions. See \cite{Bassett_2018} for a counterexample of the general result.}
\begin{equation}
\hat{\theta}_{\text{MAP}} = \lim_{c \to 0} \argmin_{\tilde{\theta}} \int L_c(\theta,\tilde{\theta}) p(\theta|\mathcal{D},M) d \theta
\end{equation}
Related to the MAP estimator is the \textit{maximum likelihood estimate} (MLE), which can be seem as a modification of the MAP that doesn't take in account prior belief
\begin{equation}\label{mle_definition}
\hat{\theta}_{\text{MLE}} = \argmax_\theta  p(\mathcal{D} | \theta, M).
\end{equation}

The MAP (and MLE) estimation suffers from some drawbacks for continuous distributions:
\begin{itemize}
	\item The MAP estimation does not take in account any true loss function, just limits of loss functions. Specially in applications that has an intrinsic asymmetric loss, this may result in grave mistakes.
	\item The MAP estimation is in general an untypical point for the distribution, in the sense that the probability of the parameter to be near the MAP is low. In particular, in high dimensions that MAP will be very untypical (see \cite{Betancourt_2017}).
	\item The MAP estimation is not invariant under reparameterizations. To illustrate, assume that $\theta$ is a one-dimensional parameter representing some phenomena $F$, and let $\phi = g^{-1}(\theta)$, where $g$ is diffeomorphic \footnote{In order to exclude some special conditions, assume both $\theta$ and $\phi$ are supported in $\mathbb{R}$}. Clearly, $\phi$ is also a valid parameterization of $F$. Assuming $g'(\phi) > 0$ for simplicity, let $f_\theta(\theta) := p(\theta|\mathcal{D},M)$. Then, we have, letting $f_\phi(\phi) := p(\phi | \mathcal{D},M)$, that $f_\phi(\phi) = f_\theta(g(\phi))g'(\phi)$. This implies that:
	\begin{equation}
	 f'(\phi) = g''(\phi) f_\theta(g(\phi)) + (g'(\phi))^2 f'_\theta(g(\phi)).
	\end{equation}
	Now, being $\hat{\theta}_\text{MAP}$ the MAP estimator for $\theta$, we have $f'_\theta(\hat{\theta}_\text{MAP}) = 0$.
	However, letting $\hat{\phi} := g^{-1}(\hat{\theta}_\text{MAP})$, we have that $f'(\hat{\phi}) = g''(\hat{\phi}) f_\theta(g(\hat{\phi}))$, which does not equal to $0$ unless $g''(\hat{\phi}) = 0$. Hence, $\hat{\phi}$ cannot be the MAP estimator for $\phi$. But, since $\theta$ and $\phi$ are both valid parameterizations for phenomena $F$, this lack of invariance implies that the MAP estimation has no meaning in estimating $F$.
\end{itemize}
Still, the MAP estimator is relatively straightforward to calculate, since it requires the optimization of $p(\mathcal{D}|\theta) p(\theta)$, which is in general a simpler problem than integration. Thus, it is widely used.

\section{Model selection}\label{modelselectionsection}
In the previous discussion, the model $M$ was assumed to be fixed, with only its parameters being unknown. In practice, we have a set of models $\mathcal{M}$ from which we choose $M$. This raises the question on how to make this choice of $M$.

The standard Bayesian solution for the problem would be placing a prior distribution $P(M)$ for the models, and then computing the posterior distribution for them, given the data, by Bayes' rule
\begin{equation}
 P(M|\mathcal{D}) = \frac{P(\mathcal{D}|M) P(M)}{\sum_{M' \in \mathcal{M}} P(\mathcal{D}|M') P(M')},
\end{equation}
with the model likelihood, in this setting being called \textit{marginal likelihood} or \textit{evidence}, given by
\begin{equation}\label{marginalization_3}
p(\mathcal{D} | M) = \int_{\Theta_M} p(\mathcal{D} | \theta_M, M) p(\theta_M | M) d\theta_M,
\end{equation}
emphasizing that the parameter space $\Theta_M$ depends on the model.
Then, one can choose $M$ by MAP estimation
\begin{equation}
 \hat{M} = \argmax_{M \in \mathcal{M}} p(\mathcal{D} |M) p(M),
\end{equation}
or, in prediction settings, carrying the full posterior model distribution for doing model averaging. Still, choosing a prior for models may not be a trivial task, as discussed in \cite{Robert_2001}. To circumvent this, one can instead forget about the prior (or assume an uniform prior), and choose the model with maximum likelihood
\begin{equation}\label{modelselectionobjective}
\hat{M} = \argmax_{M \in \mathcal{M}} p(\mathcal{D} | M) = \argmax_{M \in \mathcal{M}} \int p(\mathcal{D} | \theta_M, M) p(\theta_M | M) d\theta_M.
\end{equation}

The choice of models by maximization of evidence results in the \textit{Bayesian Occam's razor} \cite{MacKay2003,MacKay_1991,Rasmussen_2001}, named after the Occam's razor principle that says, given a choice between models, we should select the simplest models that still explains the data. We say that some model is simpler or more complex than another if it can explain few or more data. To see how Occam's razor works in Bayesian setting, it suffices to realize that, between all possible datasets, probabilities must sum to one. For illustration, assume that $\mathcal{D}$ comes from a finite set of possible datasets. Then, we need
\begin{equation}
 \sum_{\mathcal{D}'} p(\mathcal{D}'|M) = 1.
\end{equation}
Now, compare three models, $M_1$, $M_2$ and $M_3$. $M_1$ can explain only very few datasets well, so few that it cannot explain $\mathcal{D}$. $M_2$ can explain more datasets, including $\mathcal{D}$, but not so much as $M_3$ explains, which is a vast number of datasets. We have then that $p(\mathcal{D}|M_1)$ must be very low, given that $M_1$ does not explain $\mathcal{D}$. The two other models, that explains the data, have higher values of $p(\mathcal{D}|M_2)$ and $p(\mathcal{D}|M_3)$. But, since $p(\mathcal{D}|M_3)$ "shares" probability mass with more datasets than $p(\mathcal{D}|M_2)$, by conservation of probability mass, we find that $p(\mathcal{D}|M_2)$ is higher.
Hence we have the order
\begin{equation}
 p(\mathcal{D}|M_2) > p(\mathcal{D}|M_3) > p(\mathcal{D}|M_1).
\end{equation}
Hence, we find that $M_2$ is simple enough to be desirable, but not so simple as to not be able to explain $\mathcal{D}$, thus obeying the Occam's razor principle.

The model set $\mathcal{M}$ itself does not need to be discrete or enumerable. If $\mathcal{M}$ can be parametrized by a set $\Lambda$, then one can change $\mathcal{M}$ for $\Lambda$, and find the maximum of evidence by:
\begin{equation}
 \lambda_{ML-II} = \argmax_{\lambda \in \Lambda} p(\mathcal{D}|M(\lambda)).
\end{equation}
This estimator is called \textit{type II maximum likelihood} estimator. By setting an prior over $\Lambda$, we would have instead a \textit{type II maximum a posteriori} estimator
\begin{equation}
 \lambda_{MAP-II} = \argmax_{\lambda \in \Lambda} p(\mathcal{D}|M(\lambda)) p(M(\lambda)).
\end{equation}

\section{Approximate inference}
Computationally, Bayesian inference suffers from two major issues:
\begin{itemize}
\item Because in the posterior density \eqref{bayes_theorem_2}, the normalizing term $p(\mathcal{D})$ \footnote{From now on we omit the dependence on the model $M$.} is to be determined by the integral \eqref{marginalization_2}, a closed-form solution of the posterior density is often unavailable, even though the unnormalized density $Z p(\theta|\mathcal{D}) = p(\mathcal{D}|\theta)p(\theta) = p(\theta,\mathcal{D})$ usually is.

\item A more grave problem is that, even with the normalized posterior density at hand, for an arbitrary function $f(\theta)$, the expectation $\int f(\theta) p(\theta|\mathcal{D}) d\theta$ is not trivial to calculate. And, as seen in Section \ref{decision_theory_section}, what one wants in the end with posterior distribution is to calculate expectations. Thus, computational methods for dealing with those problems are needed.
\end{itemize}

In this section, Monte Carlo methods are quickly reviewed, along with Laplace's approximation. Discussion on variational inference, another important approximate method, is postponed to Chapter 3, since it is a main subject of this work.

\subsection{Monte Carlo integration methods}

Consider back the expectation
\begin{equation}\label{ev_example}
\mu := \Ev_{\theta \sim p(\theta|\mathcal{D})}[f(\theta)] = \int f(\theta) p(\theta|\mathcal{D}) d\theta.
\end{equation}
Assuming this expectation exists, if one can sample $\theta_1,\ldots,\theta_N$ from $\theta|\mathcal{D}$, independently, then the estimator
\begin{equation}
 \hat{\mu} := \frac{1}{N} \sum_{i=1}^N f(\theta_i),
\end{equation}
is such that, as $N \to \infty$, $\hat{\mu} \to \mu$ almost surely, by the law of large numbers. Moreover, if the variance of $f(\theta)$ is finite, then the convergence rate is $
\mathcal{O}\left(\sqrt{\frac{\Var(f(\theta))}{N}}\right)$,
by the central limit theorem. Hence, the challenge of Monte Carlo methods is how to get, from an unnormalized posterior distribution $p(\theta,\mathcal{D})$, independent or "independent enough" samples from this distribution.

\subsubsection{Importance sampling}
The importance sampling algorithm \cite{Robert_2005} is a relatively simple algorithm for sampling from unnormalized posteriors. Let $q(\theta)$ be some proposal distribution, such that one can sample easily from $q(\theta)$, having samples $\theta_1,\ldots,\theta_N \sim q(\theta)$. Finally, assume an unnormalized density $\bar{q}(\theta) = Z_q q(\theta)$ is known. Then, rewrite \eqref{ev_example} as
\begin{equation}\label{is_rewrite}
\hat{\mu} = \int f(\theta) p(\theta|\mathcal{D}) d\theta =
\frac{Z_q}{Z} \int f(\theta) \frac{p(\theta,\mathcal{D})}{\bar{q}(\theta)} q(\theta) d\theta,
\end{equation}
which can be estimated as
\begin{equation}\label{is_derivation_1}
 \frac{Z_q}{Z} \int f(\theta) \frac{p(\theta,\mathcal{D})}{\bar{q}(\theta)} q(\theta) d\theta \approx \frac{1}{Z/Z_q} \frac{1}{N} \sum_{i=1}^N \tilde{w}_i f(\theta_i), \quad \tilde{w}_i := \frac{p(\theta_i,\mathcal{D})}{\bar{q}(\theta_i)}.
\end{equation}
The ratio $Z/Z_q$ can himself be estimated, using the same samples, as
\begin{equation}\label{is_derivation_2}
\frac{Z}{Z_q} = \frac{1}{Z_q} \int p(\theta,\mathcal{D}) d \theta = \int \frac{p(\theta,\mathcal{D})}{\bar{q}(\theta)} q(\theta) d\theta \approx \frac{1}{N} \sum_{i=1}^N \tilde{w}_i.
\end{equation}
Then, joining \eqref{is_derivation_1} and \eqref{is_derivation_2}, we have an estimate for \eqref{ev_example}
\begin{equation}
 \hat{\mu} = \int f(\theta) p(\theta|\mathcal{D}) d\theta \approx \sum_{i=1}^N w_i f(\theta_i), \quad w_i = \frac{\tilde{w}_i}{\sum_{j=1}^N \tilde{w}_j}, \, \forall i.
\end{equation}

\subsubsection{Markov Chain Monte Carlo}
Markov Chain Monte Carlo (MCMC) methods uses Markov chains to sample from the desired distribution \cite{Robert_2005,Brooks_2011}. MCMC is arguably the most popular method in Bayesian statistics, due to their ability to sample efficiently from relatively high dimensional distributions, with only unnormalized density available. As such, the number of MCMC methods is enormous. Here a basic method, Metropolis-Hastings, is reviewed in passing.

Markov chains are sequences of random variables $X_0,X_1,\ldots$, with the property that the conditional distribution $X_i|X_0,\ldots,X_{i-1}$ is the same as $X_i|X_{i-1}$. Thus, a Markov chain is completely defined by the distribution of the initial random variable $X_0$, and the \textit{transition probability distribution},  $p(x_{i+1}|x_i)$. If $p(x_{i+1}|x_i)$ is independent of $i$, is called a \textit{stationary transition}, and those kinds of chains are of most interest in MCMC methods.

Markov chains becomes interesting when their transitions have some unique distribution $\pi(x)$, called a \textit{stationary distribution}, such that
\begin{equation}
 \pi(x') = \int p(x'|x) \pi(x) dx,
\end{equation}
that is, when the initial random variable $X_0$ of a Markov chain is distributed according to $\pi(x)$, under the transition $p(x'|x)$, every $X_i$ is distributed according to $pi(x)$. One of the conditions that suffices (although is not necessary)for $\pi(x)$ being a stationary distribution is that it satisfies the \textit{detailed balance condition}
\begin{equation}
 p(x'|x)\pi(x) = p(x|x')\pi(x').
\end{equation}
With the stationary distribution, under some technical conditions (see \cite{Robert_2005}), we have for a Markov chain with transition probability $p(x'|x)$, such that $X_0 = x_0$ and $x_i$ is sampled from $p(x_i|x_{i-1})$, for $i \geq 1$, that, as $N \to \infty$,
\begin{equation}
 \frac{1}{N} \sum_{i=1}^N f(x) \to \Ev_{X \sim \pi}[f(X)].
\end{equation}

Moreover, the convergence follows a version of the central limit theorem. Assume first that $X_0 \sim \pi$. Then, we have that the central limit theorem holds, with \eqref{cltconvergence} being substituted for
\begin{equation}\label{cltmc}
 \mathcal{O}\left(\sqrt{\frac{\Var(f(X_1)) + 2 \sum_{k=1}^\infty \Cov(f(X_1),f(X_{1+k}))}{N}}\right),
\end{equation}
when $i$ large enough \cite{Geyer_2011}. More generally (and realistically), any Markov chain (modulo a technical conditions) for which the transition $p(x'|x)$ has stationary distribution $\pi(x)$ follows the central limit theorem, with asymptotic rate of convergence being the same as when $X_0 \sim \pi$. \footnote{This results in the important notion of \textit{effective sample size} (ESS), where \eqref{cltmc} is substituted for $\mathcal{O}\left(\sqrt{\frac{\Var(f(X))}{N_{\text{eff}}}}\right)$, with $N_\text{eff} = N/\left(1+2\sum_{k=1}^\infty \text{corr}(f(X_i),f(X_{i+k})\right)$, when $i$ is large enough.}

These results gives rise to the following procedure: construct a randomized algorithm such that, starting with some $\theta_i \in \Theta$, $\theta_{i+1} \in \Theta$ is generated such that $p(\theta_{i+1}|\theta_i)$ has stationary distribution $p(\theta|\mathcal{D})$.

The Metropolis-Hastings algorithm is one manner of doing this for a general distribution. Given a (possibly unnormalized) conditional distribution $g(\theta'|\theta)$ (a \textit{proposal distribution}), and $\theta_t$, $t \geq 0$, one samples a proposal
$\tilde{\theta}_{t+1}$ from $g(\theta'|\theta_t)$, and then, letting
\begin{equation}
 \alpha(\tilde{\theta}_{t+1},\theta_t) =
  \min \left(1, \frac{p(\tilde{\theta}_{t+1}|\mathcal{D}) g(\theta_t|\tilde{\theta}_{t+1})}{p(\theta_t|\mathcal{D}) g(\tilde{\theta}_{t+1}|\theta_t)}\right),
\end{equation}
be the \textit{acceptance probability}, then let $\theta_{t+1} = \tilde{\theta}_{t+1}$ with probability $\alpha(\tilde{\theta}_{t+1},\theta_t)$, else let $\theta_{t+1} = \theta_t$. One key observation is that the ratio $p(\tilde{\theta}_{t+1}|\mathcal{D})/p(\theta_t|\mathcal{D})$ is independent of the normalization constant, thus it can be substituted for $p(\mathcal{D}|\tilde{\theta}_{t+1})p(\tilde{\theta}_{t+1})/p(\mathcal{D}|\theta_t)p(\theta_t)$, avoiding the need for the normalized posterior.

For continuous distributions, one standard proposal distribution is $g(\theta'|\theta) = \mathcal{N}(\theta'|\theta,\epsilon^2 I)$, with $\epsilon$ being the step size, resulting in the \textit{Random Walk Metropolis} algorithm. In particular, with this proposal distribution $g(\theta'|\theta) = g(\theta'|\theta)$, simplifying the acceptance probability to
\begin{equation}
\alpha(\tilde{\theta}_{t+1},\theta_t) =
\min \left(1, \frac{p(\tilde{\theta}_{t+1}|\mathcal{D})}{p(\theta_t|\mathcal{D})}\right),
\end{equation}

\subsection{Laplace's approximation}
Laplace's approximation \cite{Bishop_2007} is arguably the simplest technique from a class of methods that tries to approximate the density $p(\theta|\mathcal{D})$ by some other density $q(\theta)$, using $p(\theta,\mathcal{D})$, and work with the approximation. Another technique that belongs to this class of methods is variational inference, the subject of Chapter 5.

Consider $\Theta = \mathbb{R}^D$, $p(\theta|\mathcal{D})$ to be smooth, and $\theta^* = \hat{\theta}_{\text{MAP}}$ be the MAP of $p(\theta|\mathcal{D}) = p(\theta,\mathcal{D})/Z$. Then, doing a second order Taylor approximation on $l(\theta) = \log p(\theta,\mathcal{D}) = \log p(\theta|\mathcal{D}) + \log p(\mathcal{D})$, around $\theta^*$, and noticing $\nabla_\theta l(\theta^*) = 0$,
\begin{equation}
 l(\theta) \approx l(\theta^*) + \frac{1}{2} (\theta - \theta^*)^T H_{\theta^*}(l) (\theta - \theta^*),
\end{equation}
where $H_{\theta^*}(l)$ is the Hessian matrix of $l(\theta)$ on $\theta^*$ \footnote{The negative of the Hessian matrix $-H_{\theta}(l)$ is the same as Fisher information matrix $I(\theta)$.}. Then, letting $\Sigma = -H_{\theta^*}^{-1}(l)$ and $\mu = \theta^*$, taking the exponential on both sides
\begin{equation}
p(\theta,\mathcal{D}) \approx \exp(l(\theta^*)) \exp \left(-\frac{1}{2}(\theta - \mu)^T \Sigma^{-1} (\theta - \mu) \right).
\end{equation}
The second side is just the unnormalized density of $\mathcal{N}(\theta|\mu,\Sigma)$. Hence, normalizing back, we arrive at the Laplace's approximation for $p(\theta|\mathcal{D})$
\begin{equation}
p(\theta|\mathcal{D}) \approx \mathcal{N}\big(\theta;\theta^*,-H_{\theta^*}^{-1} (l)\big).
\end{equation}

The Laplace' approximation needs optimization of $l(\theta)$ and access to second derivatives, which for many cases may be cheaply available. However, since the approximation is only local, it may diverge sharply from the actual posterior. Moreover, in higher dimensions, calculating and inverting the Hessian matrix may be too costly.

\subsubsection{Remark on approximation}
It is important to consider a possible advantage of using an approximate density $q(\theta)$ over sampling from $p(\theta|\mathcal{D})$. Assume $q(\theta)$ simple enough so that there is no need for advanced sampling techniques for Markov Chain Monte Carlo. Then, consider the general loss minimization problem \eqref{generalloss}, and substitute $p(\theta|\mathcal{D})$ for $q(\theta)$, yielding the minimization objective for $a \in \mathcal{A}$.
\begin{equation}
 F_q(a) = \int_{\Theta} L(\theta,a) q(\theta) d\theta.
\end{equation}
If $\mathcal{A}$ is a subset of $\mathbb{R}^k$, then one can sample $N$ samples from $q(\theta)$ and get a stochastic estimation of $\nabla F_q(a)$
\begin{equation}
 \nabla F_q(a) \approx \frac{1}{N}\sum_{\theta_i \sim q(\theta)} \nabla_a L(\theta_i,a),
\end{equation}
allowing the application of stochastic gradient descent, and related techniques, for minimizing $F_q(a)$. However, sampling from $q(\theta)$ is easy, so the bottleneck mostly belongs in the evaluation of $\nabla_a L(\theta,a)$. If samples from $p(\theta|\mathcal{D})$ were made from some more advanced sampling technique instead, the bottleneck would be in the sampling algorithm performance, which may be not quite as fast. Since $q(\theta)$ must be discovered only once, then approximation may be more feasible.

The drawback is that of course $q(\theta)$ must be a good approximation of $p(\theta|\mathcal{D})$ to begin with, which may not be easy to ensure (as discussed, this is one drawback from Laplace's approximation).

\section{Expensive and intractable likelihoods}
In general, Monte Carlo techniques assumes that $p(\theta,\mathcal{D}) = p(\mathcal{D}|\theta) p(\theta)$ can be evaluated cheaply. Since usually the prior $p(\theta)$ is chosen in a manner that it is very simple, whether $p(\theta,\mathcal{D})$ is hard to evaluate depends on $p(\mathcal{D}|\theta)$. In many cases, likelihood evaluation is in fact cheap, but in some cases it may be expensive or intractable, requiring specific techniques for approximate inference.

\subsection{Pseudo-marginals}\label{pseudomarginalsection}
One case of intractable likelihood is when the likelihood model depends on some unobserved variable, that must be marginalize. To illustrate, consider that $\mathcal{D} = y_1$ is a noisy observation of a phenomena $z_1$, whose dependence on a parameter $\theta$ is modeled as $p(z_1|\theta)$. The noise model $p(y_1|z_1)$ is also available. Then, the likelihood $p(y_1|\theta)$ comes from marginalization
\begin{displaymath}
p(y_1|\theta) = \int p(y_1|z_1) p(z_1|\theta) d\theta.
\end{displaymath}

As a general case, consider a likelihood dependent on a latent variable
\begin{equation}\label{ilikemargin}
 p(\mathcal{D}|\theta) = \int p(\mathcal{D}|\omega,\theta) p(\omega|\theta) d\omega.
\end{equation}
Assume the integral in \eqref{ilikemargin} is not available analytically, hence so is not $p(\mathcal{D}|\theta)$. Usually what is available are Monte Carlo estimates of $p(\mathcal{D}|\theta)$, say by i.i.d. samples of $w|\theta$,
\begin{equation}
 \hat{p}(\mathcal{D}|\theta) = \frac{1}{N} \sum_{\omega_i \sim p(\omega|\theta)} p(\mathcal{D}|\omega_i,\theta),
\end{equation}
or by importance sampling. In this case, \cite{Andrieu_2009} shows that when using an unbiased and positive estimate $\hat{p}(\mathcal{D}|\theta)$ at each step of the Metropolis-Hastings algorithm, resulting in an unbiased estimate of the unnormalized posterior $\hat{p}(\mathcal{D}|\theta)p(\theta)$, the resulting stationary distribution is $p(\mathcal{D}|\theta)$. The result does not give an answer on whether Metropolis-Hastings using $\hat{p}(\mathcal{D}|\theta)$ is efficient, and how to make so. This itself is a current topic of research (some examples can be found in \cite{Andrieu_2010,Sherlock_2015}).

\subsection{Approximate Bayesian computation}
Now consider a model that $p(\mathcal{D}|\theta)$ is not readily available, but for each fixed $\theta \in \Theta$, one can sample the \textit{random variable} $\mathcal{D}|\theta$ with ease. For clarity, we will refer to this random variable as $\mathcal{D}'|\theta$, while keeping $\mathcal{D}$ denoting the fixed data.

As an example, consider the data $\mathcal{D}$ consists of observation point $x_N$ of a long Markov chain, with known transition probability distribution $p(x_{i+1}|x_i)$, and one wants to infer the point $x_0$ where the chain was initiated. The likelihood $p(x_N|x_0)$ is given by
\begin{equation}
 p(x_N|x_0) = \int \ldots \int p(x_N|x_{N-1}) \ldots p(x_1|x_0) dx_1 \ldots dx_{N-1},
\end{equation}
which is hard to even compute some pseudo-marginal. However, given some $x_0$, sampling $x_N$ is just a question of simulating the chain for $N$ steps, with transition $p(x_{i+1}|x_i)$. Some other examples of models whose likelihood is hard to evaluate, but sampling is easy, are found in evolutionary genetics \cite{Pritchard_1999,Beaumont_2003}.

In approximate Bayesian computation (ABC) \cite{Fearnhead_2012,Beaumont_2003}, one wishes to construct an artificial likelihood $p_{\text{ABC}}(\mathcal{D}|\theta)$, in such a way that for each $\theta$, when the simulated data $\mathcal{D}'|\theta$ is "similar" to $\mathcal{D}$, $p_{\text{ABC}}(\mathcal{D}|\theta)$ is higher than when $\mathcal{D}'|\theta$ is not. For doing this, one takes:
\begin{itemize}
	\item a function $S$ that takes a (simulated or real) dataset $\mathcal{D}$ and return some $d$-dimensional statistics of it.
	For example, if $\mathcal{D} = \{y_1,\ldots,y_N\}$, the statistics may be the first $d$ empirical moments of $\mathcal{D}$, or simply $\mathcal{D}$, making $S$ the identity function (in this case $d=N$).
	\item A function $k:\mathbb{R}^d \to \mathbb{R}$, integrating to one, such that $k$ achieves its maximum at $0$. For instance, $k(x) = \mathcal{N}(x;0,h^2 I)$ can be used.
\end{itemize}
With those, one defines the ABC approximation for the likelihood
\begin{equation}\label{abclikelihood}
 p_{\text{ABC}}(\mathcal{D}|\theta) = \int \frac{1}{h}k\left(\frac{S(\mathcal{D}) - S(\mathcal{D}')}{h}\right) p(\mathcal{D}'|\theta) d\mathcal{D}'.
\end{equation}
To see why this is an approximation of the true likelihood $p(\mathcal{D}|\theta)$, assume that $S(\mathcal{D}) = S(\mathcal{D}')$ if and only if $\mathcal{D} = \mathcal{D}'$, and consider $k(x) = \mathcal{N}(x;0,h^2 I)$. Then, as $h \to 0$, $h^{-1}k((S(\mathcal{D}) - S(\mathcal{D}'))/h)$ goes to the Dirac delta function $\delta(\mathcal{D} - \mathcal{D}')$. But, we have that
\begin{equation}
\int \delta(\mathcal{D} - \mathcal{D}') p(\mathcal{D}'|\theta) d \mathcal{D}' = p(\mathcal{D}|\theta)
\end{equation},
so $p_{\text{ABC}}(\mathcal{D}|\theta)$ goes to $p(\mathcal{D}|\theta)$ when $h$ goes to $0$.

With the approximate likelihood \eqref{abclikelihood}, one has the corresponding approximate ABC posterior
\begin{equation}
 p_{\text{ABC}}(\theta|\mathcal{D}) \propto p_{\text{ABC}}(\mathcal{D}|\theta) p(\theta).
\end{equation}
Notice the ABC likelihood still is not analytically available. However, since samples from $p(\mathcal{D}'|\theta)$ are available, one can use the pseudo-marginal technique presented in previous section to sample from the approximate ABC posterior. The question on how to choose appropriate summary statistics is addressed for example in \cite{Fearnhead_2012}.

\subsection{Expensive likelihoods}
In some cases, the likelihood $p(\mathcal{D}|\theta)$ is expensive to evaluate but not intractable, such that one can have tens or hundreds of evaluations in limited time, but not much more. Moreover, unlike the previously presented case, sampling from the model is just as expensive, if not more, than evaluating $p(\mathcal{D}|\theta)$. Such likelihoods arise, for example, in Bayesian inverse problems \cite{Tarantola_2004}, where the mapping from parameters to observations is done by expensive simulations.

An approach is, given a limited number of likelihood evaluations $\Omega_N = \{(\theta_i,p(\mathcal{D}|\theta_i)\}$, construct an approximate model $\hat{p}_N(\theta|\mathcal{D})$ of $p(\theta|\mathcal{D})$, and inference is performed with the approximation, usually with MCMC. This model should, given new evaluations of the likelihood $\Omega_{N'}$, be able to incorporate those in an online manner.

Gaussian processes, presented in next chapter, are particularly suitable for this task, and are used in \cite{Rasmussen_2003,Wang_2018_2,Bilionis_2013,Kandasamy_2015,Conrad_2016}, using Monte Carlo methods on the approximation. Other approximations include GRIMA \cite{Bliznyuk_2012} and polynomial approximations \cite{Marzouk_2007}. The work presented here falls in the contest of expensive likelihoods methods, using Gaussian processes for approximation, and variational inference for approximate inference, as in \cite{Acerbi_2018}.


\unnumberedchapter{Nomenclature}
\chapter*{Nomenclature}

% Break up this table into several ones if it takes up more than one page
\begin{longtable}{rl}
$h$ & Planck constant ($6.626\ 070\ 04\e{-34}\ \mbox{Js}$). \\
$\hbar$ & Planck constant over $2\pi$ ($1.054\ 572\ 66\e{-34}\ \mbox{Js}$). \\
$L_z$ & Angular momentum operator along the $z$-dimension; $xp_y-yp_x$. \\
$\nabla$ & Gradient operator. \\
$\Omega$ & Angular rotation frequency of condensate. \\
$\xi$ & Condensate healing length; the distance from a region of zero density at vortex core to bulk density. \\
$\mu$ & Chemical potential of the condensate; the energy change per unit change in particle number. \\
\end{longtable}


\section{Phase Unwrapping}

\subsection{Path-Following vs Minimum Norm Algorithms}

\subsubsection{Path-Following Algorithms}

Phase unwrapping algorithms may be categorized as path-following or minimum norm algorithms.  Path-following algorithms generally specify one or more starting points at which the phase is considered to be `true.'  Residues, masks, and/or a continuous measure of phase quality may then be used to restrict or guide the allowed path(s), along which the encountered pixels are unwrapped based on local pixel values.  Because the unwrapping operation consists entirely of adding some multiple of $2\pi$, the resulting phase is necessarily `congruent' to the wrapped phase input.

The \code{itk::ItohPhaseUnwrapping} class presented above is the simplest possible example of a path-following algorithm.  More sophisticated algorithms have been described which attempt to restrict the possible paths so as to avoid unwrapping through low-quality regions:

\begin{itemize}

\item Goldstein's Branch Cut Phase Unwrapping \cite{Goldstein1988}
\item Flynn's Quality-Guided Residue-Mask Phase Unwrapping \cite{Flynn1996}
\item Flynn's Minimum Discontinuity Phase Unwrapping \cite{Flynn1997}
\item Quality-Guided Phase Unwrapping

\end{itemize}

While Goldstein's and Flynn's algorithms rely on residues, the quality-guided algorithm relies on a user-defined quality map (such as phase derivative variance, discussed above).  This distinction is important because of the observation that residues are only physically meaningful in two dimensions.  Therefore, Goldstein's and Flynn's algorithms are only useful for two-dimensional phase unwrapping.  Phase derivative variance and other quality measures, however, may easily be generalized to arbitrary dimension.  Therefore, the quality-guided approach may be implemented for $n$-dimensional images.  For this reason, \code{itk:QualityGuidedPhaseUnwrappingImageFilter} (defined in \code{itkQualityGuidedPhaseUnwrappingImageFilter.h}) was implimented for this submission, whereas Goldstein's and Flynn's algorithms were not considered.

\subsubsection{Minimum Norm Algorithms}

The framework for the minimum $L^p$-norm algorithms was first presented by Ghiglia, et al, in \cite{Ghiglia1998}. Minimum norm algorithms may be subclassified according to (a) whether they take into account phase quality and (b) the exponent of the term being minimized.  Weighted algorithms penalize differences in low-quality pixels less than high-quality pixels, whereas unweighted algorithms weight differences in all pixels equally, regardless of quality.  To give physical significance to the particular norm chosen, $L^0$-norm methods minimize the number of pixels that ate not congruent to the input, $L^1$-norm methods minimize the absolute differences, and $L^2$-norm methods minimize the squared differences.  Unweighted, minimum $L^2$-norm phase unwrapping may be implimented efficiently by taking advantage of the discrete cosine transform (DCT).  This algorithm is implemented in the \code{itk:DCTPhaseUnwrappingImageFilter} (defined in \code{itkDCTPhaseUnwrappingImageFilter.h}).

\subsection{Quality-Guided Phase Unwrapping: Implementation Summary}

The \code{itk::QualityGuidedPhaseUnwrapping} class iterates over three images: the wrapped image, the quality image, and a binary image.  A pixel in the binary image is \code{true} if the pixel has been unwrapped, or \code{false} otherwise.  Additionally, a list is maintained which contains the index and quality of all `candidate pixels.'  A pixel is considered a candidate if (a) it adjoins a pixel that has been unwrapped and (b) has not been unwrapped.

Efficiently maintaining the list of candidate pixels is of particular importance for this filter.  To this end, this submission provides the \code{itk::IndexValuePair} class (defined in \code{itkIndexValuePair.h}), which has properties \code{Index} and \code{Value}.  The class overloads the \code{==} operator such that \code{pair1 == pair2} is \code{true} if \code{pair1.Index == pair2.Index} is \code{true}, and overloads the \code{>} operator such that \code{pair1 > pair2} is \code{true} if \code{pair1.Value > pair2.Value} is \code{true}.  As such, instances of this class can be stored in a \code{std::set}, ensuring that (a) the same pixel location cannot be stored twice and (b) the pixels are sorted according to their quality score.  Therefore, an \code{itk::IndexValuePair} can be added to the list without first checking whether it is already a member, and the highest-quality pixel can always be retrieved by selecting the last element of the \code{std::set}.

The user sets the active index using the \code{SetTruePhase()} method.  This is taken as the starting point for iteration, and is set to be \code{true} in the binary image.  \code{itk::IndexValuePair}s for the pixels plus or minus one index in each direction are added to the list of candidate pixels.  The pixel in the list with the highest quality is unwrapped and made the active index, and the corresponding index in the binary image is set to \code{true}.  The process repeats while the list of candidate pixels is non-empty.

Once \code{Update()} has been called, the unwrapped and quality images may be retrieved via the \code{GetPhase()} and \code{GetQuality()} methods, respectively.  Currently, the filter only supports phase derivative variance as a quality measure, though the filter could be easily extended to include others.

\subsection{DCT Phase Unwrapping: Implementation Summary}

The unweighted, minimum $L^2$ norm solution is calculated efficiently in \code{itk::DCTPhaseUnwrappingImageFilter} (defined in \code{itkDCTPhaseUnwrappingImageFilter.h}) by taking advantage of Fourier methods for solving Laplace's equation ($\bigtriangleup \phi = 0$), as described in \cite{Ghiglia1998}.  \code{itk::DCTPhaseUnwrappingImageFilter} uses the two contributed classes \code{itk::DCTImageFilter} and \code{itk::DCTPoissonSolverImageFilter}.  We refer the reader to the Appendix for a discussion of these classes, as they are of general interest to the image processing community, but may obscure the primary objectives of this submission if described in full here.  Briefly:

\begin{itemize}

\item The wrapped phase Laplacian of the input is calculated using \code{itk::WrappedPhaseLaplacianImageFilter} (defined in \code{itkWrappedPhaseLaplacianImageFilter.h}).
\item The forward DCT is taken using \code{itk::DCTImageFilter} (defined in \code{itkDCTImageFilter.h}).
\item The  transformed image undergoes a pixelwise modulation.
\item The inverse DCT is taken.

\end{itemize}

\code{itk::DCTImageFilter} provides access to the $n$-dimensional real-to-real transform provided in the FFTW library \cite{Frigo2005}.  For this reason, in order to use this filter (and its dependents), ITK must be built with the cmake variable \code{USE\_FFTWD} set to \code{ON}, and any project using this filter is subject to the GPL license.


%% \subsection{Practical Importance}
%% \label{sec:Problem:pract}
\section{Case Study}
\label{sec:CaseStudy}

\input{fig-testbench}

To illustrate the practical importance of the four core properties, we consider a simply-typed $\lambda$-calculus augmented with an \texttt{assert} operator.
%
Suppose our goal is to formalize an environment-based (as opposed to substitution-based) evaluation semantics,
%
and prove that evaluation is strongly normalizing and that it satisfies the structural properties contraction and exchange.

\autoref{fig:testbench} shows a sketch of this environment-based evaluation (\texttt{\_$\vdash$\_$\Rightarrow$\_}) of expressions (\texttt{exp}) to results (\texttt{res}).
%
The definitions of evaluation environments (\texttt{env}), types, type contexts, and typechecking are not shown.
%
%; the full development is available in the supplementary materials.
%
\texttt{assert} takes two arguments; if their evaluation results are exactly equal, \texttt{assert} evaluates to the first,
otherwise it evaluates to an \texttt{Err} result.

Evaluation environments are used both as a parameter to the evaluation judgment as well as a data component of closure results.
%
What dictionary implementation should we choose to represent environments?

%
%% Below we show that \dds{} are a suitable choice, but that all the conventional solutions fail.

Using basic \sal{}s, contraction is false:
%
for example, given environments
%
$E_1=$\ \texttt{E ,, (n , v') ,, (n , v)} and
%
$E_2=$\ \texttt{E ,, (n , v)},
%
evaluation produces the closures
%
$\altEvalEnv{E_1}{\lambda x. e}{[E_1]\ \lambda x. e}$
%
and
%
$\altEvalEnv{E_2}{\lambda x. e}{[E_2]\ \lambda x. e}$
%
but
%
$[E_1]\ \lambda x. e \neq [E_2]\ \lambda x. e$.
%
A similar problem occurs for exchange, so it is also false.
%
In order for contraction and exchange to be true for any system with closure results,
the dictionary implementation used for closures must be \extensional.

\Cals{} must be packaged with validity proofs wherever they go, including in the closure result.
In such a validity proposition \texttt{valid : dict -> Set},
%
%% (defined in full in the supplementary materials)
%
the dictionary object is in negative position,
and in our case the dictionary type is dependent on the result datatype,
so the result is also in negative position, violating strict positivity.
As such, results cannot contain validity proofs, so for any system that uses dictionaries as data,
the dictionaries must be \semanticallyTotal.

Because \fpf{}s do not have \EqDec, it is not possible to decide which \texttt{EvalAsrt} constructor would
apply to an \texttt{assert} of two \fpf{}s. As such, using \fpf{}s would make it impossible to constructively prove strong normalization.

In contrast, \dds---uniquely amongst the surveyed solutions---possess \SemTot, \SemInj, and \EqDec.
%
Thus, they are a suitable choice for implementing environments, enabling proofs of contraction, exchange, and strong normalization.
%
We discuss the generality of this case study further in \autoref{sec:Discussion:Generality}.


\begin{intro}
  There are two fundamentally different definitions of Sobolev spaces,
  which are usually referred to as the spaces $H^k$ and $W^{k,p}$. The
  first group is obtained by completing a space of continuously
  differentiable functions with respect to a given norm. The second
  definition relies on the introduction of distributional derivatives
  and then restricts the set of functions with such derivatives to
  those bounded with respect to a given norm. Thus, we can say that
  $H^k$ approximates the desired space from the inside, while
  $W^{k,p}$ bounds it from the outside. An important result of modern
  analysis was the conclusion that both classes are actually the same.

  Details on Sobolev spaces, including most of the material below can
  be found in~\cite{AdamsFournier03}. A very condensed introduction is
  also in\cite[Chapter 7]{GilbargTrudinger98}.
\end{intro}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{The Sobolev spaces $H^{1}(\Omega)$}
\label{sec:h1}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{intro}
  These spaces are defined by first defining a norm for them, then
  completing for instance the space $\co^\infty$ with respect to this
  norm. This will lead to some difficulties with the involved symbols,
  which we will resolve in Section~\ref{sec:weak-derivatives}. We note
  that the problem of definiteness of the norm is the same as in the
  definition of $L^2(\Omega)$, which is, why we again have to take
  equivalence classes.
\end{intro}

\begin{definition}
  For functions $f,g\in \co^\infty(\Omega)$, we define the inner
  products, the
  $H^{1}$-seminorm $|.|_1$ and the $H^{1}$-norm $\norm{.}_1$ as
  \begin{xalignat}2
    \scal(f,g)_1 &= \int_\Omega \nabla f\cdot \nabla g\dx,
    &
    |f|_1 &= \norm{\nabla f}_0,
    \\
    \Scal(f,g) &= \scal(f,g)_0 + \scal(f,g)_1,
        & \norm{f}_1 &= \norm{f}_0 + |f|_1.
      \end{xalignat}
  Here, $\scal(.,.)_0$ and $\norm{.}_0$ refer to the inner product and
  norm in $L^2(\Omega)$, respectively.
\end{definition}

\begin{definition}
  \index{h1@$H^1(\Omega)$}
  First we compute the completion of
  $\co^\infty(\Omega)$ with respect to the norm $\norm{f}_1$, that is,
  the set of limits of all Cauchy sequences with respect to the
  $H^1$-norm consisting of elements in $\co^\infty(\Omega)$ with
  uniformly bounded $H^1$-norm. The $H^1$-norm of the limit function
  is defined as the limit of the norms of the sequence.

  The \define{Sobolev space} $H^1(\Omega)$ is the set of equivalence classes in
  this completion, where we say $f\simeq g$ if $\norm{f-g}_1=0$.
\end{definition}

\begin{note}
  The space $\co^\infty(\Omega)$ in this definition could have been
  replaced by $\co^1(\Omega)$ with no different effect.
\end{note}

\begin{example}
  The completion process in the definition above indeed yields
  functions which were not in $\co^\infty$. For instance, it is
  possible to construct a smooth sequence of functions converging to
  the function $f(x) = |x|$ with respect to the $H^1$-norm on $[-1,1]$.
\end{example}

\begin{definition}
  The space $\co^\infty_0(\Omega)$ is the space fo functions with
  ininitely many continuous derivatives and compact support in
  $\Omega$.
\end{definition}

\begin{definition}
  \index{h10@$H^1_0(\Omega)$}
  The Sobolev space $H^1_0(\Omega)$ is obtained by completing the
  space $\co^\infty_0(\Omega)$ with respect to the $H^1$-norm and
  taking equivalence classes such that $f\simeq g$ if $\norm{f-g}_1=0$.
\end{definition}

\begin{note}
  It remains to be shown that the spaces $H^1(\Omega)$ and
  $H^1_0(\Omega)$ are actually different.
\end{note}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Weak derivatives and the Sobolev spaces $W^{1,2}$}
\label{sec:weak-derivatives}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{intro}
  When we introduced the space $H^1(\Omega)$, we started with a
  subspace of continuous functions and extended this space by adding
  the limits of Cauchy sequences. The result is a complete space with
  respect to the norm $\norm{.}_1$. On the other hand, it is not clear
  whether this is the biggest function space for which this norm is
  finite. Therefore, in this section, we take the opposite approach:
  we define a derivative in a very broad sense and then reduce to
  those derivatives bounded with respect to the norm $\norm{.}_1$.
\end{intro}

\begin{definition}
  If for a given function $u$ there exists a function $w$ such that
  \begin{gather}
    \label{eq:hk:1}
     \int_\Omega w \phi \dx
     =
     -\int_\Omega u \partial_i \phi \dx,
     \qquad\forall \phi\in \co^\infty_0(\Omega),
  \end{gather}
  then we define $\partial_i u := w$ as the \define{distributional
    derivative} (partial) of $u$ with respect to $x_i$. Similarly through
  integration by parts, we define distributional directional
  derivatives, distributional gradients etc.
\end{definition}

\begin{note}
  The formula~\eqref{eq:hk:1} is the usual integration by
  parts. Therefore, whenever $u\in\co^1$ in a neighborhood of $x$, the
  distributional derivative and the usual derivative coincide.
\end{note}

\begin{example}
  Let $\Omega=\R$ and $u(x) = |x|$. Intuitively,
  it is clear that the distributional derivative, if it exists, must
  be the \define{Heaviside function}
  \begin{gather}
    \label{eq:hk:2}
    w(x) =
    \begin{cases}
      -1 & x<0 \\ 1 & x>0.
    \end{cases}
  \end{gather}
  The proof that this is actually the distributional derivative is
  left to the reader.
\end{example}

\begin{example}
  For the derivative of the \putindex{Heaviside function}
  in~\eqref{eq:hk:2}, we first observe that it must be zero whenever
  $x\neq 0$, since the function is continuously differentiable
  there. Now, we take a test function $\phi\in\co^\infty$ with support
  in the interval $(-\epsilon,\epsilon)$ for some positive
  $\epsilon$. Let $w'(x)$ be the derivative of $w$. Then, by
  integration by parts
  \begin{gather*}
    \int_{-\epsilon}^\epsilon w(x) \phi'(x)\dx
    = -\int_{-\epsilon}^0 w(x)' \phi(x)\dx
    -\int_0^\epsilon w(x)' \phi(x)\dx
    + 2 \phi(0) = 2\phi(0),
  \end{gather*}
  since $w'(x) = 0$ under both integrals. Thus, $w'(x)$ is an object
  which is zero everywhere except at zero, but its integral against a
  test function $\phi$ is nonzero. This contradicts our notion, that
  integrable functions can be changed on a set of measure zero without
  changing the integral. Indeed, $w'$ is not a function in the usual
  sense, and we write $w'(x) = 2 \delta(x)$, where $\delta(x)$ is the
  \define{Dirac $\delta$-distribution}, which is defined by the two
  conditions
  \begin{gather*}
    \begin{alignedat}{2}
      \delta(x) &= 0, & \forall x & \neq 0
      \\
      \int_\R \delta(x) \phi(x)\dx &= \phi(0), \quad & \forall \phi
      &\in \co^0(\R).
    \end{alignedat}
  \end{gather*}
  We stress that $\delta$ is not an integrable function, or a function
  at all.
\end{example}

\begin{example}
   Take for instance $\Omega
  = [0,1]$. It is known that \putindex{Lipschitz-continuous}
  functions on $\R$ are absolutely continuous and thus continuously
  differentiable almost everywhere, with their derivatives bounded by
  the Lipschitz constant, say $L$. Thus, the function itself is
  bounded on $[0,1]$, say by $M$. Therefore, such a function $f$ is
  weakly differentiable and its norm is bounded by
  \begin{gather*}
    \norm{f}_1 \le L+M.
  \end{gather*}
\end{example}

\begin{definition}
  For a function $u\in L^2(\Omega)$, we call a distributional
  derivative a \define{weak derivative}, if the derivative is in
  $L^2(\Omega)$ as well. For such a \define{weakly differentiable} function,
  the seminorm $|.|_1$ and thus the norm $\norm{.}_1$ is defined, if
  the gradient is understood in the distributional sense.

  The space of weakly differentiable functions defined in this manner
  is the \putindex{Sobolev space} $W^{1,2}(\Omega)$, where the
  superscript one stands for the order of derivatives and the two is
  the exponent in the norm.
\end{definition}

\begin{remark}
  In this section and the previous section, we have seen two different
  definition of Sobolev spaces. One of the important theorems of
  modern analysis due to Meyers and Serrin~\cite{MeyersSerrin64}
  states that these two definitions actually specify the same object.
\end{remark}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Higher order derivatives and different exponents}
\label{sec:higher-derivatives}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{intro}
  Here we generalize the definitions of Sobolev spaces in
  Sections~\ref{sec:h1} and~\ref{sec:weak-derivatives}, respectively,
  to higher order derivatives. Most of this section will consist of
  introducing ugly notation, which is, why we postponed
  this. Mathematically, like for continuous derivatives, the same
  concepts as above are applied to obtain the new spaces.
\end{intro}

\begin{definition}
  A $d$-dimensional \define{multi-index} is a tuple
  $\alpha=(\alpha_1,\alpha_2,\dots,\alpha_d)$ with values $\alpha_i$
  being nonnegative integers. We define partial derivatives of a
  function $u\in C^\infty$ with respect to a multi-index as
  \begin{gather*}
    \partial_{\alpha}u(x) = \frac{\partial^\alpha}{\partial x^\alpha}
    u(x)
    = \frac{\partial^{\alpha_1}}{\partial x_1^{\alpha_1}}
    \frac{\partial^{\alpha_2}}{\partial x_2^{\alpha_2}}
    \dots
    \frac{\partial^{\alpha_d}}{\partial x_d^{\alpha_d}}
    u(x_1,x_2,\dots,x_d).
  \end{gather*}
  The order of such a derivative is
  \begin{gather*}
    |\alpha| = \sum_{i=1}^d \alpha_i.
  \end{gather*}
\end{definition}

\begin{definition}
  Let $u$ be integrable on $\Omega\subseteq \R^d$. If a function $w$
  exists such that
  \begin{gather}
    \int_\Omega w \phi\dx = (-1)^{|\alpha|} \int_\Omega
    u, \partial_\alpha \phi \dx,
    \qquad\forall \phi\in \co^\infty_0(\Omega),
  \end{gather}
  then we call $\partial_\alpha u = w$ a \putindex{distributional derivative} of
  order $|\alpha|$ of $u$. If this derivative is in $L^2(\Omega)$, we
  call it a \putindex{weak derivative}.
\end{definition}

\begin{definition}
  The space $W^{k,2}(\Omega)$ is the space of functions $u\in
  L^2(\Omega)$ such that all distributional derivatives of order
  $|\alpha| \le k$ are in $L^2(\Omega)$. The $W^{k,2}$-seminorm and
  -norm are defined by
  \begin{gather*}
    |f|_k = \sqrt{\sum_{|\alpha| = k} \norm{\partial_\alpha u}^2},
    \qquad
    \norm{f}_k = \sqrt{\sum_{|\alpha| \le k} \norm{\partial_\alpha u}^2}.
  \end{gather*}
\end{definition}

\begin{remark}
  If we give up the notion of an inner product, all definitions above
  extend to the case where we replace $L^2$ by a space based on a norm
  with different exponent $1 \le p \le \infty$. This leads to the
  spaces $W^{k,p}(\Omega)$.
\end{remark}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Properties of Sobolev spaces}
\label{sec:hk:properties}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{intro}
  For continuously differentiable functions, the inclusion $\co^{k+1}
  \subset \co^k$ is obvious. The same inclusion holds for $W^{k+1,p}$
  and $W^{k,p}$ by definition. Continuous functions are obviously
  continuous on smooth submanifolds, but Sobolev functions are a
  priori not even defined there. Nevertheless, we will see below, that
  there are operators which allow us to define traces of Sobolev
  functions on lower dimensional submanifolds, and even embeddings
  into spaces of continuous functions.
\end{intro}

\begin{definition}
  Let $\Omega \subset \R^d$. For the \putindex{Sobolev space}
  $W^{k,p}(\Omega)$, we define the \define{Sobolev number}
  \begin{gather}
    \label{eq:hk:3}
    \sigma = k - \frac dp.
  \end{gather}
\end{definition}

\begin{todo}
  For the following theorems, verification is required when the cases $p=1$ and
  $p=\infty$ are included, when equality of the Sobolev numbers is
  sufficient and when not, and which assumptions on the domains are reasonable.
\end{todo}

\begin{theorem}
  Let $\Omega \subset \R^d$ be a bounded Lipschitz domain. Given two
  Sobolev spaces $W^{k_1, p_1}(\Omega)$ and $W^{k_2, p_2}(\Omega)$
  with $1 \le p_1, p_2 < \infty$. If $\sigma_1 \ge \sigma_2$, then
  there exists a continuous embedding $W^{k_1,
    p_1}(\Omega)\hookrightarrow W^{k_2, p_2}(\Omega)$ such that
\begin{gather*}
  \norm{u}_{W^{k_2, p_2}(\Omega)} \le C \norm{u}_{W^{k_1, p_1}(\Omega)}.
\end{gather*}
\end{theorem}

\begin{theorem}
  Let $\Omega_1 \subset \R^{d_1}$ be a bounded Lipschitz domain and
  $\Omega_2\subset \overline\Omega_1$ a smooth submanifold of
  dimension $d_2$. Then, if $\sigma_1 \ge \sigma_2$, there exists a
  continuous trace operator from $W^{k_1,
    p_1}(\Omega_1)\hookrightarrow W^{k_2, p_2}(\Omega_2)$, such that
  \begin{gather*}
    \norm{u}_{W^{k_2, p_2}(\Omega_2)} \le C \norm{u}_{W^{k_1, p_1}(\Omega_1)}.
  \end{gather*}
\end{theorem}

\begin{todo}
  Poincaré and Friedrichs inequalities for first and higher order
  derivatives.
\end{todo}
% \begin{definition}
%   A function is called \define{Hölder continuous} with exponent $\alpha$, if there is a
%   constant $C$, such that
%   \begin{gather*}
%     \forall x,y\in \Omega: \quad |f(x)-f(y)| \le C
%   \end{gather*}
% \end{definition}

% \begin{theorem}
%   Let $\Omega_1 \subset \R^{d_1}$ be a bounded Lipschitz domain.
% \end{theorem}

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


\label{matrix:chapter}

In Chapter~\ref{bdoodle:chapter}, we assumed that an event organizer is only allowed to inspect a group of columns (as a batch of date/time options) by polling all invitees at once.
In this chapter, we generalize the notion of ``inspection'' by the event organizer, and assume that the organizer can inspect each entry of a random matrix at unit cost (by querying a certain invitee about a certain date/time option at a unit cost).
Consequently, \Times and \Inconveniences are always equal in this setting, and the goal is to find an optimal inspection sequence which is a permutation of entries of a given random matrix.

In classic Doodle, an inspection is performed over the entire random matrix by querying all invitees (rows) about all date/time options (columns).
In the Batched Doodle Problem, we considered a class of B-Doodle mechanisms in which all invitees are queried about a subset of date/time options.
In this chapter, we study the Probabilistic Matrix Inspection Problem in which an individual invitee is queried over a single date/time option. In practice, an organizer may want to ask the most important (and/or busiest) invitee first about a couple of date/time options, to ensure that the person is available, before asking other invitees. For instance, when a doctoral graduate student is scheduling his/her university oral examination at Stanford University (which is usually the defense of dissertation in computer science), it is required that
``[t]he primary advisor, the student, and the out-of-department chairperson must be present and may not participate virtually.''~\footnote{
Excerpted on September 06, 2016, from the Graduate Academic Policies and Procedures. See the Policy section under Chapter 4.7.1 Doctoral Degrees, University Oral Examinations \& Committees.}
In such cases, the student can ask the advisor and exam chair to rule out certain date/time options that do not work for them, and then ask other examiners about their availability.

We model this setting as the problem of inspecting a random matrix where each entry is a random variable (representing availability in group scheduling settings).
Consider a matrix of mutually independent Bernoulli random variables where rows represent agents and columns represents the set of potential outcomes (such as date/time options).
Given probability distribution of the matrix, the organizer can ``inspect'' an entry of the matrix at unit cost to know of the realization of it, and wishes to determine with certainty whether the matrix contains a column consisting only of 1's at minimum number of inspections possible. In our example, this corresponds to querying an agent for her availability, and seeking an agreeable outcome.
By abstracting away the details of group scheduling, we are left with a mathematical model that represents the scheduling process, and in this work we study the properties of an optimal inspection policy and design an algorithm that finds it in polynomial time. As we later discuss, this model is applicable to other real-life settings as well.

\paragraph{Related Work.}
We refer to our discussion of related work in Chapter~\ref{bdoodle:chapter}.

\section{Formal Model} \label{matrix:sec:model}

Let us introduce mathematical notation we use in this chapter, and formally define the Probabilistic Matrix Inspection Problem (\PMIP), followed by an example to help the reader understand the setup.

\subsection{Notation and Definitions}

In the Probabilistic Matrix Inspection Problem, the goal is to determine whether a given random matrix contains a ``feasible'' column or not.

 \begin{definition}[Feasibility]
 Let $A$ be a matrix whose entries are from $\{0,1\}$, and refer to the entry of $A$ at row $r$ and column $c$ as $a_{r,c}$.
 We say that a column $c$ of $A$ is {\em feasible} if it consists only of 1's (otherwise it is {\em infeasible}).
 We say that $A$ is {\em feasible} if it contains at least one feasible column (otherwise it is {\em infeasible}).
 \end{definition}

We do not know of the values (or realizations) of the entries of $A$, as they are Bernoulli random variables, but we assume that we know of probability distribution of each entry. An input to the problem is this probability distribution as a matrix.
 \begin{definition}[Input instance]
 An input instance of the Probabilistic Matrix Inspection problem is a pair of matrices $(A, P_A)$ of size $n$ by $m$
 where $A$ is a matrix of Bernoulli random variables
 and $P_A$ is the probability matrix associated with it.
 We denote an entry of $A$ as $a_{r,c}$ and of $P_A$ as $p_{r,c}$.
 Each entry $a_{r,c}$ of $A$ is a Bernoulli random variable, and $p_{r,c}$ is the probability of success for $a_{r,c}$ (i.e., $p_{r,c} = \mathbf{P}[a_{r,c} = 1]$).
 We define $s_c = \prod_{r=1}^{n} p_{r,c}$ to denote the probability that column $c$ is feasible (probability of success for column $c$).
 \end{definition}
 Throughout this work we will assume that the set of random variables $\{a_{r,c}\}$ are mutually independent. This assumption is crucial to our technical results because it allows to compute (in polynomial time) the probability of a specific realization of $A$ conditioning on the event in which some entries of $A$ have already been realized.
 Without this assumption, it is unclear how one can compute such probabilities without having an access to the joint probability distribution over all realizations of $A$ (whose size is exponential in the size of $A$).

 We define an ``inspection'' as an operation that can be performed on $A$.
 One can inspect an arbitrary entry $a_{r,c}$ of $A$ at unit cost, so as to know of the realization of the random variable. In group scheduling, an inspection corresponds to querying an agent about her availability for a certain outcome.
 The objective of the problem is to determine whether $A$ is feasible or not, with minimum (expected) number of inspections possible. The expectation is with respect to the probability distribution specified by $P_A$.

 Because we are interested in determining feasibility of $A$ with minimum number of inspections, there are certain ``unnecessary inspections'' that an optimal strategy must avoid.
 For instance, if a certain entry $a_{r,c}$ is found to be unsuccessful (i.e., $a_{r,c} = 0$ is realized), then there is no need to inspect any other entry from the same column because the column is already known to be infeasible. Similarly, if a certain column is found to be feasible (which implies $A$ is feasible) or if all columns are found to be infeasible (which implies $A$ is infeasible), then there is no need to inspect any other entries of the matrix. Lastly, if $p_{r,c} = 0$ or $p_{r,c} = 1$, then there is no need to inspect the entry $a_{r,c}$ because we already know its realization with probability $1$.
 Therefore, without loss of generality, we will assume that $p_{r,c} \in (0,1)$.

 Let us define what constitutes a solution to the problem.  Informally, a clear description of how one should inspect a given matrix suffices -- any permutation of entries of the matrix.
 \begin{definition}[Inspection policy]
 	Given an input instance $(A,P_{A})$, a solution is any permutation of the entries of $A$, and we call it an ``inspection policy'' (or simply, a ``policy'').
 \end{definition}
 The interpretation of a permutation is as follows. The entries of $A$ will be inspected in order specified by the permutation. After each inspection, if $A$ is found to be feasible or infeasible, the inspection process ends. Otherwise, it continues inspecting the entries as specified, but it will not make any unnecessary inspections as mentioned earlier.

 If $\pi$ is a permutation of the entries of $A$, we write $C(\pi)$ to denote the number of inspections performed by $\pi$. $C(\pi)$ is a random variable whose probability distribution is determined by $P_A$. We are interested in finding an optimal policy which minimizes the expected number of inspections, $\Exp[C(\pi)]$.
 Note that there are $(nm)!$ permutations of the entries of $A$, and therefore exhaustive search for an optimal permutation will not produce an efficient algorithm.

 \subsection{Example} \label{matrix:sec:example}
Consider the 2-by-2 random matrix whose probability of success is given by $P_A$ as follows. In group scheduling, this corresponds to two agents and a set of two date/time options being considered. Along with $A$ and $P_A$, let us consider an inspection policy $\pi$ which inspects the entries of $A$ column-by-column while inspecting them from top to bottom within a column:
 \begin{equation*}
 A =
 	\begin{bmatrix}
 		a_{1,1}  & a_{1, 2} \\
 		a_{2,1}  & a_{2, 2}
 	\end{bmatrix}, ~~~
 P_A =
 	\begin{bmatrix}
 		0.6  & 0.7  \\
 		0.9  & 0.8
 	\end{bmatrix}, ~~~
 	\pi =
 	\begin{pmatrix}
 	1 & 2 & 3 & 4  \\
 	a_{1,1} & a_{2,1} & a_{1,2} & a_{2,2}
 	\end{pmatrix}.
 \end{equation*}

 Let us try to compute the expected number of inspections that would incur if we choose to use $\pi$ to inspect $A$.
 Suppose that the realization of $A$ happens to be the identity matrix of size $2$ (i.e., $a_{1,1} = a_{2,2} = 1$ and $a_{2,1} = a_{1,2} = 0$). If we use $\pi$ to inspect the matrix, it will first inspect $a_{1,1}$ and learn its realization. Because $a_{1,1} = 1$, it will inspect $a_{2,1}$ next only to find that column $1$ is infeasible after all. It will then inspect $a_{1,2}$ and learn that column $2$ is also infeasible, which implies that $A$ is infeasible. At this point, the inspection process terminates without inspecting $a_{2,2}$ as it is not necessary.
 This specific realization of $A$ happens with probability $p_{1,1}(1 - p_{2,1})(1-p_{1,2})p_{2,2}$, and yields $C(\pi) = 3$ because 3 inspections would occur.
 If the realization of $A$ happens to be the null matrix (i.e., all entries are $0$'s), then $\pi$ would only inspect $a_{1,1}$ and $a_{1,2}$ but skip $a_{2,1}$ and $a_{2,2}$.  In this manner one can consider all $2^{2\cdot 2} = 16$ possible realizations of $A$, and compute $\Exp[C(\pi)]$ in this example.

Another way to compute $\Exp[C(\pi)]$ is by de-coupling $C(\pi)$ into two random variables $N(\pi, c)$ with $c\in\{1,2\}$ where $N(\pi,c)$ denotes the number of inspections (on column $c$) performed by $\pi$ conditioning on the event that (at least one element of) column $c$ is inspected.
 We can efficiently compute these quantities: $\Exp[N(\pi, c)] = 1 \cdot \mathbf{P}[a_{1,c} = 0] + 2 \cdot \mathbf{P}[a_{1,c} = 1]$ for $c\in \{1, 2\}$.
 To express $\Exp[C(\pi)]$ in $N(\pi,c)$'s, we need to take conditional probability into account, as column 2 is inspected only if column 1 is infeasible:
 $\Exp[C(\pi)] = \Exp[N(\pi,1)] + \Exp[N(\pi,2)] (1-s_1) = 2.382$. Recall that $s_c$ is the probability of success for column $c$ (i.e., probability that column $c$ is feasible).

There is a trivial, brute-force algorithm that can find an optimal inspection policy: Consider every inspection policy (there are $(nm)!$ of them) and for each inspection policy compute its expected number of inspections (by considering all $2^{nm}$ realization of $A$). This algorithm's runtime is exponential in the size of an input matrix, and we shall design an efficient algorithm in this chapter.

\section{Technical Results and Algorithm} \label{matrix:sec:results}

We first consider two special cases of the Probabilistic Matrix Inspection problem when $n=1$ or $m=1$, both of which admit intuitive, greedy algorithms. We then discuss interesting properties of an optimal inspection policy, which leads to our main result and algorithm.

 \subsection{1-Row Matrix and 1-Column Matrix}
 Let us first consider the case where an input matrix $A$ has only one row (i.e., $n = 1$).
 In this case it is natural to inspect entries with largest probability first because we can stop as soon as we find an entry whose value is $1$ -- which makes its column and $A$ feasible. This intuition is exactly what an optimal policy should do in the single row case.

 \begin{lemma}[1-Row Matrix]\label{matrix:lemma:single_row_opt}
 When $n = 1$, an inspection policy $\pi$ is optimal if and only if it inspects the entries in non-increasing order of their associated probabilities.
 \end{lemma}
 \begin{proof}
 	Without loss of generality let us assume that a policy $\pi$ inspects the entries in increasing order of their column index; that is, $\pi(i) = a_{1,i}$.
 	Recall that $C(\pi)$ is a random variable that denotes the number of inspections $\pi$ incurs.
 	We can express the expectation of $C(\pi)$ in terms of $p_{1,c}$'s as follows:
 	\small
 	\begin{equation} \label{matrix:eqn:exp_cost_pi_1row}
 		\Exp\left[C(\pi)\right] =
 		m \left(\prod_{k=1}^{m-1}(1 - p_{1,k})\right) +
 		\sum_{j=1}^{m-1} j \left(p_j \prod_{k=1}^{j-1} (1-p_{1,k}) \right).
 	\end{equation}
 	\normalsize

 	Suppose that there exists some $c^*$ such that $p_{1,c^*} < p_{1,c^*+1}$ (if no such $c^*$ exists, then $\pi$ is an inspection policy that inspects the entries in non-increasing order of probabilities).
 	Let $\pi'$ be the same policy as $\pi$ except we swap the order of $a_{1,c^*}$ and $a_{1,c^*+1}$.
 	That is, $\pi'$ is defined as follows.
 	\begin{equation*}
 		\pi'(j) =
 		\begin{cases}
 			\pi'(j) = \pi(c^*+1)&  \mbox{if~} j = c^* \\
 			\pi'(j) = \pi(c^*)  &  \mbox{if~} j = c^*+1 \\
 			\pi'(j) = \pi(j)  &  \mbox{if~} j \neq c^* \land j \neq c^*+1
 		\end{cases}
 	\end{equation*}
 	After expressing $\Exp[C(\pi)]$ and $\Exp[C(\pi')]$ as in Equation~\ref{matrix:eqn:exp_cost_pi_1row}, one can re-arrange the terms to obtain the following:
 	\begin{equation} \label{matrix:eqn:proof_pi_1row}
 	\Exp\left[C(\pi)\right] - \Exp\left[C(\pi')\right] =
 	\left(\prod_{j=1}^{c^*-1} (1-p_{1,j})\right) (p_{1,c^*+1} - p_{1,c^*}).
 	\end{equation}
 	This quantity is positive if $p_{1,c^*+1} > p_{1,c^*}$ (recall that $p_{1,j} \in (0,1)$ for all $j$ as mentioned in Section~\ref{matrix:sec:model}).

 	This proves the lemma because any policy that inspects an entry with smaller probability before another entry with higher probability is suboptimal, and therefore an optimal policy must inspect entries in non-increasing order of their associated probabilities.
 \end{proof}
 Although the proof of Lemma~\ref{matrix:lemma:single_row_opt} is simple, it confirms correctness of our intuition. Equation~\ref{matrix:eqn:proof_pi_1row} illustrates this intuition; conditioning on the event that the first $c^*-1$ inspections fail (whose probability is the product term in Equation~\ref{matrix:eqn:proof_pi_1row}), the difference $\Exp[C(\pi)] - \Exp[C(\pi')]$ depends on the difference in the probabilities of success between the next-entry-to-be-inspected by $\pi$ and $\pi'$.

 We can also consider the case where an input matrix $A$ has only one column.
 Intuitively, if we wish to minimize the expected number of inspections, we must inspect entries with smallest probability first because we can stop as soon as we determine that $A$ is infeasible.
 Lemma~\ref{matrix:lemma:single_column_opt} formally states this intuition about optimal policy, and we omit a proof of it as it can be easily done by following the proof of Lemma~\ref{matrix:lemma:single_row_opt}.
 \begin{lemma}[1-Column Matrix] \label{matrix:lemma:single_column_opt}
 When $m = 1$, an inspection policy $\pi$ is optimal if and only if it inspects the entries in non-decreasing order of their associated probabilities.
 \end{lemma}

 \subsection{Inspection of Entire Column}
 Another interesting property of an optimal inspection policy is that once it inspects the first entry of a column, then it must commit to it and continue inspecting the remaining entries of the column until feasibility of the column is determined. Otherwise, if the policy switches to another column too soon, then it is not optimal.
 \begin{theorem}[Optimality of inspecting entire column] \label{matrix:theorem:col_by_col_opt}
 Consider any inspection policy $\pi$.
 Without loss of generality, let us assume that for each column $c$, $\pi$ inspects $a_{n,c}$ the last among $n$ entries of the column.
 Let $b_c$ be the index of $\pi$ such that $\pi(b_c) = a_{n,c}$.
 Without loss of generality, assume $b_1 < b_2 < \cdots < b_m$ (we can do this by re-labeling the columns of $A$).
 If there is some column $c^*$ such that $b_{c^*} > n\cdot c^*$, then $\pi$ is not optimal.
 \end{theorem}
 \begin{proof}
 First, note that $b_c \geq n\cdot c$ for all $c$ because we assumed $b_1 < b_2 < \cdots < b_m$, and therefore the entries of previous columns must appear before the last entry of each column.

 Let $\pi$ be an inspection policy being considered in the theorem for which there exists some $c$ with $b_{c} > n \cdot c$.
 Let us construct a different inspection policy $\pi'$.
 First, $\pi'$ inspects all entries of column $1$ in the same order $\pi$ does.
 Then, $\pi'$ inspects all entries of column $2$ in the same order $\pi$ does, and so on.
 In particular, $\pi'$ inspects all entries of a column before inspecting another column, while preserving the original ordering of the entries within each column that is given by $\pi$.
 We will show that $\Exp[C(\pi')] < \Exp[C(\pi)]$.

 Let us define a set of new random variables which can be used to express $C(\cdot)$, as we did in Section~\ref{matrix:sec:example} when analyzing an example.
 Recall that $s_c = \prod_{r=1}^{n} a_{r,c}$ is the probability of success for column $c$.
 Let $N(\pi, c)$ ($N(\pi', c)$, respectively) be a random variable that denotes the number of entries of column $c$ that is inspected by $\pi$ (by $\pi'$, respectively), conditioning on the event that column $c$ is inspected (i.e., when the previous $c-1$ columns are infeasible).
 We can then express $\Exp[C(\pi)]$ and $\Exp[C(\pi')]$ as follows:
 \begin{equation} \label{matrix:eqn:exp_c_pi_decoupled}
 	\Exp[C(\pi)] = \sum_{c=1}^{m} \Exp[N(\pi, c)]\left( \prod_{k=1}^{c-1} (1 - s_c) \right)
 \end{equation}
 and
 \begin{equation} \label{matrix:eqn:exp_c_pi2_decoupled}
 	\Exp[C(\pi')] = \sum_{c=1}^{m} \Exp[N(\pi', c)]\left( \prod_{k=1}^{c-1} (1 - s_c) \right).
 \end{equation}

 To prove the theorem we will first show that for any realization of $A$, $N(\pi, c) \geq N(\pi', c)$ holds for all $c$; this immediately implies $\Exp[C(\pi)] \geq \Exp[C(\pi')]$.
 We will then show that there exists at least one realization of $A$ such that for some column $c'$ the strict inequality $N(\pi, c') > N(\pi', c')$ holds. These two statements together imply that $\Exp[C(\pi)] > \Exp[C(\pi')]$.

 Consider any realization of $A$ with the condition that the first $m-1$ columns are infeasible (recall that $m$ is the number of columns of $A$).
 Then $N(\pi, c) = N(\pi', c)$ for all $c$ regardless of feasibility of column $m$.
 To see why, both $\pi$ and $\pi'$ would inspect the same set of entries in each of the first $m-1$ columns in the same order until the column is determined to be infeasible, and therefore $N(\pi, c) = N(\pi', c)$ if $c<m$.
 If column $m$ is feasible, then both $\pi$ and $\pi'$ would inspect all $n$ entries of it, and thus we have $N(\pi, m) = N(\pi', m) = n$. Otherwise, if column $m$ is also infeasible (in which case $A$ is infeasible), then $\pi$ and $\pi'$ would inspect the same set of entries of column $m$ in the same order until the first infeasible entry of the column is found. Therefore if the first $m-1$ columns are infeasible we have $N(\pi, c) \geq N(\pi', c)$ for all $c$.

 Now consider any realization of $A$ with the condition that at least one of the first $m-1$ columns is feasible. Let $c'$ be the smallest index of feasible columns of $A$.
 Because the columns from $1$ to $c'-1$ are infeasible, $N(\pi, c) = N(\pi', c)$ for all $c < c'$ for the same reason we stated earlier for the other case.
 Since $c'$ is feasible, $N(\pi, c') = N(\pi', c') = n$ as both policies would inspect all $n$ entries of $c'$. By our construction of $\pi'$ it is clear that $N(\pi', c) = 0$ for all $c > c'$; therefore we have $N(\pi, c) \geq N(\pi', c)$ for all $c>c'$. In summary $N(\pi, c) \geq N(\pi', c)$ holds for all $c$ in this case as well.

 So far we proved the first claim we stated earlier: for all realizations of $A$, we have $N(\pi, c) \geq N(\pi', c)$ for all $c$.
 Let us now prove the second claim.

 Let $c^*$ be the smallest index $c$ of columns such that $b_c > nc$ (note that $c^* < m$ because $b_m = nm$ by definition).
 Consider any realization of $A$ with the condition that the first $c^*-1$ columns are infeasible and column $c^*$ is feasible (feasibility of other columns do not matter).
 Using the same arguments we used earlier, we can show that $N(\pi, c) = N(\pi', c)$ for all $c < c^*$, that $N(\pi, c^*) = N(\pi', c^*) = n$, and that $N(\pi', c) = 0$ for all $c> c^*$.
 However, because $b_{c^*} > n \cdot c^*$, there is at least one entry $a_{r',c'}$ with $c' > c^*$ which  appears before $b_{n, c^*}$ in $\pi$ (otherwise, if no such entry exists, then $b_{c^*}$ would be equal to $n \cdot c^*$). This implies that there exists some $c'$ with $c' > c^*$ such that $N(\pi, c') > 0$.

 This proves the second claim that for some realization of $A$, there is some column $c'$ for which $N(\pi, c') >  N(\pi', c')$, and together with the first claim we proved earlier, this implies that $\Exp[C(\pi)] > \Exp[C(\pi')]$.
 Together with the first claim, this completes the proof: Any policy that does not inspect all entries of a column consecutively is suboptimal.
 \end{proof}
 By Theorem~\ref{matrix:theorem:col_by_col_opt}, when seeking an optimal policy, it is sufficient to consider the set of policies that inspect an entire column before committing to another column. Lemma~\ref{matrix:lemma:single_column_opt} hints that one should inspect the entries of each column in increasing order of probabilities, which we prove next.

 \subsection{Optimal Ordering within Column}

 Lemma~\ref{matrix:lemma:single_column_opt} states that
 an optimal policy must inspect the entries in increasing order of their probability of success, if $A$ is a 1-column matrix.
 This argument can be generalized to the case where there is more than one column: If an optimal policy is to inspect an entry of some column $c$, it must inspect the entry with smallest probability of success first.
 \begin{theorem}[Optimal ordering within column] \label{matrix:theorem:within_column_opt}
 	Consider any inspection policy $\pi$.
 	If there exist two entries $a_{r_1,c}$ and $a_{r_2,c}$ from the same column such that $a_{r_1,c}$ appears before $a_{r_2,c}$ in $\pi$ and $p_{r_1,c} > p_{r_2,c}$, then $\pi$ is not optimal.
 	In other words, when restricted to each column, an optimal policy must inspect the entries of the column in non-decreasing order of probabilities.
 \end{theorem}
 \begin{proof}
 	Let $\pi$ be an inspection policy being considered in the theorem.
 	Because of Theorem~\ref{matrix:theorem:col_by_col_opt} we can assume, without loss of generality, that $\pi$ inspects all entries of column 1, followed by column 2, and so on.
 	Further let us assume that $\pi$ inspects the entries of each column in increasing order of their row index (we can do so by re-labeling the indices of entries). Precisely, $\pi(r + n (c-1)) = a_{r,c}$ defines $\pi$. Let $p_{r,c^*}$ and $p_{r+1,c^*}$ be the entries with $p_{r,c^*} > p_{r+1, c^*}$.
 	Let us consider a different inspection policy $\pi'$ that is the same as $\pi$ except that $\pi'$ inspects $p_{r+1,c^*}$ before $p_{r,c^*}$, by swapping the ordering of them.
 	\begin{equation*}
 		\pi'(j) =
 		\begin{cases}
 			\pi'(j) = a_{r+1,c^*}  &  \mbox{if~} \pi(j) = a_{r,c^*} \\
 			\pi'(j) = a_{r,c^*}    &  \mbox{if~} \pi(j) = a_{r+1,c^*} \\
 			\pi'(j) = \pi(j)     &  \mbox{otherwise}
 		\end{cases}
 	\end{equation*}

 	We claim that $\Exp[C(\pi')] < \Exp[C(\pi)]$, which implies that $\pi$ is not optimal.

 	Let us define new random variables $N(\pi, c)$ and $N(\pi', c)$ as we did in our proof of Theorem~\ref{matrix:theorem:col_by_col_opt} (i.e., the number of inspections performed by the respective policy on column $c$, conditioning on the event that the column is inspected).
 	Then we can express $\Exp[C(\pi)]$ and $\Exp[C(\pi')]$ in terms of the new random variables and $s_c$'s as we did in Equations~\ref{matrix:eqn:exp_c_pi_decoupled} and \ref{matrix:eqn:exp_c_pi2_decoupled}.

 	Observe that $N(\pi, c) = N(\pi', c)$ for any realization of $A$ if $c \neq c^*$.
 	To see this, first note that column $c$ would not be inspected by $\pi$ or by $\pi'$ if any of the previous columns (that is, columns $1$ through $c-1$) is found to be feasible, in which case $N(\pi, c) = N(\pi', c) = 0$. Otherwise, if column $c$ is inspected, both policies would inspect the entries of $c$ in the very same order, so $N(\pi, c) = N(\pi', c)$ must hold. Therefore we conclude that $\Exp[N(\pi, c)] = \Exp[N(\pi', c)]$ when $c \neq c^*$.

 	We will now show that $\Exp[N(\pi, c^*)] > \Exp[N(\pi', c^*)]$ holds.
 	This immediately implies $\Exp[C(\pi)] > \Exp[C(\pi')]$ due to Equations~\ref{matrix:eqn:exp_c_pi_decoupled} and \ref{matrix:eqn:exp_c_pi2_decoupled}.
 	Let us express $\Exp[N(\pi, c^*)]$ in terms of $p_{r,c^*}$'s.
 	\begin{equation*}
 		\Exp[N(\pi, c^*)] = n\left( \prod_{k=1}^{n-1} p_{k,c^*}\right) +
 		\sum_{j=1}^{n-1} j (1-p_{j,c^*}) \left( \prod_{k=1}^{j-1} p_{k,c^*} \right)
 	\end{equation*}
 	Note that the event $N(\pi, c^*) = j$ occurs if the first $j-1$ entries are feasible while the $j$-th entry is not feasible when $j < n$, and $N(\pi, c^*) = n$ occurs if the first $n-1$ entries are feasible (but the $n$-th entry's feasibility does not matter).

 	We can express $\Exp[N(\pi', c^*)]$ in a similar manner, and simplify  $\Exp[N(\pi, c^*)] - \Exp[N(\pi', c^*)]$ as follows:
 	\small
 	\begin{equation*}
 		\Exp[N(\pi, c^*)] - \Exp[N(\pi', c^*)] =
 		r \left( \prod_{k=1}^{r-1} p_{k,c^*} \right) (p_{r,c^*} - p_{r+1,c^*}).
 	\end{equation*}
 	\normalsize
 	The quantity above is positive if $p_{r,c^*} > p_{r+1,c^*}$, which is the assumption we began with.
 	This proves the theorem.
 \end{proof}

 Theorems~\ref{matrix:theorem:col_by_col_opt} and \ref{matrix:theorem:within_column_opt} together tell us that
 in order to find an optimal policy we only need to decide the ordering of the columns.
 There are still $m!$ orderings of columns, and an exhaustive search algorithm would not be efficient.
 As we were able to generalize Lemma~\ref{matrix:lemma:single_column_opt} to Theorem~\ref{matrix:theorem:within_column_opt} by generalizing the optimal solution for 1-column case, it would be natural to consider generalizing Lemma~\ref{matrix:lemma:single_row_opt} in a similar manner.

 This idea leads to the following greedy algorithm: First we sort columns by their probability of success ($s_c = \prod_{r=1}^{n} p_{r,c}$) in decreasing order, and inspect the entries of each column in increasing order of their associated probabilities. However, as the following example shows, this algorithm is suboptimal.
 \begin{equation*}
 A =
 	\begin{bmatrix}
 		a_{1,1}  & a_{1, 2} \\
 		a_{2,1}  & a_{2, 2}
 	\end{bmatrix},
 	P_A =
 	\begin{bmatrix}
 		0.4459  & 0.2262 \\
 		0.4459  & 0.8114
 	\end{bmatrix}
 \end{equation*}
 Here we have $s_1 ~= 0.199$ and $s_2 ~= 0.184$, and the greedy algorithm would produce
 $$\pi = \begin{pmatrix} a_{1,1} & a_{2,1} & a_{1,2} & a_{2,2} \end{pmatrix}.$$

Its expected cost, $\Exp[C(\pi)]$, is $2.428$, but if we inspect the second column first, then the expected cost is $2.407$ which is optimal in this example.
 One can consider another greedy algorithm which inspects the columns in increasing order of their expected number of inspections (within column), but this algorithm turns out to be suboptimal as well.

 \subsection{Main Result and Algorithm}
 Let us present the main result that leads to an efficient algorithm for finding an optimal inspection policy.

 \begin{theorem} \label{matrix:thm:main_result}
 	Let $s_c$ be the probability of success for column $c$ as before.
 	Let $\mu_c$ be the expected number of inspections that column $c$ incurs if its entries are inspected in increasing order of their probability of success, conditioning on the event that column $c$ is inspected and infeasible.
 	An optimal policy must be a column-by-column policy (due to Theorem~\ref{matrix:theorem:col_by_col_opt}), must inspect the entries of each column in non-decreasing order of probabilities (due to Theorem~\ref{matrix:theorem:within_column_opt}), and must inspect the columns in non-decreasing order of $\mu_c(1 - s_c)/s_c$.
 \end{theorem}
 \begin{proof}
 	Consider a column-by-column inspection policy $\pi$ which inspects the column 1 through $m$ in increasing order of their index (we can assume this without loss of generality by re-labeling columns).

 	As before, let $N(\pi,c)$ be a random variable that denotes the number of inspections performed by $\pi$ on column $c$, conditioning on the event that column $c$ is inspected.
 	Then we can express $\Exp[N(\pi, c)]$ in terms of $s_c$ and $\mu_c$ as follows.
 	\begin{equation}\label{matrix:eqn:exp_cost_column_by_condition}
 		\Exp[N(\pi, c)] = s_c \cdot n  + (1-s_c) \cdot \mu_c
 	\end{equation}
 	This equation holds because if the column is feasible (with probability $s_c$), it would require $n$ inspections, but if it is not (with probability $1-s_c$), it would require $\mu_c$ inspections in expectation. The equation above simply considers these two events, and calculates the expected value of $N(\pi, c)$.

 	Suppose that there is some column $c^*$ such that $\mu_{c^*}(1 - s_{c^*}) / s_{c^*} > \mu_{c^*+1} (1 - s_{c^*+1}) / s_{c^*+1}$. Because $\pi$ inspects column $c^*$ before column $c^*+1$, it would not be inspecting the columns in increasing order of $\mu_c(1-s_c)/s_c$.
 	Consider a different inspection policy $\pi'$ which inspects the columns in the same order as $\pi$ except that $\pi'$ inspects column $c^*+1$ before $c^*$ by swapping the inspection ordering of the two.
 	We can relate $N(\pi, \cdot)$ to $N(\pi', \cdot)$ as follows.
 	\begin{equation*}
 		N(\pi', c) =
 		\begin{cases}
 			N(\pi, c^*+1) & \mbox{if~} c = c^* \\
 			N(\pi, c^*)   & \mbox{if~} c = c^* + 1 \\
 			N(\pi, c)     & \mbox{otherwise}
 		\end{cases}
 	\end{equation*}

 	As we did in proofs of Theorems~\ref{matrix:theorem:col_by_col_opt} and \ref{matrix:theorem:within_column_opt}, we can use Equations~\ref{matrix:eqn:exp_c_pi_decoupled} and \ref{matrix:eqn:exp_c_pi2_decoupled}, and simplify $\Exp[C(\pi)] - \Exp[C(\pi')]$ as follows.
	\small
 	\begin{equation} \label{matrix:eqn:main_result_diff}
 		\Exp[C(\pi)] - \Exp[C(\pi')] =  \left(\frac{\Exp[N(\pi, c^*)]}{s_{c^*}}  - \frac{\Exp[N(\pi, c^*+1)]}{s_{c^*+1}} \right)  \cdot \left( \prod_{j=1}^{c^*-1} (1 - s_j)\right) s_{c^*} s_{c^*+1}
 	\end{equation}
	\normalsize
 	The quantity in Equation~\ref{matrix:eqn:main_result_diff} is positive if the difference of the weighted expected values (in the first parentheses) are positive. Using Equation~\ref{matrix:eqn:exp_cost_column_by_condition} we obtain the following inequality.
 	\begin{equation*}
 		\frac{\Exp[N(\pi, c^*)]}{s_{c^*}}  > \frac{\Exp[N(\pi, c^*+1)]}{s_{c^*+1}}
 		\Leftrightarrow
 		\frac{\mu_{c^*} (1 - s_{c^*})}{s_{c^*}} > \frac{\mu_{c^*+1}(1 - s_{c^*+1}}{s_{c^*+1}}
 	\end{equation*}
 	By definition of $c^*$, the second inequality above holds, which implies the first. Hence, an optimal inspection policy must inspect the columns in non-decreasing order of $\mu_c(1 - s_c)/s_c$.
 \end{proof}
 Because there is a unique ordering of columns if we sort them by $\mu_c(1-s_c)/s_c$ (up to ties), Theorem~\ref{matrix:thm:main_result} leads to the following algorithm: We inspect the columns in increasing order of $\mu_c(1-s_c)/s_c$, and in each column, we inspect the entries of it in increasing order of probabilities.
 This algorithm can easily be implemented to run in polynomial time.

\section{Discussion} \label{matrix:sec:discussion}
In this work we defined the Probabilistic Matrix Inspection problem which generalizes the Batched Doodle Problem.
We first considered two special cases, and discovered interesting properties of an optimal inspection policy which agree with our intuition. We then generalized our findings to design an efficient algorithm to solve the general case, and along the way we showed that two natural greedy algorithms fail to find an optimal solution. While we believe that our technical results make a great starting point for studying and optimizing a group scheduling process, there remain several open problems and future work to be done.

As we discussed in the previous chapter, our model and algorithm rely on the assumption that probability estimates on availability of agents are available. We suggested several ideas motivated by previous work in the literature, but it will be important to deploy such ideas into a system, and integrate it with our algorithm. From a theoretical perspective, there remain several open problems. While we assumed that an inspection can be performed on a single entry at unit cost, one can generalize the cost model by allowing an inspection of any subset of entries whose cost depends on, for example, the number of entries being inspected. In the context of group scheduling, an inspection on many entries means querying multiple agents at the same time for one or many outcomes (but an inspection is not limited to the entries from the same column or row). This generalization is particularly useful when scheduling takes place in a hierarchical setting such as corporates or universities as in the example of  university oral exams at Stanford University.

Lastly, the Probabilistic Matrix Inspection problem has many other applications than group scheduling.
For instance, suppose that some research lab is hiring a new researcher among many candidates.
After reading each candidate's curricular vitae and research statement,
each member of the lab can estimate the likelihood of him/her approving the candidate, yet it is necessary to interview a candidate to make a decision.
In this setting, the problem of finding a candidate who is approved by every member of the lab is equivalent to the problem of finding a feasible date/time option. Clearly, assuming that the lab is happy to hire any of the candidates whom all of the lab members approve, it is rational to minimize the expected number of in-person interviews until someone is hired or every candidate is rejected.
Another example is a search quest for housing or childcare facility.
Each house or facility is a candidate, and there is a set of requirements for the candidate being considered. Making inquiries about and taking a tour of the property or facility involves much effort -- even though much information is available through brochures or booklets, people in this situation would wish to minimize the time and effort they need to spend until they declare a winner.

\section*{Publications}
Some of the contents of this chapter were published and included in the proceedings of the Twenty-fifth International Joint Conference on Artificial Intelligence (IJCAI)~\cite{lee2016pmip}.