Contracts with Inspections

Tomer EzraHarvard University,
Email:   Stefano LeonardiSapienza University of Rome, Email:   Matteo RussoSapienza University of Rome, Email:

In the classical principal-agent hidden-action model, a principal delegates the execution of a costly task to an agent for which he can choose among actions with different costs and different success probabilities to accomplish the task. To incentivize the agent to exert effort, the principal can commit to a contract, which is the amount of payment based on the task's success.
A crucial assumption of this model is that the principal can only base the payment on the outcome but not on the agent's chosen action.

In this work, we relax the hidden-action assumption and introduce a new model where the principal is allowed to inspect subsets of actions at some cost that depends on the inspected subset. If the principal discovers that the agent did not select the agreed-upon action through the inspection, the principal can withhold payment.
This relaxation of the model introduces a broader strategy space for the principal, who now faces a tradeoff between positive incentives (increasing payment) and negative incentives (increasing inspection).

We show how to find the best deterministic incentive-compatible inspection scheme for all monotone inspection cost functions. We then turn to randomized inspection schemes and show that one can efficiently find the best randomized incentive-compatible inspection scheme when the inspection cost function is submodular. We complement this result by showing that it is impossible to efficiently find the optimal randomized inspection scheme for the more general case of XOS inspection cost functions.

§ INTRODUCTION

Contract theory is the field of economics that studies the interaction between two interested parties, a principal and an agent, and seeks to answer the foundational question: “How do we incentivize people to work?” The original model that captures the tension between the two rational individuals  involved is called hidden-action principal-agent interaction [Holmstrom and Milgrom, 1987, Holmstrom and Milgrom, 1991, Grossman and Hart, 1983]. The principal aims to incentivize an agent to take some costly action among a set of $n$ potential actions $A$. Each action $a$ that the agent can take incurs a cost $c(a)$ for the agent and results in a distribution over the set of $m$ potential outcomes $O=\{o_1,\ldots,o_m\}$, where each outcome $o_j$ is associated with a reward for the principal $r_j$.
In order to incentivize the agent to exert effort, that will more likely lead to a favorable outcome, the principal can post a payment scheme (or a contract) that maps the set of outcomes to payments for the agent. The goal of the principal is to design a contract that incentivizes the agent to exert effort, which will maximize her own expected utility (reward minus payment). The postulates defining contract design are limited-liability which states that the payments are only one-way from the principal to the agent, and hidden-action, which states that the payments can only depend on the realized outcome and not the action taken by the agent.
When outcomes are binary ($m=2$), it is without loss of generality to assume that $r_1=0,r_2=1$, i.e., success or failure, and each action $a$ is associated with the probability of success $f(a)$.
Then, the goal of the principal is to find a single-parameter $\alpha \in [0,1]$ (the payment in case of success), such that the agent is incentivized to take some action $a^*$ (i.e., $a^* \in \arg\max_{a} \alpha f(a)-c(a)$) with maximum utility for the principal (i.e., maximizing $(1-\alpha)f(a^*)$).

However, in many real-life scenarios,  the principal may be able to examine specific actions performed by the agent.
For example, a store owner can send inspectors to check the performance of his salespeople, and a company can install activity monitoring software on the computers of its employees.
In such scenarios, the principal could base the payment not only on the outcome but also on the result of the inspection.

Contracts with inspection schemes. In this work, we relax the hidden-action postulate by allowing the principal to inspect the actions taken by the agent, incurring an inspection cost.

However, if  the principal is allowed to condition payment on the event of an inspection, she could easily extract the entire welfare by inspecting the welfare-maximizing action $i^*=\arg\max_{i} f(i)-c(i)$ with a very low probability $\varepsilon$, and paying the agent $\frac{c(i^*)}{\varepsilon}$ only if this action is actually inspected. The agent is incentivized to select action $i^*$ since the utility from it is non-negative, and all other actions lead to receiving a payment of $0$.
The principal's utility is then $f(i^*)-c(i^*) -\varepsilon \cdot v(i^*)$, where $v(i^*)$ is the cost of inspecting action $i^*$. When $\varepsilon\rightarrow 0$, then this utility converges to the maximum social welfare of the problem. This solution concept would be not only trivial but also not very useful in practice since it uses that the agent is willing to accept a payment just in an arbitrarily small probability.
Therefore, we focus on natural contracts, where the principal must commit to a payment and inspection distribution in advance and is only permitted to withhold payment if the agent is caught not performing the desired action.

Our setting can be described as follows: We are given a set of actions $A$ the agent can carry out, each associated with a cost $c(a)$, where $c: A \rightarrow \R_{\geq 0}$, a success probability $f(a)$, where $f: A \rightarrow [0,1]$, and an inspection cost function $v:2^A \rightarrow \R_{\geq 0}$.
The principal then proposes an inspection scheme described by a suggested action $i\in A$, a payment $\alpha$, and an inspection distribution $p$ over subsets of actions.
If the agent takes the suggested action $i$, then he is paid $\alpha$ in case of success.
If the agent takes some other action $j\neq i$, then, only in the case that neither action $i$ nor action $j$ are inspected, the agent is paid $\alpha$ in case of success.  We say that an inspection scheme is incentive-compatible (IC) if the suggested action is the best response for the agent.
The principal's goal is to find the IC inspection scheme that maximizes the utility of the principal.

Regarding the example of a manager hiring an inspector to evaluate the salespeople's performance, it may not be feasible or cost-effective to conduct inspections consistently. Consequently, the principal may choose to inspect the salespeople with a certain probability, thereby reducing inspection costs. This strategic approach could potentially result in increased utility, as illustrated in the following example.

Let us consider the following instance with three actions $A = \{\bot, b, g\}$: $c(\bot)=0,~f(\bot)=\frac{1}{10},~ v(\bot)=1,~c(b)=\frac{1}{10},~f(b)=\frac{1}{2}, ~v(b)=1,~c(g)=\frac{7}{20},~f(g)=1,~v(g) = \frac{1}{10}$. We assume $v$ to be additive.

* Under no inspection, we can observe that $\alpha \in [0, \frac{1}{4})$ incentivizes action $\bot$ and offering $\alpha = 0$ yields utility $\frac{1}{10}$; $\alpha \in [\frac{1}{4}, \frac{1}{2})$ incentivizes action $b$ and  offering $\alpha = \frac{1}{4}$ yields utility $\frac{3}{8} > \frac{1}{10}$; $\alpha \in [\frac{1}{2}, 1]$ incentivizes action $g$ and offering $\alpha = \frac{1}{2}$ yields utility $\frac{1}{2} > \frac{3}{8}$. Thus, the highest utility for the principal is $\frac{1}{2}$  and corresponds to action $g$.

* If the principal is only allowed to use a deterministic inspection schemes, i.e., always inspect a specific subset of actions, then inspecting any action different from action $g$ yields strictly negative utility to the principal. The principal can thus ask the agent to do action $g$, inspect it, and offer $\alpha=\frac{7}{20}$, leading to a utility of $\frac{13}{20} - \frac{1}{10} = \frac{11}{20} > \frac{1}{2}$, i.e., it is strictly larger than the highest utility under no inspection.

* Under randomized inspection schemes, the principal can ask the agent to take action $g$, inspect it with probability $\frac{3}{7}$ (and all other actions with probability $0$), offer $\alpha=\frac{7}{20}$ (so as to incentivize action $g$ over the other actions), which leads to a utility of $\frac{13}{20} - \frac{3}{70} = \frac{17}{28} > \frac{11}{20}$, i.e., it is larger than in the previous two scenarios.

In our study, we make the assumption that the inspection cost of actions falls within the complement-free hierarchy introduced by Lehmann et al., 2006, and widely used in the context of combinatorial auctions [Dobzinski et al., 2005, Assadi et al., 2021, Correa and Cristi, 2023], combinatorial and multi-agent contracts [Dütting et al., 2021, Dütting et al., 2023], as well as Prophet Inequalities and pricing [Correa and Cristi, 2023, Feldman et al., 2015] to mention a few. This hierarchy encompasses various real-world scenarios, as can be seen in the example with the company using a monitoring software, where it might be cheaper to buy a monitoring software that checks multiple measures simultaneously rather than purchasing a monitoring software for each measure separately.
The inspection cost, in this case, exhibits subadditivity or potentially even submodularity.

Our guiding question is that of investigating the tractability of the optimal inspection scheme under different classes of cost functions. We aim to characterize when the best deterministic or randomized inspection scheme can be efficiently found.

§.§ Our Contribution and Techniques

We first show how to design a simple algorithm that finds the optimal deterministic IC inspection scheme in time polynomial in the number of actions for every monotone combinatorial cost function (<Ref>).
To find the best deterministic inspection scheme, we make the following observations.
Either it is beneficial to inspect the suggested action $i$ and pay the minimal amount to ensure that the action has non-negative utility $\frac{c(i)}{f(i)}$; otherwise, the payment should be such that the agent's utility from action $i$ is the same as from some other action $j$. This allows us to consider a polynomial number of values of $\alpha$ such that either $\alpha=\frac{c(i)}{f(i)}$ or $\alpha=\frac{c(i)-c(j)}{f(i)-f(j)}$ for some action $j$. For each such $\alpha$, the set of actions that need to be inspected can be calculated easily: They are the actions with strictly larger utility for the agent under contract $\alpha$.

We then shift our focus to randomized inspection schemes. The first of our two main results proves that for the class of submodular inspection cost functions (i.e., decreasing marginals), one can find the optimal randomized inspection scheme  in polynomial time. In particular, we show:

Main Result 1 (<Ref>): One can efficiently find the optimal randomized IC inspection scheme for instances with  submodular inspection cost functions, given value query access to the inspection cost function.

The key ingredients for finding the optimal randomized inspection schemes for submodular inspection cost functions are outlined in the following steps:
We first devise an algorithm that given a sequence of marginal probabilities $p(j)$ for each action $j$,  computes the distribution over subsets of actions that minimizes the expected inspection cost while inspecting each action $j$ with a marginal probability $p(j)$.
In particular, we show that this distribution is supported by a few sets (at most $n+1$), and all sequences of marginals with the same order can be supported by the same sets. This means that, for two sequences of marginals $\{p_1(j)\}_{j\in A}, \{p_2(j)\}_{j\in A}$, with a bijection $\pi :[n] \rightarrow A $, for which $p_1(\pi(1)) \leq \ldots \leq p_1(\pi(n))$ and $p_2(\pi(1)) \leq \ldots \leq p_2(\pi(n))$, then the two distributions returned by the  aforementioned algorithm on $p_1,p_2$ have the same support.
Utilizing this tool,
for each suggested action $i$, we can partition the interval $[0,1]$ of potential values of $\alpha$ (the payment) into at most $n^2$ sub-intervals for which within each sub-interval, the optimal randomized inspection scheme only inspects the same $n+1$ inspected sets.
For each such interval, we show that finding the best inspection scheme that suggests action $i$ and uses $\alpha $ in the interval, is equivalent to a simple program in a constant number of variables and constraints.
Consequently, we can reduce the original problem to solving a small (polynomial) number of optimization problems.

We complement the former result and show an impossibility result for the class of XOS inspection cost functions (the next class in the complement-free hierarchy [Lehmann et al., 2006] see <Ref> for a formal definition).

Main Result 2 (<Ref>): Finding the best randomized IC inspection scheme for instances with XOS inspection cost functions, requires an exponential number of value (or demand) queries.

To demonstrate this hardness result, we carefully construct a family of instances with the same values of $A,f,c$, but with different XOS inspection cost functions parameterized by a set $T$.
For each inspection cost function in the family, we show that the optimal randomized inspection scheme is a solution to a specific form of optimization problem that always admits a unique optimal solution.
Distinguishing from the inspection cost function what $T$ is, requires an exponential number of value and demand queries. Given the knowledge of $T$, one can easily find the unique optimal inspection scheme, and from the unique optimal inspection scheme, one can easily derive the parameter $T$ of the instance.

Moreover, in <Ref>, we extend <Ref> and show that the gap between
the optimal deterministic inspection scheme and optimal randomized inspection scheme, can be as large as $\Omega(n)$.
Since the utility of the principal is bounded by the welfare achievable in the non-strategic version of the problem, the gap is known to also be at most $O(n)$. Lastly, in <Ref> we discuss the gaps in the principal's utility between IC inspection schemes, and non-IC inspection schemes for both the deterministic and randomized cases. In particular, we show that there is no gap in the case of deterministic inspection schemes, but there are cases that admit a gap for randomized inspection schemes.

§.§ Related Work

(Algorithmic) Contract Theory. After the seminal work of Grossman and Hart, 1983, who initiated the field of “Contract Theory”, and that of Holmstrom and Milgrom, 1987, Holmstrom and Milgrom, 1991, recent years have witnessed a surge of interest in algorithmic questions related to this model [Dütting et al., 2019, Dütting et al., 2021, Dütting et al., 2021, Dütting et al., 2023]. Dütting et al., 2019, Dütting et al., 2021  are among the first to model the problem from an algorithmic viewpoint. Their results prove that it is possible to achieve optimality in the worst case through linear contracts, contracts that pay the agent proportionally to the reward associated with an outcome. Numerous other studies have indicated robust optimality of linear contracts in non-Bayesian settings, particularly in the context of max-min criteria [Carroll, 2015, Yu and Kong, 2020, Walton and Carroll, 2022, Dai and Toikka, 2022]. Recently, Kambhampati, 2023 has shown how, in certain scenarios, randomized contracts can enhance principal's reward under max-min criteria.

Combinatorial Models of Contract Theory. Mostly related to our setting are works that study algorithmic contract design in various combinatorial settings. Dütting et al., 2021 consider agents who can select a subset of actions instead of being limited to a single action, and the probability of success is a function of the set of taken actions. They show that if the success probability function is Gross-Substitutes (a set function class defined in [Kelso and Crawford, 1982]), then the optimal contract can be found in polynomial time. This model has been adapted by [Dutting et al., 2024, Deo-Campo Vuong et al., 2024, Ezra et al., 2024], for different classes of combinatorial set functions including submodular, XOS, and supermodular.

Another line of research extended the principal-agent model to accommodate settings with multiple agents [Babaioff et al., 2012, Emek and Feldman, 2012, Dütting et al., 2023, Castiglioni et al., 2023, Deo-Campo Vuong et al., 2024, Ezra et al., 2024]. Pioneering work on combinatorial agency by Babaioff et al., 2012 and Emek and Feldman, 2012 considers a model where $n$ agents exert effort (or not) and succeed in their assigned tasks with some probability. The success or failure of the entire project is then assumed to be a Boolean function of individual successes and failures.
Dütting et al., 2023 draw the connection between multi-agent contract design and the complement-free hierarchy [Lehmann et al., 2006]: Here, each agent possesses a binary action space, and the success probability is a function of the set of agents exerting effort. They show that
the frontier of tractability is the XOS function class, as the function becomes subadditive, the problem is hard to approximate.

Conversely, Alon et al., 2021 investigate the “common agency” problem, which revolves around coordinating several principals to propose a contract to an agent. They expand upon VCG contracts, initially introduced by Lavi and Shamash, 2022 for situations with complete information, to accommodate scenarios where principals lack complete information about the agent's attributes.

Finally,  Castiglioni et al., 2023 considers scenarios where the principal observes not just the final outcome, but also the individual (stochastic) outcomes of the agents. Then, the goal of the principal is to design contracts that depend on the individual outcomes. Their focus is on principal's utility functions with the properties of IR-supermodularity (increasing returns), i.e., her utility grows faster as agents put more effort, or DR-submodularity (diminishing returns), i.e., her utility grows slower.

Contracts in Bayesian and Learning settings. Alon et al., 2021 explore the contract design problem under private cost per unit-of-effort model, and Alon et al., 2023, Castiglioni et al., 2022, Gottlieb and Moreira, 2022 in Bayesian settings (with private types). Moreover, in the Bayesian setting, Guruganesh et al., 2021 and Castiglioni et al., 2022 demonstrate that the principal can enhance her utility by offering a randomized menu of contracts rather than a single fixed contract.

In the context of online learning, Ho et al., 2016 examine the learning of monotone contracts, presenting a zooming algorithm that achieves sublinear regret. Relaxing the monotonicity assumption, Zhu et al., 2023 consider the intrinsic dimension as a complexity measure based on the covering number of a spherical code. They derive a regret bound that exponentially depends on the intrinsic dimension.

Inspection Strategies. In the context of inspections, Fallah and Jordan, 2023 study the problem of a single principal interacting with multiple agents: In particular, the principal aims to encourage safety-compliant actions to maximize utility by utilizing payments and a constrained budget for random inspections.
Finally, Ball and Knoepfle, 2023 have investigated the problem of determining the optimal timing for inspections in a time-dependent setting. Focusing on scenarios where agents exhibit impatience over time, the study explores the ideal moments for conducting inspections.

§ MODEL

We consider a setting of a single principal and a single agent.
The agent can choose an action $a \in A$, each is associated with a cost $c(a)\in \R_{\geq 0}$ and a success probability $f(a) \in [0,1]$. We assume that the agent has a null action $\bot \in A$ for which  $c(\bot)=0$ which enforces the game to be individually rational for him, and that there are overall $n$ actions (i.e., $|A|=n$). The null action can be viewed as allowing the agent to opt out of the suggested contract.
The principal can inspect the actions taken by the agent and pay for the inspection cost. If the principal inspects action set $S \subseteq A$, it costs her $\insp(S)$, where $\insp:2^A \rightarrow \R_{\geq 0}$ is a combinatorial function which is normalized (i.e., $\insp(\emptyset) =0$) and monotone (i.e., for every $S\subseteq T\subseteq  A$ it holds that $\insp(S)\leq \insp(T)$). An instance of our setting is then defined by a quadruplet $(A,c,f,v)$.
The principal's task is to design an inspection scheme consisting of three components: (1) a suggested action $a\in A$, (2) a contract $\alpha \in [0,1]$, and (3) an inspection distribution $p$ which is a distribution over sets that the principal commits to inspect (i.e., $\sum_{S \subseteq A} p(S) =1$, and for all $S\subseteq A$, $p(S)\in [0,1]$).
An inspection scheme $(a,\alpha,p)$ is deterministic if there exists $S\subseteq A$, such that $p(S) =1$ and for every $T\neq S$, $f(T)=0$. For an action $a\in A$ and an inspection distribution $p$, we denote by $p(a)\eqdef \sum_{S: a\in S} p(S)$.

Agent's and Principal's Utility. In order to introduce the agent's expected utility under inspection scheme $(i,\alpha,p)$, we observe that if the agent takes the incentivized action (action $i$), then the agent's utility is $\alpha f(i) - c(i)$ in expectation. If, instead, the agent decides to take action $j \neq i$, as long as the principal does not inspect a set containing either $i$ or $j$, then we say that the agent is not caught and is paid the promised $\alpha$-fraction of the reward (in case of success). Otherwise (the principal inspects some set containing $i$ or $j$), the agent is caught and thus paid $0$. In expectation, we have that, for $j \neq i$, the utility is $\alpha f(j) \cdot (1 - \sum_{S: \{i, j\} \cap S \neq  \emptyset} p(S))- c(j)$.[Notice that $1 - \sum_{S: \{i, j\} \cap S \neq  \emptyset} p(S)$ is precisely the probability the agent does not get caught by the principal.] To summarize, given an inspection scheme $(i, \alpha, p)$ the principal proposes, the agent's expected utility from selecting action $j$ is:

\begin{align*}
u_{\agent}(i, \alpha, p,j) = \begin{cases}
\alpha f(j) - c(j) &\text{ if } j = i\\
\alpha f(j) \cdot (1 - \sum_{S: \{i, j\} \cap S \neq \emptyset} p(S))- c(j) &\text{ if } j \neq i
\end{cases}.
\end{align*}

On the other hand, the principal's expected utility from proposing inspection scheme $(i, \alpha, p)$ and the agent selecting action $j$ is

\begin{align*}
u_{\principal}(i, \alpha, p,j) = \begin{cases}
\left(1 - \alpha \right) \cdot f(j) - \sum_{S \subseteq A} p(S) \cdot \insp(S) &\text{ if } j = i\\
\left(1 - \alpha \cdot \left(1 - \sum_{S: \{i, j\} \cap S \neq \emptyset} p(S)\right)\right) \cdot f(j) - \sum_{S \subseteq A} p(S) \cdot \insp(S) &\text{ if } j \neq i
\end{cases}.
\end{align*}

The goal of the principal is to find an incentive-compatible (IC) inspection scheme $(i, \alpha, p)$, where, by incentive-compatible, we mean that
$i \in \arg\max_{\ell \in A} u_{\agent}(i, \alpha, p,\ell)$, i.e., the agent is incentivized to take the suggested action $i$.
Among the incentive-compatible inspection schemes, the principal wants to find the one with the highest utility,
i.e., $u_{\principal}(i, \alpha, p,i)$ is maximized, and $i \in \arg\max_{\ell \in A} u_{\agent}(i, \alpha, p,\ell)$.

We first observe that it is always better for the principal to inspect the suggested action $i$ by itself or inspect some other set of actions not including $i$.

Given an inspection scheme $(i, \alpha, p)$, define inspection distribution  $p^\prime$ such that $p^\prime(\{i\}) \eqdef p(i)$, $p^\prime(S) \eqdef 0$ for $S$ such that $i \in S, S \neq \{i\}$, and $p^\prime(S) \eqdef p(S)$ otherwise. It holds that, for all $j \in A$,

* $j \in \arg\max_{\ell \in A} u_{\agent}( i, \alpha, p,\ell) \Longleftrightarrow j \in \arg\max_{\ell \in A} u_{\agent}( i, \alpha, p^\prime,\ell)$;

* $u_{\principal}(i, \alpha, p^\prime,j) \geq u_{\principal}(i, \alpha, p,j)$.

The first part of the observation follows since for each $j\in A \setminus \{i\}$,
\begin{equation}\label{eq:pp}
\sum_{S:\{i,j\} \cap S\neq \emptyset} p(S) = \sum_{S:\{i,j\} \cap S\neq \emptyset} p^\prime(S),
\end{equation}
therefore, the functions $u_{\agent}(i,\alpha,p,j) =u_{\agent}(i,\alpha,p^\prime,j)$ (and it also holds that $u_{\agent}(i,\alpha,p,i) = u_{\agent}(i,\alpha,p^\prime,i)$).

The second part of the claim follows by Equation (<ref>) and by the  monotonicity of $v$, i.e.,

\begin{eqnarray*}
\sum_{S \subseteq A} p(S) \cdot v(S) & = & \sum_{S \subseteq A: i \in S} p(S) \cdot v(S)  +\sum_{S \subseteq A: i \notin S} p(S) \cdot v(S) \\ &  \geq & \sum_{S \subseteq A: i \in S}p(S) \cdot v(\{i\}) +\sum_{S \subseteq A: i \notin S} p(S) \cdot v(S) \\ &  = & p(i) \cdot v(\{i\}) +\sum_{S \subseteq A: i \notin S} p(S) \cdot v(S) = \sum_{S \subseteq A} p^\prime(S) \cdot v(S),\end{eqnarray*}

which concludes the proof.

Note that the modification to the inspection scheme of <Ref> above preserves determinism, i.e., if the initial inspection scheme $(i,\alpha,p)$ is deterministic, then also $(i,\alpha,p^\prime)$ created by <Ref> is.

In Appendix <ref>, we discuss non-incentive-compatible inspection schemes, where the principal might suggest some action $j$ to induce the agent to best respond with action $i$ in order to gain higher utility. We show that, for deterministic inspection schemes, incentive-compatibility is without loss of generality, and the principal has no gain in suggesting an action that is not the best response of the agent. However, for randomized inspection schemes, non-incentive-compatible inspection schemes can yield higher principal's utility than the best incentive-compatible one.

Combinatorial Inspection Cost Functions.

We focus on inspection cost functions
$\insp: 2^A \rightarrow \R_{\geq 0}$
that belong to one of the following classes of set functions [Lehmann et al., 2006]:

* Set function $\insp$ is additive if for every $S\subseteq A$ it holds that $\insp(S)=\sum_{i\in S} \insp(\{i\})$.

* Set function $\insp$ is submodular if for any two sets $S, S' \subseteq A$ with $S \subseteq S'$ and any $i \in A$ it holds that $\insp(i \mid S) \geq \insp(i \mid S')$ where $\insp(i \mid S)  = \insp(\{i\} \cup S) - \insp(S)$ is called marginal.

* Set function $\insp$ is XOS if there exists a collection of additive functions $\{\gamma_\ell: 2^A \rightarrow \R_{\geq 0}\}_{\ell \in [k]}$ such that for each set $S \subseteq A$ it holds that $\insp(S) = \max_{\ell \in [k]} \gamma_\ell(S) $.

* Set function $\insp$ is subadditive if for any two sets $S, S' \subseteq A$ it holds that $\insp(S) + \insp(S') \geq \insp(S \cup S')$.

It is well known that $\text{additive} \subset \text{submodular} \subset \text{XOS} \subset \text{subadditive}$ and all containment relations are strict [Lehmann et al., 2006].

Oracles for accessing $v$.
As is common in the combinatorial optimization literature involving set functions, we assume two primitives for accessing $v$:

* A value oracle for $v$ is given $S \in 2^A$ and returns $v(S)$.

* A demand oracle for $v$ is given a vector of prices $q = (q_1, \ldots, q_n) \in \R^n_{\geq 0}$ and returns a set $S \in 2^A$ that maximizes $v(S) - \sum_{j \in S} q_j$. We denote this set by $D(v, q)$.

Both value and demand oracles are considered standard in combinatorial optimization problems over set functions.
In markets for goods (e.g., combinatorial auctions), a demand query corresponds to the best bundle to purchase given item prices.
Demand oracles have proven useful in previous studies on combinatorial contracts [Dütting et al., 2021] and multi-agent contracts [Dütting et al., 2023].

§ DETERMINISTIC INSPECTION SCHEMES

In this section, we present a polynomial time algorithm that finds the best contract with a deterministic inspection scheme. Formally we prove the following theorem:

There exists an algorithm that for every instance $(A,c,f,v)$ returns the optimal deterministic IC inspection-scheme that runs in time polynomial in $n=|A|$, and uses at most $ n^2$ value queries to $v$.

In order to prove the above theorem, we first note that a deterministic inspection scheme can be described by a triplet $(i, \alpha, S)$ composed of the suggested action $i$, the contract $\alpha$, and the inspected set $S$. We next present the algorithm for finding the best deterministic inspection scheme.

§.§ Algorithm

We first go over all actions with $c(i)=0$, and consider the one with the maximal value of $f(i)$, i.e., let $i^* = \arg\max_i \{f(i) \mid i\in A \wedge c(i)=0\}$.
This action can be incentivized by using the inspection scheme $(i^*,0,\emptyset)$, which gives the principal an expected utility of $f(i^*)$.

We then go over all actions $i\in A$ with $f(i)>c(i)>0$, and for each such $i$ we define[Observe that $A_i$ is well defined since $f(i)>f(j)$ and $f(i)>0$.]
$$A_i = \left\{ j \mid f(j) < f(i) \wedge \frac{c(i)-c(j)}{f(i)-f(j)}  > \frac{c(i)}{f(i)} \right\},$$

in particular, for every $j \in A_i$ it must be that $\frac{c(i)-c(j)}{f(i)-f(j)} > \frac{c(i)}{f(i)} >0 $. The interpretation of $A_i$ is the set of actions $j$ with lower value of $f$ than $i$, such that if the principal uses $\alpha = \frac{c(i)}{f(i) }$ then the agent strictly favors them over $i$.
Then, we define
$$S_{i}\eqdef A_i \cup \left\{ j^\prime \neq i \mid f(j^\prime) \geq f(i) \wedge f(j^\prime) \cdot \frac{c(i)}{f(i)} >c(j^\prime) \right\} $$
and for each $j\in A_i$, we define

\begin{align*}
S_{i,j} \eqdef & \left\{ j^\prime\in A_i \mid \frac{c(i)-c(j^\prime)}{f(i)-f(j^\prime)} > \frac{c(i)-c(j)}{f(i)-f(j)} \right\} \\ &\cup \left\{ j^\prime  \mid f(j^\prime) \geq f(i) \wedge \frac{c(i)-c(j)}{f(i)-f(j)} \cdot (f(j^\prime)-f(i))  > c(j^\prime)-c(i) \right\}.
\end{align*}

The interpretation of $S_i$ (respectively, $S_{i,j}$) is the set of actions that needs to be inspected if $i$ is not inspected and $\alpha= \frac{c(i)}{f(i)}$ (respectively, when $\alpha =\frac{c(i)-c(j)}{f(i)-f(j)} $), as if any of these actions is not inspected, the agent strictly favor them over action $i$.

We then consider  for each $j\in A_i $ the inspection scheme $(i,\frac{c(i)-c(j)}{f(i)-f(j)}, S_{i,j})$.
We also consider the inspection schemes $(i,\frac{c(i)}{f(i)}, S_i) $, and $(i,\frac{c(i)}{f(i)}, \{i\}) $.
We return the inspection scheme with the maximum utility for the principal among all considered inspection schemes.

§.§ Proof of Theorem <ref>

Incentive compatibility. We first show that every inspection scheme considered by our algorithm is indeed IC.
For the inspection scheme defined by $(i^*,0,\emptyset)$, this is trivially true, since the agent's utility for action $i^*$ is $0$, while for every other action cannot be more than $0$.

Now, consider inspection scheme $(i,\frac{c(i)-c(j)}{f(i)-f(j)},S_{i,j})$ where $j\in A_i$. Since $j\in A_i$, then the utility of the agent from selecting  action $i$ is strictly positive, as $\frac{c(i)-c(j)}{f(i)-f(j)} \cdot f(i) -c(i) > \frac{c(i)}{f(i)} \cdot f(i) -c(i) =0$.
On the other hand, for $j^\prime\neq i$, if $j^\prime\in S_{i,j}$ then the agent's utility from selecting $j^\prime$ is at most $0$, since the principal inspects action $j^\prime$.
Else ($j^\prime\notin S_{i,j}$), if $j^\prime\in A_i$, then we get that $j^\prime$ must satisfy that $\frac{c(i)-c(j^\prime)}{f(i)-f(j^\prime)  } \leq  \frac{c(i)-c(j)}{f(i)-f(j)  } $, which implies that, if we denote by $\delta_{i,j,j^\prime} = \frac{c(i)-c(j)}{f(i)-f(j) }-\frac{c(i)-c(j^\prime)}{f(i)-f(j^\prime) } \geq 0 $, then
\begin{eqnarray}
f(i) \cdot \frac{c(i)-c(j)}{f(i)-f(j) } &-& c(i)  =  f(i) \cdot \frac{c(i)-c(j^\prime)}{f(i)-f(j^\prime)} -c(i)   + f(i)\cdot\delta_{i,j,j^\prime} \nonumber\\ & \geq & (f(i)-f(j^\prime)+f(j^\prime)) \cdot \frac{c(i)-c(j^\prime)}{f(i)-f(j^\prime)} -(c(i)-c(j^\prime)+c(j^\prime)) + f(j^\prime)\cdot\delta_{i,j,j^\prime}
\nonumber\\ & = &  f(j^\prime)\cdot  \frac{c(i)-c(j^\prime)}{f(i)-f(j^\prime)} -c(j^\prime)+ f(j^\prime)\cdot\delta_{i,j,j^\prime}
\nonumber\\ & = & f(j^\prime) \cdot \frac{c(i)-c(j)}{f(i)-f(j) }-c(j^\prime) , \label{eq:j}
\end{eqnarray}

where the first and last equalities are by the definition of $\delta_{i,j,j^\prime}$, and  the inequality is since $f(i) >f(j^\prime)$. This implies that the agent does not want to deviate to $j^\prime$.
For $j^\prime \notin A_i$, then if $f(j^\prime)< f(i)$ then the same inequalities as (<ref>) work since $ \delta_{i,j,j^\prime} =   \frac{c(i)-c(j)}{f(i)-f(j)} - \frac{c(i)}{f(i)} + \frac{c(i)}{f(i)}- \frac{c(i)-c(j^\prime)}{f(i)-f(j^\prime)} \geq  0$.

We are left to consider the case that $f(j^\prime) \geq f(i)$. If $f(j^\prime) = f(i)$, then the condition $j^\prime\notin S_{i,j}$ implies that $c(j^\prime) \geq  c(i)$,  thus the agent cannot strictly favor action $j^\prime$ over $i$. If $f(j^\prime) > f(i)$ then the condition $j^\prime\notin S_{i,j}$ implies that $ \frac{c(i)-c(j)}{f(i)-f(j)} \leq \frac{c(i)-c(j^\prime)}{f(i)-f(j^\prime)}$, which allows us to use Inequality (<ref>) by observing that $\delta_{i,j,j^\prime} \leq 0$ and $f(i) \leq f(j^\prime)$.

An equivalent analysis (as for the former case) shows that  the inspection scheme $(i,\frac{c(i)}{f(i)},S_i)$ is IC.

For inspection scheme $\left(i,\frac{c(i)}{f(i)},\{i\}\right)$, the utility from action $i$ is $0$, and from any other action is non-positive since action $i$ is inspected.

We next show that for every IC inspection scheme $(i,\alpha,S)$, the algorithm considers an inspection scheme with at least as much expected utility for the principal.
The case of $c(i)=0$ is solved trivially by the first inspection scheme that the algorithm considers (inspection scheme $(i^*,0,\emptyset)$).

Else ($c(i) >0$), then it must be that $\alpha f(i) \geq c(i)$ (as otherwise it contradicts the individual rationality of the agent), thus $f(i)>0$, and $\alpha \geq \frac{c(i)}{f(i)}$.
We next consider three cases:
If $i\in S$, then the inspection scheme  $\left(i,\frac{c(i)}{f(i)},\{i\}\right)$ achieves at least the same utility for the principal.
($i\notin S$), if $A_i \subseteq S$, then it must be that $S_i \subseteq S$. Assume towards contradiction that there exists $j^\prime\in S_i\setminus S$, then it must belong to $S_i\setminus A_i$ (since $S$ contains $A_i$). If $f(j^\prime)=f(i)$ then the condition is equivalent to $c(j^\prime)<c(i)$ which means that  the agent can benefit from switching to $j^\prime$ as it has the same expected payment from the principal, but with a lower cost (which is a contradiction to IC). If $f(j^\prime)> f(i)$ then by definition of  $S_i\setminus A_i$, it holds that $\frac{c(i)}{f(i)} > \frac{c(j^\prime)}{f(j^\prime)}$ thus

\begin{align*}
\alpha f(j^\prime) -c(j^\prime) &= \left(\alpha-\frac{c(i)}{f(i)} + \frac{c(i)}{f(i)}\right) \cdot f(j^\prime) -c(j^\prime)  \\
&> \left(\alpha-\frac{c(i)}{f(i)}\right) \cdot f(j^\prime) \geq \left(\alpha-\frac{c(i)}{f(i)}\right) \cdot f(i) = \alpha f(i) -c(i),
\end{align*}

which is a contradiction to IC, thus, inspection scheme $(i,\frac{c(i)}{f(i)},S_{i})$ gives at least the same utility to the principal.

Else ($\exists j \in  A_i \setminus S$), then consider  $j^*= \arg\max_{j\in  A_i \setminus S} \frac{c(i)-c(j)}{f(i)-f(j)}$.
It must be that $\alpha \geq \frac{c(i)-c(j^*)}{f(i)-f(j^*)}$, as otherwise

\begin{eqnarray*}
\alpha f(j^*) -c(j^*)  & = & \left(\alpha -\frac{c(i)-c(j^*)}{f(i)-f(j^*)}+\frac{c(i)-c(j^*)}{f(i)-f(j^*)}\right) \cdot (f(j^*)-f(i)+f(i)) -c(j^*) \\
& = & \left(\alpha -\frac{c(i)-c(j^*)}{f(i)-f(j^*)}\right) \cdot f(j^*)+\frac{c(i)-c(j^*)}{f(i)-f(j^*)} \cdot f(i) -c(i) \\ & > & \left(\alpha -\frac{c(i)-c(j^*)}{f(i)-f(j^*)}\right) \cdot f(i)+\frac{c(i)-c(j^*)}{f(i)-f(j^*)} \cdot f(i) -c(i)
\\ &= & \alpha f(i)-c(i),
\end{eqnarray*}

where the inequality is since $\alpha <\frac{c(i)-c(j^*)}{f(i)-f(j^*)}$, and since $f(j^*)<f(i)$.

By definitions of $j^*,S_{i,j^*}$, it holds that $A_i \cap S_{i,*j} \subseteq S $.
It also holds that since $\alpha \geq \frac{c(i)-c(j^*)}{f(i)-f(j^*)}$, every action $j'\in S_{i,j^*} \setminus A_i $ must be in $S$. Assume towards contradiction that there exists $j' \in  S_{i,j^*} \setminus A_i \setminus S $. Then, $f(j') \geq f(i)$, therefore, it holds that

\begin{eqnarray*}
\alpha f(j') -c(j') & \geq  & \left(\alpha-\frac{c(i)-c(j^*)}{f(i)-f(j^*)}\right)   f(i)  + \frac{c(i)-c(j^*)}{f(i)-f(j^*)} f(j') -c(j')
\\ & > & \left(\alpha-\frac{c(i)-c(j^*)}{f(i)-f(j^*)}\right)   f(i)  + \frac{c(i)-c(j^*)}{f(i)-f(j^*)} f(i) -c(i)
\\ & = &  \alpha f(i) -c(i),
\end{eqnarray*}

where the first inequality is since $\alpha \geq \frac{c(i)-c(j^*)}{f(i)-f(j^*)}$, and since $f(j') \geq f(i)$, and the second inequality is since  $j' \in S_{i,j^*} \setminus A_i$.
Therefore, $S_{i,j^*} \subseteq S $, thus inspection scheme $(i,\frac{c(i)-c(j^*)}{f(i)-f(j^*)},S_{i,j^*})$ gives at least the same utility to the principal,
which concludes the proof.

Complexity. The algorithm uses at most $O(n^2)$ value queries since it ask for each $i$ at most $n+1$ queries.
The algorithm runs in polynomial time by design.

§ RANDOMIZED INSPECTION SCHEMES: SUBMODULAR INSPECTION COST

In this section, we shift our attention to randomized inspection schemes, recalling that the gap between deterministic and randomized inspection schemes in terms of the principal's expected utility can be as large as $\Omega(n)$ (see <Ref> for further details).
Our main result is a polynomial time algorithm that finds the optimal randomized inspection scheme for submodular inspection cost functions. Formally, we show  the following:

For every instance $(A,c,f,v)$ with submodular inspection cost function $v$, there exists an optimal randomized incentive-compatible inspection scheme $(i,\alpha,p)$ where $p$ is supported by at most $n+1$ sets. Moreover, such an optimal inspection scheme can be found in time polynomial in $n=|A|$ using value query access to $v$.

Before describing the algorithm and showing why <Ref> holds, we prove the following key lemma that will be useful in the remainder:

For a set $A$ with cardinality $n$, let $p:2^{A} \rightarrow \R_{\geq 0}$ be an arbitrary function, and let $v:2^{A}\rightarrow \R_{\geq 0}$ be a submodular function. Let $p(j) = \sum_{S \subseteq A:j \in S} p(S)$. Let   $\pi:[n] \rightarrow A$ be an arbitrary bijection such that   $p(\pi(1)) \leq \ldots \leq p(\pi(n))$ (such a bijection always exists). For $p^\prime:2^{A} \rightarrow \R_{\geq 0}$ such that for every $t \in [n]$, $p^\prime(\{\pi(t),...,\pi(n)\}) = p(\pi(t))-p(\pi(t-1))$ where $p(\pi(0))=0$, otherwise $p^\prime(S) =0$ for $S\neq \emptyset$, and $p^\prime(\emptyset) = \sum_{S\subseteq A} p(S)-p(\pi(n))$  it holds that:

* $\sum_{S \subseteq A}  p^\prime(S) = \sum_{S \subseteq A} p(S)$;

* For all $j \in A$,  $p^\prime(j) =\sum_{S \subseteq A:j \in S} p^\prime(S)= p(j)$;

* $\sum_{S \subseteq A} p^\prime(S) \cdot v(S) \leq \sum_{S \subseteq A} p(S) \cdot v(S)$.

The first claim holds since
$$\sum_{S \subseteq A}  p^\prime(S) = p^\prime(\emptyset) + \sum_{t\in [n]} p^\prime(\{\pi(t),...,\pi(n)\}) =p^\prime(\emptyset) + \sum_{t\in [n]} p(\pi(t)) -p(\pi(t-1))  =   \sum_{S \subseteq A} p(S),$$

where the last equality holds by telescoping and by definition of $p^\prime(\emptyset)$.

To show the second claim, let $\ell$ be the preimage of $j$ according to bijection $\pi$ , i.e., $j = \pi(\ell)$. We get

\begin{align*}
p^\prime(j) &= \sum_{S \subseteq A: j \in S} p^\prime(S) = \sum_{t \leq \ell} p^\prime(\{\pi(t),...,\pi(n)\}) \\
&= \sum_{t \leq \ell} \left(p(\pi(t)) - p(\pi(t-1)) \right)= p(\pi(\ell)) - p(\pi(0)) = p(\pi(\ell)) \\
&= p(j).
\end{align*}

For the third claim, we have

\begin{align*}
\sum_{S \subseteq A} p(S) \cdot v(S) &= \sum_{S \subseteq A} p(S) \cdot \left(\sum_{\ell=1}^{n} \ind{\pi(\ell) \in S} \cdot v(\pi(\ell) \mid S \setminus \{\pi(1),\ldots,\pi(\ell)\})\right) \\
&\geq \sum_{S \subseteq A} p(S) \cdot \left(\sum_{\ell=1}^{n} \ind{\pi(\ell) \in S} \cdot v(\pi(\ell) \mid A \setminus \{\pi(1),\ldots,\pi(\ell)\})\right)\\
&= \sum_{\ell=1}^{n} v(\pi(\ell) \mid A \setminus \{\pi(1),\ldots,\pi(\ell)\}) \cdot \left(\sum_{S \subseteq A: \pi(\ell) \in S} p(S)\right)\\
&= \sum_{\ell=1}^{n} p(\pi(\ell)) \cdot v(\pi(\ell) \mid A \setminus \{\pi(1),\ldots,\pi(\ell)\})\\
&= \sum_{\ell=1}^{n} (p(\pi(\ell)) - p(\pi(\ell - 1)) \cdot v(A \setminus \{\pi(1),\ldots,\pi(\ell-1)\})\\
&= \sum_{\ell=1}^{n} p^\prime(A \setminus \{\pi(1),\ldots,\pi(\ell-1)\}) \cdot v(A \setminus \{\pi(1),\ldots,\pi(\ell-1)\})\\
&= \sum_{S \subseteq A} p^\prime(S) \cdot v(S),
\end{align*}

where the first equality is by definition of marginals, the inequality is by submodularity of $v$, the second equality is by switching the order of summations, the third equality is by definition of $p(\pi(\ell))$, the fourth equality follows from telescoping, the fifth equality holds by definition of $p^\prime$, and the last equality follows since all added sets to the summation have either $p^\prime(S)=0$ or $S= \emptyset$ for which $v(S)=0$.

§.§ Algorithm

Our algorithm reformulates the problem of finding the best inspection scheme as solving a polynomial number of optimization problems, each with a constant number of variables and constraints. We first write it as a program over an exponential number of variables (the probabilities to inspect each set $p(S)$, and the payment $\alpha$). We then partition the interval $[0,1]$ of options for $\alpha$ to sub-intervals such that within each sub-interval the marginal probabilities that the actions are needed to be inspected have the same relative order.
This allows us to solve the program in each sub-interval separately, and use <Ref> to decrease the number of variables from the objective function from an exponential number to a constant number. We then solve each optimization (non-linear) program, and return the best one.

We now explain our algorithm formally:

Step 1: Going over the actions. We fix action $i \in A$. If $c(i) = 0$, then the inspection scheme $(i, 0, p(\emptyset))$, where $p_\emptyset$ is the deterministic inspection distribution that inspects $\emptyset$ with probability $1$, is the optimal IC inspection scheme that incentivizes action $i$ (since the principal pays $0$).

If instead $f(i) \leq c(i)$, then incentivizing action $i$ cannot guarantee a positive utility to the principal, and therefore, the inspection scheme $(\bot,0,p_\emptyset)$ guarantees at least the same utility.

Otherwise, we have that $f(i) > c(i) > 0$, then by using Observation <ref>  we can formulate the problem of finding the optimal (randomized) IC inspection scheme that incentivizes action $i$ as

\begin{align}
\min_{\alpha, p} \ &\alpha f(i) + \sum_{S \subseteq A} p(S) \cdot \insp(S) \nonumber\\
\text{s.t. } &\alpha f(i) - c(i) \geq \alpha f(j) \cdot \left(1 - p(i) - p(j)\right) - c(j), \forall j \neq i \label{eq:insp}\\
\qquad &\alpha \in [0,1], p \in \Delta(2^A), p(i)=p(\{i\}) \nonumber.
\end{align}

We note that the constraints written above are the incentive-compatibility constraints, written in terms of marginal probabilities of inspection, that we need to satisfy for the agent to take action $i$.
Since $\bot \in A$, we can add a constraint to Program (<ref>) of the form $\alpha \geq \frac{c(i)}{f(i)}$ without changing feasibility. Next,  for each $j \in A$, if  $f(j) = 0$, the incentive-compatibility constraint is less restrictive than $\alpha \geq \frac{c(i)}{f(i)}$ and can thus be discarded. Else ($f(j)>0$),  the incentive-compatibility constraint is equivalent to

\[
p(j) \geq 1 - p(i) - \frac{\alpha f(i)- c(i) + c(j)}{\alpha f(j)}.
\]

For convenience, we name the right-hand side above as $\eta_j(\alpha, p(i))$, for each $j \neq i$ with $f(j)>0$.

Step 2: Partitioning the interval $[0,1]$   to sub-intervals. Let us now define the set of $\alpha$'s for a specific action $i$ and each of the $n-1 \choose 2$ pairs $j, j^\prime \neq i$ as the $\alpha$'s respectively satisfying $\eta_j(\alpha, p(i)) = \eta_{j^\prime}(\alpha, p(i))$. Formally, let $C_i$ be the set of all $\alpha_i(j,j^\prime)$'s such that $f(j) \neq f(j^\prime)$ and that satisfy

\[
\alpha_i(j,j^\prime):~ \eta_j(\alpha, p(i)) = \eta_{j^\prime}(\alpha, p(i)) \Longleftrightarrow \alpha_i(j,j^\prime) \eqdef \frac{(c(i) - c(j)) \cdot f(j^\prime) - (c(i) - c(j^\prime)) \cdot f(j)}{(f(j^\prime) - f(j)) \cdot f(i)}.
\]

Let us observe that $\alpha$'s so defined do not depend on $p(i)$. Hence, without loss of generality, we order elements in $C_i$ in non-decreasing order and reindex them as $\alpha_{i, \ell}$'s. We first remove all $\alpha_{i,\ell}$'s not in $(0,1)$, and we add $\alpha_{i,0}=0$, and $\alpha_{i,|C_i|}=1$ to $C_i$.

Step 3: Solve the simplified program. We note that within any interval $[\alpha_{i,\ell}, \alpha_{i, \ell+1})$, the order of $\eta$'s is preserved, that is, there exists a bijection $\pi_{i, \ell}: [n-1] \rightarrow A \setminus \{i\}$ such that $\eta_{\pi_{i, \ell}(1)}(\alpha, p(i)) \leq \ldots \leq \eta_{\pi_{i, \ell}(n-1)}(\alpha, p(i))$. For convenience, we set $\eta_{\pi_{i, \ell}(0)}(\alpha, p(i)) = -\infty$ and $\eta_{\pi_{i, \ell}(n)}(\alpha, p(i)) = +\infty$.

Moreover, since this is a minimization problem, we would like $p(j)$'s to be as small as possible (yet non-negative), thus, we can derive that $p(j) = \max\{0, \eta_j(\alpha, p(i))\}$ for all $j \in A \setminus \{i\}$.

Let $k \in \{0\} \cup [n-1]$ be such that $\eta_{\pi_{i, \ell}(k)}(\alpha, p(i)) \leq 0 < \eta_{\pi_{i, \ell}(k+1)}(\alpha, p(i))$ and,  by applying <Ref> on the set $A \setminus \{i\}$,
we write Program (<ref>) in the following simplified form:

\begin{align}
\min_{\alpha, p(i)} \ &\alpha f(i) + p(i)\cdot v(\{i\}) + \eta_{\pi_{i, \ell}(k+1)}(\alpha, p(i)) \cdot v(A \setminus \{i, \pi_{i, \ell}(1), \ldots, \pi_{i,\ell}(k)\}) \nonumber\\
& + \sum_{t=k+2}^{n-1} (\eta_{\pi_{i, \ell}(t)}(\alpha, p(i)) - \eta_{\pi_{i, \ell}(t-1)}(\alpha, p(i))) \cdot v(A \setminus \{i, \pi_{i, \ell}(1), \ldots, \pi_{i,\ell}(t-1)\}) \nonumber\\
\text{s.t. } &\eta_{\pi_{i, \ell}(k)}(\alpha, p(i)) \leq 0 < \eta_{\pi_{i, \ell}(k+1)}(\alpha, p(i)) \label{eq:insp-simple}\\
\qquad &\max\left\{\alpha_{i, \ell}, \frac{c(i)}{f(i)}\right\} \leq \alpha \leq \alpha_{i, \ell+1} \nonumber.
\end{align}

Let us observe that Program (<ref>) is a constrained minimization problem in two variables, namely, $\alpha, p(i)$.

Step 4: Output. The algorithm considers all the inspection schemes in Steps 1, 2, 3 above for each $i \in A$, $\ell \in {n-1 \choose 2}$, $k \in \{0\} \cup [n-1]$. For each, it computes, using Program (<ref>), the optimal $\alpha, p(i)$, and calculates the optimal inspection scheme using <Ref> with $p(j) =0 $ for $j \in \{\pi_{i,\ell}(1),\ldots,\pi_{i,\ell}(k)\},$  $p(j) = \eta_j(\alpha, p(i)) $ for $j \in \{\pi_{i,\ell}(k+1),\ldots,\pi_{i,\ell}(n-1)\},$ and $p(i)$.
It returns the inspection scheme with the maximal expected utility among all suggestions.

§.§ Proof of <Ref>

It is sufficient to consider actions $i\in A$ with $f(i)>c(i)>0$, in particular, that a feasible solution for Program (<ref>) corresponds to a feasible solution for Program (<ref>), and vice versa. Consider the optimal inspection scheme that incentivizes action $i$,  which by <Ref> is the solution $\alpha,p$ to Program (<ref>) (with respect to action $i$).
We know that there exists an $\ell$ such that $\alpha \in [\alpha_{i, \ell},\alpha_{i,\ell+1})$.
Since within $[\alpha_{i,\ell}, \alpha_{i, \ell+1})$ the order of $\eta$'s is preserved, by the structure guarantee of <Ref> we obtain that there exists a distribution $p^\prime$ with minimum expected cost with marginals $\max\{0,\eta_{j}\}$, for $j\neq i$, and $p(i)$ for $j=i$ (that always inspect $i$ as a singleton), and is supported by the set $\{i\}$ and on sets of the form $\{\pi_{i, \ell}(j),...,\pi_{i, \ell}(n-1)\}$ for $j\in  [n]$.
Since $(\eta_{\pi_{i,\ell}(0)}, \ldots,\eta_{\pi_{i,\ell}(n)})$ is an increasing sequence with $\eta_{\pi_{i,\ell}(0)}=-\infty$, and $\eta_{\pi_{i,\ell}(n)}=\infty$, then there exists $k$ such that $\eta_{\pi_{i, \ell}(k)}(\alpha, p^\prime(i)) \leq 0 < \eta_{\pi_{i, \ell}(k+1)}(\alpha, p^\prime(i))$, which means that for the corresponding Program (<ref>) with $i,\ell,k$, the constraints are satisfied (and the objective has the same value).
Overall, the optimal solution $(\alpha,p)$, corresponds to a feasible solution with the same objective value for one of the Programs (<ref>) with the corresponding $i,\ell,k$.

We also need to show that from a feasible solution to Program (<ref>), we can construct a feasible solution to Program  (<ref>) with the same objective value.
Consider a solutions $\alpha, p(i)$ to Programs (<ref>), parametrized by combinations of $i, \ell, k$. For marginals of $0$ for all $j \leq k$, and of $\eta_{\pi_{i, \ell}(j)}(\alpha, p(i))$ for $j>k$, we apply <Ref> (on the set $A\setminus \{i\}$), and create the minimal cost distribution $p^\prime$ where $p^\prime(\{i\})=p(i)$, and for all $j \in  [n-1]$ we have $p^\prime(\pi_{i,\ell}(j))=\max\{0,\eta_{\pi_{i, \ell}(j)}(\alpha, p(i))\}$. [Observe that <Ref> can be applied using only the marginals $p(j)$'s instead of receiving a full distribution $p$. Moreover, to ensure that the created distribution $p^\prime$ is indeed a distribution, we can set  $p^\prime(\emptyset)$ to $1-p(i)-max_{j\neq i} p(j)$ which is at least 0 as otherwise this would not be a feasible solution to Program (<ref>).]
Thus, $\alpha,p^\prime$ is a feasible solution to Program (<ref>) since for every $j\neq i$, we have that $p^\prime(j) \geq \eta_j(\alpha,p(i))$ (which  equivalent to  the constraint of Program (<ref>)).
By <Ref>  $p^\prime$ has a lower expected inspection cost than $p$ and since it uses the same value of $\alpha$,
it concludes the proof.

Runtime and Number of Value Queries. The algorithm presented in this section contains three nested loops: Step 1 is performed for each $i \in A$, that is $n$ times. For each Step 1, Step 2 is performed at most $O(n^2)$ times, since this is the maximum cardinality $C_i$ has. For each iteration of Step 2, Step 3 solves a program in two variables ($\alpha, p(i)$) for each possible value of $k$, i.e., $n-1$ times at most. Thus, the algorithm runs in polynomial time.

Moreover, as for the number of value queries used by the algorithm, we know from what is argued above that there are $O(n^3)$ iterations of Steps 1, 2. For each different $k$ we iterate over in Step 3, we query the value of the same sets, thereby making $n$ value queries for all the iterations of Step 3. Thus, the algorithm requires $O(n^4)$ value queries to the inspection cost function $v$ overall.

Support. The support of the created distribution is of size at most $n+1$. This follows from the fact that besides adding the set $\{i\}$ to the support, the distribution is supported by the outcome of <Ref> on $A \setminus \{i\}$ which is at most of size $n$.

The theorem follows.

§ IMPOSSIBILITY BEYOND SUBMODULAR INSPECTION COST

In this section, we complement our positive result from <Ref> and show that for the class of XOS inspection cost functions (the next class in the hierarchy of complement-free set functions [Lehmann et al., 2006]), it is not possible to find the optimal (randomized)  inspection scheme using a polynomial number of value queries.
Moreover, the impossibility result applies even in the case where the algorithm has access to function $v$ via demand queries (as opposed to just value queries). Formally, we prove the following:

Every algorithm that for every instance $(A,f,c,\insp) $ with XOS inspection cost function $\insp$ over $n=|A|$ actions returns the optimal randomized inspection scheme, uses at least $\left(\frac{5}{4}\right)^n$ value or demand queries.

To show <Ref>, we construct a family of instances parameterized by a random hidden set $T$ such that, for every instance, there exists a unique principal's utility maximizing randomized inspection scheme, and there is a one-to-one correspondence between $T$ and this unique best inspection scheme. Additionally, using less than an exponential number of value and demand queries, one cannot extract the hidden parameter of the instance (set $T$).

§.§ Hard Instance Construction

Let us consider an instance with $n = k+3$ actions for a $k>5$ being a prime number, where we name the actions $A = \{\bot, g, x, 1, \ldots, k\}$. We now define a family of instances $\inst_T=(A, f, c, v_T)$ parametrized by a random set $T \subseteq A$, where $|T| = \left\lceil\frac{4k}{5}\right\rceil$, and such that: (1) $f(\bot) = 0, ~f(g) = 1, ~f(x) = \frac{3}{10}, ~f(i) = \frac{1}{5} ~\forall i \in [k]$, (2) $ c(\bot)=0$, $c(g) = \frac{1}{10}, ~c(x) = \frac{1}{100}, ~c(i) = \frac{1}{100} ~\forall i \in [k]$. We next describe the inspection cost function:

\begin{align}\label{eq:xos}
v_T(S) \eqdef \frac{\ind{S \setminus \{\bot, g\} \neq \emptyset}}{40} &+ \ind{\bot \in S } +\ind{g \in S } \\
&+ \frac{1}{80k} \cdot \begin{cases} 0 & \text{ if } |S|=0\\
1 &\text{ if } 0<|S \setminus\{\bot, g, x\}| < \frac{4k}{5} \text{ or } S \setminus\{\bot, g, x\} \in \cyclic(T) \\
2 &\text{ if } |S \setminus\{\bot, g, x\}| > \frac{4k}{5} \text{ and } S \setminus\{\bot, g, x\} \notin \cyclic(T)
\end{cases},\nonumber
\end{align}

where $\cyclic(T) \eqdef \left\{ T_t \mid t\in [k] \right\}$, and $T_t \eqdef \{((j +t) \mod k)+1 \mid j \in T\}$,
is defined to be the collection of all sets obtained by cyclic shifts of elements in $T$.

We now show that these inspection cost functions are XOS:

For every $T \subseteq A$ with $|T| = \left\lceil\frac{4k}{5}\right\rceil$, $v_T$ is XOS.

Let us consider the following collection $\Gamma$ of additive functions:

* $\gamma_x(S) \eqdef \frac{1}{40} \cdot \ind{x \in S} + \ind{\bot \in S} + \ind{g \in S}$, defined for action $x$;

* $\gamma_i(S) \eqdef \left(\frac{1}{40} + \frac{1}{80k}\right) \cdot \ind{i \in S} + \ind{\bot \in S} + \ind{g \in S}$, defined for each action $i \in [k]$;

* $\gamma_{S^\prime}(S) \eqdef \left(\frac{1}{40} + \frac{1}{40k}\right) \cdot \frac{|S \cap S^\prime|}{|S^\prime|} + \ind{\bot \in S} + \ind{g \in S}$, defined for each subset of actions $S^\prime \subseteq [k]$ such that $|S^\prime| > \frac{4k}{5}$ and $S^\prime \notin \cyclic(T)$.

We now show that (1) for all $S \subseteq A$ and all functions $\gamma \in \Gamma$, $v_T(S) \geq \gamma(S)$, and (2) for all $S \subseteq A$, there exists a function $\gamma \in \Gamma$ such that $v_T(S) = \gamma(S)$. This trivially holds for $S = \emptyset$. Moreover, for both claims, since the summands $\ind{\bot \in S }, \ind{g \in S }$ are common between $v_T$ and $\gamma$'s, we can ignore them, i.e., consider $v^\prime_T$ and $\gamma^\prime$ which are respectively obtained from $v_T$ and $\gamma$ by subtracting the term $\ind{\bot \in S} + \ind{g \in S}$, and consider a new instance without actions $\bot, g$.

For (1), we observe that, for $S=\{x\}$,
it holds that for every $\gamma^\prime
\in \Gamma^\prime$, $ \gamma^\prime(S)\leq \frac{1}{40} = v^\prime_T(S)$.
For all $S \subseteq A\setminus\{\bot, g\}$, such that  $v^\prime_T(S) = \frac{1}{40}+\frac{1}{80k}$, then  $\max\{\gamma^\prime_x(S), \max_{i \in [k]} \gamma^\prime_i(S)\} \leq \frac{1}{40}+\frac{1}{80k} = v^\prime_T(S)$. Also, for every $\gamma^\prime$ of the third type defined by a set $S^\prime$, it holds that $S^\prime\setminus S\neq \emptyset$. Therefore, $\gamma^\prime_{S^\prime}(S) \leq (\frac{1}{40}+\frac{1}{40k})\cdot\frac{|S^\prime|-1}{|S^\prime|} \leq (\frac{1}{40}+\frac{1}{40k})\cdot\frac{\lceil\frac{4k}{5}\rceil-1}{\lceil\frac{4k}{5}\rceil} \leq v_T^\prime(S)$.
For $S$ such that $v^\prime_T(S) = \frac{1}{40}+\frac{1}{40k}$, then for all $\gamma^\prime \in \Gamma^\prime$, it holds that $\gamma^\prime(S) \leq \frac{1}{40}+\frac{1}{40k}$, which concludes the proof of (1).

For (2), if $S = \{x\}$ then $\gamma^\prime_x(S) = v^\prime_T(S)$.   Otherwise, if $S$ is such that $v^\prime_T(S) = \frac{1}{40} + \frac{1}{80k}$, then it means that there exists some action  $i \in S \cap [k]$,  therefore, $\gamma^\prime_i(S) = v^\prime_T(S)$. If instead, $v^\prime_T(S) = \frac{1}{40} + \frac{1}{40k}$, then it means that $S$ is such that $|S \setminus\{x\}| > \frac{4k}{5} \text{ and } S \setminus\{x\} \notin \cyclic(T)$, therefore $\gamma^\prime_{S}$ exists (in $\Gamma^\prime$), thus,  $\gamma^\prime_{S}(S) = \frac{1}{40} + \frac{1}{40k}$, which concludes the proof of (2).

§.§ Proof of <Ref>

We next prove <Ref>, as per the following lemmas.

For every $T \subseteq A$ with $|T| = \left\lceil\frac{4k}{5}\right\rceil$, the unique principal's utility maximizing randomized inspection scheme of instance $\cI_T$ is $\left(g, \alpha=\frac{c(g)}{f(g)}, p\right)$, where $p(S \cup \{x\}) = \frac{1}{2|T|}$, for $S \in \cyclic(T)$, $p(\{x\}) = \frac{2}{3} - \frac{k}{2|T|}$, and $p(\emptyset) = \frac{1}{3}$.

In order to show that the unique optimal inspection scheme is $\cI_T$, we first need to show that it is never more profitable for the principal to incentivize some other action $j$ over action $g$.
To do so,  we bound the utility that the principal can extract from any other action, by the social welfare induced by this action, ignoring incentive-compatibility constraints. In particular, observe that the social welfare of actions $\bot$, $x$ or $i \in [k]$ is respectively $f(\bot) - c(\bot) = 0$, $f(x) - c(x) = \frac{29}{100}$ and $f(i) - c(i) = \frac{19}{100}$.

On the other hand, under inspection scheme $\cI_T$, we have that $p(g) = 0, p(\bot) = 0, p(x) = \frac{2}{3}$ and $p(i) = \frac{1}{2}$. Thus, the agent's best response is to take action $g$ since

\begin{align*}
u_\agent\left(g, \frac{c(g)}{f(g)}, p, \bot\right) &= f(\bot) \cdot \frac{c(g)}{f(g)} \cdot (1 - p(\bot) - p(g)) - c(\bot) = 0\\
u_\agent\left(g, \frac{c(g)}{f(g)}, p, x\right) &= f(x) \cdot \frac{c(g)}{f(g)} \cdot (1 - p(x) - p(g)) - c(x) = \frac{1}{100} - \frac{1}{100} = 0\\
u_\agent\left(g, \frac{c(g)}{f(g)}, p, i\right) &= f(i) \cdot \frac{c(g)}{f(g)} \cdot (1 - p(i) - p(g)) - c(i) = \frac{1}{100} - \frac{1}{100} = 0, ~\forall~i \in [k]\\
u_\agent\left(g, \frac{c(g)}{f(g)}, p, g\right) &= f(g) \cdot \frac{c(g)}{f(g)} - c(g) = 0,
\end{align*}

thus, the agent does not strictly favor any other action over action $g$. Therefore, the principal's utility reads

\begin{align*}
u_{\principal}(g, \alpha, p,g) &= \left(1 - \frac{c(g)}{f(g)}\right) - \left(p(\{x\}) \cdot v(\{x\}) + \sum_{S \in \cyclic(T)} p(S \cup \{x\}) \cdot v(S \cup \{x\})\right)\\
&= \frac{9}{10} - \left(\frac{2}{3} - \frac{k}{2|T|}\right)\cdot\frac{1}{40} - \frac{k}{2|T|}\left(\frac{1}{40} + \frac{1}{80k}\right) \\
&= \frac{53}{60} - \frac{1}{160 \cdot |T|}.
\end{align*}

From above, we see that incentivizing $g$ through inspection scheme $\cI_T$ is always more profitable than incentivizing any other action $j \neq g$, since $\frac{53}{60} - \frac{1}{160 \cdot |T|} > \frac{29}{100} > \frac{19}{100} > 0$ (respectively, the principal's utilities arising by incentivizing actions $x, i\in [k], \bot$).

Our next step is to show that no other inspection scheme $\cI^\prime_T \eqdef (g, \alpha^\prime, p^\prime) \neq \cI_T$ can be optimal. We can assume that $\alpha^\prime \geq \frac{c(g)}{f(g)}$, as otherwise $g$ would not be incentivized since the agent's utility from choosing action $g$ is strictly negative, but from selecting $\bot$ is $0$.
We can also assume that $p^\prime(\bot) = 0$ because it is never profitable to inspect the null action (since it has a strictly positive cost, and the constraint derived from $\bot$ is that the agent's utility from $g$ is non-negative). Moreover, it must be the case that $p^\prime(\{g\})=0$, or else there would exist a distribution $p^{\prime\prime}$ such that $p^{\prime\prime}(\{g\})=0$, $p^{\prime\prime}(\{x\} \cup [k]) = p^{\prime}(\{x\} \cup [k]) + p^\prime(\{g\})$ and $p^{\prime\prime}(S) = p^\prime(S)$ for all other sets, that still incentivizes $g$ but yields better utility to the principal (since $v_T(\{x\}\cup [k]) < v(\{g\})$), contradicting optimality of $\cI^\prime_T$. From the incentive-compatibility constraints, we derive that

\begin{align}\label{eq:constraint-x}
p^\prime(x) &\geq 1 - \frac{\alpha^\prime f(g)-c(g)+c(x)}{\alpha^\prime f(x)}\\
p^\prime(i) &\geq 1 - \frac{\alpha^\prime f(g)-c(g)+c(i)}{\alpha^\prime f(i)},~\forall~i \in [k] \nonumber.
\end{align}

Therefore, since $f(i), c(i)$ are constant across all actions $i \in [k]$, we obtain

\begin{align}\label{eq:constraint}
&k \cdot \left(1 - \frac{\alpha^\prime f(g)-c(g)+c(i)}{\alpha^\prime f(i)}\right) \leq \sum_{i \in [k]} p^\prime(i) = \sum_{i \in [k]}\sum_{S \subseteq A: i \in S} p^\prime(S) \nonumber\\
&\leq (|T|-1) \cdot \underbrace{\sum_{S \subseteq A: 0 < |S \cap [k]| < \frac{4k}{5}} p^\prime(S)}_{=: ~y_1} +~ |T| \cdot \underbrace{\sum_{S \subseteq A: S \cap [k] \in \cyclic(T)} p^\prime(S)}_{=: ~y_2} +~ k \cdot \underbrace{\sum_{\substack{S \subseteq A: |S \cap [k]| \geq \frac{4k}{5}\\ S \cap [k] \notin \cyclic(T)}} p^\prime(S)}_{=: ~y_3},
\end{align}

where the last inequality follows from the definition of marginal probabilities, from partitioning sets into the respective types and upper bounding their cardinalities. We observe that (1) if the principal inspects  $x$ it pays at least $\frac{1}{40}$; (2) if the principal decides to inspect actions from $[k]$, then she pays an additional term that depends on the set of either $\frac{1}{80k}$ or $\frac{1}{40k}$. All in all, the principal's cost (payment plus the inspection cost) is at least

\begin{align}\label{eq:objective}
\alpha^\prime f(g) + \frac{1}{40} \cdot p^\prime(x) + \frac{1}{80k} \cdot (y_1 + y_2) + \frac{1}{40k} \cdot y_3.
\end{align}

In order to lower bound the principal's cost, we simply need to minimize <Ref> subject to constraints in <Ref> and <Ref> as well as the constraints of $\alpha' \geq \frac{c(g)}{f(g)}$, $y_1+y_2+y_3\leq 1$ and $0\leq p'(x),y_1,y_2,y_3\leq 1$.
Let us simplify <Ref> as follows: we first note that in the minimizing solution $y_1 = 0$, as otherwise if one defined $y_1^\prime=0$ and $y_2^\prime=y_2 + \frac{|T|-1}{|T|} \cdot y_1$, $(\alpha^\prime, p^\prime(i), 0, y^\prime_2, y_3)$ would still be feasible and the objective evaluated on this tuple would be strictly smaller than the original one. To show the same with respect to $y_3$, we observe that for $y^\prime_2=\min\{ \frac{k}{2|T|}, y_2 + y_3 \cdot \frac{k}{|T|}\}$, and $y_3^\prime=0$, condition <Ref> holds since either $y_2^\prime =\frac{k}{2|T|}$, and <Ref> holds since $\alpha^\prime \geq \frac{1}{10}$ or $y_2^\prime=y_2 + y_3 \cdot \frac{k}{|T|}$ and <Ref> holds since $y_2^\prime \cdot|T| = y_2 \cdot |T| + y_3 \cdot k$.
It also holds that $y_2^\prime \leq 1$, and thus, for $y_2^\prime= y_2+y_3 \cdot \frac{k}{|T|} \leq 1$, it holds that $(\alpha^\prime, p^\prime(i), 0, y^\prime_2, 0)$ would still be feasible and the objective evaluated on this tuple would be strictly smaller than the original one.

Now, we observe that either $p^\prime(x)=0$, which implies that $\alpha^\prime \cdot f(g) -c(g) \geq \alpha^\prime f(x)-c(x)$, thus $\alpha^\prime \geq \frac{9}{70}$, and $u_\principal(g,\alpha^\prime,p^\prime,g) \leq (1-\alpha^\prime)f(g) \leq \frac{61}{70}$ which is strictly less than the utility of $\cI_T$. Otherwise ($p^\prime(x) > 0$), and <Ref> can be replaced with equality, as we could lower the value of $p^\prime(x)$ (up to equality or $0$) and still be feasible. Similarly, once $y_1=y_3=0$, either $y_2=0$ which implies that $\alpha^\prime \cdot f(g)-c(g) \geq \alpha^\prime f(i) -c(i)$, thus $\alpha^\prime \geq \frac{9}{80}$, and $u_\principal(g,\alpha^\prime,p^\prime,g) \leq (1-\alpha^\prime ) f(g) \leq \frac{71}{80}$, which is strictly less than the utility of $\cI_T$. Thus, also <Ref> can be replaced with equality. Hence, we can write the objective function in <Ref> as

\begin{align*}
&\alpha^\prime f(g) + \frac{1}{40} \cdot \left(1 - \frac{\alpha^\prime f(g)-c(g)+c(x)}{\alpha^\prime f(x)}\right) + \frac{1}{80k} \cdot \frac{k}{|T|} \cdot \left(1 - \frac{\alpha^\prime f(g)-c(g)+c(i)}{\alpha^\prime f(i)}\right) \\
&= \alpha^\prime + \frac{1}{40} \cdot \left(1 - 10\frac{\alpha^\prime -1/10+1/100}{3\alpha^\prime }\right) + \frac{1}{80} \cdot \frac{1}{|T|} \cdot \left(1 - 5\frac{\alpha^\prime-1/10+1/100}{\alpha^\prime}\right)\\
&= \alpha^\prime + \left( \frac{9}{1200} + \frac{9}{1600|T|}\right) \cdot \frac{1}{\alpha^\prime} - \frac{7}{120} - \frac{33}{560|T|}.
\end{align*}

This is minimized, for every $|T|$, at $\alpha^\prime = \frac{1}{10}$. In summary, the unique optimal solution is $\alpha^\prime = \frac{1}{10},~p^\prime(x) = \frac{2}{3},~y_1=y_3=0,~y_2=\frac{k}{2|T|}$.

To achieve this minimal cost, the principal must inspect a non-empty set with a probability of exactly $p'(x)$ (otherwise, the lower bound of <Ref> is not tight), which means that all non-empty sets inspected $S$ with $p^\prime(S)>0$ must contain $x$.

It also must be that each action $i\in [k]$ is inspected with probability $p^\prime(i) \geq \frac{1}{2}$.
For every $S\in \cyclic(T)$, let $P_{S}$ be $p^\prime(S \cup \{x\})$.
To encode $p^\prime(i) \geq \frac{1}{2}$ for all $i \in [k]$, we get the following system of $k$  inequalities in $k$ variables $P_{S}$'s, together with the equality encoding $\sum_{S \in \cyclic(T)} p^\prime(S \cup \{x\}) = \frac{k}{2|T|}$:

\begin{align*}
\text{For all } i\in [k],~ \sum_{S\in \cyclic(T): i\in S}P_{S}  &\geq \frac{1}{2}\\
\sum_{S\in \cyclic(T)} P_{S} &= \frac{k}{2\cdot |T|}.
\end{align*}

Since $k$ is a prime number larger than $5$ (thus $0<|T|<k$), the binary vectors representing $P_S$ for $S\in\cyclic(T)$ are independent vectors (over $\R$) thus, the unique solution is where for all $S\in \cyclic(T)$, $P_{S} = \frac{1}{2|T|}$, and therefore $p^\prime(S \cup \{x\}) = \frac{1}{2|T|}$.

To summarize, in the optimal inspection $\cI^\prime_T$, in order to incentivize action $g$, the principal has to inspect sets such that their intersection with the $k$ bad actions belongs to the cyclic shifts of $T$, i.e., $p^\prime(\{x\}) = \frac{2}{3} - \frac{k}{2|T|}$, $p^\prime(\emptyset) = \frac{1}{3}$ and $p^\prime(S \cup \{x\}) = \frac{1}{2|T|}$ for all $S \in \cyclic(T)$. This implies that $\cI^\prime_T = \cI_T$, which is a contradiction.

$\cI_T$ is, thus, the unique principal's utility maximizing (randomized)  inspection scheme.

Provided that we know what sets belong to the collection $\cyclic(T)$, we can compute the unique optimal inspection scheme $\cI_T$, inspecting each of the $S \in \cyclic(T)$ with probability exactly $\frac{1}{2|T|}$. The vice versa also holds. Hence, finding any set $S \in \cyclic(T)$ via value or demand queries implies finding the unique optimal inspection scheme $\cI_T$ and vice versa.

Given a random hidden set $T \subseteq A$ with $|T| = \left\lceil\frac{4k}{5}\right\rceil$, and  oracle access to function $v_T$, finding any $S \in \cyclic(T)$ requires at least $\left(\frac{5}{4}\right)^k$ value or demand queries to $v_T$.

Let us consider any algorithm that uses value and demand queries to find some set  $S \in \cyclic(T)$. We show that it is possible to modify the algorithm only to use value queries (each demand query can be replaced by a single value query), and still find some set $S \in \cyclic(T)$. Therefore, it is sufficient only to bound the number of value queries that are needed to find some set  $S \in \cyclic(T)$.

First, since $g,\bot$ have an additive value of $1$, we observe that $g,\bot \in D(v_T,q)$ if and only if $q_g \leq 1$ and $q_\bot\leq 1$ respectively, so we can ignore their prices, and find the demand with respect to demand query $q =(q_1,\ldots,q_k,q_x)$.

Now, we can observe that since the image (after ignoring actions $\bot,g$) of $v_T$ is
and since a demand query returns the least expensive set among sets with the same value, we can partition the subsets of $[k]\cup\{x\}$ into four parts with the same value of $v_T$, and the demand set must be one of the cheapest sets within each part.

Let us make the following considerations, given a vector of prices $q=(q_1,\ldots,q_k,q_x)$, and letting $\pi:[k]\rightarrow [k]$ be a permutation that satisfies $q_{\pi(1)} \leq \ldots\leq q_{\pi(k)}$:

* The cheapest set with a value $v_T$ of $0$ is the empty set $\emptyset$ (this is the only set with this value).

* The cheapest set with a value $v_T$ of $\frac{1}{40}$ is $\{x\}$ (this is the only set with this value).

* The cheapest set with a value $v_T$ of $\frac{1}{40}+\frac{1}{80k}$ is $\{\pi(1)\}$.

* If $\{\pi(1),\ldots,\pi(|T|)\} \notin \cyclic(T)$, then the cheapest set with a value $v_T$ of $\frac{1}{40}+\frac{1}{40k}$ is $\{\pi(1),\ldots,\pi(|T|)\}$.

From above, we have that, if $\{\pi(1),\ldots,\pi(|T|)\} \notin \cyclic(T) $ then in order to calculate the demand $D(v_T,q)$, one only needs to know $v_T(\pi(1),\ldots,\pi(|T|))$. Thus, we can modify the original algorithm as follows: Every time the original algorithm asks a demand query to compute $D(v_T,q)$, the modified algorithm asks the value query for the set $\{\pi(1),\ldots,\pi(|T|)\}$. If $v_T(\{\pi(1),\ldots,\pi(|T|)\}) = \frac{1}{40}+\frac{1}{40k}$, it means that $\{\pi(1),\ldots,\pi(|T|)\} \notin \cyclic(T)$, and so the modified algorithm (as well as the original one) keep on interrogating the value (resp. demand) oracle. Otherwise, we have that $\{\pi(1),\ldots,\pi(|T|)\} \in\cyclic(T)$, and the modified algorithm can stop and return this set.

We next lower bound the number of value queries needed for the modified algorithm to find some set $S \in \cyclic(T)$. Note that, all $k$ sets belonging to $\cyclic(T)$ have size $\left\lceil\frac{4k}{5}\right\rceil$ and the number of subsets of $[k]$ of size $\left\lceil\frac{4k}{5}\right\rceil$ is $k \choose \left\lceil\nicefrac{4k}{5}\right\rceil$. Therefore, each value query on sets $S \notin \cyclic(T)$ only reveals the information that sets $S^\prime \in \cyclic(S)$ do not belong to $\cyclic(T)$. In other words, each value query can exclude at most $k$ sets from the search of $\cyclic(T)$. This implies that the expected number of value queries needed to find any set belonging to $\cyclic(T)$ is

\begin{align*}
\sum_{t \in \left[\frac{1}{k} \cdot {k \choose \left\lceil\nicefrac{4k}{5}\right\rceil}\right]} \frac{k}{{k \choose \left\lceil\nicefrac{4k}{5}\right\rceil} - (t-1)\cdot k} \cdot t &\geq \frac{1}{k} \cdot \left({k \choose \left\lceil\nicefrac{4k}{5}\right\rceil} + k\right) \cdot \left(H\left(\frac{{k \choose \left\lceil\nicefrac{4k}{5}\right\rceil}}{k}\right) - 1\right)\\
&\geq \frac{1}{k} \cdot \left(\frac{5}{4}\right)^k,
\end{align*}

where we have used that ${v \choose b} \geq \left(\frac{v}{b}\right)^b$, and the fact that $k$ is large enough. This concludes the proof.

In summary, <Ref> shows that for the constructed XOS inspection cost function (which is XOS by <Ref>), the unique optimal inspection scheme has to inspect according to $\cI_T$. Due to <Ref>, we know that computing the optimal inspection scheme is as hard as finding (through value or demand queries) any set in $\cyclic(T)$. Finally, <Ref> shows that the number of value or demand queries to $v_T$ that is needed for finding a set in $\cyclic(T)$, is exponential in the number of actions $n$. This concludes the proof of <Ref>.

§ DISCUSSION

We introduce a principal-agent model that relaxes the hidden-action assumption and that allows the principal to incentivize the agent through both positive incentives (payments) and negative incentives (inspections).
To begin our analysis, we focus on deterministic IC inspection schemes where the principal inspects a subset of actions with certainty. We demonstrate that finding the best deterministic IC inspection scheme can be done efficiently for all (monotone) cost functions.
However, committing to deterministic inspection schemes can lead to significantly reduced utilities. As a result, we explore the use of randomized inspection schemes, which are commonly employed in practice. We then provide an efficient method for determining the optimal randomized IC inspection scheme when the inspection cost function is submodular.
We complement our positive result by showing that the problem becomes intractable when dealing with XOS inspection cost functions. This highlights the class of submodular functions as the boundary of tractability for this problem.

Although our negative result for XOS functions indicates that finding the exact optimum is not possible, it still allows for the potential of efficiently approximating the optimal solution. Exploring the approximation version of this problem, especially when inspection cost functions are XOS or subadditive, holds promise for future research.
While our work primarily focuses on the principal suggesting a single action, an intriguing direction for further exploration would involve considering scenarios where the principal can suggest a subset of actions. Furthermore, investigating the contract with inspections model in the presence of non-binary outcomes, an agent that can choose subsets of actions, multiple agents working on the same project, or hidden types would provide interesting avenues for future study.

§ ACKNOWLEDGMENTS

Stefano Leonardi and Matteo Russo are partially supported by the ERC Advanced Grant 788893 AMDROMA “Algorithmic and Mechanism Design Research in Online Markets” and MIUR PRIN project ALGADIMAR “Algorithms, Games, and Digital Markets”.
Tomer Ezra is supported by the Harvard University Center of Mathematical Sciences and Applications.

[Alon et al., 2021]
T. Alon, P. Dütting, and I. Talgam-Cohen.
Contracts with private cost per unit-of-effort.
In EC, pages 52–69. ACM, 2021a.

[Alon et al., 2021]
T. Alon, R. Lavi, E. S. Shamash, and I. Talgam-Cohen.
Incomplete information VCG contracts for common agency.
In EC, page 70. ACM, 2021b.

[Alon et al., 2023]
T. Alon, P. Duetting, Y. Li, and I. Talgam-Cohen.
Bayesian analysis of linear contracts.
In EC, page 66. ACM, 2023.

[Assadi et al., 2021]
S. Assadi, T. Kesselheim, and S. Singla.
Improved truthful mechanisms for subadditive combinatorial auctions:
Breaking the logarithmic barrier.
In SODA, pages 653–661. SIAM, 2021.

[Babaioff et al., 2012]
M. Babaioff, M. Feldman, N. Nisan, and E. Winter.
Combinatorial agency.
J. Econ. Theory, 1470 (3):0 999–1034, 2012.

[Ball and Knoepfle, 2023]
I. Ball and J. Knoepfle.
Should the timing of inspections be predictable?
In EC, page 206. ACM, 2023.

[Carroll, 2015]
G. Carroll.
Robustness and linear contracts.
American Economic Review, 1050 (2):0 536–63,

[Castiglioni et al., 2022]
M. Castiglioni, A. Marchesi, and N. Gatti.
Bayesian agency: Linear versus tractable contracts.
Artif. Intell., 307:0 103684, 2022a.

[Castiglioni et al., 2022]
M. Castiglioni, A. Marchesi, and N. Gatti.
Designing menus of contracts efficiently: The power of randomization.
In EC, pages 705–735. ACM, 2022b.

[Castiglioni et al., 2023]
M. Castiglioni, A. Marchesi, and N. Gatti.
Multi-agent contract design: How to commission multiple agents with
individual outcomes.
In EC, pages 412–448. ACM, 2023.

[Correa and Cristi, 2023]
J. R. Correa and A. Cristi.
A constant factor prophet inequality for online combinatorial
In STOC, pages 686–697. ACM, 2023.

[Dai and Toikka, 2022]
T. Dai and J. Toikka.
Robust incentives for teams.
Econometrica, 900 (4):0 1583–1613, 2022.

[Deo-Campo Vuong et al., 2024]
R. Deo-Campo Vuong, S. Dughmi, N. Patel, and A. Prasad.
On supermodular contracts and dense subgraphs.
In Proceedings of the 2024 Annual ACM-SIAM Symposium on
Discrete Algorithms (SODA), pages 109–132. SIAM, 2024.

[Dobzinski et al., 2005]
S. Dobzinski, N. Nisan, and M. Schapira.
Approximation algorithms for combinatorial auctions with
complement-free bidders.
In STOC, pages 610–618. ACM, 2005.

[Dütting et al., 2019]
P. Dütting, T. Roughgarden, and I. Talgam-Cohen.
Simple versus optimal contracts.
In EC, pages 369–387. ACM, 2019.

[Dütting et al., 2021]
P. Dütting, T. Ezra, M. Feldman, and T. Kesselheim.
Combinatorial contracts.
In FOCS, pages 815–826. IEEE, 2021a.

[Dütting et al., 2021]
P. Dütting, T. Roughgarden, and I. Talgam-Cohen.
The complexity of contracts.
SIAM J. Comput., 500 (1):0 211–254,

[Dütting et al., 2023]
P. Dütting, T. Ezra, M. Feldman, and T. Kesselheim.
Multi-agent contracts.
In STOC, pages 1311–1324. ACM, 2023.

[Dutting et al., 2024]
P. Dutting, M. Feldman, and Y. Gal Tzur.
Combinatorial contracts beyond gross substitutes.
In Proceedings of the 2024 Annual ACM-SIAM Symposium on
Discrete Algorithms (SODA), pages 92–108. SIAM, 2024.

[Emek and Feldman, 2012]
Y. Emek and M. Feldman.
Computing optimal contracts in combinatorial agencies.
Theor. Comput. Sci., 452:0 56–74, 2012.

[Ezra et al., 2024]
T. Ezra, M. Feldman, and M. Schlesinger.
On the (In)approximability of Combinatorial Contracts.
In 15th Innovations in Theoretical Computer Science Conference
(ITCS 2024), volume 287, pages 44:1–44:22. Schloss Dagstuhl –
Leibniz-Zentrum für Informatik, 2024.

[Fallah and Jordan, 2023]
A. Fallah and M. I. Jordan.
Contract design with safety inspections.
CoRR, abs/2311.02537, 2023.

[Feldman et al., 2015]
M. Feldman, N. Gravin, and B. Lucier.
Combinatorial auctions via posted prices.
In SODA, pages 123–135. SIAM, 2015.

[Gottlieb and Moreira, 2022]
D. Gottlieb and H. Moreira.
Simple contracts with adverse selection and moral hazard.
Theoretical Economics, 170 (3):0 1357–1401,

[Grossman and Hart, 1983]
S. J. Grossman and O. D. Hart.
An analysis of the principal-agent problem.
Econometrica, 510 (1):0 7–45, 1983.

[Guruganesh et al., 2021]
G. Guruganesh, J. Schneider, and J. R. Wang.
Contracts under moral hazard and adverse selection.
In EC, pages 563–582. ACM, 2021.

[Ho et al., 2016]
C. Ho, A. Slivkins, and J. W. Vaughan.
Adaptive contract design for crowdsourcing markets: Bandit algorithms
for repeated principal-agent problems.
J. Artif. Intell. Res., 55:0 317–359, 2016.

[Holmstrom and Milgrom, 1987]
B. Holmstrom and P. Milgrom.
Aggregation and linearity in the provision of intertemporal
Econometrica, 550 (2):0 303–328, 1987.

[Holmstrom and Milgrom, 1991]
B. Holmstrom and P. Milgrom.
Multitask principal-agent analyses: Incentive contracts, asset
ownership, and job design.
Journal of Law, Economics, and Organization, 7:0
24–52, 1991.

[Kambhampati, 2023]
A. Kambhampati.
Randomization is optimal in the robust principal-agent problem.
Journal of Economic Theory, 2070 (C), 2023.

[Kelso and Crawford, 1982]
A. S. Kelso and V. P. Crawford.
Job matching, coalition formation, and gross substitutes.
Econometrica, 500 (6):0 1483–1504, 1982.

[Lavi and Shamash, 2022]
R. Lavi and E. S. Shamash.
Principal-agent VCG contracts.
J. Econ. Theory, 201:0 105443, 2022.

[Lehmann et al., 2006]
B. Lehmann, D. Lehmann, and N. Nisan.
Combinatorial auctions with decreasing marginal utilities.
Games Econ. Behav., 550 (2):0 270–296, 2006.

[Walton and Carroll, 2022]
D. Walton and G. Carroll.
A general framework for robust contracting models.
Econometrica, 900 (5):0 2129–2159, 2022.

[Yu and Kong, 2020]
Y. Yu and X. Kong.
Robust contract designs: Linear contracts and moral hazard.
Oper. Res., 680 (5):0 1457–1473, 2020.

[Zhu et al., 2023]
B. Zhu, S. Bates, Z. Yang, Y. Wang, J. Jiao, and M. I. Jordan.
The sample complexity of online contract design.
In EC, page 1188. ACM, 2023.

§ GAPS BETWEEN RANDOMIZED AND DETERMINISTIC INSPECTION SCHEMES

In spite of their convenient structural properties, such as computational tractability in finding them, deterministic inspection schemes can be much worse than randomized ones. In particular, we extend <Ref> and show that the principal's utility gap between deterministic and randomized inspection schemes can grow as the instance size grows. Formally, we prove the following result:

There exists an instance $(A, f, c, v)$, and an IC randomized inspection scheme $(i, \alpha, p)$ such that for every deterministic IC inspection scheme $(i^\prime,\alpha^\prime,S)$, it holds that

\begin{align*}
u_\principal(i^\prime,\alpha^\prime,S,i^\prime) &\leq \frac{4}{n} \cdot u_\principal(i, \alpha, p, i).
\end{align*}

We present the following instance (<Ref>) where $v:2^A \rightarrow \R_{\geq 0}$ is $v(S) = |S| \cdot \frac{n}{2^n}$, and $f,c$ are defined in the following table:

$A$     $f$     $c$
$\bot$     $0$     $0$

$1$     $\frac{4}{2^n}$     $\frac{2}{2^n}$

$\vdots$     $\vdots$     $\vdots$

$i$     $\frac{2^{i+1}}{2^n}$     $\frac{2^{i+1}-i-1}{2^n}$

$\vdots$     $\vdots$     $\vdots$

$n-1$     $1$     $\frac{2^n-n}{2^n}$

Instance exhibiting $\Omega(n)$ gap between deterministic and randomized inspection schemes.
Similar instances have been used to study various other types of gaps between optimal contract vs optimal linear contract (in different settings) for example, in [Dütting et al., 2019, Guruganesh et al., 2021].

We first show that the best deterministic inspection scheme never inspects (i.e., always inspects the empty set). Indeed, any deterministic inspection scheme that inspects a non-empty set must pay at least $\frac{n}{2^n}$, since $v(S) \geq  \frac{n}{2^n}$ for all $S \neq \emptyset$. Since the maximal social welfare arising from the instance (when ignoring incentive constraints) is in correspondence of action $n-1$ and equals $\frac{n}{2^n}$, then the highest expected reward minus payment to an agent a deterministic inspection can extract from the instance is bounded above by the social welfare. This means that the utility by inspecting some non-empty set is at most $0$.

Hence, since the principal does not inspect, we have, by the incentive-compatibility constraints, that if the principal wants to incentivize the agent to take action $j \neq \bot $, then it must hold that:
$$\alpha \cdot \frac{2^{j+1}}{2^n} - \frac{2^{j+1} - j -1}{2^n} \geq \alpha \cdot \frac{2^j}{2^n} - \frac{2^j - j}{2^n},$$
which by rearranging gives us that  $\alpha \geq 1 - \frac{1}{2^j}$. Thus, the utility from incentivizing action $j$ is  at most $(1-\alpha)f(j) = \frac{1}{2^j} \cdot \frac{2^{j+1}}{2^n} = \frac{2}{2^n}$.

On the other hand, let us consider the randomized IC inspection scheme  with suggested action $n-1$, with contract $\alpha = 1 - \frac{n}{2^n}$, and $p(\emptyset) = \frac{1}{2},~p(\{n-1\}) = \frac{1}{2}$ as our randomized inspection distribution. The utility of the agent for action $n-1$ is $\alpha \cdot f(n-1) -c(n-1) =0$, while for every other action $j\neq \bot,n-1$, we have that

\begin{align*}
u_\agent(n-1,\alpha,p,j) = \alpha f(j) \cdot \left(1 - p(n-1) - p(j)\right) - c(j) = \left(1-\frac{n}{2^n}\right) \cdot   \frac{2^{j+1}} {2^n} \cdot \frac{1}{2}  - \frac{2^j-j}{2^n} \leq  0
\end{align*}

Hence, the agent is incentivized to take action $n-1$. Thus, the principal gets

\[
u_\principal\left(n-1, 1 - \frac{n}{2^n}, \left(p(\emptyset) = \frac{1}{2},~p(\{n-1\}) = \frac{1}{2}\right), n-1\right) = \frac{n}{2^n} \cdot 1 - \frac{1}{2} \cdot \frac{n}{2^n} = \frac{n}{2^{n+1}},
\]

which concludes the proof.

The instance presented in <Ref> can be easily modified to have $v(S)=0$ for all $S \subseteq A$, implying that the gap in principal's utility between no inspection and best deterministic inspection can also be at least $\Omega(n)$.

§ NON INCENTIVE-COMPATIBLE INSPECTION SCHEMES

In the main body of the paper, we focused on incentive-compatible inspection schemes. Indeed, we observe that the principal may propose an inspection scheme $(j, \alpha, p)$  so as to cause the agent to best respond by some other action $i \neq j$: We call these types of inspection schemes non-incentive-compatible (non-IC).

We show that, for deterministic inspection, IC inspection schemes are without loss of generality in that they can extract at least as much utility as non-IC inspection schemes.

For every instance $(A,c,f,v)$, and every deterministic non-incentive-compatible inspection scheme $(j, \alpha, S)$ with agent's best response $i$, there exists a deterministic incentive-compatible inspection scheme $(i', \alpha', S')$ with agent's best response $i'$ yielding at least as much utility for the principal.

Let us consider a non-incentive-compatible inspection scheme $(j, \alpha, S)$ inducing the agent to take action $i \neq j$ as the best response.

If $\{i,j\} \cap S \neq \emptyset$ (i.e., at least one of $i,j$ is inspected), then we know that the principal pays the agent $0$, which means that her incurred cost $c(i)$ is $0$. Therefore, the principal could simply suggest action $i$, offer $\alpha=0$, and inspect set $S$, and the agent's best response would still be $i$. This means that the deterministic incentive-compatible inspection scheme $(i, 0, S)$ still induces the agent's best response to be $i$, and thus achieves the same utility as the non-incentive-compatible one.

Otherwise, $\{i,j\} \cap S = \emptyset$, and we have that $u_\agent(j,\alpha ,S,\ell) = u_\agent(i,\alpha ,S,\ell)$ for every $\ell \in A$. Thus $i$ is also the best response to  $(i,\alpha,S)$.

For randomized inspection schemes, the same does not hold, as the next example demonstrates.

Let us consider the following instance with three actions $A = \{\bot, 1, 2\}$: $c(\bot)=0,~f(\bot)=0,~c(1)=\frac{1}{10},~f(1)=\frac{2}{5},~c(2)=\frac{1}{2},~f(2)=1$, and the additive inspection cost function  $v(S) \eqdef \frac{3}{10} \cdot \ind{1\in S} + 2 \cdot \ind{2\in S}  $.

* Under no inspection, the best the principal can do is incentivizing action $2$ by offering $\alpha=\frac{2}{3}$, which yields a utility of $\frac{1}{3}$. Note that the utility from incentivizing action $1$ is $\frac{3}{10} < \frac{1}{3}$.

* The best randomized incentive-compatible inspection scheme for the principal is to suggest action $2$ and solve the following program:

\begin{align*}
\min_{\alpha, p(1), p(2)} &\alpha + p(1) \cdot \frac{3}{10} + p(2) \cdot 2\\
\emph{s.t. }  &\alpha - \frac{1}{2} \geq \alpha \cdot \frac{2}{5} \cdot (1-p(1)-p(2)) - \frac{1}{10}\\
&\alpha \geq \frac{1}{2}\\
&0\leq p(1), p(2) \leq 1.
\end{align*}

Hence, $\alpha \approx 0.548$, $p(1) \approx 0.326$,  and $p(2)=0$, yielding a principal's utility of approximately $0.355$. This is the best IC-inspection scheme since an IC-inspection scheme that incentivizes action $\bot$ (respectively, $1$) cannot give the principal a utility that is better than $f(\bot)-c(\bot)=0$ (respectively, $f(1)-c(1)=\frac{3}{10}$).

* Let us consider the randomized non-incentive-compatible inspection scheme $(\bot, 1, p)$, where $p(\{\bot\})=\frac{1}{2}$, $p(\{1\}) =\frac{1}{4}$, and $p(\emptyset)=\frac{1}{4}$. Then, the agent's utility from taking each of the three actions is:

\begin{align*}
u_\agent(\bot, 1, p, \bot) &= 0,\\
u_\agent(\bot, 1, p, 1) &= \frac{2}{5} \cdot \frac{1}{4} - \frac{1}{10} = 0,\\
u_\agent(\bot, 1, p, 2) &= \frac{1}{2} - \frac{1}{2} = 0.
\end{align*}

From above, we see that action $2$ is in the agent's best response set with respect to inspection scheme $(\bot, 1, p)$. The principal pays $1$ to the agent only with probability $\frac{1}{2}$ (the probability the agent is not caught taking an action different from $\bot$), and incurs an inspection cost of $\frac{3}{10}$ (for inspecting action $1$) only with probability $\frac{1}{4}$. All in all, the principal has utility $\frac{1}{2} - \frac{3}{40} = 0.425 > 0.355$.
If the principal pays $1+\varepsilon$ instead of $1$, then the unique best response for the agent is to take action $2$.